Align text section ends so that stub tables appears at expected addresses.
[external/binutils.git] / gold / ChangeLog
1 2015-06-29  Doug Kwan  <dougkwan@google.com>
2
3         * testsuite/arm_bl_out_of_range.s: Align stub table so that it appears
4           at address expected by test.
5         * testsuite/arm_cortex_a8_b.s: Ditto.
6         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
7         * testsuite/arm_cortex_a8_bl.s: Ditto.
8         * testsuite/arm_cortex_a8_blx.s: Ditto.
9         * testsuite/arm_cortex_a8_local.s: Ditto.
10         * testsuite/arm_fix_v4bx.s: Ditto.
11         * testsuite/arm_unaligned_reloc.s: Ditto.
12         * testsuite/thumb_bl_out_of_range.s: Ditto.
13         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
14         * testsuite/thumb_blx_out_of_range.s: Ditto.
15         
16 2015-06-29  Han Shen  <shenhan@google.com>
17
18         Patch for erratum 843419 internal error.
19
20         * AArch64.cc (Erratum_stub::Insn_utilities): New typedef.
21         (Erratum_stub::update_erratum_insn): New method.
22         (Stub_table::relocate_stubs): Modified to place relocated insn.
23         (AArch64_relobj::fix_errata): Modified gold_assert.
24
25 2015-06-12  Han Shen  <shenhan@google.com>
26
27         Fix erratum 835769.
28
29         * aarch64.cc (AArch64_insn_utilities::BYTES_PER_INSN): Move
30         defintion outside class definition.
31         (AArch64_insn_utilities::AARCH64_ZR): New static constant.
32         (AArch64_insn_utilities::aarch64_op31): New member.
33         (AArch64_insn_utilities::aarch64_ra): New member.
34         (AArch64_insn_utilities::aarch64_mac): New member.
35         (AArch64_insn_utilities::aarch64_mlxl): New member.
36         (ST_E_835769): New global enum member.
37         (Stub_table::relocate_stubs): Add 835769 handler.
38         (Stub_template_repertoire::Stub_template_repertoire): Install new
39         stub type.
40         (AArch64_relobj::scan_errata): This func is renamed from
41         scan_erratum_843419.
42         (AArch64_relobj::do_count_local_symbols): Add 835769 handler.
43         (AArch64_relobj::do_relocate_sections): Add 835769 handler.
44         (AArch64_relobj::scan_sections_for_stubs): Add 835769 handler.
45         (Target_aarch64::scan_erratum_835769_span): New method.
46         (Target_aarch64::create_erratum_stub): New method.
47         (Target_aarch64::is_erratum_835769_sequence): New method.
48         (Target_aarch64::scan_erratum_843419_sequence): Move part of the
49         code into create_erratum_stub.
50         * options.h (fix_cortex_a53_835769): New option.
51
52 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
53
54         * aarch64.cc (Erratum_stub::STUB_ADDR_ALIGN): Move initialization
55         outside class body.
56         (Reloc_stub::STUB_ADDR_ALIGN): Likewise.
57
58 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
59
60         PR gold/17731
61         * layout.cc (corresponding_uncompressed_section_name): New function.
62         (Layout::choose_output_section): Call it.
63         * layout.h (corresponding_uncompressed_section_name): New function.
64         * script-sections.cc (Input_section_info::set_section_name): Check
65         for compressed debug section (.zdebug style).
66
67 2015-06-11  Jing Yu  <jingyu@google.com>
68
69         * testsuite/Makefile.am: Add -O0 for script_test_12 test.
70         * testsuite/Makefile.in: Regenerate.
71
72 2015-06-11  Davide Italiano  <dccitaliano@gmail.com>
73
74         * gold.h (is_cident): Correct typo.
75
76 2015-06-10  Han Shen  <shenhan@google.com>
77         Patch for erratum-843419 (2 of 2 - fix erratum occurrences).
78
79         Now fixing for 843419 is fully functional.
80
81         The first part of the erratum fix CL is here -
82         https://sourceware.org/ml/binutils/2015-04/msg00229.html
83
84         * aarch64.cc(global enum): New constants representing stub types.
85         (Stub_template): New POD struct.
86         (Stub_template_repertoire): New class.
87         (Stub_base): New class.
88         (Erratum_stub): New class.
89         (Reloc_stub): Refactored to be a subclass of Stub_base.
90         (Reloc_stub::Stub_type): Removed.
91         (Reloc_stub::offset): Moved to Stub_base.
92         (Reloc_stub::set_offset): Moved to Stub_base.
93         (Reloc_stub::destination_address): Moved to Stub_base.
94         (Reloc_stub::set_destination_address): Moved to Stub_base.
95         (Reloc_stub::reset_destination_address): Moved to Stub_base.
96         (Reloc_stub::stub_type): Renamed and moved to Stub_base.
97         (Reloc_stub::stub_size): Renamed and moved to Stub_base.
98         (Reloc_stub::stub_insns): Renamed and moved to Stub_base.
99         (Reloc_stub::write): Moved to Stub_base.
100         (Reloc_stub::invalid_offset): Moved to Stub_base.
101         (Reloc_stub::invalid_address): Moved to Stub_base.
102         (Reloc_stub::stub_type_): Renamed and moved to Stub_base.
103         (Reloc_stub::stub_insns_): Moved to Stub_base.
104         (Reloc_stub::offset_): Moved to Stub_base.
105         (Reloc_stub::destination_address_): Moved to Stub_base.
106         (Stub_table::The_aarch64_relobj): New typedef.
107         (Stub_table::The_erratum_stub): New typedef.
108         (Stub_table::The_erratum_stub_less): New typedef.
109         (Stub_table::The_erratum_stub_set): New typedef.
110         (Stub_table::The_erratum_stub_set_iter): New typedef.
111         (Stub_table::empty): Added emptiness testing for erratum stubs.
112         (Stub_table::add_erratum_stub): New method to add an erratum stub.
113         (Stub_table::find_erratum_stub): New method.
114         (Stub_table::find_erratum_stubs_for_input_section): New method.
115         (Stub_table::erratum_stub_address): New method.
116         (Stub_table::update_date_size_changed_p): Modified to handle erratum stubs.
117         (Stub_table::do_addralign): Modified to handle erratum stubs.
118         (Stub_table::erratum_stubs_): New member.
119         (Stub_table::erratum_stub_size_): New member.
120         (Stub_table::relocate_stubs): Modified to handle erratum stubs.
121         (Stub_table::do_write): Modified to handle erratum stubs.
122         (AArch64_relobj::The_erratum_stub): New typedef.
123         (AArch64_relobj::Erratum_stub_set_iter): New typedef.
124         (AArch64_relobj::fix_errata): New method.
125         (Target_aarch64::The_reloc_stub_type): Removed.
126         (Target_aarch64::The_erratum_stub): New typede.
127         (AArch64_relocate_functions::construct_b): New method.
128
129 2015-06-08  Nick Clifton  <nickc@redhat.com>
130
131         * po/fr.po: New French Translation.
132
133 2015-06-07  Cary Coutant  <ccoutant@gmail.com>
134
135         PR gold/18288
136         * resolve.cc (symbol_to_bits): Remove type parameter; adjust all
137         callers. Don't use STT_COMMON to check for common symbols.
138         (Symbol_table::resolve): Warn if relocatable object has STT_COMMON
139         symbol that's not in a common section.
140         * symtab.h (Symbol::is_common): Don't use STT_COMMON to check for
141         common symbols.
142
143 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
144
145         PR gold/18200
146         * Makefile.am (diststuff): Add target.
147         * Makefile.in: Regenerate.
148
149 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
150
151         PR gold/17498
152         * object.cc (Sized_relobj_file::do_count_local_symbols): Discard
153         temporary locals in merge sections.
154         * options.cc (General_options::parse_discard_all): New method.
155         (General_options::parse_discard_locals): New method.
156         (General_options::parse_discard_none): New method.
157         (General_options::General_options): Initialize discard_locals_.
158         * options.h (--discard-all): Convert to special option.
159         (--discard-locals): Likewise.
160         (--discard-none): New option.
161         (General_options::discard_all): New method.
162         (General_options::discard_locals): New method.
163         (General_options::discard_sec_merge): New method.
164         (General_options::Discard_locals): New enum.
165         (General_options::discard_locals_): New data member.
166
167 2015-06-03  Cary Coutant  <cary@google.com>
168
169         * script-sections.cc (Script_sections::Script_sections): Initialize
170         segments_created_.
171         (Script_sections::create_note_and_tls_segments): Set flag when
172         segments are created.
173         (Script_sections::expected_segment_count): Count PT_INTERP.
174         (Script_sections::attach_sections_using_phdrs_clause): Set flag when
175         segments are created.
176         * script-sections.h (Script_sections::segments_created_): New data
177         member.
178
179 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
180
181         PR gold/15370
182         * script-sections.cc
183         (Output_section_element_input::set_section_addresses): When there
184         are several patterns with no sort spec, put all sections in the same
185         bin.
186         * testsuite/Makefile.am (script_test_12): New testcase.
187         (script_test_12i): New testcase.
188         * testsuite/Makefile.in: Regenerate.
189         * testsuite/script_test_12.t: New test linker script.
190         * testsuite/script_test_12i.t: New test linker script.
191         * testsuite/script_test_12a.c: New test source file.
192         * testsuite/script_test_12b.c: New test source file.
193
194 2015-06-02  Cary Coutant  <ccoutant@gmail.com>
195
196         * nacl.h (Sniff_file): Switch parameters to get_view to get an
197         aligned view.
198
199 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
200
201         PR gold/17819
202         * gold.cc (queue_final_tasks): When --build-id=tree, queue a
203         separate task to schedule the build id computation.
204         * layout.cc (Hash_task::Hash_task): Remove build_id_blocker,
205         add Output_file and offset.
206         (Hash_task::run): Get and release the input views.
207         (Hash_task::is_runnable): Always return NULL (always runnable).
208         (Layout::queue_build_id_tasks): Remove.
209         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
210         parameters; use them instead of class members.
211         (Build_id_task_runner::run): New function.
212         (Close_task_runner::run): Pass array_of_hashes and size_of_hashes
213         to write_build_id.
214         * layout.h (Layout::queue_build_id_tasks): Remove.
215         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
216         parameters.
217         (Layout::array_of_hashes_): Remove.
218         (Layout::size_of_array_of_hashes_): Remove.
219         (Layout::input_view_): Remove.
220         (Build_id_task_runner): New class.
221         (Close_task_runner::Close_task_runner): Add array_of_hashes and
222         size_of_hashes parameters.
223         (Close_task_runner::array_of_hashes_): New data member.
224         (Close_task_runner::size_of_hashes_): New data member.
225         * testsuite/Makefile.am
226         (flagstest_compress_debug_sections_and_build_id_tree): New test.
227         * testsuite/Makefile.in: Regenerate.
228
229 2015-06-01  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
230
231         * merge.cc (get_input_merge_map): Update for data structure change.
232         (get_or_make_input_merge_map): Update for data structure change.
233         * merge.h (Object_merge_map): Use a std::vector<std::pair>> instead of
234         a std::map. Remove first_shnum_, first_map_, second_shnum_, second_map_.
235
236 2015-05-16  Alan Modra  <amodra@gmail.com>
237
238         * reloc.cc (Sized_relobj_file::find_functions): Use function_location.
239         * powerpc.cc (Target_powerpc::do_calls_non_split): New function.
240         (addi_12_1, addis_2_12, addis_12_1, cmpld_7_12_0): New constants.
241         (lis_0): Rename from lis_0_0.
242
243 2015-04-29  Cary Coutant  <cary@google.com>
244             Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
245
246         * gc.h (Garbage_collection::is_section_garbage): Change Object*
247         to Relobj*.
248         (Garbage_collection::add_reference): Likewise.
249         (Garbage_collection::gc_process_relocs): Likewise. Don't push
250         object/shndx pair onto *secvec for dynamic objects. Don't follow
251         relocations pointing to dynamic objects for GC.
252         * icf.cc (Icf::find_identical_sections): Change Object* to Relobj*.
253         (Icf::unfold_section): Likewise.
254         (Icf::is_section_folded): Likewise.
255         (Icf::get_folded_section): Likewise.
256         * icf.h: (Icf::get_folded_section): Likewise.
257         (Icf::unfold_section): Likewise.
258         (Icf::is_section_folded): Likewise.
259         (Icf::section_has_function_pointers): Likewise.
260         (Icf::set_section_has_function_pointers): Likewise.
261         * object.h (Section_id): Likewise.
262         (Const_section_id): Likewise.
263         * output.cc (Output_section::update_section_layout): Likewise.
264         * output.h: (Output_section_lookup_maps::find_relaxed_input_section):
265         Likewise.
266         * plugin.cc (update_section_order): Likewise.
267         (unique_segment_for_sections): Likewise.
268         * powerpc.cc (Powerpc_relobj::add_reference): Likewise.
269         (Target_powerpc::do_gc_add_reference): Likewise.
270         (Target_powerpc::gc_process_relocs): Likewise.
271         (Target_powerpc::do_gc_add_reference): Likewise.
272         * symtab.cc (Symbol_table::is_section_folded): Likewise.
273         (Symbol_table::gc_mark_symbol): Likewise.
274         * symtab.h: (Symbol_table::is_section_folded): Likewise.
275         * target.h: (Sized_target::gc_add_reference): Likewise.
276         (Sized_target::do_gc_add_reference): Likewise.
277
278 2015-04-29  Nick Clifton  <nickc@redhat.com>
279
280         * po/fi.po: Updated Finnish translation.
281
282 2015-04-28  Alan Modra  <amodra@gmail.com>
283
284         * powerpc.cc (Target_powerpc::do_dynsym_value): Use Address rather
285         than unsigned int for find_global_entry result temp.  Compare
286         against invalid_address.
287         (Target_powerpc::do_plt_address_for_global): Likewise.
288         (Target_powerpc::Relocate::relocate): Likewise.  Don't assert
289         on plt call stub existence for debug info.  Do assert for plt
290         and global entry stub existence if an alloc section.
291
292 2015-04-28  Alan Modra  <amodra@gmail.com>
293
294         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't assert
295         on missing global entry stub due to bogus debug info.
296
297 2015-04-27  Han Shen  <shenhan@google.com>
298
299         * options.h (--fix-cortex-a53-843419): Rename option.
300         * aarch64.cc (AArch64_relobj::do_count_local_symbols): Use renamed
301         option.
302         (AArch64_relobj::scan_sections_for_stubs): Use renamed option.
303
304 2015-04-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
305
306         PR gold/18327
307         * output.cc (Output_section::is_input_address_mapped): Assume a missing
308         entry is mapped.
309         * testsuite/Makefile.am: Add the eh_test test.
310         * testsuite/Makefile.in: Regenerate.
311         * testsuite/eh_test_a.cc: New test.
312         * testsuite/eh_test_b.cc: New test.
313
314 2015-04-23  Sriraman Tallam  <tmsriram@google.com>
315
316         * options.h (--weak-unresolved-symbols): New option.
317         * symtab.cc (Symbol_table::sized_write_globals): Change symbol
318         binding to weak with new option.
319         * symtab.h (is_weak_undefined): Check for new option.
320         (is_strong_undefined): Check for new option.
321         * testsuite/Makefile.am (weak_unresolved_symbols_test): New test.
322         * testsuite/Makefile.in: Regenerate.
323         * testsuite/weak_unresolved_symbols_test.cc: New file.
324
325 2015-04-20  Ian Coolidge  <icoolidge@google.com>
326
327         * symtab.cc (Symbol::should_add_dynsym_entry): Return true for
328         GNU_UNIQUE.
329
330 2015-04-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
331
332         * gc.cc (Garbage_collection::do_transitive_closure): Use back and
333         push_back.
334         * gc.h (Garbage_collection): Use a std::vector instead of a std::queue.
335         * object.cc (Sized_relobj_file::do_layout): Use push_back.
336         * powerpc.cc (process_gc_mark): Use push_back.
337         (Target_powerpc::do_gc_mark_symbol): Use push_back.
338         * symtab.cc (Symbol_table::gc_mark_symbol): Use push_back.
339
340 2015-04-16  Han Shen  <shenhan@google.com>
341
342         * aarch64.cc (AArch64_insn_utilities): New utility class.
343         (AArch64_relobj::Mapping_symbol_position): New struct.
344         (AArch64_relobj::Mapping_symbol_info): New typedef.
345         (AArch64_relobj::do_count_local_symbols): New function overriding
346         parent's implementation.
347         (AArch64_relobj::mapping_symbol_info_): New member
348         (AArch64_relobj::scan_erratum_843419): New method.
349         (Target_aarch64::scan_erratum_843419_span): New method.
350         (Target_aarch64::is_erratum_843419_sequence): New method.
351         * options.h (fix_cortex_a53): New option.
352
353 2015-04-09  Cary Coutant  <ccoutant@google.com>
354
355         * symtab.cc (Symbol::final_value_is_known): Check for TLS symbol
356         in a PIE link.
357         * testsuite/Makefile.am (tls_pie_test.sh): New test.
358         * testsuite/Makefile.in: Regenerate.
359         * testsuite/tls_pie_test.sh: New.
360
361 2015-04-09  Cary Coutant  <ccoutant@google.com>
362
363         * debug.h (DEBUG_LOCATION): New.
364         (DEBUG_ALL): Include DEBUG_LOCATION.
365         (debug_string_to_enum): Add DEBUG_LOCATION.
366         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug
367         output to print correct context.
368         (Sized_dwarf_line_info::do_addr2line): Add debug output. Return
369         up to 4 more locations at the beginning of the function.
370         * symtab.cc (Symbol_table::detect_odr_violations): Get canonical
371         result before sorting list of line numbers.
372         * testsuite/debug_msg.sh: Allow range of line numbers for
373         canonical results on optimized code.
374
375 2015-04-07  HC Yen <hc.yen@mediatek.com>
376
377         Add AArch32 support for gold linker.
378         gold/
379         * arm.cc: Add V8 arch combine table.
380
381 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
382
383         * aarch64.cc (do_reloc_addend): Fix signature to match the parent one.
384
385 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
386
387         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a call
388         to find by using the return value of insert.
389
390 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
391
392         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a copy
393         constructor call.
394
395 2015-04-06  Ilya Tocar  <ilya.tocar@intel.com>
396
397         PR gold/17641
398         * x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
399         (Target_x86_64::Scan::local): Don't create GOT entry, when we
400         can convert mov to lea.
401         (Target_x86_64::Scan::global): Ditto.
402         (Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
403         %reg to lea foo(%rip), %reg if possible.
404         * testsuite/Makefile.am (x86_64_mov_to_lea): New test.
405         * testsuite/x86_64_mov_to_lea1.s: New.
406         * testsuite/x86_64_mov_to_lea2.s: Ditto.
407         * testsuite/x86_64_mov_to_lea3.s: Ditto.
408         * testsuite/x86_64_mov_to_lea4.s: Ditto.
409         * testsuite/x86_64_mov_to_lea.sh: Ditto.
410
411 2015-04-02  H.J. Lu  <hongjiu.lu@intel.com>
412
413         * configure: Regenerated.
414
415 2015-04-01  Ilya Tocar  <ilya.tocar@intel.com>
416
417         PR gold/17640
418         * i386.cc (Target_i386::can_convert_mov_to_lea): New.
419         (Target_i386::Scan::local): Don't create GOT entry, when we
420         can convert GOT to GOTOFF.
421         (Target_i386::Scan::global): Ditto.
422         (Target_i386::Relocate::relocate): Convert  mov foo@GOT(%reg), %reg to
423         lea foo@GOTOFF(%reg), %reg if possible.
424         * testsuite/Makefile.am (i386_mov_to_lea): New test.
425         * testsuite/i386_mov_to_lea1.s: New.
426         * testsuite/i386_mov_to_lea2.s: Ditto.
427         * testsuite/i386_mov_to_lea3.s: Ditto.
428         * testsuite/i386_mov_to_lea4.s: Ditto.
429         * testsuite/i386_mov_to_lea5.s: Ditto.
430         * testsuite/i386_mov_to_lea.sh: Ditto.
431
432 2015-04-01  H.J. Lu  <hongjiu.lu@intel.com>
433
434         * Makefile.am (ZLIB): New.
435         (ZLIBINC): Likewise.
436         (AM_CFLAGS): Add $(ZLIBINC).
437         (AM_CXXFLAGS): Likewise.
438         (ldadd_varldadd_var): Add $(ZLIB).
439         (incremental_dump_LDADD): Likewise.
440         (dwp_LDADD): Likewise.
441         * compressed_output.cc: Don't check HAVE_ZLIB_H to include
442         <zlib.h>.
443         (zlib_compress): Don't check HAVE_ZLIB_H.
444         (zlib_decompress): Likewise.
445         * options.h (compress_debug_sections): Likewise.
446         * configure.ac (AM_CONDITIONAL): Removed.
447         * testsuite/Makefile.am (ZLIB): New.
448         (LDADD): Add $(ZLIB).
449         Don't check HAVE_ZLIB.
450         * Makefile.in: Regenerated.
451         * config.in: Likewise.
452         * configure: Likewise.
453         * testsuite/Makefile.in: Likewise.
454
455 2015-03-30  Jing Yu  <jingyu@google.com>
456
457         * aarch64-reloc.def: New TLSLD_ADD_DTPREL_HI12,
458         TLSLD_ADD_DTPREL_LO12_NC.
459         * aarch64.cc (Target_aarch64::define_tls_base_symbol): Always let
460         _TLS_MODULE_BASE_ point to the start of tls segment.
461         (Target_aarch64::optimize_tls_reloc): Add cases for
462         R_AARCH64_TLSLD_ADD_DTPREL_HI12 and
463         R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
464         (Target_aarch64::Scan::local): Likewise.
465         (Target_aarch64::Scan::global): Likewise.
466         (Target_aarch64::Relocate::relocate): Likewise.
467         (Target_aarch64::Relocate::relocate_tls): Likewise. And remove
468         subtracting tls segment size from symbol value for TLSLD_*_DTPREL
469         relocations.
470
471 2015-03-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
472
473         * merge.cc (Object_merge_map::add_mapping): call
474         Object_merge_map::Input_merge_map::add_mapping.
475         (Object_merge_map::Input_merge_map::add_mapping): New.
476         (Output_merge_data::do_add_input_section): Call
477         get_or_make_input_merge_map before a loop.
478         (Output_merge_string<Char_type>::finalize_merged_data): Call
479         get_or_make_input_merge_map before a loop.
480         * merge.h (Object_merge_map): Make Input_merge_map public.
481         * object.cc (Relobj::add_merge_mapping): Use get_or_create_merge_map.
482         (Relobj::get_or_create_merge_map): New.
483         * object.h (Relobj::get_or_create_merge_map): New.
484
485 2015-03-24  Alan Modra  <amodra@gmail.com>
486
487         PR 18147
488         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
489         relocation errors for branches to strong undefined symbols.
490
491 2015-03-23  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
492
493         * merge.cc (Object_merge_map::get_input_merge_map): Make it const.
494         (Object_merge_map::is_merge_section_for): Remove.
495         (Object_merge_map::find_merge_section): New.
496         * merge.h (Object_merge_map::is_merge_section_for): Remove.
497         (Object_merge_map::find_merge_section): New.
498         (Object_merge_map::get_input_merge_map): Add a const version.
499         * object.cc (Relobj::is_merge_section_for): Remove.
500         (Relobj::find_merge_section): New.
501         * object.h (Relobj::is_merge_section_for): Remove.
502         (Relobj::find_merge_section): New.
503         * output.cc
504         (Output_section::Input_section::is_merge_section_for): Remove.
505         (Output_section::add_merge_input_section): Don't call
506         add_merge_input_section.
507         (Output_section::find_merge_section): Return const. Use
508         object->find_merge_section.
509         (Output_section::build_lookup_maps): Don't build a map for
510         merge sections.
511         (Output_section::is_input_address_mapped): Return false if
512         section is not found.
513         (Output_section::find_starting_output_address): Use
514         find_merge_section instead of is_merge_section_for.
515         (Output_section::add_script_input_section):  Don't build a map for
516         merge sections.
517         * output.h (Output_section_lookup_maps::merge_sections_by_id_): Remove.
518         (Output_section_lookup_maps::find_merge_section): Remove.
519         (Output_section_lookup_maps::add_merge_input_section) Remove.
520         (Output_section::find_merge_section): Return const.
521
522 2015-03-22  Cary Coutant  <cary@google.com>
523
524         PR gold/18106
525         * i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
526         non-SIB form of lea, with nop after the call.
527
528 2015-03-21  Cary Coutant  <cary@google.com>
529
530         PR gold/14217
531         * output.cc (Output_segment::is_first_section_relro): Don't ignore
532         .tdata section.
533         (Output_segment::set_section_addresses): Don't align size of relro
534         segment for .tbss.
535
536 2015-03-21  Cary Coutant  <cary@google.com>
537
538         PR gold/18010
539         * stringpool.cc (Stringpool_template): Don't optimize if section
540         alignment is greater than sizeof(char).
541
542 2015-03-21  Cary Coutant  <cary@google.com>
543
544         PR gold/18048
545         * script-c.h (script_include_directive): Add first_token parameter.
546         * script.cc (script_include_directive): Add first_token parameter, and
547         pass it to read_script_file.
548         * yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
549         (PARSING_MEMORY_DEF): New tokens.
550         (top): Add new productions for INCLUDE files.
551         (file_cmd): Replace file_or_sections_cmd with copy of its productions.
552         Pass PARSING_LINKER_SCRIPT to script_include_directive.
553         (section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
554         (section_cmd): Pass PARSING_SECTION_CMDS.
555         (file_or_sections_cmd): Remove.
556         (memory_def): Pass PARSING_MEMORY_DEF.
557         * testsuite/Makefile.am (memory_test_2): New test.
558         * testsuite/Makefile.in: Regenerate.
559         * testsuite/memory_test_inc.t: New script file.
560         * testsuite/memory_test_inc_1.t.src: New script file.
561         * testsuite/memory_test_inc_2.t.src: New script file.
562         * testsuite/memory_test_inc_3.t.src: New script file.
563
564 2015-03-21  Cary Coutant  <cary@google.com>
565
566         * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
567         (Sized_relobj_dwo::setup): Build compressed section map.
568         (Sized_relobj_dwo::do_decompressed_section_contents): Delete.
569         * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
570         section map.
571         * object.cc (Sized_relobj_file::Sized_relobj_file): Remove
572         compressed_sections_ field.
573         (build_compressed_section_map): Take Object instead of
574         Sized_relobj_file parameter; add decompress_if_needed parameter.
575         (Sized_relobj_file::do_find_special_sections): Store compressed
576         section map in parent Object.
577         (Sized_relobj_file::do_decompressed_section_contents): Move
578         implementation to Object::decompressed_section_contents.
579         (Sized_relobj_file::do_discard_decompressed_sections): Move
580         implementation to Object::discard_decompressed_sections.
581         * object.h (build_compressed_section_map): Declare.
582         (Object::Object): Add compressed_sections_ field.
583         (Object::section_is_compressed): Move implementation here.
584         (Object::decompressed_section_contents): De-virtualize.
585         (Object::discard_decompressed_sections): De-virtualize.
586         (Object::do_section_is_compressed): Delete.
587         (Object::do_decompressed_section_contents): Delete.
588         (Object::set_compressed_sections): New method.
589         (Object::compressed_sections): New method.
590         (Object::compressed_sections_): New data member.
591         (Compressed_section_info, Compressed_section_map): Move to top of file.
592         (Sized_relobj_file::do_section_is_compressed): Delete.
593         (Sized_relobj_file::do_decompressed_section_contents): Delete.
594         (Sized_relobj_file::do_discard_decompressed_sections): Delete.
595         (Sized_relobj_file::compressed_sections_): Move to Object class.
596
597 2015-03-21  Cary Coutant  <ccoutant@google.com>
598
599         PR gold/18152
600         * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
601         deferred objects.
602
603 2015-03-11  Cary Coutant  <ccoutant@google.com>
604
605         * options.cc (General_options::finalize): Don't allow -z relro
606         with incremental linking.
607         * testsuite/Makefile.am (incremental_test): Add -z norelro.
608         (incremental_test_2): Likewise.
609         (incremental_test_3): Likewise.
610         (incremental_test_4): Likewise.
611         (incremental_test_5): Likewise.
612         (incremental_test_6): Likewise.
613         (incremental_copy_test): Likewise.
614         (incremental_common_test_1): Likewise.
615         (incremental_comdat_test_1): Likewise.
616         * testsuite/Makefile.in: Regenerate.
617
618 2015-03-09  Cary Coutant  <ccoutant@google.com>
619
620         PR gold/14675
621         * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
622         return enum indicating whether .eh_frame section is empty, optimizable,
623         unrecognized, or an end marker. Adjust explicit instantiations.
624         * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
625         (Eh_frame::add_ehframe_input_section): Change return type.
626         * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
627         * layout.cc (Layout::layout_eh_frame): Don't add optimized sections
628         to the .eh_frame output section until we see the end marker.
629         (Layout::finalize_eh_frame_section): New.
630         * layout.h: (Layout::finalize_eh_frame_section): New.
631
632 2015-03-05  H.J. Lu  <hongjiu.lu@intel.com>
633
634         * output.cc (Relobj::initialize_input_to_output_map<size>):
635         Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
636
637 2015-03-04  Cary Coutant  <ccoutant@google.com>
638
639         * parameters.cc (Parameters::set_target_once): Call
640         Target::select_as_default_target just once from here...
641         (set_parameters_target): ...instead of from here.
642
643 2015-03-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
644
645         * ehframe.cc (Cie::set_output_offset): Pass in and use a
646         Output_section_data instead of a Merge_map.
647         (Eh_frame::Eh_frame): Don't initialize merge_map_.
648         (Eh_frame::read_cie): Use add_merge_mapping instead of
649         Merge_map::add_mapping.
650         (Eh_frame::read_fde): Ditto.
651         (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
652         (Eh_frame::do_output_offset): Use merge_output_offset istead of
653         merge_map_->get_output_offset.
654         (Eh_frame::do_is_merge_section_for): Delete.
655         * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
656         instead of a Merge_map.
657         (Cie::set_output_offset): Pass in a Output_section_data instead of a
658         Merge_map.
659         (Eh_frame::do_is_merge_section_for): Delete.
660         (Eh_frame::merge_map_): Delete.
661         * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
662         and use a Output_section_data instead of a Merge_map.
663         (Object_merge_map::add_mapping): Ditto.
664         (Object_merge_map::get_output_offset): Remove the merge_map argument.
665         (Object_merge_map::is_merge_section_for): Pass in and use a
666         Output_section_data instead of a Merge_map.
667         (Merge_map): Delete.
668         (Output_merge_base::do_output_offset): Use merge_output_offset instead
669         of merge_map_.get_output_offset.
670         (Output_merge_base::do_is_merge_section_for): Delete.
671         (Output_merge_data::do_add_input_section): Use
672         object->add_merge_mapping instead of add_mapping.
673         (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
674         * merge.h (Merge_map): Delete forward declaration.
675         (Object_merge_map::add_mapping): Pass in and use a Output_section_data
676         instead of a Merge_map.
677         (Object_merge_map::get_output_offset): Remove the merge_map argument.
678         (Object_merge_map::is_merge_section_for): Pass in and use a
679         Output_section_data instead of a Merge_map.
680         (Input_merge_map::Object_merge_map::merge_map): Replace with
681         output_data.
682         (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
683         Output_section_data instead of a Merge_map.
684         (Merge_map): Delete.
685         (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
686         (Output_merge_base::do_is_merge_section_for): Delete.
687         (Output_merge_base::add_mapping): Delete.
688         (Output_merge_base::merge_map_): Delete.
689         * object.cc (Relobj::initialize_input_to_output_map): New.
690         (Relobj::initialize_input_to_output_map): New.
691         (Relobj::merge_output_offset): New.
692         (Relobj::is_merge_section_for): New.
693         (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
694         bits.
695         * object.h (Relobj::merge_map): Delete.
696         (initialize_input_to_output_map): New.
697         (set_merge_map): Delete.
698         (add_merge_mapping): New.
699         (merge_output_offset): New.
700         (is_merge_section_for): New.
701         * output.cc (Output_section::Input_section::is_merge_section_for):
702         Use object->is_merge_section_for.
703         * output.h (Output_section_data::is_merge_section_for): Delete.
704         (Output_section_data::do_is_merge_section_for): Delete.
705         * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
706         Use object->initialize_input_to_output_map.
707         (Merged_symbol_value<size>::value_from_output_section): Use
708         object->merge_output_offset.
709
710 2015-03-02  Peter Collingbourne  <pcc@google.com>
711             Cary Coutant  <ccoutant@google.com>
712
713         * output.cc (Output_section::add_merge_input_section): Do not
714         attempt to merge sections with an entsize of 0.
715
716 2015-03-02  Khem Raj  <raj.khem@gmail.com>
717
718         * attributes.h (class Output_attributes_section_data ): Add
719         do_print_to_mapfile function.
720
721 2015-02-24  Alan Modra  <amodra@gmail.com>
722
723         PR 18010
724         * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
725         complain if value is not a multiple of four.
726         (Target_powerpc::Relocate::relocate): Correct handling of
727         R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
728
729 2015-02-21  H.J. Lu  <hongjiu.lu@intel.com>
730
731         * configure.ac (default_size): Set to 32 for x32.
732         * configure: Regenerated.
733
734 2015-02-18  Alan Modra  <amodra@gmail.com>
735
736         PR 17954
737         * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
738         visibility.
739
740 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
741
742         * gc.h (Garbage_collection::add_reference): Don't use find.
743
744 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
745
746         * object.cc (write_local_symbols): avoid std::vector copy.
747
748 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
749
750         * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
751
752 2015-02-09  Mark Wielaard  <mjw@redhat.com>
753
754         * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
755         DW_LANG_Fortran03 and DW_LANG_Fortran08.
756
757 2015-02-16  Cary Coutant  <ccoutant@google.com>
758
759         PR gold/13577
760         PR gold/16992
761         * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
762         DF_SYMBOLIC if --dynamic-list option is used.
763         * options.cc (General_options::finalize): --dynamic-list is not
764         mutually exclusive with -Bsymbolic.
765         * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
766         listed in --dynamic-list.
767         * testsuite/Makefile.am (dynamic_list_lib2.so): Add
768         -Bsymbolic-functions.
769         * testsuite/Makefile.in: Regenerate.
770
771 2015-02-16  Cary Coutant  <ccoutant@google.com>
772
773         PR gold/17971
774         * incremental.cc: Remove redundant include of "output.h".
775
776 2015-02-12  Jing Yu  <jingyu@google.com>
777
778         * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
779         TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
780         New relocation.
781         * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
782         TLSLE_MOVW_* relocations.
783         (Target_aarch64::Scan::global): Likewise.
784         (Target_aarch64::Relocate::relocate): Likewise.
785         (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
786         for new TLSLE_MOVW_* relocations.
787
788 2015-02-11  Will Newton  <will.newton@linaro.org>
789
790         PR gold/13321
791         * arm.cc (Target_arm::make_plt_section): Create an ARM
792         state mapping symbol at the start of the PLT.
793
794 2015-02-09  H.J. Lu  <hongjiu.lu@intel.com>
795
796         * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
797         Replace two_file_shared_2.so with two_file_shared_1.so.
798         * testsuite/Makefile.in: Regenerated.
799
800 2015-02-09  Alan Modra  <amodra@gmail.com>
801
802         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
803         plugin_test_thin.a and defsym_test.
804         * testsuite/Makefile.in: Regenerate.
805
806 2015-02-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
807
808         * merge.cc (do_add_input_section): Combine loop epilogue into main loop
809         body.
810
811 2015-02-04  Peter Collingbourne  <pcc@google.com>
812
813         * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
814         forwarding symbols when computing symbol resolution info for plugins.
815         * plugin.h (Plugin_manager::symtab): New method.
816         (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
817
818 2015-02-03  Cary Coutant  <ccoutant@google.com>
819             Peter Collingbourne  <pcc@google.com>
820
821         PR gold/15660
822         * archive.cc (Thin_archive_object_unlocker): New class.
823         (Archive::include_member): Unlock external members of thin archives.
824         * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
825         (plugin_test_2): Likewise.
826         (plugin_test_3): Likewise.
827         (plugin_test_4): Likewise.
828         (plugin_test_5): Likewise.
829         (plugin_test_6): Likewise.
830         (plugin_test_7): Likewise.
831         (plugin_test_8): Likewise.
832         (plugin_test_9): Likewise.
833         (plugin_test_10): Likewise.
834         (plugin_test_11): New test case.
835         * testsuite/Makefile.in: Regenerate.
836         * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
837         file to decide whether to claim file.
838         (all_symbols_read_hook): Likewise.
839         * testsuite/plugin_test_1.sh: Adjust expected output.
840         * testsuite/plugin_test_2.sh: Likewise.
841         * testsuite/plugin_test_3.sh: Likewise.
842         * testsuite/plugin_test_6.sh: Likewise.
843         * testsuite/plugin_test_tls.sh: Likewise.
844         * testsuite/plugin_test_11.sh: New testcase.
845
846 2015-02-03  Cary Coutant  <ccoutant@google.com>
847
848         * descriptors.cc (Descriptors::open): Set artificially-low limit for
849         file descriptors when debugging enabled. Add debug output.
850         (Descriptors::release): Add debug output.
851         (Descriptors::close_some_descriptor): Likewise.
852         (Descriptors::close_all): Likewise.
853         * fileread.cc (File_read::lock): Likewise.
854         (File_read::unlock): Likewise.
855
856 2015-02-02  Cary Coutant  <ccoutant@google.com>
857
858         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
859         executable output file.
860
861 2015-01-22  Han Shen  <shenhan@google.com>
862
863         * arm.cc (Target_arm::Target_arm): Add initialization for new members.
864         (Target_arm::do_plt_address_for_global): New method.
865         (Target_arm::do_plt_address_for_local): New method.
866         (Target_arm::rel_irelative_section): New method.
867         (Target_arm::make_data_plt): Add more parameters for plt ctor.
868         (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
869         (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
870         (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
871         (Target_arm::Scan::check_non_pic): Add ifunc support.
872         (Target_arm::Scan::local): Add ifunc support.
873         (Target_arm::Scan::global): Add ifunc support.
874         (Target_arm::make_plt_section): New method.
875         (Target_arm::make_plt_entry): Change to call to make_plt_section.
876         (Target_arm::make_local_ifunc_plt_entry): New method.
877         (Target_arm::got_irelative_): New member.
878         (Target_arm::rel_irelative_): New member.
879         (Target_arm::got_section): Add creation for got_irelative_.
880         (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
881         (Target_arm::Relocate::relocate): Properly set local ifunc address.
882         (Target_arm::do_dynsym_value): Properly set global ifunc address.
883         (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
884         (Output_data_plt_arm::IRelative_data): New type.
885         (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
886         (Output_data_plt_arm::add_entry): Add more parameters.
887         (Output_data_plt_arm::add_relocation): New method.
888         (Output_data_plt_arm::add_local_ifunc_entry): New method.
889         (Output_data_plt_arm::rel_irelative): New method.
890         (Output_data_plt_arm::entry_count): Modified.
891         (Output_data_plt_arm::address_for_global): New method.
892         (Output_data_plt_arm::address_for_local): New method.
893 gold/
894         (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
895         (Output_data_plt_arm::insert_irelative_data): New method.
896         (Output_data_plt_arm::irelative_rel_): New member.
897         (Output_data_plt_arm::got_): New member.
898         (Output_data_plt_arm::got_irelative_): New member.
899         (Output_data_plt_arm::irelative_count_): New member.
900         (Output_data_plt_arm::IRelative_data_vec): New typedef.
901         (Output_data_plt_arm::irelative_data_vec_): New member.
902         (Output_data_plt_arm::do_write): Write out irelative entries.
903         (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
904         more parameters to ctor.
905         (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
906         more parameters to ctor.
907         * output.h (Output_data_reloc::add_local_relative): New method.
908         * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
909
910 2015-01-29  Alan Modra  <amodra@gmail.com>
911
912         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
913         and GOT_TLSGD to LE optimization.
914
915 2015-01-28  Cary Coutant  <ccoutant@google.com>
916
917         * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
918         for undef TLS symbols.
919         (Target_x86_64::Relocate::relocate_tls): Likewise.
920         (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
921
922 2015-01-25  Cary Coutant  <ccoutant@google.com>
923
924         * output.cc (Output_segment::set_section_addresses): Fix calculation
925         of size of relro segment.
926
927 2015-01-22  Alan Modra  <amodra@gmail.com>
928
929         * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
930         condition for need of ifunc plt entry.
931         (Target_powerpc::Scan::global <got relocs>): Likewise.
932
933 2015-01-14  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
934
935         * mips.cc (reloc_high): Add r_sym.
936         (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
937         reloc_high constructor.
938         (Mips_relocate_functions::relgot16_local): Likewise.
939         (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
940         r_type to decide whether LO16 matches HI16.
941         (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
942         rello16 and relgot16_local.
943
944 2015-01-09  Cary Coutant  <ccoutant@google.com>
945
946         * layout.cc (Layout::set_segment_offsets): Don't align start of segment
947         unless alignment is larger than page size.
948
949 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
950             Cary Coutant  <ccoutant@google.com>
951
952         PR gold/17729
953         * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
954         (DEFAULT_TARGET_X32): Set for x32.
955         * x86_64.cc (cmp_insn_32): New.
956         (lea_r10_insn_32): Likewise.
957         (lea_r11_insn_32): Likewise.
958         (cmp_insn_64): Likewise.
959         (lea_r10_insn_64): Likewise.
960         (lea_r11_insn_64): Likewise.
961         (Target_x86_64<size>::do_calls_non_split): Handle x32.
962         * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
963         (check_DATA): Add split_x32 files.
964         (split_x32_[1234n].o): New targets.
965         (split_x32_[124]): New targets.
966         (split_x32_[1234r].stdout): New targets.
967         * testsuite/split_x32.sh: New file.
968         * testsuite/split_x32_1.s: Likewise.
969         * testsuite/split_x32_2.s: Likewise.
970         * testsuite/split_x32_3.s: Likewise.
971         * testsuite/split_x32_4.s: Likewise.
972         * testsuite/split_x32_n.s: Likewise.
973         * configure: Regenerated.
974         * testsuite/Makefile.in: Likewise.
975
976 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
977
978         PR gold/17809
979         * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
980         x32.
981
982 2015-01-02  Alan Modra  <amodra@gmail.com>
983
984         * version.cc (print_version): Just print current year.
985         * dwp.cc (print_version): Likewise.
986
987 2015-01-01  Alan Modra  <amodra@gmail.com>
988
989         Update year range in copyright notice of all files.
990
991 2014-12-25  Alan Modra  <amodra@gmail.com>
992
993         * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
994         new enums.
995         (Target_arm::merge_object_attributes, ): Likewise.
996
997 2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
998
999         * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
1000         as hard float only when Tag_ABI_VFP_args is 1, using new enum value
1001         AEABI_VFP_args_vfp to check that.
1002         (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
1003         value and replace hardcoded values by enum values.
1004
1005 2014-12-22  Cary Coutant  <ccoutant@google.com>
1006
1007         * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
1008
1009 2014-12-20  H.J. Lu  <hongjiu.lu@intel.com>
1010
1011         PR gold/14608
1012         * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
1013         to "return i * i * 3;".
1014
1015 2014-12-16  Cary Coutant  <ccoutant@google.com>
1016
1017         * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
1018         (Mapfile::print_output_data): Use current_data_size() to avoid
1019         assert for sections requiring postprocessing; if address is not valid,
1020         print 0.
1021         (Mapfile::print_output_section): Use current_data_size(); print note
1022         that addresses and sizes are before compression.
1023
1024 2014-12-14  H.J. Lu  <hongjiu.lu@intel.com>
1025
1026         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1027         Cast current_group_size to unsigned long when reporting error.
1028
1029 2014-12-10  Jing Yu  <jingyu@google.com>
1030
1031         * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
1032         (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
1033         Update error message.
1034         (Target_aarch64::do_relax): Use absolute value of option
1035         stub_group_size. Replace local variable with class member
1036         stub_group_size_.
1037
1038 2014-12-04  Alan Modra  <amodra@gmail.com>
1039
1040         * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
1041         addend of PLTREL24 reloc when not generating a plt stub.  Make
1042         max_branch_offset an "Address".
1043         (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
1044         (Target_powerpc::Relocate::relocate): Likewise.
1045
1046 2014-12-04  Alan Modra  <amodra@gmail.com>
1047
1048         PR 17670
1049         * symtab.cc (Symbol::set_undefined): Remove assertion.
1050         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1051         on symbols defined in discarded sections, instead return false.
1052         Rearrange params, update all callers.
1053         (Target_powerpc::Branch_info::make_stub): Don't make stubs for
1054         branches to syms in discarded sections.
1055         (Global_symbol_visitor_opd::operator()): Set discarded opd syms
1056         undefined and flag as discarded.
1057         (Target_powerpc::Relocate::relocate): Localize variable.
1058
1059 2014-12-03  H.J. Lu  <hongjiu.lu@intel.com>
1060
1061         PR gold/17675
1062         * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
1063         * testsuite/Makefile.in: Regenerated.
1064
1065 2014-12-03  Alan Modra  <amodra@gmail.com>
1066
1067         PR 17566
1068         * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
1069         when adding dynamic relocations against section symbols.
1070
1071 2014-12-01  Dimitry Ivanov <dimitry@google.com>
1072
1073         * layout.cc (Layout::finish_dynamic_section): When '-z global'
1074         is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
1075         * options.h (General_options): New -z option (global).
1076
1077 2014-12-01  Cary Coutant  <ccoutant@google.com>
1078
1079         PR gold/17578
1080         * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
1081         is given.
1082         (Layout::create_executable_stack_info): Warn when -z noexecstack is
1083         given but some inputs require executable stack.
1084
1085 2014-11-26  Cary Coutant  <ccoutant@google.com>
1086
1087         * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
1088         .debug_str_offsets; strip .debug_gnu_pubnames and
1089         .debug_gnu_pubtypes.
1090         (lines_only_debug_sections): Strip all four new sections.
1091
1092 2014-11-26  Jing Yu  <jingyu@google.com>
1093
1094         * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
1095         register to be x0 when to relax TLSDESC_LD64_LO12.
1096
1097 2014-11-26  Alan Modra  <amodra@gmail.com>
1098
1099         * powerpc.cc (struct Stub_table_owner): New.
1100         (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
1101         unsigned int vector.  Update all references.
1102         (powerpc_relobj::set_stub_table): Take an unsigned int param
1103         rather than a Stub_table.  Update callers.
1104         (Powerpc_relobj::clear_stub_table): New function.
1105         (Target_powerpc): Add relax_failed_, relax_fail_count_ and
1106         stub_group_size_ vars.
1107         (Target_powerpc::new_stub_table): Delete.
1108         (max_branch_delta): New function, extracted from..
1109         (Target_powerpc::Relocate::relocate): ..here..
1110         (Target_powerpc::Branch_info::make_stub): ..and here.  Return
1111         status on whether stub created successfully.
1112         (Stub_control::Stub_control): Add "no_size_errors" param.  Move
1113         default sizing to..
1114         (Target_powerpc::do_relax): ..here.  Init stub_group_size_ and
1115         reduce on relax failure.
1116         (Target_powerpc::group_sections): Add "no_size_errors" param.
1117         Use stub_group_size_.  Set up group info in a temp vector,
1118         before building Stub_table vector.  Account for input sections
1119         possibly already converted to relaxed sections.
1120         (Stub_table::init): Delete.  Merge into..
1121         (Stub_table::Stub_table): ..here.
1122         (Stub_table::can_reach_stub): New function.
1123         (Stub_table::add_plt_call_entry): Add "from" parameter and
1124         return true iff stub could be reached.
1125         (Stub_table::add_long_branch_entry): Similarly.  Add "r_type"
1126         param too.
1127         (Stub_table::clear_stubs): Add "all" param.
1128
1129 2014-11-26  Alan Modra  <amodra@gmail.com>
1130
1131         * powerpc.cc (Stub_control::set_output_and_owner): New function.
1132         (Target_powerpc::group_sections): Use it.
1133
1134 2014-11-25  Cary Coutant  <ccoutant@google.com>
1135
1136         * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
1137         (Binary_to_elf::write_symbol): Add st_size parameter.
1138         * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
1139
1140 2014-11-25  Cary Coutant  <ccoutant@google.com>
1141
1142         PR gold/17639
1143         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
1144         (Sized_relobj_file::do_layout): Handle deferred sections properly
1145         during GC pass 1. Don't add reloc sections to deferred list twice.
1146         * object.h (Sized_relobj_file::is_deferred_layout): New function.
1147         (Sized_relobj_file::is_deferred_layout_): New data member.
1148
1149 2014-11-21  H.J. Lu  <hongjiu.lu@intel.com>
1150
1151         PR gold/17619
1152         * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
1153         Check PC-relative offset overflow in PLT entry.
1154
1155 2014-11-21  Alan Modra  <amodra@gmail.com>
1156
1157         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
1158         for undefined weaks.
1159
1160 2014-11-20  Alan Modra  <amodra@gmail.com>
1161
1162         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
1163         from --stub-group-size parameter divided by 1024.
1164         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
1165         template parameter.  Update all uses.
1166         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
1167         has_stub_value.  Set for long branches.  Don't report overflow for
1168         branch to undefined weak symbols.  Print info message on
1169         overflowing branch to stub.
1170
1171 2014-11-20  Alan Modra  <amodra@gmail.com>
1172
1173         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
1174
1175 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
1176
1177         * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
1178         entry for R_X86_64_GOTPLT64.
1179         (Target_x86_64<size>::Relocate::relocate): Update comments for
1180         R_X86_64_GOTPLT64.
1181
1182 2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>
1183
1184         * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
1185         * plugin.h: add lock definition
1186
1187 2014-10-29  Han Shen  <shenhan@google.com>
1188             Jing Yu   <jingyu@google.com>
1189
1190         * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
1191         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1192         TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
1193         Symbol::TLS_REF.
1194         * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
1195         method.
1196         (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
1197         (Target_aarch64::tls_ld_to_le): New method.
1198         (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
1199         for 64bit targets.
1200         (Output_data_plt_aarch64::irelative_rel_): New data member.
1201         (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
1202         (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
1203         (Output_data_plt_aarch64::add_relocation): New method.
1204         (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
1205         offset. Add got_irelative size to got size.
1206         (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
1207         type string with the new typename.
1208         (AArch64_relocate_functions::update_adr): Replace parameter x with
1209         immed.
1210         (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
1211         (AArch64_relocate_functions::reloc_common): New method.
1212         (AArch64_relocate_funcsions::rela_general): Extract common part out
1213         into reloc_common method.
1214         (AArch64_relocate_functions::rela_general): Likewise.
1215         (AArch64_relocate_functions::pcrela_general): Likewise.
1216         (AArch64_relocate_functions::adr): New method.
1217         (AArch64_relocate_functions::adrp): Calculate immed before calling
1218         update_adr.
1219         (AArch64_relocate_functions::adrp): Likewise.
1220         (AArch64_relocate_functions::movnz): Cast x to SignedW type when
1221         comparing x to 0. Calculate immed from ~x when x < 0.
1222         (Target_aarch64::optimize_tls_reloc): Add new cases for
1223         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1224         TLSLD_MOVW_DTPREL_G0_NC.
1225         (Target_aarch64::possible_function_pointer_reloc): Implement this
1226         method.
1227         (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
1228         comment.
1229         (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
1230         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1231         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1232         (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
1233         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1234         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1235         (Target_aarch64::make_plt_entry): Call add_entry with two more
1236         parameters.
1237         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1238         (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
1239         ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1240         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1241         (Target_aarch64::Relocate::relocate_tls): Add cases for
1242         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1243         TLSLD_MOVW_DTPREL_G0_NC.
1244         * testsuite/icf_safe_so_test.cc: Correct test comment.
1245         * testsuite/icf_safe_test.sh: Add AArch64 arch.
1246
1247 2014-10-22  Alan Modra  <amodra@gmail.com>
1248
1249         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
1250         thread_starter.
1251
1252 2014-10-18  Andreas Schwab  <schwab@linux-m68k.org>
1253
1254         * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
1255
1256 2014-10-17  Cary Coutant  <ccoutant@google.com>
1257
1258         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1259         Add "typename" keyword.
1260
1261 2014-10-15  Han Shen  <shenhan@google.com>
1262             Jing Yu   <jingyu@google.com>
1263
1264         Patch for gold aarch64 backend to support relaxation.
1265         * aarch64-reloc.def: Change format.
1266         * aarch64.cc (class Reloc_stub): New class.
1267         (class Stub_table): New class.
1268         (class AArch64_relobj): New class.
1269         (class AArch64_input_section): New class.
1270         (class AArch64_output_section): New class.
1271         (Target_aarch64::new_stub_table): New method.
1272         (Target_aarch64::new_aarch64_input_section): New method.
1273         (Target_aarch64::find_aarch64_input_section): New method.
1274         (Target_aarch64::scan_section_for_stubs): New method.
1275         (Target_aarch64::scan_reloc_section_for_stubs): New method.
1276         (Target_aarch64::relocate_stub): New method.
1277         (Target_aarch64::current_target): New method.
1278         (Target_aarch64::do_make_elf_object): New method.
1279         (Target_aarch64::do_may_relax): New method.
1280         (Target_aarch64::do_relax): New method.
1281         (Target_aarch64::group_sections): New method.
1282         (Target_aarch64::scan_reloc_for_stub): New method.
1283         (Target_aarch64::do_make_output_section): New method.
1284         (Target_aarch64::stub_tables_): New data member.
1285         (Target_aarch64::aarch64_input_section_map_): New data member.
1286         (AArch64_relocate_functions::maybe_apply_stub): New method.
1287
1288 2014-09-30  Cary Coutant  <ccoutant@google.com>
1289
1290         PR gold/17432
1291         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
1292
1293 2014-09-30  Kito Cheng  <kito@0xlab.org>
1294
1295         PR gold/13597
1296         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
1297         hash table before sysv-style hash table.
1298
1299 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
1300
1301         * options.h (--pic-executable): Add negative to alias to -no-pie.
1302
1303 2014-09-26  Cary Coutant  <ccoutant@google.com>
1304
1305         PR gold/16773
1306         * object.cc (Sized_relobj_file): Compute value of section symbols
1307         for TLS sections the same as TLS symbols.
1308
1309 2014-09-25  Cary Coutant  <ccoutant@google.com>
1310
1311         PR gold/17432
1312         * resolve.cc (Symbol_table::resolve): Override common placeholder
1313         symbols, but adjust sizes.
1314         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
1315         symbols to common lists.
1316
1317 2014-09-24  Alan Modra  <amodra@gmail.com>
1318
1319         * po/POTFILES.in: Regenerate.
1320
1321 2014-09-23  Taiju Tsuiki  <tzik@google.com>
1322             Cary Coutant  <ccoutant@google.com>
1323
1324         PR gold/14860
1325         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
1326         on input_sections_blocker.
1327         * layout.cc (Write_sections_task::locks): Unblock
1328         input_sections_blocker_.
1329         * layout.h (Write_sections_task::Write_sections_task): Add
1330         input_sections_blocker.
1331         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
1332         to DEPENDENCIES.
1333         * testsuite/Makefile.in: Regenerate.
1334
1335 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1336
1337         * testsuite/Makefile.am (plugin_test_10): New test.
1338         * testsuite/Makefile.in: Regenerate
1339         * testsuite/plugin_common_test_2.c (c1): Align to 8.
1340         * testsuite/plugin_test_10.sh: New file.
1341
1342 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1343
1344         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
1345         * resolve.cc (Symbol_table::resolve): Don't override common symbols
1346         during the replacement phase.
1347
1348 2014-09-17  Han Shen  <shenhan@google.com>
1349             Jing Yu  <jingyu@google.com>
1350
1351         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
1352         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
1353         * aarch64.cc (Target_aarch64): Add data members
1354         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
1355         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
1356         constructor.
1357         (Target_aarch64::do_reloc_symbol_index): New method.
1358         (Target_aarch64::do_reloc_addend): New method.
1359         (Target_aarch64::add_tlsdesc_info): New method.
1360         (Target_aarch64::do_dynsym_value): New method.
1361         (Target_aarch64::do_make_data_plt): Add new parameters: got,
1362         got_irelative. Pass them to Output_data_plt_aarch64_standard.
1363         (Target_aarch64::make_data_plt): Add new parameters: got,
1364         got_irelative. Pass them to do_make_data_plt.
1365         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
1366         (Target_aarch64::Relocate:tls_gd_to_le): New method.
1367         (Target_aarch64::Relocate:tls_ie_to_le): New method.
1368         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
1369         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
1370         (Target_aarch64::got_tlsdesc_section): New method.
1371         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1372         (Target_aarch64::define_tls_base_symbol): New method.
1373         (Target_aarch64::reserve_tlsdesc_entries): New method.
1374         (Target_aarch64::got_mod_index_entry): New method.
1375         (Target_aarch64::rela_tlsdesc_section): New method.
1376         (Target_aarch64::rela_irelative_section): New method.
1377         (Target_aarch64::Tlsdesc_info): New struct.
1378         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
1379         relocations and tlsdesc relocations.
1380         (Target_aarch64::optimize_tls_reloc): Implement method.
1381         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
1382         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
1383         in constructor.
1384         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
1385         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
1386         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
1387         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
1388         (Output_data_plt_aarch64::rela_tlsdesc): New method.
1389         (Output_data_plt_aarch64::rela_irelative): New method.
1390         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
1391         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
1392         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
1393         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
1394         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
1395         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
1396         (Output_data_plt_aarch64_standard): New member variables:
1397         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
1398         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
1399         New parameter: got, got_irelative.
1400         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
1401         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
1402         (Output_data_plt_aarch64::do_write): Replace got_address with
1403         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
1404         (AArch64_relocate_functions::update_movnz): New method.
1405         (AArch64_relocate_functions): Correct format.
1406         (AArch64_relocate_functions::movnz): New method.
1407         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
1408         before the switch. Add new cases to switch.
1409         Check ie_to_le relaxation on tlsie relocations. Add code handling
1410         tlsgd tlsdesc cases.
1411         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
1412         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
1413         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
1414         Call reloc_name_in_error_message to print unsupported reloc.
1415         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
1416         make_data_plt.
1417         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
1418         relocs. Fill in some more dynamic tags.
1419         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
1420         Skip call tls_get_addr when tlsgd is relaxed.
1421         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
1422         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
1423         tlsdesc->ie relaxation.
1424
1425 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1426
1427         * mips.cc (Target_mips_nacl): New class.
1428         (Target_selector_mips_nacl): New class.
1429         (target_selector_mips32): Rename from target_selector_mips32be and use
1430         Target_selector_mips_nacl instead of Target_selector_mips.
1431         (target_selector_mips32el): Rename from target_selector_mips32 and use
1432         Target_selector_mips_nacl instead of Target_selector_mips.
1433         (target_selector_mips64): Rename from target_selector_mips64be and use
1434         Target_selector_mips_nacl instead of Target_selector_mips.
1435         (target_selector_mips64el): Rename from target_selector_mips64 and use
1436         Target_selector_mips_nacl instead of Target_selector_mips.
1437         (Target_mips::mips_info): Add const attribute.
1438
1439 2014-09-02  Cary Coutant  <ccoutant@google.com>
1440
1441         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
1442         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
1443         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
1444         (Sized_incr_dynobj::do_section_name): Likewise.
1445         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
1446         (Sized_incr_dynobj::do_section_name): Likewise.
1447         * object.h (Object::section_name): Likewise.
1448         (Object::do_section_name): Likewise.
1449         (Sized_relobj_file::do_section_name): Likewise.
1450         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
1451         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
1452
1453 2014-09-02  Cary Coutant  <ccoutant@google.com>
1454
1455         PR gold/17005
1456         * ehframe.cc (Fde::write): Add output_offset parameter.
1457         (Cie::write): Likewise.
1458         (Eh_frame::set_final_data_size): Account for offset within output
1459         section.
1460         (Eh_frame::do_sized_write): Likewise.
1461         * ehframe.h (Fde::write): Add output_offset parameter.
1462         (Cie::write): Likewise.
1463         * output.cc (Output_section::Input_section_sort_entry): Remove
1464         section_has_name_; add output_section_name parameter. Use
1465         output section name for non-input sections.
1466         (Output_section::Input_section_sort_entry::section_has_name): Remove.
1467         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
1468         (Output_section::Input_section_sort_compare): Remove logic for
1469         sections without names.
1470         (Output_section::Input_section_sort_init_fini_compare): Likewise.
1471         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
1472         Likewise.
1473         (Output_section::Input_section_sort_section_name_compare): Likewise.
1474
1475 2014-08-29 Han Shen <shenhan@google.com>
1476            Jing Yu <jingyu@google.com>
1477
1478         * aarch64-reloc-property.cc
1479         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
1480         reference reloc property in the table.
1481         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
1482         3 other entries.
1483         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
1484         2 new overloaded methods.
1485         (Output_data_got_aarch64::do_write): Add code to write out
1486         static relocs.
1487         (class Output_data_got_aarch64::Static_reloc): New class to wrap
1488         static relocs.
1489         (Output_data_got_aarch64::static_relocs): New vector to
1490         hold static relocs.
1491         (Target_aarch64::TCB_SIZE): New const static memeber.
1492         (Target_aarch64::tcb_size): New method.
1493         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
1494         (Target_aarch64::Relocate::relocate_tls): New method.
1495         (Target_aarch64::Scan::local): Add code handling new reloc types.
1496         (Target_aarch64::Scan::global): Add code handling new reloc types.
1497
1498 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
1499
1500         * options.h (-no-pie): Add option.
1501
1502 2014-08-08  Jing Yu  <jingyu@google.com>
1503             Han Shen  <shenhan@google.com>
1504
1505         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
1506         (DEFFILES): add aarch64-reloc.def.
1507         (TARGETSOURCES): Add aarch64-reloc-property.cc.
1508         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
1509         * Makefile.in: Regenerate.
1510         * aarch64-reloc-property.cc: New file.
1511         * aarch64-reloc-property.h: New file.
1512         * aarch64-reloc.def: New file.
1513         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
1514         with tab to make the format consistent.
1515         (Output_data_got_aarch64::symbol_table_): New method.
1516         (Target_aarch64::do_plt_address_for_global): New method.
1517         (Target_aarch64::do_plt_address_for_local): New method.
1518         (Target_aarch64::do_select_as_default_target): New method.
1519         (Target_aarch64::do_make_data_plt): New method.
1520         (Target_aarch64::make_data_plt): New method.
1521         (Output_data_plt_aarch64::has_irelative_section): New method.
1522         (Output_data_plt_aarch64::address_for_global): New method.
1523         (Output_data_plt_aarch64::address_for_local): New method.
1524         (Output_data_plt_aarch64::irelative_rel_): New parameter.
1525         (Output_data_plt_aarch64::add_entry): Implement contents.
1526         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
1527         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
1528         the got_pov entry to plt0.
1529         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
1530         Implement contents.
1531         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
1532         (AArch64_howto): New struct.
1533         (aarch64_howto[]): New static const array.
1534         (AArch64_relocate_functions): New class.
1535         (Target_aarch64::Scan::get_reference_flags): Remove method.
1536         (Target_aarch64::Scan::local): Implement to support a few relocations.
1537         (Target_aarch64::Scan::global): Implement to support a few relocations.
1538         (Target_aarch64::make_plt_section): Implement contents.
1539         (Target_aarch64::make_plt_entry): Implement contents.
1540         (Target_aarch64::do_finalize_sections): Implement contents.
1541         (Target_aarch64::Relocate::relocate): Implement a few relocations.
1542         (Target_aarch64::relocate_section): Implement contents.
1543
1544 2014-08-06  Alan Modra  <amodra@gmail.com>
1545
1546         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
1547
1548 2014-08-06  Alan Modra  <amodra@gmail.com>
1549
1550         PR 13227
1551         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
1552
1553 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
1554
1555         * object.cc (Relobj::is_section_name_included): Add
1556         ".rodata.nptl_version" to not garbage collect this section.
1557
1558 2014-07-08  Cary Coutant  <ccoutant@google.com>
1559
1560         * expression.cc (struct Expression::Expression_eval_info): Add
1561         new fields type_pointer, vis_pointer, and nonvis_pointer.
1562         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
1563         nonvis_pointer parameters. Adjust all calls.
1564         (Symbol_expression::value): Update type, visibility, and nonvis bits
1565         in caller.
1566         * script.cc (Symbol_assignment::sized_finalize): Update type,
1567         visibility, and remaining st_other bits for new symbol.
1568         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
1569         vis_pointer, and nonvis_pointer parameters.
1570         * symtab.h (Symbol::set_type): New method.
1571
1572         * testsuite/Makefile.am (defsym_test): New test.
1573         * testsuite/Makefile.in: Regenerate.
1574         * testsuite/defsym_test.c: New file.
1575         * testsuite/defsym_test.sh: New file.
1576
1577 2014-07-08  Cary Coutant  <ccoutant@google.com>
1578
1579         PR gold/15639
1580         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
1581         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
1582         (Sized_dynobj::base_read_symbols): ...new method.
1583         * object.h (Sized_relobj_file::base_read_symbols): New method.
1584         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
1585         (Sized_relobj_file::base_read_symbols): ...new method.
1586         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
1587         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
1588         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
1589
1590 2014-07-04  Alan Modra  <amodra@gmail.com>
1591
1592         * po/POTFILES.in: Regenerate.
1593
1594 2014-07-02  Jing Yu  <jingyu@google.com>
1595
1596         * aarch64.cc: New file
1597         * Makefile.am (TARGETSOURCES): Add aarch64.cc
1598         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
1599         * Makefile.in: Regenerate.
1600         * configure.tgt: Add entries for aarch64*.
1601         * configure.ac:  Likewise.
1602         * configure: Likewise.
1603
1604 2014-06-27  Alan Modra  <amodra@gmail.com>
1605
1606         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
1607
1608 2014-06-24  Cary Coutant  <ccoutant@google.com>
1609
1610         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
1611         sections.
1612         (Dwo_file::sized_read_unit_index): Likewise.
1613
1614 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1615
1616         * mips.cc: New file.
1617         * Makefile.am (TARGETSOURCES): Add mips.cc
1618         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
1619         * configure.tgt: Add entries for mips*.
1620         * configure.ac: Likewise.
1621         * Makefile.in: Regenerate.
1622         * configure: Likewise.
1623
1624 2014-06-09  Cary Coutant  <ccoutant@google.com>
1625
1626         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
1627         unit_length is within section bounds.
1628
1629 2014-06-09  Cary Coutant  <ccoutant@google.com>
1630
1631         PR gold/16980
1632         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
1633         map.
1634
1635 2014-06-07  Alan Modra  <amodra@gmail.com>
1636
1637         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
1638
1639 2014-06-06  Cary Coutant  <ccoutant@google.com>
1640
1641         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
1642         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
1643         (Dwarf_pubnames_table::read_header): Likewise.
1644         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
1645         .debug_gnu_pubtypes.
1646
1647 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
1648
1649         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
1650         * Makefile.in, configure: Regenerate.
1651
1652 2014-06-03  Alan Modra  <amodra@gmail.com>
1653
1654         * powerpc.cc (addis_12_2): Define.
1655         (Stub_table::do_write): Support fusion on ELFv2 stubs.
1656
1657 2014-06-03  Alan Modra  <amodra@gmail.com>
1658
1659         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
1660         st_other output.
1661
1662 2014-06-02  Alan Modra  <amodra@gmail.com>
1663
1664         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
1665         Only ignore relocs on ELFv1.
1666         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
1667
1668 2014-05-30  Cary Coutant  <ccoutant@google.com>
1669
1670         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
1671         * testsuite/Makefile.in: Regenerate.
1672         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
1673
1674 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
1675
1676         PR gold/16945
1677         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
1678         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
1679
1680 2014-05-15  Alan Modra  <amodra@gmail.com>
1681
1682         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
1683         Compare FDE contents with DW_CFA_nop rather than 0.
1684
1685 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
1686
1687         * symtab.h (may_need_copy_reloc): Remove check for position independent
1688         code.
1689         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
1690         position independence before pc absolute may_need_copy_reloc call.
1691         Add check for executable output befor pc relative may_need_copy_reloc
1692         call.
1693         * i386.cc: Ditto.
1694         * arm.cc: Ditto.
1695         * sparc.cc: Ditto.
1696         * tilegx.cc: Ditto.
1697         * powerpc.cc: Add check for no position independence before
1698         may_need_copy_reloc calls.
1699         * testsuite/pie_copyrelocs_test.cc: New file.
1700         * testsuite/pie_copyrelocs_shared_test.cc: New file.
1701         * Makefile.am (pie_copyrelocs_test): New test.
1702         * Makefile.in: Regenerate.
1703
1704 2014-05-08  Martin Liška  <mliska@suse.cz>
1705
1706         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
1707
1708 2014-05-06  Cary Coutant  <ccoutant@google.com>
1709
1710         PR gold/16900
1711         * i386.cc (Output_data_got_plt_i386): New class.
1712         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
1713         parameter. Change all callers.
1714         (Output_data_plt_i386::layout_): Remove.
1715         (Output_data_plt_i386::got_plt_): Change type.
1716         (Target_i386::got_plt_): Change type. Change all references.
1717         (Target_i386::got_section): Create instance of new class.
1718         (Output_data_got_plt_i386::do_write): New function.
1719         * x86_64.cc (Output_data_got_plt_x86_64): New class.
1720         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
1721         parameter. Change all callers.
1722         (Output_data_plt_x86_64::layout_): Remove.
1723         (Output_data_plt_x86_64::got_plt_): Change type.
1724         (Target_x86_64::got_plt_): Change type. Change all references.
1725         (Target_x86_64::got_section): Create instance of new class.
1726         (Output_data_got_plt_x86_64::do_write): New function.
1727         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
1728         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
1729         class.
1730
1731 2014-05-05  Cary Coutant  <ccoutant@google.com>
1732
1733         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
1734         if we have pubnames/pubtypes.
1735
1736 2014-05-02  Cary Coutant  <ccoutant@google.com>
1737
1738         * defstd.cc (in_segment): Define __ehdr_start here...
1739         * layout.cc (Layout::finalize): ...Instead of here.  Set the
1740         output segment when known.
1741         * resolve.cc (Symbol::override_base_with_special): Remember
1742         the original binding.
1743         * symtab.cc (Symbol::set_output_segment): New function.
1744         (Symbol::set_undefined): New function.
1745         * symtab.h (Symbol::is_weak_undefined): Check original undef
1746         binding.
1747         (Symbol::is_strong_undefined): New function.
1748         (Symbol::set_output_segment): New function.
1749         (Symbol::set_undefined): New function.
1750         * target-reloc.h (is_strong_undefined): Remove.
1751         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
1752         Check for hidden undefs.
1753         (relocate_section): Call Symbol::is_strong_undefined.
1754
1755         * testsuite/Makefile.am (ehdr_start_test_1)
1756         (ehdr_start_test_2, ehdr_start_test_3)
1757         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
1758         * testsuite/Makefile.in: Regenerate.
1759         * testsuite/ehdr_start_def.cc: New source file.
1760         * testsuite/ehdr_start_test.cc: New source file.
1761         * testsuite/ehdr_start_test.t: New linker script.
1762         * testsuite/ehdr_start_test_4.sh: New shell script.
1763
1764 2014-04-23  Cary Coutant  <ccoutant@google.com>
1765
1766         PR gold/16870
1767         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
1768
1769 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1770
1771         * layout.cc (Layout::include_section): Allow a target to decide
1772         whether to include a section.
1773         * target.h (Target::should_include_section): New function.
1774         (Target::do_should_include_section): New function.
1775
1776 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1777
1778         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
1779         inline into ...
1780         (Copy_relocs::emit): ... here.
1781         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
1782         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
1783         (Copy_reloc_entry::entries_): Change from private to protected.
1784
1785 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
1786
1787         * icf.cc (get_section_contents): Replace copies of reloc
1788         vectors with const references.
1789
1790 2014-04-02  Cary Coutant  <ccoutant@google.com>
1791
1792         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
1793         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
1794         * configure: Regenerate.
1795         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
1796         -fno-use-linker-plugin.
1797         (LINK1, CXXLINK1): Add it to the link command.
1798         * testsuite/Makefile.in: Regenerate.
1799
1800 2014-03-12  Alan Modra  <amodra@gmail.com>
1801
1802         * Makefile.in: Regenerate.
1803
1804 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1805
1806         * symtab.h (Symbol::set_nonvis): New function.
1807
1808 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1809
1810         * symtab.cc (Sized_symbol<32>::init_output_data):
1811         Instantiate the template.
1812         (Sized_symbol<64>::init_output_data): Likewise.
1813
1814 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1815
1816         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
1817         adjust dynamic symbol value.
1818         * target.h (Target::adjust_dyn_symbol): New function.
1819         (Target::do_adjust_dyn_symbol): New function.
1820
1821 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1822
1823         * output.cc (Output_data_dynamic::Dynamic_entry::write):
1824         Get the value of DYNAMIC_CUSTOM dynamic entry.
1825         * output.h (Output_data_dynamic::add_custom): New function.
1826         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
1827         dynamic entry.
1828         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
1829         * target.h (Target::dynamic_tag_custom_value): New function.
1830         (Target::do_dynamic_tag_custom_value): New function.
1831
1832 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1833
1834         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
1835         dynsym indexes.
1836         * target.h (Target::has_custom_set_dynsym_indexes): New function.
1837         (Target::do_has_custom_set_dynsym_indexes): New function.
1838         (Target::set_dynsym_indexes): New function.
1839         (Target::do_set_dynsym_indexes): New function.
1840
1841 2014-03-07  Alan Modra  <amodra@gmail.com>
1842
1843         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
1844         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
1845         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
1846         (Powerpc_relocate_functions::has_overflow_bitfield,
1847         overflowed): Use the above.
1848         (Target_powerpc::Relocate::relocate): Correct overflow checking
1849         for a number of relocations.  Modify overflow test for 16-bit
1850         fields in instructions to signed/unsigned according to whether
1851         the field takes a signed or unsigned value.
1852
1853 2014-03-05  Alan Modra  <amodra@gmail.com>
1854
1855         Update copyright years.
1856
1857 2014-03-05  Alan Modra  <amodra@gmail.com>
1858
1859         * powerpc.cc (Target_powerpc::Scan::local, global): Support
1860         R_PPC64_ADDR64_LOCAL.
1861         (Target_powerpc::Relocate::relocate): Likewise.
1862
1863 2014-03-03  Alan Modra  <amodra@gmail.com>
1864
1865         * dwp.cc (print_version): Update copyright year to current.
1866
1867 2014-02-10  Alan Modra  <amodra@gmail.com>
1868
1869         * po/gold.pot: Regenerate.
1870
1871 2014-02-06  Cary Coutant  <ccoutant@google.com>
1872
1873         Fix problem where -u is ignored when a weak undef is seen.
1874
1875         * archive.cc (Library_base::should_include_member): Reorder
1876         code to check for -u option if a weak undef has already been seen.
1877         * testsuite/Makefile.am (weak_undef_test_2): New test case.
1878         * testsuite/Makefile.in: Regenerate.
1879         * testsuite/weak_undef_file3.cc: New file.
1880         * testsuite/weak_undef_file4.cc: New file.
1881         * testsuite/weak_undef_test_2.cc: New file.
1882
1883 2014-02-05  Cary Coutant  <ccoutant@google.com>
1884
1885         Fix issues with gold undefined symbol diagnostics.
1886
1887         PR binutils/15435
1888         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
1889         check to here.
1890         * target-reloc.h (is_strong_undefined): New function.
1891         (relocate_section): Move undef vtable symbol check from here.
1892         Check for is_strong_undefined.
1893
1894 2014-02-05  Cary Coutant  <ccoutant@google.com>
1895
1896         Fix problems with the --dynamic-list option.
1897
1898         PR gold/13577
1899         * options.cc (General_options::parse_dynamic_list):
1900         Set have_dynamic_list_.
1901         (General_options::General_options): Initialize have_dynamic_list_.
1902         (General_options::finalize): Turn off -Bsymbolic and
1903         -Bsymbolic-functions if --dynamic-list provided.
1904         * options.h (General_options::have_dynamic_list): New function.
1905         (General_options::have_dynamic_list_): New data member.
1906         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
1907         correctly.
1908
1909         PR gold/16530
1910         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
1911         in --dynamic-list, mark it.
1912
1913         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
1914         (dynamic_list_2): New test case.
1915         * testsuite/Makefile.in: Regenerate.
1916         * testsuite/dynamic_list_2.cc: New file.
1917         * testsuite/dynamic_list_2.t: New file.
1918         * testsuite/dynamic_list_lib1.cc: New file.
1919         * testsuite/dynamic_list_lib2.cc: New file.
1920         * testsuite/gc_dynamic_list_test.c: New file.
1921         * testsuite/gc_dynamic_list_test.sh: New file.
1922         * testsuite/gc_dynamic_list_test.t: New file.
1923
1924 2014-01-28  Cary Coutant  <ccoutant@google.com>
1925
1926         Add .gdb_index version 7 support.
1927
1928         * gold/dwarf_reader.cc: include <utility> (for make_pair).
1929         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
1930         debug sections.
1931         (Dwarf_ranges_table::read_ranges_table): Likewise.
1932         (Dwarf_pubnames_table::read_section): Check for GNU-style
1933         sections, and for compressed debug sections.
1934         (Dwarf_pubnames_table::read_header): Compute end address of table.
1935         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
1936         for end of list by offset, not by offset == 0.
1937         (Dwarf_info_reader::do_read_string_table): Check for compressed
1938         debug sections.
1939         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1940         Initialize new data members.
1941         (Dwarf_pubnames_table::next_name): return flag_byte.
1942         (Dwarf_pubnames_table::end_of_table_): New data member.
1943         (Dwarf_pubnames_table::is_gnu_style_): New data member.
1944         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
1945         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
1946         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
1947         read skeleton type unit DIEs.
1948         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
1949         (Gdb_index::do_write): Write flag_byte.
1950         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
1951         (Gdb_index::Cu_vector): Store flags along with cu indexes.
1952         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
1953         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
1954
1955 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
1956
1957         * version.cc (print_version): Update copyright year to 2014.
1958
1959 2013-12-19  Dimitry Andric  <dimitry@andric.com>
1960
1961         * stringpool.cc (Stringpool_template::reserve): Add
1962         HAVE_UNORDERED_MAP case.
1963         * stringpool.cc (Stringpool_template::print_stats): Likewise.
1964
1965 2013-12-18  Cary Coutant  <ccoutant@google.com>
1966
1967         * configure.ac: Check for <unordered_set> and <unordered_map>.
1968         * config.in: Regenerate.
1969         * configure: Regenerate.
1970         * system.h: Use <unordered_set> and <unordered_map> if available.
1971
1972 2013-12-10  Roland McGrath  <mcgrathr@google.com>
1973
1974         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
1975         with $(INSTALL_PROGRAM_ENV).
1976         * Makefile.in: Regenerate.
1977
1978 2013-11-22  Cary Coutant  <ccoutant@google.com>
1979
1980         * configure.ac: Add check for which library is needed for
1981         dlopen.
1982         * configure: Regenerate.
1983
1984 2013-11-22  Cary Coutant  <ccoutant@google.com>
1985
1986         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
1987         assembler.
1988         * testsuite/Makefile.in: Regenerate.
1989
1990 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
1991
1992         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
1993         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
1994         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
1995         (Target_x86_64<size>::Scan::local): Likewise.
1996         (Target_x86_64<size>::Scan::global): Likewise.
1997         (Target_x86_64<size>::Relocate::relocate): Likewise.
1998         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
1999         Likewise.
2000         (Target_x86_64<size>::Scan::check_non_pic(): Handle
2001         R_X86_64_PC32_BND.
2002
2003         * testsuite/Makefile.am (check_PROGRAMS): Add
2004         exception_x86_64_bnd_test.
2005         (exception_x86_64_bnd_test_SOURCES): New macro.
2006         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
2007         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
2008         (exception_x86_64_bnd_test_LDADD): Likewise.
2009         (exception_x86_64_bnd_1.o): New rule.
2010         (exception_x86_64_bnd_2.o): Likewise.
2011         * testsuite/Makefile.in: Regenerated.
2012
2013 2013-11-15  Alan Modra  <amodra@gmail.com>
2014
2015         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
2016         accessor.
2017         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
2018         Only call ppc64_local_entry_offset for 64-bit.  Restrict
2019         symval_for_branch lookup to ELFv1.
2020         (Stub_table::add_plt_call_entry): Use unsigned int off.
2021         (Output_data_glink::Address, invalid_address): New.
2022         (Output_data_glink::add_eh_frame): Move out of line.  Add
2023         support for ELFv2.
2024         (Output_data_glink::add_global_entry, find_global_entry,
2025         global_entry_address): New functions.
2026         (Output_data_glink::global_entry_stubs_, end_branch_table_,
2027         ge_size): New variables.
2028         (Output_data_glink::set_final_data_size): Add global entry
2029         stub sizing.
2030         (Output_data_glink::do_write): Write global entry stubs.
2031         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
2032         parameter.  Return true for ELFv2.  Adjust callers.
2033         (Target_powerpc::Scan::local, global): Restrict opd lookup to
2034         ELFv1.  Similarly for ifunc and dynamic relocation processing
2035         specific to ELFv1.  Recognize that symbols are defined on
2036         their plt entries for ELFv2.
2037         (Target_powerpc::symval_for_branch): Assert if called for
2038         ELFv2 or ppc32.
2039         (Target_powerpc::Relocate::relocate): Use global entry plt
2040         stub for symbol value if such exists on ELFv2.
2041         (Target_powerpc::Relocate::relocate): Don't call
2042         symval_for_branch when ELFv2.  Do adjust for local entry
2043         offset when ELFv2.
2044         (Target_powerpc::do_dynsym_value): Set symbols to global entry
2045         plt stub for ELFv2.
2046         (Target_powerpc::do_plt_address_for_global): Similarly.
2047
2048 2013-11-14  Cary Coutant  <ccoutant@google.com>
2049
2050         Revert patch -- this did not fix the problem, and there is
2051         no race there.
2052
2053         2013-11-14  Cary Coutant  <ccoutant@google.com>
2054
2055             PR gold/14860
2056             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2057             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2058             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2059             updating fde_offsets_.
2060             (Eh_frame_hdr::lock_): New data member.
2061
2062 2013-11-14  Cary Coutant  <ccoutant@google.com>
2063
2064         * dwp.cc (Dwo_file_entry): New type.
2065         (File_list): Use Dwo_file_entry.
2066         (Dwo_file::verify): New function.
2067         (Dwo_file::verify_dwo_list): New function.
2068         (Dwo_file::sized_verify_dwo_list): New function.
2069         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
2070         list.
2071         (Dwp_options): New enum type.
2072         (dwp_options): Add --verify-only.
2073         (usage): Likewise.
2074         (main): Likewise.
2075         * dwp.h (gold_info): Add declaration.
2076
2077 2013-11-14  Cary Coutant  <ccoutant@google.com>
2078
2079         PR gold/14860
2080         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2081         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2082         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2083         updating fde_offsets_.
2084         (Eh_frame_hdr::lock_): New data member.
2085
2086 2013-11-06  Cary Coutant  <ccoutant@google.com>
2087
2088         PR gold/15758
2089         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
2090         before reloc sections.
2091
2092 2013-11-04  Alan Modra  <amodra@gmail.com>
2093
2094         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
2095         (Symbol::needs_dynamic_reloc): Test new flag.
2096         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
2097         (Target_powerpc::Scan::get_reference_flags): Add target param.
2098         Return FUNC_DESC_ABI for 64-bit ELFv1.
2099         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
2100         call.
2101         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
2102         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
2103
2104 2013-10-31  Cary Coutant  <ccoutant@google.com>
2105
2106         Restore support for dwp v2 DWARF package file format.
2107
2108         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2109         tu_length parameter.  Adjust all callers.
2110         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2111         * dwp.cc: Include dwarf.h.
2112         (Section_bounds): New struct type.
2113         (Unit_set): New struct type.
2114         (Dwo_file::Dwo_file): Initialize new data member.
2115         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2116         Combine and rename to...
2117         (Dwo_file::read_unit_index): ...this.
2118         (Dwo_file::sized_read_compunit_index)
2119         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2120         (Dwo_file::sized_read_unit_index): ...this.
2121         (Dwo_file::copy_section): Remove section_name, is_str_offsets
2122         parameters; add section_id parameter.
2123         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2124         (Dwo_file::add_unit_set): ...this.
2125         (Dwo_file::shndx_map_): Remove.
2126         (Dwo_file::sect_offsets_): New data member.
2127         (Dwp_output_file::Dwp_output_file): Initialize new data members.
2128         (Dwp_output_file::add_section): Rename to...
2129         (Dwp_output_file::add_contribution): ...this.
2130         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2131         (Dwp_output_file::add_tu_set): Likewise.
2132         (Dwp_output_file::Contribution): New type.
2133         (Dwp_output_file::Section::contributions): New data member.
2134         (Dwp_output_file::Cu_or_tu_set): Remove.
2135         (Dwp_output_file::Section::Section): New ctor.
2136         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2137         (Dwp_output_file::Dwp_index::Section_table): New type.
2138         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2139         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2140         parameter.
2141         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2142         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2143         (Dwp_output_file::Dwp_index::section_table): New member function.
2144         (Dwp_output_file::Dwp_index::section_table_end): New member function.
2145         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2146         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2147         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2148         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2149         (Dwp_output_file::Dwp_index::section_table_): New data member.
2150         (Dwp_output_file::Dwp_index::section_mask_): New data member.
2151         (Dwp_output_file::add_output_section): New member function.
2152         (Dwp_output_file::write_new_section): New member function.
2153         (Dwp_output_file::write_contributions): New member function.
2154         (Dwp_output_file::section_id_map_): New data member.
2155         (class Dwo_id_info_reader): Remove.
2156         (class Unit_reader): New class.
2157         (get_dwarf_section_name): New function.
2158         (Dwo_file::read_executable): Adjust initializations of class data.
2159         (Dwo_file::read): Add support for v2 package file format.
2160         (Dwo_file::read_unit_index): Likewise.
2161         (Dwo_file::sized_read_unit_index): Likewise.
2162         (Dwo_file::copy_section): Likewise.
2163         (Dwo_file::add_unit_set): Likewise.
2164         (Dwp_output_file::add_output_section): Likewise.
2165         (Dwp_output_file::add_contribution): Likewise.
2166         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2167         for empty slot.
2168         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2169         file format.
2170         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2171         slot.
2172         (Dwp_output_file::initialize): Remove unused function.
2173         (Dwp_output_file::finalize): Add support for v2 package file format.
2174         (Dwp_output_file::write_index): Likewise.
2175         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2176         function prototype.
2177
2178 2013-10-31  Cary Coutant  <ccoutant@google.com>
2179
2180         * configure.ac: Fix check for -fmerge-constants.
2181         * configure.ac: Regenerate.
2182
2183 2013-10-30  Roland McGrath  <mcgrathr@google.com>
2184
2185         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
2186         Correct 9-byte nop sequence to match what the assembler generates.
2187
2188 2013-10-30  Alan Modra  <amodra@gmail.com>
2189
2190         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
2191         ppc64_local_entry_offset, ppc64_local_entry_offset,
2192         do_read_symbols): New functions.
2193         (Powerpc_relobj::e_flags_, st_other_): New vars.
2194         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
2195         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
2196         (Powerpc_relobj::e_flags_): New var.
2197         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
2198         and adjust for ELFv2.
2199         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
2200         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
2201         (Powerpc_dynobj::do_find_special_sections): Likewise.
2202         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
2203         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
2204         to ELFv2 local entry.
2205         (Target_powerpc::do_relax): No thread safe barriers needed for
2206         ELFv2.
2207         (Output_data_plt_powerpc::initial_plt_entry_size_,
2208         plt_entry_size): Delete.  Replace all uses with
2209         first_plt_entry_offset() and plt_entry_size().
2210         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
2211         reserved_size parm.  Update callers.
2212         (Output_data_plt_powerpc::entry_count): Update.
2213         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
2214         and use Target_powerpc::first_plt_entry_offset().
2215         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
2216         rename to plt_entry_size.
2217         (Output_data_plt_powerpc::add_ifunc_entry,
2218         add_local_ifunc_entry): Adjust reloc for ELFv2.
2219         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
2220         (glink_eh_frame_fde_64v2): New.
2221         (Stub_table::plt_call_size): Support ELFv2 sizing.
2222         (Output_data_glink::add_eh_frame): Use the new FDE.
2223         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
2224         (Stub_table::do_write): Write ELFv2 stubs and glink.
2225         (Target_powerpc::Relocate::relocate): Replaces nop after call
2226         with ld 2,24(1) and adjust local offset destination for ELFv2.
2227
2228 2013-10-30  Alan Modra  <amodra@gmail.com>
2229
2230         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
2231         (Target_powerpc::Scan::global, local): Likewise.
2232         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
2233         on all ppc64 @h and @ha relocs.
2234
2235 2013-10-14  Alan Modra  <amodra@gmail.com>
2236
2237         * output.h (Output_data_got::add_constant): Tidy.
2238         (Output_data_got::add_constant_pair): New function.
2239         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
2240         methods used so as to first call reserve_ent().
2241
2242 2013-10-11  Roland McGrath  <mcgrathr@google.com>
2243
2244         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
2245         add_got_entry and add_got_entry_pair.
2246
2247         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
2248         (HAVE_PUBNAMES): Likewise.
2249         * configure: Regenerate.
2250
2251         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
2252         * testsuite/Makefile.in: Regenerate.
2253
2254         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
2255         Remove const from declaration.
2256         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
2257         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
2258         * output.h (Output_file_header): Remove const from member target_
2259         and corresponding constructor argument.
2260         * output.cc (Output_file_header::Output_file_header): Update prototype.
2261         (Output_file_header::do_sized_write): Use this->target_ in place
2262         of parameters()->target().
2263
2264         * testsuite/undef_symbol.cc (Foo::get_a): New method.
2265
2266         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
2267         * configure: Regenerate.
2268         * Makefile.in: Regenerate.
2269         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
2270         * testsuite/merge_string_literals_2.c: Likewise.
2271         * testsuite/Makefile.am
2272         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
2273         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
2274         literal -fmerge-constants.
2275         * testsuite/Makefile.in: Regenerate.
2276
2277         * i386.cc (Target_i386): Remove unused member dynbss_.
2278         * arm.cc (Target_arm): Likewise.
2279         * powerpc.cc (Target_powerpc): Likewise.
2280         * sparc.cc (Target_sparc): Likewise.
2281         * tilegx.cc (Target_tilegx): Likewise.
2282         * x86_64.cc (Target_x86_64): Likewise.
2283         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
2284         type_signature_, type_offset_.
2285         * plugin.h (Plugin_hook): Remove unused member layout_.
2286         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
2287         mapfile_.
2288         (Read_member): Remove unused members input_objects_, symtab_,
2289         mapfile_, layout_.
2290         (Check_library): Remove unused member symtab_.
2291         * archive.h (Lib_group): Remove unused member lib_.
2292         * archive.cc (Lib_group::Lib_group): Update initializer.
2293         * incremental.h (Incremental_binary): Remove unused member target_.
2294         (Incremental_script_entry): Removed unused member script_.
2295         * layout.h (Write_symbols_task): Remove unused member input_objects_.
2296         * icf.h (Icf): Remove unused member num_tracked_relocs.
2297
2298         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
2299         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
2300         its only use.
2301         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
2302
2303         * archive.h: Use struct rather than class for forward declaration
2304         of Read_symbols_data.
2305
2306 2013-10-07  Cary Coutant  <ccoutant@google.com>
2307
2308         PR gold/16010
2309         * testsuite/Makefile.am (icf_test): Fix dependencies.
2310         (icf_safe_test): Likewise.
2311         (icf_safe_so_test): Likewise.
2312         (large_symbol_alignment): Add empty _LDADD rule.
2313         * testsuite/Makefile.in: Regenerate.
2314
2315 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
2316
2317         PR gold/15927
2318         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
2319         relocation for R_X86_64_32 on x32.
2320
2321 2013-08-27  Roland McGrath  <mcgrathr@google.com>
2322
2323         * output.cc (Output_segment::set_section_addresses): Take new
2324         Target* argument.  If target->isolate_execinstr() and the segment
2325         is executable and starts at a target->abi_pagesize() boundary,
2326         pad its end out to a target->abi_pagesize() boundary with code fill.
2327         * output.h (Output_segment::set_section_addresses): Update decl.
2328         * layout.h (Layout::check_output_data_for_reset_values): Take new
2329         argument RELAX_OUTPUTS.
2330         (Layout): New member relax_output_list_.
2331         (Layout::add_relax_output): New method.
2332         * layout.cc (Layout::Layout): Update constructor.
2333         (Layout::reset_relax_output): New method.
2334         (Layout::clean_up_after_relaxation): Call it.
2335         (Layout::prepare_for_relaxation): Update caller.
2336         (Layout::set_segment_offsets): Update callers of set_section_addresses.
2337         Call reset_relax_output before re-processing segments for
2338         isolate_execinstr case.
2339         (Layout::write_data): Handle relax_output_list_.
2340         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
2341         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
2342
2343 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
2344
2345         PR binutils/15834
2346         * object.h: Fix typos.
2347
2348 2013-08-16  Roland McGrath  <mcgrathr@google.com>
2349
2350         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
2351         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
2352
2353 2013-08-07  Cary Coutant  <ccoutant@google.com>
2354
2355         Revert support for v2 DWP files:
2356
2357         2013-03-01  Cary Coutant  <ccoutant@google.com>
2358
2359             Add dwp support for v2 DWARF package file format.
2360             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2361             tu_length parameter.  Adjust all callers.
2362             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2363             * dwp.cc: Include dwarf.h.
2364             (Section_bounds): New struct type.
2365             (Unit_set): New struct type.
2366             (Dwo_file::Dwo_file): Initialize new data member.
2367             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2368             Combine and rename to...
2369             (Dwo_file::read_unit_index): ...this.
2370             (Dwo_file::sized_read_compunit_index)
2371             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2372             (Dwo_file::sized_read_unit_index): ...this.
2373             (Dwo_file::copy_section): Remove section_name, is_str_offsets
2374             parameters; add section_id parameter.
2375             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2376             (Dwo_file::add_unit_set): ...this.
2377             (Dwo_file::shndx_map_): Remove.
2378             (Dwo_file::sect_offsets_): New data member.
2379             (Dwp_output_file::Dwp_output_file): Initialize new data members.
2380             (Dwp_output_file::add_section): Rename to...
2381             (Dwp_output_file::add_contribution): ...this.
2382             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2383             (Dwp_output_file::add_tu_set): Likewise.
2384             (Dwp_output_file::Contribution): New type.
2385             (Dwp_output_file::Section::contributions): New data member.
2386             (Dwp_output_file::Cu_or_tu_set): Remove.
2387             (Dwp_output_file::Section::Section): New ctor.
2388             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2389             (Dwp_output_file::Dwp_index::Section_table): New type.
2390             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2391             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2392             parameter.
2393             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2394             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2395             (Dwp_output_file::Dwp_index::section_table): New member function.
2396             (Dwp_output_file::Dwp_index::section_table_end): New member function.
2397             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2398             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2399             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2400             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2401             (Dwp_output_file::Dwp_index::section_table_): New data member.
2402             (Dwp_output_file::Dwp_index::section_mask_): New data member.
2403             (Dwp_output_file::add_output_section): New member function.
2404             (Dwp_output_file::write_new_section): New member function.
2405             (Dwp_output_file::write_contributions): New member function.
2406             (Dwp_output_file::section_id_map_): New data member.
2407             (class Dwo_id_info_reader): Remove.
2408             (class Unit_reader): New class.
2409             (get_dwarf_section_name): New function.
2410             (Dwo_file::read_executable): Adjust initializations of class data.
2411             (Dwo_file::read): Add support for v2 package file format.
2412             (Dwo_file::read_unit_index): Likewise.
2413             (Dwo_file::sized_read_unit_index): Likewise.
2414             (Dwo_file::copy_section): Likewise.
2415             (Dwo_file::add_unit_set): Likewise.
2416             (Dwp_output_file::add_output_section): Likewise.
2417             (Dwp_output_file::add_contribution): Likewise.
2418             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2419             for empty slot.
2420             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2421             file format.
2422             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2423             slot.
2424             (Dwp_output_file::initialize): Remove unused function.
2425             (Dwp_output_file::finalize): Add support for v2 package file format.
2426             (Dwp_output_file::write_index): Likewise.
2427             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2428             function prototype.
2429
2430 2013-07-31  Cary Coutant  <ccoutant@google.com>
2431
2432         * object.cc (Sized_relobj::do_output_section_address): New function.
2433         (Sized_relobj): Instantiate explicitly.
2434         * object.h (Object::output_section_address): New function.
2435         (Object::do_output_section_address): New function.
2436         (Sized_relobj::do_output_section_address): New function.
2437         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
2438
2439 2013-07-30  Cary Coutant  <ccoutant@google.com>
2440             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2441
2442         * parameters.cc (Parameters::entry): Return target-specific entry
2443         symbol name.
2444         * target.h (Target::entry_symbol_name): New function.
2445         (Target_info::entry_symbol_name): New data member.
2446
2447         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
2448         * i386.cc (Target_i386::i386_info): Likewise.
2449         (Target_i386_nacl::i386_nacl_info): Likewise.
2450         * sparc.cc (Target_sparc::sparc_info): Likewise.
2451         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
2452         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
2453         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
2454         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2455
2456 2013-07-22  Sterling Augustine  <saugustine@google.com>
2457
2458         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
2459         Convert parameter shndx to local variable. Add parameters symtab
2460         and symtab_size.  Scan over section names.  Find relocation
2461         section corresponding to current section.  Create and initialize
2462         reloc_mapper_ and reloc_type_.
2463         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
2464         unit_length to off_t.  Initialize member unit_length_.  Fill in field
2465         cu_offset_.
2466         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2467         Initialize new fields unit_length_ and cu_offset_.
2468         (Dwarf_pubnames_table::read_section): Update prototype.
2469         (Dwarf_pubnames_table::cu_offset): New member function.
2470         (Dwarf_pubnames_table::subsection_size): Likewise.
2471         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
2472         New fields.
2473         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
2474         member functions public.
2475         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
2476         Update comment.  Rework logic.  Move repeated parts to...
2477         (Gdb_index_info_reader::read_pubtable): ...here. New function.
2478         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
2479         pubtypes_table_, and stmt_list_offset.
2480         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2481         Gdb_index::find_pubtype_offset,
2482         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
2483         (Gdb_index::pubnames_read): Update prototype and rework logic.
2484         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
2485         Forward declare.
2486         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2487         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
2488         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
2489         Gdb_index::map_pubtable_to_dies):
2490         Declare functions.
2491         (Gdb_index::pubnames_read): Update declaration.
2492         (Gdb_index::Pubname_offset_map): New type.
2493         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
2494         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
2495         Gdb_index::stmt_list_offset): Declare.
2496         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
2497         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
2498         Gdb_index::pubtypes_offset_): Remove.
2499
2500 2013-07-19  Roland McGrath  <mcgrathr@google.com>
2501
2502         * options.h (General_options): Add -Trodata-segment option.
2503         * parameters.cc (Parameters::check_rodata_segment): New function.
2504         (Parameters::set_target_once): Call it.
2505         * parameters.h (Parameters): Declare it (private member function).
2506         * layout.cc (load_seg_unusable_for_headers): New function, broken
2507         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
2508         then validate rodata segment rather than text segment.
2509         (relaxation_loop_body): Call that.
2510         (is_text_segment): New function.  Don't admit a non-executable
2511         segment if TARGET->isolate_execinstr().
2512         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
2513
2514 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
2515
2516         PR gold/15070
2517         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
2518         * nacl.h (Sniff_file::View::View): Request aligned view.
2519
2520 2013-07-11  Cary Coutant  <ccoutant@google.com>
2521
2522         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
2523         correct BRLT entry size.
2524
2525 2013-07-03  Alan Modra  <amodra@gmail.com>
2526
2527         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
2528         comment.
2529
2530 2013-07-01  Cary Coutant  <ccoutant@google.com>
2531
2532         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
2533         reloc_type_.
2534         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
2535         (Dwarf_ranges_table::lookup_reloc): New function.
2536         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
2537         reloc_type_.
2538         (Dwarf_ranges_table::lookup_reloc): New function.
2539         (Dwarf_ranges_table::reloc_type_): New data member.
2540
2541 2013-06-27  Jing Yu  <jingyu@google.com>
2542
2543         PR gold/15662
2544         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
2545         function.
2546         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
2547         (Target_powerpc::do_relax): Call the above.
2548
2549 2013-06-27  Cary Coutant  <ccoutant@google.com>
2550
2551         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
2552         on garbage collected .opd section.
2553
2554 2013-06-27  Alan Modra  <amodra@gmail.com>
2555
2556         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
2557         is non-zero.
2558         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
2559         (Target_powerpc::do_function_location): Likewise for loc->shndx.
2560
2561 2013-06-14  Cary Coutant  <ccoutant@google.com>
2562
2563         * resolve.cc (Symbol::override_base): Don't override st_type
2564         from plugin placeholder symbols.
2565         (Symbol_table::resolve): Likewise.
2566         (Symbol_table::should_override): Don't complain about TLS mismatch
2567         if the TO symbol is a plugin placeholder.
2568         * testsuite/Makefile.am (plugin_test_tls): New test.
2569         * testsuite/Makefile.in: Regenerate.
2570         * testsuite/plugin_test_tls.sh: New test script.
2571         * testsuite/two_file_test_2_tls.cc: New test source.
2572         * testsuite/two_file_test_tls.cc: New test source.
2573
2574 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2575
2576         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
2577         the maximum segment alignment is larger than the page size.
2578         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
2579         correctly aligns the symbols with large alignemnt.
2580         * testsuite/Makefile.in: Regenerate.
2581         * testsuite/large_symbol_alignment.cc: New file.
2582
2583 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2584             Sriraman Tallam  <tmsriram@google.com>
2585
2586         * options.h (sort_section): New option.
2587         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
2588         Rename from Input_section_sort_section_name_special_ordering_compare.
2589         (Input_section_sort_section_name_compare): New struct.
2590         * output.cc (Output_section::Input_section_sort_section_name_compare::
2591         operator()): New function.
2592         (Output_section::sort_attached_input_sections): Use new sort function
2593         for .text if --sort-section=name is specified.
2594         * layout.cc (Layout::make_output_section):
2595         Add sorting by name when --sort-section=name is specified.
2596         * testsuite/Makefile.am (text_section_grouping): Test option
2597         --sort-section=name.
2598         * testsuite/Makefile.in: Regenerate.
2599         * testsuite/section_sorting_name.cc: New file.
2600         * testsuite/section_sorting_name.sh: New file.
2601
2602 2013-05-21  Cary Coutant  <ccoutant@google.com>
2603
2604         * symtab.h (Symbol::is_cxx_vtable): New function.
2605         * target-reloc.h (relocate_section): Check for vtable symbol.
2606         * testsuite/Makefile.am (missing_key_func.sh): New test case.
2607         * testsuite/Makefile.in: Regenerate.
2608         * testsuite/missing_key_func.cc: New test source.
2609         * testsuite/missing_key_func.sh: New test script.
2610
2611 2013-05-21  Cary Coutant  <ccoutant@google.com>
2612
2613         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
2614         type of enclosing symbol.
2615         (Relocate_info::location): Check symbol type when describing symbol.
2616         * object.h (Symbol_location_info): Remove unused line_number;
2617         add enclosing_symbol_type.
2618         * testsuite/debug_msg.sh: Adjust expected output.
2619
2620 2013-05-13  Cary Coutant  <ccoutant@google.com>
2621
2622         * configure.ac: Export DEFAULT_TARGET.
2623         * configure: Regenerate.
2624         * Makefile.in: Regenerate.
2625         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
2626         * testsuite/Makefile.in: Regenerate.
2627         * testsuite/debug_msg.sh: Delete duplicate tests.
2628         Don't check undef_int error message match for powerpc where the
2629         source file and line number aren't available.
2630
2631 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2632
2633         * options.h (General_options): Add --rosegment-gap option.
2634         * options.cc (finalize): --rosegment-gap implies --rosegment.
2635         * layout.cc (set_segment_offsets): Let user option override
2636         target->rosegment_gap().
2637
2638 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2639
2640         * options.h (General_options): Remove leading space from help
2641         messages for -nostdlib and --rosegment.
2642
2643 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
2644
2645         PR ld/15365
2646         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
2647
2648 2013-05-03  Alan Modra  <amodra@gmail.com>
2649
2650         * merge.cc (Output_merge_string::do_add_input_section): Correct
2651         scan for number of strings.  Rename vars to avoid shadowing.
2652         Include missing terminator in input_size_.
2653
2654 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
2655
2656         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
2657         Restore empty string handling.
2658
2659 2013-05-01  Cary Coutant  <ccoutant@google.com>
2660
2661         * stringpool.cc (Stringpool_template::new_key_offset): Fix
2662         uninitialized warning.
2663
2664 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2665
2666         * output.cc (Output_section::add_merge_input_section): Allow
2667         to merge sections if the alignment is more than character size.
2668         * merge.h (Output_merge_string::Output_merge_string): Remove
2669         assert.
2670         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
2671         only not-null strings. Check the alignment of strings.
2672         * stringpool.h
2673         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
2674         alignment as the argument.
2675         (Stringpool_template<Stringpool_char>::addralign_): New class member.
2676         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
2677         Align non-zero length strings according to the addralign_.
2678         (Stringpool_template<Stringpool_char>::set_string_offsets):
2679         Updating offsets according to the given alignment.
2680         * testsuite/Makefile.am (text_section_grouping): Test if string
2681         literals are getting merged.
2682         * testsuite/Makefile.in: Regenerate.
2683         * testsuite/merge_string_literals_1.c: New file.
2684         * testsuite/merge_string_literals_2.c: Ditto.
2685         * testsuite/merge_string_literals.sh: Ditto.
2686
2687 2013-04-26  Ian Lance Taylor  <iant@google.com>
2688
2689         * target-reloc.h (relocate_section): If the reloc offset is out of
2690         range, pass VIEW as NULL to relocate.relocate.
2691         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
2692         * i386.cc (Target_i386::Relocate::relocate): Likewise.
2693         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
2694         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
2695         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
2696         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2697
2698 2013-04-26  Geoff Pike  <gpike@chromium.org>
2699
2700         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
2701         * layout.cc (Hash_task): New class.
2702         (Layout::queue_build_id_tasks): New function.
2703         (Layout::write_build_id): Handle single-thread portion of build ID
2704         computation.  (In some cases, all of it is single-threaded.)  Replace
2705         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
2706         functionality in fewer lines of code.
2707         * layout.h (Layout::queue_build_id_tasks): New function declaration.
2708         * options.h (General_options): make "--build-id" default to tree
2709         rather than sha1.  Add two new options related to --build-id=tree:
2710         --build-id-chunk-size-for-treehash and
2711         --build-id-min-file-size-for-treehash.
2712         * Makefile.am: add testing of --build-id=tree and related new options
2713         (these tests will be invoked by "make check").
2714         * Makefile.in: Regenerate.
2715
2716 2013-04-25  Alan Modra  <amodra@gmail.com>
2717
2718         * configure.tgt: Add powerpcle and powerpc64le.
2719
2720 2013-04-22  Alan Modra  <amodra@gmail.com>
2721
2722         PR gold/15355
2723         * layout.cc (Layout::segment_precedes): Allow more than one
2724         segment with the same type and flags.
2725
2726 2013-04-15  Cary Coutant  <ccoutant@google.com>
2727
2728         * layout.cc (Layout::set_relocatable_section_offsets): Don't
2729         allocate space in file for BSS sections.
2730
2731 2013-04-15  Cary Coutant  <ccoutant@google.com>
2732
2733         * script-sections.cc (Orphan_output_section): Reset address
2734         to zero after each orphaned section for relocatable links.
2735
2736 2013-04-15  Cary Coutant  <ccoutant@google.com>
2737
2738         * symtab.cc (Symbol_table::sized_write_globals): Subtract
2739         section starting address for relocatable link.
2740         * testsuite/Makefile.am (script_test_11): New test.
2741         * testsuite/Makefile.in: Regenerate.
2742         * testsuite/script_test_11.c: New source file.
2743         * testsuite/script_test_11.t: New linker script.
2744
2745 2013-04-13  Alan Modra  <amodra@gmail.com>
2746
2747         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
2748         owner when sections are not adjacent and exceed group size.
2749         (Target_powerpc::group_sections): Handle corner case.
2750         (Target_powerpc::Branch_info::make_stub): Handle case where
2751         stub table doesn't exist due to branches in non-exec sections.
2752         (Target_powerpc::Relocate::relocate): Likewise.
2753
2754 2013-04-11  Alan Modra  <amodra@gmail.com>
2755
2756         PR gold/15354
2757         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
2758         .branch_lt to match bfd ld.  Adjust comments throughout file.
2759
2760 2013-04-04  Ian Lance Taylor  <iant@google.com>
2761
2762         GCC PR c++/56840
2763         * object.cc (do_layout_deferred_sections): Handle .eh_frame
2764         sections before checking whether they are included in the link.
2765
2766 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
2767
2768         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
2769         object before calling the plugin claim_file handler.  Pass the elf
2770         object of the archive to the plugin. Delete the elf object if the
2771         plugin claims the file.
2772
2773 2013-03-21  Alan Modra  <amodra@gmail.com>
2774
2775         * layout.cc (Layout::set_segment_offsets): Accept writable .text
2776         segment when omagic.
2777
2778 2013-03-21  Alan Modra  <amodra@gmail.com>
2779
2780         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
2781         comparison warning.
2782         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
2783         uninitialized" warning.
2784
2785 2013-03-20  Alan Modra  <amodra@gmail.com>
2786
2787         * symtab.h (Symbol::clear_version): New function.
2788         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
2789         is_needed by weak references.  Clear version for symbols defined
2790         in as-needed objects that are not needed.
2791
2792 2013-03-15  Alan Modra  <amodra@gmail.com>
2793
2794         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
2795         static and public.  Add report_err param.  Return false for data refs.
2796         (Target_powerpc::rela_dyn_section): New overloaded function.
2797         (Target_powerpc::plt_, iplt_): Elucidate.
2798         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
2799         (Output_data_plt_powerpc::do_write): Don't write .iplt.
2800         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
2801         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
2802         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
2803         push_branch and make_plt_entry for ifunc syms when
2804         reloc_needs_plt_for_ifunc.
2805         (Target_powerpc::Relocate::relocate): Don't use plt entry value
2806         for ifunc unless reloc_needs_plt_for_ifunc.
2807
2808 2013-03-15  Alan Modra  <amodra@gmail.com>
2809
2810         * gc.h (gc_process_relocs): Don't look through function descriptors.
2811         * icf.cc (get_section_contents): Do so here instead.
2812
2813 2013-03-13  Alan Modra  <amodra@gmail.com>
2814
2815         * powerpc.cc (is_branch_reloc): Forward declare.
2816         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
2817         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
2818         false for 64-bit, true for 32-bit non-branch relocs.
2819         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
2820         * testsuite/Makefile.am (icf_test): Use linker map file instead of
2821         nm output.
2822         (icf_safe_test): Generate linker map file as well as nm output.
2823         (icf_safe_so_test): Likewise.
2824         * testsuite/Makefile.in: Regenerate.
2825         * testsuite/icf_test.sh: Parse linker map file to determine
2826         section folding.
2827         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
2828         * testsuite/icf_safe_so_test.sh: Likewise.
2829         (X86_32_or_ARM_specific_safe_fold): Merge into..
2830         (arch_specific_safe_fold): ..this.
2831         (X86_64_specific_safe_fold): Delete unused function.
2832
2833 2013-03-12  Alan Modra  <amodra@gmail.com>
2834
2835         * gc.h (gc_process_relocs): Look through function descriptors
2836         to determine shndx, symvalue and addend used by ICF.  Tidy
2837         variable duplication.
2838
2839 2013-03-11  Alan Modra  <amodra@gmail.com>
2840
2841         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
2842         * layout.cc (Layout_task_runner::run): ..to here.
2843         * symtab.h (struct Symbol_location): Extract from..
2844         (class Symbol_table): ..here.
2845         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
2846         * target.h (class Target): Add function_location and
2847         do_function_location functions.
2848         (class Sized_target): Add do_function_location.
2849         * object.h (class Sized_relobj_file): Move find_shdr..
2850         (class Object): ..to here.
2851         * object.cc: Likewise.  Update to suit.  Instantiate.
2852         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
2853         * powerpc.cc (class Powerpc_dynobj): New.
2854         (Target_powerpc::do_function_location): New function.
2855         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
2856         (Powerpc_dynobj::do_read_symbols): New function.
2857         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
2858
2859 2013-03-08  Ian Lance Taylor  <iant@google.com>
2860
2861         * options.cc (General_options::string_to_object_format): Accept
2862         "default".
2863
2864 2013-03-08  Alan Modra  <amodra@gmail.com>
2865
2866         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
2867         pointer to Post_fde.
2868         (struct Post_fde): Move definition to here..
2869         * ehframe.cc (struct Post_fde): ..from here.
2870         (Cie::write): Don't alloc Post_fde.
2871         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
2872
2873 2013-03-07  Alan Modra  <amodra@gmail.com>
2874
2875         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
2876         relocation referencing .LC0.
2877         * testsuite/discard_locals_test.sh: Remove FIXMEs.
2878
2879 2013-03-07  Alan Modra  <amodra@gmail.com>
2880
2881         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
2882         always_inline.  Add assembly for powerpc to avoid GOT.
2883
2884 2013-03-07  Alan Modra  <amodra@gmail.com>
2885
2886         * testsuite/script_test_10.sh: Don't test .bss section
2887         header number.
2888
2889 2013-03-06  Alan Modra  <amodra@gmail.com>
2890
2891         * powerpc.cc (class Powerpc_relobj): Move some member functions.
2892         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
2893         all callers.  Handle folded sections.
2894         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
2895         to Powerpc_relobj.
2896         (Global_symbol_visitor_opd::operator()): Likewise.
2897
2898 2013-03-04  Alan Modra  <amodra@gmail.com>
2899
2900         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
2901         * testsuite/Makefile.in: Regenerate.
2902
2903 2013-03-01  Cary Coutant  <ccoutant@google.com>
2904
2905         Add dwp support for v2 DWARF package file format.
2906         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2907         tu_length parameter.  Adjust all callers.
2908         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2909         * dwp.cc: Include dwarf.h.
2910         (Section_bounds): New struct type.
2911         (Unit_set): New struct type.
2912         (Dwo_file::Dwo_file): Initialize new data member.
2913         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2914         Combine and rename to...
2915         (Dwo_file::read_unit_index): ...this.
2916         (Dwo_file::sized_read_compunit_index)
2917         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2918         (Dwo_file::sized_read_unit_index): ...this.
2919         (Dwo_file::copy_section): Remove section_name, is_str_offsets
2920         parameters; add section_id parameter.
2921         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2922         (Dwo_file::add_unit_set): ...this.
2923         (Dwo_file::shndx_map_): Remove.
2924         (Dwo_file::sect_offsets_): New data member.
2925         (Dwp_output_file::Dwp_output_file): Initialize new data members.
2926         (Dwp_output_file::add_section): Rename to...
2927         (Dwp_output_file::add_contribution): ...this.
2928         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2929         (Dwp_output_file::add_tu_set): Likewise.
2930         (Dwp_output_file::Contribution): New type.
2931         (Dwp_output_file::Section::contributions): New data member.
2932         (Dwp_output_file::Cu_or_tu_set): Remove.
2933         (Dwp_output_file::Section::Section): New ctor.
2934         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2935         (Dwp_output_file::Dwp_index::Section_table): New type.
2936         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2937         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2938         parameter.
2939         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2940         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2941         (Dwp_output_file::Dwp_index::section_table): New member function.
2942         (Dwp_output_file::Dwp_index::section_table_end): New member function.
2943         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2944         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2945         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2946         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2947         (Dwp_output_file::Dwp_index::section_table_): New data member.
2948         (Dwp_output_file::Dwp_index::section_mask_): New data member.
2949         (Dwp_output_file::add_output_section): New member function.
2950         (Dwp_output_file::write_new_section): New member function.
2951         (Dwp_output_file::write_contributions): New member function.
2952         (Dwp_output_file::section_id_map_): New data member.
2953         (class Dwo_id_info_reader): Remove.
2954         (class Unit_reader): New class.
2955         (get_dwarf_section_name): New function.
2956         (Dwo_file::read_executable): Adjust initializations of class data.
2957         (Dwo_file::read): Add support for v2 package file format.
2958         (Dwo_file::read_unit_index): Likewise.
2959         (Dwo_file::sized_read_unit_index): Likewise.
2960         (Dwo_file::copy_section): Likewise.
2961         (Dwo_file::add_unit_set): Likewise.
2962         (Dwp_output_file::add_output_section): Likewise.
2963         (Dwp_output_file::add_contribution): Likewise.
2964         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2965         for empty slot.
2966         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2967         file format.
2968         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2969         slot.
2970         (Dwp_output_file::initialize): Remove unused function.
2971         (Dwp_output_file::finalize): Add support for v2 package file format.
2972         (Dwp_output_file::write_index): Likewise.
2973         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2974         function prototype.
2975
2976 2013-03-01  Cary Coutant  <ccoutant@google.com>
2977
2978         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
2979         function into class definition in header file.
2980         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
2981         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
2982         New function.
2983         (Dwarf_info_reader::check_buffer): Move here from .cc file.
2984
2985 2013-02-28  Alan Modra  <amodra@gmail.com>
2986
2987         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
2988         * target.cc (Target::do_plt_fde_location): New function.
2989         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
2990         accessor function, and constructor param.
2991         (struct Post_fde, Post_fdes): Declare.
2992         (Cie::write): Add post_fdes param.
2993         * ehframe.cc (Fde::write): Use plt_fde_location.
2994         (struct Post_fde): Define.
2995         (Cie::write): Stash FDEs added post merge mapping.
2996         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
2997         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
2998         (Eh_frame::do_sized_write): Arrange to write post map FDES after
2999         other FDEs.
3000         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
3001         (Target_powerpc::has_glink): New function.
3002         (Target_powerpc::do_relax): Add eh_frame info for stubs.
3003         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
3004         glink_eh_frame_fde_32, default_fde): New data.
3005         (Stub_table::eh_frame_added_): New var.
3006         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
3007         Make const.
3008         (Stub_table::add_eh_frame): New function.
3009         (Output_data_glink::add_eh_frame): New function.
3010         (Target_powerpc::make_glink_section): Call add_eh_frame.
3011
3012 2013-02-15  Ian Lance Taylor  <iant@google.com>
3013
3014         * options.h (DEFINE_uint64_alias): Define.
3015         (class General_options): Add -Ttext-segment as an alias for
3016         -Ttext.
3017
3018 2013-02-15  Alan Modra  <amodra@gmail.com>
3019
3020         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
3021         (Stub_table::do_write): ..here, two places.
3022         (Stub_table::plt_call_size): Use it here too.
3023
3024 2013-02-11  Ian Lance Taylor  <iant@google.com>
3025
3026         * descriptors.cc (Descriptors::close_all): New function.
3027         * descriptors.h (class Descriptors): Declare close_all.
3028         (close_all_descriptors): New inline function.
3029         * plugin.cc: Include "descriptors.h".
3030         (Plugin_manager::cleanup): Call close_all_descriptors.
3031
3032 2013-02-06  Alan Modra  <amodra@gmail.com>
3033
3034         * README: Update coding style link.
3035
3036 2013-01-28  Cary Coutant  <ccoutant@google.com>
3037
3038         * dwp.cc (File_list): New typedef.
3039         (Dwo_name_info_reader): New class.
3040         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
3041         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
3042         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
3043         (Dwo_file::read_executable): New function.
3044         (Dwo_file::read): Move common setup code to ...
3045         (Dwo_file::make_object): ... here.
3046         (dwp_options): Add --exec/-e.
3047         (usage): Likewise.
3048         (main): Likewise.
3049
3050 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
3051
3052         * layout.cc (Layout::layout): Check for option text_reorder.
3053         (Layout::make_output_section): Ditto.
3054         * options.h (text_reorder): New option.
3055         * output.cc (Input_section_sort_compare): Remove special ordering
3056         of section names.
3057         (Output_section::
3058          Input_section_sort_section_name_special_ordering_compare::
3059          operator()): New function.
3060         (Output_section::sort_attached_input_sections): Use new sort function
3061         for .text.
3062         * output.h (Input_section_sort_section_name_special_ordering_compare):
3063         New struct.
3064         * testsuite/Makefile.am (text_section_grouping): Test option
3065         --no-text-reorder
3066         * testsuite/Makefile.in: Regenerate.
3067         * testsuite/text_section_grouping.sh: Check order of functions without
3068         default text reordering.
3069
3070 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3071
3072         * options.h (General_options): Change default to true for new_dtags.
3073
3074 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3075
3076         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
3077         when enable_new_dtags is false.  Only add DT_RUNPATH when
3078         enable_new_dtags is true.
3079
3080 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
3081
3082         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
3083         used in declaration and definition consistent.
3084         (Target_powerpc::symval_for_branch): Ditto.
3085
3086 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3087
3088         * testsuite/plugin_final_layout.cc: Fix comment.
3089
3090 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3091
3092         * layout.cc (Layout::layout): Do not do default sorting for
3093         text sections when section ordering is specified.
3094         (make_output_section): Ditto.
3095         * testsuite/plugin_final_layout.cc: Name the function sections
3096         to catch reordering issues.
3097
3098 2013-01-15  Alan Modra  <amodra@gmail.com>
3099
3100         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
3101         plt-thread-safe.
3102
3103 2013-01-15  Alan Modra  <amodra@gmail.com>
3104
3105         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
3106         * testsuite/Makefile.in: Regenerate.
3107
3108 2013-01-14  Alan Modra  <amodra@gmail.com>
3109
3110         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
3111         * testsuite/Makefile.in: Regenerate.
3112
3113 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
3114
3115         PR bfd/14430
3116         Fix mingw gold build with plugins enabled
3117         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
3118         * configure.ac: Export DLOPEN_LIBS and add headers check.
3119         * plugin.cc: Handle non-dlfcn case.
3120         * Makefile.in: Regenerate.
3121         * config.in: Regenerate.
3122         * configure: Regenerate.
3123         * testsuite/Makefile.in: Regenerate.
3124
3125 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
3126
3127         * output.h (sort_attached_input_sections): Change to be public.
3128         * script-sections.cc
3129         (Output_section_definition::set_section_addresses): Sort
3130         attached input sections according to section order before linker
3131         script assigns section addresses.
3132         (Orphan_output_section::set_section_addresses): Sort
3133         attached input sections according to section order before linker
3134         script assigns section addresses.
3135         * Makefile.am (final_layout.sh): Use a simple linker script to
3136         check if section ordering still works.
3137         * Makefile.in: Regenerate.
3138
3139 2013-01-09  Ben Cheng  <bccheng@google.com>
3140
3141         * arm.cc (Target_arm::attributes_accept_div): New function.
3142         (Target_arm::attributes_forbid_div): New function.
3143         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
3144         attribute using the same new functions as what bfd/elf32_arm.c
3145         does.
3146
3147 2013-01-07  Cary Coutant  <ccoutant@google.com>
3148
3149         PR gold/14993
3150         * output.cc (Output_section::add_input_section): For incremental
3151         updates, don't track input sections that are allocated from patch
3152         space.
3153
3154 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3155             Ian Lance Taylor  <iant@google.com>
3156
3157         PR gold/14897
3158         * configure.ac (--enable-ld): Removed.
3159         (install_as_default): Set to yes only for --enable-gold=default
3160         or --disable-ld.
3161         * configure: Regenerated.
3162
3163 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3164
3165         * options.h (General_options): Add -fuse-ld= for GCC linker
3166         option compatibility.
3167
3168 2013-01-04  Cary Coutant  <ccoutant@google.com>
3169
3170         * configure.ac: Fix typo restoring CXXFLAGS.
3171         * configure: Regenerate.
3172
3173 2013-01-04  Cary Coutant  <ccoutant@google.com>
3174
3175         * testsuite/Makefile.am (CXXLINK_S): New macro.
3176         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
3177         * testsuite/Makefile.in: Regenerate.
3178
3179 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
3180
3181         * version.cc (print_version): Update copyright year to 2013.
3182
3183 2012-12-20  Ian Lance Taylor  <iant@google.com>
3184
3185         * layout.cc (Layout::special_ordering_of_input_section): New
3186         function.
3187         (Layout::layout): If input section requires special ordering, must
3188         sort input sections.
3189         (Layout::make_output_section): May sort .text input sections.
3190         (Layout::is_section_name_prefix_grouped): Remove.
3191         * layout.h (class Layout): Declare
3192         special_ordering_of_input_section.  Don't declare
3193         is_section_name_prefix_grouped.
3194         * output.cc (Output_section::add_input_section): Revert last
3195         change.
3196         (Output_section::Input_section_sort::match_file_name): Don't crash
3197         if called on output section data.
3198         (Output_section::Input_section_sort_compare): Sort based on
3199         special ordering.
3200         (Output_section::Input_section_sort_section_order_index_compare):
3201         Revert last patch.
3202         (Output_section::sort_attached_input_sections): Likewise.
3203
3204 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
3205
3206         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
3207         * layout.h (Layout::is_section_name_prefix_grouped): New function.
3208         * output.cc (Output_section::add_input_section): Check if section
3209         name contains special prefix.  Keep input sections to sort such
3210         sections.
3211         (Output_section::Input_section_sort_section_order_index_compare
3212          ::operator()): Group sections according to prefixes.
3213         (Output_section::sort_attached_input_sections): Add condition to
3214         Input_section_entry constructor call.
3215         * testsuite/Makefile.am (text_section_grouping): New test.
3216         * testsuite/Makefile.in: Regenerate.
3217         * testsuite/text_section_grouping.cc: New file.
3218         * testsuite/text_section_grouping.sh: New file.
3219
3220 2012-12-17  Nick Clifton  <nickc@redhat.com>
3221
3222         * Makefile.am: Add copyright notice.
3223         * NEWS: Likewise.
3224         * README: Likewise.
3225         * configure.ac: Likewise.
3226         * ftruncate.c: Likewise.
3227         * Makefile.in: Regenerate.
3228
3229 2012-12-14  Cary Coutant  <ccoutant@google.com>
3230
3231         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
3232         --no-as-needed flag.
3233         (exception_separate_shared_12_test): Likewise.
3234         (incremental_copy_test): Likewise.
3235         * testsuite/Makefile.in: Regenerate.
3236
3237 2012-12-14  Cary Coutant  <ccoutant@google.com>
3238
3239         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
3240         (Dwp_output_file::Dwp_index::enter_set): Add assert.
3241
3242 2012-12-12  Alan Modra  <amodra@gmail.com>
3243
3244         * powerpc.cc (class Track_tls): New.
3245         (class Relocate, class Scan): Inherit Track_tls.
3246         (Target_powerpc::Scan::local, global): Track tls optimization
3247         and avoid creating plt entry for __tls_get_addr if all uses
3248         are optimized away.
3249         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
3250
3251 2012-12-12  Alan Modra  <amodra@gmail.com>
3252
3253         * options.h (General_options): Add --toc-sort/--no-toc-sort.
3254         Replace no_toc_optimize with toc_optimize.
3255         * output.h (Output_section::input_sections): Provide non-const variant.
3256         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
3257         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
3258         accessors.
3259         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
3260         (class Sort_toc_sections): New.
3261         (Target_powerpc::do_finalize_sections): Sort toc sections.
3262         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
3263
3264 2012-12-10  Roland McGrath  <mcgrathr@google.com>
3265
3266         * testsuite/binary_unittest.cc (read_all): New function.
3267         (Sized_binary_test): Use it instead of ::read.
3268         * fileread.cc (do_read): Don't assume pread always reads the whole
3269         amount in a single call.
3270
3271 2012-12-10  Alan Modra  <amodra@gmail.com>
3272
3273         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
3274         Set EM_PPC64 or EM_PPC here.
3275         (Target_selector_powerpc::do_recognize): Delete.
3276
3277 2012-12-10  Alan Modra  <amodra@gmail.com>
3278
3279         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
3280         stub_table_.
3281         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
3282
3283 2012-12-07  Roland McGrath  <mcgrathr@google.com>
3284
3285         * testsuite/binary_unittest.cc (Sized_binary_test):
3286         Use open_descriptor rather than ::open.
3287
3288 2012-12-07  Alan Modra  <amodra@gmail.com>
3289
3290         * powerpc.cc (Stub_table::do_write): Delete redundant Address
3291         typedef and invalid_address constant.
3292         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
3293         instantiate constants.
3294
3295 2012-12-06  Roland McGrath  <mcgrathr@google.com>
3296
3297         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
3298         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
3299         * aclocal.m4: Regenerate.
3300         * configure: Regenerate.
3301         * Makefile.in: Regenerate.
3302         * testsuite/Makefile.in: Regenerate.
3303
3304 2012-12-07  Alan Modra  <amodra@gmail.com>
3305
3306         * options.h (General_options): Add no_toc_optimize.
3307         * powerpc.cc (ok_lo_toc_insn): New function.
3308         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
3309
3310 2012-12-06  Alan Modra  <amodra@gmail.com>
3311
3312         * options.h (General_options): Add plt_align, plt_static_chain,
3313         plt_thread_safe.  Update stub_group_size help text.
3314         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
3315         for new plt_thread_safe_ var.
3316         (use_plt_offset): Correct comments.
3317         (Target_powerpc::do_relax): Look for thread creation symbols to
3318         determine default plt_thread_safe value.  Clear plt call stubs
3319         as well as branch stubs each iteration.
3320         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
3321         insn constants.
3322         (l, hi, ha, write_insn): Move earlier.
3323         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
3324         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
3325         plt stubs too.
3326         (Stub_table::update_size): Adjust.
3327         (Stub_table::prev_size, set_prev_size): Delete.
3328         (Stub_table::stub_align): Let --plt-align affect result.
3329         (Stub_table::plt_call_size): Calculate sizes for various stubs.
3330         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
3331         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
3332         (Stub_table::do_write): Support more stub variants.
3333
3334 2012-12-04  Alan Modra  <amodra@gmail.com>
3335
3336         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
3337         (Target_powerpc::do_define_standard_symbols): New function.
3338
3339 2012-12-03  Alan Modra  <amodra@gmail.com>
3340
3341         * output.h: Formatting, whitespace.
3342
3343 2012-12-03  Alan Modra  <amodra@gmail.com>
3344
3345         * layout.h (Layout::get_executable_sections): Declare.
3346         * layout.cc (Layout::get_executable_sections): New function.
3347         * arm.cc (Target_arm::group_sections): Use it.
3348         (Arm_output_section::group_sections): Delete now redundant test.
3349         * output.cc (Output_reloc::Output_reloc): Add is_relative.
3350         param to handle relative relocs.
3351         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
3352         (Output_data_reloc::add_absolute): Adjust.
3353         (Output_data_reloc::add_relative): New function.
3354         (Output_data::reset_data_size): New function.
3355         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
3356         (Output_section::set_addralign): New function.
3357         (Output_section::checkpoint_set_addralign): New function.
3358         (Output_section::clear_section_offsets_need_adjustment): New function.
3359         (Output_section::input_sections): Make public.
3360         * powerpc.cc (class Output_data_brlt_powerpc): New.
3361         (class Stub_table, class Stub_control): New.
3362         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
3363         stub_table_, set_stub_table, stub_table): New vectors and accessor
3364         functions.
3365         (Target_powerpc::do_may_relax, do_relax, push_branch,
3366         new_stub_table, stub_tables, brlt_section, group_sections,
3367         add_branch_lookup_table, find_branch_lookup_table,
3368         write_branch_lookup_table, make_brlt_section): New functions.
3369         (Target_powerpc::struct Sort_sections, class Branch_info): New.
3370         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
3371         branch_info_): New vars.
3372         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
3373         make call stubs here.
3374         (Output_data_glink): Remove all call stub handling from this class.
3375         (Target_powerpc::Scan::local, global): Save interesting branch
3376         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
3377         (Target_powerpc::do_finalize_sections): Only make reg save/restore
3378         functions on final link.
3379         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
3380         Handle long branch destinations too.
3381         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
3382         do_plt_address_for_local): Adjust lookup of plt call stubs.
3383
3384 2012-11-30  Alan Modra  <amodra@gmail.com>
3385
3386         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
3387         relocs against protected symbols when building 32-bit shared libs.
3388
3389 2012-11-30  Alan Modra  <amodra@gmail.com>
3390
3391         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
3392         param.  Call got_section() to make .got.  Update all callers
3393         and their callers and so on.
3394
3395 2012-11-30  Alan Modra  <amodra@gmail.com>
3396
3397         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
3398         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
3399         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
3400         value if it already exists.
3401
3402 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
3403
3404         PR gold/14858
3405         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
3406
3407 2012-11-14  Roland McGrath  <mcgrathr@google.com>
3408
3409         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
3410         than bfc instruction for data sandboxing.
3411
3412 2012-11-08  Alan Modra  <amodra@gmail.com>
3413
3414         * po/POTFILES.in: Regenerate.
3415
3416 2012-11-05  Alan Modra  <amodra@gmail.com>
3417
3418         * configure.ac: Apply 2012-09-10 change to config.in here.
3419         * configure: Regenerate.
3420
3421 2012-11-05  Alan Modra  <amodra@gmail.com>
3422
3423         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
3424         (struct Opd_ent): Use "Address" rather than "Offset".
3425         (Output_data_got_powerpc::got_base_offset): Return Valtype.
3426         (Target_powerpc::got_section): Make public.
3427         (Target_powerpc::scan_relocs): Move code setting symbols..
3428         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
3429         Create _SDA_BASE_ only when referenced.
3430
3431 2012-11-02  Roland McGrath  <mcgrathr@google.com>
3432
3433         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
3434         from last change.
3435
3436 2012-11-01  Roland McGrath  <mcgrathr@google.com>
3437
3438         * target.h (Sized_target::relocate_relocs): Use Elf_Off
3439         for offset_in_output_section parameter.
3440         (Sized_target::relocate_special_relocatable): Likewise.
3441         * arm.cc (Target_arm::relocate_relocs): Likewise.
3442         (Target_arm::relocate_special_relocatable): Likewise.
3443         * i386.cc (Target_i386::relocate_relocs): Likewise.
3444         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
3445         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
3446         * target-reloc.h (relocate_relocs): Likewise.
3447         * testsuite/testfile.cc (Target_test): Likewise.
3448         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
3449         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
3450
3451         * system.h: Move inclusion of <clocale> to after <libintl.h> in
3452         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
3453
3454         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
3455         parameter, which is unused in the [!F_SETFD] case.
3456
3457         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
3458         SYMNDX to off_t before comparing it to this->data_size().
3459         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
3460         * incremental.cc (Output_section_incremental_inputs::do_write):
3461         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
3462
3463         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
3464
3465 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
3466
3467         * gold.cc (Target_arm::do_adjust_elf_header): Add the
3468         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
3469         in EABI_VER5.
3470
3471 2012-10-29  Cary Coutant  <ccoutant@google.com>
3472
3473         * dwp.cc (usage): Add file and exit status parameters;
3474         add --help and --version options.
3475         (print_version): New function.
3476         (main): Add --help and --version options.
3477
3478 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3479
3480         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
3481         final_layout_sequence.txt.
3482         * testsuite/Makefile.in: Regenerated.
3483
3484 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3485
3486         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
3487         COMPILE generated by automake.
3488         (LINK1): Likewise.
3489         (CXXCOMPILE1): Likewise.
3490         (CXXLINK1): Likewise.
3491         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
3492         (LINK): Likewise.
3493         (CXXCOMPILE): Likewise.
3494         (CXXLINK): Likewise.
3495         * testsuite/Makefile.in: Regenerated.
3496
3497 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3498
3499         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
3500         on bad fwrite return.
3501
3502 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3503
3504         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
3505         on val.
3506
3507 2012-10-23  Cary Coutant  <ccoutant@google.com>
3508
3509         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
3510         * testsuite/Makefile.in: Regenerate.
3511         * testsuite/dwp_test.h: New source file.
3512         * testsuite/dwp_test_1.cc: New source file.
3513         * testsuite/dwp_test_1.s: New source file.
3514         * testsuite/dwp_test_1.sh: New source file.
3515         * testsuite/dwp_test_1b.cc: New source file.
3516         * testsuite/dwp_test_1b.s: New source file.
3517         * testsuite/dwp_test_2.cc: New source file.
3518         * testsuite/dwp_test_2.s: New source file.
3519         * testsuite/dwp_test_2.sh: New source file.
3520         * testsuite/dwp_test_main.cc: New source file.
3521         * testsuite/dwp_test_main.s: New source file.
3522
3523 2012-10-23  Cary Coutant  <ccoutant@google.com>
3524
3525         * dwp.h: New header file.
3526         * dwp.cc: New source file.
3527         * gold.h: Move shared declarations to system.h.
3528         * system.h: New header file.
3529         * Makefile.am: Add dwp.
3530         * Makefile.in: Regenerate.
3531
3532 2012-10-23  Cary Coutant  <ccoutant@google.com>
3533
3534         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
3535         Dwarf_info_reader::read_from_pointer.
3536         (Dwarf_pubnames_table::read_header): Likewise.
3537         (Dwarf_pubnames_table::next_name): Likewise.
3538         (Dwarf_die::read_attributes): Likewise.
3539         (Dwarf_die::skip_attributes): Likewise.
3540         (Dwarf_info_reader::read_from_pointer): New function template.
3541         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
3542         (Dwarf_pubnames_table): Likewise.
3543         (Dwarf_info_reader::read_from_pointer): New function template.
3544         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
3545         Dwarf_pubnames_table ctor.
3546
3547 2012-10-23  Cary Coutant  <ccoutant@google.com>
3548
3549         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
3550         abbrev_shndx.
3551         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
3552         abbrev_shndx_.
3553         (Dwarf_info_reader::set_abbrev_shndx): New method.
3554         (Dwarf_info_reader::abbrev_shndx_): New data member.
3555
3556 2012-10-23  Cary Coutant  <ccoutant@google.com>
3557
3558         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
3559         from object, not parameters.
3560         (Dwarf_info_reader::parse): Likewise.
3561         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
3562         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
3563         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
3564         methods.
3565
3566 2012-10-23  Cary Coutant  <ccoutant@google.com>
3567
3568         * fileread.cc (Input_file::Input_file): New constructor.
3569         * fileread.h (class Input_file): Add new constructor.
3570
3571 2012-10-18  Alan Modra  <amodra@gmail.com>
3572
3573         PR gold/14727
3574         * object.cc (Relobj::is_section_name_included): Also match
3575         .sdata personality section.
3576
3577 2012-10-18  Alan Modra  <amodra@gmail.com>
3578
3579         * target-reloc.h (class Default_comdat_behavior): New, package up..
3580         (get_comdat_behaviour): ..this.
3581         (relocate_section): Add Relocate_comdat_behavior template arg,
3582         adjust code to suit.
3583         * arm.cc (Target_arm::relocate_section): Adjust to suit.
3584         (Target_arm::scan_reloc_section): Likewise.
3585         * i386.cc (Target_i386::relocate_section): Likewise.
3586         * sparc.cc (Target_sparc::relocate_section): Likewise.
3587         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
3588         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
3589         * powerpc.cc (class Relocate_comdat_behavior): New.
3590         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
3591         gold::relocate_section with new template arg.
3592
3593 2012-10-18  Alan Modra  <amodra@gmail.com>
3594
3595         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
3596         dynamic relocs for GOT_TPREL got entries, without symbol if
3597         resolving locally.
3598         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
3599         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
3600         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
3601
3602 2012-10-17  Alan Modra  <amodra@gmail.com>
3603
3604         PR gold/14726
3605         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
3606
3607 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
3608
3609         * layout.cc (Layout::include_section): Keep sections marked
3610         SHF_EXCLUDE when doing relocatable links.
3611
3612 2012-10-16  Alan Modra  <amodra@gmail.com>
3613
3614         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
3615         (Target_powerpc::do_finalize_sections): Call it.
3616         (Output_data_save_res): New class and supporting functions.
3617         (Target_powerpc::symval_for_branch): Only look up .opd entry for
3618         normal symbols defined in object files.
3619
3620 2012-10-12  Alan Modra  <amodra@gmail.com>
3621
3622         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
3623         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
3624         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
3625         section if scan_opd_relocs not yet called.
3626         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
3627
3628 2012-10-12  Alan Modra  <amodra@gmail.com>
3629
3630         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3631         add_local_ifunc_entry): Revert last change.
3632         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
3633
3634 2012-10-05  Alan Modra  <amodra@gmail.com>
3635
3636         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
3637         do_plt_address_for_global): New functions.
3638         (Output_data_got_powerpc::do_write): Don't segfault when linking
3639         statically.
3640         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3641         add_local_ifunc_entry): Return true on adding entry..
3642         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
3643         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
3644         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
3645         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
3646         set up symbols here.
3647         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
3648         syms here.  Do so even when no .iplt.  Don't segfault when linking
3649         statically.
3650         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
3651         new variants without reloc param.
3652         (Glink_sym_ent::Glink_sym_ent): Likewise.
3653         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
3654         reloc when refs will resolve to plt call stub.
3655         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
3656         R_PPC_PLTREL24 to resolve locally.
3657         (Target_powerpc::Scan::global): Correct ifunc handling.
3658         (Target_powerpc::Relocate::relocate): Correct local sym glink
3659         lookup.  Don't destroy "value" when we have a plt call stub,
3660         and when checking plt call validity.
3661         (Target_powerpc::do_dynsym_value): Simplify.
3662
3663 2012-10-05  Alan Modra  <amodra@gmail.com>
3664
3665         * i386.cc (Output_data_plt_i386::address_for_global,
3666         address_for_local): Add plt offset to returned value.  Adjust uses.
3667         * sparc.cc (Output_data_plt_sparc::address_for_global,
3668         address_for_local): Likewise.
3669         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
3670         address_for_local): Likewise.
3671         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
3672         address_for_local): Likewise.
3673         * target.h (Target::plt_address_for_global, plt_address_for_local):
3674         Update comment.
3675         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
3676         (Output_data_got::Got_entry::write): Nor here.
3677         * output.h: Comment fix.
3678
3679 2012-10-02  Jiong Wang  <jiwang@tilera.com>
3680
3681         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
3682         global_offset_table_ value for larget got.
3683         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
3684
3685 2012-09-29  Alan Modra  <amodra@gmail.com>
3686
3687         * powerpc.cc (Target_powerpc::iplt_): New output section.
3688         (Target_powerpc::iplt_section, make_iplt_section,
3689         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
3690         (Target_powerpc::make_plt_entry): Handle ifunc syms.
3691         Target_powerpc::plt_entry_count): Count iplt entries too.
3692         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
3693         reloc section in constructor.  New params.
3694         (Target_powerpc::make_plt_section): Create reloc section here instead.
3695         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
3696         functions.
3697         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
3698         (Output_data_glink::add_entry, find_entry): New functions to
3699         deal with local syms.
3700         (Glink_sym_ent): Add support for local syms.
3701         (Output_data_glink::do_write): Handle ifunc plt entries.
3702         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3703         (Target_powerpc::Scan::local, global): Handle ifunc syms.
3704         (Target_powerpc::Relocate::relocate): Likewise.
3705         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
3706
3707 2012-09-25  Alan Modra  <amodra@gmail.com>
3708
3709         * object.h (Sized_relobj_file::adjust_local_symbol,
3710         do_adjust_local_symbol): New functions.
3711         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
3712         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
3713         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
3714         and irregular opd entry spacing.
3715         (Powerpc_relobj::do_read_relocs): Add opd size checks.
3716         (Global_symbol_visitor_opd): New functor.
3717         (Target_powerpc::do_finalize_sections): Omit global symbols defined
3718         on deleted opd entries.
3719
3720 2012-09-15  Jiong Wang  <jiwang@tilera.com>
3721
3722         * tilegx.cc: New file.
3723         * Makefile.am (TARGETSOURCES): Add tilegx.cc
3724         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
3725         * configure.tgt: Add entries for tilegx*.
3726         * configure.ac: Likewise.
3727         * Makefile.in: Rebuild.
3728         * configure: Likewise.
3729         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
3730         tilegx.
3731
3732 2012-09-13  Alan Modra  <amodra@gmail.com>
3733
3734         * target-reloc.h (scan_relocs): Call scan.local for relocs
3735         against symbols in discarded sections.  Pass is_discarded
3736         param.
3737         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
3738         Add is_discarded param.
3739         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
3740         is_discarded to flag opd entry as discarded.  Don't emit dyn
3741         relocs on such entries.
3742         (Target_powerpc::Scan::global): Similarly detect and handle
3743         such opd entries.
3744         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
3745         opd_ent_.  Update all uses.
3746         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
3747         (Target_powerpc::relocate_section): Zero out discarded opd
3748         entry relocs.
3749
3750 2012-09-12  Ian Lance Taylor  <iant@google.com>
3751
3752         PR gold/14570
3753         * output.cc: Rename Output_data_got template parameter from size
3754         to got_size for all functions.  Compile all variants of
3755         Output_data_got.
3756         (Output_data_got::Got_entry::write): Correct use of size for
3757         symbol value.  Use local_is_tls rather than casting to
3758         Sized_relobj_file.
3759         * object.h (class Object): Add local_is_tls and do_local_is_tls.
3760         (class Sized_relobj_file): Add do_local_is_tls.
3761         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
3762
3763 2012-09-11  Alan Modra  <amodra@gmail.com>
3764
3765         PR gold/14566
3766         * layout.cc (Layout::set_segment_offsets): When using
3767         common-page-size alignment, ensure we are on a new max-page-size
3768         page.
3769         * output.cc (Output_segment::set_section_addresses): Use
3770         abi_pagesize, not common_pagesize for relro boundary.
3771         (Output_segment::set_offset): Likewise.
3772
3773 2012-09-11  Alan Modra  <amodra@gmail.com>
3774
3775         * output.h (Output_data_got::add_global_tls, add_local_tls,
3776         add_local_tls_pair): New functions.
3777         (Output_data_got::add_local_pair_with_rel): Remove second
3778         reloc param.  Expand comment.
3779         (Output_data_got::Got_entry): Rename use_plt_offset_ to
3780         use_plt_or_tls_offset_, similarly for constructor param.
3781         (Output_data_got::Got_entry::write): Add got_index param.
3782         * output.cc (Output_data_got::add_global_tls, add_local_tls,
3783         add_local_tls_pair): New functions.
3784         (Output_data_got::Got_entry::write): Handle tls symbols
3785         with use_plt_or_tls_offset_ set specially.
3786         (Output_data_got::add_local_pair_with_rel): Only one reloc.
3787         (Output_data_got::do_write): Replace iterator with index, pass
3788         index to entry write function.
3789         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
3790         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
3791         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
3792         call.
3793         * i386.cc (Target_i386::Scan::local): Likewise.
3794         * sparc.cc (Target_sparc::Scan::local): Likewise.
3795         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
3796         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
3797         do_tls_offset_for_global): New functions.
3798         (Target_powerpc::Scan::local): Correct TLS relocations and got
3799         entry values.
3800         (Target_powerpc::Scan::global): Don't emit unnecessary
3801         dynamic relocations on TLS GOT entries.
3802
3803 2012-09-10  Matthias Klose  <doko@ubuntu.com>
3804
3805         * config.in: Disable sanity check for kfreebsd.
3806
3807 2012-09-10  Sterling Augustine  <saugustine@google.com>
3808
3809         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
3810         (Gdb_index::pubtypes_read): New parameter.
3811         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
3812         to calls.
3813         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
3814         pubtypes_object_.
3815
3816 2012-09-09  Alan Modra  <amodra@gmail.com>
3817
3818         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
3819         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
3820         * gc.h (gc_process_relocs): Call target gc_add_reference.
3821         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
3822         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
3823         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
3824         unnecessary cast.
3825         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
3826         to cater for when we don't need code offset.  Update use.
3827         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
3828         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
3829         set_opd_valid): New functions.
3830         (Target_powerpc::do_gc_add_reference): New function.
3831         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
3832         stashed refs.
3833         (Target_powerpc::do_gc_mark_symbol): New function.
3834
3835 2012-09-06  Cary Coutant  <ccoutant@google.com>
3836
3837         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
3838         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
3839         (Dwarf_die::skip_attributes): Likewise.
3840         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
3841         * testsuite/gdb_index_test.cc (inline_func_1): New function.
3842         (main): Call it.
3843         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
3844
3845 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
3846
3847         * testsuite/script_test_3.t: Add .got.plt output section
3848         statement.
3849         * testsuite/script_test_4.t: Likewise.
3850
3851 2012-09-05  Alan Modra  <amodra@gmail.com>
3852
3853         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
3854         update all uses and lose "enum" when using type.
3855
3856 2012-09-05  Alan Modra  <amodra@gmail.com>
3857
3858         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
3859         * configure: Regenerate.
3860         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
3861         (plugin_final_layout.stdout): Likewise.
3862         (memory_test): Set page sizes to 0x1000.
3863         * testsuite/Makefile.in: Regenerate.
3864         * testsuite/discard_locals_test.sh: Add FIXME comment.
3865         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
3866         * testsuite/pr14265.t: Add .got output section statement.
3867         * testsuite/script_test_2.t: Likewise.
3868         * testsuite/script_test_3.t: Likewise.
3869         * testsuite/script_test_4.t: Likewise.
3870         * testsuite/script_test_5.t: Likewise.
3871         * testsuite/script_test_6.t: Likewise.
3872         * testsuite/script_test_7.t: Likewise.
3873         * testsuite/script_test_9.t: Likewise.
3874
3875 2012-09-05  Alan Modra  <amodra@gmail.com>
3876
3877         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
3878         (Powerpc_relocate_functions::Status): New typedef.
3879         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3880         (Target_powerpc::Scan::local): Handle REL64.
3881         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
3882         for REL32 and REL64.
3883         (Target_powerpc::symval_for_branch): New function, extracted from..
3884         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
3885         checks.  Report overflow errors.
3886
3887 2012-09-05  Alan Modra  <amodra@gmail.com>
3888
3889         * object.h (Sized_relobj_file::emit_relocs): Delete.
3890         (Sized_relobj_file::emit_relocs_reltype): Delete.
3891         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
3892         relocate_relocs for --emit-relocs.
3893         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
3894         * output.h: Update comment.
3895         (Output_segment::first_section): New function.
3896         (Output_segment::first_section_load_address): Use first_section.
3897         * output.cc (Output_segment::first_section): New function extracted..
3898         (Output_segment::first_section_load_address): ..from here.  Delete.
3899         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
3900         * target.h (Sized_target::relocate_for_relocatable): Likewise.
3901         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
3902         adjust call to target.h function.
3903         * i386.cc (Target_i386): Likewise.
3904         * sparc.cc (Target_sparc): Likewise.
3905         * x86_64.cc (Target_x86_64): Likewise.
3906         * powerpc.cc (Target_powerpc): Likewise.
3907         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
3908         first tls section has section symbol for optimised local dynamic
3909         output relocs.
3910         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
3911         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
3912         optimised tls code.
3913         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
3914         Rename to relocate_relocs.  Update error message.
3915
3916 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
3917
3918         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
3919         --just-symbols.
3920
3921 2012-08-31  Alan Modra  <amodra@gmail.com>
3922
3923         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
3924         (Powerpc_relobj::toc_base_offset): New stub function.
3925         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
3926         got_mod_index_offset to tlsld_got_offset.  Update all refs.
3927         (Target_powerpc::Relocate::enum skip_tls): New.
3928         (Target_powerpc::call_tls_get_addr_): New var.
3929         (Target_powerpc::is_branch_reloc): Move to file scope.
3930         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
3931         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
3932         New functions.
3933         (Target_powerpc::enum Got_type): Delete old values, add new ones.
3934         (powerpc_info): Correct common_pagesize for ppc64.
3935         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
3936         (Powerpc_relocate_functions): Add overflow check enums and functions.
3937         Add non-shift version of rela, rela_ua.  Delete all rel public
3938         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
3939         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
3940         addr16_ha3, addr14 functions.
3941         (Output_data_got_powerpc::add_constant_pair): New function.
3942         (Output_data_got_powerpc::got_base_offset): Likewise.
3943         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
3944         (instruction constants): Sort, add some more.
3945         (Output_data_glink::do_write): Add and use Address typedef.  Use
3946         object->toc_base_offset() stub for 64-bit.
3947         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
3948         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3949         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
3950         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
3951         Always treat .opd relocs as against locally defined symbol.
3952         Correct condition for RELATIVE relocs.
3953         (Target_powerpc::do_finalize_sections): Test for NULL sections.
3954         (Target_powerpc::Relocate::relocate): Use plt call stub as value
3955         for 32-bit syms with a plt entry.  Correct ppc64 toc base
3956         calculations.  Handle TLS relocs, and more.  Add overflow
3957         checking and adjust for Powerpc_relocate_functions changes.
3958         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
3959         Reinstate --emit-relocs code with FIXME.
3960
3961 2012-08-30  Alan Modra  <amodra@gmail.com>
3962
3963         * layout.cc (Layout::set_segment_offsets): Set p_align to
3964         abi_pagesize, not common_pagesize.
3965         (Layout::relaxation_loop_body): Similarly use abi_pagesize
3966         to determine whether file header can go in segment.
3967
3968 2012-08-30  Alan Modra  <amodra@gmail.com>
3969
3970         * output.h (Output_reloc::Output_reloc <output section>): Add
3971         is_relative param.  Adjust calls.
3972         (Output_reloc::add_output_section_relative): New functions.
3973         * output.cc (Output_reloc::Output_reloc <output section>): Handle
3974         is_relative.
3975         (Output_reloc::symbol_value): Handle SECTION_CODE.
3976
3977 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
3978
3979         * gold.cc (queue_middle_tasks): Call layout again when unique
3980         segments for sections is desired.
3981         * layout.cc (Layout::Layout): Initialize new members.
3982         (Layout::get_output_section_flags): New function.
3983         (Layout::choose_output_section): Call get_output_section_flags.
3984         (Layout::layout): Make output section for mapping to a unique segment.
3985         (Layout::insert_section_segment_map): New function.
3986         (Layout::attach_allocated_section_to_segment): Make unique segment for
3987         output sections marked so.
3988         (Layout::segment_precedes): Check for unique segments when sorting.
3989         * layout.h (Layout::Unique_segment_info): New struct.
3990         (Layout::Section_segment_map): New typedef.
3991         (Layout::insert_section_segment_map): New function.
3992         (Layout::get_output_section_flags): New function.
3993         (Layout::is_unique_segment_for_sections_specified): New function.
3994         (Layout::set_unique_segment_for_sections_specified): New function.
3995         (Layout::unique_segment_for_sections_specified_): New member.
3996         (Layout::section_segment_map_): New member.
3997         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
3998         Rename is_gc_pass_one to is_pass_one.
3999         Rename is_gc_pass_two to is_pass_two.
4000         Rename is_gc_or_icf to is_two_pass.
4001         Check for which pass based on whether symbols data is present.
4002         Make it two pass when unique segments for sections is desired.
4003         * output.cc (Output_section::Output_section): Initialize new
4004         members.
4005         * output.h (Output_section::is_unique_segment): New function.
4006         (Output_section::set_is_unique_segment): New function.
4007         (Output_section::is_unique_segment_): New member.
4008         (Output_section::extra_segment_flags): New function.
4009         (Output_section::set_extra_segment_flags): New function.
4010         (Output_section::extra_segment_flags_): New member.
4011         (Output_section::segment_alignment): New function.
4012         (Output_section::set_segment_alignment): New function.
4013         (Output_section::segment_alignment_): New member.
4014         (Output_segment::Output_segment): Initialize is_unique_segment_.
4015         (Output_segment::is_unique_segment): New function.
4016         (Output_segment::set_is_unique_segment): New function.
4017         (Output_segment::is_unique_segment_): New member.
4018         * plugin.cc (allow_unique_segment_for_sections): New function.
4019         (unique_segment_for_sections): New function.
4020         (Plugin::load): Add new functions to transfer vector.
4021         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
4022         * Makefile.in: Regenerate.
4023         * testsuite/plugin_final_layout.sh: Check if unique segment
4024         functionality works.
4025         * testsuite/plugin_section_order.c (onload): Check if new interfaces
4026         are available.
4027         (allow_unique_segment_for_sections): New global.
4028         (unique_segment_for_sections): New global.
4029         (claim_file_hook): Call allow_unique_segment_for_sections.
4030         (all_symbols_read_hook): Call unique_segment_for_sections.
4031
4032 2012-08-22  Cary Coutant  <ccoutant@google.com>
4033
4034         * layout.cc (Layout::include_section): Don't assert on GROUP
4035         sections with --emit-relocs.
4036
4037 2012-08-21  Cary Coutant  <ccoutant@google.com>
4038
4039         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
4040         if --export-dynamic-symbol names an undef symbol.
4041
4042 2012-08-18  Alan Modra  <amodra@gmail.com>
4043
4044         * powerpc.cc: Formatting and white space.
4045         (Powerpc_relobj): Rename got2_section_ to special_.
4046         Add opd_ent_shndx_ and opd_ent_off_ vectors.
4047         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
4048         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
4049         (Target_powerpc): Add Address typedef and invalid_address.  Use
4050         throughout.
4051         (Target_powerpc::is_branch_reloc): New function.
4052         (Powerpc_relocate_functions): Add Address typedef, use throughout.
4053         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
4054         for dst_mask, value and addend.
4055         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
4056         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
4057         (Output_data_glink::do_write): Correct toc base.  Don't try to use
4058         uint16_t for 24-bit offset.  Use get_output_section_offset and
4059         check return.
4060         (Target_powerpc::Scan::local): Handle more relocs.
4061         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
4062         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
4063         Plug in toc restoring insn after plt calls.  Translate branches
4064         to function descriptor symbols to corresponding entry point.
4065         (Target_powerpc::relocate_for_relocatable): Check return from
4066         get_output_section_offset.
4067         * symtab.h: Comment typo.
4068
4069 2012-08-14  Ian Lance Taylor  <iant@google.com>
4070
4071         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
4072         unsupported_relocal_local to call unsupported_reloc_global.
4073
4074 2012-08-14  Nick Clifton  <nickc@redhat.com>
4075
4076         PR ld/14265
4077         * script-sections.cc (Sections_element::output_section_name): Add
4078         keep return parameter.
4079         (Output_section_element::match_name): Add keep return parameter.
4080         Return the value of the keep_ member.
4081         * script-sections.h (class Output_section): Update
4082         output_section_name prototype.
4083         * layout.cc (Layout::keep_input_section): New public member
4084         function.
4085         (Layout::choose_output_section): Pass keep parameter to
4086         output_section_name.
4087         * layout.h (class Layout): Add keep_input_section.
4088         * object.cc (Sized_relobj_file::do_layout): Check for kept input
4089         sections.
4090         * testsuite/Makefile.am: Add a test.
4091         * testsuite/Makefile.in: Regenerate.
4092         * testsuite/pr14265.c: Source file for the test.
4093         * testsuite/pr14265.t: Linker script for the test.
4094         * testsuite/pr14265.sh: Shell script for the test.
4095
4096 2012-08-14  Alan Modra  <amodra@gmail.com>
4097
4098         * target.h (Target::output_section_name): New function.
4099         (Target::do_output_section_name): New function.
4100         * layout.cc (Layout::choose_output_section): Call the above.
4101         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
4102
4103 2012-08-14  Alan Modra  <amodra@gmail.com>
4104
4105         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
4106         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
4107         for replace_constant call.
4108         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
4109         (Output_data_glink::do_print_to_mapfile): New function.
4110         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
4111         (Target_powerpc::Relocate::relocate): Likewise.
4112
4113 2012-08-14  Alan Modra  <amodra@gmail.com>
4114
4115         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
4116         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
4117         (Output_data_glink::add_entry,find_entry): Remove shndx param.
4118         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
4119         all references to shndx_.  Handle special case for R_PPC_PLTREL24
4120         here.
4121         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
4122         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
4123         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
4124         here.
4125         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
4126         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
4127
4128 2012-08-12  Alan Modra  <amodra@gmail.com>
4129
4130         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
4131         (glink insn constants): Use uint32_t.
4132         (Output_data_glink::add_entry): Use insert, not [] operator.
4133
4134 2012-08-11  Alan Modra  <amodra@gmail.com>
4135
4136         * object.h (Sized_relobj_file::find_shdr): New function.
4137         (Sized_relobj_file::find_special_sections): New function.
4138         * object.cc (Sized_relobj_file::find_shdr): New function.
4139         (Sized_relobj_file::find_eh_frame): Use find_shdr.
4140         (Sized_relobj_file::find_special_sections): New function, split out..
4141         (Sized_relobj_file::do_read_symbols): ..from here.
4142         * output.h (Output_data_got::replace_constant): New function.
4143         (Output_data_got::num_entries): New function.
4144         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
4145         (Output_data_got::got_offset): Protected rather than private.
4146         (Output_data_got::replace_got_entry): New function.
4147         * output.cc (Output_data_got::replace_got_entry): New function.
4148         * powerpc.cc (class Powerpc_relobj): New.
4149         (class Powerpc_relocate_functions): Delete all psymval variants or
4150         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
4151         Implement _ha functions using corresponding _hi function.
4152         (Powerpc_relobj::find_special_sections): New function.
4153         (Target_powerpc::do_make_elf_object): New function.
4154         (class Output_data_got_powerpc): New.
4155         (class Output_data_glink): New.
4156         (class Powerpc_scan_relocatable_reloc): New.
4157         Many more changes througout file.
4158
4159 2012-08-09  Nick Clifton  <nickc@redhat.com>
4160
4161         * po/vi.po: Updated Vietnamese translation.
4162
4163 2012-08-07  Ian Lance Taylor  <iant@google.com>
4164
4165         * layout.cc (Layout::add_target_dynamic_tags): If
4166         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
4167         plt_rel.
4168
4169 2012-07-30  Nick Clifton  <nickc@redhat.com>
4170
4171         * po/gold.pot: Updated template.
4172         * po/es.po: Updated Spanish translation.
4173
4174 2012-07-18  Cary Coutant  <ccoutant@google.com>
4175
4176         PR gold/14344
4177         * configure.ac: Add check for -gpubnames support.
4178         * configure: Regenerate.
4179         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
4180         support; force -gno-pubnames.
4181         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
4182         support.
4183         (gdb_index_test_4): New test.
4184         * testsuite/Makefile.in: Regenerate.
4185         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
4186         * testsuite/gdb_index_test_2.sh: Likewise.
4187         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
4188         * testsuite/gdb_index_test_4.sh: New script.
4189         * testsuite/gdb_index_test_comm.sh: New script with common code;
4190         don't look for space after colon.
4191
4192 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
4193
4194         * gold.cc (queue_middle_tasks): Update function order only after
4195         deferred objects due to plugins are processed.
4196
4197 2012-07-11  Ian Lance Taylor  <iant@google.com>
4198
4199         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
4200         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
4201         (Target_arm::scan_reloc_for_stub): Likewise.
4202         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
4203         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
4204         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
4205         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
4206         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
4207
4208 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
4209             Ian Lance Taylor  <iant@google.com>
4210
4211         PR gold/14309
4212         * configure.ac: Test whether std::tr1::hash<off_t> works.
4213         * gold.h: Add a specialization for std::tr1::hash<off_t> if
4214         needed.
4215         * output.h (class Output_fill): Add virtual destructor.
4216         * configure, config.in: Rebuild.
4217
4218 2012-06-22  Roland McGrath  <mcgrathr@google.com>
4219
4220         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
4221
4222 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
4223
4224         * plugin.cc (Plugin::load): Handle position independent executables.
4225
4226 2012-06-06  Cary Coutant  <ccoutant@google.com>
4227
4228         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
4229         add .debug_macro.
4230         (lines_only_debug_sections): Likewise.
4231         (gdb_fast_lookup_sections): New static array.
4232         (is_gdb_debug_section): Rename formal parameter.
4233         (is_lines_only_debug_section): Likewise.
4234         (is_gdb_fast_lookup_section): New function.
4235         (Layout::include_section): Check for ".zdebug_" prefix; pass
4236         section name suffix to is_gdb_debug_section, et al.; check for
4237         fast-lookup sections when building .gdb_index.
4238         * options.h (--strip-debug-gdb): Update GDB version number.
4239
4240 2012-06-06  Cary Coutant  <ccoutant@google.com>
4241
4242         * configure.ac: Add check for fallocate.
4243         * configure: Regenerate.
4244         * config.in: Regenerate.
4245
4246         * options.h (class General_options): Add --mmap-output-file and
4247         --posix-fallocate options.
4248         * output.cc: (posix_fallocate): Remove; replace with...
4249         (gold_fallocate): New function.
4250         (Output_file::map_no_anonymous): Call gold_fallocate.
4251         (Output_file::map): Check --mmap-output-file option.
4252
4253 2012-06-05  Jing Yu  <jingyu@google.com>
4254
4255         * gold.h (textdomain): Add do {} to empty while(0).
4256         (bindtextdomain): Likewise.
4257
4258 2012-06-04  Cary Coutant  <ccoutant@google.com>
4259
4260         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
4261         has_dynsym_index.
4262
4263 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
4264
4265         * symtab.cc (Symbol_table::define_special_symbol):
4266         Initialize *poldsym to prevent uninitialized variable errors.
4267
4268 2012-05-23  Cary Coutant  <ccoutant@google.com>
4269
4270         * layout.cc (Layout::section_name_mapping): Add rules to handle
4271         exact match on .data.rel.ro.local or .data.rel.ro.
4272         (Layout::output_section_name): Check for exact matches.
4273
4274 2012-05-23  Cary Coutant  <ccoutant@google.com>
4275
4276         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
4277         more carefully.
4278
4279 2012-05-22  Cary Coutant  <ccoutant@google.com>
4280
4281         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
4282         object before exporting symbol.
4283
4284 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
4285
4286         * testsuite/tls_test.cc: Include "config.h" first.
4287         * testsuite/tls_test_c.c: Likewise.
4288
4289 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
4290             Nick Clifton  <nickc@redhat.com>
4291
4292         PR 14072
4293         * configure.in: Add check that sysdep.h has been included before
4294         any system header files.
4295         * configure: Regenerate.
4296         * config.in: Regenerate.
4297
4298 2012-05-14  Cary Coutant  <ccoutant@google.com>
4299
4300         * layout.cc (Layout::make_output_section): Mark .tdata section
4301         as RELRO.
4302         * testsuite/relro_test.cc: Add a TLS variable.
4303
4304 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
4305
4306         PR gold/14091
4307         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
4308         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
4309         R_X86_64_64.
4310
4311 2012-05-08  Cary Coutant  <ccoutant@google.com>
4312
4313         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
4314         (lines_only_debug_sections): Likewise.
4315
4316 2012-05-02  Roland McGrath  <mcgrathr@google.com>
4317
4318         * nacl.cc: New file.
4319         * nacl.h: New file.
4320         * Makefile.am (CCFILES, HFILES): Add them.
4321         * Makefile.in: Regenerate.
4322         * i386.cc (Output_data_plt_i386_nacl): New class.
4323         (Output_data_plt_i386_nacl_exec): New class.
4324         (Output_data_plt_i386_nacl_dyn): New class.
4325         (Target_i386_nacl): New class.
4326         (Target_selector_i386_nacl): New class.
4327         (target_selector_i386): Use it instead of Target_selector_i386.
4328         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
4329         (Target_x86_64_nacl): New class.
4330         (Target_selector_x86_64_nacl): New class.
4331         (target_selector_x86_64, target_selector_x32): Use it instead of
4332         Target_selector_x86_64.
4333         * arm.cc (Output_data_plt_arm_nacl): New class.
4334         (Target_arm_nacl): New class.
4335         (Target_selector_arm_nacl): New class.
4336         (target_selector_arm, target_selector_armbe): Use it instead of
4337         Target_selector_arm.
4338
4339         * target-select.cc (select_target): Take new Input_file* and off_t
4340         arguments, pass them on to recognize method of selector.
4341         * object.cc (make_elf_sized_object): Update caller.
4342         * parameters.cc (parameters_force_valid_target): Likewise.
4343         * incremental.cc (make_sized_incremental_binary): Likewise.
4344         * target-select.h: Update decl.
4345         (Target_selector::recognize): Take new Input_file* argument,
4346         pass it on to do_recognize.
4347         (Target_selector::do_recognize): Take new Input_file* argument.
4348         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
4349         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
4350         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
4351         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
4352
4353         * target.h (Target::Target_info): New members isolate_execinstr
4354         and rosegment_gap.
4355         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
4356         * arm.cc (Target_arm::arm_info): Update initializer.
4357         * i386.cc (Target_i386::i386_info): Likewise.
4358         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
4359         * sparc.cc (Target_sparc::sparc_info): Likewise.
4360         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4361         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
4362         * layout.cc (Layout::attach_allocated_section_to_segment):
4363         Take new const Target* argument.  If target->isolate_execinstr(), act
4364         like --rosegment.
4365         (Layout::find_first_load_seg): Take new const Target* argument;
4366         if target->isolate_execinstr(), reject PF_X segments.
4367         (Layout::relaxation_loop_body): Update caller.
4368         (Layout::set_segment_offsets): If target->isolate_execinstr(),
4369         reset file offset to zero when we hit LOAD_SEG, and then do a second
4370         loop over the segments before LOAD_SEG to reassign offsets after
4371         addresses have been determined.  Handle target->rosegment_gap().
4372         (Layout::attach_section_to_segment): Take new const Target* argument;
4373         pass it to attach_allocated_section_to_segment.
4374         (Layout::make_output_section): Update caller.
4375         (Layout::attach_sections_to_segments): Take new const Target* argument;
4376         pass it to attach_section_to_segment.
4377         * gold.cc (queue_middle_tasks): Update caller.
4378         * layout.h (Layout): Update method decls with new arguments.
4379
4380         * arm.cc (Target_arm::Target_arm): Take optional argument for the
4381         Target_info pointer to use.
4382         (Target_arm::do_make_data_plt): New virtual method.
4383         (Target_arm::make_data_plt): New method that calls it.
4384         (Target_arm::make_plt_entry): Use it.
4385         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
4386         for the section alignment.
4387         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
4388         method.
4389         (Output_data_plt_arm::first_plt_entry_offset): Call it.
4390         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
4391         method.
4392         (Output_data_plt_arm::get_plt_entry_size): Call it.
4393         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
4394         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
4395         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
4396         method.
4397         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
4398         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
4399         method instead of sizeof(plt_entry).
4400         (Output_data_plt_arm::add_entry): Likewise.
4401         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
4402         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
4403         than static method.
4404         (Target_arm::plt_entry_size): Likewise.
4405         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
4406         Move to ...
4407         (Output_data_plt_arm_standard): ... here, new class.
4408         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
4409         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
4410         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
4411
4412         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4413         Take additional argument for the PLT entry size.
4414         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
4415         Use get_plt_entry_size method rather than plt_entry_size variable.
4416         (Output_data_plt_x86_64::reserve_slot): Likewise.
4417         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
4418         (Output_data_plt_x86_64::add_entry): Likewise.
4419         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
4420         (Output_data_plt_x86_64::address_for_global): Likewise.
4421         (Output_data_plt_x86_64::address_for_local): Likewise.
4422         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4423         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
4424         Make method non-static.
4425         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
4426         method.
4427         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
4428         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
4429         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
4430         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
4431         virtual method.
4432         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
4433         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
4434         virtual method.
4435         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
4436         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
4437         virtual method.
4438         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
4439         (Output_data_plt_x86_64::plt_entry_size)
4440         (Output_data_plt_x86_64::first_plt_entry)
4441         (Output_data_plt_x86_64::plt_entry)
4442         (Output_data_plt_x86_64::tlsdesc_plt_entry)
4443         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
4444         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
4445         (Output_data_plt_x86_64_standard): ... here, new class.
4446         (Target_x86_64::Target_x86_64): Take optional argument for the
4447         Target_info pointer to use.
4448         (Target_x86_64::do_make_data_plt): New virtual method.
4449         (Target_x86_64::make_data_plt): New method to call it.
4450         (Target_x86_64::init_got_plt_for_update): Use that.
4451         Call this->plt_->add_eh_frame method here.
4452         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
4453         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
4454         rather than static method.
4455         (Target_x86_64::plt_entry_size): Likewise.
4456         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
4457         rather than plt_entry_size variable.  Move guts of PLT filling to...
4458         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
4459         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
4460         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
4461
4462         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
4463         additional argument for the section alignment.
4464         Don't do add_eh_frame_for_plt here.
4465         (Output_data_plt_i386::first_plt_entry_offset): Make the method
4466         non-static.  Use get_plt_entry_size method rather than plt_entry_size
4467         variable.
4468         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
4469         method.
4470         (Output_data_plt_i386::get_plt_entry_size): Call it.
4471         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
4472         (Output_data_plt_i386::add_eh_frame): New method to call it.
4473         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
4474         method.
4475         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
4476         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
4477         method.
4478         (Output_data_plt_i386::fill_plt_entry): New method to call it.
4479         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
4480         method instead of plt_entry_size.
4481         (Output_data_plt_i386::plt_entry_size)
4482         (Output_data_plt_i386::plt_eh_frame_fde_size)
4483         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
4484         (Output_data_plt_i386_standard): ... here, new class.
4485         (Output_data_plt_i386_exec): New class.
4486         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
4487         (Output_data_plt_i386_exec::first_plt_entry): ... here.
4488         (Output_data_plt_i386::exec_plt_entry): Move to ...
4489         (Output_data_plt_i386_exec::plt_entry): ... here.
4490         (Output_data_plt_i386_dyn): New class.
4491         (Output_data_plt_i386::first_plt_entry): Move to ...
4492         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
4493         (Output_data_plt_i386::dyn_plt_entry): Move to ...
4494         (Output_data_plt_i386_dyn::plt_entry): ... here.
4495         (Target_i386::Target_i386): Take optional argument for the Target_info
4496         pointer to use.
4497         (Target_i386::do_make_data_plt): New virtual method.
4498         (Target_i386::make_data_plt): New method to call it.
4499         (Target_i386::make_plt_section): Use that.
4500         Call this->plt_->add_eh_frame method here.
4501         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
4502         rather than plt_entry_size variable.
4503         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
4504         (Output_data_plt_i386::address_for_local): Likewise.
4505         (Output_data_plt_i386::do_write): Likewise.
4506         Move guts of PLT filling to...
4507         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
4508         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
4509         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
4510         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
4511
4512 2012-05-01  Cary Coutant  <ccoutant@google.com>
4513
4514         * dwarf_reader.cc (Dwarf_die::read_attributes)
4515         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
4516         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
4517         * reduced_debug_output.cc
4518         (Output_reduced_debug_info_section::get_die_end): Remove
4519         DW_FORM_GNU_ref_index.  Add default case.
4520
4521 2012-04-26  Mark Wielaard  <mjw@redhat.com>
4522
4523         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
4524         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
4525         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
4526         DW_AT_high_pc as offset from DW_AT_low_pc.
4527
4528         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
4529         * testsuite/Makefile.in: Regenerate.
4530         * testsuite/gdb_index_test_3.c: New test source file.
4531         * testsuite/gdb_index_test_3.sh: New test source file.
4532
4533 2012-04-25  Ian Lance Taylor  <iant@google.com>
4534
4535         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
4536         pointer.
4537         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
4538         as a class, not a struct.
4539         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
4540         (Target_arm::apply_cortex_a8_workaround): Likewise.
4541         * gc.h: Declare Reloc_types as a struct, not a class.
4542         * object.h: Declare Symbols_data as a struct.
4543         * reloc.h: Declare Read_relocs_data as a struct.
4544         * target.h: Declare Relocate_info as a struct.
4545
4546 2012-04-24  David S. Miller  <davem@davemloft.net>
4547
4548         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
4549         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
4550         and R_SPARC_WPLT30.
4551
4552 2012-04-24  Cary Coutant  <ccoutant@google.com>
4553
4554         * incremental-dump.cc (find_input_containing_global): Replace
4555         magic number with symbolic constant.
4556         (dump_incremental_inputs): Update version number.
4557         * incremental.cc (Output_section_incremental_inputs): Update version
4558         number; import symbolic constants from Incremental_inputs_reader.
4559         (Incremental_inputs::create_data_sections): Align relocations
4560         section correctly for 64-bit targets.
4561         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
4562         constants; add padding.
4563         (Output_section_incremental_inputs::write_header): Add assert for
4564         header_size.
4565         (Output_section_incremental_inputs::write_input_files): Add assert
4566         for input_entry_size.
4567         (Output_section_incremental_inputs::write_info_blocks): Add padding;
4568         add assert for object_info_size, input_section_entry_size,
4569         global_sym_entry_size.
4570         * incremental.h (Incremental_inputs_reader): Add symbolic constants
4571         for data structure sizes; use them.
4572         (Incremental_input_entry_reader): Import symbolic constants from
4573         Incremental_inputs_reader; use them.
4574
4575 2012-04-23  David S. Miller  <davem@davemloft.net>
4576
4577         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
4578         and elf_flags_set_.
4579         (Target_sparc::Target_sparc): Initialize new fields.
4580         (Target_sparc::do_make_elf_object): New function.
4581         (Target_sparc::do_adjust_elf_header): New function.
4582
4583 2012-04-23  Cary Coutant  <ccoutant@google.com>
4584
4585         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
4586         CU range table of gdb index.
4587
4588 2012-04-20  David S. Miller  <davem@davemloft.net>
4589
4590         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
4591         instead of false.
4592
4593 2012-04-16  David S. Miller  <davem@davemloft.net>
4594
4595         * sparc.cc (Target_sparc::got_address): New function.
4596         (Sparc_relocate_functions::gdop_hix22): New function.
4597         (Sparc_relocate_functions::gdop_lox10): New function.
4598         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
4599         relocs.
4600         (Target_sparc::Scan::local): Likewise if the global symbol is not
4601         preemptible and is not IFUNC.
4602         (Target_sparc::Relocate::relocate): Perform GOTDATA code
4603         transformations for local and non-preemptible non-IFUNC global
4604         symbols.
4605
4606         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
4607         writing out 64-bit part of ranges.
4608
4609         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
4610         -fpic and -fpie respectively.
4611         * Makefile.in: Regenerate.
4612
4613         * sparc.cc (class Target_sparc): Add rela_ifunc_.
4614         (Target_sparc::Target_sparc): Initialize new field.
4615         (Target_sparc::do_plt_section_for_global): New function.
4616         (Target_sparc::do_plt_section_for_local): New function.
4617         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
4618         (Target_sparc::make_plt_section): New function, broken out of
4619         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
4620         (Target_sparc::make_plt_entry): Call make_plt_section.
4621         (Target_sparc::make_local_ifunc_plt_entry): New function.
4622         (Target_sparc::rela_ifunc_section): New function.
4623         (Target_sparc::plt_section): Remove const.
4624         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
4625         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
4626         and ifunc_count_ fields.
4627         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
4628         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
4629         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
4630         (Output_data_plt_sparc::rela_ifunc): New function.
4631         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
4632         (Output_data_plt_sparc::has_ifunc_section): New function.
4633         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
4634         (Output_data_plt_sparc::address_for_global): New function.
4635         (Output_data_plt_sparc::address_for_local): New function.
4636         (Output_data_plt_sparc::plt_index_to_offset): New function.
4637         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
4638         and entry_count.
4639         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
4640         entry_count.
4641         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
4642         R_SPARC_JMP_IREL to switch.
4643         (Target_sparc::Scan::check_non_pic): Likewise.
4644         (Target_sparc::Scan::local): Handle IFUNC symbols.
4645         (Target_sparc::Scan::local): Likewise.
4646         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
4647         and plt_address_for_local.
4648         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
4649         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
4650
4651         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
4652         (class Output_data_reloc): Adjust calls to Output_reloc_type.
4653         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
4654         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
4655         global relocs too.
4656         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
4657         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
4658         calls.
4659         * sparc.cc (Target_sparc::Scan::global): Likewise.
4660         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4661
4662 2012-04-16  Cary Coutant  <ccoutant@google.com>
4663
4664         * archive.cc (Library_base::should_include_member): Check for
4665         --export-dynamic-symbol.
4666         * options.h (class General_options): Add --export-dynamic-symbol.
4667         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
4668         --export-dynamic-symbol.
4669         (Symbol_table::gc_mark_undef_symbols): Likewise.
4670         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
4671
4672 2012-04-12  David S. Miller  <davem@davemloft.net>
4673
4674         * sparc.cc (Reloc::wdisp10): New relocation method.
4675         (Reloc::h34): Likewise.
4676         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
4677         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
4678         R_SPARC_WDISP10.
4679         (Target_sparc::Scan::local): Likewise.
4680         (Target_sparc::Scan::global): Likewise.
4681         (Target_sparc::Relocate::relocate): Likewise.
4682
4683 2012-04-09  Cary Coutant  <ccoutant@google.com>
4684
4685         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
4686         low_pc == 0.
4687
4688 2012-04-06  Ian Lance Taylor  <iant@google.com>
4689
4690         * timer.cc: #include <unistd.h>.
4691
4692 2012-04-06  Roland McGrath  <mcgrathr@google.com>
4693
4694         * configure.in (AC_CHECK_HEADERS): Add locale.h.
4695         * config.in: Regenerate.
4696         * configure: Regenerate.
4697
4698 2012-04-05  Nick Clifton  <nickc@redhat.com>
4699
4700         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
4701         (AM_LC_MESSAGES): Add.
4702         * aclocal.m4: Regenerate.
4703         * config.in: Regenerate.
4704         * configure: Regenerate.
4705
4706 2012-03-21  Cary Coutant  <ccoutant@google.com>
4707
4708         * Makefile.am: Add gdb-index.cc, gdb-index.h.
4709         * Makefile.in: Regenerate.
4710         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
4711         (Sized_elf_reloc_mapper::symbol_section): New function.
4712         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
4713         (make_elf_reloc_mapper): New function.
4714         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
4715         (Dwarf_abbrev_table::do_read_abbrevs): New function.
4716         (Dwarf_abbrev_table::do_get_abbrev): New function.
4717         (Dwarf_ranges_table::read_ranges_table): New function.
4718         (Dwarf_ranges_table::read_range_list): New function.
4719         (Dwarf_pubnames_table::read_section): New function.
4720         (Dwarf_pubnames_table::read_header): New function.
4721         (Dwarf_pubnames_table::next_name): New function.
4722         (Dwarf_die::Dwarf_die): New function.
4723         (Dwarf_die::read_attributes): New function.
4724         (Dwarf_die::skip_attributes): New function.
4725         (Dwarf_die::set_name): New function.
4726         (Dwarf_die::set_linkage_name): New function.
4727         (Dwarf_die::attribute): New function.
4728         (Dwarf_die::string_attribute): New function.
4729         (Dwarf_die::int_attribute): New function.
4730         (Dwarf_die::uint_attribute): New function.
4731         (Dwarf_die::ref_attribute): New function.
4732         (Dwarf_die::child_offset): New function.
4733         (Dwarf_die::sibling_offset): New function.
4734         (Dwarf_info_reader::check_buffer): New function.
4735         (Dwarf_info_reader::parse): New function.
4736         (Dwarf_info_reader::do_parse): New function.
4737         (Dwarf_info_reader::do_read_string_table): New function.
4738         (Dwarf_info_reader::lookup_reloc): New function.
4739         (Dwarf_info_reader::get_string): New function.
4740         (Dwarf_info_reader::visit_compilation_unit): New function.
4741         (Dwarf_info_reader::visit_type_unit): New function.
4742         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
4743         Sized_elf_reloc_mapper.
4744         (Sized_dwarf_line_info::symbol_section): Remove function.
4745         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
4746         (Sized_dwarf_line_info::read_line_mappings): Remove object
4747         parameter, adjust callers.
4748         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
4749         * dwarf_reader.h: Include <sys/types.h>.
4750         (class Track_relocs): Remove forward declaration.
4751         (class Elf_reloc_mapper): New class.
4752         (class Sized_elf_reloc_mapper): New class.
4753         (class Dwarf_abbrev_table): New class.
4754         (class Dwarf_range_list): New class.
4755         (class Dwarf_ranges_table): New class.
4756         (class Dwarf_pubnames_table): New class.
4757         (class Dwarf_die): New class.
4758         (class Dwarf_info_reader): New class.
4759         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
4760         (Sized_dwarf_line_info::symbol_section): Remove member function.
4761         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
4762         base class.
4763         * gdb-index.cc: New source file.
4764         * gdb-index.h: New source file.
4765         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
4766         and .debug_types sections, call Layout::add_to_gdb_index.
4767         (Sized_relobj_incr::do_section_name): Implement.
4768         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
4769         return type; Implement.
4770         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
4771         return type.
4772         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
4773         parameter list and return type.
4774         (Sized_incr_dynobj::do_section_contents): Likewise.
4775         * layout.cc: Include gdb-index.h.
4776         (Layout::Layout): Initialize gdb_index_data_.
4777         (Layout::init_fixed_output_section): Check for .gdb_index section.
4778         (Layout::add_to_gdb_index): New function. Instantiate.
4779         * layout.h: Add forward declaration for class Gdb_index.
4780         (Layout::add_to_gdb_index): New member function.
4781         (Layout::gdb_index_data_): New data member.
4782         * main.cc: Include gdb-index.h.
4783         (main): Print statistics for gdb index.
4784         * object.cc (Object::section_contents): Move code into
4785         do_section_contents.
4786         (need_decompressed_section): Check for sections needed when building
4787         gdb index.
4788         (build_compressed_section_map): Likewise.
4789         (Sized_relobj_file::do_read_symbols): Need local symbols when building
4790         gdb index.
4791         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
4792         sections; call Layout::add_to_gdb_index.
4793         (Sized_relobj_file::do_decompressed_section_contents): Call
4794         do_section_contents directly.
4795         * object.h (Object::do_section_contents): Adjust parameter list and
4796         return type.
4797         (Object::do_decompressed_section_contents): Call do_section_contents
4798         directly.
4799         (Sized_relobj_file::do_section_contents): Adjust parameter list and
4800         return type.
4801         * options.h (class General_options): Add --gdb-index option.
4802         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
4803         list and return type.
4804         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
4805         * reloc.h (Track_relocs::checkpoint): New function.
4806         (Track_relocs::reset): New function.
4807
4808         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
4809         New test cases.
4810         * testsuite/Makefile.in: Regenerate.
4811         * testsuite/gdb_index_test.cc: New test source file.
4812         * testsuite/gdb_index_test_1.sh: New test source file.
4813         * testsuite/gdb_index_test_2.sh: New test source file.
4814
4815 2012-03-19  Doug Kwan  <dougkwan@google.com>
4816
4817         * arm.cc (Target_arm::do_define_standard_symbols): New method.
4818         (Target_arm::do_finalize_sections): Remove code which defines
4819         __exidx_start and __exidx_end.  Make symbol table parameter
4820         anonymous as it is not used.
4821         * gold.cc (queue_middle_tasks): Call target hook to define any
4822         target-specific symbols.
4823         * target.h (Target::define_standard_symbols): New method.
4824         (Target::do_define_standard_symbols): Same.
4825         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
4826         * testsuite/Makefile.in: Regenerate.
4827         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
4828         and __exidx_end.
4829         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
4830         relocations are generated for __exidx_start and __exidx_end.
4831
4832 2012-03-16  Doug Kwan  <dougkwan@google.com>
4833
4834         * testsuite/Makefile.am: Disable test initpri3b.
4835         * testsuite/Makefile.in: Regenerate.
4836
4837 2012-03-15  Doug Kwan  <dougkwan@google.com>
4838
4839         * arm.cc (Target_arm::got_section): Make .got section read-only
4840         if -z now is given.
4841
4842 2012-03-15  Ian Lance Taylor  <iant@google.com>
4843
4844         PR gold/13850
4845         * layout.cc (Layout::make_output_section): Correctly mark
4846         SHT_INIT_ARRAY, et. al., as relro.
4847
4848 2012-03-14  Doug Kwan  <dougkwan@google.com>
4849
4850         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
4851         dynamic relocations for protected symbols in shared objects.
4852
4853 2012-03-13  Ian Lance Taylor  <iant@google.com>
4854
4855         * resolve.cc (Symbol_table::resolve): When merging common symbols,
4856         keep the larger alignment.
4857
4858 2012-03-12  Cary Coutant  <ccoutant@google.com>
4859
4860         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
4861         handling of DW_LNE_define_file.
4862
4863 2012-03-12  Cary Coutant  <ccoutant@google.com>
4864
4865         * reduced_debug_output.cc
4866         (Output_reduced_debug_info_section::get_die_end): Add new FORM
4867         codes to switch.
4868
4869 2012-02-29  Cary Coutant  <ccoutant@google.com>
4870
4871         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
4872
4873 2012-02-29  Cary Coutant  <ccoutant@google.com>
4874
4875         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4876         Call Object::decompressed_section_contents.
4877         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
4878         New dtor.
4879         (Sized_dwarf_line_info::buffer_start_): New data member.
4880         * merge.cc (Output_merge_data::do_add_input_section): Call
4881         Object::decompressed_section_contents.
4882         (Output_merge_string::do_add_input_section): Likewise.
4883         * object.cc (need_decompressed_section): New function.
4884         (build_compressed_section_map): Decompress sections needed later.
4885         (Sized_relobj_file::do_decompressed_section_contents): New function.
4886         (Sized_relobj_file::do_discard_decompressed_sections): New function.
4887         * object.h (Object::decompressed_section_contents): New function.
4888         (Object::discard_decompressed_sections): New function.
4889         (Object::do_decompressed_section_contents): New function.
4890         (Object::do_discard_decompressed_sections): New function.
4891         (Compressed_section_info): New type.
4892         (Compressed_section_map): Include decompressed section contents.
4893         (Sized_relobj_file::do_decompressed_section_contents): New function.
4894         (Sized_relobj_file::do_discard_decompressed_sections): New function.
4895
4896 2012-02-16  Cary Coutant  <ccoutant@google.com>
4897
4898         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
4899         * testsuite/Makefile.in: Regenerate.
4900
4901 2012-02-14  Cary Coutant  <ccoutant@google.com>
4902
4903         * options.cc (General_options::finalize): Disallow -pie and -static.
4904
4905 2012-02-03  Doug Kwan  <dougkwan@google.com>
4906
4907         * arm.cc (Arm_relocate_functions::abs8,
4908         Arm_relocate_functions::abs16): Use
4909         Bits::has_signed_unsigned_overflow32.
4910         (Arm_relocate_functions::thm_abs8): Correct range of
4911         overflow check.
4912         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
4913         in assertions.
4914
4915 2012-02-02  Doug Kwan  <dougkwan@google.com>
4916
4917         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
4918         position independent outputs, not just shared objects.
4919
4920 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
4921
4922         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
4923         * configure: Regenerated.
4924
4925 2012-01-27  Ian Lance Taylor  <iant@google.com>
4926
4927         * reloc.h (Bits): New class with static functions, copied from
4928         namespace utils in arm.cc.
4929         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
4930         instead.
4931
4932 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4933
4934         * incremental.cc (write_info_blocks): Correct relocation offset.
4935
4936 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4937
4938         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
4939         (Relocate::tls_gd_to_le): Likewise.
4940
4941 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4942
4943         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
4944
4945 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4946
4947         * configure.ac: Check if -mcmodel=medium works.
4948         * configure: Regenerated.
4949
4950 2012-01-24  Cary Coutant  <ccoutant@google.com>
4951
4952         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
4953         definition and ...
4954         (read_unsigned_LEB_128_x): ... this new function.
4955         (read_signed_LEB_128): Replaced with inline definition and ...
4956         (read_signed_LEB_128_x): ... this new function.
4957         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
4958         (read_unsigned_LEB_128): Add inline definition.
4959         (read_signed_LEB_128_x): New function.
4960         (read_signed_LEB_128): Add inline definition.
4961         * testsuite/Makefile.am (leb128_unittest): New unit test.
4962         * testsuite/Makefile.in: Regenerate.
4963         * testsuite/leb128_unittest.cc: New unit test.
4964
4965 2012-01-23  Ian Lance Taylor  <iant@google.com>
4966
4967         PR gold/13617
4968         * i386.cc (Target_i386::do_code_fill): When using a jmp
4969         instruction, pad with nop instructions.
4970         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4971
4972 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
4973
4974         * x86_64.cc (gc_process_relocs): Add typename on types used in
4975         template.
4976         (scan_relocs): Likewise.
4977         (relocate_section): Likewise.
4978         (apply_relocation): Likewise.
4979
4980 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
4981
4982         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
4983         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
4984         under x32.
4985
4986 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
4987
4988         * x86_64.cc: Initial support for x32.
4989
4990 2012-01-03  Cary Coutant  <ccoutant@google.com>
4991
4992         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
4993         Use abstract base class for GOT.
4994         * gold/output.h (class Output_data_got_base): New abstract base class.
4995         (class Output_data_got): Derive from new base class, adjust ctors.
4996         (Output_data_got::reserve_slot): Make virtual; rename to
4997         do_reserve_slot; Adjust callers.
4998         * gold/target.h (Sized_target::init_got_plt_for_update): Return
4999         pointer to abstract base class.
5000         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
5001
5002 2011-12-18  Ian Lance Taylor  <iant@google.com>
5003
5004         * object.h (Relobj::local_symbol_value): New function.
5005         (Relobj::local_plt_offset): New function.
5006         (Relobj::local_has_got_offset): New function.
5007         (Relobj::local_got_offset): New function.
5008         (Relobj::set_local_got_offset): New function.
5009         (Relobj::do_local_symbol_value): New pure virtual function.
5010         (Relobj::do_local_plt_offset): Likewise.
5011         (Relobj::do_local_has_got_offset): Likewise.
5012         (Relobj::do_local_got_offset): Likewise.
5013         (Relobj::do_set_local_got_offset): Likewise.
5014         (Sized_relobj::do_local_has_got_offset): Rename from
5015         local_has_got_offset.
5016         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
5017         (Sized_relobj::do_set_local_got_offset): Rename from
5018         set_local_got_offset.
5019         (Sized_relobj_file::do_local_plt_offset): Rename from
5020         local_plt_offset.
5021         (Sized_relobj_file::do_local_symbol_value): New function.
5022         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
5023         local_plt_offset.
5024         * output.cc (Output_data_got::Got_entry::write): Change object to
5025         Relobj.  Use local_symbol_value.
5026         (Output_data_got::add_global_with_rel): Change rel_dyn to
5027         Output_data_reloc_generic*.  Use add_global_generic.
5028         (Output_data_got::add_global_with_rela): Remove.  Change all
5029         callers to use add_global_with_rel.
5030         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
5031         Output_data_reloc_generic*.  Use add_global_generic.
5032         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
5033         callers to use add_global_pair_with_rel.
5034         (Output_data_got::add_local): Change object to Relobj*.
5035         (Output_data_got::add_local_plt): Likewise.
5036         (Output_data_got::add_local_with_rel): Change object to Relobj*,
5037         change rel_dyn to Output_data_reloc_generic*.  Use
5038         add_local_generic.
5039         (Output_data_got::add_local_with_rela): Remove.  Change all
5040         callers to use all_local_with_rel.
5041         (Output_data_got::add_local_pair_with_rel): Change object to
5042         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
5043         add_output_section_generic.
5044         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
5045         callers to use add_local_pair_with_rel.
5046         (Output_data_got::reserve_local): Change object to Relobj*.
5047         * output.h: (class Output_data_reloc_generic): Add pure virtual
5048         declarations for add_global_generic, add_local_generic,
5049         add_output_section_generic.
5050         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
5051         functions for Output_data_reloc_generic.  Update declarations for
5052         changes listed in output.cc.
5053         (class Output_data_got): Change template parameter to got_size.
5054         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
5055         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
5056         function.
5057         (Sized_relobj_incr::do_local_plt_offset): New function.
5058         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
5059         add_global_generic.
5060
5061 2011-12-17  Cary Coutant  <ccoutant@google.com>
5062
5063         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
5064         * resolve.cc (Symbol_table::resolve): Likewise.
5065         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
5066         arrays.
5067         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5068
5069 2011-12-16  Ian Lance Taylor  <iant@google.com>
5070
5071         * output.h (Output_data_reloc_generic::add): Only call
5072         add_dynamic_reloc if this is a dynamic reloc section.
5073
5074 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
5075
5076         PR gold/13505
5077         * target-reloc.h (apply_relocation): Replace <64, false> with
5078         <size, big_endian>.
5079
5080 2011-11-25  Nick Clifton  <nickc@redhat.com>
5081
5082         * po/it.po: New Italian translation.
5083
5084 2011-11-17  Sterling Augustine  <saugustine@google.com>
5085
5086         * script.cc (script_include_directive): Implement.
5087         (read_script_file): New local variables name and search_path. Update
5088         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
5089         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
5090         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
5091
5092 2011-11-11  Sterling Augustine  <saugustine@google.com>
5093
5094         * yyscript.y (section_cmd): Add support for INCLUDE directive.
5095         (file_or_sections_cmd): Likewise.
5096
5097 2011-11-11  Doug Kwan  <dougkwan@google.com>
5098
5099         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
5100         if --just-symbols is given.
5101
5102 2011-11-10  Doug Kwan  <dougkwan@google.com>
5103
5104         PR gold/13362
5105         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
5106         when processing data relocs.
5107         * reloc.h (Relocate_functions::rel_unaligned): New method.
5108         (Relocate_functions::pcrel_unaligned): Ditto.
5109         (Relocate_functions::rel32_unaligned): Ditto.
5110         (Relocate_functions::pcrel32_unaligned): Ditto.
5111
5112 2011-11-09  Doug Kwan  <dougkwan@google.com>
5113
5114         PR gold/13362
5115         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
5116         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
5117         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
5118         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5119         (Relocate_functions::rel_unaligned): New.
5120         (Relocate_functions::rel32_unaligned): New.
5121         * target-reloc.h (relocate_for_relocatable): Add code to handle
5122         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5123         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
5124         arm_unaligned_reloc_r): New targets.
5125         * testsuite/Makefile.in: Regenerate.
5126         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
5127         linking.
5128
5129 2011-11-02  Ian Lance Taylor  <iant@google.com>
5130
5131         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
5132         NATIVE_LINKER.
5133         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
5134         * options.cc (General_options::finalize): Use library search path
5135         from configure script if specified.  If not native and no sysroot,
5136         only search TOOLLIBDIR.
5137         * options.h (Search_directory::Search_directory): Change name to
5138         const std::string&.
5139         (General_options::add_to_library_path_with_sysroot): Change arg to
5140         const std::string&.
5141         * configure, Makefile.in, config.in: Rebuild.
5142
5143 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5144
5145         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
5146         we are working around the ARM1176 Erratum.
5147         * options.h (General_options::fix_arm1176): Add option.
5148         * testsuite/Makefile.am: Add testcases, and keep current ones
5149         working.
5150         * testsuite/Makefile.in: Regenerate.
5151         * testsuite/arm_fix_1176.s: New file.
5152         * testsuite/arm_fix_1176.sh: Likewise.
5153
5154 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5155
5156         * arm.cc (Target_arm::Target_arm): Remove initialisation of
5157         may_use_blx_.
5158         (Target_arm::may_use_blx): Remove method.
5159         (Target_arm::set_may_use_blx): Likewise.
5160         (Target_arm::may_use_v4t_interworking): New method.
5161         (Target_arm::may_use_v5t_interworking): Likewise.
5162         (Target_arm::may_use_blx_): Remove member variable.
5163         (Arm_relocate_functions::arm_branch_common): Check for v5T
5164         interworking.
5165         (Arm_relocate_functions::thumb_branch_common): Likewise.
5166         (Reloc_stub::stub_type_for_reloc): Likewise.
5167         (Target_arm::do_finalize_sections): Correct interworking checks.
5168         * testsuite/Makefile.am: Add new tests.
5169         * testsuite/Makefile.in: Regenerate.
5170         * testsuite/arm_farcall_arm_arm.s: New test.
5171         * testsuite/arm_farcall_arm_arm.sh: Likewise.
5172         * testsuite/arm_farcall_arm_thumb.s: Likewise.
5173         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
5174         * testsuite/arm_farcall_thumb_arm.s: Likewise.
5175         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
5176         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
5177         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
5178
5179 2011-10-31  Cary Coutant  <ccoutant@google.com>
5180
5181         PR gold/13023
5182         * expression.cc (Expression::eval_with_dot): Add
5183         is_section_dot_assignment parameter.
5184         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
5185         absolute and assigning to dot within a section.
5186         * script-sections.cc
5187         (Output_section_element_assignment::set_section_addresses): Pass
5188         dot_section to set_if_absolute.
5189         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
5190         as is_section_dot_assignment flag to eval_with_dot.
5191         (Output_section_element_dot_assignment::set_section_addresses):
5192         Likewise.
5193         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
5194         parameter.  Also set value if relative to dot_section; set the
5195         symbol's output_section.
5196         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
5197         parameter.  Adjust all callers.
5198         (Expression::eval_maybe_dot): Likewise.
5199         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
5200         Adjust all callers.
5201         * testsuite/script_test_2.t: Test assignment of an absolute value
5202         to dot within an output section element.
5203
5204 2011-10-31  Cary Coutant  <ccoutant@google.com>
5205
5206         * options.h (class General_options): Add --[no-]gnu-unique options.
5207         * symtab.cc (Symbol_table::sized_write_globals): Convert
5208         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
5209
5210 2011-10-31  Cary Coutant  <ccoutant@google.com>
5211
5212         PR gold/13359
5213         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
5214         unnecessary assertion.
5215         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
5216
5217 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
5218
5219         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5220         gc_mark_symbol.
5221         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5222         gc_mark_symbol.
5223         Change to just keep the section associated with symbol.
5224         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
5225         they are externally visible and --export-dynamic is turned on.
5226         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
5227
5228 2011-10-19  Ian Lance Taylor  <iant@google.com>
5229
5230         PR gold/13163
5231         * script-sections.cc
5232         (Output_section_element_dot_assignment::needs_output_section): New
5233         function.
5234
5235 2011-10-19  Ian Lance Taylor  <iant@google.com>
5236
5237         PR gold/13204
5238         * layout.cc (Layout::segment_precedes): Don't assert failure if a
5239         --section-start option was seen.
5240         * options.h (General_options::any_section_start): New function.
5241
5242 2011-10-18  David S. Miller  <davem@davemloft.net>
5243
5244         PR binutils/13301
5245         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
5246         member to track relocation locations that have moved during TLS
5247         reloc optimizations.
5248         (Target_sparc::Relocate::Relocate): Initialize to NULL.
5249         (Target_sparc::Relocate::relocate): Adjust view down by 4
5250         bytes if it matches reloc_adjust_addr_.
5251         (Target_sparc::Relocate::relocate_tls): Always move the
5252         __tls_get_addr call delay slot instruction forward 4 bytes when
5253         performing relaxation.
5254
5255 2011-10-18  Cary Coutant  <ccoutant@google.com>
5256
5257         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
5258         (Output_file::map_no_anonymous): Check for non-zero
5259         return code from posix_fallocate.
5260
5261 2011-10-17  Cary Coutant  <ccoutant@google.com>
5262
5263         PR gold/13245
5264         * plugin.cc (is_visible_from_outside): Check for symbols
5265         referenced from dynamic objects.
5266         * resolve.cc (Symbol_table::resolve): Don't count references
5267         from dynamic objects as references from real ELF files.
5268         * testsuite/plugin_test_2.sh: Adjust expected result.
5269
5270 2011-10-17  Cary Coutant  <ccoutant@google.com>
5271
5272         * gold.cc: Include timer.h.
5273         (queue_middle_tasks): Stamp time.
5274         (queue_final_tasks): Likewise.
5275         * main.cc (main): Store timer in parameters.  Print timers
5276         for each pass.
5277         * parameters.cc (Parameters::Parameters): Initialize timer_.
5278         (Parameters::set_timer): New function.
5279         (set_parameters_timer): New function.
5280         * parameters.h (Parameters::set_timer): New function.
5281         (Parameters::timer): New function.
5282         (Parameters::timer_): New data member.
5283         (set_parameters_timer): New function.
5284         * timer.cc (Timer::stamp): New function.
5285         (Timer::get_pass_time): New function.
5286         * timer.h (Timer::stamp): New function.
5287         (Timer::get_pass_time): New function.
5288         (Timer::pass_times_): New data member.
5289
5290 2011-10-17  Cary Coutant  <ccoutant@google.com>
5291
5292         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
5293         task for members of lib groups.
5294
5295 2011-10-17  Cary Coutant  <ccoutant@google.com>
5296
5297         PR gold/13288
5298         * fileread.cc (File_read::find_view): Add assert.
5299         (File_read::make_view): Move bounds check (replace with assert)...
5300         (File_read::find_or_make_view): ... to here.
5301
5302 2011-10-12  Cary Coutant  <ccoutant@google.com>
5303
5304         * output.cc (Output_file::open_base_file): Handle case where
5305         ::read returns less than requested size.
5306
5307 2011-10-10  Cary Coutant  <ccoutant@google.com>
5308
5309         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
5310         Initialize defined_count_.
5311         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
5312         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
5313         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
5314         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
5315         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
5316         * incremental.h (Sized_relobj_incr::defined_count_): New data
5317         member.
5318         (Sized_incr_dynobj::defined_count_): New data member.
5319         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
5320         Return zeroes instead of internal error.
5321
5322 2011-10-10  Cary Coutant  <ccoutant@google.com>
5323
5324         PR gold/13249
5325         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
5326         (Output_reloc::symbol_value): Return PLT offset if flag is set.
5327         * output.h (class Output_reloc): Add use_plt_offset flag.
5328         (Output_reloc::type_): Adjust size of bit field.
5329         (Output_reloc::use_plt_offset_): New bit field.
5330         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
5331         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
5332         flag.  Adjust all callers.
5333         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
5334         creating RELATIVE relocations.
5335
5336 2011-10-10  Nick Clifton  <nickc@redhat.com>
5337
5338         * po/es.po: Updated Spanish translation.
5339         * po/fi.po: Updated Finnish translation.
5340
5341 2011-10-03   Diego Novillo  <dnovillo@google.com>
5342
5343         * options.cc (parse_uint): Fix dereference of RETVAL.
5344
5345 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
5346
5347         * layout.h (section_order_map_): New member.
5348         (get_section_order_map): New member function.
5349         * output.cc (Output_section::add_input_section): Check for patterns
5350         only when --section-ordering-file is specified.
5351         * gold.cc (queue_middle_tasks): Delay updating order of sections till
5352         output_sections have been formed.
5353         * layout.cc (Layout_Layout): Initialize section_order_map_.
5354         * plugin.cc (update_section_order): Store order in order_map. Do not
5355         update the order.
5356         * testsuite/Makefile.am: Add test case for plugin_final_layout.
5357         * testsuite/Makefile.in: Regenerate.
5358         * testsuite/plugin_section_order.c: New file.
5359         * testsuite/plugin_final_layout.cc: New file.
5360         * testsuite/plugin_final_layout.sh: New file.
5361
5362 2011-09-29  Cary Coutant  <ccoutant@google.com>
5363
5364         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5365         Check for NULL.
5366         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
5367         symbols during incremental update.
5368         (Symbol_table::add_from_dynobj): Likewise.
5369
5370 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5371             Ian Lance Taylor  <iant@google.com>
5372
5373         * symtab.cc (Symbol_table::define_special_symbol): Always
5374         canonicalize version string.
5375
5376 2011-09-26  Cary Coutant  <ccoutant@google.com>
5377
5378         * gold.cc (queue_initial_tasks): Move option checks ...
5379         * options.cc (General_options::finalize): ... to here. Disable
5380         some options; make others fatal.
5381
5382 2011-09-26  Cary Coutant  <ccoutant@google.com>
5383
5384         gcc PR lto/47247
5385         * plugin.cc (get_symbols_v2): New function.
5386         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
5387         (is_referenced_from_outside): New function.
5388         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
5389         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
5390         (get_symbols): Pass version parameter.
5391         (get_symbols_v2): New function.
5392         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
5393         parameter.
5394         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
5395         (onload): Add LDPT_GET_SYMBOLS_V2.
5396         (all_symbols_read_hook): Use get_symbols_v2; check for
5397         LDPR_PREVAILING_DEF_IRONLY_EXP.
5398         * testsuite/plugin_test_3.sh: Update expected results.
5399
5400 2011-09-23  Simon Baldwin  <simonb@google.com>
5401
5402         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
5403         configuration options.
5404         * configure: Regenerate.
5405         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
5406         * Makefile.in: Regenerate.
5407         * testsuite/Makefile.in: Regenerate.
5408
5409 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
5410
5411         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
5412
5413 2011-09-19  Cary Coutant  <ccoutant@google.com>
5414
5415         * incremental.cc (can_incremental_update): Fix typo in comment.
5416         * incremental.h (can_incremental_update): Likewise.
5417
5418 2011-09-18  Cary Coutant  <ccoutant@google.com>
5419
5420         * incremental.cc (can_incremental_update): New function.
5421         * incremental.h (can_incremental_update): New function.
5422         * layout.cc (Layout::init_fixed_output_section): Call it.
5423         (Layout::make_output_section): Don't allow patch space in .eh_frame.
5424         * object.cc (Sized_relobj_file::do_layout): Call
5425         can_incremental_update.
5426
5427 2011-09-13  Cary Coutant  <ccoutant@google.com>
5428
5429         * configure.ac: Check for glibc support for gnu_indirect_function
5430         support with static linking, setting automake conditional
5431         IFUNC_STATIC.
5432         * Makefile.in: Regenerate.
5433         * configure: Regenerate.
5434
5435         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
5436         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
5437         for IFUNC_STATIC.
5438         * testsuite/Makefile.in: Regenerate.
5439
5440 2011-09-13  Cary Coutant  <ccoutant@google.com>
5441
5442         * incremental.cc (Sized_relobj_incr::do_layout): Call
5443         report_comdat_group for kept comdat sections.
5444         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
5445         * testsuite/Makefile.in: Regenerate.
5446         * testsuite/incr_comdat_test_1.cc: New source file.
5447         * testsuite/incr_comdat_test_2_v1.cc: New source file.
5448         * testsuite/incr_comdat_test_2_v2.cc: New source file.
5449         * testsuite/incr_comdat_test_2_v3.cc: New source file.
5450
5451 2011-09-13  Ian Lance Taylor  <iant@google.com>
5452
5453         * object.cc (Sized_relobj_file::do_layout): Remove unused local
5454         variable external_symbols_offset.
5455
5456 2011-09-12  Ian Lance Taylor  <iant@google.com>
5457
5458         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
5459         triggered if object has no symbols.
5460
5461 2011-09-09  David S. Miller  <davem@davemloft.net>
5462
5463         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
5464         (Output_fill_debug_line::do_write): Likewise.
5465
5466 2011-08-29  Cary Coutant  <ccoutant@google.com>
5467
5468         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
5469         casts to match formatting specs.
5470         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
5471
5472 2011-08-26  Cary Coutant  <ccoutant@google.com>
5473
5474         * layout.cc (Free_list::allocate): Provide guarantee of minimum
5475         remaining hole size when allocating.
5476         (Layout::make_output_section): Set fill methods for debug sections.
5477         * layout.h (Free_list::Free_list_node): Move from private to
5478         public.
5479         (Free_list::set_min_hole_size): New function.
5480         (Free_list::begin, Free_list::end): New functions.
5481         (Free_list::min_hole_): New data member.
5482         * output.cc: Include dwarf.h.
5483         (Output_fill_debug_info::do_minimum_hole_size): New function.
5484         (Output_fill_debug_info::do_write): New function.
5485         (Output_fill_debug_line::do_minimum_hole_size): New function.
5486         (Output_fill_debug_line::do_write): New function.
5487         (Output_section::Output_section): Initialize new data member.
5488         (Output_section::set_final_data_size): Ensure patch space is larger
5489         than minimum hole size.
5490         (Output_section::do_write): Fill holes in debug sections.
5491         * output.h (Output_fill): New class.
5492         (Output_fill_debug_info): New class.
5493         (Output_fill_debug_line): New class.
5494         (Output_section::set_free_space_fill): New function.
5495         (Output_section::free_space_fill_): New data member.
5496         * testsuite/Makefile.am (incremental_test_3): Add
5497         --incremental-patch option.
5498         (incremental_test_4): Likewise.
5499         (incremental_test_5): Likewise.
5500         (incremental_test_6): Likewise.
5501         (incremental_copy_test): Likewise.
5502         (incremental_common_test_1): Likewise.
5503         * testsuite/Makefile.in: Regenerate.
5504
5505 2011-08-26  Nick Clifton  <nickc@redhat.com>
5506
5507         * po/es.po: Updated Spanish translation.
5508
5509 2011-08-01  Cary Coutant  <ccoutant@google.com>
5510
5511         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
5512         * gold/testsuite/Makefile.in: Regenerate.
5513         * gold/testsuite/justsyms_exec.c: New source file.
5514         * gold/testsuite/justsyms_lib.c: New source file.
5515
5516 2011-08-01  Cary Coutant  <ccoutant@google.com>
5517
5518         * layout.cc (Layout::set_segment_offsets): Don't realign text
5519         segment if -Ttext was specified.
5520         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
5521         file type.
5522         * object.h (Sized_relobj_file::e_type): New function.
5523         (Sized_relobj_file::e_type_): New data member.
5524         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
5525         base address for ET_EXEC files.
5526         * target.cc (Target::do_make_elf_object_implementation): Allow
5527         ET_EXEC files with --just-symbols option.
5528
5529 2011-07-28  Cary Coutant  <ccoutant@google.com>
5530
5531         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
5532         Add thread_number parameter.
5533         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
5534         * workqueue-threads.cc
5535         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
5536         current thread if its thread number is greater than desired thread
5537         count.
5538         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
5539         Add thread_number parameter.
5540         (Workqueue::should_cancel_thread): Likewise.
5541         (Workqueue::find_runnable_or_wait): Pass thread_number to
5542         should_cancel_thread.
5543         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
5544         parameter.
5545
5546 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
5547
5548         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
5549         only after checking if it cannot be forced local.
5550         * symtab.h (is_externally_visible): Check if the symbol is not forced
5551         local.
5552
5553 2011-07-15  Ian Lance Taylor  <iant@google.com>
5554
5555         * options.h (class General_options): Add --print-output-format.
5556         Move -EL next to -EB, for  better --help output.
5557         * target-select.cc: Include <cstdio>, "options.h", and
5558         "parameters.h".
5559         (Target_selector::do_target_bfd_name): New function.
5560         (print_output_format): New function.
5561         * target-select.h (class Target_selector): Update declarations.
5562         (Target_selector::target_bfd_name): New function.
5563         (print_output_format): Declare.
5564         * main.cc: Include "target-select.h".
5565         (main): Handle --print-output-format.
5566         * gold.cc: Include "target-select.h".
5567         (queue_initial_tasks): Handle --print-output-format when there are
5568         no input files.
5569         * parameters.cc (parameters_force_valid_target): Give a better
5570         error message if -EB/-EL does not match target.
5571         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
5572         function.
5573
5574 2011-07-15  Ian Lance Taylor  <iant@google.com>
5575
5576         * i386.cc (class Output_data_plt_i386): Add layout_ field.
5577         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
5578         (Output_data_plt_i386::do_write): Write address of .dynamic
5579         section to first entry in .got.plt section.
5580         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
5581         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5582         Initialize layout_.
5583         (Output_data_plt_x86_64::do_write): Write address of .dynamic
5584         section to first entry in .got.plt section.
5585         * layout.h (Layout::dynamic_section): New function.
5586
5587 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
5588
5589         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
5590         to claim_file call.
5591         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
5592         input_section_position_, and input_section_glob_.
5593         (read_layout_from_file): Call function section_ordering_specified.
5594         * layout.h (is_section_ordering_specified): New function.
5595         (section_ordering_specified): New function.
5596         (section_ordering_specified_): New boolean member.
5597         * main.cc(main): Call load_plugins after layout object is defined.
5598         * output.cc (Output_section::add_input_section): Use
5599         function section_ordering_specified to check if section ordering is
5600         needed.
5601         * output.cc (Output_section::add_relaxed_input_section): Use
5602         function section_ordering_specified to check if section ordering is
5603         needed.
5604         (Output_section::update_section_layout): New function.
5605         (Output_section::sort_attached_input_sections): Check if input section
5606         must be reordered.
5607         * output.h (Output_section::update_section_layout): New function.
5608         * plugin.cc (get_section_count): New function.
5609         (get_section_type): New function.
5610         (get_section_name): New function.
5611         (get_section_contents): New function.
5612         (update_section_order): New function.
5613         (allow_section_ordering): New function.
5614         (Plugin::load): Add the new interfaces to the transfer vector.
5615         (Plugin_manager::load_plugins): New parameter.
5616         (Plugin_manager::all_symbols_read): New parameter.
5617         (Plugin_manager::claim_file): New parameter. Save the elf object for
5618         unclaimed objects.
5619         (Plugin_manager::get_elf_object): New function.
5620         (Plugin_manager::get_view): Change to directly use the bool to check
5621         if get_view is called from claim_file_hook.
5622         * plugin.h (input_objects): New function
5623         (Plugin__manager::load_plugins): New parameter.
5624         (Plugin_manager::claim_file): New parameter.
5625         (Plugin_manager::get_elf_object): New function.
5626         (Plugin_manager::in_claim_file_handler): New function.
5627         (Plugin_manager::in_claim_file_handler_): New member.
5628         (layout): New function.
5629         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
5630         handler with an extra parameter. Make the elf object before calling
5631         claim_file handler.
5632         * testsuite/plugin_test.c (get_section_count): New function pointer.
5633         (get_section_type): New function pointer.
5634         (get_section_name): New function pointer.
5635         (get_section_contents): New function pointer.
5636         (update_section_order): New function pointer.
5637         (allow_section_ordering): New function pointer.
5638         (onload): Check if the new interfaces exist.
5639
5640 2011-07-13  Ian Lance Taylor  <iant@google.com>
5641
5642         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
5643         relro section.
5644         * x86_64.cc (Target_x86_64::got_section): Likewise.
5645         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
5646         (relro_now_test_SOURCES): New variable.
5647         (relro_now_test_DEPENDENCIES): New variable.
5648         (relro_now_test_LDFLAGS): New variable.
5649         (relro_now_test_LDADD): New variable.
5650         (relro_now_test.so): New target.
5651         * testsuite/Makefile.in: Rebuild.
5652
5653 2011-07-12  Ian Lance Taylor  <iant@google.com>
5654
5655         PR gold/12980
5656         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
5657         GLOB_DAT relocation rather than a RELATIVE relocation for a
5658         protected symbol when creating a shared library.
5659         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5660         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
5661         * testsuite/protected_main_1.cc (main): Test that protected
5662         function has same address.
5663
5664 2011-07-11  Ian Lance Taylor  <iant@google.com>
5665
5666         PR gold/12979
5667         * options.h (class General_options): Add -Bgroup.
5668         * options.cc (General_options::finalize): If -Bgroup is set,
5669         default to --unresolved-symbols=report-all.
5670         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
5671         * target-reloc.h (issue_undefined_symbol_error): Handle
5672         --unresolved-symbols=report-all.
5673
5674 2011-07-08  Ian Lance Taylor  <iant@google.com>
5675
5676         PR gold/11985
5677         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
5678         if linker script discards key sections.
5679         (Layout::create_dynamic_symtab): Likewise.
5680         (Layout::assign_local_dynsym_offsets): Likewise.
5681         (Layout::sized_create_version_sections): Likewise.
5682         (Layout::create_interp): Likewise.
5683         (Layout::finish_dynamic_section): Likewise.
5684         (Layout::set_dynamic_symbol_size): Likewise.
5685
5686 2011-07-08  Ian Lance Taylor  <iant@google.com>
5687
5688         PR gold/12386
5689         * options.h (class General_options): Add --unresolved-symbols.
5690         * target-reloc.h (issue_undefined_symbol_error): Check
5691         --unresolved-symbols.  Add comments.
5692
5693 2011-07-08  Ian Lance Taylor  <iant@google.com>
5694
5695         * testsuite/odr_violation2.cc (Ordering::operator()): Make
5696         expression more complex.
5697
5698 2011-07-08  Ian Lance Taylor  <iant@google.com>
5699
5700         PR gold/11317
5701         * target-reloc.h (issue_undefined_symbol_error): New inline
5702         function, broken out of relocate_section.
5703         (relocate_section): Call issue_undefined_symbol_error.
5704         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5705         there is no TLS segment if we are about to issue an undefined
5706         symbol error.
5707         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5708
5709 2011-07-08  Ian Lance Taylor  <iant@google.com>
5710
5711         PR gold/12279
5712         * resolve.cc (Symbol_table::should_override): Add fromtype
5713         parameter.  Change all callers.  Give error when linking together
5714         TLS and non-TLS symbol.
5715         (Symbol_table::should_override_with_special): Add fromtype
5716         parameter.  Change all callers.
5717         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5718         there is no TLS segment if we have reported some errors.
5719         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5720
5721 2011-07-08  Ian Lance Taylor  <iant@google.com>
5722
5723         PR gold/12372
5724         * target.h (Target::plt_address_for_global): New function.
5725         (Target::plt_address_for_local): New function.
5726         (Target::plt_section_for_global): Remove.
5727         (Target::plt_section_for_local): Remove.
5728         (Target::do_plt_address_for_global): New virtual function.
5729         (Target::do_plt_address_for_local): New virtual function.
5730         (Target::do_plt_section_for_global): Remove.
5731         (Target::do_plt_section_for_local): Remove.
5732         (Target::register_global_plt_entry): Add Symbol_table and Layout
5733         parameters.
5734         * output.cc (Output_data_got::Got_entry::write): Use
5735         plt_address_for_global and plt_address_for_local.
5736         * layout.cc (Layout::add_target_dynamic_tags): Use size and
5737         address of output section.
5738         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
5739         got_irelative_, and irelative_count_ fields.  Update
5740         declarations.
5741         (Output_data_plt_i386::has_irelative_section): New function.
5742         (Output_data_plt_i386::entry_count): Add irelative_count_.
5743         (Output_data_plt_i386::set_final_data_size): Likewise.
5744         (class Target_i386): Add got_irelative_ and rel_irelative_
5745         fields.  Update declarations.
5746         (Target_i386::Target_i386): Initialize new fields.
5747         (Target_i386::do_plt_address_for_global): New function replacing
5748         do_plt_section_for_global.
5749         (Target_i386::do_plt_address_for_local): New function replacing
5750         do_plt_section_for_local.
5751         (Target_i386::got_section): Create got_irelative_.
5752         (Target_i386::rel_irelative_section): New function.
5753         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
5754         fields.  Don't define __rel_iplt_{start,end}.
5755         (Output_data_plt_i386::add_entry): Add symtab and layout
5756         parameters.  Change all callers.  Use different PLT and GOT for
5757         IFUNC symbols.
5758         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
5759         layout parameters.  Change all callers.  Use different PLT and
5760         GOT.
5761         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
5762         (Output_data_plt_i386::rel_irelative): New function.
5763         (Output_data_plt_i386::address_for_global): New function.
5764         (Output_data_plt_i386::address_for_local): New function.
5765         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
5766         IRELATIVE GOT when changing IFUNC GOT entries.
5767         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
5768         reloc.
5769         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
5770         if we didn't create an IRELATIVE GOT.
5771         (Target_i386::Relocate::relocate): Use plt_address_for_global and
5772         plt_address_for_local.
5773         (Target_i386::do_dynsym_value): Use plt_address_for_global.
5774         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
5775         got_irelative_, and irelative_count_ fields.  Update
5776         declarations.
5777         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5778         Initialize new fields.  Remove symtab parameter.  Change all
5779         callers.
5780         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
5781         irelative_count_.
5782         (Output_data_plt_x86_64::has_irelative_section): New function.
5783         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
5784         (class Target_x86_64): Add got_irelative_ and rel_irelative_
5785         fields.  Update declarations.
5786         (Target_x86_64::Target_x86_64): Initialize new fields.
5787         (Target_x86_64::do_plt_address_for_global): New function replacing
5788         do_plt_section_for_global.
5789         (Target_x86_64::do_plt_address_for_local): New function replacing
5790         do_plt_section_for_local.
5791         (Target_x86_64::got_section): Create got_irelative_.
5792         (Target_x86_64::rela_irelative_section): New function.
5793         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
5794         all callers.  Don't create __rel_iplt_{start,end}.
5795         (Output_data_plt_x86_64::add_entry): Add symtab and layout
5796         parameters.  Change all callers.  Use different PLT and GOT for
5797         IFUNC symbols.
5798         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
5799         layout parameters.  Change all callers.  Use different PLT and
5800         GOT.
5801         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
5802         parameters.  Change all callers.  Use different PLT and GOT for
5803         IFUNC symbols.
5804         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
5805         (Output_data_plt_x86_64::rela_irelative): New function.
5806         (Output_data_plt_x86_64::address_for_global): New function.
5807         (Output_data_plt_x86_64::address_for_local): New function.
5808         (Output_data_plt_x86_64::set_final_data_size): Likewise.
5809         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
5810         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
5811         (Target_x86_64::register_global_plt_entry): Add symtab and layout
5812         parameters.
5813         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
5814         reloc.
5815         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
5816         symbols if we didn't create an IRELATIVE GOT.
5817         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
5818         plt_address_for_local.
5819         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
5820         * testsuite/ifuncvar1.c: New test file.
5821         * testsuite/ifuncvar2.c: New test file.
5822         * testsuite/ifuncvar3.c: New test file.
5823         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
5824         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
5825         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
5826         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
5827         * testsuite/Makefile.in: Rebuild.
5828
5829 2011-07-07  Cary Coutant  <ccoutant@google.com>
5830
5831         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
5832         (two_file_test_1_ndebug.o): Likewise.
5833         (two_file_test_1b_ndebug.o): Likewise.
5834         (two_file_test_2_ndebug.o): Likewise.
5835         (two_file_test_main_ndebug.o): Likewise.
5836         (incremental_test_2): Link with no-debug versions.
5837
5838 2011-07-06  Cary Coutant  <ccoutant@google.com>
5839
5840         * gold/incremental.cc
5841         (Output_section_incremental_inputs::write_info_blocks): Check for
5842         hidden and internal symbols.
5843
5844 2011-07-06  Cary Coutant  <ccoutant@google.com>
5845
5846         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
5847         Check disposition for startup file.
5848         (Incremental_inputs::report_command_line): Ignore
5849         --incremental-startup-unchanged option.
5850         * options.cc (General_options::parse_incremental_startup_unchanged):
5851         New function.
5852         (General_options::General_options): Initialize new data member.
5853         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
5854         (General_options): Add --incremental-startup-unchanged option.
5855         (General_options::incremental_startup_disposition): New function.
5856         (General_options::incremental_startup_disposition_): New data member.
5857
5858 2011-07-06  Cary Coutant  <ccoutant@google.com>
5859
5860         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
5861         input file index to Script_info ctor.
5862         (Sized_incremental_binary::do_file_has_changed): Find the
5863         command-line argument for files named in scripts.
5864         * incremental.h (Script_info::Script_info): New ctor
5865         with input file index.
5866         (Script_info::input_file_index): New function.
5867         (Script_info::input_file_index_): New data member.
5868         (Incremental_binary::get_library): Add const.
5869         (Incremental_binary::get_script_info): Add const.
5870         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
5871         * testsuite/Makefile.am (incremental_test_5): New test case.
5872         (incremental_test_6): New test case.
5873         * testsuite/Makefile.in: Regenerate.
5874
5875 2011-07-06  Cary Coutant  <ccoutant@google.com>
5876
5877         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
5878         debug output when command lines differ.
5879
5880 2011-07-06  Cary Coutant  <ccoutant@google.com>
5881
5882         * incremental.cc (Incremental_inputs::report_command_line): Ignore
5883         --incremental-patch option.
5884         * layout.cc (Free_list::allocate): Extend allocation beyond original
5885         end if enabled.
5886         (Layout::make_output_section): Mark sections that should get
5887         patch space.
5888         * options.cc (parse_percent): New function.
5889         * options.h (parse_percent): New function.
5890         (DEFINE_percent): New macro.
5891         (General_options): Add --incremental-patch option.
5892         * output.cc (Output_section::Output_section): Initialize new data
5893         members.
5894         (Output_section::add_input_section): Print section name when out
5895         of patch space.
5896         (Output_section::add_output_section_data): Likewise.
5897         (Output_section::set_final_data_size): Add patch space when
5898         doing --incremental-full.
5899         (Output_section::do_reset_address_and_file_offset): Remove patch
5900         space.
5901         (Output_segment::set_section_list_addresses): Print debug output
5902         only if --incremental-update.
5903         * output.h (Output_section::set_is_patch_space_allowed): New function.
5904         (Output_section::is_patch_space_allowed_): New data member.
5905         (Output_section::patch_space_): New data member.
5906         * parameters.cc (Parameters::incremental_full): New function.
5907         * parameters.h (Parameters::incremental_full): New function
5908         * testsuite/Makefile.am (incremental_test_2): Add test for
5909         --incremental-patch option.
5910         * testsuite/Makefile.in: Regenerate.
5911         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
5912         (t18): Remove function body.
5913
5914 2011-07-05  Doug Kwan  <dougkwan@google.com>
5915
5916         PR gold/12771
5917         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
5918         Arm_Address type for relocation result.
5919         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
5920         overflow check.
5921         (Arm_relocate_functions::abs32): Use unaligned access.
5922         (Arm_relocate_functions::rel32): Ditto.
5923         (Arm_relocate_functions::prel31): Ditto.
5924         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
5925         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
5926         static data relocations.
5927         * testsuite/Makefile.in: Regnerate.
5928         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
5929
5930 2011-07-05  Ian Lance Taylor  <iant@google.com>
5931
5932         PR gold/12392
5933         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
5934         symbols if necessary.
5935         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5936
5937 2011-07-05  Ian Lance Taylor  <iant@google.com>
5938
5939         PR gold/12952
5940         * resolve.cc (Symbol::override_base_with_special): Simply override
5941         version with special symbol version, ignoring previous version.
5942
5943 2011-07-05  Ian Lance Taylor  <iant@google.com>
5944
5945         * object.cc (Sized_relobj_file::include_section_group): Add
5946         information to comment about signature location.
5947
5948 2011-07-02  Ian Lance Taylor  <iant@google.com>
5949
5950         PR gold/12957
5951         * options.h (class General_options): Add -f and -F.
5952         * options.cc (General_options::finalize): Fatal error if -f/-F
5953         are used without -shared.
5954         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
5955
5956 2011-07-02  Ian Lance Taylor  <iant@google.com>
5957
5958         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
5959
5960 2011-07-01  Ian Lance Taylor  <iant@google.com>
5961
5962         PR gold/12525
5963         PR gold/12952
5964         * resolve.cc (Symbol::override_base_with_special): Don't override
5965         the version if the overriding symbol has a different name.
5966         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
5967         all callers.  If we give an error about an undefined version,
5968         define the base version if necessary.
5969         * dynobj.h (class Versions): Update declaration.
5970         * testsuite/weak_alias_test_5.cc: New file.
5971         * testsuite/weak_alias_test.script: New file.
5972         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
5973         and versioned_alias have the right value, and call t2.
5974         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
5975         weak_alias_test_5.so.
5976         (weak_alias_test_LDADD): Likewise.
5977         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
5978         * testsuite/Makefile.in: Rebuild.
5979
5980 2011-07-01  Ian Lance Taylor  <iant@google.com>
5981
5982         PR gold/12525
5983         * options.h (class General_options): Support -z notext.
5984         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
5985         -Wl,-z,notext.
5986         (two_file_shared_nonpic.so): Likewise.
5987         (two_file_shared_mixed.so): Likewise.
5988         (two_file_shared_mixed_1.so): Likewise.
5989         (weak_undef_lib_nonpic.so): Likewise.
5990         (alt/weak_undef_lib_nonpic.so): Likewise.
5991         (tls_test_shared_nonpic.so): Likewise.
5992         * testsuite/Makefile.in: Rebuild.
5993
5994 2011-07-01  Ian Lance Taylor  <iant@google.com>
5995
5996         PR gold/12525
5997         * configure.ac: Test whether static linking works, setting
5998         the automake conditional HAVE_STATIC.
5999         * testsuite/Makefile.am: Disable tests using -static if
6000         HAVE_STATIC is not true.
6001         * configure, testsuite/Makefile.in: Rebuild.
6002
6003 2011-07-01  Ian Lance Taylor  <iant@google.com>
6004
6005         PR gold/12525
6006         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
6007         Assert if we see DW_EH_PE_indirect.
6008         * target.h (Target::ehframe_datarel_base): New function.
6009         (Target::do_ehframe_datarel_base): New target function.
6010         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
6011         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
6012         function.
6013
6014 2011-07-01  Ian Lance Taylor  <iant@google.com>
6015
6016         PR gold/12571
6017         * options.h (class General_options): Add
6018         --ld-generated-unwind-info.
6019         * ehframe.cc (Fde::write): Add address parameter.  Change all
6020         callers.  If associated with PLT, fill in address and size.
6021         (Cie::set_output_offset): Only add merge mapping if there is an
6022         object.
6023         (Cie::write): Add address parameter.  Change all callers.
6024         (Eh_frame::add_ehframe_for_plt): New function.
6025         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
6026         input_offset_ fields into union u_, with new plt field.
6027         (Fde::Fde): Adjust for new union field.
6028         (Fde::Fde) [Output_data version]: New constructor.
6029         (Fde::add_mapping): Only add merge mapping if there is an object.
6030         (class Cie): Update declarations.
6031         (class Eh_frame): Declare add_ehframe_for_plt.
6032         * layout.cc (Layout::layout_eh_frame): Break out code into
6033         make_eh_frame_section, and call it.
6034         (Layout::make_eh_frame_section): New function.
6035         (Layout::add_eh_frame_for_plt): New function.
6036         * layout.h (class Layout): Update declarations.
6037         * merge.cc (Merge_map::add_mapping): Add assertion.
6038         * i386.cc: Include "dwarf.h".
6039         (class Output_data_plt_i386): Make first_plt_entry,
6040         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
6041         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6042         and plt_eh_frame_fde.
6043         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
6044         boundary.  Call add_eh_frame_for_plt if appropriate.
6045         * x86_64.cc: Include "dwarf.h".
6046         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
6047         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
6048         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6049         and plt_eh_frame_fde.
6050         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
6051         appropriate.
6052
6053 2011-06-29  Ian Lance Taylor  <iant@google.com>
6054
6055         PR gold/12629
6056         * object.cc (Sized_relobj_file::layout_section): Change shdr
6057         parameter to be const.
6058         (Sized_relobj_file::layout_eh_frame_section): New function, broken
6059         out of do_layout.
6060         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
6061         appropriate.  Call layout_eh_frame_section.
6062         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
6063         sections.
6064         * object.h (class Sized_relobj_file): Update declarations.
6065
6066 2011-06-29  Ian Lance Taylor  <iant@google.com>
6067
6068         PR gold/12652
6069         * script.cc (Token::integer_value): Accept trailing M/m/K/k
6070         modifier.
6071         (Lex::gather_token): Accept trailing M/m/K/k for integers.
6072
6073 2011-06-29  Ian Lance Taylor  <iant@google.com>
6074
6075         PR gold/12675
6076         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
6077         SHT_X86_64_UNWIND.
6078         * layout.cc (Layout::layout_eh_frame): Likewise.
6079
6080 2011-06-29  Ian Lance Taylor  <iant@google.com>
6081
6082         PR gold/12695
6083         * layout.cc (Layout::symtab_section_shndx): New function.
6084         * layout.h (class Layout): Declare symtab_section_shndx.
6085         * output.cc (Output_section::write_header): Call it.
6086
6087 2011-06-29  Ian Lance Taylor  <iant@google.com>
6088
6089         PR gold/12818
6090         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
6091         symbols which are not used in a relocation.
6092
6093 2011-06-28  Ian Lance Taylor  <iant@google.com>
6094
6095         PR gold/12898
6096         * layout.cc (Layout::segment_precedes): Don't crash if a linker
6097         script create indistinguishable segments.
6098         (Layout::set_segment_offsets): Use stable_sort when sorting
6099         segments.  Pass this to Compare_segments constructor.
6100         * layout.h (class Layout): Make segment_precedes non-static.
6101         (class Compare_segments): Change from struct to class.  Add
6102         layout_ field.  Add constructor.
6103         * script-sections.cc
6104         (Script_sections::attach_sections_using_phdrs_clause): Rename
6105         local orphan to is_orphan.  Don't report failure to put empty
6106         section in segment.  On attachment failure, report name of
6107         section, and attach to first PT_LOAD segment.
6108
6109 2011-06-28  Ian Lance Taylor  <iant@google.com>
6110
6111         PR gold/12934
6112         * target-select.cc (Target_selector::Target_selector): Add
6113         emulation parameter.  Change all callers.
6114         (select_target_by_bfd_name): Rename from select_target_by_name.
6115         Change all callers.
6116         (select_target_by_emulation): New function.
6117         (supported_emulation_names): New function.
6118         * target-select.h (class Target_selector): Add emulation_ field.
6119         Update declarations.
6120         (Target_selector::recognize_by_bfd_name): Rename from
6121         recognize_by_name.  Change all callers.
6122         (Target_selector::supported_bfd_names): Rename from
6123         supported_names.  Change all callers.
6124         (Target_selector::recognize_by_emulation): New function.
6125         (Target_selector::supported_emulations): New function.
6126         (Target_selector::emulation): New function.
6127         (Target_selector::do_recognize_by_bfd_name): Rename from
6128         do_recognize_by_name.  Change all callers.
6129         (Target_selector::do_supported_bfd_names): Rename from
6130         do_supported_names.  Change all callers.
6131         (Target_selector::do_recognize_by_emulation): New function.
6132         (Target_selector::do_supported_emulations): New function.
6133         (select_target_by_bfd_name): Change name in declaration.
6134         (select_target_by_emulation): Declare.
6135         (supported_emulation_names): Declare.
6136         * parameters.cc (parameters_force_valid_target): Try to find
6137         target based on emulation from -m option.
6138         * options.h (class General_options): Change doc string for -m.
6139         * options.cc (help): Print emulations.
6140         (General_options::parse_V): Likewise.
6141         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
6142         Add emulation parameter.  Change all callers.
6143
6144 2011-06-28  Ian Lance Taylor  <iant@google.com>
6145
6146         * target.h (class Target): Add osabi_ field.
6147         (Target::osabi): New function.
6148         (Target::set_osabi): New function.
6149         (Target::Target): Initialize osabi_.
6150         (Target::do_adjust_elf_header): Make pure virtual.
6151         (Sized_target::do_adjust_elf_header): Declare.
6152         * target.cc (Sized_target::do_adjust_elf_header): New function.
6153         (class Sized_target): Instantiate all versions.
6154         * freebsd.h (class Target_freebsd): Remove.
6155         (Target_selector_freebsd::do_recognize): Call set_osabi on
6156         Target.
6157         (Target_selector_freebsd::do_recognize_by_name): Likewise.
6158         (Target_selector_freebsd::set_osabi): Remove.
6159         * i386.cc (class Target_i386): Inherit from Sized_target rather
6160         than Target_freebsd.
6161         * x86_64.cc (class Target_x86_64): Likewise.
6162
6163 2011-06-28  Ian Lance Taylor  <iant@google.com>
6164
6165         * target.h (Target::can_check_for_function_pointers): Rewrite.
6166         Make non-virtual.
6167         (Target::can_icf_inline_merge_sections): Likewise.
6168         (Target::section_may_have_icf_unsafe_poineters): Likewise.
6169         (Target::Target_info): Add can_icf_inline_merge_sections field.
6170         (Target::do_can_check_for_function_pointers): New virtual
6171         function.
6172         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
6173         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
6174         from can_check_for_function_pointers, move in file.
6175         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
6176         section_may_have_icf_unsafe_poineters, move in file.
6177         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
6178         * i386.cc (Target_i386::do_can_check_for_function_pointers):
6179         Rename from can_check_for_function_pointers, move in file.
6180         (Target_i386::can_icf_inline_merge_sections): Remove.
6181         (Target_i386::i386_info): Initialize
6182         can_icf_inline_merge_sections.
6183         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
6184         Initialize can_icf_inline_merge_sections.
6185         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
6186         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
6187         Rename from can_check_for_function_pointers, move in file.
6188         (Target_x86_64::can_icf_inline_merge_sections): Remove.
6189         (Target_x86_64::x86_64_info): Initialize
6190         can_icf_inline_merge_sections.
6191         * testsuite/testfile.cc (Target_test::test_target_info):
6192         Likewise.
6193         * icf.cc (get_section_contents): Correct formatting.
6194
6195 2011-06-27  Ian Lance Taylor  <iant@google.com>
6196
6197         * symtab.cc (Symbol::versioned_name): New function.
6198         (Symbol_table::add_to_final_symtab): Use versioned_name when
6199         appropriate.
6200         (Symbol_table::sized_write_symbol): Likewise.
6201         * symtab.h (class Symbol): Declare versioned_name.
6202         * stringpool.h (class Stringpool_template): Add variant of add
6203         which takes a std::basic_string.
6204         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
6205         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
6206         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
6207         (ver_test_12.o): New target.
6208         * testsuite/Makefile.in: Rebuild.
6209
6210 2011-06-27  Doug Kwan  <dougkwan@google.com>
6211
6212         * arm.cc (Arm_relocate_functions::thm_jump8,
6213         Arm_relocate_functions::thm_jump11): Use a wider signed
6214         type to compute offset.
6215         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
6216         arm_thm_jump8.
6217         * testsuite/Makefile.in: Regenerate.
6218         * testsuite/arm_branch_in_range.sh: Check test results of
6219         arm_thm_jump11 and arm_thm_jump8.
6220         * testsuite/arm_thm_jump11.s: New test source file.
6221         * testsuite/arm_thm_jump11.t: New linker script.
6222         * testsuite/arm_thm_jump8.s: New test source file.
6223         * testsuite/arm_thm_jump8.t: New linker script.
6224
6225 2011-06-24  Ian Lance Taylor  <iant@google.com>
6226
6227         * layout.cc: Include "object.h".
6228         (ctors_sections_in_init_array): New static variable.
6229         (Layout::is_ctors_in_init_array): New function.
6230         (Layout::layout): Add entry to ctors_sections_in_init_array if
6231         appropriate.
6232         * layout.h (class Layout): Declare is_ctors_in_init_array.
6233         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
6234         is_ctors_reverse_view is set.
6235         (Sized_relobj_file::write_sections): Add layout parameter.  Change
6236         all callers.  Set is_ctors_reverse_view field of View_size.
6237         (Sized_relobj_file::reverse_words): New function.
6238         * object.h (Sized_relobj_file::View_size): Add
6239         is_ctors_reverse_view field.
6240         (class Sized_relobj_file): Update declarations.
6241         * testsuite/initpri3.c: New test.
6242         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
6243         initpri3b.
6244         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
6245         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
6246         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
6247         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
6248         * testsuite/Makefile.in: Rebuild.
6249
6250 2011-06-24  Cary Coutant  <ccoutant@google.com>
6251
6252         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
6253         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
6254         (debug_msg_cdebug.err): New targets.
6255         * testsuite/Makefile.in: Regenerate.
6256         * testsuite/debug_msg.sh: Check output of link with compressed debug.
6257         Fix checks for link with shared library.
6258
6259 2011-06-24  Doug Kwan  <dougkwan@google.com>
6260
6261         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
6262         skip empty text sections.
6263         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
6264
6265 2011-06-22  Ian Lance Taylor  <iant@google.com>
6266
6267         PR gold/12910
6268         * options.h (class General_options): Add --ctors-in-init-array.
6269         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
6270         friends as SHT_PROGBITS for merging sections.
6271         (Layout::layout): Remove special handling of .init_array and
6272         friends.  Don't sort if doing relocatable link.  Sort for .ctors
6273         and .dtors if ctors_in_init_array.
6274         (Layout::make_output_section): Force correct section types for
6275         .init_array and friends.  Don't sort if doing relocatable link,
6276         Don't sort .ctors and .dtors if ctors_in_init_array.
6277         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
6278         (Layout::output_section_name): Add relobj parameter.  Change all
6279         callers.  Handle .ctors. and .dtors. in code rather than table.
6280         Handle .ctors and .dtors if ctors_in_init_array.
6281         (Layout::match_file_name): New function, moved from output.cc.
6282         * layout.h (class Layout): Update declarations.
6283         * output.cc: Include "layout.h".
6284         (Input_section_sort_entry::get_priority): New function.
6285         (Input_section_sort_entry::match_file_name): Just call
6286         Layout::match_file_name.
6287         (Output_section::Input_section_sort_init_fini_compare::operator()):
6288         Handle .ctors and .dtors.  Sort by explicit priority rather than
6289         by name.
6290         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
6291         * testsuite/initpri2.c: New test.
6292         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
6293         (check_PROGRAMS): Add initpri2.
6294         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
6295         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
6296         * configure, testsuite/Makefile.in: Rebuild.
6297
6298 2011-06-19  Ian Lance Taylor  <iant@google.com>
6299
6300         PR gold/12880
6301         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
6302         .interp section to a PT_INTERP segment even if we have seen a
6303         --dynamic-linker option.  Don't do it if we have seen a PHDRS
6304         clause in a linker script.
6305         (Layout::finalize): Don't create a .interp section if we've
6306         already create a PT_INTERP segment.
6307         (Layout::create_interp): Always call choose_output_section (revert
6308         patch of 2011-06-17).  Don't create PT_INTERP segment.
6309         * script-sections.cc
6310         (Script_sections::create_note_and_tls_segments): Add a .interp
6311         section to a PT_INTERP segment even if we have seen a
6312         --dynamic-linker option.
6313
6314 2011-06-18  Ian Lance Taylor  <iant@google.com>
6315
6316         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
6317         merely because a non-PT_LOAD segment has a dynamic reloc.
6318
6319 2011-06-18  Ian Lance Taylor  <iant@google.com>
6320
6321         * layout.cc (Layout::finish_dynamic_section): Don't create
6322         DT_FLAGS entry if not needed.
6323
6324 2011-06-18  Ian Lance Taylor  <iant@google.com>
6325
6326         PR gold/12745
6327         * layout.cc (Layout::layout_eh_frame): Correct handling of
6328         writable .eh_frame section.
6329
6330 2011-06-17  Ian Lance Taylor  <iant@google.com>
6331
6332         PR gold/12893
6333         * resolve.cc (Symbol_table::resolve): Don't give an error if a
6334         symbol is redefined with the exact same object and value.
6335
6336 2011-06-17  Ian Lance Taylor  <iant@google.com>
6337
6338         PR gold/12880
6339         * layout.h (class Layout): Add interp_segment_ field.
6340         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
6341         (Layout::attach_allocated_section_to_segment): If making shared
6342         library, put .interp section in PT_INTERP segment.
6343         (Layout::finalize): Also call create_interp if -dynamic-linker
6344         option was used.
6345         (Layout::create_interp): Assert that there is no PT_INTERP
6346         segment.  If not using a SECTIONS clause, use make_output_section.
6347         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
6348         * script-sections.cc
6349         (Script_sections::create_note_and_tls_segments): If making shared
6350         library, put .interp section in PT_INTERP segment.
6351
6352 2011-06-17  Ian Lance Taylor  <iant@google.com>
6353
6354         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
6355         when making a shared library.
6356
6357 2011-06-17  Ian Lance Taylor  <iant@google.com>
6358
6359         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
6360         parameter.  Change all callers.  Don't issue warning about PC32
6361         against locally defined symbol.
6362
6363 2011-06-16  Ian Lance Taylor  <iant@google.com>
6364
6365         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
6366         occurs in same object.
6367
6368 2011-06-14  Alan Modra  <amodra@gmail.com>
6369
6370         * po/POTFILES.in: Regenerate.
6371
6372 2011-06-09  Ian Lance Taylor  <iant@google.com>
6373
6374         * script-sections.cc
6375         (Orphan_output_section::set_section_addresses): For a relocatable
6376         link set address to 0.
6377
6378 2011-06-09  Cary Coutant  <ccoutant@google.com>
6379
6380         PR gold/12804
6381         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
6382         used with --compress-debug-sections.
6383         * gold/object.cc (Sized_relobj_file::do_layout): Report
6384         uncompressed size of compressed input sections.
6385
6386 2011-06-08  Cary Coutant  <ccoutant@google.com>
6387
6388         PR gold/12804
6389         * testsuite/two_file_test_2_v1.cc: Change initialization of
6390         v2 to keep it in .data.
6391
6392 2011-06-07  Cary Coutant  <ccoutant@google.com>
6393
6394         * common.cc (Symbol_table::do_allocate_commons_list): Call
6395         gold_fallback.
6396         * errors.cc (Errors::fatal): Adjust call to gold_exit.
6397         (Errors::fallback): New function.
6398         (gold_fallback): New function.
6399         * errors.h (Errors::fallback): New function.
6400         * gold.cc (gold_exit): Change status parameter to enum; adjust
6401         all callers.
6402         (queue_initial_tasks): Call gold_fallback.
6403         * gold.h: Include cstdlib.
6404         (Exit_status): New enum type.
6405         (gold_exit): Change status parameter to enum.
6406         (gold_fallback): New function.
6407         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
6408         (Layout::create_symtab_sections): Likewise.
6409         (Layout::create_shdrs): Likewise.
6410         * main.cc (main): Adjust call to gold_exit.
6411         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
6412         (Output_data_got::add_got_entry_pair): Likewise.
6413         (Output_section::add_input_section): Likewise.
6414         (Output_section::add_output_section_data): Likewise.
6415         (Output_segment::set_section_list_addresses): Likewise.
6416         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
6417
6418 2011-06-07  Cary Coutant  <ccoutant@google.com>
6419
6420         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
6421         for incremental links.
6422         * output.cc (Output_segment::set_section_list_addresses): Remove
6423         FIXME and test for TLS or BSS.
6424
6425 2011-06-07  Cary Coutant  <ccoutant@google.com>
6426
6427         * testsuite/Makefile.am: Add incremental_copy_test,
6428         incremental_common_test_1.
6429         * testsuite/Makefile.in: Regenerate.
6430         * testsuite/common_test_1_v1.c: New source file.
6431         * testsuite/common_test_1_v2.c: New source file.
6432         * testsuite/copy_test_v1.cc: New source file.
6433
6434 2011-06-07  Cary Coutant  <ccoutant@google.com>
6435
6436         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
6437         update, allocate common from bss section's free list.
6438         * incremental-dump.cc (dump_incremental_inputs): Print flag for
6439         linker-defined symbols.
6440         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
6441         Skip GOT and PLT entries that are no longer referenced.
6442         (Output_section_incremental_inputs::write_info_blocks): Mark
6443         linker-defined symbols.
6444         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
6445         * output.cc (Output_section::allocate): New function.
6446         * output.h (Output_section::allocate): New function.
6447         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
6448         linker-defined symbols.
6449         (Symbol::override_base_with_special): Copy is_predefined_ flag.
6450         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
6451         (Symbol::init_base_output_data): Likewise.
6452         (Symbol::init_base_output_segment): Likewise.
6453         (Symbol::init_base_constant): Likewise.
6454         (Sized_symbol::init_output_data): Likewise.
6455         (Sized_symbol::init_output_segment): Likewise.
6456         (Sized_symbol::init_constant): Likewise.
6457         (Symbol_table::do_define_in_output_data): Likewise.
6458         (Symbol_table::do_define_in_output_segment): Likewise.
6459         (Symbol_table::do_define_as_constant): Likewise.
6460         * symtab.h (Symbol::is_predefined): New function.
6461         (Symbol::init_base_output_data): Add is_predefined parameter.
6462         (Symbol::init_base_output_segment): Likewise.
6463         (Symbol::init_base_constant): Likewise.
6464         (Symbol::is_predefined_): New data member.
6465         (Sized_symbol::init_output_data): Add is_predefined parameter.
6466         (Sized_symbol::init_output_segment): Likewise.
6467         (Sized_symbol::init_constant): Likewise.
6468         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
6469
6470 2011-06-07  Cary Coutant  <ccoutant@google.com>
6471
6472         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
6473         instead of emit_copy_reloc.
6474         (Copy_relocs::emit_copy_reloc): Refactor.
6475         (Copy_relocs::make_copy_reloc): New function.
6476         (Copy_relocs::add_copy_reloc): Remove.
6477         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
6478         section.
6479         (Copy_relocs::make_copy_reloc): New function.
6480         (Copy_relocs::add_copy_reloc): Remove.
6481         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
6482         unchanged input files.
6483         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
6484         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
6485         Reserve BSS space for COPY relocations.
6486         (Sized_incremental_binary::do_emit_copy_relocs): New function.
6487         (Output_section_incremental_inputs::write_info_blocks): Record
6488         whether a symbol is copied from a shared object.
6489         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
6490         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
6491         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
6492         (Incremental_input_entry_reader::get_output_symbol_index): Add
6493         is_copy parameter.
6494         (Incremental_binary::emit_copy_relocs): New function.
6495         (Incremental_binary::do_emit_copy_relocs): New function.
6496         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6497         new data member.
6498         (Sized_incremental_binary::add_copy_reloc): New function.
6499         (Sized_incremental_binary::do_emit_copy_relocs): New function.
6500         (Sized_incremental_binary::Copy_reloc): New struct.
6501         (Sized_incremental_binary::Copy_relocs): New typedef.
6502         (Sized_incremental_binary::copy_relocs_): New data member.
6503         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
6504         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
6505         * target.h (Sized_target::emit_copy_reloc): New function.
6506         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
6507
6508 2011-06-02  Cary Coutant  <ccoutant@google.com>
6509
6510         PR gold/12163
6511         * gold/archive.cc (Archive::Archive): Initialize new data member.
6512         (Archive::include_all_members): Return if archive has already been
6513         included.
6514         * gold/archive.h (Archive::include_all_members_): New data member.
6515
6516 2011-06-02  Nick Clifton  <nickc@redhat.com>
6517
6518         * dynobj.h: Fix spelling mistake in comment.
6519         * output.cc: Likewise.
6520
6521 2011-05-31  Doug Kwan  <dougkwan@google.com>
6522             Asier Llano
6523
6524         PR gold/12826
6525         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
6526         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
6527         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
6528         redundant arm_exidx_test.so.
6529         * testsuite/Makefile.in: Regenerate.
6530         (check_SCRIPTS): Add pr12826.sh
6531         (check_DATA): Add pr12826.stdout
6532         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
6533         * testsuite/pr12826.sh: New file.
6534         * testsuite/pr12826_1.s: Ditto.
6535         * testsuite/pr12826_1.s: Ditto.
6536
6537 2011-05-30  Ian Lance Taylor  <iant@google.com>
6538
6539         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
6540         sections.
6541
6542 2011-05-29  Ian Lance Taylor  <iant@google.com>
6543
6544         PR gold/12804
6545         * testsuite/Makefile.am: Use different file name for two_file_test
6546         temporary file for each incremental test.
6547         * testsuite/Makefile.in: Rebuild.
6548
6549 2011-05-29  Ian Lance Taylor  <iant@google.com>
6550
6551         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
6552         binary input file is empty.
6553
6554 2011-05-27  Ian Lance Taylor  <iant@google.com>
6555
6556         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
6557         (ver_test_9.so): Likewise.
6558         * testsuite/Makefile.in: Rebuild.
6559
6560 2011-05-26 Cary Coutant  <ccoutant@google.com>
6561
6562         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
6563         * incremental.cc (Incremental_inputs::report_input_section): Fix
6564         comment, indentation.
6565         (Incremental_inputs::report_comdat_group): New function.
6566         (Output_section_incremental_inputs::set_final_data_size): Adjust size
6567         of data for incremental input file entry.
6568         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
6569         group count, COMDAT group signatures.
6570         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
6571         an unchanged input file.
6572         * incremental.h (Incremental_object_entry::Incremental_object_entry):
6573         Initialize new data member.
6574         (Incremental_object_entry::add_comdat_group): New function.
6575         (Incremental_object_entry::get_comdat_group_count): New function.
6576         (Incremental_object_entry::get_comdat_signature_key): New function.
6577         (Incremental_object_entry::groups_): New data member.
6578         (Incremental_inputs::report_comdat_group): New function.
6579         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
6580         data for incremental input file entry.
6581         (Incremental_input_entry_reader::get_comdat_group_count): New function.
6582         (Incremental_input_entry_reader::get_input_section): Adjust size of
6583         data for incremental input file entry.
6584         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
6585         (Incremental_input_entry_reader::get_comdat_group_signature): New
6586         function.
6587         * object.cc (Sized_relobj::include_section_group): Report kept
6588         COMDAT groups for incremental links.
6589
6590 2011-05-24  David Meyer  <pdox@google.com>
6591
6592         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
6593         with name parameter.  Add found_name parameter.
6594         * fileread.cc (Input_file::find_file): Adjust code accordingly.
6595         * dirsearch.h (class Dirsearch): Update declaration.
6596
6597 2011-05-24  Ian Lance Taylor  <iant@google.com>
6598
6599         * archive.cc (Library_base::should_include_member): Pull in object
6600         from archive if it defines the entry symbol.
6601         * parameters.cc (Parameters::entry): New function.
6602         * parameters.h (class Parameters): Declare entry.
6603         * output.h (class Output_file_header): Remove entry_ field.
6604         * output.cc (Output_file_header::Output_file_header): Remove entry
6605         parameter.  Change all callers.
6606         (Output_file_header::entry): Use parameters->entry.
6607         * gold.cc (queue_middle_tasks): Likewise.
6608         * plugin.cc (Plugin_hook::run): Likewise.
6609
6610 2011-05-24 Cary Coutant  <ccoutant@google.com>
6611
6612         * gold.cc (queue_initial_tasks): Pass incremental base filename
6613         to Output_file::open_base_file; don't print error message.
6614         * incremental-dump.cc (main): Adjust call to
6615         Output_file::open_for_modification.
6616         * incremental-dump.cc (main): Likewise.
6617         * incremental.cc (Incremental_inputs::report_command_line):
6618         Ignore --incremental-base option when comparing command lines.
6619         Ignore parameter when given as separate argument.
6620         * options.h (class General_options): Add --incremental-base.
6621         * output.cc (Output_file::Output_file):
6622         (Output_file::open_base_file): Add base_name and writable parameters;
6623         read base file into new file; print error message here.
6624         (Output_file::map_no_anonymous): Add writable parameter; adjust all
6625         callers.
6626         * output.h (Output_file::open_for_modification): Rename to...
6627         (Output_file::open_base_file): ...this; add base_name and
6628         writable parameters; adjust all callers.
6629         (Output_file::map_no_anonymous): Add writable parameter; adjust all
6630         callers.
6631         * testsuite/Makefile.am (incremental_test_4): Test
6632         --incremental-base.
6633         * testsuite/Makefile.in: Regenerate.
6634
6635 2011-05-24 Cary Coutant  <ccoutant@google.com>
6636
6637         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
6638         incremental_test_4.
6639         * testsuite/Makefile.in: Regenerate.
6640         * testsuite/two_file_test_1_v1.cc: New test source file.
6641         * testsuite/two_file_test_1b_v1.cc: New test source file.
6642         * testsuite/two_file_test_2_v1.cc: New test source file.
6643
6644 2011-05-24 Cary Coutant  <ccoutant@google.com>
6645
6646         * dynobj.h (Dynobj::do_dynobj): New function.
6647         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
6648         flag and soname for shared objects.
6649         * incremental.cc (Incremental_inputs::report_object): Make
6650         either Incremental_object_entry or Incremental_dynobj_entry; add
6651         soname to string table.
6652         (Incremental_inputs::report_input_section): Add assertion.
6653         (Output_section_incremental_inputs::set_final_data_size): Adjust
6654         type of input file entry for shared libraries; adjust size of
6655         shared library info entry.
6656         (Output_section_incremental_inputs::write_input_files): Write
6657         as_needed flag for shared libraries.
6658         (Output_section_incremental_inputs::write_info_blocks): Adjust type
6659         of input file entry for shared libraries; write soname.
6660         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
6661         soname from incremental info.
6662         * incremental.h (enum Incremental_input_flags): Add
6663         INCREMENTAL_INPUT_AS_NEEDED.
6664         (Incremental_input_entry::Incremental_input_entry): Initialize new
6665         data member.
6666         (Incremental_input_entry::set_as_needed): New function.
6667         (Incremental_input_entry::as_needed): New function.
6668         (Incremental_input_entry::do_dynobj_entry): New function.
6669         (Incremental_input_entry::as_needed_): New data member.
6670         (Incremental_object_entry::Incremental_object_entry): Don't check
6671         for shared library.
6672         (Incremental_object_entry::do_type): Likewise.
6673         (class Incremental_dynobj_entry): New class.
6674         (Incremental_input_entry_reader::as_needed): New function.
6675         (Incremental_input_entry_reader::get_soname): New function.
6676         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
6677         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
6678         size of shared library info entry.
6679         * layout.cc (Layout::finish_dynamic_section): Don't test for
6680         incremental link when adding DT_NEEDED entries.
6681         * object.h (Object::Object): Initialize new data member.
6682         (Object::dynobj): New function.
6683         (Object::set_as_needed): New function.
6684         (Object::as_needed): New function.
6685         (Object::do_dynobj): New function.
6686         (Object::as_needed_): New data member.
6687
6688 2011-05-24 Cary Coutant  <ccoutant@google.com>
6689
6690         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
6691         info; adjust display of GOT entries.
6692         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6693         vector of input objects; remove file_status_.
6694         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
6695         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
6696         got_plt reader; call target hooks to reserve GOT entries.
6697         (Output_section_incremental_inputs::set_final_data_size): Adjust size
6698         of input file info header and GOT info entry.
6699         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
6700         relocation info.
6701         (Got_plt_view_info::got_descriptor): Remove.
6702         (Got_plt_view_info::sym_index): New data member.
6703         (Got_plt_view_info::input_index): New data member.
6704         (Local_got_offset_visitor::visit): Write input file index.
6705         (Global_got_offset_visitor::visit): Write 0 for input file index.
6706         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
6707         with sym_index and input_index.
6708         (Output_section_incremental_inputs::write_got_plt): Adjust size of
6709         incremental info GOT entry; replace got_descriptor with input_index.
6710         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
6711         map from input file index to object.
6712         (Sized_relobj_incr::do_layout): Replace direct data member reference
6713         with accessor function.
6714         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
6715         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
6716         Adjust size of input file info header.
6717         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
6718         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
6719         (Incremental_input_entry_reader::get_input_section): Adjust size of
6720         input file info header.
6721         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
6722         of incremental info GOT entry.
6723         (Incremental_got_plt_reader::get_got_desc): Remove.
6724         (Incremental_got_plt_reader::get_got_symndx): New function.
6725         (Incremental_got_plt_reader::get_got_input_index): New function.
6726         (Sized_incremental_binary::Sized_incremental_binary): Remove
6727         file_status_; add input_objects_.
6728         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
6729         (Sized_incremental_binary::set_file_is_unchanged): Remove.
6730         (Sized_incremental_binary::file_is_unchanged): Remove.
6731         (Sized_incremental_binary::set_input_object): New function.
6732         (Sized_incremental_binary::input_object): New function.
6733         (Sized_incremental_binary::file_status_): Remove.
6734         (Sized_incremental_binary::input_objects_): New data member.
6735         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
6736         references.
6737         (Sized_relobj_incr::invalid_address): Move to base class.
6738         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
6739         class.
6740         (Sized_relobj_incr::do_output_section_offset): Likewise.
6741         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
6742         (Sized_relobj_incr::section_offsets_): Likewise.
6743         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
6744         function.
6745         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
6746         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
6747         with accessor function.
6748         (Sized_relobj_file::do_layout): Likewise.
6749         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
6750         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
6751         (Sized_relobj_file::compute_final_local_value): Replace refs to
6752         section_offsets_ with accessor function.
6753         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
6754         * object.h (Relobj::Relobj): Initialize new data members.
6755         (Relobj::add_dyn_reloc): New function.
6756         (Relobj::first_dyn_reloc): New function.
6757         (Relobj::dyn_reloc_count): New function.
6758         (Relobj::first_dyn_reloc_): New data member.
6759         (Relobj::dyn_reloc_count_): New data member.
6760         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
6761         references.
6762         (Sized_relobj::Address): New typedef.
6763         (Sized_relobj::invalid_address): Move here from child class.
6764         (Sized_relobj::Sized_relobj): Initialize new data members.
6765         (Sized_relobj::sized_relobj): New function.
6766         (Sized_relobj::is_output_section_offset_invalid): Move here from
6767         child class.
6768         (Sized_relobj::get_output_section_offset): Likewise.
6769         (Sized_relobj::local_has_got_offset): Likewise.
6770         (Sized_relobj::local_got_offset): Likewise.
6771         (Sized_relobj::set_local_got_offset): Likewise.
6772         (Sized_relobj::do_for_all_local_got_entries): Likewise.
6773         (Sized_relobj::clear_got_offsets): New function.
6774         (Sized_relobj::section_offsets): Move here from child class.
6775         (Sized_relobj::do_output_section_offset): Likewise.
6776         (Sized_relobj::do_set_section_offset): Likewise.
6777         (Sized_relobj::Local_got_offsets): Likewise.
6778         (Sized_relobj::local_got_offsets_): Likewise.
6779         (Sized_relobj::section_offsets_): Likewise.
6780         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
6781         references.
6782         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
6783         class.
6784         (Sized_relobj_file::sized_relobj): New function
6785         (Sized_relobj_file::local_has_got_offset): Move to base class.
6786         (Sized_relobj_file::local_got_offset): Likewise.
6787         (Sized_relobj_file::set_local_got_offset): Likewise.
6788         (Sized_relobj_file::get_output_section_offset): Likewise.
6789         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
6790         (Sized_relobj_file::do_output_section_offset): Likewise.
6791         (Sized_relobj_file::do_set_section_offset): Likewise.
6792         (Sized_relobj_file::Local_got_offsets): Likewise.
6793         (Sized_relobj_file::local_got_offsets_): Likewise.
6794         (Sized_relobj_file::section_offsets_): Likewise.
6795         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
6796         (all constructors).
6797         (set_needs_dynsym_index): Convert relobj to derived class pointer.
6798         (Output_reloc::get_symbol_index): Likewise.
6799         (Output_reloc::local_section_offset): Likewise.
6800         (Output_reloc::get_address): Likewise.
6801         (Output_reloc::symbol_value): Likewise.
6802         (Output_data_got::reserve_slot): Move to class definition.
6803         (Output_data_got::reserve_local): New function.
6804         (Output_data_got::reserve_slot_for_global): Remove.
6805         (Output_data_got::reserve_global): New function.
6806         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
6807         (all constructors, two instantiations).
6808         (Output_reloc::get_relobj): New function (two instantiations).
6809         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
6810         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
6811         (Output_data_reloc::add_global): Adjust type of relobj.
6812         (Output_data_reloc::add_global_relative): Likewise.
6813         (Output_data_reloc::add_symbolless_global_addend): Likewise.
6814         (Output_data_reloc::add_local): Likewise.
6815         (Output_data_reloc::add_local_relative): Likewise.
6816         (Output_data_reloc::add_symbolless_local_addend): Likewise.
6817         (Output_data_reloc::add_local_section): Likewise.
6818         (Output_data_reloc::add_output_section): Likewise.
6819         (Output_data_reloc::add_absolute): Likewise.
6820         (Output_data_reloc::add_target_specific): Likewise.
6821         (Output_data_got::reserve_slot): Move definition here.
6822         (Output_data_got::reserve_local): New function.
6823         (Output_data_got::reserve_global): New function.
6824         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
6825         section_offsets_ with accessor function.
6826         (Sized_relobj_file::write_sections): Likewise.
6827         (Sized_relobj_file::do_relocate_sections): Likewise.
6828         * target.h (Sized_target::reserve_local_got_entry): New function.
6829         (Sized_target::reserve_global_got_entry): New function.
6830         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
6831         (Target_x86_64::reserve_global_got_entry): New function.
6832         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
6833
6834 2011-05-23 Cary Coutant  <ccoutant@google.com>
6835
6836         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
6837         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
6838         bit when checking got_type.
6839         * incremental.cc (Sized_incremental_binary::setup_readers):
6840         Store symbol table and string table locations; initialize bit vector
6841         of file status flags.
6842         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
6843         unchanged files.
6844         (Sized_incremental_binary::do_process_got_plt): New function.
6845         (Sized_incremental_binary::get_symtab_view): Use stored locations.
6846         (Output_section_incremental_inputs::set_final_data_size): Record
6847         file index for each input file.
6848         (Output_section_incremental_inputs::write_got_plt): Store file index
6849         instead of input entry offset for each GOT entry.
6850         * incremental.h
6851         (Incremental_input_entry::Incremental_input_entry): Initialize new
6852         data member.
6853         (Incremental_input_entry::set_offset): Store file index.
6854         (Incremental_input_entry::get_file_index): New function.
6855         (Incremental_input_entry::file_index_): New data member.
6856         (Incremental_binary::process_got_plt): New function.
6857         (Incremental_binary::do_process_got_plt): New function.
6858         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6859         data members.
6860         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
6861         (Sized_incremental_binary::set_file_is_unchanged): New function.
6862         (Sized_incremental_binary::file_is_unchanged): New function.
6863         (Sized_incremental_binary::do_process_got_plt): New function.
6864         (Sized_incremental_binary::file_status_): New data member.
6865         (Sized_incremental_binary::main_symtab_loc_): New data member.
6866         (Sized_incremental_binary::main_strtab_loc_): New data member.
6867         * output.cc (Output_data_got::Got_entry::write): Add case
6868         RESERVED_CODE.
6869         (Output_data_got::add_global): Call add_got_entry.
6870         (Output_data_got::add_global_plt): Likewise.
6871         (Output_data_got::add_global_with_rel): Likewise.
6872         (Output_data_got::add_global_with_rela): Likewise.
6873         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
6874         (Output_data_got::add_global_pair_with_rela): Likewise.
6875         (Output_data_got::add_local): Call add_got_entry.
6876         (Output_data_got::add_local_plt): Likewise.
6877         (Output_data_got::add_local_with_rel): Likewise.
6878         (Output_data_got::add_local_with_rela): Likewise.
6879         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
6880         (Output_data_got::add_local_pair_with_rela): Likewise.
6881         (Output_data_got::reserve_slot): New function.
6882         (Output_data_got::reserve_slot_for_global): New function.
6883         (Output_data_got::add_got_entry): New function.
6884         (Output_data_got::add_got_entry_pair): New function.
6885         (Output_section::add_output_section_data): Edit FIXME.
6886         * output.h
6887         (Output_section_data_build::Output_section_data_build): New
6888         constructor with size parameter.
6889         (Output_data_space::Output_data_space): Likewise.
6890         (Output_data_got::Output_data_got): Initialize new data member; new
6891         constructor with size parameter.
6892         (Output_data_got::add_constant): Call add_got_entry.
6893         (Output_data_got::reserve_slot): New function.
6894         (Output_data_got::reserve_slot_for_global): New function.
6895         (class Output_data_got::Got_entry): Add RESERVED_CODE.
6896         (Output_data_got::add_got_entry): New function.
6897         (Output_data_got::add_got_entry_pair): New function.
6898         (Output_data_got::free_list_): New data member.
6899         * target.h (Sized_target::init_got_plt_for_update): New function.
6900         (Sized_target::register_global_plt_entry): New function.
6901         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
6902         Initialize new data member; call init; add constructor with PLT count.
6903         (Output_data_plt_x86_64::init): New function.
6904         (Output_data_plt_x86_64::add_relocation): New function.
6905         (Output_data_plt_x86_64::reserve_slot): New function.
6906         (Output_data_plt_x86_64::free_list_): New data member.
6907         (Target_x86_64::init_got_plt_for_update): New function.
6908         (Target_x86_64::register_global_plt_entry): New function.
6909         (Output_data_plt_x86_64::add_entry): Allocate from free list for
6910         incremental updates.
6911         (Output_data_plt_x86_64::add_relocation): New function.
6912         * testsuite/object_unittest.cc (Object_test): Set default options.
6913
6914 2011-05-16  Ian Lance Taylor  <iant@google.com>
6915
6916         * options.h (class General_options): Make -i a synonym for -r.
6917
6918 2011-05-16  Ian Lance Taylor  <iant@google.com>
6919
6920         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
6921
6922 2011-05-10 Cary Coutant  <ccoutant@google.com>
6923
6924         * object.cc (Sized_relobj::do_count_local_symbols): Check for
6925         strip_all (-s).
6926
6927 2011-05-06  Ian Lance Taylor  <iant@google.com>
6928
6929         * layout.cc (Layout::layout): If the output section flags change,
6930         update the ordering.
6931
6932 2011-04-25 Cary Coutant  <ccoutant@google.com>
6933
6934         * incremental-dump.cc (dump_incremental_inputs): Print local
6935         symbol info for each input file.
6936         * incremental.cc
6937         (Output_section_incremental_inputs::set_final_data_size): Add local
6938         symbol info to input file entries in incremental info.
6939         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6940         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
6941         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
6942         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
6943         implementation.
6944         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
6945         (Sized_incr_relobj::do_relocate): Write the local symbols.
6946         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
6947         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
6948         Adjust size of input file header.
6949         (Incremental_inputs_reader::get_local_symbol_offset): New function.
6950         (Incremental_inputs_reader::get_local_symbol_count): New function.
6951         (Incremental_inputs_reader::get_input_section): Adjust size of input
6952         file header.
6953         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
6954         (Sized_incr_relobj::This): New typedef.
6955         (Sized_incr_relobj::sym_size): New const data member.
6956         (Sized_incr_relobj::Local_symbol): New struct.
6957         (Sized_incr_relobj::do_output_local_symbol_count): New function.
6958         (Sized_incr_relobj::do_local_symbol_offset): New function.
6959         (Sized_incr_relobj::local_symbol_count_): New data member.
6960         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
6961         (Sized_incr_relobj::local_symbol_index_): New data member.
6962         (Sized_incr_relobj::local_symbol_offset_): New data member.
6963         (Sized_incr_relobj::local_dynsym_offset_): New data member.
6964         (Sized_incr_relobj::local_symbols_): New data member.
6965         * object.h (Relobj::output_local_symbol_count): New function.
6966         (Relobj::local_symbol_offset): New function.
6967         (Relobj::do_output_local_symbol_count): New function.
6968         (Relobj::do_local_symbol_offset): New function.
6969         (Sized_relobj::do_output_local_symbol_count): New function.
6970         (Sized_relobj::do_local_symbol_offset): New function.
6971
6972 2011-04-22  Vladimir Simonov  <sv@sw.ru>
6973
6974         * descriptors.cc (set_close_on_exec): New function.
6975         (Descriptors::open): Use set_close_on_exec.
6976         * output.cc (S_ISLNK): Define if not defined.
6977
6978 2011-04-22 Cary Coutant  <ccoutant@google.com>
6979
6980         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6981         global symbol map.
6982         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6983         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
6984         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
6985         relocations.
6986         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
6987         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
6988         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
6989         * incremental.h
6990         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
6991         function.
6992         (Incremental_binary::apply_incremental_relocs): New function.
6993         (Incremental_binary::do_apply_incremental_relocs): New function.
6994         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6995         data member.
6996         (Sized_incremental_binary::add_global_symbol): New function.
6997         (Sized_incremental_binary::global_symbol): New function.
6998         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6999         (Sized_incremental_binary::symbol_map_): New data member.
7000         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
7001         * target.h (Sized_target::apply_relocation): New function.
7002         * target-reloc.h (apply_relocation): New function.
7003         * x86_64.cc (Target_x86_64::apply_relocation): New function.
7004
7005 2011-04-22  Doug Kwan  <dougkwan@google.com>
7006
7007         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
7008         flag of a SHT_ARM_EXIDX section.
7009         * testsuite/Makefile.am (arm_exidx_test): New test rules.
7010         * testsuite/Makefile.in: Regenerate.
7011         * testsuite/arm_exidx_test.s: New file.
7012         * testsuite/arm_exidx_test.sh: Same.
7013
7014 2011-04-20 Cary Coutant  <ccoutant@google.com>
7015
7016         PR gold/12689
7017         * archive.h (Incremental_archive_entry::Archive_member):
7018         Initialize arg_serial_ (second constructor).
7019
7020 2011-04-17  Ian Lance Taylor  <iant@google.com>
7021
7022         * object.cc (Relocate_info::location): Simplify location string.
7023         * errors.cc (Errors::error_at_location): Don't print program
7024         name.
7025         (Errors::warning_at_location): Likewise.
7026         (Errors::undefined_symbol): Likewise.
7027         * testsuite/debug_msg.sh: Update accordingly.
7028
7029 2011-04-14 Cary Coutant  <ccoutant@google.com>
7030
7031         * gold/layout.cc (Layout::symtab_section_offset): New function.
7032         * gold/layout.h (Layout::symtab_section_offset): New function.
7033         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
7034
7035 2011-04-12  Ian Lance Taylor  <iant@google.com>
7036
7037         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
7038         with MREMAP_MAYMOVE.
7039         * output.h (class Output_file): Add map_is_allocated_ field.
7040         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
7041         not available, provide stubs.  If mremap is not available, #define
7042         it to gold_mremap.
7043         (MREMAP_MAYMOVE): Define if not defined.
7044         (Output_file::Output_file): Initialize map_is_allocated_.
7045         (Output_file::resize): Check map_is_allocated_.
7046         (Output_file::map_anonymous): If mmap fails, use malloc.
7047         (Output_file::unmap): Don't do anything for an anonymous map.
7048         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
7049         is not available, provide stubs.
7050         (File_read::View::~View): Use free rather than delete[].
7051         (File_read::make_view): Use malloc rather than new[].  If mmap
7052         fails, use malloc.
7053         (File_read::find_or_make_view): Use malloc rather than new[].
7054         * gold.h: Remove HAVE_REMAP code.
7055         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
7056         exists.  Rename mremap to gold_mremap.  If mmap is not available
7057         don't do anything.
7058         * configure, config.in: Rebuild.
7059
7060 2011-04-11  Ian Lance Taylor  <iant@google.com>
7061
7062         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
7063         initialize local variable v.
7064
7065 2011-04-11  Cary Coutant  <ccoutant@google.com>
7066
7067         * archive.cc (Archive::include_member): Adjust call to
7068         report_object.
7069         (Add_archive_symbols::run): Track argument serial numbers.
7070         (Lib_group::include_member): Likewise.
7071         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
7072         * archive.h (Incremental_archive_entry::Archive_member):
7073         Initialize arg_serial_.
7074         (Archive_member::arg_serial_): New data member.
7075         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
7076         (Sized_dynobj::do_add_symbols): Track symbols when doing an
7077         incremental link.
7078         (Sized_dynobj::do_for_all_local_got_entries): New function.
7079         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
7080         function.
7081         * fileread.cc (get_mtime): New function.
7082         * fileread.h (get_mtime): New function.
7083         * gold.cc (queue_initial_tasks): Check for incremental update.
7084         (process_incremental_input): New function.
7085         (queue_middle_tasks): Don't force valid target for incremental
7086         update.
7087         * incremental-dump.cc (find_input_containing_global): Adjust
7088         size of symbol info entry.
7089         (dump_incremental_inputs): Dump argument serial number and
7090         in_system_directory flag; bias shndx by 1; print symbol names
7091         when dumping per-file symbol lists; use new symbol info readers.
7092         * incremental.cc
7093         (Output_section_incremental_inputs:update_data_size): New function.
7094         (Sized_incremental_binary::setup_readers): Setup input readers
7095         for each input file; build maps for files added from libraries
7096         and scripts.
7097         (Sized_incremental_binary::check_input_args): New function.
7098         (Sized_incremental_binary::do_check_inputs): Build map of argument
7099         serial numbers to input arguments.
7100         (Sized_incremental_binary::do_file_has_changed): Rename
7101         do_file_is_unchanged to this; compare file modification times.
7102         (Sized_incremental_binary::do_init_layout): New function.
7103         (Sized_incremental_binary::do_reserve_layout): New function.
7104         (Sized_incremental_binary::do_get_input_reader): Remove.
7105         (Sized_incremental_binary::get_symtab_view): New function.
7106         (Incremental_checker::can_incrementally_link_output_file): Remove.
7107         (Incremental_inputs::report_command_line): Exclude --debug options.
7108         (Incremental_inputs::report_archive_begin): Add parameter; track
7109         argument serial numbers; don't put input file entry for archive
7110         before archive members.
7111         (Incremental_inputs::report_archive_end): Put input file entry
7112         for archive after archive members.
7113         (Incremental_inputs::report_object): Add parameter; track argument
7114         serial numbers and in_system_directory flag.
7115         (Incremental_inputs::report_script): Add parameter; track argument
7116         serial numbers.
7117         (Output_section_incremental_inputs::set_final_data_size): Adjust
7118         size of symbol info entry; check for forwarding symbols.
7119         (Output_section_incremental_inputs::write_input_files): Write
7120         in_system_directory flag and argument serial number.
7121         (Output_section_incremental_inputs::write_info_blocks): Map section
7122         indices between incremental info and original input file; store
7123         input section index for each symbol.
7124         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
7125         change operator() to visit().
7126         (class Global_got_offset_visitor): Likewise.
7127         (class Global_symbol_visitor_got_plt):
7128         (Output_section_incremental_inputs::write_got_plt): Use new visitor
7129         classes.
7130         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
7131         (Sized_incr_relobj::do_read_symbols): New function.
7132         (Sized_incr_relobj::do_layout): New function.
7133         (Sized_incr_relobj::do_layout_deferred_sections): New function.
7134         (Sized_incr_relobj::do_add_symbols): New function.
7135         (Sized_incr_relobj::do_should_include_member): New function.
7136         (Sized_incr_relobj::do_for_all_global_symbols): New function.
7137         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
7138         (Sized_incr_relobj::do_section_size): New function.
7139         (Sized_incr_relobj::do_section_name): New function.
7140         (Sized_incr_relobj::do_section_contents): New function.
7141         (Sized_incr_relobj::do_section_flags): New function.
7142         (Sized_incr_relobj::do_section_entsize): New function.
7143         (Sized_incr_relobj::do_section_address): New function.
7144         (Sized_incr_relobj::do_section_type): New function.
7145         (Sized_incr_relobj::do_section_link): New function.
7146         (Sized_incr_relobj::do_section_info): New function.
7147         (Sized_incr_relobj::do_section_addralign): New function.
7148         (Sized_incr_relobj::do_initialize_xindex): New function.
7149         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
7150         (Sized_incr_relobj::do_read_relocs): New function.
7151         (Sized_incr_relobj::do_gc_process_relocs): New function.
7152         (Sized_incr_relobj::do_scan_relocs): New function.
7153         (Sized_incr_relobj::do_count_local_symbols): New function.
7154         (Sized_incr_relobj::do_finalize_local_symbols): New function.
7155         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
7156         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
7157         (Sized_incr_relobj::do_relocate): New function.
7158         (Sized_incr_relobj::do_set_section_offset): New function.
7159         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
7160         (Sized_incr_dynobj::do_read_symbols): New function.
7161         (Sized_incr_dynobj::do_layout): New function.
7162         (Sized_incr_dynobj::do_add_symbols): New function.
7163         (Sized_incr_dynobj::do_should_include_member): New function.
7164         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
7165         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
7166         (Sized_incr_dynobj::do_section_size): New function.
7167         (Sized_incr_dynobj::do_section_name): New function.
7168         (Sized_incr_dynobj::do_section_contents): New function.
7169         (Sized_incr_dynobj::do_section_flags): New function.
7170         (Sized_incr_dynobj::do_section_entsize): New function.
7171         (Sized_incr_dynobj::do_section_address): New function.
7172         (Sized_incr_dynobj::do_section_type): New function.
7173         (Sized_incr_dynobj::do_section_link): New function.
7174         (Sized_incr_dynobj::do_section_info): New function.
7175         (Sized_incr_dynobj::do_section_addralign): New function.
7176         (Sized_incr_dynobj::do_initialize_xindex): New function.
7177         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
7178         (make_sized_incremental_object): New function.
7179         (Incremental_library::copy_unused_symbols): New function.
7180         (Incremental_library::do_for_all_unused_symbols): New function.
7181         * incremental.h (enum Incremental_input_flags): New type.
7182         (class Incremental_checker): Remove.
7183         (Incremental_input_entry::Incremental_input_entry): Add argument
7184         serial number.
7185         (Incremental_input_entry::arg_serial): New function.
7186         (Incremental_input_entry::set_is_in_system_directory): New function.
7187         (Incremental_input_entry::is_in_system_directory): New function.
7188         (Incremental_input_entry::arg_serial_): New data member.
7189         (Incremental_input_entry::is_in_system_directory_): New data member.
7190         (class Script_info): Move here from script.h.
7191         (Script_info::Script_info): Add filename parameter.
7192         (Script_info::filename): New function.
7193         (Script_info::filename_): New data member.
7194         (Incremental_script_entry::Incremental_script_entry): Add argument
7195         serial number.
7196         (Incremental_object_entry::Incremental_object_entry): Likewise.
7197         (Incremental_object_entry::add_input_section): Build list of input
7198         sections with map to original shndx.
7199         (Incremental_object_entry::get_input_section_index): New function.
7200         (Incremental_object_entry::shndx_): New data member.
7201         (Incremental_object_entry::name_key_): Rename; adjust all refs.
7202         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
7203         (Incremental_archive_entry::Incremental_archive_entry): Add argument
7204         serial number.
7205         (Incremental_inputs::report_archive_begin): Likewise.
7206         (Incremental_inputs::report_object): Likewise.
7207         (Incremental_inputs::report_script): Likewise.
7208         (class Incremental_global_symbol_reader): New class.
7209         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
7210         and store flags and input file type.
7211         (Incremental_input_entry_reader::arg_serial): New function.
7212         (Incremental_input_entry_reader::type): Extract type from flags.
7213         (Incremental_input_entry_reader::is_in_system_directory): New function.
7214         (Incremental_input_entry_reader::get_input_section_count): Call
7215         accessor function for type.
7216         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
7217         function for type; adjust size of global symbol entry.
7218         (Incremental_input_entry_reader::get_global_symbol_count): Call
7219         accessor function for type.
7220         (Incremental_input_entry_reader::get_object_count): Likewise.
7221         (Incremental_input_entry_reader::get_object_offset): Likewise.
7222         (Incremental_input_entry_reader::get_member_count): Likewise.
7223         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
7224         (Incremental_input_entry_reader::get_member_offset): Likewise.
7225         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
7226         (Incremental_input_entry_reader::Global_symbol_info): Remove.
7227         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
7228         (Incremental_input_entry_reader::get_global_symbol_reader): New
7229         function.
7230         (Incremental_input_entry_reader::get_output_symbol_index): New
7231         function.
7232         (Incremental_input_entry_reader::type_): Remove.
7233         (Incremental_input_entry_reader::flags_): New data member.
7234         (Incremental_inputs_reader::input_file_offset): New function.
7235         (Incremental_inputs_reader::input_file_index): New function.
7236         (Incremental_inputs_reader::input_file): Call input_file_offset.
7237         (Incremental_inputs_reader::input_file_at_offset): New function.
7238         (Incremental_relocs_reader::get_r_type): Reformat.
7239         (Incremental_relocs_reader::get_r_shndx): Reformat.
7240         (Incremental_relocs_reader::get_r_offset): Reformat.
7241         (Incremental_relocs_reader::data): New function.
7242         (Incremental_binary::Incremental_binary): Initialize new data members.
7243         (Incremental_binary::check_inputs): Add cmdline parameter.
7244         (Incremental_binary::file_is_unchanged): Remove.
7245         (Input_reader::arg_serial): New function.
7246         (Input_reader::get_unused_symbol_count): New function.
7247         (Input_reader::get_unused_symbol): New function.
7248         (Input_reader::do_arg_serial): New function.
7249         (Input_reader::do_get_unused_symbol_count): New function.
7250         (Input_reader::do_get_unused_symbol): New function.
7251         (Incremental_binary::input_file_count): New function.
7252         (Incremental_binary::get_input_reader): Change signature to use
7253         index instead of filename.
7254         (Incremental_binary::file_has_changed): New function.
7255         (Incremental_binary::get_input_argument): New function.
7256         (Incremental_binary::get_library): New function.
7257         (Incremental_binary::get_script_info): New function.
7258         (Incremental_binary::init_layout): New function.
7259         (Incremental_binary::reserve_layout): New function.
7260         (Incremental_binary::output_file): New function.
7261         (Incremental_binary::do_check_inputs): New function.
7262         (Incremental_binary::do_file_is_unchanged): Remove.
7263         (Incremental_binary::do_file_has_changed): New function.
7264         (Incremental_binary::do_init_layout): New function.
7265         (Incremental_binary::do_reserve_layout): New function.
7266         (Incremental_binary::do_input_file_count): New function.
7267         (Incremental_binary::do_get_input_reader): Change signature.
7268         (Incremental_binary::input_args_map_): New data member.
7269         (Incremental_binary::library_map_): New data member.
7270         (Incremental_binary::script_map_): New data member.
7271         (Sized_incremental_binary::Sized_incremental_binary): Initialize
7272         new data members.
7273         (Sized_incremental_binary::output_section): New function.
7274         (Sized_incremental_binary::inputs_reader): Add const.
7275         (Sized_incremental_binary::symtab_reader): Add const.
7276         (Sized_incremental_binary::relocs_reader): Add const.
7277         (Sized_incremental_binary::got_plt_reader): Add const.
7278         (Sized_incremental_binary::get_symtab_view): New function.
7279         (Sized_incremental_binary::Inputs_reader): New typedef.
7280         (Sized_incremental_binary::Input_entry_reader): New typedef.
7281         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
7282         (Sized_incremental_binary::do_file_is_unchanged): Remove.
7283         (Sized_incremental_binary::do_file_has_changed): New function.
7284         (Sized_incremental_binary::do_init_layout): New function.
7285         (Sized_incremental_binary::do_reserve_layout): New function.
7286         (Sized_input_reader::Inputs_reader): Remove.
7287         (Sized_input_reader::Input_entry_reader): Remove.
7288         (Sized_input_reader::do_arg_serial): New function.
7289         (Sized_input_reader::do_get_unused_symbol_count): New function.
7290         (Sized_input_reader::do_get_unused_symbol): New function.
7291         (Sized_incremental_binary::do_input_file_count): New function.
7292         (Sized_incremental_binary::do_get_input_reader): Change signature;
7293         use index instead of filename.
7294         (Sized_incremental_binary::section_map_): New data member.
7295         (Sized_incremental_binary::input_entry_readers_): New data member.
7296         (class Sized_incr_relobj): New class.
7297         (class Sized_incr_dynobj): New class.
7298         (make_sized_incremental_object): New function.
7299         (class Incremental_library): New class.
7300         * layout.cc (Free_list::num_lists): New static data member.
7301         (Free_list::num_nodes): New static data member.
7302         (Free_list::num_removes): New static data member.
7303         (Free_list::num_remove_visits): New static data member.
7304         (Free_list::num_allocates): New static data member.
7305         (Free_list::num_allocate_visits): New static data member.
7306         (Free_list::init): New function.
7307         (Free_list::remove): New function.
7308         (Free_list::allocate): New function.
7309         (Free_list::dump): New function.
7310         (Free_list::print_stats): New function.
7311         (Layout_task_runner::run): Resize output file for incremental updates.
7312         (Layout::Layout): Initialize new data members.
7313         (Layout::set_incremental_base): New function.
7314         (Layout::init_fixed_output_section): New function.
7315         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
7316         incremental updates.
7317         (Layout::create_gold_note): Do not create gold note section for
7318         incremental updates.
7319         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
7320         for incremental updates.
7321         (Layout::set_section_offsets): For incremental updates, allocate space
7322         from free list.
7323         (Layout::create_symtab_sections): Layout with offsets relative to
7324         start of section; for incremental updates, allocate space from free
7325         list.
7326         (Layout::create_shdrs): For incremental updates, allocate space from
7327         free list.
7328         (Layout::finish_dynamic_section): For incremental updates, do not
7329         check --as-needed (fixed in subsequent patch).
7330         * layout.h (class Free_list): New class.
7331         (Layout::set_incremental_base): New function.
7332         (Layout::incremental_base): New function.
7333         (Layout::init_fixed_output_section): New function.
7334         (Layout::allocate): New function.
7335         (Layout::incremental_base_): New data member.
7336         (Layout::free_list_): New data member.
7337         * main.cc (main): Print Free_list statistics.
7338         * object.cc (Relobj::finalize_incremental_relocs): Add
7339         clear_counts parameter; clear counts only when clear_counts is set.
7340         (Sized_relobj::Sized_relobj): Initialize new base class.
7341         (Sized_relobj::do_layout): Don't report special sections.
7342         (Sized_relobj::do_for_all_local_got_entries): New function.
7343         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
7344         symtab_off to all symbol table offsets.
7345         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
7346         * object.h (class Got_offset_list): Move to top of file.
7347         (Object::Object): Allow case where input_file == NULL.
7348         (Object::~Object): Likewise.
7349         (Object::input_file): Assert that input_file != NULL.
7350         (Object::lock): Allow case where input_file == NULL.
7351         (Object::unlock): Likewise.
7352         (Object::is_locked): Likewise.
7353         (Object::token): Likewise.
7354         (Object::release): Likewise.
7355         (Object::is_incremental): New function.
7356         (Object::get_mtime): New function.
7357         (Object::for_all_local_got_entries): New function.
7358         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
7359         (Object::set_is_in_system_directory): New function.
7360         (Object::is_in_system_directory): New function.
7361         (Object::do_is_incremental): New function.
7362         (Object::do_get_mtime): New function.
7363         (Object::do_for_all_local_got_entries): New function.
7364         (Object::is_in_system_directory_): New data member.
7365         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
7366         (class Sized_relobj_base): New class.
7367         (class Sized_relobj): Derive from Sized_relobj_base.
7368         (class Sized_relobj::Symbols): Redeclare from base class.
7369         (class Sized_relobj::local_got_offset_list): Remove.
7370         (class Sized_relobj::Output_sections): Redeclare from base class.
7371         (class Sized_relobj::do_for_all_local_got_entries): New function.
7372         (class Sized_relobj::write_local_symbols): Add offset parameter.
7373         (class Sized_relobj::local_symbol_offset_): Update comment.
7374         (class Sized_relobj::local_dynsym_offset_): Update comment.
7375         * options.cc (Input_arguments::add_file): Remove const.
7376         * options.h (Input_file_argument::Input_file_argument):
7377         Initialize arg_serial_ (all constructors).
7378         (Input_file_argument::set_arg_serial): New function.
7379         (Input_file_argument::arg_serial): New function.
7380         (Input_file_argument::arg_serial_): New data member.
7381         (Input_arguments::Input_arguments): Initialize file_count_.
7382         (Input_arguments::add_file): Remove const.
7383         (Input_arguments::number_of_input_files): New function.
7384         (Input_arguments::file_count_): New data member.
7385         (Command_line::number_of_input_files): Call
7386         Input_arguments::number_of_input_files.
7387         * output.cc (Output_segment_headers::Output_segment_headers):
7388         Set current size.
7389         (Output_section::Input_section::current_data_size): New function.
7390         (Output_section::Output_section): Initialize new data members.
7391         (Output_section::add_input_section): Don't do merge sections for
7392         an incremental link; allocate space from free list for an
7393         incremental update.
7394         (Output_section::add_output_section_data): Allocate space from
7395         free list for an incremental update.
7396         (Output_section::update_data_size): New function.
7397         (Output_section::set_fixed_layout): New function.
7398         (Output_section::reserve): New function.
7399         (Output_segment::set_section_addresses): Remove const.
7400         (Output_segment::set_section_list_addresses): Remove const; allocate
7401         space from free list for an incremental update.
7402         (Output_segment::set_offset): Adjust size of RELRO segment for an
7403         incremental update.
7404         * output.h (Output_data::current_data_size): Move here from
7405         child classes.
7406         (Output_data::pre_finalize_data_size): New function.
7407         (Output_data::update_data_size): New function.
7408         (Output_section_headers::update_data_size): new function.
7409         (Output_section_data_build::current_data_size): Move to Output_data.
7410         (Output_data_strtab::update_data_size): New function.
7411         (Output_section::current_data_size): Move to Output_data.
7412         (Output_section::set_fixed_layout): New function.
7413         (Output_section::has_fixed_layout): New function.
7414         (Output_section::reserve): New function.
7415         (Output_section::update_data_size): New function.
7416         (Output_section::has_fixed_layout_): New data member.
7417         (Output_section::free_list_): New data member.
7418         (Output_segment::set_section_addresses): Remove const.
7419         (Output_segment::set_section_list_addresses): Remove const.
7420         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
7421         New function.
7422         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
7423         New function.
7424         * readsyms.cc (Read_symbols::do_read_symbols): Add library
7425         parameter when calling Add_symbols constructor; store argument
7426         serial number for members of a lib group.
7427         (Add_symbols::locks): Allow case where token == NULL.
7428         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
7429         (Read_member::~Read_member): New function.
7430         (Read_member::is_runnable): New function.
7431         (Read_member::locks): New function.
7432         (Read_member::run): New function.
7433         (Check_script::~Check_script): New function.
7434         (Check_script::is_runnable): New function.
7435         (Check_script::locks): New function.
7436         (Check_script::run): New function.
7437         (Check_library::~Check_library): New function.
7438         (Check_library::is_runnable): New function.
7439         (Check_library::locks): New function.
7440         (Check_library::run): New function.
7441         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
7442         (Add_symbols::library_): New data member.
7443         (class Read_member): New class.
7444         (class Check_script): New class.
7445         (class Check_library): New class.
7446         * reloc.cc (Read_relocs::is_runnable): Allow case where
7447         token == NULL.
7448         (Read_relocs::locks): Likewise.
7449         (Scan_relocs::locks): Likewise.
7450         (Relocate_task::locks): Likewise.
7451         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
7452         to clear counters.
7453         (Sized_relobj::incremental_relocs_scan): Fix comment.
7454         (Sized_relobj::do_relocate): Pass output file offset to
7455         write_local_symbols.
7456         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
7457         from class declaration.
7458         * script.cc (read_input_script): Allocate Script_info; pass
7459         argument serial number to report_script.
7460         * script.h (class Script_info): Move to incremental.h.
7461         * symtab.cc (Symbol_table::add_from_incrobj): New function.
7462         * symtab.h (Symbol_table::add_from_incrobj): New function.
7463         (Symbol_table::set_file_offset): New function.
7464
7465 2011-04-05  Cary Coutant  <ccoutant@google.com>
7466
7467         * incremental-dump.cc (dump_incremental_inputs): Change signature
7468         to take a Sized_incremental_binary; change caller.  Use readers
7469         in Sized_incremental_binary.
7470         * incremental.cc
7471         (Sized_incremental_binary::find_incremental_inputs_sections):
7472         Rename do_find_incremental_inputs_sections to this.
7473         (Sized_incremental_binary::setup_readers): New function.
7474         (Sized_incremental_binary::do_check_inputs): Check
7475         has_incremental_info_ flag; move setup code to setup_readers;
7476         use input readers.
7477         (Sized_incremental_binary::do_file_is_unchanged): New function.
7478         (Sized_incremental_binary::do_get_input_reader): New function.
7479         * incremental.h (class Incremental_binary): Move to end of file.
7480         (Incremental_binary::file_is_unchanged): New function.
7481         (Incremental_binary::do_file_is_unchanged): New function.
7482         (Incremental_binary::Input_reader): New class.
7483         (Incremental_binary::get_input_reader): New function.
7484         (class Sized_incremental_binary): Move to end of file.
7485         (Sized_incremental_binary::Sized_incremental_binary): Setup the
7486         input section reader classes.
7487         (Sized_incremental_binary::has_incremental_info): New function.
7488         (Sized_incremental_binary::inputs_reader): New function.
7489         (Sized_incremental_binary::symtab_reader): New function.
7490         (Sized_incremental_binary::relocs_reader): New function.
7491         (Sized_incremental_binary::got_plt_reader): New function.
7492         (Sized_incremental_binary::do_file_is_unchanged): New function.
7493         (Sized_incremental_binary::Sized_input_reader): New class.
7494         (Sized_incremental_binary::get_input_reader): New function.
7495         (Sized_incremental_binary::find_incremental_inputs_sections):
7496         Rename do_find_incremental_inputs_sections to this.
7497         (Sized_incremental_binary::setup_readers): New function.
7498         (Sized_incremental_binary::has_incremental_info_): New data member.
7499         (Sized_incremental_binary::inputs_reader_): New data member.
7500         (Sized_incremental_binary::symtab_reader_): New data member.
7501         (Sized_incremental_binary::relocs_reader_): New data member.
7502         (Sized_incremental_binary::got_plt_reader_): New data member.
7503         (Sized_incremental_binary::current_input_file_): New data member.
7504
7505 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
7506
7507         PR gold/12640
7508         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
7509         violation.
7510
7511 2011-03-30  Cary Coutant  <ccoutant@google.com>
7512
7513         * archive.cc (Archive::include_member): Adjust call to report_object.
7514         (Add_archive_symbols::run): Add script_info to call to
7515         report_archive_begin.
7516         (Lib_group::include_member): Adjust call to report_object.
7517         (Add_lib_group_symbols::run): Adjust call to report_object.
7518         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
7519         blocks.  Add object count for script input files.
7520         * incremental.cc (Incremental_inputs::report_archive_begin): Add
7521         script_info parameter; change all callers.
7522         (Incremental_inputs::report_object): Add script_info parameter;
7523         change all callers.
7524         (Incremental_inputs::report_script): Store backpointer to
7525         incremental info entry.
7526         (Output_section_incremental_inputs::set_final_data_size): Record
7527         additional information for scripts.
7528         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7529         * incremental.h (Incremental_script_entry::add_object): New function.
7530         (Incremental_script_entry::get_object_count): New function.
7531         (Incremental_script_entry::get_object): New function.
7532         (Incremental_script_entry::objects_): New data member; adjust
7533         constructor.
7534         (Incremental_inputs::report_archive_begin): Add script_info parameter.
7535         (Incremental_inputs::report_object): Add script_info parameter.
7536         (Incremental_inputs_reader::get_object_count): New function.
7537         (Incremental_inputs_reader::get_object_offset): New function.
7538         * options.cc (Input_arguments::add_file): Return reference to
7539         new input argument.
7540         * options.h (Input_argument::set_script_info): New function.
7541         (Input_argument::script_info): New function.
7542         (Input_argument::script_info_): New data member; adjust all
7543         constructors.
7544         (Input_file_group::add_file): Return reference to new input argument.
7545         (Input_file_lib::add_file): Likewise.
7546         (Input_arguments::add_file): Likewise.
7547         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
7548         * script.cc (Parser_closure::Parser_closure): Add script_info
7549         parameter; adjust all callers.
7550         (Parser_closure::script_info): New function.
7551         (Parser_closure::script_info_): New data member.
7552         (read_input_script): Report scripts earlier to incremental info.
7553         (script_add_file): Set script_info in Input_argument.
7554         (script_add_library): Likewise.
7555         * script.h (Script_options::Script_info): Rewrite class.
7556
7557 2011-03-29  Cary Coutant  <ccoutant@google.com>
7558
7559         * archive.cc (Library_base::should_include_member): Move
7560         method here from class Archive.
7561         (Archive::Archive): Initialize base class.
7562         (Archive::should_include_member): Move to base class.
7563         (Archive::do_for_all_unused_symbols): New function.
7564         (Add_archive_symbols::run): Remove redundant access to
7565         incremental_inputs.
7566         (Lib_group::Lib_group): Initialize base class.
7567         (Lib_group::do_filename): New function.
7568         (Lib_group::include_member): Pass pointer to Lib_group to
7569         report_object.
7570         (Lib_group::do_for_all_unused_symbols): New function.
7571         (Add_lib_group_symbols::run): Report archive information for
7572         incremental links.
7573         * archive.h (class Library_base): New base class.
7574         (class Archive): Derive from Library_base.
7575         (Archive::filename): Move to base class.
7576         (Archive::set_incremental_info): Likewise.
7577         (Archive::incremental_info): Likewise.
7578         (Archive::Should_include): Likewise.
7579         (Archive::should_include_member): Likewise.
7580         (Archive::Armap_entry): Remove.
7581         (Archive::Unused_symbol_iterator): Remove.
7582         (Archive::unused_symbols_begin): Remove.
7583         (Archive::unused_symbols_end): Remove.
7584         (Archive::do_filename): New function.
7585         (Archive::do_get_mtime): New function.
7586         (Archive::do_for_all_unused_symbols): New function.
7587         (Archive::task_): Move to base class.
7588         (Archive::incremental_info_): Likewise.
7589         (class Lib_group): Derive from Library_base.
7590         (Lib_group::do_filename): New function.
7591         (Lib_group::do_get_mtime): New function.
7592         (Lib_group::do_for_all_unused_symbols): New function.
7593         (Lib_group::task_): Move to base class.
7594         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
7595         function.
7596         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
7597         function.
7598         * incremental.cc (Incremental_inputs::report_archive_begin):
7599         Use Library_base; call library's get_mtime; add incremental inputs
7600         entry before members.
7601         (class Unused_symbol_visitor): New class.
7602         (Incremental_inputs::report_archive_end): Use Library_base; use
7603         visitor class to record unused symbols; don't add incremental inputs
7604         entry after members.
7605         (Incremental_inputs::report_object): Use Library_base.
7606         * incremental.h
7607         (Incremental_archive_entry::Incremental_archive_entry): Remove
7608         unused Archive parameter.
7609         (Incremental_inputs::report_archive_begin): Use Library_base.
7610         (Incremental_inputs::report_archive_end): Likewise.
7611         (Incremental_inputs::report_object): Likewise.
7612         * object.cc (Sized_relobj::do_for_all_global_symbols): New
7613         function.
7614         * object.h (Object::for_all_global_symbols): New function.
7615         (Object::do_for_all_global_symbols): New function.
7616         (Sized_relobj::do_for_all_global_symbols): New function.
7617         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
7618         function.
7619         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
7620         function.
7621
7622 2011-03-27  Ian Lance Taylor  <iant@google.com>
7623
7624         * archive.cc (Archive::interpret_header): Return -1 if something
7625         goes wrong.  Change callers accordingly.
7626
7627 2011-03-25  Cary Coutant  <ccoutant@google.com>
7628
7629         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
7630         * testsuite/Makefile.in: Regenerate.
7631
7632 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
7633
7634         * plugin.cc (get_view): New.
7635         (Plugin::load): Pass get_view to the plugin.
7636         (Plugin_manager::get_view): New.
7637
7638 2011-03-21  Ian Lance Taylor  <iant@google.com>
7639
7640         * testsuite/final_layout.sh: Rewrite to not use dc.
7641         * testsuite/relro_test.sh: Fail if dc is not present.
7642
7643 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
7644
7645         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
7646         Change == to -eq.
7647         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
7648         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
7649         Change == to -eq.
7650         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
7651         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
7652
7653 2011-03-14  Ian Lance Taylor  <iant@google.com>
7654
7655         * script-sections.cc (Sort_output_sections::script_compare):
7656         Rename from is_before, change return type.
7657         (Sort_output_sections::operator()): Adjust accordingly.
7658
7659 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
7660
7661         PR gold/12572
7662         * testsuite/odr_violation2.cc: Add comment to make all error line
7663         numbers double digits.
7664         * testsuite/debug_msg.sh: Adjust expected errors.
7665
7666 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
7667
7668         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
7669         but mark earlier ones as non-canonical
7670         (offset_to_iterator): Update search target and example
7671         (do_addr2line): Return extra lines in a vector*
7672         (format_file_lineno): Extract from do_addr2line
7673         (one_addr2line): Add vector* out-param
7674         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
7675         when a lineno entry appeared last for its instruction
7676         (Dwarf_line_info): Add vector* out-param
7677         * object.cc (Relocate_info): Pass NULL for the vector* out-param
7678         * symtab.cc (Odr_violation_compare): Include the lineno in the
7679         comparison again.
7680         (linenos_from_loc): New. Combine the canonical line for an
7681         address with its other lines.
7682         (True_if_intersect): New. Helper functor to make
7683         std::set_intersection a query.
7684         (detect_odr_violations): Compare sets of lines instead of just
7685         one line for each function. This became less deterministic, but
7686         has fewer false positives.
7687         * symtab.h: Declarations.
7688         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
7689         mix an optimized and non-optimized object in the same binary
7690         (odr_violation2.so): Same.
7691         * testsuite/Makefile.in: Regenerate from Makefile.am.
7692         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
7693         * testsuite/debug_msg.sh: Update line numbers and add
7694         assertions.
7695         * testsuite/odr_violation1.cc: Use OdrDerived, in a
7696         non-optimized context.
7697         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
7698         isn't inlined, and use OdrDerived in an optimized context.
7699         * testsuite/odr_header1.h: Defines OdrDerived, where
7700         optimization will change the
7701         first-instruction-in-the-destructor's file and line number.
7702         * testsuite/odr_header2.h: Defines OdrBase.
7703
7704 2011-03-09  Ian Lance Taylor  <iant@google.com>
7705
7706         * fileread.cc (File_read::clear_views): Don't delete the whole
7707         file view.
7708
7709 2011-03-08  Ian Lance Taylor  <iant@google.com>
7710
7711         PR gold/12525
7712         * fileread.cc: #include <climits>.
7713         (GOLD_IOV_MAX): Define.
7714         (File_read::read_multiple): Limit number of entries by iov_max.
7715         * fileread.h (class File_read): Always set max_readv_entries to
7716         128.
7717
7718 2011-03-07  Ian Lance Taylor  <iant@google.com>
7719
7720         PR gold/12525
7721         * options.h (class General_options): Add -dy and -dn.
7722
7723 2011-03-02  Cary Coutant  <ccoutant@google.com>
7724
7725         * testsuite/script_test_9.t: Add TLS segment.
7726
7727 2011-03-02  Simon Baldwin  <simonb@google.com>
7728
7729         * configure.ac: Add check for gnu_indirect_function support in
7730         the toolchain building binutils.
7731         * configure: Rebuild.
7732
7733 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
7734
7735         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
7736         plugin only symbols.
7737         (Symbol_table::sized_finalize_symbol) Mark symbol only present
7738         in plugin files as not needed in the symbol table.
7739
7740 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
7741
7742         * output.cc (Output_section::add_input_section): Delay fill
7743         generation for section ordering.
7744
7745 2011-02-09  Ian Lance Taylor  <iant@google.com>
7746
7747         PR gold/12316
7748         * object.h (class Sized_relobj): Remove clear_local_symbols.
7749         * reloc.cc (Sized_relobj::do_relocate): Don't call
7750         clear_local_symbols.
7751
7752 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
7753
7754         * plugin.cc (is_visible_from_outside): Return true for symbols
7755         in the -u option.
7756
7757 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
7758
7759         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
7760         filename.
7761
7762 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
7763
7764         * icf.h (is_section_foldable_candidate): Change type of parameter
7765         to std::string.
7766         * icf.cc (Icf::find_identical_sections): Change type of local variable
7767         section_name to be std::string.
7768         (is_function_ctor_or_dtor): Change type of parameter to std::string.
7769
7770 2011-01-25  Ian Lance Taylor  <iant@google.com>
7771
7772         * script.cc (script_add_extern): Rewrite to use
7773         add_symbol_reference.
7774
7775 2011-01-25  Doug Kwan  <dougkwan@google.com>
7776
7777         * icf.cc (get_section_contents): Always lock section's object.
7778
7779 2011-01-24  Ian Lance Taylor  <iant@google.com>
7780
7781         * options.h (class General_options): Accept
7782         --no-detect-odr-violations.
7783
7784 2011-01-24  Ian Lance Taylor  <iant@google.com>
7785
7786         * version.cc (version_string): Bump to 1.11.
7787
7788 2011-01-24  Ian Lance Taylor  <iant@google.com>
7789
7790         * plugin.cc (class Plugin_rescan): Define new class.
7791         (Plugin_manager::claim_file): Set any_claimed_.
7792         (Plugin_manager::save_archive): New function.
7793         (Plugin_manager::save_input_group): New function.
7794         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
7795         necessary.
7796         (Plugin_manager::new_undefined_symbol): New function.
7797         (Plugin_manager::rescan): New function.
7798         (Plugin_manager::rescannable_defines): New function.
7799         (Plugin_manager::add_input_file): Set any_added_.
7800         * plugin.h (class Plugin_manager): define new fields rescannable_,
7801         undefined_symbols_, any_claimed_, and any_added_.  Declare
7802         Plugin_rescan as friend.  Declare new functions.
7803         (Plugin_manager::Rescannable): Define type.
7804         (Plugin_manager::Rescannable_list): Define type.
7805         (Plugin_manager::Undefined_symbol_list): Define type.
7806         (Plugin_manager::Plugin_manager): Initialize new fields.
7807         * archive.cc (Archive::defines_symbol): New function.
7808         (Add_archive_symbols::run): Pass archive to plugins if any.
7809         * archive.h (class Archive): Declare defines_symbol.
7810         * readsyms.cc (Input_group::~Input_group): New function.
7811         (Finish_group::run): Pass input_group to plugins if any.
7812         * readsyms.h (class Input_group): Declare destructor.
7813         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
7814         any.
7815
7816 2011-01-10  Ian Lance Taylor  <iant@google.com>
7817
7818         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
7819         section as relro.
7820         (Layout::set_segment_offsets): Reset increase_relro before calling
7821         set_section_addresses a second time.
7822
7823 2011-01-04  Cary Coutant  <ccoutant@google.com>
7824
7825         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
7826         sections before NOBITS sections.
7827
7828 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
7829
7830         * version.cc (print_version): Update copyright to 2011.
7831
7832 2010-12-23  Cary Coutant  <ccoutant@google.com>
7833
7834         * output.h (Output_data_reloc::add_output_section): Pass OD instead
7835         of OS to this->add.  Add OD parameter to second form of the function.
7836
7837 2010-12-20  Ian Lance Taylor  <iant@google.com>
7838
7839         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
7840         second of two consecutive entries with same offset.
7841
7842 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7843
7844         * testsuite/Makefile.am (ifuncmain2static_LDADD)
7845         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
7846         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
7847         to avoid unneeded links against $(LDADD).
7848         * testsuite/Makefile.in: Regenerate.
7849
7850 2010-12-15  Ian Lance Taylor  <iant@google.com>
7851
7852         PR gold/12324
7853         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
7854         for R_X86_64_32 and R_X86_64_PC32.
7855         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
7856         ver_matching_def_pic.o.
7857         (ver_matching_def_pic.o): New target.
7858
7859 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7860
7861         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
7862         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
7863         Move definition before File_read::View member definitions.
7864         (File_read::View::~View): Initialize and hold lock before
7865         updating current_mapped_bytes.
7866
7867 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7868
7869         * dwarf_reader.cc: Remove outdated comment.
7870         * gold-threads.cc: Fix typo in error message.
7871         * archive.cc: Fix typos in comments.
7872         * archive.h: Likewise.
7873         * arm-reloc-property.cc: Likewise.
7874         * arm-reloc-property.h: Likewise.
7875         * arm-reloc.def: Likewise.
7876         * arm.cc: Likewise.
7877         * attributes.h: Likewise.
7878         * cref.cc: Likewise.
7879         * ehframe.cc: Likewise.
7880         * fileread.h: Likewise.
7881         * gold.h: Likewise.
7882         * i386.cc: Likewise.
7883         * icf.cc: Likewise.
7884         * incremental.h: Likewise.
7885         * int_encoding.cc: Likewise.
7886         * layout.h: Likewise.
7887         * main.cc: Likewise.
7888         * merge.h: Likewise.
7889         * object.cc: Likewise.
7890         * object.h: Likewise.
7891         * options.cc: Likewise.
7892         * readsyms.cc: Likewise.
7893         * reduced_debug_output.cc: Likewise.
7894         * reloc.cc: Likewise.
7895         * script-sections.cc: Likewise.
7896         * sparc.cc: Likewise.
7897         * symtab.h: Likewise.
7898         * target-reloc.h: Likewise.
7899         * target.cc: Likewise.
7900         * target.h: Likewise.
7901         * timer.cc: Likewise.
7902         * timer.h: Likewise.
7903         * x86_64.cc: Likewise.
7904
7905 2010-12-09  Cary Coutant  <ccoutant@google.com>
7906
7907         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
7908         stack.
7909         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
7910         parameter; change all callers.
7911         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
7912         * options.h (warn_execstack): New option.
7913
7914 2010-12-07  Doug Kwan  <dougkwan@google.com>
7915
7916         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
7917         like function call relocations.
7918
7919 2010-12-07  Ian Lance Taylor  <iant@google.com>
7920
7921         * archive.cc (Archive::get_elf_object_for_member): Permit
7922         punconfigured to be NULL.
7923         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
7924         (Archive::include_member): Pass NULL to get_elf_object_for_member
7925         if we searched for the archive and this is the first included
7926         object.
7927
7928 2010-12-01  Ian Lance Taylor  <iant@google.com>
7929
7930         * dwarf_reader.h (class Sized_dwarf_line_info): Add
7931         track_relocs_type_ field.
7932         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7933         Set track_relocs_type_.
7934         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
7935         contents when using RELA relocs.
7936         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
7937         reloc_map_.
7938         * reloc.cc (Track_relocs::next_addend): New function.
7939         * reloc.h (class Track_relocs): Declare next_addend.
7940
7941 2010-12-01  Ian Lance Taylor  <iant@google.com>
7942
7943         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
7944         virtual destructor.
7945
7946 2010-12-01  Ian Lance Taylor  <iant@google.com>
7947
7948         * README: Update compilers known to work and fail.
7949
7950 2010-11-23  Matthias Klose  <doko@ubuntu.com>
7951
7952         * configure.in: For --enable-gold, handle value `default' instead of
7953         `both*'.  Always install ld as ld.bfd, install as ld if gold is
7954         not the default.
7955         * configure: Regenerate.
7956
7957 2010-11-18  Doug Kwan  <dougkwan@google.com>
7958
7959         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
7960         and right_alignment to be zero.  Store result alignment only if it is
7961         greater than existing alignment.
7962
7963 2010-11-16  Cary Coutant  <ccoutant@google.com>
7964
7965         PR gold/12220
7966         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7967         Check for ".zdebug_line".
7968
7969 2010-11-16  Doug Kwan  <dougkwan@google.com>
7970             Cary Coutant  <ccoutant@google.com>
7971
7972         * output.h (Output_segment::set_section_addresses): Pass increase_relro
7973         by reference; adjust all callers.
7974         * output.cc (Output_segment::set_section_addresses): Adjust references
7975         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
7976         list is empty.
7977         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
7978         end at page boundary.
7979
7980 2010-11-16  Cary Coutant  <ccoutant@google.com>
7981
7982         PR gold/12220
7983         * layout.cc (Layout::choose_output_section): Transform names of
7984         compressed sections even when using a script with a SECTIONS clause.
7985         (Layout::output_section_name): Remove code to transform
7986         compressed debug section names.
7987         * output.cc (Output_section::add_input_section): Use uncompressed
7988         section size when tracking input sections.
7989
7990 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
7991
7992         * symtab.h (Symbol::NON_PIC_REF): Remove.
7993         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
7994         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
7995         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
7996         (Symbol::use_plt_offset): Take a flags argument and pass it
7997         directly to needs_dynamic_reloc.  Restrict check for undefined
7998         weak symbols to function calls.
7999         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
8000         (Target_arm::Scan::global): Use it.
8001         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
8002         (Target_arm::Relocate::relocate): Likewise.
8003         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
8004         parameter with an r_type parameter.  Use get_reference_flags
8005         to get the flags.
8006         (Target_arm::Relocate::relocate): Update accordingly.
8007         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
8008         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
8009         (Target_i386::Scan::global): Likewise.
8010         (Target_i386::Relocate::relocate): Likewise.
8011         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
8012         parameter with an r_type parameter.  Use get_reference_flags
8013         to get the flags.
8014         (Target_i386::Relocate::relocate): Update accordingly.
8015         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
8016         (Target_powerpc::Scan::global): Use it.
8017         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
8018         (Target_powerpc::Relocate::relocate): Likewise.
8019         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
8020         (Target_sparc::Scan::global): Use it.
8021         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
8022         (Target_sparc::Relocate::relocate): Likewise.
8023         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
8024         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
8025         (Target_x86_64::Scan::global): Likewise.
8026         (Target_x86_64::Relocate::relocate): Likewise.
8027
8028 2010-11-08  Doug Kwan  <dougkwan@google.com>
8029             Cary Coutant  <ccoutant@google.com>
8030
8031         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
8032         (Arm_exidx_merge_section::section_contents_): New data member.
8033         (Arm_input_section::Arm_input_section): Initialize original_contents_.
8034         (Arm_input_section::~Arm_input_section): De-allocate memory.
8035         (Arm_input_section::original_contents_): New data member.
8036         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
8037         in parameters instead of calling Object::section_contents without
8038         locking.
8039         (Arm_output_section::group_section): New parameter TASK.  Pass it
8040         to callees that need locking objects.
8041         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
8042         to lock EXIDX input sections.  Fix a formatting issue.  Call
8043         Arm_exidx_merged_section::build_contents to create merged section
8044         contents.
8045         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
8046         to lock object of stub table owner.
8047         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
8048         TEXT_SIZE to initialize data member TEXT_SIZE_.
8049         (Arm_exidx_input_section::addralign): Fix typo in comment.
8050         (Arm_exidx_input_section::text_size): New method.
8051         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
8052         that require locking objects.  Lock objects before scanning for stubs
8053         and updating local symbols.
8054         (Arm_input_section<big_endian>::init): Copy contents of original
8055         input section.
8056         (Arm_input_section<big_endian>::do_write): Use saved contents of
8057         original input section instead of calling Object::section_contents
8058         without locking.
8059         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
8060         size without calling Object::section_size().
8061         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
8062         for size.  Allocate a buffer for merged EXIDX entries.
8063         (Arm_exidx_merged_section::build_contents): New method.
8064         (Arm_exidx_merged_section::do_write): Move merge section contents
8065         building code to Arm_exidx_merged_section::build_contetns.  Write
8066         out contetns in buffer instead of building it on the fly.
8067         (Arm_relobj::make_exidx_input_section): Also pass text section size
8068         to Arm_exidx_input_section constructor.
8069         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
8070         (Arm_dynobj::do_read_symbols): Fix memory leak.
8071         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
8072         * target.h: (class Task): Add forward declaration.
8073         (Target::relax): Add new parameter TASK and pass it to
8074         Target::do_relax().
8075         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
8076
8077 2010-11-05  Cary Coutant  <ccoutant@google.com>
8078
8079         PR gold/10708
8080         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
8081         object when reading from the file.
8082         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
8083         second layout pass.
8084         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
8085         when reading section contents.
8086         (get_section_contents): Likewise.
8087         (icf::find_identical_sections): Likewise.
8088         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
8089         object when reading from the file.
8090         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
8091         the object when doing deferred section layout.
8092
8093 2010-11-03  Nick Clifton  <nickc@redhat.com>
8094
8095         PR gold/12001
8096         * script.h (class Symbol_assignment: name): New member.  Returns
8097         the name of the symbol.
8098         * scrfipt.cc (Script_options::is_pending_assignment): New member.
8099         Returns true if the given symbol name is on the list of
8100         assignments wating to be processed.
8101         * archive.cc (should_incldue_member): If the symbol is undefined,
8102         check to see if it is on the list of symbols pending assignment.
8103
8104 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
8105
8106         * script-sections.cc (Script_sections::find_memory_region): Check
8107         for a NULL output section pointer.
8108
8109 2010-10-29  Doug Kwan  <dougkwan@google.com>
8110
8111         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
8112         Output_section::add_relaxed_input_section.
8113         * output.cc (Output_section::add_relaxed_input_section): Add new
8114         arguments LAYOUT and NAME.  Set section order index.
8115         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8116         Copy section order index.
8117         * output.h (Output_section::add_relaxed_input_section): Add new
8118         arguments LAYOUT and NAME.
8119
8120 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8121
8122         * testsuite/Makefile.am: Move gcctestdir/ld rule to
8123         NATIVE_OR_CROSS_LINKER.
8124         * testsuite/Makefile.in: Regenerate.
8125
8126 2010-10-20  Doug Kwan  <dougkwan@google.com>
8127
8128         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
8129         without SHF_LINK_ORDER flags.
8130         * layout.cc (Layout::choose_output_section): Do not filter
8131         SHF_LINK_ORDER flag in a relocatable link.
8132
8133 2010-10-17  Cary Coutant  <ccoutant@google.com>
8134
8135         * output.h (Output_segment::set_section_addresses): Change function
8136         signature.  Update all callers.
8137         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
8138         sections.
8139         (Output_segment::set_section_addresses): Align after last TLS
8140         section.  Add padding before last relro section instead of after.
8141
8142 2010-10-17  Doug Kwan  <dougkwan@google.com>
8143
8144         * gold/arm.cc (Target_arm::got_section): Use correct order and set
8145         GOT output section to be writable.
8146
8147 2010-10-14  Cary Coutant  <ccoutant@google.com>
8148
8149         * debug.h (DEBUG_INCREMENTAL): New flag.
8150         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
8151         * gold.cc (queue_initial_tasks): Check parameters for incremental link
8152         mode.
8153         * incremental.cc (report_command_line): Ignore all forms of
8154         --incremental.
8155         * layout.cc (Layout::Layout): Check parameters for incremental link
8156         mode.
8157         * options.cc (General_options::parse_incremental): New function.
8158         (General_options::parse_no_incremental): New function.
8159         (General_options::parse_incremental_full): New function.
8160         (General_options::parse_incremental_update): New function.
8161         (General_options::incremental_mode_): New data member.
8162         (General_options::finalize): Check incremental_mode_.
8163         * options.h (General_options): Update help text for --incremental.
8164         Add --no-incremental, --incremental-full, --incremental-update.
8165         (General_options::Incremental_mode): New enum type.
8166         (General_options::incremental_mode): New function.
8167         (General_options::incremental_mode_): New data member.
8168         * parameters.cc (Parameters::incremental_mode_): New data member.
8169         (Parameters::set_options): Set incremental_mode_.
8170         (Parameters::set_incremental_full): New function.
8171         (Parameters::incremental): New function.
8172         (Parameters::incremental_update): New function.
8173         (set_parameters_incremental_full): New function.
8174         * parameters.h (Parameters::set_incremental_full): New function.
8175         (Parameters::incremental): New function.
8176         (Parameters::incremental_update): New function.
8177         (Parameters::incremental_mode_): New data member.
8178         (set_parameters_incremental_full): New function.
8179         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
8180         incremental link mode.
8181         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
8182         (Sized_relobj::do_relocate_sections): Likewise.
8183         * testsuite/Makefile.am (incremental_test): Use --incremental-full
8184         option.
8185         * testsuite/Makefile.in: Regenerate.
8186         * testsuite/incremental_test.sh: Filter all forms of --incremental.
8187
8188 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8189
8190         * script-sections.h (class Script_sections): Make
8191         Sections_elements typedef public.
8192         * script-sections.cc (class Sort_output_sections): Add elements_
8193         field.  Add constructor which sets it; change all callers.
8194         (Sort_output_sections::is_before): New function.
8195         (Sort_output_sections::operator()): Call is_before.
8196         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
8197         conditional.
8198         * testsuite/script_test_10.sh: New test. Test script section
8199         order.
8200         * testsuite/script_test_10.t: Likewise.
8201         * testsuite/script_test_10.s: Likewise.
8202         * testsuite/Makefile.am: Wrap the cross linker tests and the
8203         common tests into NATIVE_OR_CROSS_LINKER.
8204         (check_SCRIPTS): Add script_test_10.sh.
8205         (check_DATA): Add script_test_10.stdout.
8206         (script_test_10.o, script_test_10): New targets.
8207         (script_test_10.stdout): New target.
8208         * configure, testsuite/Makefile.in: Regenerate.
8209
8210 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8211
8212         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
8213         error for the deprecated relocations.
8214         (Target_arm::Scan::global): Likewise.
8215         (Target_arm::Relocate::relocate): Likewise.
8216
8217 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
8218
8219         * fileread.cc (Input_file::find_file): Initialize *found_name
8220         and *namep when using the fallback search for case 4.
8221
8222 2010-10-11  Cary Coutant  <ccoutant@google.com>
8223
8224         * options.h (class General_options): Redefine -z lazy as an alias for
8225         the negation of -z now.
8226
8227 2010-10-11  Ian Lance Taylor  <iant@google.com>
8228
8229         * resolve.cc (symbol_to_bits): Report the value of the unsupported
8230         binding.
8231
8232 2010-10-06  Nick Clifton  <nickc@redhat.com>
8233
8234         * script-sections.cc(class Memory_region): Remove
8235         current_lma_offset_ field.  Rename current_vma_offset_ to
8236         current_offset_.  Add last_section_ field.
8237         (Memory_region::get_current_vma_address): Rename to
8238         get_current_address.
8239         (Memory_region::get_current_lma_address): Delete.
8240         (Memory_region::increment_vma_offset): Rename to
8241         increment_offset.
8242         (Memory_region::increment_lma_offset): Delete.
8243         (Memory_region::attributes_compatible): New method.  Returns
8244         true if the provided section is compatible with the region.
8245         (Memory_region::get_last_section): New method.  Returns the last
8246         section to use the region.
8247         (Memory_region::set_last_section): New method.  Stores the last
8248         section to use the region.
8249         (Script_sections::block_in_region): New method.  Returns true if
8250         a block of memory is contained within a region.
8251         (Script_sections::find_memory_region): New method.  Locates a
8252         memory region to be used to set a VMA or LMA address.
8253         (Output_section_definition::set_section_addresses): Add code to
8254         check for addresses set by memory regions.
8255         (Output_segment::set_section_addresses): Remove memory region
8256         walking code.
8257         (Script_sections::create_segment): Add a warning if a header
8258         segment is created outside of any region.
8259         * script-sections.h (class Script_sections): Add prototypes for
8260         find_memory_region and block_in_region methods.
8261         * testsuite/memory_test.s: Use .long instead of .word.
8262         * testsuite/memory_test.t: Add some more output sections.
8263         * testsuite/memory_test.sh: Update expected output.
8264
8265 2010-10-02  Doug Kwan  <dougkwan@google.com>
8266
8267         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
8268         defintion to symtab.h
8269         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
8270         declaration to defintion.
8271
8272 2010-10-01  Nick Clifton  <nickc@redhat.com>
8273
8274         * expression.cc (eval): Replace dummy argument with NULL.
8275         (eval_maybe_dot): Check for a NULL result section pointer.
8276         (Symbol_expression::value): Likewise.
8277         (Dot_expression::value): Likewise.
8278         (BINARY_EXPRESSION): Likewise.
8279         (Max_expression::value): Likewise.
8280         (Min_expression::value): Likewise.
8281         (Absolute_expression::value): Likewise.
8282         (Addr_expression::value_from_output_section): Likewise.
8283         (Loaddddr_expression::value_from_output_section): Likewise.
8284         (Segment_start_expression::value): Likewise.
8285         * script-sections.cc
8286         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
8287         argument with NULL.
8288         (Sections_elememt_dot_assignment::set_section_addresses):
8289         Likewise.
8290         (Output_data_expression::do_write_to_buffer): Likewise.
8291         (Output_section_definition::finalize_symbols): Likewise.
8292         (Output_section_definition::set_section_addresses): Likewise.
8293
8294 2010-09-30  Doug Kwan  <dougkwan@google.com>
8295
8296         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
8297
8298 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
8299
8300         * target.h (Target::can_icf_inline_merge_sections): New virtual
8301         function.
8302         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
8303         virtual function.
8304         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
8305         virtual function.
8306         * icf.cc (get_section_contents): Inline merge sections only when
8307         target allows it.
8308
8309 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8310
8311         * configure: Regenerate.
8312
8313 2010-09-17  Ian Lance Taylor  <iant@google.com>
8314
8315         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
8316         * testsuite/Makefile.am (memory_test.o): New target.
8317         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
8318         memory_test.t.
8319         * testsuite/Makefile.in: Rebuild.
8320
8321 2010-09-17  Doug Kwan  <dougkwan@google.com>
8322
8323         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
8324         defintion if relocation uses GOT entries of the symbol.
8325         * testsuite/icf_safe_test.sh: Fix test.
8326         * testsuite/icf_safe_so_test.sh: Fix test.
8327
8328 2010-09-16  Cary Coutant  <ccoutant@google.com>
8329
8330         * script_sections.cc (class Memory_region): Remove "NULL" from
8331         vector initializations.
8332
8333 2010-09-15  Cary Coutant  <ccoutant@google.com>
8334
8335         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
8336         Resolve forwarding symbols.
8337
8338 2010-09-15  Doug Kwan  <dougkwan@google.com>
8339
8340         * gold/testsuite/script_test_3.t: Add ARM special sections.
8341         * gold/testsuite/script_test_4.t: Same.
8342         * gold/testsuite/script_test_5.t: Same.
8343         * gold/testsuite/script_test_6.t: Same.
8344         * gold/testsuite/script_test_7.t: Same.
8345         * gold/testsuite/script_test_7.t: Same.
8346         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
8347
8348 2010-09-14  Cary Coutant  <ccoutant@google.com>
8349
8350         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
8351         (Target_x86_64::Relocate::relocate_tls): Replace check for
8352         saw_tls_block_reloc_ with test for executable section.
8353
8354 2010-09-12  Cary Coutant  <ccoutant@google.com>
8355
8356         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
8357         position-independent executables to shared libraries need dynamic
8358         relocations.
8359         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
8360         position-independent executables.
8361         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
8362         * testsuite/Makefile.in: Regenerate.
8363
8364 2010-09-10  Nick Clifton  <nickc@redhat.com>
8365
8366         PR gold/11997
8367         * testsuite/memory_test.t: Discard any sections that are not
8368         needed.
8369
8370 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
8371
8372         PR gold/11996
8373         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
8374         "This::" to work around a bug in gcc 4.2.
8375
8376         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
8377
8378 2010-09-09  Rafael Espindola  <espindola@google.com>
8379
8380         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
8381         sections with different PF_X flags in the same segment.
8382         (Layout::find_first_load_seg): Search all segments to find the first
8383         one.
8384         * options.h (rosegment): New.
8385
8386 2010-09-08  Rafael Espindola  <espindola@google.com>
8387
8388         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
8389
8390 2010-09-08  Doug Kwan  <dougkwan@google.com>
8391
8392         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
8393         (Arm_relobj::do_relocate_sections): Add new parameter for output
8394         file to match the parent.
8395         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
8396         of local symbols instead of input values.  Update code to track
8397         changes in gold::relocate_section.
8398         * object.cc (Sized_relobj::compute_final_local_value): New methods.
8399         (Sized_relobj::compute_final_local_value_internal): New methods.
8400         (Sized_relobj::do_finalize_local_symbols): Move code from loop
8401         body into private version of Sized_relobj::compute_final_local_value.
8402         Call the inline method.
8403         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
8404         merged symbol value if there is one.
8405         (Symbol_value::has_output_value): New method defintiion.
8406         (Sized_relobj::Compute_final_local_value_status): New enum type.
8407         (Sized_relobj::compute_final_local_value): New methods.
8408         (Sized_relobj::compute_final_local_value_internal): New methods.
8409         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
8410         and arm_cortex_a8.sh.
8411         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
8412         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
8413         New tests.
8414         * Makefile.in: Regenerate.
8415         * testsuite/arm_bl_out_of_range.s: Update test.
8416         * testsuite/thumb_bl_out_of_range.s: Ditto.
8417         * testsuite/thumb_blx_out_of_range.s: Ditto.
8418         * testsuite/arm_branch_out_of_range.sh: New file.
8419         * testsuite/arm_cortex_a8.sh: Ditto.
8420         * testsuite/arm_cortex_a8_b.s: Ditto.
8421         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
8422         * testsuite/arm_cortex_a8_b_local.s: Ditto.
8423         * testsuite/arm_cortex_a8_bl.s: Ditto.
8424         * testsuite/arm_cortex_a8_blx.s: Ditto.
8425         * testsuite/arm_cortex_a8_local.s: Ditto.
8426         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
8427         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
8428
8429 2010-09-08  Rafael Espindola  <espindola@google.com>
8430
8431         * Makefile.am (memory_test.stdout): Run readelf with -W.
8432         * Makefile.in: Regenerate.
8433         * testsuite/memory_test.sh: Make the regexps accept both 32 and
8434         64 bit output.
8435
8436 2010-09-08  Rafael Espindola  <espindola@google.com>
8437
8438         * script-sections.cc (Script_sections::add_memory_region): Convert
8439         field precision to int.
8440         * script.cc (script_set_section_region, script_set_section_region):
8441         Convert field precision to int.
8442
8443 2010-09-08  Rafael Espindola  <espindola@google.com>
8444
8445         * arm.cc (do_finalize_sections): Create the __exidx_start and
8446         __exdix_end symbols even when the section is missing.
8447
8448 2010-09-08  Nick Clifton  <nickc@redhat.com>
8449
8450         * README: Remove claim that MEMORY is not supported.
8451         * expression.cc (script_exp_function_origin)
8452         (script_exp_function_length): Move from here to ...
8453         * script.cc: ... here.
8454         (script_set_section_region, script_add_memory)
8455         (script_parse_memory_attr, script_include_directive): New
8456         functions.
8457         * script-sections.cc
8458         (class Memory_region): New class.
8459         (class Output_section_definition): Add set_memory_region,
8460         set_section_vma, set_section_lma and get_section_name methods.
8461         (class Script_Sections): Add add_memory_region,
8462         find_memory_region, find_memory_region_origin,
8463         find_memory_region_length and set_memory_region methods.
8464         Have set_section_addresses method walk the list of set memory
8465         regions.
8466         Extend the print methos to display memory regions.
8467         * script-sections.h: Add prototypes for new methods.
8468         Add enum for MEMORY region attributes.
8469         * yyscript.y: Add support for parsing MEMORY regions.
8470         * script-c.h: Add prototypes for new functions.
8471         * testsuite/Makefile.am: Add test of MEMORY region functionality.
8472         * testsuite/Makefile.in: Regenerate.
8473         * testsuite/memory_test.sh: New script.
8474         * testsuite/memory_test.s: New assembler source file.
8475         * testsuite/memory_test.t: New linker script.
8476
8477 2010-08-27  Doug Kwan  <dougkwan@google.com>
8478
8479         * gold/resolve.cc (Symbol_table::should_override): Let a weak
8480         reference override an existing dynamic weak reference.
8481         * testsuite/Makefile.am: Add new test dyn_weak_ref.
8482         * testsuite/Makefile.in: Regenerate.
8483         * testsuite/dyn_weak_ref.sh: New file.
8484         * testsuite/dyn_weak_ref_1.c: Ditto.
8485         * testsuite/dyn_weak_ref_2.c: Ditto.
8486
8487 2010-08-27  Ian Lance Taylor  <iant@google.com>
8488
8489         * incremental.h (class Incremental_input_entry): Add virtual
8490         destructor.
8491
8492 2010-08-27  Ian Lance Taylor  <iant@google.com>
8493
8494         * testsuite/start_lib_test_3.c: Mark t3 as used.
8495
8496 2010-08-27  Nick Clifton  <nickc@redhat.com>
8497
8498         * options.cc (version_script): Fix small typo in previous
8499         whitespace tidyup.
8500
8501 2010-08-25  Nick Clifton  <nickc@redhat.com>
8502
8503         * archive.cc: Formatting fixes: Remove whitespace between
8504         typename and following asterisk.  Remove whitespace between
8505         function name and opening parenthesis.
8506         * archive.h: Likewise.
8507         * arm.cc: Likewise.
8508         * attributes.cc: Likewise.
8509         * attributes.h: Likewise.
8510         * common.cc: Likewise.
8511         * copy-relocs.cc: Likewise.
8512         * dirsearch.h: Likewise.
8513         * dynobj.cc: Likewise.
8514         * ehframe.cc: Likewise.
8515         * ehframe.h: Likewise.
8516         * expression.cc: Likewise.
8517         * fileread.cc: Likewise.
8518         * fileread.h: Likewise.
8519         * gc.h: Likewise.
8520         * gold-threads.cc: Likewise.
8521         * gold.cc: Likewise.
8522         * i386.cc: Likewise.
8523         * icf.h: Likewise.
8524         * incremental-dump.cc: Likewise.
8525         * incremental.cc: Likewise.
8526         * layout.cc: Likewise.
8527         * layout.h: Likewise.
8528         * main.cc: Likewise.
8529         * merge.cc: Likewise.
8530         * merge.h: Likewise.
8531         * object.cc: Likewise.
8532         * object.h: Likewise.
8533         * options.cc: Likewise.
8534         * options.h: Likewise.
8535         * output.cc: Likewise.
8536         * output.h: Likewise.
8537         * plugin.cc: Likewise.
8538         * plugin.h: Likewise.
8539         * powerpc.cc: Likewise.
8540         * reloc.cc: Likewise.
8541         * script-c.h: Likewise.
8542         * script-sections.cc: Likewise.
8543         * script.cc: Likewise.
8544         * stringpool.cc: Likewise.
8545         * symtab.cc: Likewise.
8546         * symtab.h: Likewise.
8547         * target.cc: Likewise.
8548         * timer.cc: Likewise.
8549         * timer.h: Likewise.
8550         * version.cc: Likewise.
8551         * x86_64.cc: Likewise.
8552
8553 2010-08-24  Nick Clifton  <nickc@redhat.com>
8554
8555         PR 11899
8556         * layout.cc (segment_precedes): Sort segments by their physical
8557         addresses, if they have been set.
8558
8559 2010-08-23  Cary Coutant  <ccoutant@google.com>
8560
8561         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
8562         symbols data.
8563         (Lib_group::include_member): Unlock object after deleting its
8564         symbols data.
8565         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
8566         the bug fixed here.
8567
8568 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
8569             Cary Coutant  <ccoutant@google.com>
8570
8571         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
8572         constructor, and set_blocker.
8573         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
8574         readsyms_blocker_.
8575         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
8576         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
8577         * testsuite/Makefile.am (start_lib_test): New test case.
8578         * testsuite/Makefile.in: Regenerate.
8579         * testsuite/start_lib_test_main.c: New file.
8580         * testsuite/start_lib_test_1.c: New file.
8581         * testsuite/start_lib_test_2.c: New file.
8582         * testsuite/start_lib_test_3.c: New file.
8583
8584 2010-08-19  Ian Lance Taylor  <iant@google.com>
8585
8586         * Makefile.in: Rebuild with automake 1.11.1.
8587         * aclocal.m4: Likewise.
8588         * testsuite/Makefile.in: Likewise.
8589
8590 2010-08-19  Ian Lance Taylor  <iant@google.com>
8591
8592         PR 10893
8593         * i386.cc (class Output_data_plt_i386): Update declarations.
8594         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
8595         local_ifuncs_ fields.
8596         (Target_i386::do_plt_section_for_global): New function.
8597         (Target_i386::do_plt_section_for_local): New function.
8598         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
8599         parameter; change all callers.  Initialize global_ifuncs_ and
8600         local_ifuncs_.  If doing a static link define __rel_iplt_start and
8601         __rel_iplt_end.
8602         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
8603         (Output_data_plt_i386::add_local_ifunc_entry): New function.
8604         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
8605         symbols.
8606         (Target_i386::make_plt_section): New function, broken out of
8607         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
8608         (Target_i386::make_plt_entry): Call make_plt_section.
8609         (Target_i386::make_local_ifunc_plt_entry): New function.
8610         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
8611         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
8612         R_386_IRELATIVE to switch.
8613         (Target_i386::Scan::global): Likewise.
8614         (Target_i386::Relocate::relocate): Likewise.
8615         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
8616         switch.
8617         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
8618         (Target_x86_64::do_plt_section_for_global): New function.
8619         (Target_x86_64::do_plt_section_for_local): New function.
8620         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
8621         parameter; change all callers.  If doing a static link define
8622         __rela_iplt_start and __rela_iplt_end.
8623         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
8624         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
8625         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
8626         to point to .plt.
8627         (Target_x86_64::make_local_ifunc_plt_entry): New function.
8628         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
8629         switch.
8630         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
8631         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
8632         R_X86_64_IRELATIVE to switch.
8633         (Target_x86_64::Scan::global): Likewise.
8634         (Target_x86_64::Relocate::relocate): Likewise.
8635         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
8636         switch.
8637         * target.h (class Target): Add plt_section_for_global and
8638         plt_section_for_local functions.  Add do_plt_section_for_global
8639         and do_plt_section_for_local virtual functions.
8640         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
8641         clarifying comments.
8642         (Symbol::use_plt_offset): Handle IFUNC symbol.
8643         * object.cc (Sized_relobj::Sized_relobj): Initialize
8644         local_plt_offsets_.
8645         (Sized_relobj::local_has_plt_offset): New function.
8646         (Sized_relobj::local_plt_offset): New function.
8647         (Sized_relobj::set_local_plt_offset): New function.
8648         (Sized_relobj::do_count): Handle IFUNC symbol.
8649         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
8650         a bit away from input_shndx_ field.  Add set_is_func_symbol and
8651         is_ifunc_symbol functions.
8652         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
8653         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
8654         local_plt_offsets_ field.
8655         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
8656         * output.h (class Output_section_data): Add non-const
8657         output_section function.
8658         (class Output_data_got): Update declarations.
8659         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
8660         Add use_plt_offset parameter to global and local constructors.
8661         Change all callers.  Change local_sym_index_ field to 31 bits.
8662         Change GSYM_CODE and CONSTANT_CODE accordingly.
8663         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
8664         doing a static link don't set sh_link field.
8665         (Output_data_got::Got_entry::write): Use PLT offset if
8666         appropriate.
8667         (Output_data_got::add_global_plt): New function.
8668         (Output_data_got::add_local_plt): New function.
8669         * target-reloc.h (relocate_section): Handle IFUNC symbol.
8670         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
8671         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
8672         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
8673         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
8674         IFUNC conditional.
8675         * testsuite/ifunc-sel.h: New file.
8676         * testsuite/ifuncmain1.c: New file.
8677         * testsuite/ifuncmain1vis.c: New file.
8678         * testsuite/ifuncmod1.c: New file.
8679         * testsuite/ifuncdep2.c: New file.
8680         * testsuite/ifuncmain2.c: New file.
8681         * testsuite/ifuncmain3.c: New file.
8682         * testsuite/ifuncmod3.c: New file.
8683         * testsuite/ifuncmain4.c: New file.
8684         * testsuite/ifuncmain5.c: New file.
8685         * testsuite/ifuncmod5.c: New file.
8686         * testsuite/ifuncmain6pie.c: New file.
8687         * testsuite/ifuncmod6.c: New file.
8688         * testsuite/ifuncmain7.c: New file.
8689         * configure, testsuite/Makefile.in: Rebuild.
8690
8691 2010-08-18  Ian Lance Taylor  <iant@google.com>
8692
8693         * incremental.cc
8694         (Output_section_incremental_inputs::write_input_files): Add cast
8695         to avoid signed/unsigned comparison warning.
8696         (Output_section_incremental_inputs::write_info_blocks): Likewise.
8697
8698 2010-08-12  Cary Coutant  <ccoutant@google.com>
8699
8700         * common.cc (Sort_commons::operator()): Remove unnecessary code.
8701
8702 2010-08-13  Ian Lance Taylor  <iant@google.com>
8703
8704         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
8705
8706 2010-08-12  Cary Coutant  <ccoutant@google.com>
8707             Doug Kwan  <dougkwan@google.com>
8708
8709         * resolve.cc (Symbol_table::should_override): When a weak dynamic
8710         defintion overrides non-weak undef, remember that the original undef
8711         is not weak.
8712         * symtab.cc (Symbol_table::sized_write_global): For undef without
8713         an original weak binding, set binding to global in output.
8714         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
8715         * testsuite/Makefile.in: Regenerate.
8716         * testsuite/strong_ref_weak_def.sh: New file.
8717         * testsuite/strong_ref_weak_def_1.c: Ditto.
8718         * testsuite/strong_ref_weak_def_2.c: Ditto.
8719
8720 2010-08-12  Cary Coutant  <ccoutant@google.com>
8721
8722         * testsuite/incremental_test.sh: Rewrite.
8723         * testsuite/incremental_test_1.c: Rewrite.
8724         * testsuite/incremental_test_2.c: Rewrite.
8725
8726 2010-08-12  Cary Coutant  <ccoutant@google.com>
8727
8728         * arm.cc (Target_arm::got_size): Add const.
8729         (Target_arm::got_entry_count): New function.
8730         (Target_arm::plt_entry_count): New function.
8731         (Target_arm::first_plt_entry_offset): New function.
8732         (Target_arm::plt_entry_size): New function.
8733         (Output_data_plt_arm::entry_count): New function.
8734         (Output_data_plt_arm::first_plt_entry_offset): New function.
8735         (Output_data_plt_arm::get_plt_entry_size): New function.
8736         * i386.cc (Target_i386::got_size): Add const.
8737         (Target_i386::got_entry_count): New function.
8738         (Target_i386::plt_entry_count): New function.
8739         (Target_i386::first_plt_entry_offset): New function.
8740         (Target_i386::plt_entry_size): New function.
8741         (Output_data_plt_i386::entry_count): New function.
8742         (Output_data_plt_i386::first_plt_entry_offset): New function.
8743         (Output_data_plt_i386::get_plt_entry_size): New function.
8744         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
8745         find_incremental_inputs_sections.  Dump incremental_got_plt section.
8746         * incremental.cc: Include target.h.
8747         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
8748         parameter.  Adjust all callers.  Find incremental_got_plt section.
8749         (Incremental_inputs::create_data_sections): Create incremental_got_plt
8750         section.
8751         (Output_section_incremental_inputs::set_final_data_size): Calculate
8752         size of incremental_got_plt section.
8753         (Output_section_incremental_inputs::do_write): Write the
8754         incremental_got_plt section.
8755         (Got_plt_view_info): New struct.
8756         (Local_got_offset_visitor): New class.
8757         (Global_got_offset_visitor): New class.
8758         (Global_symbol_visitor_got_plt): New class.
8759         (Output_section_incremental_inputs::write_got_plt): New function.
8760         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
8761         Add parameter.  Adjust all callers.
8762         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8763         (Incremental_inputs::got_plt_section): New function.
8764         (Incremental_inputs::got_plt_section_): New data member.
8765         (Incremental_got_plt_reader): New class.
8766         * layout.cc (Layout::create_incremental_info_sections): Add the
8767         incremental_got_plt section.
8768         * object.h (Got_offset_list::get_list): New function.
8769         (Got offset_list::for_all_got_offsets): New function.
8770         (Sized_relobj::local_got_offset_list): New function.
8771         * powerpc.cc (Target_powerpc::got_size): Add const.
8772         (Target_powerpc::got_entry_count): New function.
8773         (Target_powerpc::plt_entry_count): New function.
8774         (Target_powerpc::first_plt_entry_offset): New function.
8775         (Target_powerpc::plt_entry_size): New function.
8776         (Output_data_plt_powerpc::entry_count): New function.
8777         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
8778         (Output_data_plt_powerpc::get_plt_entry_size): New function.
8779         * sparc.cc (Target_sparc::got_size): Add const.
8780         (Target_sparc::got_entry_count): New function.
8781         (Target_sparc::plt_entry_count): New function.
8782         (Target_sparc::first_plt_entry_offset): New function.
8783         (Target_sparc::plt_entry_size): New function.
8784         (Output_data_plt_sparc::entry_count): New function.
8785         (Output_data_plt_sparc::first_plt_entry_offset): New function.
8786         (Output_data_plt_sparc::get_plt_entry_size): New function.
8787         * symtab.h (Symbol::got_offset_list): New function.
8788         (Symbol_table::for_all_symbols): New function.
8789         * target.h (Sized_target::got_entry_count): New function.
8790         (Sized_target::plt_entry_count): New function.
8791         (Sized_target::plt_entry_size): New function.
8792         * x86_64.cc (Target_x86_64::got_size): Add const.
8793         (Target_x86_64::got_entry_count): New function.
8794         (Target_x86_64::plt_entry_count): New function.
8795         (Target_x86_64::first_plt_entry_offset): New function.
8796         (Target_x86_64::plt_entry_size): New function.
8797         (Output_data_plt_x86_64::entry_count): New function.
8798         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
8799         (Output_data_plt_x86_64::get_plt_entry_size): New function.
8800
8801 2010-08-12  Cary Coutant  <ccoutant@google.com>
8802
8803         * archive.cc: Include incremental.h.
8804         (Archive::Archive): Initialize incremental_info_.
8805         (Archive::include_member): Record archive members in incremental info.
8806         (Add_archive_symbols::run): Record begin and end of an archive in
8807         incremental info.
8808         (Lib_group::include_member): Record objects in incremental info.
8809         * archive.h (Incremental_archive_entry): Forward declaration.
8810         (Archive::set_incremental_info): New member function.
8811         (Archive::incremental_info): New member function.
8812         (Archive::Unused_symbol_iterator): New class.
8813         (Archive::unused_symbols_begin): New member function.
8814         (Archive::unused_symbols_end): New member function.
8815         (Archive::incremental_info_): New data member.
8816         * incremental-dump.cc (find_input_containing_global): New function.
8817         (dump_incremental_inputs): Dump new incremental info sections.
8818         * incremental.cc: Include symtab.h.
8819         (Output_section_incremental_inputs): New class.
8820         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
8821         new incremental info sections.
8822         (Sized_incremental_binary::do_check_inputs): Likewise.
8823         (Incremental_inputs::report_archive): Remove.
8824         (Incremental_inputs::report_archive_begin): New function.
8825         (Incremental_inputs::report_archive_end): New function.
8826         (Incremental_inputs::report_object): New function.
8827         (Incremental_inputs::finalize_inputs): Remove.
8828         (Incremental_inputs::report_input_section): New function.
8829         (Incremental_inputs::report_script): Rewrite.
8830         (Incremental_inputs::finalize): Do nothing but finalize string table.
8831         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8832         (Incremental_inputs::sized_create_inputs_section_data): Remove.
8833         (Incremental_inputs::create_data_sections): New function.
8834         (Incremental_inputs::relocs_entsize): New function.
8835         (Output_section_incremental_inputs::set_final_data_size): New function.
8836         (Output_section_incremental_inputs::do_write): New function.
8837         (Output_section_incremental_inputs::write_header): New function.
8838         (Output_section_incremental_inputs::write_input_files): New function.
8839         (Output_section_incremental_inputs::write_info_blocks): New function.
8840         (Output_section_incremental_inputs::write_symtab): New function.
8841         * incremental.h (Incremental_script_entry): Forward declaration.
8842         (Incremental_object_entry): Forward declaration.
8843         (Incremental_archive_entry): Forward declaration.
8844         (Incremental_inputs): Forward declaration.
8845         (Incremental_inputs_header_data): Remove.
8846         (Incremental_inputs_header): Remove.
8847         (Incremental_inputs_header_write): Remove.
8848         (Incremental_inputs_entry_data): Remove.
8849         (Incremental_inputs_entry): Remove.
8850         (Incremental_inputs_entry_write): Remove.
8851         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
8852         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
8853         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8854         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
8855         Likewise.
8856         (Incremental_input_entry): New class.
8857         (Incremental_script_entry): New class.
8858         (Incremental_object_entry): New class.
8859         (Incremental_archive_entry): New class.
8860         (Incremental_inputs::Incremental_inputs): Initialize new data members.
8861         (Incremental_inputs::report_inputs): Remove.
8862         (Incremental_inputs::report_archive): Remove.
8863         (Incremental_inputs::report_archive_begin): New function.
8864         (Incremental_inputs::report_archive_end): New function.
8865         (Incremental_inputs::report_object): Change prototype.
8866         (Incremental_inputs::report_input_section): New function.
8867         (Incremental_inputs::report_script): Change prototype.
8868         (Incremental_inputs::get_reloc_count): New function.
8869         (Incremental_inputs::set_reloc_count): New function.
8870         (Incremental_inputs::create_data_sections): New function.
8871         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8872         (Incremental_inputs::inputs_section): New function.
8873         (Incremental_inputs::symtab_section): New function.
8874         (Incremental_inputs::relocs_section): New function.
8875         (Incremental_inputs::get_stringpool): Add const.
8876         (Incremental_inputs::command_line): Add const.
8877         (Incremental_inputs::inputs): Remove.
8878         (Incremental_inputs::command_line_key): New function.
8879         (Incremental_inputs::input_file_count): New function.
8880         (Incremental_inputs::input_files): New function.
8881         (Incremental_inputs::relocs_entsize): New function.
8882         (Incremental_inputs::sized_create_inputs_section_data): Remove.
8883         (Incremental_inputs::finalize_inputs): Remove.
8884         (Incremental_inputs::Input_info): Remove.
8885         (Incremental_inputs::lock_): Remove.
8886         (Incremental_inputs::inputs_): Change type.
8887         (Incremental_inputs::inputs_map_): Remove.
8888         (Incremental_inputs::current_object_entry_): New data member.
8889         (Incremental_inputs::inputs_section_): New data member.
8890         (Incremental_inputs::symtab_section_): New data member.
8891         (Incremental_inputs::relocs_section_): New data member.
8892         (Incremental_inputs::reloc_count_): New data member.
8893         (Incremental_inputs_reader): New class.
8894         (Incremental_symtab_reader): New class.
8895         (Incremental_relocs_reader): New class.
8896         * layout.cc (Layout::finalize): Move finalization of incremental info
8897         and creation of incremental info sections to follow finalization of
8898         symbol table.  Set offsets for postprocessing sections.
8899         (Layout::create_incremental_info_sections): Call
8900         Incremental_inputs::create_data_sections.  Add incremental symtab
8901         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
8902         sections to layout after input sections.
8903         * layout.h (struct Timespec): Forward declaration.
8904         (Layout::incremental_inputs): Add const.
8905         (Layout::create_incremental_info_sections): Add parameter.
8906         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
8907         * object.cc: Include incremental.h.
8908         (Relobj::finalize_incremental_relocs): New function.
8909         (Sized_relobj::do_layout): Record input sections in incremental info.
8910         * object.h (Object::output_section): New function.
8911         (Object::output_section_offset): Moved from Relobj.
8912         (Object::get_incremental_reloc_base): New function.
8913         (Object::get_incremental_reloc_count): New function.
8914         (Object::do_output_section): New function.
8915         (Object::do_output_section_offset): Moved from Relobj.
8916         (Object::do_get_incremental_reloc_base): New function.
8917         (Object::do_get_incremental_reloc_count): New function.
8918         (Object::Object): Initialize new data members.
8919         (Relobj::output_section): Renamed do_output_section and moved to
8920         protected.
8921         (Relobj::output_section_offset): Moved to Object.
8922         (Relobj::do_get_incremental_reloc_base): New function.
8923         (Relobj::do_get_incremental_reloc_count): New function.
8924         (Relobj::allocate_incremental_reloc_counts): New function.
8925         (Relobj::count_incremental_reloc): New function.
8926         (Relobj::finalize_incremental_relocs): New function.
8927         (Relobj::next_incremental_reloc_index): New function.
8928         (Relobj::reloc_counts_): New data member.
8929         (Relobj::reloc_bases_): New data member.
8930         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
8931         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
8932         (Sized_relobj::incremental_relocs_scan): New function.
8933         (Sized_relobj::incremental_relocs_scan_reltype): New function.
8934         (Sized_relobj::incremental_relocs_write): New function.
8935         (Sized_relobj::incremental_relocs_write_reltype): New function.
8936         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
8937         incremental link.
8938         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
8939         archives and object files elsewhere.
8940         (Add_symbols::run): Report object files here.
8941         (Finish_group::run): Report end of archive at end of group.
8942         * reloc.cc: Include layout.h, incremental.h.
8943         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
8944         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
8945         (Sized_relobj::incremental_relocs_scan): New function.
8946         (Sized_relobj::incremental_relocs_scan_reltype): New function.
8947         (Sized_relobj::do_relocate_sections): Write incremental relocations.
8948         (Sized_relobj::incremental_relocs_write): New function.
8949         (Sized_relobj::incremental_relocs_write_reltype): New function.
8950         * script.cc (read_input_script): Rewrite test for incremental link.
8951         Change call to Incremental_inputs::report_script.
8952         * symtab.h (Symbol_table::first_global_index): New function.
8953         (Symbol_table::output_count): New function.
8954
8955 2010-08-12  Doug Kwan  <dougkwan@google.com>
8956
8957         * arm.cc (Target_arm::merge_object_attributes): Check command line
8958         options --no-wchar-size-warning and --no-enum-size-warning.
8959         * options.h (General_options): Add ld-compatible options
8960         --no-enum-size-warning and --no-wchar-size-warning.
8961
8962 2010-08-04  Ian Lance Taylor  <iant@google.com>
8963
8964         * x86_64.cc (Target_x86_64::Scan::local): Use
8965         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
8966         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
8967         (Target_x86_64::Scan::global): Likewise.
8968         (Target_x86_64::Relocate::relocate): Likewise.
8969         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
8970         Likewise.
8971
8972 2010-08-03  Cary Coutant  <ccoutant@google.com>
8973
8974         * merge.cc (Output_merge_string::do_add_input_section): Count strings
8975         to reserve space in merged_strings vector. Keep total input size
8976         for stats.
8977         (Output_merge_string::do_print_merge_stats): Print total input size.
8978         * merge.h (Output_merge_string): Add input_size_ field.
8979         * stringpool.cc (Stringpool_template::string_length): Move
8980         implementations out of Stringpool_template class and place in
8981         stringpool.h.
8982         * stringpool.h (string_length): Move out of Stringpool_template.
8983
8984 2010-08-03  Ian Lance Taylor  <iant@google.com>
8985
8986         PR 11712
8987         * layout.cc (relaxation_loop_body): If address of load segment is
8988         set, adjust address to include headers if possible.
8989
8990 2010-08-03  Ian Lance Taylor  <iant@google.com>
8991
8992         * version.cc (version_string): Bump to 1.10.
8993
8994 2010-08-03  Ian Lance Taylor  <iant@google.com>
8995
8996         PR 11805
8997         * layout.h (enum Output_section_order): Define.
8998         (class Layout): Update declarations.
8999         * layout.cc (Layout::get_output_section): Add order parameter.
9000         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
9001         is_first_non_relro parameters.  Change all callers.
9002         (Layout::choose_output_section): Likewise.
9003         (Layout::add_output_section_data): Likewise.
9004         (Layout::make_output_section): Likewise.  Set order.
9005         (Layout::default_section_order): New function.
9006         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
9007         * output.cc (Output_section::Output_section): Initialize order_.
9008         Don't initialize deleted fields.
9009         (Output_segment::Output_segment): Don't initialize deleted
9010         fields.
9011         (Output_segment::add_output_section_to_load): New function
9012         replacing add_output_section.  Change all callers to call this or
9013         add_output_section_to_nonload.
9014         (Output_segment::add_output_section_to_nonload): New function.
9015         (Output_segment::remove_output_section): Rewrite.
9016         (Output_segment::add_initial_output_data): Likewise.
9017         (Output_segment::has_any_data_sections): Likewise.
9018         (Output_segment::is_first_section_relro): Likewise.
9019         (Output_segment::maximum_alignment): Likewise.
9020         (Output_segment::has_dynamic_reloc): New function replacing
9021         dynamic_reloc_count.  Change all callers.
9022         (Output_segment::has_dynamic_reloc_list): New function replacing
9023         dynamic_reloc_count_list.  Change all callers.
9024         (Output_segment::set_section_addresses): Rewrite.
9025         (Output_segment::set_offset): Rewrite.
9026         (Output_segment::find_first_and_last_list): Remove.
9027         (Output_segment::set_tls_offsets): Rewrite.
9028         (Output_segment::first_section_load_address): Likewise.
9029         (Output_segment::output_section_count): Likewise.
9030         (Output_segment::section_with_lowest_load_address): Likewise.
9031         (Output_segment::write_section_headers): Likewise.
9032         (Output_segment::print_sections_to_map): Likewise.
9033         * output.h (class Output_data): Remove dynamic_reloc_count_
9034         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
9035         (Output_data::add_dynamic_reloc): Rewrite.
9036         (Output_data::has_dynamic_reloc): New function.
9037         (Output_data::dynamic_reloc_count): Remove.
9038         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
9039         is_last_relro_, is_first_non_relro_, is_interp_,
9040         is_dynamic_linker_section_ fields.  Add order and set_order
9041         functions.  Remove is_relro_local, set_is_relro_local,
9042         is_last_relro, set_is_last_relro, is_first_non_relro,
9043         set_is_first_non_relro functions, is_interp, set_is_interp,
9044         is_dynamic_linker_section, and set_is_dynamic_linker_section
9045         functions.
9046         (class Output_segment): Change Output_data_list from std::list to
9047         std:;vector.  Add output_lists_ field.  Remove output_data_ and
9048         output_bss_ fields.  Update declarations.
9049
9050 2010-08-02  Ian Lance Taylor  <iant@google.com>
9051
9052         * arm.cc (Target_arm::gc_process_relocs): Use typename.
9053         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
9054         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
9055
9056 2010-08-02  Ian Lance Taylor  <iant@google.com>
9057
9058         PR 11855
9059         * script.cc (Script_options::Script_options): Initialize
9060         symbol_definitions_ and symbol_references_.
9061         (Script_options::add_symbol_assignment): Update
9062         symbol_definitions_ and symbol_references_.
9063         (Script_options::add_symbol_reference): New function.
9064         (script_symbol): New function.
9065         * script.h (class Script_options): Add symbol_definitions_ and
9066         symbol_references_ fields.
9067         (Script_options::referenced_const_iterator): New type.
9068         (Script_options::referenced_begin): New function.
9069         (Script_options::referenced_end): New function.
9070         (Script_options::is_referenced): New function.
9071         (Script_options::any_unreferenced): New function.
9072         * script-c.h (script_symbol): Declare.
9073         * yyscript.y (exp): Call script_symbol.
9074         * symtab.cc: Include "script.h".
9075         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
9076         Change all callers.  Check symbols referenced by scripts.
9077         (Symbol_table::add_undefined_symbols_from_command_line): Add
9078         layout parameter.  Change all callers.
9079         (Symbol_table::do_add_undefined_symbols_from_command_line):
9080         Likewise.  Break out loop body.  Check symbols referenced by
9081         scripts.
9082         (Symbol_table::add_undefined_symbol_from_command_line): New
9083         function broken out of
9084         do_add_undefined_symbols_from_command_line.
9085         * symtab.h (class Symbol_table): Update declarations.
9086         * archive.cc: Include "layout.h".
9087         (Archive::should_include_member): Add layout parameter.  Change
9088         all callers.  Check for symbol mentioned in expression.
9089         * archive.h (class Archive): Update declaration.
9090         * object.cc (Sized_relobj::do_should_include_member): Add layout
9091         parameter.
9092         * object.h (Object::should_include_member): Add layout parameter.
9093         Change all callers.
9094         (Object::do_should_include_member): Add layout parameter.
9095         (class Sized_relobj): Update declaration.
9096         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
9097         parameter.
9098         * dynobj.h (class Sized_dynobj): Update declaration.
9099         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
9100         layout parameter.
9101         * plugin.h (class Sized_pluginobj): Update declaration.
9102
9103 2010-08-02  Ian Lance Taylor  <iant@google.com>
9104
9105         PR 11866
9106         * output.cc (Output_segment::set_offset): Search for the first and
9107         last sections rather than assuming that the list is in order.
9108         (Output_segment::find_first_and_last_list): New function.
9109         * output.h (class Output_segment): Update declarations.
9110         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
9111         (relro_strip_test_SOURCES): New variable.
9112         (relro_strip_test_DEPENDENCIES): New variable.
9113         (relro_strip_test_LDFLAGS): New variable.
9114         (relro_strip_test_LDADD): New variable.
9115         (relro_strip_test.so): New target.
9116
9117 2010-08-02  Ian Lance Taylor  <iant@google.com>
9118
9119         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
9120         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
9121         (Target_i386::got_tlsdesc_section): New function.
9122         (Target_i386::got_section): Create space for GOT entries for
9123         TLSDESC relocations.
9124         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
9125         R_386_TLS_GOTDESC.
9126         (Target_i386::Scan::global): Likewise.
9127         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
9128         using TLSDESC GOT.
9129         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
9130         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
9131         (Target_x86_64::got_tlsdesc_section): New function.
9132         (Target_x86_64::got_section): Create space for GOT entries for
9133         TLSDESC relocations.
9134         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
9135         R_386_TLS_GOTDESC.
9136         (Target_x86_64::Scan::global): Likewise.
9137         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
9138         using TLSDESC GOT.
9139
9140 2010-08-02  Ian Lance Taylor  <iant@google.com>
9141
9142         * testsuite/final_layout.sh: Use dc to convert from hex to
9143         decimal.
9144
9145 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
9146
9147         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
9148         paramter to the call to gold::gc_process_relocs.
9149         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
9150         paramter to the call to gold::gc_process_relocs.
9151         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
9152         parameter to the call to gold::gc_process_relocs.
9153         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
9154         template parameter to the call to gold::gc_process_relocs.
9155         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
9156         paramter to the call to gold::gc_process_relocs.
9157         * gc.h (get_embedded_addend_size): New function.
9158         (gc_process_relocs): Save the size of the reloc for use by ICF.
9159         * icf.cc (get_section_contents): Get the addend from the text section
9160         for SHT_REL relocation sections.
9161         * icf.h (Icf::Reloc_addend_size_info): New typedef.
9162         (Icf::Reloc_info): Add new member reloc_addend_size_info.
9163         * int_encoding.h (read_from_pointer): New overloaded function.
9164         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
9165         * testsuite/icf_sht_rel_addend_test.sh: New file.
9166         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
9167         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
9168
9169 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9170
9171         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
9172         * Makefile.in: Regenerate.
9173         * testsuite/Makefile.in: Regenerate.
9174
9175 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
9176
9177         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
9178         * gold/testsuite/debug_msg.cc: Likewise.
9179         * gold/testsuite/odr_violation1.cc
9180         * gold/testsuite/odr_violation2.cc
9181
9182 2010-07-21  Cary Coutant  <ccoutant@google.com>
9183
9184         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
9185         string, and length fields.
9186         (Output_merge_string::Merged_strings_list): New type.
9187         (Output_merge_string::Merged_strings_lists): New typedef.
9188         (Output_merge_string): Replace merged_strings_ with
9189         merged_strings_lists_.
9190         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
9191         Merged_strings_list per input object and section.  Don't store pointer
9192         to the string.  Don't store length with each merged string entry.
9193         (Output_merge_string::finalize_merged_data): Loop over list of merged
9194         strings lists.  Recompute length of each merged string.
9195
9196 2010-07-15  Cary Coutant  <ccoutant@google.com>
9197
9198         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
9199         here.
9200
9201 2010-07-14  Ian Lance Taylor  <iant@google.com>
9202
9203         * descriptors.cc (Descriptors::open): Report correct name in error
9204         message.
9205
9206 2010-07-13  Doug Kwan  <dougkwan@google.com>
9207
9208         * arm.cc (Arm_input_section::Arm_input_section): For a
9209         SHT_ARM_EXIDX section, always keeps the input sections.
9210         (Arm_input_section::set_exidx_section_link): New method.
9211         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
9212         has_errors_ to false.
9213         (Arm_exidx_input_section::has_errors,
9214         Arm_exidx_input_section::set_has_errors): New methods.
9215         (Arm_exidx_input_section::has_errors_): New data member.
9216         (Arm_relobj::get_exidx_shndx_list): New method.
9217         (Arm_output_section::append_text_sections_to_list): Do not skip
9218         section without SHF_EXECINSTR.
9219         (Arm_output_section::fix_exidx_coverage): Skip input sections with
9220         errors.
9221         (Arm_relobj::make_exidx_input_section): Add new parameter for text
9222         section header.  Make error messages more verbose.  Check for
9223         a non-executable section linked to an EXIDX section.
9224         (Arm_relobj::do_read_symbols): Remove error checking, which has been
9225         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
9226         check that there is no deferred EXIDX section if we exit early.
9227         Instead of not making an EXIDX section in case of an error, make one
9228         and set the has_errors flag of it.
9229         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
9230         in a relocatable link.
9231         (Target_arm::do_relax): Look for the EXIDX output section instead of
9232         assuming that it is called .ARM.exidx.
9233         (Target_arm::fix_exidx_coverage): Add a new parameter for input
9234         section list.  Do not check for SHF_EXECINSTR section flags but
9235         skip any input section with errors.
9236         * output.cc (Output_section::Output_section): Initialize
9237         always_keeps_input_sections_ to false.
9238         (Output_section::add_input_section): Check for
9239         always_keeps_input_sections_.
9240         *  output.h (Output_section::always_keeps_input_sections,
9241         Output_section::set_always_keeps_input_sections): New methods.
9242         (Output_section::always_keeps_input_sections): New data member.
9243
9244 2010-07-13  Rafael Espindola  <espindola@google.com>
9245
9246         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
9247         * fileread.h (Input_file): Add try_extra_search_path and find_file.
9248
9249 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
9250             Ian Lance Taylor  <iant@google.com>
9251
9252         * output.h (Output_section_lookup_maps::add_merge_section):
9253         Correct check of whether value was inserted.
9254         (Output_section_lookup_maps::add_merge_input_section): Likewise.
9255         (Output_section_lookup_maps::add_relaxed_input_section):
9256         Likewise.
9257         * arm.cc (Target_arm::got_section): Remove used local os.
9258         * i386.cc (Target_i386::got_section): Likewise.
9259         * x86_64.cc (Target_x86_64::got_section): Likewise.
9260         * sparc.cc (Target_sparc::got_section): Likewise.
9261         (Target_sparc::relocate): Remove unused local have_got_offset.
9262         * powerpc.cc (Target_powerpc::relocate): Likewise.
9263
9264 2010-07-13  Ian Lance Taylor  <iant@google.com>
9265
9266         * compressed_output.cc (zlib_decompress): Fix signature in
9267         !HAVE_ZLIB_H case.
9268
9269         * archive.cc (Archive::include_member): Unlock an external member
9270         of a thin archive.  Don't bother to delete an object we know is
9271         NULL.
9272
9273 2010-07-12  Cary Coutant  <ccoutant@google.com>
9274
9275         * compressed_output.cc (zlib_decompress): New function.
9276         (get_uncompressed_size): New function.
9277         (decompress_input_section): New function.
9278         * compressed_output.h (get_uncompressed_size): New function.
9279         (decompress_input_section): New function.
9280         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
9281         Handle compressed debug sections.
9282         * layout.cc (is_compressed_debug_section): New function.
9283         (Layout::output_section_name): Map compressed section names to
9284         canonical names.
9285         * layout.h (is_compressed_debug_section): New function.
9286         (is_debug_info_section): Recognize compressed debug sections.
9287         * merge.cc: Include compressed_output.h.
9288         (Output_merge_data::do_add_input_section): Handle compressed
9289         debug sections.
9290         (Output_merge_string::do_add_input_section): Handle compressed
9291         debug sections.
9292         * object.cc: Include compressed_output.h.
9293         (Sized_relobj::Sized_relobj): Initialize new data members.
9294         (build_compressed_section_map): New function.
9295         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
9296         * object.h (Object::section_is_compressed): New method.
9297         (Object::do_section_is_compressed): New method.
9298         (Sized_relobj::Compressed_section_map): New type.
9299         (Sized_relobj::do_section_is_compressed): New method.
9300         (Sized_relobj::compressed_sections_): New data member.
9301         * output.cc (Output_section::add_input_section): Handle compressed
9302         debug sections.
9303         * reloc.cc: Include compressed_output.h.
9304         (Sized_relobj::write_sections): Handle compressed debug sections.
9305
9306 2010-07-08  Cary Coutant  <ccoutant@google.com>
9307
9308         * resolve.cc (Symbol_table::resolve): Remember whether undef was
9309         weak when resolving to a dynamic def.
9310         (Symbol_table::should_override): Add adjust_dyndef flag; set it
9311         for weak undef/dynamic def cases. Adjust callers.
9312         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
9313         undef_binding_weak_.
9314         (Symbol_table::sized_write_globals): Adjust symbol binding.
9315         (Symbol_table::sized_write_symbol): Add binding parameter.
9316         * symtab.h (Symbol::set_undef_binding): New method.
9317         (Symbol::is_undef_binding_weak): New method.
9318         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
9319         (Symbol_table::should_override): Add new parameter.
9320         (Symbol_table::sized_write_symbol): Add new parameter.
9321
9322         * testsuite/weak_undef_file1.cc: Add new test case.
9323         * testsuite/weak_undef_file2.cc: Fix header comment.
9324         * testsuite/weak_undef_test.cc: Add new test case.
9325
9326 2010-06-29  Doug Kwan  <dougkwan@google.com>
9327
9328         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
9329         Initialize USE_SYMBOL_.
9330         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
9331         definition.
9332         (Arm_reloc_property::uses_symbol_): New data member declaration.
9333         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
9334         uses symbol value and symbol is undefined but not weakly undefined.
9335
9336 2010-06-28  Rafael Espindola  <espindola@google.com>
9337
9338         * plugin.cc (Plugin::load): Use dlerror.
9339
9340 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
9341
9342         * symtab.cc (detect_odr_violations): When reporting an ODR
9343         violation, report an object where the symbol is defined.
9344
9345 2010-06-25  Doug Kwan  <dougkwan@google.com>
9346
9347         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
9348         (Target_arm::section_may_have_icf_unsafe_pointers): New method
9349         definition.
9350         (Target_arm::Scan::local_reloc_may_be_function_pointer,
9351         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
9352         target hook to detect function points.
9353         (Target_arm::Scan::possible_function_pointer_reloc): New method.
9354         * icf.h (Icf::check_section_for_function_pointers): Change type of
9355         parameter SECTION_NAME to const reference to std::string.  Use
9356         target hook to determine if section may have unsafe pointers.
9357         * target.h (Target::section_may_have_icf_unsafe_pointers): New
9358         method definition.
9359
9360 2010-06-21  Rafael Espindola  <espindola@google.com>
9361
9362         * fileread.cc (Input_file::find_fie): New
9363         (Input_file::open): Use Input_file::find_fie.
9364         * fileread.h (Input_file::find_fie): New
9365         * plugin.cc (set_extra_library_path): New.
9366         (Plugin::load): Add set_extra_library_path to the transfer vector.
9367         (Plugin_manager::set_extra_library_path): New.
9368         (Plugin_manager::add_input_file): Use the extra search path if set.
9369         (set_extra_library_path(): New.
9370         * plugin.h (Plugin_manager): Add set_extra_library_path and
9371         extra_search_path_.
9372
9373 2010-06-19  Cary Coutant  <ccoutant@google.com>
9374
9375         * layout.cc (gdb_sections): Add .debug_types.
9376         (lines_only_debug_sections): Likewise.
9377
9378 2010-06-18  Rafael Espindola  <espindola@google.com>
9379
9380         * plugin.cc (add_input_file,add_input_library)
9381         (Plugin_manager::add_input_file): Make filename arguments const.
9382         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
9383         const.
9384
9385 2010-06-16  Doug Kwan  <dougkwan@google.com>
9386
9387         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
9388         .ARM.attributes section if we have not merged any input
9389         attributes sections.
9390
9391 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9392
9393         * arm.cc: Allow combining objects with no EABI version
9394         information.
9395
9396 2010-06-15  Rafael Espindola  <espindola@google.com>
9397
9398         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
9399
9400 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9401
9402         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
9403         (struct iovec): Correct !HAVE_READV definition.
9404
9405 2010-06-10  Cary Coutant  <ccoutant@google.com>
9406
9407         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
9408         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
9409         reloc sections.
9410         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
9411
9412         PR 11683
9413         * symtab.h (Symbol::is_placeholder): New member function.
9414         * target-reloc.h (relocate_section): Check for placeholder symbols.
9415
9416         * testsuite/Makefile.am (plugin_test_8): New test.
9417         (plugin_test_9): New test.
9418         * testsuite/Makefile.in: Regenerate.
9419
9420 2010-06-09  Nick Clifton  <nickc@redhat.com>
9421
9422         * yyscript.y (input_list_element): Allow strings prefixed with
9423         the '-' character.  Treat these as libraries.
9424         * script.cc (script_add_library): New function.  Adds a library
9425         specified by "-l<name>" found in an input script.
9426         * script-c.h: Add prototype for script_add_library.
9427
9428 2010-06-07  Doug Kwan  <dougkwan@google.com>
9429
9430         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
9431         Restrict stub-group size to be within long conditional branch
9432         range when working around cortex-A8 erratum.
9433
9434 2010-06-07  Damien Diederen  <dd@crosstwine.com>
9435
9436         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
9437         #ifdef typo.
9438
9439 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
9440
9441         PR gold/11658
9442         * output.cc
9443         (Output_section::Input_section_sort_entry::compare_section_ordering):
9444         Change to return non-zero correctly.
9445         (Output_section::Input_section_sort_section_order_index_compare
9446         ::operator()): Change to fix ambiguity in comparisons.
9447
9448 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
9449
9450         * gold.h (is_wildcard_string): New function.
9451         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
9452         (Layout::layout_eh_frame): Ditto.
9453         (Layout::find_section_order_index): New method.
9454         (Layout::read_layout_from_file): New method.
9455         * layout.h (Layout::find_section_order_index): New method.
9456         (Layout::read_layout_from_file): New method.
9457         (Layout::input_section_position_): New private member.
9458         (Layout::input_section_glob_): New private member.
9459         * main.cc (main): Call read_layout_from_file here.
9460         * options.h (--section-ordering-file): New option.
9461         * output.cc (Output_section::input_section_order_specified_): New
9462         member.
9463         (Output_section::Output_section): Initialize new member.
9464         (Output_section::add_input_section): Add new parameter.
9465         Keep input sections when --section-ordering-file is used.
9466         (Output_section::set_final_data_size): Sort input sections when
9467         section ordering file is specified.
9468         (Output_section::Input_section_sort_entry): Add new parameter.
9469         Check sorting type.
9470         (Output_section::Input_section_sort_entry::compare_section_ordering):
9471         New method.
9472         (Output_section::Input_section_sort_compare::operator()): Change to
9473         consider section_order_index.
9474         (Output_section::Input_section_sort_init_fini_compare::operator()):
9475         Change to consider section_order_index.
9476         (Output_section::Input_section_sort_section_order_index_compare
9477         ::operator()): New method.
9478         (Output_section::sort_attached_input_sections): Change to sort
9479         according to section order when specified.
9480         (Output_section::add_input_section<32, true>): Add new parameter.
9481         (Output_section::add_input_section<64, true>): Add new parameter.
9482         (Output_section::add_input_section<32, false>): Add new parameter.
9483         (Output_section::add_input_section<64, false>): Add new parameter.
9484         * output.h (Output_section::add_input_section): Add new parameter.
9485         (Output_section::input_section_order_specified): New
9486         method.
9487         (Output_section::set_input_section_order_specified): New method.
9488         (Input_section::Input_section): Initialize section_order_index_.
9489         (Input_section::section_order_index): New method.
9490         (Input_section::set_section_order_index): New method.
9491         (Input_section::section_order_index_): New member.
9492         (Input_section::Input_section_sort_section_order_index_compare): New
9493         struct.
9494         (Output_section::input_section_order_specified_): New member.
9495         * script-sections.cc (is_wildcard_string): Delete and move modified
9496         method to gold.h.
9497         (Output_section_element_input::Output_section_element_input): Modify
9498         call to is_wildcard_string.
9499         (Output_section_element_input::Input_section_pattern
9500         ::Input_section_pattern): Ditto.
9501         (Output_section_element_input::Output_section_element_input): Ditto.
9502         * testsuite/Makefile.am (final_layout): New test case.
9503         * testsuite/Makefile.in: Regenerate.
9504         * testsuite/final_layout.cc: New file.
9505         * testsuite/final_layout.sh: New file.
9506
9507 2010-06-01  Rafael Espindola  <espindola@google.com>
9508
9509         * plugin.cc (Plugin::load): Pass the output name to the plugin.
9510
9511 2010-06-01  Rafael Espindola  <espindola@google.com>
9512
9513         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
9514         visibility of symbols.
9515
9516 2010-05-27  Doug Kwan  <dougkwan@google.com>
9517
9518         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
9519         from start of output section instead of address for a local symbol
9520         in a merged or relaxed section when doing a relocatable link.
9521
9522 2010-05-26  Rafael Espindola  <espindola@google.com>
9523
9524         PR 11604
9525         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
9526         adding sections the garbage collector removed.
9527         * gold/testsuite/Makefile.am: Add test.
9528         * gold/testsuite/Makefile.in: Regenerate.
9529         * gold/testsuite/plugin_test_7.sh: New.
9530         * gold/testsuite/plugin_test_7_1.c: New.
9531         * gold/testsuite/plugin_test_7_2.c: New.
9532
9533 2010-05-26  Rafael Espindola  <espindola@google.com>
9534
9535         * script-sections.cc (Output_section_definition::set_section_addresses):
9536         Check for --section-start.
9537
9538 2010-05-26  Doug Kwan  <dougkwan@google.com>
9539
9540         * arm.cc (Arm_scan_relocatable_relocs): New class.
9541         (Target_arm::relocate_special_relocatable): New method.
9542         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
9543         (Arm_relocate_functions::thumb_branch_common): Same.
9544         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
9545         instead of Default_scan_relocatable_relocs.
9546         * target-reloc.h (relocate_for_relocatable): Let target handle
9547         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
9548         * target.h (Sized_target::relocate_special_relocatable): New method.
9549
9550 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9551
9552         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
9553
9554 2010-05-23  Doug Kwan  <dougkwan@google.com>
9555
9556         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
9557         instead of a cast.
9558         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
9559         with a direct branch, not a conditional branch, to a stub.
9560         * merge.cc (Output_merge_base::record_input_section): New method
9561         defintion.
9562         (Output_merge_data::do_add_input_section): Record input section if
9563         keeps-input-sections flag is set.
9564         (Output_merge_string::do_add_input_section): Ditto.
9565         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
9566         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
9567         INPUT_SECTIONS_.
9568         (Output_merge_base::keeps_input_sections,
9569         Output_merge_base::set_keeps_input_sections,
9570         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
9571         method definitions.
9572         (Output_merge_base::Input_sections): New type declaration.
9573         (Output_merge_base::input_sections_begin,
9574         Output_merge_base::input_sections_end,
9575         Output_merge_base::do_set_keeps_input_sections): New method definitions.
9576         (Output_merge_base::bool keeps_input_sections_,
9577         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
9578         Output_merge_base::input_sections_): New data members.
9579         (Output_merge_data::do_set_keeps_input_sections): New method
9580         defintion.
9581         (Output_merge_string::do_set_keeps_input_sections): Ditto.
9582         * output.cc (Output_section::Input_section::relobj): Move method
9583         defintion from class declaration to here and handle merge sections.
9584         (Output_section::Input_section::shndx): Ditto.
9585         (Output_section::Output_section): Remove initializations of removed
9586         data members and initialize new data member LOOKUP_MAPS_.
9587         (Output_section::add_input_section): Set keeps-input-sections flag
9588         for a newly created merge output section as appropriate.  Adjust code
9589         to use Output_section_lookup_maps class.
9590         (Output_section::add_relaxed_input_section): Adjst code for lookup
9591         maps code refactoring.
9592         (Output_section::add_merge_input_section): Add a new parameter
9593         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
9594         class.  If adding input section to a newly created merge output
9595         section fails, remove the new merge section.
9596         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
9597         Adjust code for use of the Output_section_lookup_maps class.
9598         (Output_section::find_merge_section): Ditto.
9599         (Output_section::build_lookup_maps): New method defintion.
9600         (Output_section::find_relaxed_input_section): Adjust code to use
9601         Output_section_lookup_maps class.
9602         (Output_section::get_input_sections): Export merge sections.  Adjust
9603         code to use Output_section_lookup_maps class.
9604         (Output_section:::add_script_input_section): Adjust code to use
9605         Output_section_lookup_maps class.  Update lookup maps for merge
9606         sections also.
9607         (Output_section::discard_states): Use Output_section_lookup_maps.
9608         (Output_section::restore_states): Same.
9609         * output.h (Merge_section_properties): Move class defintion out of
9610         Output_section.
9611         (Output_section_lookup_maps): New class.
9612         (Output_section::Input_section::is_merge_section): New method
9613         defintion.
9614         (Output_section::Input_section::relobj): Move defintion out of class
9615         defintion.  Declare method only.
9616         (Output_section::Input_section::shndx): Ditto.
9617         (Output_section::Input_section::output_merge_base): New method defintion.
9618         (Output_section::Input_section::u2_.pomb): New union field.
9619         (Output_section::Merge_section_by_properties_map,
9620         Output_section::Output_section_data_by_input_section_map,
9621         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
9622         Remove types.
9623         (Output_section::add_merge_input_section): Add new parameter
9624         KEEPS_INPUT_SECTIONS.
9625         (Output_section::build_lookup_maps): New method declaration.
9626         (Output_section::merge_section_map_,
9627         Output_section::merge_section_by_properties_map_,
9628         Output_section::relaxed_input_section_map_,
9629         Output_section::is_relaxed_input_section_map_valid_): Remove data
9630         members.
9631         (Output_section::lookup_maps_): New data member.
9632
9633 2010-05-21  Doug Kwan  <dougkwan@google.com>
9634
9635         PR gold/11619
9636         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
9637         avoid a compilation error.
9638
9639 2010-05-19  Rafael Espindola  <espindola@google.com>
9640
9641         * script-sections.cc (Output_section_definition::allocate_to_segment):
9642         Update the phdrs_list even when the output section is NULL.
9643         * testsuite/Makefile.am: Add test.
9644         * testsuite/Makefile.in: Regenerate.
9645         * testsuite/script_test_9.cc: New.
9646         * testsuite/script_test_9.sh: New.
9647         * testsuite/script_test_9.t: New.
9648
9649 2010-05-19  Doug Kwan  <dougkwan@google.com>
9650
9651         * arm.cc (Arm_input_section::original_size): New method.
9652         (Arm_input_section::do_addralign): Add a cast.
9653         (Arm_input_section::do_output_offset): Remove static cast.
9654         (Arm_input_section::original_addralign,
9655          Arm_input_section::original_size_): Change type to uint32_t.
9656         (Arm_input_section::init): Add safe casts for section alignment
9657         and size.
9658         (Arm_input_section::set_final_data_size): Do not set address and
9659         offset of stub table.
9660         (Arm_output_section::fix_exidx_coverage): Change use of of
9661         Output_section::Simple_input_section to that of
9662         Output_section::Input_section.
9663         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
9664         except for the first pass.
9665         * output.cc (Output_section::get_input_sections): Change type of
9666         input_sections to std::list<Input_section>.
9667         (Output_section::add_script_input_section): Rename from
9668         Output_section::add_simple_input_section.  Change type of SIS
9669         parameter from Simple_input_section to Input_section.
9670         * output.h (Output_section::Simple_input_section): Remove class.
9671         (Output_section::Input_section): Change class visibility to public.
9672         (Output_section::Input_section::addralign): Use stored alignments
9673         for special input sections if set.
9674         (Output_section::Input_section::set_addralign): New method.
9675         (Output_section::get_input_sections): Change parameter type from
9676         list of Simple_input_section to list of Input_section.
9677         (Output_section::add_script_input_section): Rename from
9678         Output_section::add_simple_input_section. Change first parameter's
9679         type from Simple_input_section to Input_section and remove the
9680         second and third parameters.
9681         * script-sections.cc (Input_section::Input_section_list): Change
9682         type to list of Output_section::Input_section/
9683         (Input_section_info::Input_section_info): Change parameter type of
9684         INPUT_SECTION to Output_section::Input_section.
9685         (Input_section_info::input_section): Change return type.
9686         (Input_section_info::input_section_): Change type to
9687         Output_section::Input_section.
9688         (Output_section_element_input::set_section_addresses): Adjust code
9689         to use Output_section::Input_section instead of
9690         Output_section::Simple_input_section.  Adjust code for renaming
9691         of Output_section::add_simple_input_section.
9692         (Orphan_output_section::set_section_addresses): Ditto.
9693
9694 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9695
9696         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
9697         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
9698
9699 2010-05-18  Rafael Espindola  <espindola@google.com>
9700
9701         * options.cc (General_options::finalize): Handle -nostdlib.
9702         * options.h (nostdlib): New option.
9703         * script.cc (script_add_search_dir): Handle -nostdlib.
9704
9705 2010-05-12  Doug Kwan  <dougkwan@google.com>
9706
9707         * arm.cc (Target_arm::do_finalize_sections): Create an empty
9708         attributes section only if there no attributes section after merging.
9709         (Target_arm::merge_object_attributes): Move value of
9710         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
9711         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
9712         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
9713         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
9714         and arm_attr_merge_7.stdout.
9715         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
9716         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
9717         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
9718         arm_attr_merge_7b.o): New rules.
9719         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
9720         arm_attr_merge_7
9721         * testsuite/Makefile.in: Regenerate.
9722         * testsuite/arm_attr_merge.sh: New file.
9723         * testsuite/arm_attr_merge_[67][ab].s: Same.
9724
9725 2010-05-05  Nick Clifton  <nickc@redhat.com>
9726
9727         * po/es.po: Updated Spanish translation.
9728
9729 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
9730
9731         * Makefile.am (install-exec-local): Properly install gold as
9732         default cross linker.
9733         * Makefile.in: Regenerated.
9734
9735 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
9736             Nick Clifton  <nickc@redhat.com>
9737
9738         * configure.ac (install_as_default): Define and set to false
9739         unless --enable-gold or --enable-gold=both/gold has been
9740         specified.
9741         * configure: Regenerate.
9742
9743         * Makefile.am (install-exec-local): Install the executable as
9744         'ld.gold'.  If install_as_default is true then also install it as
9745         'ld'.
9746         * Makefile.in: Regenerated.
9747
9748 2010-04-24  Ian Lance Taylor  <iant@google.com>
9749
9750         * layout.cc (Layout::layout_reloc): In relocatable link don't
9751         combine reloc sections for grouped sections.
9752
9753 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
9754
9755         * gc.h (gc_process_relocs): Pass information on relocs pointing to
9756         sections that are not ordinary to icf.
9757         * icf.cc (get_section_contents): Handle relocation pointing to section
9758         with no object or shndx information.
9759         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
9760         * testsuite/Makefile.in: Regenerate.
9761         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
9762         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
9763
9764 2010-04-22  Ian Lance Taylor  <iant@google.com>
9765
9766         * expression.cc (Expression::Expression_eval_info): Add
9767         result_alignment_pointer field.
9768         (Expression::eval_with_dot): Add result_alignment_pointer
9769         parameter.  Change all callers.
9770         (Expression::eval_maybe_dot): Likewise.
9771         (class Binary_expression): Add alignment_pointer parameter to
9772         left_value and right_value.  Change all callers.
9773         (BINARY_EXPRESSION): Set result alignment.
9774         (class Trinary_expression): Add alignment_pointer parameter to
9775         arg2_value and arg3_value.  Change all callers.
9776         (Trinary_cond::value): Set result alignment.
9777         (Max_expression::value, Min_expression::value): Likewise.
9778         (Align_expression::value): Likewise.
9779         * script-sections.cc (class Sections_element): Add dot_alignment
9780         parameter to set_section_addresses virtual function.  Update
9781         instantiations.
9782         (class Output_section_element): Likewise.
9783         (Script_sections::create_segments): Add dot_alignment parameter.
9784         Change all callers.
9785         (Script_sections::create_segments_from_phdrs_clause): Likewise.
9786         (Script_sections::set_phdrs_clause_addresses): Likewise.
9787         * script-sections.h: Update declarations.
9788         * script.h: Update declarations.
9789         * output.h (Output_segment::set_minimum_p_align): Don't decrease
9790         min_p_align.
9791         * testsuite/script_test_3.t: Set large alignment.
9792         * testsuite/script_test_3.sh: Make sure that at least one LOAD
9793         segment has expected alignment.
9794
9795 2010-04-22  Nick Clifton  <nickc@redhat.com>
9796
9797         * po/gold.pot: Updated by the Translation project.
9798         * po/vi.po: Updated Vietnamese translation.
9799
9800 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
9801
9802         * testsuite/Makefile.am (check_PROGRAMS): Add
9803         icf_virtual_function_folding_test.
9804         * testsuite/Makefile.in: Regenerated.
9805
9806 2010-04-15  Andrew Haley  <aph@redhat.com>
9807
9808         * options.h (merge_exidx_entries): New option.
9809         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
9810         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
9811         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
9812         (Target_arm::merge_exidx_entries): New function.
9813         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
9814         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
9815         to Arm_exidx_fixup constructor.
9816         Add new arg, merge_exidx_entries.
9817         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
9818         Arm_output_section::fix_exidx_coverage.
9819
9820 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
9821
9822         * icf.cc (get_section_contents): Check for preemptible functions.
9823         Ignore addend when appropriate.
9824         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
9825         section folded.
9826         (add_from_relobj): Check for section folded.
9827         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
9828         * symtab.h (should_add_dynsym_entry): Add new parameter.
9829         * target-reloc.h (scan_relocs): Check for section folded.
9830         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
9831         Check reloc types for function pointers in shared objects.
9832         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
9833         case.
9834         (icf_preemptible_functions_test): New test case.
9835         (icf_string_merge_test): New test case.
9836         * testsuite.Makefile.in: Regenerate.
9837         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
9838         bar_glob.  Refactor code.
9839         * testsuite/icf_preemptible_functions_test.cc: New file.
9840         * testsuite/icf_preemptible_functions_test.sh: New file.
9841         * testsuite/icf_string_merge_test.cc: New file.
9842         * testsuite/icf_string_merge_test.sh: New file.
9843         * testsuite/icf_virtual_function_folding_test.cc: New file.
9844         * testsuite/icf_virtual_function_folding_test.sh: New file.
9845
9846 2010-04-14  Doug Kwan  <dougkwan@google.com>
9847
9848         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
9849         for local symbol recounting if we remove a section due to ICF.
9850         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
9851         there are no regular objects in input.
9852
9853 2010-04-13  Doug Kwan  <dougkwan@google.com>
9854
9855         * arm.cc (Arm_input_section::set_final_data_size): Compute
9856         accurate final data size instead of using current data size.
9857
9858 2010-04-09  Doug Kwan  <dougkwan@google.com>
9859
9860         * layout.cc (Layout::choose_output_section): Handle script section
9861         types.
9862         (Layout::make_output_section_for_script): Add section type parameter.
9863         Handle script section types.
9864         * layout.h (Layout::make_output_section_for_script): Add section
9865         type parameter.
9866         * output.cc (Output_section::Output_section): Initialize data member
9867         is_noload_.
9868         (Output_section::do_reset_address_and_file_offset): Do not set address
9869         to 0 if section is a NOLOAD section.
9870         * output.h (Output_section::is_noload): New method.
9871         (Output_section::set_is_noload): Ditto.
9872         (Output_section::is_noload_): New data member.
9873         * script-c.h (Script_section_type): New enum type.
9874         (struct Parser_output_section_header): Add new file section_type.
9875         * script-sections.cc (Sections_element::output_section_name): Add
9876         parameter for returning script section type.
9877         (Output_section_definition::output_section_name): Ditto.
9878         (Output_section_definition::section_type)P; New method.
9879         (Output_section_definiton::script_section_type_name): Ditto.
9880         (Output_section_definition::script_section_type_): New data member.
9881         (Output_section_definition::Output_section_definition): Initialize
9882         data member Output_section_definition::script_section_type_.
9883         (Output_section_definition::create_sections): Pass script section type
9884         to Layout::make_output_section_for_script.
9885         (Output_section_definition::output_section_name): Return script
9886         section type to caller.
9887         (Output_section_definition::set_section_address): Do not advance
9888         dot value and load address if section type is NOLOAD.  Set address
9889         of NOLOAD sections regardless of section flags.
9890         (Output_section_definition::print): Print section type if it is
9891         not SCRIPT_SECTION_TYPE_NONE.
9892         (Output_section_definition::section_type): New method.
9893         (Output_section_definition::script_section_type_name): Ditto.
9894         (Script_sections::output_section_name): Add new parameter
9895         PSECTION_TYPE for returning script section type.  Pass it to
9896         section elements.  Handle discard sections.
9897         (Sort_output_sections::operator()): Handle NOLOAD sections.
9898         * script-sections.h (Script_sections::Section_type): New enum type.
9899         (Script_sections::output_section_name): Add a new parameter for
9900         returning script section type.
9901         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
9902         INFO and NOLOAD.
9903         * yyscript.y (union): Add new field SECTION_TYPE.
9904         (COPY, DSECT, INFO, NOLOAD): New tokens.
9905         (opt_address_and_section_type): Change type to output_section_header.
9906         (section_type): New non-terminal
9907         (section_header): Handle section type.
9908         (opt_address_and_section_type): Return section type value.
9909
9910 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
9911
9912         * testsuite/plugin_common_test_1.c (foo): Add prototype.
9913         * testsuite/plugin_common_test_2.c (foo): Likewise.
9914
9915 2010-04-08  Doug Kwan  <dougkwan@google.com>
9916
9917         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
9918         Output_merge_data.
9919         * output.cc (Output_section::add_merge_input_section): Simplify
9920         code and return status of Output_merge_base::add_input_section.
9921         Update merge section map only if Output_merge_base::add_input_section
9922         returns true.
9923
9924 2010-04-07  Doug Kwan  <dougkwan@google.com>
9925
9926         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
9927         if section is marked as containing instructions but has no mapping
9928         symbols.
9929         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
9930         correct section index.
9931         (Arm_relobj::find_linked_text_section): Ditto.
9932
9933 2010-04-07  Cary Coutant  <ccoutant@google.com>
9934
9935         * archive.cc (include_member): Destroy Read_symbols_data object before
9936         releasing file.
9937         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
9938         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
9939         (Read_symbols_data::~Read_symbols_data) New destructor.
9940         (Section_relocs::Section_relocs) New constructor.
9941         (Section_relocs::~Section_relocs) New destructor.
9942         (Read_relocs_data::Read_relocs_data) New constructor.
9943         (Read_relocs_data::~Read_relocs_data) New destructor.
9944         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
9945         pointers to NULL after deleting.
9946
9947 2010-04-07  Doug Kwan  <dougkwan@google.com>
9948
9949         * arm.cc: Replace "endianity" with "endianness" in comments.
9950         (Arm_exidx_cantunwind): Ditto.
9951         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
9952         (Arm_relobj::merge_flags_and_attributes): New method.
9953         (Arm_relobj::merge_flags_and_attributes_): New data member.
9954         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
9955         (Arm_relobj::scan_sections_for_stubs): Ditto.
9956         (Arm_relobj::do_read_symbols): Check to see if we really want to
9957         merge processor-specific flags and attributes.  Exit early if
9958         an object is empty except for section names and the undefined symbol.
9959         (Target_arm::do_finalize_sections): Move check for ELF format to
9960         Arm_relobj::do_read_symbols.  Merge processor specific flags and
9961         attributes from a regular object only when we have determined that
9962         it is aapropriate.  Do not create an .ARM.attributes section in
9963         output if there is no regular input object.
9964         (Target_arm::merge_processor_specific_flags): Check
9965         --warn-mismatch before printing any error.
9966         (Target_arm::merge_object_attributes): Ditto.
9967         * gold.cc (queue_middle_tasks): Handle the case in which there is
9968         no regular object in input.
9969         * options.cc (General_options::parse_EB): New method.
9970         (General_options::parse_EL): Same.
9971         (General_options::General_options): Initialize endianness_.
9972         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
9973         New options.
9974         (General_options::Endianness): New enum.
9975         (General_options::endianness): New method.
9976         (General_options::endianness_): New data member.
9977         * parameters.cc (Parameters::set_options): Check target endianness.
9978         (Parameters::set_target_once): Ditto.
9979         (Parameters::check_target_endianness): New method.
9980         (parameters_force_valid_target): If either -EL or -EB is specified,
9981         use it to define endianness of default target.
9982         * parameters.h (Parameters::check_target_endianness): New method
9983         declaration.
9984         * target.h (class Target): Change "endianity" to "endianness"
9985         in comments.
9986
9987 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9988
9989         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
9990         * configure: Regenerate.
9991         * Makefile.in: Regenerate.
9992         * testsuite/Makefile.in: Regenerate.
9993
9994 2010-04-06  Cary Coutant  <ccoutant@google.com>
9995
9996         gcc PR lto/42757
9997         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
9998         prevailing definitions of common symbols.
9999         * testsuite/plugin_test_6.sh: New test case.
10000         * testsuite/plugin_common_test_1.c: New test case.
10001         * testsuite/plugin_common_test_2.c: New test case.
10002         * testsuite/Makefile.am (plugin_test_6): New test case.
10003         * testsuite/Makefile.in: Regenerate.
10004
10005 2010-04-06  Nick Clifton  <nickc@redhat.com>
10006
10007         * po/vi.po: New Vietnamese translation.
10008
10009 2010-03-30  Doug Kwan  <dougkwan@google.com>
10010
10011         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
10012
10013 2010-03-25  Doug Kwan  <dougkwan@google.com>
10014
10015         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
10016         to avoid a conversion warning on a 32-bit host.
10017
10018 2010-03-24  Ian Lance Taylor  <iant@google.com>
10019
10020         * testsuite/script_test_3.t: Add a TLS segment.
10021         * testsuite/Makefile.am (check_PROGRAMS): Add
10022         tls_phdrs_script_test.
10023         (tls_phdrs_script_test_SOURCES): Define.
10024         (tls_phdrs_script_test_DEPENDENCIES): Define.
10025         (tls_phdrs_script_test_LDFLAGS): Define.
10026         (tls_phdrs_script_test_LDADD): Define.
10027         * testsuite/Makefile.in: Rebuild.
10028
10029 2010-03-23  Cary Coutant  <ccoutant@google.com>
10030
10031         * fileread.cc (find_or_make_view): Fix comment.
10032
10033 2010-03-23  Ian Lance Taylor  <iant@google.com>
10034
10035         * script-sections.cc (class Orphan_section_placement): Define
10036         PLACE_TLS and PLACE_TLS_BSS.
10037         (Orphan_section_placement::Orphan_section_placement): Initialize
10038         new places.
10039         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
10040         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
10041         (tls_script_test_SOURCES): Define.
10042         (tls_script_test_DEPENDENCIES): Define.
10043         (tls_script_test_LDFLAGS): Define.
10044         (tls_script_test_LDADD): Define.
10045         * testsuite/Makefile.in: Rebuild.
10046
10047 2010-03-22  Doug Kwan  <dougkwan@google.com>
10048
10049         * arm.cc (Arm_relocate_functions::abs8,
10050         Arm_relocate_functions::abs16): Use correct check for overflow
10051         specified in the ARM ELF specs.
10052         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
10053         target of a BLX instruction specially.
10054         (Reloc_stub::stub_type_for_reloc): Ditto.
10055         (Relocate::relocate): Use symbolic names instead of numeric relocation
10056         codes to report error.
10057         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
10058         workaround.
10059         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
10060         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
10061         thumb2_blx_out_of_range.stdout
10062         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
10063         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
10064         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
10065         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
10066         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
10067         thumb2_blx_in_range, thumb2_blx_in_range.o,
10068         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
10069         thumb2_blx_out_of_range.o): New rules.
10070         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
10071         thumb2_blx_in_range and thumb2_blx_out_of_range.
10072         * testsuite/Makefile.in: Regenerate.
10073         * arm_branch_in_range.sh: Add tests for THUMB BLX.
10074         * testsuite/thumb_blx_in_range.s: New file.
10075         * testsuite/thumb_blx_out_of_range.s: New file.
10076
10077 2010-03-22  Rafael Espindola  <espindola@google.com>
10078
10079         * archive.cc (Should_include): Move to archive.h.
10080         (should_include_member): Make it a member of Archive.
10081         (Lib_group): New.
10082         (Add_lib_group_symbols): New.
10083         * archive.h: Include options.h.
10084         (Archive_member): Moved from Archive.
10085         (Should_include): Moved from archive.cc.
10086         (Lib_group): New.
10087         (Add_lib_group_symbols): New.
10088         * dynobj.cc (do_should_include_member): New.
10089         * dynobj.h (do_should_include_member): New.
10090         * gold.cc (queue_initial_tasks): Update call to queue.
10091         * main.cc (main): Print lib group stats.
10092         * object.cc (do_should_include_member): New.
10093         * object.h: Include archive.h.
10094         (Object::should_include_member): New.
10095         (Object::do_should_include_member): New.
10096         (Sized_relobj::do_should_include_member): New.
10097         * options.cc (General_options::parse_start_lib): New.
10098         (General_options::parse_end_lib): New.
10099         (Input_arguments::add_file): Handle lib groups.
10100         (Input_arguments::start_group): Check we are not in a lib.
10101         (Input_arguments::start_lib): New.
10102         (Input_arguments::end_lib): New.
10103         * options.h (General_options): Add start_lib and end_lib.
10104         (Input_argument::lib_): New.
10105         (Input_argument::lib): New.
10106         (Input_argument::is_lib): New.
10107         (Input_file_lib): New.
10108         (Input_arguments::in_lib_): New.
10109         (Input_arguments::in_lib): New.
10110         (Input_arguments::start_lib): New.
10111         (Input_arguments::end_lib_): New.
10112         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
10113         in unused members as preempted.
10114         (Sized_pluginobj::do_should_include_member): New.
10115         * plugin.h (Sized_pluginobj::do_should_include_member): New.
10116         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
10117         return the blocker.
10118         (Read_symbols::do_whole_lib_group): New.
10119         (Read_symbols::do_lib_group): New.
10120         (Read_symbols::do_read_symbols): Handle lib groups.
10121         (Read_symbols::get_name): Handle lib groups.
10122         * readsyms.h (Read_symbols): Add an archive member pointer.
10123         (Read_symbols::do_whole_lib_group): New.
10124         (Read_symbols::do_lib_group): New.
10125         (Read_symbols::member_): New.
10126         * script.cc (read_input_script): Update call to queue_soon.
10127
10128 2010-03-19  Doug Kwan  <dougkwan@google.com>
10129
10130         * arm.cc (Stub_table::Stub_table): Initialize new data members
10131         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10132         (Stub_table::add_reloc_stub): Assign stub offset and update
10133         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10134         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
10135         New data members.
10136         (Stub_table::update_data_size_and_addralign): Use
10137         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
10138         instead of going over all reloc stubs.
10139         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
10140         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10141         Stringpool_template::offset_ to size of Stringpool_char.
10142         (Stringpool_template::new_key_offset): Remove code to initialize
10143         Stringpool_template::offset_.
10144         * stringpool.h (Stringpool_template::set_no_zero_null): Set
10145         Stringpool_template::offset_ to zero.
10146
10147 2010-03-15  Doug Kwan  <dougkwan@google.com>
10148
10149         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10150         offset_.
10151         (Stringpool_template::new_key_offset): New method.
10152         (Stringpool_template::add_string): Assign offsets when adding new
10153         strings.
10154         (Stringpool_template::set_string_offsets): Do not set string offsets
10155         when not optimizing.
10156         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
10157         member size_.
10158         (Chunked_vector::clear): Clear size_.
10159         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
10160         (Chunked_vector::size): Return size_.
10161         (Chunked_vector::push_back): Use size_ to find insert position.
10162         (Chunked_vector::size_): New data member.
10163         (Stringpool_template::set_no_zero_null): Assert string set is empty.
10164         (Stringpool_template::new_key_offset): New method declaration.
10165         (Stringpool_template::offset_): New data member.
10166
10167 2010-03-15   Rafael Espindola  <espindola@google.com>
10168
10169         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
10170         Add_symbols' constructor.
10171         * readsyms.h (Add_symbols): Remove the input_group member.
10172
10173 2010-03-10  Ian Lance Taylor  <iant@google.com>
10174
10175         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
10176         target to ask whether a reference to a symbol requires a stack
10177         split.
10178         * target.h (Target::is_call_to_non_split): New function.
10179         (Target::do_is_call_to_non_split): Declare virtual function.
10180         * target.cc: Include "symtab.h".
10181         (Target::do_is_call_to_non_split): New function.
10182         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
10183
10184 2010-03-10  Cary Coutant  <ccoutant@google.com>
10185
10186         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
10187         (File_read::open[1]): Remove initial mapping of whole_file_view_.
10188         (File_read::open[2]): Add whole_file_view_ to list of views.
10189         (File_read::make_view): Remove test of whole_file_view_.
10190         (File_read::find_or_make_view): Create whole_file_view_ if
10191         necessary.
10192         (File_read::clear_views): Replace bool parameter with enum;
10193         adjust all callers.  Don't delete views with permanent data;
10194         do delete cached views and views from archives if
10195         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
10196         if clearing the corresponding view.
10197         * fileread.h (File_read::Clear_views_mode): New enum.
10198         (File_read::View::is_permanent_view): New method.
10199         (File_read::clear_views): Replace bool parameter
10200         with enum; adjust all callers.
10201         * options.h (General_options): Change keep_files_mapped option;
10202         add map_whole_files.
10203         * readsyms.cc (Add_symbols::run): Delete sd_ object before
10204         releasing the file.
10205         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
10206         the file.
10207
10208 2010-03-10  David S. Miller  <davem@davemloft.net>
10209
10210         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
10211
10212 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
10213
10214         * icf.cc (get_section_contents): Add '@' marker after processing the
10215         merge reloc.
10216
10217 2010-03-08  Doug Kwan  <dougkwan@google.com>
10218
10219         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
10220         due to a conversion warning.
10221         (Arm_relobj::update_output_local_symbol_count): Check for local
10222         symbol with unset output index.
10223
10224 2010-03-05  Ian Lance Taylor  <iant@google.com>
10225
10226         * options.h (class General_options): Add --spare-dynamic-tags.
10227         * output.cc (Output_data_dynamic::set_final_data_size): Implement
10228         --spare-dynamic-tags.
10229
10230 2010-03-05  Ian Lance Taylor  <iant@google.com>
10231
10232         * incremental.cc: Include "libiberty.h".
10233
10234 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
10235
10236         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
10237         function, is_info_ member.
10238         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
10239         (Versions::Versions): Update caller.
10240         (Versions::define_base_version): Likewise.
10241         (Versions::add_def): Likewise.
10242
10243 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
10244
10245         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
10246         (Scan::possible_function_pointer_reloc): New function.
10247         (Scan::local_reloc_may_be_function_pointer): Change to call
10248         possible_function_pointer_reloc.
10249         (Scan::global_reloc_may_be_function_pointer): Ditto.
10250         * icf.h (Icf::check_section_for_function_pointers): Change to reject
10251         relocations in ".data.rel.ro._ZTV" section.
10252         * testsuite/icf_safe_so_test.sh: Change to pass i386.
10253         * testsuite/icf_safe_so_test.cc: Ditto.
10254         * testsuite/icf_safe_test.cc: Ditto.
10255         * testsuite/icf_safe_test.sh: Ditto.
10256
10257 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10258             Ian Lance Taylor  <iant@google.com>
10259
10260         * target-reloc.h (relocate_section): Check the symbol table index
10261         for -1U before setting the local symbol index.
10262         (scan_relocatable_relocs): If copying the relocation, record that
10263         the local symbol is required.
10264         * object.h (Symbol_value::is_output_symtab_index_set): New
10265         function.
10266         (Symbol_value::may_be_discarded_from_output_symtab): New
10267         function.
10268         (Symbol_value::has_output_symtab_entry): New function.
10269         (Symbol_value::needs_output_symtab_entry): Remove.
10270         (Symbol_value::output_symtab_index): Make sure the symbol index is
10271         set.
10272         (Symbol_value::set_output_symtab_index): Make sure the symbol
10273         index is not set.  Make sure the new index is valid.
10274         (Symbol_value::set_must_have_output_symtab_entry): New function.
10275         (Symbol_value::has_output_dynsym_entry): New function.
10276         (Symbol_value::set_output_dynsym_index): Make sure the new index
10277         is valid.
10278         (Sized_relobj::set_must_have_output_symtab_entry): New function.
10279         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
10280         local symbol if permitted.
10281         (Sized_relobj::do_finalize_local_symbols): Call
10282         is_output_symtab_index_set rather than needs_output_symtab_entry.
10283         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
10284         rather than needs_output_symtab_entry.  Call
10285         has_output_dynsym_entry rather than needs_output_dynsym_entry.
10286         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
10287         is_output_symtab_index_set rather than needs_output_symtab_entry.
10288         * testsuite/discard_locals_relocatable_test.c: New file.
10289         * testsuite/discard_locals_test.sh: Test -r.
10290         * testsuite/Makefile.am (check_DATA): Add
10291         discard_locals_relocatable_test1.syms,
10292         discard_local_relocatable_test2.syms.
10293         (MOSTLYCLEANFILES): Likewise.  Also add
10294         discard_locals_relocatable_test1.lout and
10295         discard_locals_relocatable_test2.out.
10296         (discard_locals_relocatable_test1.syms): New target.
10297         (discard_locals_relocatable_test.o): New target.
10298         (discard_locals_relocatable_test1.out): New target.
10299         (discard_locals_relocatable_test2.syms): New target.
10300         (discard_locals_relocatable_test2.out): New target.
10301         (various): Add missing ../ld-new dependencies.
10302         * testsuite/Makefile.in: Rebuild.
10303
10304 2010-03-03  Nick Clifton  <nickc@redhat.com>
10305
10306         * po/fi.po: New Finnish translation.
10307
10308 2010-03-01  Doug Kwan  <dougkwan@google.com>
10309
10310         * layout.cc (Layout::Layout): Force section types of .init_array*,
10311         .preinit_array* and .fini_array* sections.
10312         * output.cc (Output_section::Input_section_sort_entry::has_priority):
10313         Fix check of return value of std::string::find.().
10314         (Output_section::Input_section_sort_compare::operator()): Remove
10315         comment about .init_array.
10316         (Output_section::Input_section_sort_init_fini_compare::operator()):
10317         New method.
10318         (Output_section::sort_attached_input_sections): Handle .init_array
10319         and .fini_array specially.
10320         * output.h (Output_section::Inut_section_sort_compare): Update
10321         comment.
10322         (Output_section::Input_section_sort_init_fini_compare): New struct.
10323
10324 2010-02-26  Doug Kwan  <dougkwan@google.com>
10325
10326         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
10327         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
10328         * testsuite/debug_msg.sh: Avoid matching source line number for
10329         use of global variable undef_int.
10330
10331 2010-02-26  Doug Kwan  <dougkwan@google.com>
10332
10333         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
10334         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
10335         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
10336         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
10337         * options.cc (General_options::General_options): Initialize member
10338         fix_v4bx_.
10339         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
10340         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
10341         and rm_no_fix_v4bx.stdout
10342         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
10343         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
10344         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
10345         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
10346         and arm_no_fix_v4bx.
10347         * Makefile.in: Regenerate.
10348         * testsuite/arm_fix_v4bx.s: New file.
10349         * testsuite/arm_fix_v4bx.sh: Ditto.
10350
10351 2010-02-24  Doug Kwan  <dougkwan@google.com>
10352
10353         * arm.cc (Target_arm::got_section): Make the .got section the first
10354         non RELRO section in the data segment.
10355         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
10356         suffixes of section names.
10357
10358 2010-02-24  Doug Kwan  <dougkwan@google.com>
10359
10360         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
10361         flags and attributes merging if an input file is a binary file.
10362         * fileread.cc (Input_file::open): Record format of original file.
10363         * fileread.h (Input_file::Format): New enum type.
10364         (Input_file::Input_file): Initialize data member format_.
10365         (Input_file::format): New method definition.
10366         (Input_file::format_):: New data member.
10367
10368 2010-02-24  Doug Kwan  <dougkwan@google.com>
10369
10370         * arm.cc (Arm_output_data_got): New class.
10371         (ARM_TCB_SIZE): New constant
10372         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
10373         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
10374         If user uses a script with a SECTIONS clause, issue only a warning
10375         for a misplaced EXIDX input section.  Otherwise, issue an error.
10376         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
10377         garbage collection.
10378         (Target_arm::got_mode_index_entry): Handle static linking.
10379         (Target_arm::Scan::local): Ditto.
10380         (Target_arm::Scan::global): Ditto.
10381         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
10382         all incorrectly implemented relocations.
10383         (Target_arm::fix_exidx_coverage): Pass layout to
10384         Arm_output_section::fix_exidx_coverage.
10385         * layout.cc (Layout::section_name_mapping): Remove trailing dots
10386         from ".ARM.exidx." and ".ARM.extab.".
10387
10388 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10389
10390         * arm.cc (Target_arm::do_finalize_sections): Create attribute
10391         section if it does not already exist.
10392         * attributes.cc (Attributes_section_data::Attributes_section_data):
10393         Don't crash if size is zero.
10394
10395 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10396             Ian Lance Taylor  <iant@google.com>
10397
10398         * gold.cc (queue_middle_tasks): If no input files were opened,
10399         exit.
10400         * workqueue.h (Task_function::Task_function): Assert that there is
10401         a blocker.
10402
10403 2010-02-22  Doug Kwan  <dougkwan@google.com>
10404
10405         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
10406         * icf.cc (get_section_contents): Cast snprintf arguments to long long
10407         types to avoid warnings due to different uint64_t implementations
10408         on different hosts.
10409
10410 2010-02-21  Doug Kwan  <dougkwan@google.com>
10411
10412         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
10413         handling of the maximum backward branch offset.
10414         (Arm_relocate_functions::thumb_branch_common): Ditto.
10415         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
10416         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
10417         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
10418         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
10419         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
10420         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
10421         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
10422         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
10423         thumb_bl_out_of_range thumb_bl_out_of_range.o,
10424         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
10425         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
10426         thumb2_bl_out_of_range.o): New rules.
10427         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
10428         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
10429         thumb2_bl_out_of_range
10430         * testsuite/Makefile.in: Regenerate.
10431         * testsuite/arm_bl_in_range.s: New file.
10432         * testsuite/arm_bl_out_of_range.s: Ditto.
10433         * testsuite/arm_branch_in_range.sh: Ditto.
10434         * testsuite/arm_branch_range.t: Ditto.
10435         * testsuite/thumb2_branch_range.t: Ditto.
10436         * testsuite/thumb_bl_in_range.s: Ditto.
10437         * testsuite/thumb_bl_out_of_range.s: Ditto.
10438         * testsuite/thumb_branch_range.t: Ditto.
10439
10440 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
10441
10442         * gc.h (gc_process_relocs): Change vectors to point to the new list.
10443         Add reloc offset information.
10444         * icf.cc (get_section_contents): Change iterators to point to the new
10445         vectors. Add reloc offset information to the contents.
10446         * icf.h (Icf::Sections_reachable_info): New typedef.
10447         (Icf::Sections_reachable_list): New typedef.
10448         (Icf::Offset_info): New typedef.
10449         (Icf::Reloc_info): New struct typedef.
10450         (Icf::Reloc_info_list): New typedef.
10451         (Icf::symbol_reloc_list): Delete method.
10452         (Icf::addend_reloc_list): Delete method.
10453         (Icf::section_reloc_list): Delete method.
10454         (Icf::reloc_info_list): New method.
10455         (Icf::reloc_info_list_): New member.
10456
10457 2010-02-19  Doug Kwan  <dougkwan@google.com>
10458
10459         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
10460         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
10461         * arm.cc (Arm_relocation_functions): New forward declaration.
10462         (Target_arm::Target_arm): Initialize new data members
10463         got_mod_index_offset_ and tls_base_symbol_defined_.
10464         (Target_arm::Relocate::relocate_tls): New method.
10465         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
10466          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
10467         New methods.
10468         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
10469         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
10470         (Target_arm::got_mod_index_offset_,
10471         Target_arm::tls_base_symbol_defined_): New data members.
10472         (Target_arm::Scan::local, Target::Scan::global,
10473         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
10474         relocations.
10475
10476 2010-02-18  Doug Kwan  <dougkwan@google.com>
10477
10478         * arm.cc (Arm_relobj::find_linked_text_section): New method.
10479         (Arm_relobj::make_exidx_input_section): Pass section index of linked
10480         text section as a parameter becuase some broken tools may not set
10481         the link in section header.
10482         (Target_arm::has_got_section): New method.
10483         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
10484         without any mapping symbol as data only.  Remove warning.
10485         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
10486         link in its section header, try to discover the link by inspecting the
10487         REL31 relocation at the beginning of the section.
10488         (Target_arm::Scan::check_non_pic): Report name of offending relocation
10489         in error message.
10490         (Target_arm::Scan::global): Treat any reference to the symbol
10491         _GLOBAL_OFFSET_TABLE_ as a GOT access.
10492
10493 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
10494
10495         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
10496         (Scan::global_reloc_may_be_function_pointer): New function.
10497         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10498         (Scan::global_reloc_may_be_function_pointer): New function.
10499         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10500         (Scan::global_reloc_may_be_function_pointer): New function.
10501         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
10502         (Scan::global_reloc_may_be_function_pointer): New function.
10503         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
10504         (Scan::global_reloc_may_be_function_pointer): New function.
10505         (Scan::possible_function_pointer_reloc): New function.
10506         (Target_x86_64::can_check_for_function_pointers): New function.
10507         * gc.h (gc_process_relocs): Scan relocation types to determine if
10508         function pointers were taken for targets that support it.
10509         * icf.cc (Icf::find_identical_sections): Include functions for
10510         folding in safe ICF whose pointer is not taken.
10511         * icf.h (Secn_fptr_taken_set): New typedef.
10512         (fptr_section_id_): New member.
10513         (section_has_function_pointers): New function.
10514         (set_section_has_function_pointers): New function.
10515         (check_section_for_function_pointers): New function.
10516         * options.h: Fix comment for safe ICF option.
10517         * target.h (can_check_for_function_pointers): New function.
10518         * testsuite/Makefile.am: Add icf_safe_so_test test case.
10519         Modify icf_safe_test for X86-64.
10520         * testsuite/Makefile.in: Regenerate.
10521         * testsuite/icf_safe_so_test.cc: New file.
10522         * testsuite/icf_safe_so_test.sh: New file.
10523         * testsuite/icf_safe_test.cc (kept_func_3): New function.
10524         (main): Change to take pointer to function kept_func_3.
10525         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
10526         folding is done correctly for X86-64.
10527
10528 2010-02-12  David S. Miller  <davem@davemloft.net>
10529
10530         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
10531         is_symbolless parameter.
10532         (Output_reloc<SHT_REL>::is_symbolless): New.
10533         (Output_reloc<SHT_REL>::is_symbolless_): New.
10534         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
10535         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
10536         (Output_reloc<SHT_RELA>::is_symbolless): New.
10537         (Output_data_reloc::add_global): Handle is_symbolless.
10538         (Output_data_reloc::add_global_relative): Likewise.
10539         (Output_data_reloc::add_local): Likewise.
10540         (Output_data_reloc::add_local_relative): Likewise.
10541         (Output_data_reloc::add_symbolless_global_addend): New.
10542         (Output_data_reloc::add_symbolless_local_addend): New.
10543         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
10544         is_symbolless.
10545         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
10546         instead of ->is_relative_
10547         (Output_reloc::write): Likewise.
10548         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
10549         (Output_reloc::write_rel): Simplify.
10550
10551         * sparc.cc (Target_sparc::Scan::local): Use
10552         ->add_symbolless_local_addend as needed.
10553         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
10554         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
10555         based upon relocation offset.
10556
10557 2010-02-11  Doug Kwan  <dougkwan@google.com>
10558
10559         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
10560         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
10561         beginning of function.
10562         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
10563         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
10564         parameter is_32bit in calls to should_apply_static_reloc.
10565         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
10566         (check_DATA): Add arm_abs_global.stdout.
10567         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
10568         arm_abs_global.stdout): New rules.
10569         (MOSTLLYCLEANFILES): Add arm_abs_global
10570         * Makefile.in: Regenerate.
10571         * testsuite/arm_abs_global.s: New file.
10572         * testsuite/arm_abs_global.sh: Ditto.
10573         * testsuite/arm_abs_lib.s: Ditto.
10574
10575 2010-02-11  Ian Lance Taylor  <iant@google.com>
10576
10577         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
10578         Read_relocs task.
10579         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
10580         Allocate_commons_task first.
10581         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
10582         task, rather than symtab_lock_.
10583         (Gc_process_relocs::~Gc_process_relocs): New function.
10584         (Gc_process_relocs::is_runnable): Check this_blocker_.
10585         (Gc_process_relocs::locks): Use next_blocker_ rather than
10586         blocker_.
10587         (Scan_relocs::~Scan_relocs): New function.
10588         (Scan_relocs::is_runnable): Check this_blocker_ rather than
10589         symtab_lock_.
10590         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
10591         next_blocker_.
10592         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
10593         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
10594         constructor accordingly.
10595         (class Gc_process_relocs): Likewise.
10596         (class Scan_relocs): Likewise.
10597         * common.h (class Allocate_commons_task): Remove symtab_lock_
10598         field, and corresponding constructor parameter.
10599         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
10600         symtab_lock_.
10601         (Allocate_commons_task::locks): Likewise.
10602
10603 2010-02-11  Ian Lance Taylor  <iant@google.com>
10604
10605         * gold-threads.h (class Once): Define.
10606         (class Initialize_lock): Rewrite as child of Once.
10607         * gold-threads.cc (class Once_initialize): Define.
10608         (once_pointer_control): New static variable.
10609         (once_pointer, once_arg): New static variables.
10610         (c_run_once): New static function.
10611         (Once::Once, Once::run_once, Once::internal_run): New functions.
10612         (class Initialize_lock_once): Remove.
10613         (initialize_lock_control): Remove.
10614         (initialize_lock_pointer): Remove.
10615         (initialize_lock_once): Remove.
10616         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
10617         (Initialize_lock::initialize): Rewrite.
10618         (Initialize_lock::do_run_once): New function.
10619         * archive.cc (Archive::interpret_header): Only clear name if it is
10620         not already empty.
10621         * fileread.cc: Include "gold-threads.h"
10622         (file_counts_lock): New static variable.
10623         (file_counts_initialize_lock): Likewise.
10624         (File_read::release): Only increment counts when using --stats.
10625         Use a lock around the increment.
10626         * parameters.cc (class Set_parameters_target_once): Define.
10627         (set_parameters_target_once): New static variable.
10628         (Parameters::Parameters): Move here from parameters.h.
10629         (Parameters::set_target): Rewrite.
10630         (Parameters::set_target_once): New function.
10631         (Parameters::clear_target): Move here and rewrite.
10632         * parameters.h (class Parameters): Update declarations.  Add
10633         set_parameters_target_once_ field.
10634         (Parameters::Parameters): Move to parameters.cc.
10635         (Parameters::clear_target): Likewise.
10636         * readsyms.cc (Read_symbols::do_group): Create a Start_group
10637         task.
10638         (Start_group::~Start_group): New function.
10639         (Start_group::is_runnable): New function.
10640         (Start_group::locks, Start_group::run): New functions.
10641         (Finish_group::run): Change saw_undefined to size_t.
10642         * readsyms.h (class Start_group): Define.
10643         (class Finish_group): Change saw_undefined_ field to size_t.
10644         (Finish_group::Finish_group): Remove saw_undefined and
10645         this_blocker parameters.  Change all callers.
10646         (Finish_group::set_saw_undefined): New function.
10647         (Finish_group::set_blocker): New function.
10648         * symtab.h (class Symbol_table): Change saw_undefined to return
10649         size_t.  Change saw_undefined_ field to size_t.
10650         * target-select.cc (Set_target_once::do_run_once): New function.
10651         (Target_selector::Target_selector): Initialize set_target_once_
10652         field.  Don't initialize lock_ and initialize_lock_ fields.
10653         (Target_selector::instantiate_target): Rewrite.
10654         (Target_selector::set_target): New function.
10655         * target-select.h (class Set_target_once): Define.
10656         (class Target_selector): Update declarations.  Make
10657         Set_target_once a friend.  Remove lock_ and initialize_lock_
10658         fields.  Add set_target_once_ field.
10659
10660 2010-02-10  Ian Lance Taylor  <iant@google.com>
10661
10662         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
10663         queueing any tasks.
10664         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
10665         (queue_middle_tasks): Add all blockers before queueing any tasks.
10666         (queue_final_tasks): Likewise.
10667         * token.h (Task_token::add_blockers): New function.
10668         * object.h (Input_objects::number_of_relobjs): New function.
10669
10670 2010-02-10  Ian Lance Taylor  <iant@google.com>
10671
10672         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
10673         shared, not if not position independent.
10674         * x86_64.cc (Relocate::relocate_tls): Likewise.
10675         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
10676         (tls_pie_pic_test): New target.
10677         * testsuite/Makefile.in: Rebuild.
10678
10679         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
10680         (tls_test_main_pie.o, tls_test_pie.o): New targets.
10681         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
10682         * testsuite/Makefile.in: Rebuild.
10683
10684 2010-02-09  David S. Miller  <davem@davemloft.net>
10685
10686         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
10687         R_SPARC_RELATIVE using ->add_local_relative().
10688         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
10689
10690         * output.h (Output_data_dynamic::add_section_size): New method
10691         that takes two Output_data objects.
10692         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
10693         entry param.  Handle it in initializers.
10694         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
10695         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
10696         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
10697         arg.
10698         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
10699         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
10700         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
10701         for dynrel_includes_plt.
10702         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10703         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10704         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
10705         before .rela.plt
10706         (Target_sparc::do_finalize_sections): Update to pass true for
10707         dynrel_includes_plt.
10708         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
10709         output before .rela.plt
10710         (Target_powerpc::do_finalize_sections): Update to pass true for
10711         dynrel_includes_plt when 32-bit.
10712
10713 2010-02-08  Doug Kwan  <dougkwan@google.com>
10714
10715         * arm.cc (Arm_relobj::simple_input_section_output_address): New
10716         method.
10717         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
10718         Arm_relobj::scan_section_for_cortex_a8_stubs,
10719         Arm_relobj::do_relocation_section): Instead of calling
10720         Output_section::output_address, use faster
10721         Arm_relobj::simple_input_section_output_address.
10722
10723 2010-02-08  David S. Miller  <davem@davemloft.net>
10724
10725         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
10726         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
10727         relocation helper function.
10728
10729         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
10730         just like R_SPARC_GOT{10,13,22}.
10731         (Target_sparc::Scan::local): Likewise.
10732         (Target_sparc::Relocate:relocate): Likewise.
10733
10734 2010-02-06  Ian Lance Taylor  <iant@google.com>
10735
10736         * configure.ac: Rewrite targetobjs duplicate removal code to use
10737         only shell constructs.
10738         * configure: Rebuild.
10739
10740 2010-02-05  Doug Kwan  <dougkwan@google.com>
10741
10742         PR 11247
10743         * arm.cc (Arm_relobj::section_is_scannable): New method.
10744         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
10745         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
10746
10747 2010-02-04  Doug Kwan  <dougkwan@google.com>
10748
10749         PR 11247
10750         * arm-reloc-property.cc (cstdio): Include.
10751         * configure.ac (targetobjs): Remove duplicates.
10752         * configure: Regenerate.
10753         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
10754         big and little endian version for a given address size.
10755
10756 2010-02-03  Doug Kwan  <dougkwan@google.com>
10757
10758         * arm-reloc-property.cc
10759         (Arm_reloc_property_table::reloc_name_in_error_message): New method
10760         definition.
10761         * arm-reloc-property.h
10762         (Arm_reloc_property_table::get_implemented_static_reloc_property):
10763         New method definition.
10764         (Arm_reloc_property_table::reloc_name_in_error_message): New method
10765         declaration.
10766         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
10767         overflow to N.
10768         (GOT_PREL): Change implemented to Y.
10769         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
10770         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
10771         (Arm_relocate_functions::movw_abs_nc): Remove method.
10772         (Arm_relocate_functions::movt_abs): Ditto.
10773         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
10774         (Arm_relocate_functions::thm_movt_abs): Ditto.
10775         (Arm_relocate_functions::movw_rel_nc): Ditto.
10776         (Arm_relocate_functions::movw_rel): Ditto.
10777         (Arm_relocate_functions::movt_rel): Ditto.
10778         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
10779         (Arm_relocate_functions:thm_movw_rel): Ditto.
10780         (Arm_relocate_functions:thm_movt_rel): Ditto.
10781         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
10782         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
10783         New method definitions.
10784         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
10785         (Arm_relocation_functions::arm_grp_ldr): Ditto.
10786         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
10787         (Arm_relocation_functions::arm_grp_ldc): Ditto.
10788         (Target_arm::Relocate::relocate): Check for non-static or
10789         unimplemented relocation code and exit early.  Change calls to
10790         Target_arm::reloc_uses_thumb_bit and
10791         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
10792         instead.  Refactor code to handle similar relocations to increase
10793         code sharing.  Remove check for unsupported relocation code in switch
10794         statement.
10795         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
10796         relocation property table to find out size.  Change error message to
10797         print out the name of a relocation code instead of the numeric value.
10798         (Target_arm::scan_reloc_for_stub): Use relocation property table
10799         instead of calling Target_arm::reloc_uses_thumb_bit().
10800
10801 2010-02-02  Doug Kwan  <dougkwan@google.com>
10802
10803         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
10804         types of relaxed input section.
10805
10806 2010-02-02  Doug Kwan  <dougkwan@google.com>
10807
10808         * Makefile.am (HFILES): Add arm-reloc-property.h.
10809         (DEFFILES): New.
10810         (TARGETSOURCES): Add arm-reloc-property.cc
10811         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
10812         (libgold_a_SOURCES): $(DEFFILES)
10813         * Makefile.in: Regenerate.
10814         * arm-reloc-property.cc: New file.
10815         * arm-reloc-property.h: New file.
10816         * arm-reloc.def: New file.
10817         * arm.cc: Update comments.
10818         (arm-reloc-property.h): New included header.
10819         (arm_reloc_property_table): New global variable.
10820         (Target_arm::do_select_as_default_target): New method definition.
10821         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
10822         arm-reloc-property to targ_extra_obj.
10823         * parameters.cc (set_parameters_target): Call
10824         Target::select_as_default_target().
10825         * target.h (Target::select_as_default_target): New method definition.
10826         (Target::do_select_as_default_target): Same.
10827
10828 2010-02-01  Doug Kwan  <dougkwan@google.com>
10829
10830         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
10831         first_output_text_section_.
10832         (Arm_exidx_fixup::first_output_text_section): New method definition.
10833         (Arm_exidx_fixup::first_output_text_section_): New data member.
10834         (Arm_exidx_fixup::process_exidx_section): Record the first text
10835         output section seen.
10836         (Arm_output_section::fix_exidx_coverage): Set correct linked section
10837         and entsize in output section header.
10838
10839 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10840
10841         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
10842         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
10843         (Arm_relocate_functions::thm_alu11): New Method.
10844         (Arm_relocate_functions::thm_pc8): New Method.
10845         (Arm_relocate_functions::thm_pc12): New Method.
10846         (Target_arm::Scan::local): Handle the relocations.
10847         (Target_arm::Scan::global): Likewise.
10848         (Target_arm::Relocate::relocate): Likewise.
10849         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10850
10851 2010-01-29  Doug Kwan  <dougkwan@google.com>
10852
10853         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
10854         of relocation types as ld.
10855
10856 2010-01-29  Doug Kwan  <dougkwan@google.com>
10857
10858         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
10859         to public.
10860         (Arm_relocate_functions::thumb_branch_common): Ditto.
10861         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
10862         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
10863         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
10864         Arm_relocate_functions::jump24): Remove.
10865         (Target_arm::Relocate::relocate): Adjust code to call
10866         Arm_relocation_functions::arm_branch_common and
10867         Arm_relocation_functions::thumb_branch_common instead of their removed
10868         wrappers.  Merge switch-cases together to reduce source code size.
10869
10870 2010-01-29  Doug Kwan  <dougkwan@google.com>
10871
10872         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
10873         output_local_symbol_count_needs_update_.
10874         (Arm_relobj::output_local_symbol_count_needs_update,
10875          Arm_relobj::set_output_local_symbol_count_needs_update,
10876          Arm_relobj::update_output_local_symbol_count): New methods.
10877         (Arm_relobj::output_local_symbol_count_needs_update_): New data
10878         member.
10879         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
10880         of pointed function as in a R_ARM_PREL31 relocation.
10881         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
10882         for output local symbol count updating.
10883         (Target_arm::do_relax): Update output local symbol counts in objects
10884         if necessary.
10885         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
10886
10887 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10888
10889         * arm.cc: Added support for the ARM relocations:
10890         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
10891         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
10892         (Arm_relocate_functions::movw_rel_nc): Renamed (was
10893         movw_prel_nc).
10894         (Arm_relocate_functions::movw_rel): New method.
10895         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
10896         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
10897         thm_movw_prel_nc).
10898         (Arm_relocate_functions::thm_movw_rel): New method.
10899         (Arm_relocate_functions::thm_movt_rel): Renamed (was
10900         thm_movt_prel).
10901         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
10902         relocations.
10903         (Target_arm::Scan::global): Likewise.
10904         (Target_arm::Relocate::relocate): Likewise.
10905         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10906         Likewise.
10907
10908 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10909
10910         * arm.cc: Added support for ARM group relocations.
10911         (Target_arm::reloc_needs_sym_origin): New method.
10912         (Arm_relocate_functions::calc_grp_kn): New method.
10913         (Arm_relocate_functions::calc_grp_residual): New method.
10914         (Arm_relocate_functions::calc_grp_gn): New method.
10915         (Arm_relocate_functions::arm_grp_alu): New Method.
10916         (Arm_relocate_functions::arm_grp_ldr): New Method.
10917         (Arm_relocate_functions::arm_grp_ldrs): New Method.
10918         (Arm_relocate_functions::arm_grp_ldc): New Method.
10919         (Target_arm::Scan::local): Handle the ARM group relocations.
10920         (Target_arm::Scan::global): Likewise.
10921         (Target_arm::Relocate::relocate): Likewise.
10922         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10923         Likewise.
10924
10925 2010-01-26  Doug Kwan  <dougkwan@google.com>
10926
10927         * arm.cc (set): Include.
10928         (class Arm_exidx_fixup): Change type of last_input_section_ to const
10929         pointer type.
10930         (Arm_output_section::Text_section_list): New type.
10931         (Arm_output_section::append_text_sections_to_list): New method.
10932         (Arm_output_section::fix_exidx_coverage): Ditto.
10933         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
10934         (Arm_relobj::convert_input_section_to_relaxed_section): Use
10935         Relobj::set_section_offset() instead of
10936         Sized_relobj::invalidate_section_offset().
10937         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
10938         parameter for section headers. Ignore relocation sections for
10939         unallocated sections and EXIDX sections.
10940         (Target_arm::fix_exidx_coverage): New method.
10941         (Target_arm::output_section_address_less_than): New type.
10942         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
10943         linked text section instead of the EXIDX section.
10944         (Arm_output_section::create_stub_group): Add an assertion to check
10945         that this is not an EXIDX output section.
10946         (Arm_output_section::append_text_sections_to_list): New method.
10947         (Arm_output_section::fix_exidx_coverage): Ditto.
10948         (Arm_relobj::scan_sections_for_stubs): Adjust call to
10949         Arm_relobj::section_needs_reloc_stub_scanning.
10950         (Target_arm::do_relax): Fix EXIDX output section coverage in the
10951         first pass.
10952         (Target_arm::fix_exidx_coverage): New method.
10953         * object.h (Relobj::set_output_section): New method.
10954         (Sized_relobj::invalidate_section_offset): Remove method.
10955         (Sized_relobj::do_invalidate_section_offset): Remove method.
10956         (Sized_relobj::do_set_section_offset): Handle offset value -1.
10957
10958 2010-01-25  Doug Kwan  <dougkwan@google.com>
10959
10960         * arm.cc (Arm_exidx_merged_section::do_output_offset):
10961         Fix warning due to signed and unsigned comparison on a 32-bit host.
10962
10963 2010-01-22  Doug Kwan  <dougkwan@google.com>
10964
10965         * arm.cc (Target_arm::do_relax): Record an output section for section
10966         offset adjustment it contains any stub table that has changed.
10967         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
10968         offsets in an output section if necessary.
10969         * output.cc (Output_section::Output_section): Initialize
10970         section_offsets_need_adjustments_.
10971         (Output_section::add_input_section_for_script): Renamed to
10972         Output_section::add_simple_input_section.
10973         (Output_section::save_states): Add a comment.
10974         (Output_section::discard_states): New method defintion.
10975         (Output_section::adjust_section_offsets): Same.
10976         * output.h (Output_section::add_input_section_for_script): Renamed to
10977         Output_section::add_simple_input_section.
10978         (Output_section::discard_states): New method declaration.
10979         (Output_section::adjust_section_offsets): Same.
10980         (Output_section::section_offsets_need_adjustment,
10981         Output_section::set_section_offsets_need_adjustment): New method
10982         definitions.
10983         (Output_section::section_offsets_need_adjustment_): New data member.
10984         * script-sections.cc
10985         (Output_section_element_input::set_section_address): Adjust code for
10986         renaming of Output_section::add_input_section_for_script.
10987         (Orphan_output_section::set_section_address): Same.
10988
10989 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10990
10991         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
10992         Fix_v4bx enum values .
10993         * gold/options.h (General_options): New option definitions.
10994         (General_options::fix_v4bx): New method.
10995         (General_options::Fix_v4bx): New enum.
10996         * gold/options.cc (General_options::parse_fix_v4bx): New method.
10997         (General_options::parse_fix_v4bx_interworking): New method.
10998
10999 2010-01-22  Doug Kwan  <dougkwan@google.com>
11000
11001         * arm.cc (Arm_exidx_fixup): New class.
11002
11003 2010-01-21  Doug Kwan  <dougkwan@google.com>
11004
11005         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
11006         classes.
11007         (Arm_exidx_section_offset_map): New type.
11008
11009 2010-01-21  Doug Kwan  <dougkwan@google.com>
11010
11011         * arm.cc (Arm_exidx_input_section): New class.
11012         (Arm_relobj::exidx_input_section_by_link,
11013         Arm_relobj::exidx_input_section_by_shndx,
11014         Arm_relobj::make_exidx_input_section): New methods.
11015         (read_arm_attributes_section): Remove.
11016         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
11017         information about them.
11018         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
11019         to here.
11020
11021 2010-01-20  Doug Kwan  <dougkwan@google.com>
11022
11023         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
11024         Input_section_specifier to Section_id.
11025         (Target_arm::new_arm_input_section: Adjust code for change of key
11026         type.
11027         (Target_arm::find_arm_input_section): Ditto.
11028         * gc.h (object.h): Include for Section_id nand Section_id_hash.
11029         (Section_id): Remove.
11030         (Garbage_collection::Section_id_hash): Remove.
11031         * icf.h (object.h): Include for Section_id nand Section_id_hash.
11032         (Section_id): Remove.
11033         (Icf::Section_id_hash): Remove.
11034         * object.h (Section_id, Const_section_id, Section_id_hash,
11035         Const_section_id_hash): New type definitions.
11036         * output.cc (Output_section::add_relaxed_input_section): Change to
11037         use Const_section_id instead of Input_section_specifier as key type.
11038         (Output_section::add_merge_input_section): Ditto.
11039         (Output_section::build_relaxation_map): Change to use Section_id
11040         instead of Input_section_specifier as key type.
11041         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11042         Ditto.
11043         (Output_section::convert_input_sections_to_relaxed_sections): Change
11044         to use Const_section_id instead of Input_section_specifier as key type.
11045         (Output_section::find_merge_section): Ditto.
11046         (Output_section::find_relaxed_input_section): Ditto.
11047         * output.h (Input_section_specifier): Remove class.
11048         (Output_section::Output_section_data_by_input_section_map): Change
11049         key type to Const_section_id.
11050         (Output_section::Output_relaxed_input_section_by_input_section_map):
11051         Ditto.
11052         (Output_section::Relaxation_map): Change key type to Section_id.
11053
11054 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11055
11056         * gold/arm.cc: Added support for R_ARM_V4BX relocation
11057         (class Arm_v4bx_stub): New class.
11058         (DEF_STUBS): Updated definition to support v4_veneer_bx.
11059         (Stub_factory::make_arm_v4bx_stub): New method.
11060         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
11061         (Stub_table::empty): Handle v4bx stubs.
11062         (Stub_table::add_arm_v4bx_stub): New method.
11063         (Stub_table::find_arm_v4bx_stub): New method.
11064         (Arm_relocate_functions::v4bx): New method.
11065         (Target_arm::fix_v4bx): New method.
11066         (Target_arm::Target_arm): Handle R_ARM_V4BX.
11067         (Stub_table::relocate_stubs): Likewise.
11068         (Stub_table::do_write): Likewise.
11069         (Stub_table::update_data_size_and_addralign): Likewise.
11070         (Stub_table::finalize_stubs):  Likewise.
11071         (Target_arm::Scan::local): Likewise.
11072         (Target_arm::Scan::global): Likewise.
11073         (Target_arm::do_finalize_sections): Likewise.
11074         (Target_arm::Relocate::relocate): Likewise.
11075         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11076         Likewise.
11077         (Target_arm::scan_reloc_for_stub): Likewise.
11078         (Target_arm::scan_reloc_section_for_stubs): Likewise.
11079
11080 2010-01-19  Ian Lance Taylor  <iant@google.com>
11081
11082         * output.cc (Output_section_headers::do_sized_write): Write large
11083         segment count to sh_info field.
11084         (Output_file_header::do_sized_write): For large segment count,
11085         write PN_XNUM to e_phnum field.
11086
11087 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11088
11089         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
11090         (Arm_relocate_functions::thm_jump8): New function.
11091         (Arm_relocate_functions::thm_jump11): New function.
11092         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
11093         R_ARM_THM_JUMP11.
11094         (Target_arm::Scan::global): Likewise.
11095         (Target_arm::Relocate::relocate): Likewise.
11096         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11097         Likewise.
11098
11099 2010-01-14  Doug Kwan  <dougkwan@google.com>
11100
11101         * arm.cc (map, utility): Include headers.
11102         (Target_arm::apply_cortex_a8_workaround): New method.
11103         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
11104         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
11105         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
11106         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
11107         the --[no-]fix-cortex-a8 command line options.
11108         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
11109         (Target_arm::relocate_stub): Use addend in instruction template.
11110         * options.h (DEFINE_bool): Set the user-set flag.
11111         (General_options): Add --[no-]-fix-cortex options.
11112         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
11113         : Update fast look-up map after conversion.
11114
11115 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
11116
11117         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
11118         in the first pass of do_layout.
11119
11120 2010-01-13  Doug Kwan  <dougkwan@google.com>
11121
11122         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11123         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
11124         apparent compiler problem of not folding static constant integral
11125         data members of elfcpp::Elf_sizes<32>.
11126
11127 2010-01-13  Doug Kwan  <dougkwan@google.com>
11128
11129         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11130         Arm_relobj::section_needs_cortex_a8_stub_scanning,
11131         Arm_relobj::scan_section_for_cortex_a8_erratum,
11132         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
11133         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
11134         sections to scan for relocation stubs into a new method
11135         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
11136         relocation and Cortex-A8 stub scanning.
11137         (Target_arm::do_relax): Force stubs to be after stubbed sections
11138         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
11139         the beginning of a new relaxation pass.  Update a comment.
11140         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
11141
11142 2010-01-12  Ian Lance Taylor  <iant@google.com>
11143
11144         * target-reloc.h (visibility_error): New inline function.
11145         (relocate_section): Call visibility_error.
11146         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
11147         (MOSTLYCLEANFILES): Likewise.
11148         (protected_4_pic.o, protected_3.err): New targets.
11149         * testsuite/protected_4.cc: New file.
11150
11151 2010-01-12  Doug Kwan  <dougkwan@google.com>
11152
11153         * arm.cc (Cortex_a8_reloc): New class.
11154         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
11155         and cortex_a8_relocs_info_.
11156         (Target_arm::fix_cortex_a8): New method definition.
11157         (Target_arm::Cortex_a8_relocs_info): New type.
11158         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
11159         New data member declarations.
11160         (Target_arm::scan_reloc_for_stub): Record information about
11161         relocations for THUMB branches that might be exempted from the
11162         Cortex-A8 workaround.
11163         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
11164         at the beginning of a relaxation pass.
11165
11166 2010-01-12  Doug Kwan  <dougkwan@google.com>
11167
11168         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
11169         (Arm_relobj::Mapping_symbol_position,
11170          Arm_reloj::Mapping_symbol_position_less,
11171          Arm_relobj::Mapping_symbols_info): New types.
11172         (Target_arm::is_mapping_symbol_name): New method definition.
11173         (Arm_relobj::do_count_local_symbols): Save information about mapping
11174         symbols.
11175
11176 2010-01-11  Doug Kwan  <dougkwan@google.com>
11177
11178         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
11179         Arm_relocate_functions::thumb32_branch_upper,
11180         Arm_relocate_functions::thumb32_branch_lower,
11181         Arm_relocate_functions::thumb32_cond_branch_offset,
11182         Arm_relocate_functions::thumb32_cond_branch_upper,
11183         Arm_relocate_functions::thumb32_cond_branch_lower,
11184         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
11185         branch offset encoding.
11186         (Arm_relocate_functions::thumb_branch_common): Use new branch
11187         offset encoding methods to avoid code duplication.
11188         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
11189         (Stub_addend_reader::operator()): Use new branch encoding method
11190         to avoid code duplication.
11191
11192 2010-01-11  Doug Kwan  <dougkwan@google.com>
11193
11194         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
11195         (Target_arm::do_finalize_sections): Define special EXIDX section
11196         symbols only if referenced.
11197         * gc.h (Garbage_collection::add_reference): New method.
11198         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
11199         code duplication.
11200
11201 2010-01-11  Ian Lance Taylor  <iant@google.com>
11202
11203         * script.cc (Version_script_info::build_expression_list_lookup):
11204         Change complaing about duplicate wildcard match from error to
11205         warning.
11206
11207         * script.cc (class Lazy_demangler): Recreate--revert part of patch
11208         of 2009-12-30.
11209         (Version_script_info::Version_script_info): Initialize globs_,
11210         default_version_, default_is_global_, and exact_.  Don't
11211         initialize globals_ or locals_.
11212         (Version_script_info::build_lookup_tables): Build local symbols
11213         first.
11214         (Version_script_info::unquote): New function.
11215         (Version_script_info::add_exact_match): New function.
11216         (Version_script_info::build_expression_list_lookup): Remove lookup
11217         parameter.  Add is_global parameter.  Change all callers.  Handle
11218         wildcard pattern specially.  Unquote pattern.  Call
11219         add_exact_match.
11220         (Version_script_info::get_name_to_match): New function.
11221         (Version_script_info::get_symbol_version): New function.
11222         (Version_script_info::get_symbol_version_helper): Remove.
11223         (Version_script_info::check_unmatched_names): Call unquote.
11224         * script.h (class Version_script_info): Change get_symbol_version
11225         to be non-inline and add is_global parameter; change all callers.
11226         Rewrite symbol_is_local.  Update declarations.  Define struct
11227         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
11228         Remove globals_ and locals_ members.  Add exact_, globs_,
11229         default_version_, is_global_.
11230         (Version_script_info::Glob): Remove pattern, add expression and
11231         is_global.  Update constructor.  Change all callers.
11232         * dynobj.cc (Versions::finalize): Mark the version symbol as the
11233         default version.
11234         (Versions::symbol_section_contents): If a symbol is undefined, or
11235         defined in a dynamic object, set the version index to
11236         VER_NDX_LOCAL.
11237         * symtab.cc (Symbol_table::add_from_relobj): Don't call
11238         symbol_is_local.
11239         (Symbol_table::add_from_pluginobj): Likewise.
11240         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
11241
11242 2010-01-11  Doug Kwan  <dougkwan@google.com>
11243
11244         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
11245         (incremental_dump_LDADD): Add linking option for libintl.
11246         * Makefile.in: Regenerate.
11247
11248 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
11249
11250         PR gold/11144
11251         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
11252         instead of -Ds.
11253         * testsuite/Makefile.in: Regenerated.
11254
11255 2010-01-10  Doug Kwan  <dougkwan@google.com>
11256
11257         * options.h (DEFINE_var): Use parentheses around argument varname__
11258         in macro body to avoid any unintended subsequent substitutions.
11259
11260 2010-01-10  Ian Lance Taylor  <iant@google.com>
11261
11262         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
11263         candidates before doing symbol resolution.
11264
11265         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
11266         ODR candidates if only one is weak.
11267
11268 2010-01-08  Ian Lance Taylor  <iant@google.com>
11269
11270         * script.cc (Version_script_info::build_expression_list_lookup):
11271         Don't warn about ambiguous version, just record the ambiguity.
11272         (Version_script_info::get_symbol_version_helper): Give error if
11273         version is ambiguous.
11274
11275 2010-01-08  Doug Kwan  <dougkwan@google.com>
11276
11277         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
11278         prev_data_size_ and prev_addralign_.  Remove initializer for
11279         deleted data member has_been_changed_.
11280         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
11281         to determine if the table is empty.
11282         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
11283         Remove.
11284         (Stub_table::add_reloc_stub): Define method in class definition
11285         instead of just declaring it there.
11286         (Stub_table::add_cortex_a8_stub): New method definition.
11287         (Stub_table::update_data_size_and_addralign): Ditto.
11288         (Stub_table::finalize_stubs): Ditto.
11289         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
11290         (Stub_table::do_addralign_): Return address alignment in the
11291         (Stub_table::do_reset_address_and_file_offset): Define method in
11292         class definition instead of declaring it there.  Set current data
11293         size to be the data size of the previous pass.
11294         (Stub_table::set_final_data_size): Use current data size as the
11295         final data size.
11296         (Stub_table::relocate_stub): Change parameter type of stub from
11297         Reloc_stub pointer to Stub pointer.
11298         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
11299         (Stub_table::Cortex_a8_stub_list): New typedef.
11300         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
11301          Stub_table::prev_addralign_): New data member.
11302         (Arm_relobj::Arm_relobj): Initialize data member
11303         section_has_cortex_a8_workaround_.
11304         (Arm_relobj::section_has_cortex_a8_workaround,
11305          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
11306          definitions.
11307         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
11308         declarations.
11309         (Target_arm::relocate_stub): Change parameter type of stub from
11310         Reloc_stub pointer to Stub pointer.
11311         (Insn_template::size, Insn_template::alignment): Handle
11312         THUMB16_SPECIAL_TYPE.
11313         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
11314          Stub_table::update_data_size_and_addralign,
11315          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
11316         definitions.
11317         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
11318         (Stub_table::do_write): Ditto.
11319         (Target_arm::do_relax): Adjust code for changes in Stub_table.
11320
11321 2010-01-08  Ian Lance Taylor  <iant@google.com>
11322
11323         PR 11108
11324         * symtab.h (class Symbol): Remove fields is_target_special_ and
11325         has_plt_offset_.  Add field is_defined_in_discarded_section_.
11326         (Symbol::is_defined_in_discarded_section): New function.
11327         (Symbol::set_is_defined_in_discarded_section): New function.
11328         (Symbol::has_plt_offset): Rewrite.
11329         (Symbol::set_plt_offset): Verify that new offset is not -1U.
11330         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
11331         Don't initialize is_target_special_ or has_plt_offset_.
11332         Initialize is_defined_in_discarded_section_.
11333         (Symbol_table::add_from_relobj): If appropriate, set
11334         is_defined_in_discarded_section.
11335         * resolve.cc (Symbol::override_base_with_special): Don't test
11336         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
11337         * target-reloc.h (relocate_section): Do special handling for
11338         symbols defined in discarded sections for global symbols as well
11339         as local symbols.
11340
11341 2010-01-08  Ian Lance Taylor  <iant@google.com>
11342
11343         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
11344         the SHT_SYMTAB case.
11345
11346 2010-01-08  Ian Lance Taylor  <iant@google.com>
11347
11348         * object.cc (Sized_relobj::do_layout): Don't get confused if
11349         layout_eh_frame returns NULL.
11350
11351 2010-01-08  Ian Lance Taylor  <iant@google.com>
11352
11353         PR 11084
11354         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
11355         dynamic symbol table, use the normal symbol table.
11356         (Sized_dynobj::do_read_symbols): Remove assertion about type of
11357         symbol table.
11358
11359 2010-01-08  Ian Lance Taylor  <iant@google.com>
11360
11361         PR 11072
11362         * layout.cc (Layout::include_section): Remove .gnu_debuglink
11363         sections.
11364
11365 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
11366
11367         * version.cc (print_version): Change to "Copyright 2010".
11368
11369 2010-01-08  Ian Lance Taylor  <iant@google.com>
11370
11371         PR 10287
11372         PR 11063
11373         * i386.cc (class Target_i386): Change return type of plt_section
11374         to be non-const.
11375         (class Output_data_plt_i386): Add tls_desc_rel_ field.
11376         (Output_data_plt_i386::Output_data_plt_i386): Initialize
11377         tls_desc_rel_ field.
11378         (Output_data_plt_i386::rel_tls_desc): New function.
11379         (Target_i386::rel_tls_desc_section): New function.
11380         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
11381         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
11382         R_386_TLS_DESC reloc in rel_tls_desc_section.
11383         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
11384         Define struct Tlsdesc_info.
11385         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
11386         (Target_x86_64::do_reloc_symbol_index): New function.
11387         (Target_x86_64::add_tlsdesc_info): New function.
11388         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
11389         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
11390         tlsdesc_rel_ field.
11391         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
11392         all callers.
11393         (Output_data_plt_x86_64::rela_tlsdesc): New function.
11394         (Target_x86_64::rela_tlsdesc_section): New function.
11395         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
11396         handling.
11397         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
11398         (Target_x86_64::do_reloc_addend): New function.
11399         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
11400         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
11401         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
11402         (Output_reloc::type): New function.
11403         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
11404         (Output_reloc::is_target_specific): New function.
11405         (Output_reloc::target_arg): New function.
11406         (class Output_reloc) [SHT_RELA]: Add four new constructors for
11407         absolute relocs and target specific relocs.
11408         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
11409         add_target_specific.
11410         (class Output_data_reloc) [SHT_RELA]: Likewise.
11411         * output.cc (Output_reloc::Output_reloc): Add four new versions
11412         for absolute relocs and target specific relocs.
11413         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
11414         (Output_reloc::get_symbol_index): Likewise.
11415         (Output_reloc::local_section_offset): Check that local_sym_index_
11416         is not TARGET_CODE or 0.
11417         (Output_reloc::symbol_value): Likewise.
11418         (Output_reloc::write) [SHT_RELA]: Call target for target specific
11419         reloc.
11420         * target.h (class Target): Add reloc_symbol_index and reloc_addend
11421         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
11422         functions.
11423         * layout.cc (add_target_dynamic_tags): Use output section for
11424         DT_PLTRELSZ and DT_JMPREL.
11425
11426 2010-01-07  Ian Lance Taylor  <iant@google.com>
11427
11428         PR 11061
11429         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
11430         function.
11431         (class Output_data_reloc_generic): Define.
11432         (class Output_data_reloc_base): Change base class to
11433         Output_data_reloc_generic.  Change add() method to call
11434         bump_relative_reloc_count for a relative reloc.  Remove
11435         sort_relocs_ field.
11436         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
11437         to sort_relocs().
11438         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
11439         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
11440         appropriate.
11441         * layout.h (class Layout): Update declaration.
11442
11443 2010-01-07  Ian Lance Taylor  <iant@google.com>
11444
11445         * output.h (class Output_data): Add const version of
11446         output_section and do_output_section.
11447         (class Output_section_data): Add const version of
11448         do_output_section.
11449         (class Output_section): Likewise.
11450         * layout.cc (Layout::add_target_dynamic_tags): New function.
11451         * layout.h (class Layout): Update declarations.
11452         * arm.cc (Target_arm::do_finalize_sections): Use
11453         add_target_dynamic_tags.
11454         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11455         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11456         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11457         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11458
11459 2010-01-07  Ian Lance Taylor  <iant@google.com>
11460
11461         PR 11042
11462         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
11463         object as needed.
11464
11465 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
11466             Ian Lance Taylor  <iant@google.com>
11467
11468         PR 11019
11469         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
11470         Xindex::read_symtab_xindex.
11471
11472 2010-01-07  Doug Kwan  <dougkwan@google.com>
11473
11474         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
11475         (Insn_template::thumb16_bcond_insn): New method declaration.
11476         (Insn_template): Fix spelling.
11477         (Stub::thumb16_special): New method declaration.
11478         (Stub::do_write): Define virtual method which was previously pure
11479         virtual.
11480         (Stub::do_thumb16_special): New method declaration.
11481         (Stub::do_fixed_endian_write): New template member.
11482         (Reloc_stub::do_write): Remove.
11483         (Reloc_stub::do_fixed_endian_write): Remove.
11484         (Cortex_a8_stub): New class definition.
11485         (Stub_factory::make_cortex_a8_stub): New method definition.
11486         (Stub_factory::Stub_factory): Add missing static storage class
11487         qualifier for elf32_arm_stub_a8_veneer_blx.
11488
11489 2010-01-07  Ian Lance Taylor  <iant@google.com>
11490
11491         PR 10980
11492         * options.h (class General_options): Add --warn-unresolved-symbols
11493         and --error-unresolved-symbols.
11494         * errors.cc (Errors::undefined_symbol): Implement
11495         --warn-unresolved-symbols.
11496
11497         * options.h (class General_options): Add -z text and -z textoff.
11498         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
11499
11500 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
11501
11502         * gc.h (Garbage_collection::Cident_section_map): New typedef.
11503         (Garbage_collection::cident_sections): New function.
11504         (Garbage_collection::add_cident_section): New function.
11505         (Garbage_collection::cident_sections_): New member.
11506         (gc_process_relocs): Add references to sections whose names are C
11507         identifiers.
11508         * gold.h (cident_section_start_prefix): New constant.
11509         (cident_section_stop_prefix): New constant.
11510         (is_cident): New function.
11511         * layout.cc (Layout::define_section_symbols): Replace string constants
11512         with the newly defined constants.
11513         * object.cc (Sized_relobj::do_layout): Track sections whose names are
11514         C identifiers.
11515         * testsuite/Makefile.am: Add gc_orphan_section_test.
11516         * testsuite/Makefile.in: Regenerate.
11517         * testsuite/gc_orphan_section_test.cc: New file.
11518         * testsuite/gc_orphan_section_test.sh: New file.
11519
11520 2010-01-06  Ian Lance Taylor  <iant@google.com>
11521
11522         PR 10980
11523         * options.h (class General_options): Add --warn-shared-textrel.
11524         * layout.cc (Layout::finish_dynamic_section): Implement
11525         --warn-shared-textrel.
11526
11527         PR 10980
11528         * options.h (class General_options): Add --warn-multiple-gp.
11529
11530 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11531
11532         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
11533         $(THREADSLIB) and $(LIBDL).
11534         * Makefile.in: Rebuild.
11535
11536 2010-01-06  Ian Lance Taylor  <iant@google.com>
11537
11538         PR 10980
11539         * options.cc (General_options::parse_section_start): New function.
11540         (General_options::section_start): New function.
11541         (General_options::General_options): Initialize all members.
11542         * options.h: Include <map>
11543         (class General_options): Add --section-start.  Add section_starts_
11544         member.
11545         * layout.cc (Layout::attach_allocated_section_to_segment): If
11546         --section-start was used, set the address of the segment.  Remove
11547         local sort_sections.
11548         (Layout::relaxation_loop_body): If the address of the load segment
11549         has been set by --section-start, don't use it.
11550         * output.h (Output_segment::update_flags_for_output_section): New
11551         function.
11552         * output.cc (Output_segment::add_output_section): Call
11553         update_flags_for_output_section.
11554
11555 2010-01-05  Ian Lance Taylor  <iant@google.com>
11556
11557         PR 10980
11558         * options.h (class General_options): Add --undefined-version.
11559         * script.cc (struct Version_expression): Add was_matched_by_symbol
11560         field.
11561         (Version_script_info::matched_symbol): New function.
11562         (Version_script_info::get_symbol_version_helper): Call
11563         matched_symbol.
11564         (Version_script_info::check_unmatched_names): New function.
11565         * script.h (class Version_script_info): Update declarations.
11566         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
11567
11568         * options.h (class General_options): Use DEFINE_bool_alias for
11569         allow_multiple_definition.
11570         * resolve.cc (Symbol_table::should_override): Don't test
11571         allow_multiple_definition.
11572
11573         PR 10980
11574         * options.h (class General_options): Add --cref.
11575         * main.cc (main): Print cref table if --cref.  Don't close mapfile
11576         until after printing cref table.
11577         * cref.cc: Include "symtab.h".
11578         (class Cref_inputs): Define Cref_table_compare and Cref_table.
11579         (Cref_table_compare::operator()): New function.
11580         (Cref_inputs::gather_cref): New function.
11581         (filecol): New static const.
11582         (Cref_inputs::print_cref): New function.
11583         (Cref::print_cref): New function.
11584         * cref.h: Include <cstdio>.
11585         (class Cref): Update declarations.
11586         * mapfile.h (Mapfile::file): New function.
11587         * object.h (class Object): Define Symbols.  Declare virtual
11588         do_get_global_symbols.
11589         (Object::get_global_symbols): New function.
11590         * object.cc (Input_objects::add_object): Pass object to cref_ if
11591         --cref.
11592         (Input_objects::archive_start): Likewise.
11593         (Input_objects::archive_stop): Likewise.
11594         (Input_objects::print_cref): New function.
11595         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
11596         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
11597         --cref.
11598         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
11599         function.
11600         * plugin.h (class Sized_pluginobj): Update declarations.
11601
11602 2010-01-05  Ian Lance Taylor  <iant@google.com>
11603
11604         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
11605         to is_default_version.  Rename insdef to insdefault.
11606         (Symbol_table::add_from_relobj): Rename def to is_default_version
11607         and local to is_forced_local.
11608         (Symbol_table::add_from_pluginobj): Likewise.
11609         (Symbol_table::add_from_dynobj): Likewise.
11610         (Symbol_table::define_special_symbol): Rename insdef to
11611         insdefault.
11612
11613 2010-01-04  Ian Lance Taylor  <iant@google.com>
11614
11615         PR 10980
11616         * options.h (class General_options): Add
11617         --allow-multiple-definition and -z muldefs.
11618         * resolve.cc (Symbol_table::should_override): Don't warn about a
11619         multiple symbol definition if --allow-multiple-definition or -z
11620         muldefs.
11621
11622         PR 10980
11623         * options.h (class General_options): Add --add-needed and
11624         --copy-dt-needed-entries.  Tweak --as-needed help entry.
11625         * object.cc (Input_objects::check_dynamic_dependencies): Give an
11626         error if --copy-dt-needed-entries aka --add-needed is used and
11627         would cause a change in behaviour.
11628
11629         PR 10980
11630         * options.h (class General_options): Add -G as a short version of
11631         --shared.  Add no-op options -assert, -g, and -i.
11632
11633 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
11634
11635         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
11636         check for .text or .gnu.linkonce.t sections.
11637         * icf.cc (Icf::find_identical_sections): Ditto.
11638         Change the detection for mangled function name within the section
11639         name.
11640         * icf.h (is_section_foldable_candidate): New function.
11641
11642 2009-12-30  Ian Lance Taylor  <iant@google.com>
11643
11644         PR 10980
11645         * options.h (class General_options): Permit two dashes with
11646         --retain-symbols-file.
11647
11648 2009-12-30  Ian Lance Taylor  <iant@google.com>
11649
11650         PR 10979
11651         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
11652         don't put the file header and segment headers in the text
11653         segment.
11654
11655         PR 10979
11656         * common.cc (Sort_commons::operator()): Stabilize sort when both
11657         entries are NULL.
11658         (Symbol_table::do_allocate_commons_list): When allocating common
11659         symbols, skip a symbol which is no longer common.
11660         * symtab.h (Symbol::is_common): Test whether the symbol comes from
11661         an object before checking its type.
11662         * testsuite/common_test_2.c: New file.
11663         * testsuite/common_test_3.c: New file.
11664         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
11665         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
11666         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
11667         (common_test_2_pic.o, common_test_2.so): New targets.
11668         (common_test_3_pic.o, common_test_3.so): New targets.
11669         * testsuite/Makefile.in: Rebuild.
11670
11671         PR 10979
11672         * script.cc (read_input_script): If we see a new SECTIONS clause,
11673         and we have added an input section, give an error.
11674         * layout.h (class Layout): Add have_added_input_section function.
11675         Add have_added_input_section_ field.
11676         * layout.cc (Layout::Layout): Initialize
11677         have_added_input_section_.
11678         (Layout::layout): Set have_added_input_section_.
11679         (Layout::layout_eh_frame): Likewise.
11680
11681 2009-12-30  Ian Lance Taylor  <iant@google.com>
11682
11683         PR 10931
11684         * options.h (class General_options): Add --sort-common option.
11685         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
11686         * common.cc (Sort_common): Add sort_order parameter to
11687         constructor.  Add sort_order_ field.
11688         (Sort_commons::operator): Check sort_order_.
11689         (Symbol_table::allocate_commons): Determine the sort order.
11690         (Symbol_table::do_allocate_commons): Add sort_order parameter.
11691         Change all callers.
11692         (Symbol_table::do_allocate_commons_list): Likewise.
11693
11694 2009-12-30  Ian Lance Taylor  <iant@google.com>
11695
11696         PR 10916
11697         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
11698         symbols from this object, don't change the visibility of an
11699         undefined symbol.
11700         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
11701
11702 2009-12-30  Ian Lance Taylor  <iant@google.com>
11703
11704         PR 10861
11705         * script.h (class Version_script_info): Define Language enum.
11706         Update declarations.  Define Glob, Exact, and Lookup types.  Add
11707         new fields globals_, locals_, and is_finalized_.
11708         * script.cc: Various formatting fixes.
11709         (class Parser_closure): Change language_stack_ from a vector of
11710         std::string to one of Version_script_info::Language.  Adjust all
11711         uses accordingly.
11712         (class Lazy_demangler): Remove.
11713         (struct Version_expression): Change language from std::string to
11714         Version_script_info::Language.
11715         (Version_script_info::Version_script_info): New function.
11716         (Version_script_info::~Version_script_info): Don't call clear.
11717         (Version_script_info::finalize): New function.
11718         (Version_script_info::build_lookup_tables): New function.
11719         (Version_script_info::build_expression_list_lookup): New
11720         function.
11721         (Version_script_info::get_symbol_version_helper): Rewrite to use
11722         lookup tables.
11723         (Version_script_info::print_expression_list): Adjust to use
11724         Version_script_info::Language.
11725         (script_push_lex_into_version_mode): Check that the version script
11726         has not been finalized.
11727         (version_script_push_lang): Change language string to
11728         Version_script_info::Language.
11729         * options.cc (Command_line::version_script): New function.
11730         * options.h (class General_options): Add finalize_dynamic_list
11731         function.  Change version_script from declaration to definition.
11732         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
11733         * testsuite/version_script.map: Remove duplicate def of foo.
11734         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
11735         version_script.map.
11736         * testsuite/Makefile.in: Rebuild.
11737
11738 2009-12-30  Ian Lance Taylor  <iant@google.com>
11739
11740         PR 10843
11741         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
11742         if the input symbol index is 0, make the output symbol index 0.
11743
11744 2009-12-30  Ian Lance Taylor  <iant@google.com>
11745
11746         PR 10670
11747         * options.h (class General_options): Add -x/--discard-all.
11748         * object.cc (Sized_relobj::do_count_local_symbols): Handle
11749         --discard-all.  If the local symbol needs a dynamic entry, check
11750         that before handling --discard-locals.
11751
11752 2009-12-30  Ian Lance Taylor  <iant@google.com>
11753
11754         PR 10450
11755         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
11756         flags to PF_R.
11757         (Output_segment::add_output_section): Don't change the flags if
11758         the type is PT_TLS.
11759
11760         PR 10450
11761         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
11762         GNU hash table if they need a dynamic value.  Otherwise, don't add
11763         them if they are defined in a dynamic object or are forced local.
11764
11765 2009-12-29  Ian Lance Taylor  <iant@google.com>
11766
11767         PR 10450
11768         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
11769         .gnu.hash table for a 32-bit target.
11770
11771         PR 10450
11772         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
11773         regular and a dynamic object only needs a dynamic symbol table
11774         entry if it is externally visible.
11775
11776         PR 10450
11777         * i386.cc (class Target_i386): Initialize global_offset_table_ in
11778         constructor.  Add global_offset_table_ field.
11779         (Target_i386::got_section): Set global_offset_table_.
11780         (Target_i386::do_finalize_sections): Set global_offset_table_
11781         size.
11782         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
11783         in constructor.  Add global_offset_table_ field.
11784         (Target_x86_64::got_section): Set global_offset_table_.
11785         (Target_x86_64::do_finalize_sections): Set global_offset_table_
11786         size.
11787
11788         * layout.cc (Layout::Layout): Initialize increase_relro_.
11789         (Layout::get_output_section): Add is_relro, is_last_relro, and
11790         is_first_non_relro parameters.  Change all callers.
11791         (Layout::choose_output_section): Likewise.
11792         (Layout::add_output_section_data): Likewise.
11793         (Layout::make_output_section): Likewise.
11794         (Layout::set_segment_offsets): Clear increase_relro when using a
11795         linker script.
11796         * layout.h (class Layout): Add increase_relro method.  Add
11797         increase_relro_ field.  Update declarations.
11798         * output.cc (Output_section::Output_section): Initialize
11799         is_last_relro_ and is_first_non_relro_.
11800         (Output_segment::add_output_section): Group relro sections is
11801         do_sort is true.  Handle is_last_relro and is_first_non_relro.
11802         (Output_segment::maximum_alignment): Remove relro handling.
11803         (Output_segment::set_section_addresses): Add increase_relro
11804         parameter.  Change all callers.  Add initial alignment to align
11805         relro sections on separate page.  Remove old relro handling.
11806         (Output_segment::set_section_list_addresses): Remove in_relro
11807         parameter.  Change all callers.
11808         (Output_segment::set_offset): Add increase parameter.  Change all
11809         callers.  Remove old relro handling.
11810         * output.h (class Output_section): Add new methods: is_last_relro,
11811         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
11812         Add is_last_relro_ and is_first_non_relro_ fields.
11813         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
11814         Create separate .got.plt section.  Call increase_relro.
11815         * x86_64.cc (Target_x86_64::got_section): Likewise.
11816         * testsuite/relro_script_test.t: Add .got.plt.
11817
11818         PR 10450
11819         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
11820         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
11821         (Layout::finalize): Call set_dynamic_symbol_size.
11822         (Layout::set_dynamic_symbol_size): New function.
11823         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
11824         set_dynamic_symbol_size.
11825
11826         PR 10450
11827         * output.h (class Output_section): Add is_entsize_zero_ field.
11828         * output.cc (Output_section::Output_section): Initialize
11829         is_entsize_zero_.
11830         (Output_section::set_entsize): If two different entsizes are
11831         requested, force it to zero.
11832         (Output_section::add_input_section): Set flags for .debug_str
11833         before updating section flags.  Set entsize.
11834         (Output_section::update_flags_for_input_section): Set SHF_MERGE
11835         and SHF_STRING if all input sections have those flags.
11836
11837 2009-12-29   Rafael Espindola  <espindola@google.com>
11838
11839         * main.cc (main): Fix the sys time reporting.
11840         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
11841         reporting.
11842
11843 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
11844
11845         * options.cc (General_options::parse_version): Allow -v to exit
11846         without an error if there is nothing to link.
11847
11848 2009-12-29  Ian Lance Taylor  <iant@google.com>
11849
11850         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
11851         using a version of gcc before 4.1.
11852         * configure: Rebuild.
11853
11854 2009-12-28  Chris Demetriou  <cgd@google.com>
11855
11856         * attributes.cc (Output_attributes_section_data::do_write): Use
11857         std::vector::front rather than std::vector::data.
11858
11859 2009-12-28  Ian Lance Taylor  <iant@google.com>
11860
11861         * symtab.h (class Symbol_table): Add enum Defined.
11862         * resolve.cc (Symbol_table::should_override): Add defined
11863         parameter.  Change all callers.  Test whether object is NULL
11864         before calling a method on it.
11865         (Symbol_table::report_resolve_problem): Add defined parameter.
11866         Change all callers.
11867         (Symbol_table::should_override_with_special): Likewise.
11868         * symtab.cc (Symbol_table::define_in_output_data): Add defined
11869         parameter.  Change all callers.
11870         (Symbol_table::do_define_in_output_data): Likewise.
11871         (Symbol_table::define_in_output_segment): Likewise.
11872         (Symbol_table::do_define_in_output_segment): Likewise.
11873         (Symbol_table::define_as_constant): Likewise.
11874         (Symbol_table::do_define_as_constant): Likewise.
11875         * script.h (class Symbol_assignment): Add is_defsym parameter to
11876         constructor; change all callers.
11877         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
11878         parameter.  Change all callers.  Add is_defsym_ field.
11879         (class Parser_closure): Add parsing_defsym parameter to
11880         constructor; change all callers.  Add parsing_defsym accessor
11881         function.  Add parsing_defsym_ field.
11882
11883 2009-12-28  Ian Lance Taylor  <iant@google.com>
11884
11885         * gold.cc (queue_middle_tasks): Fix formatting.
11886         * object.cc (Relobj::is_section_name_included): Likewise.
11887
11888 2009-12-23  Ian Lance Taylor  <iant@google.com>
11889
11890         * i386.cc (Target_i386::do_calls_non_split): Recognize
11891         -fsplit-stack prologue for a function with a static chain.
11892         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
11893         -fsplit-stack prologue when using %r11.
11894
11895 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
11896
11897         * options.cc (General_options::parse_version): Make -v continue and do
11898         the link like GNU ld does.
11899
11900 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
11901
11902         * Makefile.am (CCFILES): Add timer.cc.
11903         (HFILES): Add timer.h.
11904         * configure.ac: Check for sysconf and times.
11905         * main.cc: include timer.h.
11906         (main): Use Timer instead of get_run_time.
11907         * timer.cc: New.
11908         * timer.h: New.
11909         * workqueue.cc: include timer.h.
11910         (Workqueue::find_and_run_task):
11911         Report user, sys and wall time.
11912         * Makefile.in: Regenerate.
11913         * config.in: Regenerate.
11914         * configure: Regenerate.
11915
11916 2009-12-16  Doug Kwan  <dougkwan@google.com>
11917
11918         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
11919         sections.
11920         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
11921         relaxed input sections.
11922         * output.cc (Output_section::find_relaxed_input_section): Change
11923         return type to Output_relaxed_input_section pointer.  Adjust code
11924         for new type of relaxed_input_section_map_.
11925         * output.h (Output_section::find_relaxed_input_section): Change
11926         return type to Output_relaxed_input_section pointer.
11927         (Output_section::Output_relaxed_input_section_by_input_section_map):
11928         New type.
11929         (Output_section::relaxed_input_section_map_): Change type to
11930         Output_section::Output_relaxed_input_section_by_input_section_map.
11931         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
11932         input section.
11933
11934 2009-12-15  Ian Lance Taylor  <iant@google.com>
11935
11936         * layout.cc (Layout::create_shstrtab): Only write out after input
11937         sections if we are compressing debug sections.
11938
11939 2009-12-15  Ian Lance Taylor  <iant@google.com>
11940
11941         * archive.cc (Archive::add_symbols): Only look up a symbol without
11942         a version if there is, in fact, a version.
11943
11944 2009-12-14  Ian Lance Taylor  <iant@google.com>
11945
11946         Revert -Wshadow changes, all changes from:
11947         2009-12-11  Doug Kwan  <dougkwan@google.com>
11948         2009-12-11  Nick Clifton  <nickc@redhat.com>
11949         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
11950
11951 2009-12-11  Doug Kwan  <dougkwan@google.com>
11952
11953         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
11954         due to -Wshadow.
11955         * attributes.cc (Object_attribute::size): Ditto.
11956         (Attributes_section_data::size): Ditto.
11957         (Attributes_section_data::Attributes_section_data): Ditto.
11958         (Output_attributes_section_data::do_write): Ditto.
11959         * attributes.h (Object_attribute::set_type): Ditto.
11960         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
11961
11962 2009-12-11  Nick Clifton  <nickc@redhat.com>
11963
11964         * archive.cc: Fix shadowed variable warnings.
11965         * arm.cc: Likewise.
11966         * compressed_output.cc: Likewise.
11967         * compressed_output.h: Likewise.
11968         * configure: Likewise.
11969         * dwarf_reader.cc: Likewise.
11970         * dynobj.cc: Likewise.
11971         * dynobj.h: Likewise.
11972         * ehframe.cc: Likewise.
11973         * ehframe.h: Likewise.
11974         * errors.cc: Likewise.
11975         * expression.cc: Likewise.
11976         * fileread.cc: Likewise.
11977         * fileread.h: Likewise.
11978         * freebsd.h: Likewise.
11979         * i386.cc: Likewise.
11980         * icf.cc: Likewise.
11981         * incremental.h: Likewise.
11982         * layout.cc: Likewise.
11983         * layout.h: Likewise.
11984         * mapfile.cc: Likewise.
11985         * merge.cc: Likewise.
11986         * merge.h: Likewise.
11987         * object.cc: Likewise.
11988         * object.h: Likewise.
11989         * options.h: Likewise.
11990         * output.cc: Likewise.
11991         * output.h: Likewise.
11992         * parameters.cc: Likewise.
11993         * plugin.cc: Likewise.
11994         * powerpc.cc: Likewise.
11995         * reduced_debug_output.cc: Likewise.
11996         * reduced_debug_output.h: Likewise.
11997         * reloc.cc: Likewise.
11998         * reloc.h: Likewise.
11999         * resolve.cc: Likewise.
12000         * script-sections.cc: Likewise.
12001         * script.cc: Likewise.
12002         * script.h: Likewise.
12003         * sparc.cc: Likewise.
12004         * symtab.cc: Likewise.
12005         * symtab.h: Likewise.
12006         * target-select.cc: Likewise.
12007         * target-select.h: Likewise.
12008         * token.h: Likewise.
12009         * workqueue.cc: Likewise.
12010         * workqueue.h: Likewise.
12011         * x86_64.cc: Likewise.
12012
12013 2009-12-10  Doug Kwan  <dougkwan@google.com>
12014
12015         * arm.cc (attributes.h): New include.
12016         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
12017         (Arm_relobj::~Arm_relobj): Delete object pointed by
12018         attributes_section_data_.
12019         (Arm_relobj::attributes_section_data): New method definition.
12020         (Arm_relobj::attributes_section_data_): New data member declaration.
12021         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
12022         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
12023         attributes_section_data_.
12024         (Arm_dynobj::attributes_section_data): New method definition.
12025         (Arm_dynobj::attributes_section_data_): New data member declaration.
12026         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
12027         initialization value of may_use_blx_ to false.
12028         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
12029         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
12030         object attributes to compute results instead of hard-coding.
12031         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
12032         Target_arm::get_secondary_compatible_arch,
12033         Target_arm::set_secondary_compatible_arch
12034         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12035         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
12036         New method declarations.
12037         (Target_arm::get_aeabi_object_attribute): New method definition.
12038         (Target_arm::attributes_section_data_): New data member declaration.
12039         (read_arm_attributes_section): New template definition.
12040         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
12041         (Arm_dynobj::do_read_symbols): Ditto.
12042         (Target_arm::do_finalize_sections): Merge attributes sections from
12043         input.  Check for BLX use after attributes section merging.
12044         Fix __exidx_start and __exidx_end visibility.  Create an
12045         .ARM.attributes section if necessary.
12046         (Target_arm::get_secondary_compatible_arch,
12047         Target_arm::set_secondary_compatible_arch,
12048         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12049         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
12050         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
12051         New method definitions.
12052
12053 2009-12-09  Ian Lance Taylor  <iant@google.com>
12054
12055         * plugin.cc (Plugin::load): Don't cast from void* to a function
12056         pointer.
12057
12058 2009-12-09  Ian Lance Taylor  <iant@google.com>
12059
12060         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
12061         information fields.
12062
12063 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
12064
12065         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
12066         Replace two_file_shared_1.so with two_file_shared_2.so.
12067         * testsuite/Makefile.in: Regenerated.
12068
12069 2009-12-08  Doug Kwan  <dougkwan@google.com>
12070
12071         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
12072         (HFILES): Add attributes.h and int_encoding.h.
12073         * Makefile.in: Regenerate.
12074         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
12075         function definitions to int_encoding.cc
12076         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
12077         prototypes to int_encoding.h
12078         * reduced_debug_output.cc (int_encoding.h): New include.
12079         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
12080         function definitions to int_encoding.cc
12081         (insert_into_vector, read_from_pointer): Move template definitions to
12082         int_encoding.h
12083         * attributes.cc: New file.
12084         * attributes.h: New file.
12085         * int_encoding.cc: New file.
12086         * int_encoding.h: New file.
12087
12088 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
12089
12090         PR gold/11055
12091         * incremental-dump.cc (dump_incremental_inputs): New.
12092         (main): Use dump_incremental_inputs.
12093
12094 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
12095
12096         PR gold/10893
12097         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
12098         checking elfcpp::STT_FUNC.
12099         (Target_i386::Relocate::relocate): Likewise.
12100         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
12101
12102         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
12103         symbols from shared libraries into normal FUNC symbols.
12104
12105         * symtab.h (Symbol): Add is_func and use it.
12106
12107 2009-12-05  Doug Kwan  <dougkwan@google.com>
12108
12109         * arm.cc (Target_arm::arm_info): Initialize new fields
12110         attributes_section and attributes_vendor.
12111         * i386.cc (Target_i386::i386_info): Same.
12112         * object.cc (Sized_relobj::do_layout): Skip attribute section.
12113         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
12114         fields attributes_section and attributes_vendor.
12115         * sparc.cc (Target_sparc::sparc_info): Same.
12116         * target.h (Target::attributes_section, Target::attributes_vendor,
12117         Target::is_attributes_section, Target::attribute_arg_type,
12118         Target::attributes_order): New method definitions.
12119         (Target::Target_info::attributes_section,
12120         Target::Target_info::attributes_vendor): New fields.
12121         (Target::do_attribute_arg_type, Target::do_attributes_order): New
12122         virtual method definitions.
12123         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
12124         attributes_section and attributes_vendor.
12125         * testsuite/testfile.cc (Target_test::test_target_info): Same.
12126
12127 2009-12-05  Doug Kwan  <dougkwan@google.com>
12128
12129         * arm.cc: Update comments about interworking and stub generation.
12130         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
12131         considered as non-PIC.
12132         (Arm_relocate_functions::base_abs): Fix formatting.
12133         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
12134         of function to use GOT entry address instead of offset.
12135         (Target_arm::Scan::global): Issue an error if a symbol would need a
12136         PLT does not get one because it is untyped.  Remove code to create
12137         dynamic symbols for relative branches.
12138         (Target_arm::Relocate::relocate: Use 0 instead of false since function
12139         takes unsigned integer instead of boolean.
12140
12141 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
12142
12143         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
12144         (two_file_test_LDADD): Likewise.
12145         (common_test_1_LDADD): Likewise.
12146         (exception_test_LDADD) Likewise.
12147         (weak_test_LDADD): Likewise.
12148         (many_sections_test_LDADD): Likewise.
12149         (initpri1_LDADD): Likewise.
12150         (script_test_1_LDADD): Likewise.
12151         (script_test_2_LDADD): Likewise.
12152         (justsyms_LDADD): Likewise.
12153         (binary_test_LDADD): Likewise.
12154         (large_LDADD): Likewise.
12155         * testsuite/Makefile.in: Regenerated.
12156
12157 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
12158
12159         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
12160         (Symbol_table::override_with_special): Likewise.
12161         (Symbol_table::add_from_object): Likewise.
12162
12163 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12164
12165         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12166         Don't set the data_offset twice.
12167
12168 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12169
12170         * testsuite/Makefile.in: Regenerate.
12171
12172 2009-12-03  Doug Kwan  <dougkwan@google.com>
12173
12174         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
12175         (Target_arm::do_finalize_sections): Add parameter for symbol table
12176         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
12177         * i386.cc (Target_i386::do_finalize_sections): Add an additional
12178         parameter for symbol table pointer.
12179         * layout.cc (Layout::finalize): Call Target::finalize_sections with
12180         an additional parameter for a pointer to symbol table.
12181         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
12182         parameter for a symbol table pointer.
12183         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
12184         * target.h (Target::finalize_sections, Target::do_finalize_sections):
12185         Ditto.
12186         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
12187         parameter for a symbol table pointer.
12188
12189 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
12190
12191         * incremental.cc (Incremental_inputs_header)
12192         (Incremental_inputs_header_write, Incremental_inputs_entry)
12193         (Incremental_inputs_entry_write): Move ...
12194         * incremental.h (Incremental_inputs_header)
12195         (Incremental_inputs_header_write, Incremental_inputs_entry)
12196         (Incremental_inputs_entry_write): here.
12197
12198 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12199
12200         * incremental.cc (make_sized_incremental_binary): Set the target.
12201         Error if it is incompatible.
12202         * output.h (Output_file): Add filename method.
12203
12204 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12205
12206         * incremental.cc (Incremental_inputs_entry): Remove unused argument
12207         from the get_* methods.
12208
12209 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12210
12211         * incremental-dump.cc (main): Check that the offeset of a script is 0.
12212         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12213         Write 0 for the data_offset of scripts.
12214
12215 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12216
12217         * testsuite/Makefile.am: Add the incremental_test.sh test.
12218         * testsuite/incremental_test.sh: New.
12219         * testsuite/incremental_test_1.c: New.
12220         * testsuite/incremental_test_2.c: New.
12221
12222 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
12223
12224         * incremental-dump.cc (main): Fix typos.
12225
12226 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
12227
12228         PR gold/11025
12229         * incremental-dump.cc (main): Use llu to print 64 bit values.
12230
12231 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
12232             H.J. Lu  <hongjiu.lu@intel.com>
12233
12234         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
12235         $(LIBDL).
12236         (incremental_dump_LDADD): Likewise.
12237         * Makefile.in: Regenerated.
12238
12239 2009-11-25  Doug Kwan  <dougkwan@google.com>
12240
12241         Revert:
12242
12243         2009-11-25  Doug Kwan  <dougkwan@google.com>
12244
12245                 * arm.cc (Target_arm::Target_arm): Move method definition
12246                 outside of class definition.  Add code to handle
12247                 --target1-rel, --target1-abs and --target2= options.
12248                 (Target_arm::get_reloc_reloc_type): Change method to be
12249                 non-static and const.
12250                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
12251                 New data member declaration.
12252                 (Target_arm::Scan::local, Target_arm::Scan::global,
12253                 Target_arm::Relocate::relocate,
12254                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12255                 Adjust call to Target_arm::get_real_reloc_type.
12256                 (Target_arm::get_real_reloc_type): Use command line options
12257                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12258                 * options.h (--target1-rel, --target1-abs, --target2): New
12259                 ARM-only options.
12260
12261 2009-11-25  Doug Kwan  <dougkwan@google.com>
12262
12263         * arm.cc (Target_arm::Target_arm): Move method definition outside of
12264         class definition.  Add code to handle --target1-rel, --target1-abs
12265         and --target2= options.
12266         (Target_arm::get_reloc_reloc_type): Change method to be non-static
12267         and const.
12268         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
12269         member declaration.
12270         (Target_arm::Scan::local, Target_arm::Scan::global,
12271         Target_arm::Relocate::relocate,
12272         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
12273         call to Target_arm::get_real_reloc_type.
12274         (Target_arm::get_real_reloc_type): Use command line options to
12275         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12276         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
12277         options.
12278
12279 2009-11-25  Doug Kwan  <dougkwan@google.com>
12280
12281         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
12282         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
12283         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
12284         formatting.
12285         (Arm_relocate_functions::thm_call): Replace body with a call to
12286         Arm_relocate_functions::thumb_branch_common.
12287         (Arm_relocate_functions::thm_jump24,
12288         Arm_relocate_functions::thm_xpc22): New method definitions.
12289         (Arm_relocate_functions::thumb_branch_common): New method definition.
12290         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
12291         operator.
12292         (Target_arm::Relocate::relocate): Adjust call to thm_call.
12293         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
12294
12295 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12296
12297         * Makefile.am: Build incremental-dump
12298         * Makefile.in: Regenerate.
12299         * incremental-dump.cc: New.
12300         * incremental.cc (Incremental_inputs_header_data,
12301         Incremental_inputs_entry_data): Move to incremental.h
12302         * incremental.h: (Incremental_inputs_header_data,
12303         Incremental_inputs_entry_data): Move from incremental.cc
12304
12305 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12306
12307         * incremental.cc (Incremental_inputs_header,
12308         Incremental_inputs_header_write, Incremental_inputs_entry,
12309         Incremental_inputs_entry_write): Add a typedef with the data type.
12310
12311 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12312
12313         * incremental.cc (Incremental_inputs_header,
12314         Incremental_inputs_header_write, Incremental_inputs_entry,
12315         Incremental_inputs_entry_write): Update comment about which
12316         type has the filed descriptions.
12317
12318 2009-11-15  Doug Kwan  <dougkwan@google.com>
12319
12320         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
12321         (Arm_relocate_functions::arm_branch_common): Change method defintion
12322         in class definition to a method declaration and update list of formal
12323         parameters.
12324         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
12325         Arm_relocation_functions::jump24): Adjust call to
12326         Arm_relocate_functions::arm_branch_common.  Update list of formal
12327         parameters.
12328         (Arm_relocate_functions::xpc25): New method definition.
12329         (Arm_relocate_functions::arm_branch_common): Move method defintion
12330         out from class definition.  Use stubs for mode-switching and extending
12331         branch ranges.
12332         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
12333         specially.  Change code to enable use of stubs in ARM branches.
12334
12335 2009-11-10  Doug Kwan  <dougkwan@google.com>
12336
12337         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
12338         in method declaration.
12339         (Target_arm::relocate_stub): New method declaration.
12340         (Target_arm::default_target): Change to return a pointer instead of
12341         a const reference.
12342         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
12343         Target_arm::default_target.
12344         (Arm_Relobj::do_relocate_sections): Remove options paramater in
12345         method definition.
12346         (Target_arm::relocate_section): Adjust view.
12347         (Target_arm::relocate_stub): New method definition.
12348
12349 2009-11-10  Doug Kwan  <dougkwan@google.com>
12350
12351         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
12352         a format warning.
12353         * incremental.cc (open_incremental_binary): Initialized local
12354         variables to avoid warnings.
12355         * object.cc (make_elf_object): Ditto.
12356         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
12357         a format warning.
12358
12359 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
12360
12361         PR gold/10930
12362         * testsuite/plugin_test.c: Include "config.h".
12363
12364 2009-11-09  Doug Kwan  <dougkwan@google.com>
12365
12366         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
12367         (arm_symbol_value): Remove.
12368         (Arm_relocate_functions::arm_branch_common,
12369         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
12370         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
12371         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
12372         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
12373         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
12374         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
12375         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
12376         Arm_relocate_functions::thm_mobw_abs_nc,
12377         Arm_relocate_functions::thm_mov_abs,
12378         Arm_relocate_functions::movw_prel_nc,
12379         Arm_relocate_functions::thm_movt_abs,
12380         Arm_relocate_functions::movt_prel,
12381         Arm_relocate_functions::thm_movw_prel_nc,
12382         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
12383         (Target_arm::Relocate::relocate): Only decompose address into two
12384         parts if relocation type uses the thumb-bit and pass the actual
12385         bit instead of a flag indicating that the thumb-bit is used.  Adjust
12386         calls to methods in Arm_relocate_functions for this change.
12387
12388 2009-11-08  Ian Lance Taylor  <iant@google.com>
12389
12390         PR 10925
12391         * reloc.cc: Instantiate
12392         Sized_relobj::initialize_input_to_output_maps and
12393         Sized_relobj:free_input_to_output_maps.
12394
12395 2009-11-06  Ian Lance Taylor  <iant@google.com>
12396
12397         PR 10876
12398         * defstd.cc (in_segment): Set only_if_ref true for "end".
12399
12400 2009-11-06  Doug Kwan  <dougkwan@google.com>
12401
12402         * arm.cc (class Reloc_stub): Correct a comment.
12403         (Target_arm::Target_arm): Initialize arm_input_section_map_.
12404         (Target_arm::scan_section_for_stubs): New method declaration.
12405         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
12406         Change methods from private to protected.
12407         (Target_arm::do_may_relax): New method definition.
12408         (Target_arm::do_relax, Target_arm::group_sections,
12409         Target_arm::scan_reloc_for_stub,
12410         Target_arm::scan_reloc_section_for_stubs): New method declarations.
12411         (Target_arm::arm_input_section_map_): New data member declaration.
12412         (Target_arm::scan_reloc_for_stub,
12413         Target_arm::scan_reloc_section_for_stubs,
12414         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
12415         Target_arm::do_relax): New method definitions.
12416
12417 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
12418
12419         * configure.ac: Check for (struct stat)::st_mtim
12420         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
12421         * config.in: Regenerate.
12422         * configure: Regenerate.
12423
12424 2009-11-05  Ian Lance Taylor  <iant@google.com>
12425
12426         PR 10910
12427         * output.cc (Output_segment::add_output_section): Add missing
12428         return statement.
12429
12430 2009-11-04  Ian Lance Taylor  <iant@google.com>
12431
12432         PR 10880
12433         * object.h (class Object): Add is_needed and set_is_needed
12434         methods.  Add is_needed_ field.  Make bool fields into bitfields.
12435         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
12436         defined in a dynamic object and referenced by a regular object,
12437         set is_needed for the dynamic object.
12438         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
12439         if the file is marked with as_needed and it is not needed.
12440
12441 2009-11-04  Ian Lance Taylor  <iant@google.com>
12442
12443         PR 10887
12444         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
12445         tags if data is discarded by linker script.
12446         * i386.cc (Target_i386::do_finalize_sections): Likewise.
12447         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
12448         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
12449         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
12450
12451 2009-11-04  Ian Lance Taylor  <iant@google.com>
12452
12453         * layout.cc (Layout::get_output_section): Add is_interp and
12454         is_dynamic_linker_section parameters.  Change all callers.
12455         (Layout::choose_output_section): Likewise.
12456         (Layout::make_output_section): Likewise.
12457         (Layout::add_output_section_data): Add is_dynamic_linker_section
12458         parameter.  Change all callers.
12459         * layout.h (class Layout): Update declarations.
12460         * output.h (class Output_section): Add is_interp, set_is_interp,
12461         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
12462         Add is_interp_, is_dynamic_linker_section_ fields.  Change
12463         generate_code_fills_at_write_ to a bitfield.
12464         * output.cc (Output_section::Output_sections): Initialize new
12465         fields.
12466         (Output_segment::add_output_section): Add do_sort parameter.
12467         Change all callers.
12468
12469 2009-11-03  Ian Lance Taylor  <iant@google.com>
12470
12471         PR 10860
12472         * options.h (class General_options): Add --warn-common.
12473         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
12474         merging two common symbols.
12475         (Symbol_table::should_override): Handle --warn-common when merging
12476         a common symbol with a defined symbol.  Use report_resolve_problem
12477         for multiple definitions.
12478         (Symbol_table::report_resolve_problem): New function.
12479         * symtab.h (class Symbol_table): Declare report_resolve_problem.
12480
12481 2009-11-03  Doug Kwan  <dougkwan@google.com>
12482
12483         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
12484         stub_factory_.
12485         (Target_arm::stub_factory): New method definition.
12486         (Target_arm::new_arm_input_section,
12487         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
12488         Target_arm::reloc_uses_thumb_bit): New method declarations.
12489         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
12490         New type definitions.
12491         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
12492         member declarations.
12493         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
12494         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
12495         New method definitions.
12496
12497 2009-11-03  Ian Lance Taylor  <iant@google.com>
12498
12499         * options.h (class General_options): Add --warn_constructors.
12500
12501 2009-11-03  Ian Lance Taylor  <iant@google.com>
12502
12503         PR 10893
12504         * defstd.cc (in_section): Add entries for __rel_iplt_start,
12505         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
12506
12507 2009-11-03  Ian Lance Taylor  <iant@google.com>
12508
12509         PR 10895
12510         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
12511         --msgid-bugs-address.
12512         (install-pdf): New target.
12513         (install-data_yes): Look up one directory to find mkinstalldirs.
12514
12515 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
12516
12517         * po/Make-in (.po.gmo): Don't generate .gmo files in source
12518         tree.
12519
12520 2009-10-30  Doug Kwan  <dougkwan@google.com>
12521
12522         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
12523
12524 2009-10-30  Doug Kwan  <dougkwan@google.com>
12525
12526         * arm.cc (Stub_addend_reader): New struct template definition
12527         and partial specializations.
12528         (Stub_addend_reader::operator()): New method definition for a
12529         partially specialized template.
12530
12531 2009-10-30  Doug Kwan  <dougkwan@google.com>
12532
12533         * arm.cc (Arm_relobj::processor_specific_flags): New method
12534         definition.
12535         (Arm_relobj::do_read_symbols): New method declaration.
12536         (Arm_relobj::processor_specific_flags_): New data member declaration.
12537         (Arm_dynobj): New class definition.
12538         (Target_arm::do_finalize_sections): Add input_objects parameter.
12539         (Target_arm::do_adjust_elf_header): New method declaration.
12540         (Target_arm::are_eabi_versions_compatible,
12541         (Target_arm::merge_processor_specific_flags): New method declaration.
12542         (Target_arm::do_make_elf_object): New overloaded method definitions
12543         and declaration.
12544         (Arm_relobj::do_read_symbols): New method definition.
12545         (Arm_dynobj::do_read_symbols): Ditto.
12546         (Target_arm::do_finalize_sections): Add input_objects parameters.
12547         Merge processor-specific flags from all input objects.
12548         (Target_arm::are_eabi_versions_compatible,
12549         Target_arm::merge_processor_specific_flags,
12550         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
12551         New method definitions.
12552         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
12553         Input_objects pointer type parameter.
12554         * layout.cc (Layout::finalize): Pass input objects to target's.
12555         finalize_sections function.
12556         * output.cc (Output_file_header::do_sized_write): Set ELF file
12557         header's processor-specific flags.
12558         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
12559         Input_objects pointer type parameter.
12560         * sparc.cc (Target_sparc::do_finalize_sections): Same.
12561         * target.h (Input_objects): New forward class declaration.
12562         (Target::processor_specific_flags,
12563         Target::are_processor_specific_flags_sect): New method definitions.
12564         (Target::finalize_sections): Add input_objects parameter.
12565         (Target::Target): Initialize processor_specific_flags_ and
12566         are_processor_specific_flags_set_.
12567         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
12568         parameter.
12569         (Target::set_processor_specific_flags): New method definition.
12570         (Target::processor_specific_flags_,
12571         Target::are_processor_specific_flags_set_): New data member
12572         declarations.
12573         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
12574         Input_objects pointer type parameter.
12575
12576 2009-10-30  Doug Kwan  <dougkwan@google.com>
12577
12578         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
12579
12580 2009-10-28  Ian Lance Taylor  <iant@google.com>
12581
12582         * object.h (class Relobj): Drop options parameter from
12583         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
12584         do_scan_relocs, do_relocate.  Change all callers.
12585         (class Sized_relobj): Drop options parameters from
12586         do_gc_process_relocs, do_scan_relocs, do_relocate,
12587         do_relocate_sections, relocate_sections, emit_relocs_scan,
12588         emit_relocs_scan_reltype.  Change all callers.
12589         (struct Relocate_info): Remove options field and all references to
12590         it.
12591         * reloc.h (class Read_relocs): Remove options constructor
12592         parameter and options_ field.  Change all callers.
12593         (class Gc_process_relocs, class Scan_relocs): Likewise.
12594         (class Relocate_task): Likewise.
12595         * target-reloc.h (scan_relocs): Remove options parameter.  Change
12596         all callers.
12597         (scan_relocatable_relocs): Likewise.
12598         * target.h (class Sized_target): Remove options parameter from
12599         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
12600         all callers.
12601         * gc.h (gc_process_relocs): Remove options parameter.  Change all
12602         callers.
12603         * arm.cc: Update functions to remove options parameters.
12604         * i386.cc: Likewise.
12605         * powerpc.cc: Likewise.
12606         * sparc.cc: Likewise.
12607         * x86_64.cc: Likewise.
12608         * testsuite/testfile.cc: Likewise.
12609
12610 2009-10-28  Doug Kwan  <dougkwan@google.com>
12611
12612         * arm.cc (Arm_relobj): New class definition.
12613         (Arm_relobj::scan_sections_for_stubs,
12614         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
12615         New method definitions.
12616
12617 2009-10-28  Cary Coutant  <ccoutant@google.com>
12618
12619         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
12620         (Plugin::cleanup_done_): New member.
12621         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
12622         (Plugin_manager::cleanup_done_): Remove.
12623         (Plugin_manager::add_input_file): Edit error message.
12624         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
12625         (Plugin_manager::cleanup): Remove use of cleanup_done_.
12626
12627 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
12628
12629         * fileread.cc: (File_read::View::~View): Use the new
12630         data_ownership_ filed.
12631         (File_read::~File_read): Dispose the new whole_file_view_.
12632         (File_read::open): Mmap the whole file if needed.
12633         (File_read::open): Use whole_file_view_ instead of contents_.
12634         (File_read::find_view): Use whole_file_view_ if applicable.
12635         (File_read::do_read): Use whole_file_view_ instead of contents_.
12636         (File_read::make_view): Use whole_file_view_ instead of contents_,
12637         update File_read::View::View call.
12638         (File_read::find_or_make_view): Update File_read::View::View
12639         call.
12640         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
12641         remove contents_
12642         (File_read::View::Data_ownership): New enum.
12643         (File_read::View::View): Replace bool mapped_ with Data_ownership
12644         argument.
12645         (File_read::View::mapped_): Remove (replaced by data_ownership_).
12646         (File_read::View::data_ownership_): New field.
12647         (File_read::contents_): Remove (replaced by whole_file_view_).
12648         (File_read::whole_file_view_): New field.
12649         * options.h (class General_options): Add --keep-files-mapped.
12650
12651 2009-10-27  Cary Coutant  <ccoutant@google.com>
12652
12653         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
12654         * testsuite/Makefile.am (plugin_test_5): New test case.
12655         * testsuite/Makefile.in: Regenerate.
12656
12657 2009-10-25  Doug Kwan  <dougkwan@google.com>
12658
12659         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
12660         from private to protected to allow access by child class.
12661         (Sized_relobj::do_relocate_sections): New method declaration.
12662         (Sized_relobj::relocate_sections): Virtualize.
12663         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
12664         Sized_relobj::relocate_sections.  Instantiate template explicitly
12665         for different target sizes and endianity.
12666
12667 2009-10-24  Doug Kwan  <dougkwan@google.com>
12668
12669         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
12670         (Arm_input_section::as_arm_input_section): New method.
12671         (Arm_output_section): New class definition.
12672         (Arm_output_section::create_stub_group,
12673         Arm_output_section::group_sections): New method definitions.
12674
12675 2009-10-22  Doug Kwan  <dougkwan@google.com>
12676
12677         * arm.cc (Arm_input_section): New class definition.
12678         (Arm_input_section::init, Arm_input_section:do_write,
12679         Arm_input_section::set_final_data_size,
12680         Arm_input_section::do_reset_address_and_file_offset): New method
12681         definitions.
12682
12683 2009-10-21  Doug Kwan  <dougkwan@google.com>
12684
12685         * arm.cc (Stub_table, Arm_input_section): New forward class
12686         declarations.
12687         (Stub_table): New class defintion.
12688         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
12689         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
12690         New method definition.
12691
12692 2009-10-21  Doug Kwan  <dougkwan@google.com>
12693
12694         * arm.cc: Update copyright comments.
12695         (Target_arm): New forward class template declaration.
12696         (Arm_address): New type.
12697         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
12698         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
12699         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
12700         constants.
12701         (Insn_template): Same.
12702         (DEF_STUBS): New macro.
12703         (Stub_type): New enum type.
12704         (Stub_template): New class definition.
12705         (Stub): Same.
12706         (Reloc_stub): Same.
12707         (Stub_factory): Same.
12708         (Target_arm::Target_arm): Initialize may_use_blx_ and
12709         should_force_pic_veneer_.
12710         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
12711         Target_arm::should_force_pic_veneer,
12712         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
12713         Target_arm::using_thumb_only, Target_arm:;default_target): New
12714         method defintions.
12715         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
12716         New data member declarations.
12717         (Insn_template::size, Insn_template::alignment): New method defintions.
12718         (Stub_template::Stub_template): New method definition.
12719         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
12720         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
12721         (Stub_factory::Stub_factory): New method definition.
12722         * gold.h (string_hash): New template.
12723         * output.h (Input_section_specifier::hash_value): Use
12724         gold::string_hash.
12725         (Input_section_specifier::string_hash): Remove.
12726         * stringpool.cc (Stringpool_template::string_hash): Use
12727         gold::string_hash.
12728
12729 2009-10-20  Doug Kwan  <dougkwan@google.com>
12730
12731         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
12732         symbols of relaxed input sections.
12733         * output.h (Output_section::find_relaxed_input_section): Make
12734         method public.
12735
12736 2009-10-16  Doug Kwan  <dougkwan@google.com>
12737
12738         * dynobj.cc (Versions::Versions): Initialize version_script_.
12739         Only insert base version symbol definition for a shared object
12740         if version script defines any version versions.
12741         (Versions::define_base_version): New method definition.
12742         (Versions::add_def): Check that base version is not needed.
12743         (Versions::add_need): Define base version lazily.
12744         * dynobj.h (Versions::define_base_version): New method declaration.
12745         (Versions::needs_base_version_): New data member declaration.
12746         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
12747         (check_DATA): Add no_version_test.stdout.
12748         (libno_version_test.so, no_version_test.o no_version_test.stdout):
12749         New make rules.
12750         * testsuite/Makefile.in: Regenerate.
12751         * testsuite/no_version_test.c: New file.
12752         * testsuite/no_version_test.sh: Ditto.
12753
12754 2009-10-16  Doug Kwan  <dougkwan@google.com>
12755
12756         * expression.cc (class Segment_start_expression): New class definition.
12757         (Segment_start_expression::value): New method definition.
12758         (script_exp_function_segment_start): Return a new
12759         Segment_start_expression.
12760         * gold/script-c.h (script_saw_segment_start_expression): New function
12761         prototype.
12762         * script-sections.cc (Script_sections::Script_sections): Initialize
12763         SAW_SEGMENT_START_EXPRESSION_ to false.
12764         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
12765         and -Tbbs options to specify section addresses if given in
12766         command line and no SEGMENT_START expression is seen in a script.
12767         * script-sections.h (Script_sections::saw_segment_start_expression,
12768         Script_sections::set_saw_segment_start_expression): New method
12769         definition.
12770         (Script_sections::saw_segment_start_expression_): New data member
12771         declaration.
12772         * script.cc (script_saw_segment_start_expression): New function.
12773         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
12774         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
12775         script_test_7.sh and script_test_8.sh.
12776         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
12777         script_test_8.stdout.
12778         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
12779         (script_test_6, script_test_6.stdout, script_test_7,
12780         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
12781         * Makefile.in: Regenerate.
12782         * testsuite/script_test_6.sh: New file.
12783         * testsuite/script_test_6.t: Same.
12784         * testsuite/script_test_7.sh: Same.
12785         * testsuite/script_test_7.t: Same.
12786         * testsuite/script_test_8.sh: Same.
12787
12788 2009-10-16  Doug Kwan  <dougkwan@google.com>
12789
12790         * output.cc (Output_segment::set_section_list_address): Cast
12791         expressions to unsigned long long type to avoid format warnings.
12792
12793 2009-10-15  Ian Lance Taylor  <iant@google.com>
12794
12795         * script.cc (Script_options::add_symbol_assignment): Always add a
12796         dot assignment to script_sections_.
12797         * script-sections.cc (Script_sections::add_dot_assignment):
12798         Initialize if necessary.
12799
12800         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
12801         program headers with no load segment if there is a linker script.
12802
12803         * layout.cc (Layout::set_segment_offsets): Align the file offset
12804         to the segment aligment for -N or -n with no load segment.
12805         * output.cc (Output_segment::add_output_section): Don't crash if
12806         the first section is a TLS section.
12807         (Output_segment::set_section_list_addresses): Print an error
12808         message if the address moves backward in a linker script.
12809         * script-sections.cc
12810         (Output_section_element_input::set_section_addresses): Don't
12811         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
12812         (Orphan_output_section::set_section_addresses): Likewise.
12813
12814 2009-10-15  Doug Kwan  <dougkwan@google.com>
12815
12816         * layout.cc (Layout::finish_dynamic_section): Generate tags
12817         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
12818         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
12819         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
12820
12821 2009-10-14  Ian Lance Taylor  <iant@google.com>
12822
12823         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
12824         fields.
12825         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
12826         data_shdr fields of relinfo.
12827         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
12828         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
12829         R_386_TLS_LDO_32, adjust based on section flags.
12830         (Target_i386::Relocate::fix_up_ldo): Remove.
12831
12832 2009-10-13  Ian Lance Taylor  <iant@google.com>
12833
12834         Add support for -pie.
12835         * options.h (class General_options): Add -pie and
12836         --pic-executable.
12837         (General_options::output_is_position_independent): Test -pie.
12838         (General_options::output_is_executable): Return true if not shared
12839         and not relocatable.
12840         (General_options::output_is_pie): Remove.
12841         * options.cc (General_options::finalize): Reject incompatible uses
12842         of -pie.
12843         * gold.cc (queue_middle_tasks): A -pie link is not static.
12844         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
12845         * symtab.cc (Symbol::final_value_is_known): Return false if
12846         output_is_position_independent.
12847         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
12848         output_is_position_independent.
12849         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
12850         output_is_position_independent.
12851         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
12852         output_is_position_independent.
12853         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
12854         two_file_pie_test.
12855         (basic_pie_test.o, basic_pie_test): New targets.
12856         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
12857         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
12858         (two_file_pie_test): New target.
12859         * testsuite/Makefile.in: Rebuild.
12860         * README: Remove note saying that -pie is not supported.
12861
12862 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
12863
12864         * options.h (class General_options): Add -init and -fini.
12865         * layout.cc (Layout::finish_dynamic_section): Emit
12866         given init and fini functions.
12867
12868 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
12869
12870         * gc.h (gc_process_relocs): Check if icf is enabled using new
12871         function.
12872         * gold.cc (queue_initial_tasks): Likewise.
12873         (queue_middle_tasks): Likewise.
12874         * object.cc (do_layout): Likewise.
12875         * symtab.cc (is_section_folded): Likewise.
12876         * main.cc (main): Likewise.
12877         * reloc.cc (Read_relocs::run): Likewise.
12878         (Sized_relobj::do_scan_relocs): Likewise.
12879         * icf.cc (is_function_ctor_or_dtor): New function.
12880         (Icf::find_identical_sections): Check if function is ctor or dtor when
12881         safe icf is chosen.
12882         * options.h (General_options::icf): Change option to be an enum.
12883         (Icf_status): New enum.
12884         (icf_enabled): New method.
12885         (icf_safe_folding): New method.
12886         (set_icf_status): New method.
12887         (icf_status_): New variable.
12888         * (options.cc) (General_options::finalize): Set icf_status_.
12889         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
12890         icf_test and icf_keep_unique_test to use the --icf enum flag.
12891         * testsuite/icf_safe_test.sh: New file.
12892         * testsuite/icf_safe_test.cc: New file.
12893
12894 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
12895
12896         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
12897         includes to gc.h and icf.h.
12898         * arm.cc: Include gc.h.
12899         * gold.cc: Likewise.
12900         * i386.cc: Likewise.
12901         * powerpc.cc: Likewise.
12902         * sparc.cc: Likewise.
12903         * x86_64.cc: Likewise.
12904         * gc.h: Include icf.h.
12905
12906 2009-10-11  Ian Lance Taylor  <iant@google.com>
12907
12908         * plugin.cc: Include "gold.h" before other header files.
12909
12910 2009-10-10  Chris Demetriou  <cgd@google.com>
12911
12912         * options.h (Input_file_argument::Input_file_type): New enum.
12913         (Input_file_argument::is_lib_): Replace with...
12914         (Input_file_argument::type_): New member.
12915         (Input_file_argument::Input_file_argument): Take Input_file_type
12916         'type' rather than boolean 'is_lib' as second argument.
12917         (Input_file_argument::is_lib): Use type_.
12918         (Input_file_argument::is_searched_file): New function.
12919         (Input_file_argument::may_need_search): Handle is_searched_file.
12920         * options.cc (General_options::parse_library): Support -l:filename.
12921         (General_options::parse_just_symbols): Update for Input_file_argument
12922         changes.
12923         (Command_line::process): Likewise.
12924         * archive.cc (Archive::get_file_and_offset): Likewise.
12925         * plugin.cc (Plugin_manager::release_input_file): Likewise.
12926         * script.cc (read_script_file, script_add_file): Likewise.
12927         * fileread.cc (Input_file::Input_file): Likewise.
12928         (Input_file::will_search_for): Handle is_searched_file.
12929         (Input_file::open): Likewise.
12930         * readsyms.cc (Read_symbols::get_name): Likewise.
12931         * testsuite/Makefile.am (searched_file_test): New test.
12932         * testsuite/Makefile.in: Regenerate.
12933         * testsuite/searched_file_test.cc: New file.
12934         * testsuite/searched_file_test_lib.cc: New file.
12935
12936 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12937             Ian Lance Taylor  <iant@google.com>
12938
12939         * descriptor.cc: Include <cstdio> and "binary-io.h".
12940         (Descriptors::open): Open the files in binary mode always.
12941         * script.cc (Lex::get_token): Treat \r as whitespace.
12942
12943 2009-10-09  Ian Lance Taylor  <iant@google.com>
12944
12945         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
12946
12947 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12948             Ian Lance Taylor  <iant@google.com>
12949
12950         * configure.ac: Check for readv function also.
12951         * fileread.cc (readv): Define if not HAVE_READV.
12952         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
12953         does not exist.
12954         * config.in: Regenerate.
12955         * configure: Regenerate.
12956
12957 2009-10-09  Doug Kwan  <dougkwan@google.com>
12958
12959         * layout.cc (Layout::make_output_section): Call target hook to make
12960         ordinary output section.
12961         (Layout::finalize): Adjust parameter list of call the
12962         Target::may_relax().
12963         * layout.h (class Layout::section_list): New method.
12964         * merge.h (Output_merge_base::entsize): Change visibility to public.
12965         (Output_merge_base::is_string, Output_merge_base::do_is_string):
12966         New methods.
12967         (Output_merge_string::do_is_string): New method.
12968         * object.cc (Sized_relobj::do_setup): renamed from
12969         Sized_relobj::set_up.
12970         * object.h (Sized_relobj::adjust_shndx,
12971         Sized_relobj::initializ_input_to_output_maps,
12972         Sized_relobj::free_input_to_output_maps): Change visibilities to
12973         protected.
12974         (Sized_relobj::setup): Virtualize.
12975         (Sized_relobj::do_setup): New method declaration.
12976         (Sized_relobj::invalidate_section_offset,
12977         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
12978         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
12979         * options.cc (parse_int): New function.
12980         * options.h (parse_int): New declaration.
12981         (DEFINE_int): New macro.
12982         (stub_group_size): New option.
12983         * output.cc (Output_section::Output_section): Initialize memebers
12984         merge_section_map_, merge_section_by_properties_map_,
12985         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
12986         (Output_section::add_input_section): Handled deferred code-fill
12987         generation and remove an old comment.
12988         (Output_section::add_relaxed_input_section): New method definition.
12989         (Output_section::add_merge_input_section): Use merge section by
12990         properties map to speed to search.  Update merge section maps
12991         as appropriate.
12992         (Output_section::build_relaxation_map): New method definition.
12993         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
12994         Same.
12995         (Output_section::relax_input_section): Renamed to
12996         Output_section::convert_input_sections_to_relaxed_sections and change
12997         interface to take a vector of pointers to relaxed sections.
12998         (Output_section::find_merge_section,
12999         Output_section::find_relaxed_input_section): New method definitions.
13000         (Output_section::is_input_address_mapped,
13001         Output_section::output_offset, Output_section::output_address):
13002         Use output section data maps to speed up searching.
13003         (Output_section::find_starting_output_address): Add comments.
13004         (Output_section::do_write,
13005         Output_section::write_to_postprocessing_buffer): Do code-fill
13006         generation as appropriate.
13007         (Output_section::get_input_sections): Invalidate relaxed input section
13008         map.
13009         (Output_section::restore_states): Adjust type of checkpoint .
13010         Invalidate relaxed input section map.
13011         * output.h (Output_merge_base): New class declaration.
13012         (Input_section_specifier): New class defintion.
13013         (class Output_relaxed_input_section) Change base class to
13014         Output_section_data_build.
13015         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
13016         base class initializer.
13017         (Output_section::add_relaxed_input_section): New method declaration.
13018         (Output_section::Input_section): Change visibility to protected.
13019         (Output_section::Input_section::relobj,
13020         Output_section::Input_section::shndx): Handle relaxed input sections.
13021         Output_section::input_sections) Change visibility to protected.  Also
13022         define overload to return a non-const pointer.
13023         (Output_section::Merge_section_properties): New class defintion.
13024         (Output_section::Merge_section_by_properties_map,
13025         Output_section::Output_section_data_by_input_section_map,
13026         Output_section::Relaxation_map): New types.
13027         (Output_section::relax_input_section): Rename method to
13028         Output_section::convert_input_sections_to_relaxed_sections and change
13029         interface to take a vector of relaxed section pointers.
13030         (Output_section::find_merge_section,
13031         Output_section::find_relaxed_input_section,
13032         Output_section::build_relaxation_map,
13033         Output_section::convert_input_sections_in_list_to_relaxed_sections):
13034         New method declarations.
13035         (Output_section::merge_section_map_
13036         Output_section::merge_section_by_properties_map_,
13037         Output_section::relaxed_input_section_map_,
13038         Output_section::is_relaxed_input_section_map_valid_,
13039         Output_section::generate_code_fills_at_write_): New data members.
13040         * script-sections.cc
13041         (Output_section_element_input::set_section_addresses): Call
13042         current_data_size and addralign methods of relaxed input sections.
13043         (Orphan_output_section::set_section_addresses): Call current_data_size
13044         and addralign methods of relaxed input sections.
13045         * symtab.cc (Symbol_table::compute_final_value): Extract template
13046         from the body of Symbol_table::sized_finalize_symbol.
13047         (Symbol_table::sized_finalized_symbol): Call
13048         Symbol_table::compute_final_value.
13049         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
13050         (Symbol_table::compute_final_value): New templated method declaration.
13051         * target.cc (Target::do_make_output_section): New method defintion.
13052         * target.h (Target::make_output_section): New method declaration.
13053         (Target::relax): Add more parameters for input objects, symbol table
13054         and layout.  Adjust call to do_relax.
13055         (Target::do_make_output_section): New method declaration.
13056         (Target::do_relax): Add parameters for input objects, symbol table
13057         and layout.
13058
13059 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13060
13061         * pread.c: Include stdio.h.
13062
13063 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13064
13065         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
13066         defined.
13067
13068 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13069
13070         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
13071         Change read_shndx type to unsigned int.
13072         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13073         int.
13074         (Sized_dwarf_line_info::read_line_mappings): Likewise.
13075         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
13076         Change read_shndx type to unsigned int.
13077         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13078         int.
13079         (Sized_dwarf_line_info::read_line_mappings): Likewise.
13080         * layout.cc (Layout::create_symtab_sections): Cast the result of
13081         local_symcount * symsize to off_t in the gold_assert.
13082
13083 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13084
13085         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
13086         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
13087         R_ARM_BASE_ABS.
13088         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
13089         (Arm_relocate_functions::thm_abs5): New function.
13090         (Arm_relocate_functions::abs12): New function.
13091         (Arm_relocate_functions::abs16): New function.
13092         (Arm_relocate_functions::base_abs): New function.
13093         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
13094         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
13095         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
13096         R_ARM_BASE_ABS.
13097         (Scan::global): Likewise.
13098         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
13099         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
13100         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
13101         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
13102         R_ARM_BASE_ABS.
13103
13104 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13105
13106         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
13107         (Arm_relocate_functions::movt_prel): New function.
13108         (Arm_relocate_functions::thm_movw_prel_nc): New function.
13109         (Arm_relocate_functions::thm_movt_prel): New function.
13110         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
13111         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
13112         (Scan::global, Relocate::relocate): Likewise.
13113         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13114
13115 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13116
13117         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
13118         Incremental_checker.
13119         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
13120         unsigned int.
13121         (class Incremental_inputs_header): New class.
13122         (Incremental_inputs_header_writer): Edit comment.
13123         (Incremental_inputs_entry): New class.
13124         (Incremental_inputs_entry_writer): Edit comment.
13125         (Sized_incremental_binary::do_find_incremental_inputs_section):
13126         Add *strtab_shndx parameter, fill it.
13127         (Sized_incremental_binary::do_check_inputs): New method.
13128         (Incremental_checker::can_incrementally_link_output_file): Use
13129         Sized_incremental_binary::check_inputs.
13130         (Incremental_inputs::report_command_line): Save command line in
13131         command_line_.
13132         * incremental.h:
13133         (Incremental_binary::find_incremental_inputs_section): New
13134         method.
13135         (Incremental_binary::do_find_incremental_inputs_section): Add
13136         strtab_shndx parameter.
13137         (Incremental_binary::do_check_inputs): New pure virtual method.
13138         (Sized_incremental_binary::do_check_inputs): Declare.
13139         (Incremental_checker::Incremental_checker): Add incremental_inputs
13140         parameter, use it to initialize incremental_inputs_.
13141         (Incremental_checker::incremental_inputs_): New field.
13142         (Incremental_checker::command_line): New method.
13143         (Incremental_checker::inputs): New method.
13144         (Incremental_checker::command_line_): New field.
13145
13146 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13147
13148         * incremental.cc: Include <cstdarg> and "target-select.h".
13149         (vexplain_no_incremental): New function.
13150         (explain_no_incremental): New function.
13151         (Incremental_binary::error): New method.
13152         (Sized_incremental_binary::do_find_incremental_inputs_section): New
13153         method.
13154         (make_sized_incremental_binary): New function.
13155         (open_incremental_binary): New function.
13156         (can_incrementally_link_file): Add checks if output is ELF and has
13157         inputs section.
13158         * incremental.h: Include "elfcpp_file.h" and "output.h".
13159         (Incremental_binary): New class.
13160         (Sized_incremental_binary): New class.
13161         (open_incremental_binary): Declare.
13162         * object.cc (is_elf_object): Use
13163         elfcpp::Elf_recognizer::is_elf_file.
13164         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
13165         * output.h (Output_file::filesize): New method.
13166
13167 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13168
13169         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
13170         New function.
13171         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
13172         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
13173         function.
13174         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
13175         function.
13176         (Arm_relocate_functions::movw_abs_nc): New function.
13177         (Arm_relocate_functions::movt_abs): New function.
13178         (Arm_relocate_functions::thm_movw_abs_nc): New function.
13179         (Arm_relocate_functions::thm_movt_abs): New function.
13180         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
13181         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
13182         (Scan::global): Likewise.
13183         (Relocate::relocate): Likewise.
13184         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13185
13186 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13187
13188         * arm.cc (Arm_relocate_functions::got_prel) New function.
13189         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
13190         (Relocate::relocate): Likewise.
13191         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13192
13193 2009-10-06  Ian Lance Taylor  <iant@google.com>
13194
13195         * options.h (class General_options): Define
13196         split_stack_adjust_size parameter.
13197         * object.h (class Object): Add uses_split_stack_ and
13198         has_no_split_stack_ fields.  Add uses_split_stack and
13199         has_no_split_stack accessor functions.  Declare
13200         handle_split_stack_section.
13201         (class Reloc_symbol_changes): Define.
13202         (class Sized_relobj): Define Function_offsets.  Declare
13203         split_stack_adjust, split_stack_adjust_reltype, and
13204         find_functions.
13205         * object.cc (Object::handle_split_stack_section): New function.
13206         (Sized_relobj::do_layout): Call handle_split_stack_section.
13207         * dynobj.cc (Sized_dynobj::do_layout): Call
13208         handle_split_stack_section.
13209         * reloc.cc (Sized_relobj::relocate_sections): Call
13210         split_stack_adjust for executable sections in split_stack
13211         objects.  Pass reloc_map to relocate_section.
13212         (Sized_relobj::split_stack_adjust): New function.
13213         (Sized_relobj::split_stack_adjust_reltype): New function.
13214         (Sized_relobj::find_functions): New function.
13215         * target-reloc.h: Include "object.h".
13216         (relocate_section): Add reloc_symbol_changes parameter.  Change
13217         all callers.
13218         * target.h (class Target): Add calls_non_split method.  Declare
13219         do_calls_non_split virtual method.  Declare match_view and
13220         set_view_to_nop.
13221         * target.cc: Include "elfcpp.h".
13222         (Target::do_calls_non_split): New function.
13223         (Target::match_view): New function.
13224         (Target::set_view_to_nop): New function.
13225         * gold.cc (queue_middle_tasks): Give an error if mixing
13226         split-stack and non-split-stack objects with -r.
13227         * i386.cc (Target_i386::relocate_section): Add
13228         reloc_symbol_changes parameter.
13229         (Target_i386::do_calls_non_split): New function.
13230         * x86_64.cc (Target_x86_64::relocate_section): Add
13231         reloc_symbol_changes parameter.
13232         (Target_x86_64::do_calls_non_split): New function.
13233         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
13234         parameter.
13235         * powerpc.cc (Target_powerpc::relocate_section): Add
13236         reloc_symbol_changes parameter.
13237         * sparc.cc (Target_sparc::relocate_section): Add
13238         reloc_symbol_changes parameter.
13239         * configure.ac: Call AM_CONDITIONAL for the default target.
13240         * configure: Rebuild.
13241         * testsuite/Makefile.am (TEST_AS): New variable.
13242         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
13243         (check_DATA): Add split_i386 and split_x86_64 files.
13244         (SPLIT_DEFSYMS): Define.
13245         (split_i386_[1234n].o): New targets.
13246         (split_i386_[124]): New targets.
13247         (split_i386_[1234r].stdout): New targets.
13248         (split_x86_64_[1234n].o): New targets.
13249         (split_x86_64_[124]): New targets.
13250         (split_x86_64_[1234r].stdout): New targets.
13251         (MOSTLYCLEANFILES): Add new executables.
13252         * testsuite/split_i386.sh: New file.
13253         * testsuite/split_x86_64.sh: New file.
13254         * testsuite/split_i386_1.s: New file.
13255         * testsuite/split_i386_2.s: New file.
13256         * testsuite/split_i386_3.s: New file.
13257         * testsuite/split_i386_4.s: New file.
13258         * testsuite/split_i386_n.s: New file.
13259         * testsuite/split_x86_64_1.s: New file.
13260         * testsuite/split_x86_64_2.s: New file.
13261         * testsuite/split_x86_64_3.s: New file.
13262         * testsuite/split_x86_64_4.s: New file.
13263         * testsuite/split_x86_64_n.s: New file.
13264         * testsuite/testfile.cc (Target_test): Update relocation_section
13265         function.
13266         * testsuite/Makefile.in: Rebuild.
13267
13268 2009-10-06  Ian Lance Taylor  <iant@google.com>
13269
13270         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
13271         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
13272         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
13273         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
13274         the address on ldo_addrs_.
13275         (Target_i386::Relocate::fix_up_ldo): New function.
13276
13277 2009-10-06   Rafael Espindola  <espindola@google.com>
13278
13279         * plugin.cc (add_input_library): New.
13280         (Plugin::load): Add add_input_library to tv.
13281         (Plugin_manager::add_input_file): Add the is_lib argument.
13282         (add_input_file): Update call to Plugin_manager::add_input_file.
13283         (add_input_library): New.
13284         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
13285
13286 2009-09-30  Doug Kwan  <dougkwan@google.com>
13287
13288         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
13289         symbol and call Symbol::may_need_copy_reloc to determine if
13290         a copy reloc is needed.
13291         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
13292         nocopyreloc is given in command line.
13293         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
13294         given in command line.
13295         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
13296         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
13297         of the removed Target_i386::may_need_copy_reloc.
13298         * options.h (copyreloc): New option with default value false.
13299         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13300         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
13301         instead of the removed Target_powerpc::may_need_copy_reloc.
13302         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13303         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
13304         instead of the removed Target_sparc::may_need_copy_reloc.
13305         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
13306         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
13307         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
13308         instead of the removed Target_x86_64::may_need_copy_reloc.
13309
13310 2009-09-30  Ian Lance Taylor  <iant@google.com>
13311
13312         * object.h (class Object): Remove target_ field, and target,
13313         sized_target, and set_target methods.
13314         (Object::sized_target): Remove.
13315         (class Sized_relobj): Update declarations.  Remove sized_target.
13316         * object.cc (Sized_relobj::setup): Remove target parameter.
13317         Change all callers.
13318         (Input_objects::add_object): Don't do anything with the target.
13319         (make_elf_sized_object): Add punconfigured parameter.  Change all
13320         callers.  Set or test parameter target.
13321         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
13322         Change all callers.
13323         * parameters.cc (Parameters::set_target): Change parameter type to
13324         be non-const.
13325         (Parameters::default_target): Remove.
13326         (set_parameters_target): Change parameter type to be non-const.
13327         (parameters_force_valid_target): New function.
13328         (parameters_clear_target): New function.
13329         * parameters.h (class Parameters): Update declarations.  Remove
13330         default_target method.  Add sized_target and clear_target
13331         methods.  Change target_ to be non-const.
13332         (set_parameters_target): Update declaration.
13333         (parameters_force_valid_target): Declare.
13334         (parameters_clear_target): Declare.
13335         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
13336         as NULL if we aren't searching.
13337         (Add_symbols::run): Don't check for compatible target.
13338         * fileread.cc (Input_file::open_binary): Call
13339         parameters_force_valid_target.
13340         * gold.cc (queue_middle_tasks): Likewise.
13341         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
13342         set_target on object.
13343         * dynobj.h (class Sized_dynobj): Update declarations.
13344         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
13345         make_elf_object returns NULL.
13346         (Archive::include_member): Don't check whether object target is
13347         compatible.
13348         * output.cc (Output_section::add_input_section): Get target from
13349         parameters.
13350         (Output_section::relax_input_section): Likewise.
13351         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
13352         parameters.
13353         (Sized_relobj::do_scan_relocs): Likewise.
13354         (Sized_relobj::relocate_sections): Likewise.
13355         * resolve.cc (Symbol_table::resolve): Likewise.
13356         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
13357         parameter.  Change all callers.
13358         (Symbol_table::add_from_object): Get target from parameters.
13359         (Symbol_table::add_from_relobj): Don't check object target.
13360         (Symbol_table::add_from_dynobj): Likewise.
13361         (Symbol_table::define_special_symbol): Get target from
13362         parameters.
13363         * symtab.h (class Symbol_table): Update declaration.
13364         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
13365         parameter.  Change all callers.  Clear parameter target.
13366         (Binary_test): Test target here.
13367         * testsuite/object_unittest.cc (gold_testsuite): Remove
13368         target_test_pointer parameter.  Change all callers.
13369         (Object_test): Test target here.
13370
13371 2009-09-26  Ian Lance Taylor  <iant@google.com>
13372
13373         * testsuite/initpri1.c: Don't try to use constructor priorities if
13374         compiling with gcc before 4.3.
13375
13376 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
13377
13378         * testsuite/retain_symbols_file_test.sh (check_present): Change
13379         output file name to retain_symbols_file_test.stdout.
13380         (check_absent): Likewise.
13381
13382 2009-09-18  Craig Silverstein  <csilvers@google.com>
13383
13384         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
13385         * options.cc: Include <cerrno> and <fstream>.
13386         (General_options::finalize): Parse -retain-symbols-file tag.
13387         * options.h: New flag.
13388         (General_options): New method should_retain_symbol, new
13389         variable symbols_to_retain.
13390         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
13391         should_retain_symbol map.
13392         * testsuite/Makefile.am (retain_symbols_file_test): New test.
13393         * testsuite/Makefile.in: Regenerate.
13394         * testsuite/retain_symbols_file_test.sh: New file.
13395
13396 2009-09-18  Nick Clifton  <nickc@redhat.com>
13397
13398         * po/es.po: Updated Spanish translation.
13399
13400 2009-09-17  Doug Kwan  <dougkwan@google.com>
13401
13402         * debug.h (DEBUG_RELAXATION): New constant.
13403         (DEBUG_ALL): Add DEBUG_RELAXATION.
13404         (debug_string_to_enum): Add relaxation debug option.
13405         * layout.cc
13406         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
13407         Layout::Relaxation_debug_check::read_sections,
13408         Layout::Relaxation_debug_check::read_sections): New method definitions.
13409         (Layout::Layout): Initialize data members
13410         record_output_section_data_from_scrips_,
13411         script_output_section_data_list_ and relaxation_debug_check_.
13412         (Layout::save_segments, Layout::restore_segments,
13413         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13414         Layout::relaxation_loop_body): New method definitions.
13415         (Layout::finalize): Support relaxation.  Move section layout code to
13416         Layout::relaxation_loop_body.
13417         (Layout::set_asection_address_from_script): Move code for orphan
13418         section placement out.
13419         (Layout::place_orphan_sections_in_script): New method definition.
13420         * layout.h (Output_segment_headers, Output_file_header):
13421         New forward class declarations.
13422         (Layout::~Layout): Define.
13423         (Layout::new_output_section_data_from_script): New method definition.
13424         (Layout::place_orphan_sections_in_script): New method declaration.
13425         (Layout::Segment_states): New type declaration.
13426         (Layout::save_segments, Layout::restore_segments,
13427         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13428         Layout::relaxation_loop_body): New method declarations.
13429         (Layout::Output_section_data_list): New type declaration.
13430         (Layout::Relaxation_debug_check): New class definition.
13431         (Layout::record_output_section_data_from_script_,
13432         Layout::script_output_section_data_list_, Layout::segment_states_,
13433         Layout::relaxation_debug_check_): New data members.
13434         * output.cc: (Output_section_headers::do_size): New method definition.
13435         (Output_section_headers::Output_section_headers): Move size
13436         computation to Output_section_headers::do_size.
13437         (Output_segment_headers::do_size): New method definition.
13438         (Output_file_header::Output_file_header): Move size computation to
13439         Output_file_header::do_size and call it.
13440         (Output_file_header::do_size): New method definition.
13441         (Output_data_group::Output_data_group): Adjust call to
13442         Output_section_data.
13443         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
13444         (Output_symtab_xindex::do_write): Add array bound check.
13445         (Output_section::Input_section::print_to_mapfile): Handle
13446         RELAXED_INPUT_SECTION_CODE.
13447         (Output_section::Output_section): Initialize data member checkpoint_.
13448         (Output_section::~Output_section): Delete checkpoint object pointed
13449         by checkpoint_.
13450         (Output_section::add_input_section): Always add an Input_section if
13451         relaxing.
13452         (Output_section::add_merge_input_section): Add assert.
13453         (Output_section::relax_input_section): New method definition.
13454         (Output_section::set_final_data_size): Set load address to zero for
13455         an unallocated section.
13456         (Output_section::do_address_and_file_offset_have_reset_values):
13457         New method definition.
13458         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
13459         Handle relaxed input section.
13460         (Output_section::sort_attached_input_sections): Checkpoint input
13461         section list lazily.
13462         (Output_section::get_input_sections): Change type of input_sections to
13463         list of Simple_input_section pointers.  Checkpoint input section list
13464         lazily.  Also handle relaxed input sections.
13465         (Output_section::add_input_section_for_script): Take a reference to
13466         a Simple_input_section object instead of Relobj pointer and section
13467         index as parameter.  Handle relaxed input sections.
13468         (Output_section::save_states, Output_section::restore_states): New
13469         method definitions.
13470         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
13471         (Output_data::is_data_size_fixed): New method definition.
13472         (Output_data::reset_addresss_and_file_offset): Do not reset data size
13473         if it is fixed.
13474         (Output_data::address_and_file_offset_have_reset_values): New method
13475         definition.
13476         (Output_data::do_address_and_file_offset_have_reset_values): New method
13477         definition.
13478         (Output_data::set_data_size): Check that data size is not fixed.
13479         (Output_data::fix_data_size): New method definition.
13480         (Output_data::is_data_size_fixed_): New data member.
13481         (Output_section_headers::set_final_data_size): New method definition.
13482         (Output_section_headers::do_size): New method declaration.
13483         (Output_segment_headers::set_final_data_size): New method definition.
13484         (Output_segment_headers::do_size): New method declaration.
13485         (Output_file_header::set_final_data_size)::New method definition.
13486         (Output_file_header::do_size)::New method declaration.
13487         (Output_section_data::Output_section_data): Add new parameter
13488         is_data_size_fixed and use it to fix data size.
13489         (Output_data_const::Output_data_const): Adjust call to base class
13490         constructor and fix data size.
13491         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
13492         base class constructor and fix data size.
13493         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
13494         base class constructor and fix data size.
13495         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
13496         class constructor and fix data size.
13497         (Output_data_group::set_final_data_size): New method definition.
13498         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
13499         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
13500         class constructor and fix data size.
13501         (Output_relaxed_input_section): New class definition.
13502         (Output_section::Simple_input_section): New class definition.
13503         (Output_section::get_input_sections): Adjust parameter list.
13504         (Output_section::add_input_section_for_script): Same.
13505         (Output_section::save_states, Output_section::restore_states,
13506         Output_section::do_address_and_file_offset_have_reset_values,
13507         (Output_section::Input_section::Input_section): Handle
13508         RELAXED_INPUT_SECTION_CODE.  Add new overload for
13509         Output_relaxed_input_section.
13510         (Output_section::Input_section::is_input_section,
13511         Output_section::Input_section::set_output_section): Handle relaxed
13512         input section.
13513         (Output_section::Input_section::is_relaxed_input_section,
13514         Output_section::Input_section::output_section_data,
13515         Output_section::Input_section::relaxed_input_section): New method
13516         definitions.
13517         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
13518         value.
13519         (Output_section::Input_section::u1_): Update comments.
13520         (Output_section::Input_section::u2_): Add new union member poris.
13521         (Output_section::Checkpoint_output_section): New classs definition.
13522         (Output_section::relax_input_section): New method declaration.
13523         (Output_section::checkpoint_): New data member.
13524         (Output_segment): Update comments.
13525         (Output_segment::Output_segment): Un-privatize copy constructor.
13526         (Output_segment::operator=): Un-privatize.
13527         * script-sections.cc (Output_section_element::Input_section_list):
13528         Change element type to Output_section::Simple_input_section.
13529         (Output_section_element_dot_assignment::set_section_addresses):
13530         Register output section data for relaxation clean up.
13531         (Output_data_exression::Output_data_expression): Adjust call to base
13532         constructor to fix data size.
13533         (Output_section_element_data::set_section_addresses): Register
13534         Output_data_expression object for relaxation clean up.
13535         (struct Input_section_info): Replace Relobj pointer and section index
13536         pair with Output_section::Simple_input_section and Convert struct to a
13537         class.
13538         (Input_section_sorter::operator()): Adjust access to
13539         Input_section_info data member to use accessors.
13540         (Output_section_element_input::set_section_addresses): Use layout
13541         parameter.  Adjust code to use Output_section::Simple_input_section
13542         and Input_secction_info classes.  Register filler for relaxation
13543         clean up.
13544         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
13545         and section index pair with Output_section::Simple_input_section
13546         class.  Adjust code accordingly.
13547         (Phdrs_element::release_segment): New method definition.
13548         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
13549         segment list.
13550         (Script_sections::release_segments): New method definition.
13551         * gold/script-sections.h (Script_sections::release_segments): New
13552         method declaration.
13553         * gold/target.h (Target::may_relax, Target::relax,
13554         Target::do_may_relax, Target::do_relax): New method definitions.
13555
13556 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13557
13558         * arm.cc (has_signed_unsigned_overflow): New function.
13559         (Arm_relocate_functions::abs8): New function.
13560         (Target_arm::Scan::local): Handle R_ARM_ABS8.
13561         (Target_arm::Scan::global): Likewise.
13562         (Target_arm::relocate::relocate): Likewise.
13563         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
13564         Likewise.
13565
13566 2009-09-16  Cary Coutant  <ccoutant@google.com>
13567
13568         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
13569         * testsuite/Makefile.in: Regenerate.
13570
13571 2009-09-11  Nick Clifton  <nickc@redhat.com>
13572
13573         * po/gold.pot: Updated by the Translation project.
13574
13575 2009-09-08  Cary Coutant  <ccoutant@google.com>
13576
13577         * output.cc (Output_file::open): Add execute permission to empty file.
13578         * testsuite/Makefile.am (permission_test): New test.
13579         * testsuite/Makefile.in: Regenerate.
13580
13581 2009-09-02  Ian Lance Taylor  <iant@google.com>
13582
13583         * output.cc (Output_file::resize): Call map_no_anonymous rather
13584         than map.
13585
13586 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
13587
13588         * gold.cc: Include "incremental.h".
13589         (queue_initial_tasks): Call Incremental_checker methods.
13590         * incremental.cc: Include "output.h".
13591         (Incremental_checker::can_incrementally_link_output_file): New
13592         method.
13593         * incremental.h (Incremental_checker): New class.
13594
13595         * output.cc (Output_file::open_for_modification): New method.
13596         (Output_file::map_anonymous): Changed return type to bool.  Record
13597         map in base_ field.
13598         (Output_file::map_no_anonymous): New method, broken out of map.
13599         (Output_file::map): Use map_no_anonymous and map_anonymous.
13600         * output.h (class Output_file): Update declarations.
13601
13602 2009-08-24  Cary Coutant  <ccoutant@google.com>
13603
13604         * options.h (Command_line::Pre_options): New class.
13605         (Command_line::pre_options): New member.
13606         * options.cc (gold::options::ready_to_register): New variable.
13607         (One_option::register_option): Do nothing if not registering options.
13608         Assert if same short option registered twice.
13609         (General_options::General_options): Turn off option registration when
13610         done constructing.
13611         (Command_line::Pre_options::Pre_options): New constructor.
13612
13613 2009-08-24  Cary Coutant  <ccoutant@google.com>
13614
13615         * options.h (General_options::no_keep_memory): Remove incorrect
13616         short option.
13617
13618 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
13619
13620         * Makefile.am (am__skiplex, am__skipyacc): New.
13621         * Makefile.in: Regenerate.
13622
13623 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
13624
13625         * Makefile.am (AM_CPPFLAGS): Renamed from ...
13626         (INCLUDES): ... this.
13627         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
13628         (AM_CPPFLAGS): Renamed from ...
13629         (INCLUDE): ... this.
13630         * Makefile.in, testsuite/Makefile.in: Regenerate.
13631
13632         * Makefile.in: Regenerate.
13633         * aclocal.m4: Likewise.
13634         * config.in: Likewise.
13635         * configure: Likewise.
13636         * testsuite/Makefile.in: Likewise.
13637
13638         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13639         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13640         * Makefile.in: Regenerate.
13641         * testsuite/Makefile.in: Regenerate.
13642
13643 2009-08-19  Cary Coutant  <ccoutant@google.com>
13644
13645         * resolve.cc (Symbol_table::resolve): Don't complain about defined
13646         symbols in shared libraries overridden by hidden or internal symbols
13647         in the main program.
13648
13649 2009-08-19  Chris Demetriou  <cgd@google.com>
13650
13651         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
13652         checking source file names in error messages.
13653
13654 2009-08-18  Doug Kwan  <dougkwan@google.com>
13655
13656         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
13657         an elcpp::Ehdr as parameter.  Adjust call to set_target.
13658         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
13659         an elfcpp::Ehdr as parameter.
13660         * object.cc (Object::set_target): Remove the version that looks up
13661         a target and sets it.
13662         (Sized_relobj::setup): Take a Target object instead of
13663         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
13664         (make_elf_sized_object): Find target and ask target to
13665         make an ELF object.
13666         * object.h: (Object::set_target): Remove the version that looks up
13667         a target and sets it.
13668         (Sized_relobj::setup): Take a Target object instead of
13669         an elfcpp:Ehdr as parameter.
13670         * target.cc: Include dynobj.h.
13671         (Target::do_make_elf_object_implementation): New.
13672         (Target::do_make_elf_object): New.
13673         * target.h (Target::make_elf_object): New template declaration.
13674         (Target::do_make_elf_object): New method declarations.
13675         (Target::do_make_elf_object_implementation): New template declaration.
13676
13677 2009-08-14  Ian Lance Taylor  <iant@google.com>
13678
13679         * gold.h (FUNCTION_NAME): Define.
13680         (gold_unreachable): Use FUNCTION_NAME.
13681
13682 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
13683
13684         * icf.cc (Icf::find_identical_sections): Issue a warning when a
13685         symbol in the --keep-unique list is not found.
13686
13687 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
13688
13689         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
13690         been maked as --keep-unique.
13691         (Icf::unfold_section): New function.
13692         * icf.h (Icf::unfold_section): New function.
13693         * options.h (General_options::keep_unique): New option.
13694         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
13695         * testsuite/Makefile.in: Regenerate.
13696         * testsuite/icf_keep_unique_test.sh: New file.
13697         * testsuite/icf_keep_unique_test.cc: New file.
13698
13699 2009-08-12  Cary Coutant  <ccoutant@google.com>
13700
13701         PR 10471
13702         * resolve.cc (Symbol_table::resolve): Check for references from
13703         dynamic objects to hidden and internal symbols.
13704         * testsuite/Makefile.am (hidden_test.sh): New test.
13705         * testsuite/Makefile.in: Regenerate.
13706         * testsuite/hidden_test.sh: New script.
13707         * testsuite/hidden_test_1.c: New test source.
13708         * testsuite/hidden_test_main.c: New test source.
13709
13710 2009-08-11  Doug Kwan  <dougkwan@google.com>
13711
13712         * arm.cc: Update comments.
13713         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
13714         segment to locate the .ARM.exidx section if present.
13715
13716 2009-08-09  Doug Kwan  <dougkwan@google.com>
13717
13718         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
13719         patch.
13720
13721 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
13722         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
13723         compiler warnings.
13724
13725 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
13726
13727         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
13728         valid tls_segment only for non-debug-section relocations.
13729         * testsuite/Makefile.am: Add gc_tls_test.
13730         * testsuite/Makefile.in: Regenerate.
13731         * testsuite/gc_tls_test.cc: New file.
13732         * testsuite/gc_tls_test.sh: New file.
13733
13734 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
13735
13736         * icf.cc: New file.
13737         * icf.h: New file.
13738         * Makefile.am (CCFILES): Add icf.cc.
13739         (HFILES): Add icf.h
13740         * Makefile.in: Regenerate.
13741         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
13742         * gc.h (gc_process_relocs): Populate lists used by icf to contain
13743         section, symbol and addend information for the relocs.
13744         * gold.cc (queue_middle_tasks): Call identical code folding.
13745         * gold.h: Add defines for multimap.
13746         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
13747         to the call of finalize_local_symbols.
13748         * main.cc (main): Create object of class Icf.
13749         * object.cc (Sized_relobj::do_layout): Allow this function to be
13750         called twice during icf.
13751         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
13752         to sections marked as identical by icf.
13753         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
13754         when available.
13755         (Sized_relobj::do_section_entsize): New function.
13756         * object.h (Object::section_entsize): New function.
13757         (Object::do_section_entsize): New pure virtual function.
13758         (Relobj::finalize_local_symbols): Add new parameter.
13759         (Relobj::do_section_entsize): New function.
13760         * options.h (General_options::icf): New option.
13761         (General_options::icf_iterations): New option.
13762         (General_options::print_icf_sections): New option.
13763         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
13764         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
13765         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
13766         icf.
13767         * symtab.cc (Symbol_table::is_section_folded): New function.
13768         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
13769         to sections marked as identical by icf.
13770         * symtab.h (Symbol_table::set_icf): New function.
13771         (Symbol_table::icf): New function.
13772         (Symbol_table::is_section_folded): New function.
13773         (Symbol_table::icf_): New data member.
13774         * target-reloc.h (relocate_section): Ignore sections folded by icf.
13775         * testsuite/Makefile.am: Add commands to build icf_test.
13776         * testsuite/Makefile.in: Regenerate.
13777         * testsuite/icf_test.sh: New file.
13778         * testsuite/icf_test.cc: New file.
13779
13780 2009-07-24  Chris Demetriou  <cgd@google.com>
13781
13782         * layout.cc (is_compressible_debug_section): Fix incorrect
13783         comment about compressed section names.
13784
13785 2009-07-20  Ian Lance Taylor  <ian@airs.com>
13786
13787         PR 10419
13788         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
13789
13790 2009-07-16  Ian Lance Taylor  <iant@google.com>
13791
13792         PR 10400
13793         * layout.h: #include <map>.
13794         (class Kept_section): Change from struct to class.  Add accessors
13795         and setters.  Add section size to Comdat_group mapping.  Change
13796         Comdat_group to std::map.  Add is_comdat_ field.  Add
13797         linkonce_size field in union.
13798         (class Layout): Update declaration of find_or_add_kept_section.
13799         Don't declare find_kept_object.
13800         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
13801         parameter.  Add object, shndx, is_comdat, and is_group_name
13802         parameters.  Change all callers.  Adjust for new Kept_section.
13803         (Layout::find_kept_object): Remove.
13804         * object.cc (Sized_relobj::include_section_group): Update use of
13805         Kept_section.  Rename secnum to shndx.  Only record
13806         Kept_comdat_section if sections are the same size.
13807         (Sized_relobj::include_linkonce_section): Update use of
13808         Kept_section.  Only record Kept_comdat_section if sections are the
13809         same size.  Set size of linkonce section.
13810         (Sized_relobj::map_to_kept_section): Update call to
13811         get_kept_comdat_section.
13812         * object.h (class Sized_relobj): Rename fields in
13813         Kept_comdat_section to drop trailing underscores; change object
13814         field to Relobj*.  Change Kept_comdat_section_table to store
13815         struct rather than pointer.
13816         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
13817         Add kept_object and kept_shndx parameters.  Change all callers.
13818         (Sized_relobj::get_kept_comdat_section): Change return type to
13819         bool.  Add kept_object and kept_shndx parameters.  Change all
13820         callers.
13821         * plugin.cc (Pluginobj::include_comdat_group): Update call to
13822         Layout::find_or_add_kept_section.
13823
13824 2009-07-09  Ian Lance Taylor  <iant@google.com>
13825
13826         * merge.cc (Object_merge_map::initialize_input_to_output_map):
13827         Reserve space in the hash table.
13828
13829 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
13830
13831         * fileread.cc (File_read::get_mtime): New method.
13832         * fileread.h (Timespec): New structure.
13833         (File_read::get_mtime): New method.
13834         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
13835         Renamed from timestamp_nsec.
13836         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
13837         Elf_Xword.
13838         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
13839         timestamp_nsec.
13840         (Incremental_inputs::report_archive): Save mtime; style fix.
13841         (Incremental_inputs::report_obejct): Save mtime; style fix.
13842         (Incremental_inputs::report_script): Save mtime; style fix.
13843         (Incremental_inputs::finalize_inputs): Style fix.
13844         (Incremental_inputs::finalize): Style fix.
13845         (Incremental_inputs::create_input_section_data): Store inputs
13846         mtime.
13847         * incremental.h (Incremental_inputs::report_script): Add mtime
13848         argument.
13849         (Incremental_inputs::Input_info::Input_info): Intialize only one
13850         union member.
13851         (Incremental_inputs::Input_info::archive): Move to nameless
13852         union.
13853         (Incremental_inputs::Input_info::obejct): Move to nameless union.
13854         (Incremental_inputs::Input_info::script): Move to nameless union.
13855         (Incremental_inputs::mtime): New field.
13856         * script.cc (read_input_script): Pass file mtime to
13857         Incremental_input.
13858         * script.h (Script_info::inputs): Style fix.
13859
13860 2009-07-01  Ian Lance Taylor  <ian@airs.com>
13861
13862         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
13863         instead of 32.
13864
13865 2009-06-24  Ian Lance Taylor  <iant@google.com>
13866
13867         PR 10156
13868         * layout.cc (Layout::choose_output_section): If we find an
13869         existing section, update the flags.
13870         (Layout::create_notes): New function, broken out of
13871         Layout::finalize.
13872         (Layout::finalize): Don't create note sections.
13873         (Layout::create_note): Don't crash if linker script discards
13874         section.
13875         (Layout::create_gold_note): Likewise.
13876         (Layout::create_build_id): Likewise.  Don't set
13877         after_input_sections on the section.
13878         (Layout::create_executable_stack_info): Remove target parameter.
13879         Change caller.
13880         * layout.h (class Layout): Declare create_notes.  Update
13881         declaration of create_executable_stack_info.
13882         * gold.cc (queue_middle_tasks): Call create_notes.
13883         * output.cc (Output_section::update_flags_for_input_section): Move
13884         here from output.h.  If SHF_ALLOC flag is newly set, mark address
13885         invalid.
13886         * output.h (Output_data::mark_address_invalid): New function.
13887         (class Output_section): Only declare, not define,
13888         update_flags_for_input_section.  Remove set_flags.
13889
13890 2009-06-24  Ian Lance Taylor  <iant@google.com>
13891
13892         * script-sections.cc (Output_section_definition::
13893         set_section_addresses): Rename shadowing local load_address to
13894         laddr.
13895
13896 2009-06-24  Ian Lance Taylor  <iant@google.com>
13897
13898         PR 10244
13899         * reloc.cc (relocate_sections): Skip empty relocation sections.
13900
13901 2009-06-23  Ian Lance Taylor  <iant@google.com>
13902
13903         PR 10156
13904         * layout.cc (Layout::create_note): Use choose_output_section
13905         rather than make_output_section.
13906
13907 2009-06-23  Ian Lance Taylor  <iant@google.com>
13908
13909         PR 10237
13910         * options.cc (General_options::parse_V): Set printed_version_.
13911         (General_options::General_options): Initialize printed_version_.
13912         * options.h (class General_options): Add printed_version_ field.
13913         * gold.cc (queue_initial_tasks): If there are no input files,
13914         don't give a fatal error if we printed the version information.
13915         (queue_middle_tasks): If using -r with a shared object, give a
13916         fatal error rather than an ordinary error.
13917
13918 2009-06-23  Ian Lance Taylor  <iant@google.com>
13919
13920         PR 10219
13921         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
13922         (Layout::make_output_section): Set have_stabstr_section_ if we see
13923         a .stab*str section.
13924         (Layout::finalize): Call link_stabs_sections.
13925         (Layout::link_stabs_sections): New file.
13926         * layout.h (class Layout): Add have_stabstr_section_ field.
13927         Declare link_stabs_sections.
13928
13929 2009-06-23  Doug Kwan  <dougkwan@google.com>
13930
13931         * Makefile.am (libgold_a_LIBADD): New.
13932         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
13933         * Makefile.in: Regenerate.
13934         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
13935         * configure: Regenerate.
13936         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
13937         * fileread.cc: Include sys/state.h
13938         * gold.h: Declare memmem and strndup if found missing.
13939         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
13940
13941 2009-06-23  Ian Lance Taylor  <iant@google.com>
13942
13943         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
13944         * configure: Rebuild.
13945
13946 2009-06-23  Ian Lance Taylor  <iant@google.com>
13947
13948         PR 10147
13949         * object.cc (Object::section_contents): Don't try to get a view if
13950         the section has length zero.
13951         (Object::handle_gnu_warning_section): If the section is empty, use
13952         the name of the section as the warning.
13953
13954 2009-06-23  Ian Lance Taylor  <iant@google.com>
13955
13956         PR 10133
13957         * stringpool.h (class Stringpool_template): Add optimize_ field.
13958         (Stringpool_template::set_optimize): New function.
13959         * stringpool.cc (Stringpool_template::Stringpool_template):
13960         Initialize optimize_ field.
13961         (Stringpool_template::set_string_offsets): Test local optimize
13962         fild rather than parameter.
13963         * layout.cc (Layout::Layout): Call set_optimize on the section
13964         name stringpool.
13965
13966 2009-06-22  Ian Lance Taylor  <iant@google.com>
13967
13968         PR 10030
13969         * yyscript.y: Parse TARGET.
13970         * script.cc (script_set_target): New function.
13971         * script-c.h (script_set_target): Declare.
13972         * options.cc (General_options::string_to_object_format): Rename
13973         from string_to_object_format in anonymous namespace.  Change
13974         callers.
13975         * options.h (class General_options): Declare
13976         string_to_object_format.
13977
13978 2009-06-22  Ian Lance Taylor  <iant@google.com>
13979
13980         * script-sections.cc (Script_sections::create_segments): Don't put
13981         program headers in a PT_LOAD segment if -n or -N.
13982
13983 2009-06-22  Ian Lance Taylor  <iant@google.com>
13984
13985         PR 10141
13986         * options.h (class General_options): Add -z lazy and -z now.  Sort
13987         -z options into alphabetical order.
13988         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
13989
13990 2009-06-21  Ian Lance Taylor  <iant@google.com>
13991
13992         * layout.cc (Layout::make_output_section): Call
13993         Target::new_output_section.
13994         (Layout::attach_allocated_section_to_segment): Put large section
13995         sections in a separate load segment with the large segment flag
13996         set.
13997         (Layout::segment_precedes): Sort large data segments after other
13998         load segments.
13999         (align_file_offset): New static function.
14000         (Layout::set_segment_offsets): Use align_file_offset.
14001         * output.h (class Output_section): Add is_small_section_ and
14002         is_large_section_ fields.
14003         (Output_section::is_small_section): New function.
14004         (Output_section::set_is_small_section):  New function.
14005         (Output_section::is_large_section): New function.
14006         (Output_section::set_is_large_section): New function.
14007         (Output_section::is_large_data_section): New function.
14008         (class Output_segment): Add is_large_data_segment_ field.
14009         (Output_segment::is_large_data_segment): New function.
14010         (Output_segment::set_is_large_data_segment): New function.
14011         * output.cc (Output_section::Output_section): Initialize new
14012         fields.
14013         (Output_segment::Output_segment): Likewise.
14014         (Output_segment::add_output_section): Add assertion that large
14015         data sections always go in large data segments.  Force small data
14016         sections to the end of the list of data sections.  Force small BSS
14017         sections to the start of the list of BSS sections.  For large BSS
14018         sections to the end of the list of BSS sections.
14019         * symtab.h (class Symbol): Declare is_common_shndx.
14020         (Symbol::is_defined): Check Symbol::is_common_shndx.
14021         (Symbol::is_common): Likewise.
14022         (class Symbol_table): Define enum Commons_section_type.  Update
14023         declarations.  Add small_commons_ and large_commons_ fields.
14024         * symtab.cc (Symbol::is_common_shndx): New function.
14025         (Symbol_table::Symbol_table): Initialize new fields.
14026         (Symbol_table::add_from_object): Put small and large common
14027         symbols in the right list.
14028         (Symbol_table::sized_finalized_symbol): Check
14029         Symbol::is_common_shndx.
14030         (Symbol_table::sized_write_globals): Likewise.
14031         * common.cc (Symbol_table::do_allocate_commons): Allocate new
14032         common symbol lists.  Don't call do_allocate_commons_list if the
14033         list is empty.
14034         (Symbol_table::do_allocate_commons_list): Remove is_tls
14035         parameter.  Add comons_section_type parameter.  Change all
14036         callers.  Handle small and large common symbols.
14037         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
14038         Symbol::is_common_shndx.
14039         * resolve.cc (symbol_to_bits): Likewise.
14040         * target.h (Target::small_common_shndx): New function.
14041         (Target::small_common_section_flags): New function.
14042         (Target::large_common_shndx): New function.
14043         (Target::large_common_section_flags): New function.
14044         (Target::new_output_section): New function.
14045         (Target::Target_info): Add small_common_shndx, large_common_shndx,
14046         small_common_section_flags, and large_common_section_flags
14047         fields.
14048         (Target::do_new_output_section): New virtual function.
14049         * arm.cc (Target_arm::arm_info): Initialize new fields.
14050         * i386.cc (Target_i386::i386_info): Likewise.
14051         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
14052         Likewise.
14053         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
14054         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14055         (Target_x86_64::do_new_output_section): New function.
14056         * configure.ac: Define conditional MCMODEL_MEDIUM.
14057         * testsuite/Makefile.am (check_PROGRAMS): Add large.
14058         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
14059         (large_LDFLAGS): Define.
14060         * testsuite/large.c: New file.
14061         * testsuite/testfile.cc (Target_test::test_target_info):
14062         Initialize new fields.
14063         * configure, testsuite/Makefile.in: Rebuild.
14064
14065 2009-06-05  Doug Kwan  <dougkwan@google.com>
14066
14067         * Makefile.am (CCFILES): Add target.cc.
14068         * Makefile.in: Regenerate.
14069         * i386.cc (class Target_i386): Define new virtual method to
14070         override do_is_local_label_name in parent.
14071         * object.cc (Sized_relobj::do_count_local_symbols): Discard
14072         local symbols if --discard-locals or -X is given.
14073         * options.h (class General_options): Declare new options
14074         '--discard-locals' and '-X' for discarding locals.
14075         * target.h (class Target): Define new methods is_local_label_name.
14076         Declare new virtual method do_is_local_label_name.
14077         * target.cc: New file.
14078         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
14079         (check_SCRIPTS): Add discard_locals_test.sh.
14080         (check_DATA): Add discard_local_tests.syms.
14081         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
14082         (discard_local_tests.syms, discard_locals_test.o): New make rules.
14083         * testsuite/Makefile.in: Regenerate.
14084         * testsuite/discard_locals_test.c: New file.
14085         * testsuite/discard_locals_test.sh: Same.
14086
14087 2009-06-05  Doug Kwan  <dougkwan@google.com>
14088
14089         * object.cc (Sized_relobj::Sized_relobj): Initialize
14090         discarded_eh_frame_shndx_ to -1U.
14091         (Sized_relobj::do_layout): Record index of a discard .eh_frame
14092         section.
14093         (Sized_relobj::do_count_local_symbols): Skip local symbols in
14094         a discarded .eh_frame section.
14095         (Sized_relobj::do_finalize_local_symbols): Ditto.
14096         * object.h (class Sized_relobj): Declare new member
14097         discarded_eh_frame_shndx_.
14098         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
14099         (local_labels_test.o, local_labels_test): New rules.
14100         * testsuite/Makefile.in: Regenerate.
14101
14102 2009-06-04  Doug Kwan  <dougkwan@google.com>
14103
14104         * layout.cc (Layout::section_name_mapping): Add mapping for
14105         special ARM sections.
14106
14107 2009-06-03  Doug Kwan  <dougkwan@google.com>
14108
14109         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
14110         (utils::has_overflow): Same.
14111
14112 2009-06-03  Ian Lance Taylor  <iant@google.com>
14113
14114         * layout.cc (Layout::section_name_mapping): New array, replacing
14115         Layout::linkonce_mapping.
14116         (Layout::section_name_mapping_count): New variable, replacing
14117         Layout::linkonce_mapping_count.
14118         (Layout::linkonce_output_name): Remove.
14119         (Layout::output_section_name): Rewrite.
14120         * layout.h (class Layout): Rename Linkonce_mapping to
14121         Section_name_mapping, linkonce_mapping to section_name_mapping,
14122         linkonce_mapping_count to section_name_mapping_count.  Don't
14123         declare linkonce_output_name.
14124
14125 2009-06-03  Doug Kwan  <dougkwan@google.com>
14126
14127         * gold/arm.cc (namespace utils): New.
14128         (Target_arm::reloc_is_non_pic): Define new method.
14129         (class Arm_relocate_functions): New.
14130         (Target_arm::Relocate::relocate): Handle relocation types used by
14131         Android.
14132
14133 2009-06-03  Ian Lance Taylor  <iant@google.com>
14134
14135         * arm.cc (Target_arm::scan::global): Use || instead of |.
14136
14137 2009-06-02  Doug Kwan  <dougkwan@google.com>
14138
14139         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
14140         issued_non_pic_error_.
14141         (class Target_arm::Scan): Declare new method check_non_pic.
14142         Define new method symbol_needs_plt_entry.
14143         Declare new data member issued_non_pic_error_.
14144         (class Target_arm::Relocate): Declare new method
14145         should_apply_static_reloc.
14146         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
14147         (Target_arm::Scan::check_non_pic): Define new method.
14148         (Target_arm::Scan::local): Handle a small subset of reloc types used
14149         by Android.
14150         (Target_arm::Scan::local): Same.
14151         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
14152
14153 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
14154
14155         * incremental.cc (Incremental_inputs::report_command_line): Filter
14156         out --incremental-* options.
14157
14158 2009-05-29  Doug Kwan  <dougkwan@google.com>
14159
14160         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
14161         template class.
14162         (class Target_arm): Update comment.
14163         (Target_arm::Target_arm): Initialize new data members GOT_,
14164         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
14165         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
14166         and Target_arm::rel_dyn_section.
14167         Declare new_enum Target_arm::Got_type.
14168         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
14169         and DYNBSS_.
14170         Update commments for member do_dynsym_value.
14171         (Target_arm::got_size, Target_arm::plt_section,
14172         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
14173         new methods inside class defintion.
14174         (Target_arm::got_section): Define new method.
14175         (Target_arm::rel_dyn_section): Same.
14176         (Output_data_plt_arm): New template class.
14177         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
14178         (Output_data_plt_arm:do_adjust_output_section): Define new method.
14179         (Output_data_plt_arm::add_entry): Same.
14180         (Output_data_plt_arm::first_plt_entry): Define new
14181         static data member for PLT instruction template.
14182         (Output_data_plt_arm::plt_entry): Same.
14183         (Output_data_plt_arm::do_write): Define new method.
14184         (Target_arm::make_plt_entry): Same.
14185         (Target_arm::do_finalize_sections): Same.
14186         (Target_arm::do_dynsym_value): Same.
14187
14188 2009-05-28  Doug Kwan  <dougkwan@google.com>
14189
14190         * Makefile.am (TARGETSOURCES): Add arm.cc.
14191         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
14192         * Makefile.in: Regenerate.
14193         * arm.cc: New file.
14194         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
14195
14196 2009-05-26  Doug Kwan  <dougkwan@google.com>
14197
14198         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
14199         (General_options::check_excluded_libs): Strip off directories in
14200         archive name before matching like GNU ld does.
14201         * testsuite/Makefile.am (MOSTLYCLEANFILES,
14202         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
14203         (exclude_libs_test_LDFLAGS): Add linker option
14204         -Wl,--exclude-libs,libexclude_libs_test_3
14205         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
14206         an explicit archive without using -l.
14207         (alt/libexclude_libs_test_3.a): New make rule.
14208         * testsuite/Makefile.in: Regenerate.
14209         * testsuite/exclude_libs_test.c : Declare lib3_default().
14210         (main): Call it.
14211         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
14212         * exclude_libs_test_3.c: New file.
14213
14214 2009-05-26  Nick Clifton  <nickc@redhat.com>
14215
14216         * po/id.po: New Indonesian translation.
14217         * po/gold.pot: Updated template file.
14218
14219 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
14220
14221         * testsuite/Makefile.am: Add -ffunction-sections to compile
14222         gc_comdat_test files.  Add -Wl,--gc-sections to build
14223         gc_comdat_test.
14224         * testsuite/Makefile.in: Regenerate.
14225         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
14226
14227 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
14228
14229         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
14230         kept comdat section was garbage collected.
14231         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
14232         * testsuite/Makefile.in: Regenerate.
14233         * testsuite/gc_comdat_test.sh: New file.
14234         * testsuite/gc_comdat_test_1.cc: New file.
14235         * testsuite/gc_comdat_test_2.cc: New file.
14236
14237 2009-05-19  Doug Kwan  <dougkwan@google.com>
14238
14239         * archive.cc (Archive::Archive): Move constructor from archive.h
14240         to here.  Initialize no_export_.
14241         (Archive::get_elf_object_for_member): Set no_export flag of object.
14242         * archive.h (Archive::Archive): Move constructor body to
14243         archive.cc.
14244         (Archive::no_export): New method.
14245         (Archive::no_export_): New field.
14246         * object.h (Object::Object): Initialize no_export_ to false.
14247         (Object::no_export, Object::set_no_export): New methods.
14248         (Object::no_export_): New field.
14249         * options.cc (General_options::parse_exclude_libs): New method.
14250         (General_options::check_excluded_libs) Same.
14251         * options.h (exclude_libs): New option.
14252         (General_options::check_excluded_libs): New method declaration.
14253         (General_options::excluded_libs_): New field.
14254         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
14255         default or protected visibility if an object has no-export flag set.
14256         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
14257         (check_SCRIPTS): Add exclude_libs_test.sh.
14258         (check_DATA): Add exclude_libs_test.syms.
14259         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
14260         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
14261         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
14262         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
14263         (exclude_libs_test.syms, libexclude_libs_test_1.a,
14264         libexclude_libs_test_2.a): New rules.
14265         * testsuite/Makefile.in: Regenerate.
14266         * testsuite/exclude_libs_test.c: New file.
14267         * testsuite/exclude_libs_test.sh: Ditto.
14268         * testsuite/exclude_libs_test_1.c: Ditto.
14269         * testsuite/exclude_libs_test_2.c: Ditto.
14270
14271 2009-05-15  Ian Lance Taylor  <iant@google.com>
14272
14273         * configure.ac: Check for declarations for cases where libiberty.h
14274         checks HAVE_DECL_xxx.
14275         * configure, config.in: Rebuild.
14276
14277 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
14278
14279         * gold.h (Incremental_argument_list): Remove (invalid) forward
14280         declaration.
14281         * incremental.cc (Incremental_inputs::report_achive): New method.
14282         (Incremental_inputs::report_object): New method.
14283         (Incremental_inputs::report_script): New method.
14284         (Incremental_inputs::finalize_inputs): New method.
14285         (Incremental_inputs::finalize): Call finalize_inputs().
14286         (Incremental_inputs::sized_create_incremental_inputs_section_data):
14287         Create inputs entries.
14288         * incremental.h (Incremental_input_type): New enum.
14289         (Incremental_inputs::Incremental_input): Initialize new fields.
14290         (Incremental_inputs::report_inputs): New method.
14291         (Incremental_inputs::report_achive): New method.
14292         (Incremental_inputs::report_object): New method.
14293         (Incremental_inputs::report_script): New method.
14294         (Incremental_inputs::finalize_inputs): New method.
14295         (Incremental_inputs::Input_info): New struct.
14296         (Incremental_inputs::Input_info_map): New typedef.
14297         (Incremental_inputs::lock_): New field.
14298         (Incremental_inputs::Inputs_): New field.
14299         (Incremental_inputs::Inputs_map): New field.
14300         * main.cc (main): Call Incremental_input::report_inputs.
14301         * options.h (Input_argument_list): Typedef moved from
14302         Input_arguments.
14303         (Input_file_group::Files): Remove, use ::Input_argument_list.
14304         (Input_file_group::Input_argument_list): Remove, use
14305         ::Input_argument_list.
14306         * plugin.cc (Plugin_manager::add_input_file): Add error in
14307         incremental build.
14308         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
14309         functions.
14310         * script.cc (read_input_script): Call
14311         Incremental_input::report_script.
14312         * script.h (Script_info): New class.
14313
14314 2009-04-27  Ian Lance Taylor  <iant@google.com>
14315
14316         * x86_64.cc (do_adjust_output_section): Set entsize to
14317         plt_entry_size.
14318
14319 2009-04-23  Elliott Hughes  <enh@google.com>
14320
14321         * output.cc (Output_file::close): After short writes, continue
14322         writing from the correct offset in the buffer being written.
14323
14324 2009-04-23  Chris Demetriou  <cgd@google.com>
14325
14326         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
14327         * configure: Regenerate.
14328         * config.in: Regenerate.
14329         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
14330         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
14331
14332 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
14333
14334         * incremental.cc (Incremental_inputs_header_data): Renamed from
14335         Incremental_input_header_data.
14336         (Incremental_inputs_header_data::data_size): New field.
14337         (Incremental_inputs_header_data::put_input_file_count): Renamed
14338         from input_file_count.
14339         (Incremental_inputs_header_data::put_command_line_offset): Renamed
14340         from command_line_offset.
14341         (Incremental_inputs_header_data::put_reserved): Renamed from
14342         put_reserved.
14343         (Incremental_inputs_entry_data): Renamed from
14344         Incremental_input_entry_data.
14345         (Incremental_inputs_entry_data::data_size): New field.
14346         (Incremental_inputs::report_command_line): New method.
14347         (Incremental_inputs::finalize): New method.
14348         (Incremental_inputs::create_incremental_inputs_data): New method.
14349         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
14350         * incremental.h: New file.
14351         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
14352         (Layout::finalize): Create incremental inputs section in
14353         incremental builds.
14354         (Layout::create_incremental_info_sections): New method.
14355         * layout.h (Layout::incremental_inputs): New method.
14356         (Layout::create_incremental_info_sections): New method.
14357         (Layout::incremental_inputs_): New field.
14358         * main.cc (main): Notify Incremental_input of the command line.
14359
14360 2009-04-01  Ian Lance Taylor  <iant@google.com>
14361             Mikolaj Zalewski  <mikolajz@google.com>
14362
14363         * gold.h (reserve_unordered_map): Define, three versions, one for
14364         each version of Unordered_map.
14365         * layout.cc (Layout::Layout): Remove options parameter.  Add
14366         number_of_input_files parameter.  Don't initialize options_.
14367         Initialize number_of_input_files_ and resized_signatures_.  Move
14368         sections_are_attached_.
14369         (Layout::layout_group): Reserve space for group_signatures_.
14370         (Layout::find_or_add_kept_section): Change name parameter to be a
14371         reference.  Resize signatures_ map when it gets large enough.
14372         (Layout::layout_eh_frame): Use parameters->options() instead of
14373         this->options_.
14374         (Layout::make_output_section): Likewise.
14375         (Layout::attach_allocated_section_to_segment): Likewise.
14376         (Layout::finalize, Layout::create_executable_stack): Likewise.
14377         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
14378         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
14379         * layout.h (class Layout): Update declarations.  Remove options_
14380         field.  Add number_of_input_files_ and resized_signatures_
14381         fields.  Move sections_are_attached_ field.
14382         * main.cc (main): Pass number of input files to Layout
14383         constructor.  Don't pass options.
14384
14385 2009-03-30  Ian Lance Taylor  <iant@google.com>
14386
14387         * ffsll.c (ffsll): Correct implementation.
14388
14389 2009-03-27  Ian Lance Taylor  <iant@google.com>
14390
14391         * ffsll.c: New file.
14392         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
14393         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
14394         * ftruncate.c (ftruncate): Declare before definition.
14395         * mremap.c (mremap): Likewise.
14396         * pread.c (pread): Likewise.
14397         * configure, Makefile.in, config.in: Rebuild.
14398
14399         * mremap.c: New file.
14400         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
14401         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
14402         (mremap): Declare if HAVE_MREMAP is not defined.
14403         * configure, Makefile.in, config.in: Rebuild.
14404
14405 2009-03-27  Cary Coutant  <ccoutant@google.com>
14406
14407         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
14408         position independent.
14409         * sparc.cc (Target_sparc::check_non_pic): Likewise.
14410         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
14411
14412 2009-03-24  Cary Coutant  <ccoutant@google.com>
14413
14414         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
14415         an executable.
14416         (needs_dynamic_reloc): Likewise.
14417
14418 2009-03-24  Ian Lance Taylor  <iant@google.com>
14419
14420         * yyscript.y (file_cmd): Recognize EXTERN.
14421         (extern_name_list, extern_name_list_body): New nonterminals.
14422         * script.cc (script_add_extern): Define.
14423         * script-c.h (script_add_extern): Declare.
14424
14425 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
14426
14427         * object.cc (is_elf_object): Define.
14428         * object.h (is_elf_object): Declare.
14429         * archive.cc (Archive::get_elf_object_for_member): Call
14430         is_elf_object.
14431         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
14432
14433 2009-03-24  Elliott Hughes  <enh@google.com>
14434
14435         * output.cc (Output_file::map_anonymous): Define.
14436         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
14437         try an anonymous one.  Report the size if the mmap fails.
14438         * output.h (class Output_file): Declare map_anonymous.
14439
14440 2009-03-24  Ian Lance Taylor  <iant@google.com>
14441
14442         * target-select.cc (instantiate_target): Don't acquire the lock if
14443         the instantiated_target_ field has already been set.
14444
14445 2009-03-23  Ian Lance Taylor  <iant@google.com>
14446
14447         * gold-threads.h (class Initialize_lock): Define.
14448         * gold-threads.cc (class Initialize_lock_once): Define.
14449         (initialize_lock_control): New static variable.
14450         (initialize_lock_pointer): New static variable.
14451         (initialize_lock_once): New static function.
14452         (Initialize_lock::Initialize_lock): Define.
14453         (Initialize_lock::initialize): Define.
14454         * target-select.h: Include "gold-threads.h".
14455         (class Target_selector): Add lock_ and initialize_lock_ fields.
14456         Don't define instantiate_target, just declare it.
14457         * target-select.cc (Target_selector::Target_selector): Initialize
14458         new fields.
14459         (Target_selector::instantiate_target): Define.
14460         * descriptors.h: Include "gold-threads.h".
14461         (class Descriptors): Add initialize_lock_ field.
14462         * descriptors.cc (Descriptors::Descriptors): Initialize new
14463         field.
14464         (Descriptors::open): Use initialize_lock_ field
14465         * errors.h (class Errors): Add initialize_lock_ field.
14466         * errors.cc (Errors::Errors): Initialize new field.
14467         (Errors::initialize_lock): Use initialize_lock_ field.
14468         * powerpc.cc (class Target_selector_powerpc): Remove
14469         instantiated_target_ field.  In do_recognize call
14470         instantiate_target rather than do_instantiate_target.  In
14471         do_instantiate_target just allocate a new target.
14472         * sparc.cc (class Target_selector_sparc): Likewise.
14473
14474         * freebsd.h: New file.
14475         * i386.cc: Include "freebsd.h".
14476         (Target_i386): Derive from Target_freebsd rather than
14477         Sized_target.
14478         (Target_selector_i386): Derive from Target_selector_freebsd rather
14479         than Target_selector.
14480         * x86_64.cc: Include "freebsd.h".
14481         (Target_x86_64): Derive from Target_freebsd rather than
14482         Sized_target.
14483         (Target_selector_x86_64): Derive from Target_selector_freebsd
14484         rather than Target_selector.
14485         * target.h (class Target): Add adjust_elf_header and
14486         do_adjust_elf_header.
14487         * output.cc (Output_file_header:: do_sized_write): Call target
14488         adjust_elf_header routine.
14489         * configure.tgt: Set targ_osabi.
14490         * configure.ac: Define GOLD_DEFAULT_OSABI.
14491         * parameters.cc (Parameters::default_target): Pass
14492         GOLD_DEFAULT_OSABI to select_target.
14493         * target-select.h (class Target_selector): Make instantiate_target
14494         protected rather than private.
14495         * Makefile.am (HFILES): Add freebsd.h.
14496         * configure, Makefile.in, config.in: Rebuild.
14497
14498         * merge.cc (do_add_input_section): Correct pend value.  Change
14499         message about last entry not being null terminated from error to
14500         warning.
14501
14502 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
14503
14504         * incremental.cc: New file.
14505         * Makefile.am (CCFILES): Add incremental.cc.
14506         * Makefile.in: Rebuild.
14507
14508 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
14509
14510         * layout.cc (Layout::output_section_name): Preserve names
14511         of '.note.' sections.
14512
14513 2009-03-19  Ian Lance Taylor  <iant@google.com>
14514
14515         * descriptors.cc (Descriptors::open): Check that the options are
14516         valid before using them.
14517
14518 2009-03-18  Ian Lance Taylor  <iant@google.com>
14519
14520         * script-sections.h: Include <list>.
14521         (class Script_sections): Change Sections_elements from std::vector
14522         to std::list.  Typedef public Elements_iterator.  Add
14523         orphan_section_placement_, data_segment_align_start_, and
14524         saw_data_segment_align_ fields.  Remove data_segment_align_index_
14525         field.
14526         * script-sections.cc (class Orphan_section_placement): New class.
14527         (class Sections_element): Add virtual functions is_relro and
14528         orphan_section_init.  Remove virtual function place_orphan_here.
14529         (class Output_section_definition): Add is_relro and
14530         orphan_section_init.  Remove place_orphan_here.
14531         (class Orphan_output_section): Likewise.
14532         (Script_sections::Script_sections): Update for field changes.
14533         (Script_sections::data_segment_align): Set saw_data_segment_align_
14534         and data_segment_align_start_, not data_segment_align_index.
14535         (Script_sections::data_segment_relro_end): Check
14536         saw_data_segment_align_.  Use data_segment_align_start_ rather
14537         than data_segment_align_index_.
14538         (Script_sections::place_orphan): Rewrite to use
14539         Orphan_section_placement.
14540
14541 2009-03-17  Ian Lance Taylor  <iant@google.com>
14542
14543         * archive.cc (Archive::add_symbols): Check for a version attached
14544         to the symbol name in the archive map.
14545         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
14546         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
14547         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
14548         (ver_test_11.a): New target.
14549         * testsuite/Makefile.in: Rebuild.
14550
14551         * configure.ac: Check for chsize and posix_fallocate.  Replace
14552         ftruncate.
14553         * ftruncate.c: New file, from gnulib.
14554         * output.cc (posix_fallocate): Define dummy version if not
14555         HAVE_POSIX_FALLOCATE.
14556         (Output_file::map): Call posix_fallocate rather than lseek and
14557         write.
14558         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
14559         * configure, Makefile.in, config.in: Rebuild.
14560
14561 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
14562
14563         * layout.h (Layout::create_note): Add section_name parameter.
14564         * layout.cc (Layout::create_note): Likewise.
14565         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
14566
14567 2009-03-17  Ian Lance Taylor  <iant@google.com>
14568
14569         * descriptors.cc: Include "options.h".
14570         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
14571         (Descriptors::open): Always use O_CLOEXEC when opening a new
14572         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
14573         then set FD_CLOEXEC.
14574
14575         * sparc.cc (class Target_sparc): Add has_got_section.
14576         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
14577         make sure we have a GOT section.
14578
14579         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
14580         (Target_sparc::Scan::local): Likewise.
14581         (Target_sparc::Scan::global): Likewise.
14582         (Target_sparc::Relocate::relocate): Likewise.
14583         (Target_sparc::Relocate::relocate_tls): Likewise.
14584
14585         * symtab.cc (Symbol_table::define_default_version): New function,
14586         broken out of add_from_object.
14587         (Symbol_table::add_from_object): Call define_default_version.
14588         (Symbol_table::define_special_symbol): Add resolve_oldsym
14589         parameter.  Change all callers.  If the version for a symbol comes
14590         from a version script, resolve it with the symbol with the same
14591         name with no version.  Also add the symbol without a version if
14592         appropriate.
14593         (do_define_in_output_data): If resolving with oldsym, don't delete
14594         sym.
14595         (do_define_in_output_segment): Likewise.
14596         (do_define_as_constant): Likewise.
14597         * symtab.h (class Symbol_table): Update declarations.
14598
14599 2009-03-13  Ian Lance Taylor  <iant@google.com>
14600
14601         * readsyms.cc (Read_symbols::incompatible_warning): New function.
14602         (Read_symbols::requeue): New function.
14603         (Read_symbols::do_read_symbols): If make_elf_object fails because
14604         the target type is not configured, and the file was searched for,
14605         issue a warning and retry with the next directory.
14606         (Add_symbols::run): If the file has an incompatible format, and
14607         it was searched for, requeue the Read_symbols task.  On error,
14608         release the object.
14609         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
14610         dirindex parameter to constructor.  Change all callers.  Declare
14611         incompatible_warning and requeue.
14612         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
14613         input_argument_ and input_group_ fields.  Add them to
14614         constructor.  Change all callers.
14615         (class Read_script): Add dirindex_ field.  Add it to constructor.
14616         Change all callers.
14617         * archive.cc (Archive::setup): Remove input_objects parameter.
14618         Change all callers.
14619         (Archive::get_file_and_offset): Likewise.
14620         (Archive::read_all_symbols): Likewise.
14621         (Archive::read_symbols): Likewise.
14622         (Archive::get_elf_object_for_member): Remove input_objects
14623         parameter.  Add punconfigured parameter.  Change all callers.
14624         (Archive::add_symbols): Change return type to bool.  Check return
14625         value of include_member.
14626         (Archive::include_all_members): Likewise.
14627         (Archive::include_member): Change return type to bool.  Return
14628         false if first included object has incompatible target.  Set
14629         included_member_ field.
14630         (Add_archive_symbols::run): If add_symbols returns false, requeue
14631         Read_symbols task.
14632         * archive.h (class Archive): Add included_member_ field.
14633         Initialize it in constructor.  Add input_file and searched_for
14634         methods.  Update declarations.
14635         (class Add_archive_symbols): Add dirpath_, dirindex_, and
14636         input_argument_ fields.  Add them to constructor.  Change all
14637         callers.
14638         * script.cc: Include "target-select.h".
14639         (class Parser_closure): Add skip_on_incompatible_target_ and
14640         found_incompatible_target_ fields.  Add
14641         skip_on_incompatible_target parameter to constructor.  Change all
14642         callers.  Add methods skip_on_incompatible_target,
14643         clear_skip_on_incompatible_target, found_incompatible_target, and
14644         set_found_incompatible_target.
14645         (read_input_script): Add dirindex parameter.  Change all callers.
14646         If parser finds an incompatible target, requeue Read_symbols
14647         task.
14648         (script_set_symbol): Clear skip_on_incompatible_target in
14649         closure.
14650         (script_add_assertion, script_parse_option): Likewise.
14651         (script_start_sections, script_add_phdr): Likewise.
14652         (script_check_output_format): New function.
14653         * script.h (read_input_script): Update declaration.
14654         * script-c.h (script_check_output_format): Declare.
14655         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
14656         (ignore_cmd): Remove OUTPUT_FORMAT.
14657         * fileread.cc (Input_file::Input_file): Add explicit this.
14658         (Input_file::will_search_for): New function.
14659         (Input_file::open): Add pindex parameter.  Change all callers.
14660         * fileread.h (class Input_file): Add input_file_argument method.
14661         Declare will_search_for.  Update declarations.
14662         * object.cc (make_elf_object): Add punconfigured parameter.
14663         Change all callers.
14664         * object.h (class Object): Make input_file public.  Add
14665         searched_for method.
14666         (make_elf_object): Update declaration.
14667         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
14668         restart search.
14669         * dirsearch.h (class Dirsearch): Update declaration.
14670         * options.h (class General_options): Add --warn-search-mismatch.
14671         * parameters.cc (Parameters::is_compatible_target): New function.
14672         * parameters.h (class Parameters): Declare is_compatible_target.
14673         * workqueue.cc (Workqueue::add_blocker): New function.
14674         * workqueue.h (class Workqueue): Declare add_blocker.
14675
14676         * fileread.cc (Input_file::open): Remove options parameter.
14677         Change all callers.
14678         (Input_file::open_binary): Likewise.
14679         * script.cc (read_input_script): Likewise.
14680         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
14681         options parameter from constructor.  Change all callers.
14682         (class Read_script): Likewise.
14683         * fileread.h (class Input_file): Update declarations.
14684         * script.h (read_input_script): Update declaration.
14685
14686 2009-03-10  Nick Clifton  <nickc@redhat.com>
14687
14688         * po/es.po: New Spanish translation.
14689
14690 2009-03-06  Cary Coutant  <ccoutant@google.com>
14691
14692         * options.cc (parse_short_option): Keep dash_z from registering itself.
14693
14694 2009-03-03  Ian Lance Taylor  <iant@google.com>
14695
14696         PR 9918
14697         * target-reloc.h (relocate_section): Pass output_section to
14698         relocate.
14699         * i386.cc (Target_i386::should_apply_static_reloc): Add
14700         output_section parameter.  Change all callers.
14701         (Target_i386::Relocate::relocate): Add output_section parameter.
14702         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14703         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
14704         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
14705         * testsuite/two_file_shared.sh: New script.
14706         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
14707         (check_DATA): Add two_file_shared.dbg.
14708         (two_file_shared.dbg): New target.
14709         * testsuite/Makefile.in: Rebuild.
14710
14711 2009-03-01  Ian Lance Taylor  <iant@google.com>
14712
14713         * configure.ac: Check for byteswap.h.
14714         * configure: Rebuild.
14715         * config.in: Rebuild.
14716
14717 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
14718
14719         * layout.cc (Layout::find_or_add_kept_section): New function.
14720         (Layout::add_comdat): Removed.
14721         * layout.h (struct Kept_section): Move out of class Layout.
14722         Remove trailing underscores from field names.  Add group_sections
14723         field.  Rename group_ field to is_group.  Change all uses.
14724         (class Layout): Declare find_or_add_kept_section, not add_comdat.
14725         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
14726         comdat_groups_ field.
14727         (Sized_relobj::include_section_group): Use
14728         find_or_add_kept_section and Kept_section::group_sections.
14729         (Sized_relobj::include_linkonce_section): Likewise.
14730         * object.cc (class Sized_relobj): Don't define Comdat_group or
14731         Comdat_group_table.  Remove find_comdat_group and
14732         add_comdat_group.  Remove comdat_groups_ field.
14733         * plugin.cc (include_comdat_group): Use
14734         Layout::find_or_add_kept_section.
14735
14736 2009-02-28  Ian Lance Taylor  <iant@google.com>
14737
14738         * README: --gc-sections and map files are now supported.  Document
14739         some build requirements.
14740
14741         PR 6992
14742         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
14743         relocatable link set the value of the section symbol to zero.
14744         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
14745         relocatable link don't include the section address in the local
14746         symbol value.
14747
14748 2009-02-27  Ian Lance Taylor  <iant@google.com>
14749
14750         PR 6811
14751         * options.h (class Search_directory): Add is_system_directory.
14752         (class General_options): Declare is_in_system_directory.
14753         * options.cc (get_relative_sysroot): Make static.
14754         (get_default_sysroot): Make static.
14755         (General_optoins::is_in_system_directory): New function.
14756         * fileread.cc (Input_file::is_in_system_directory): New function.
14757         * fileread.h (class Input_file): Declare is_in_system_directory.
14758         * object.h (class Object): Add is_in_system_directory.
14759         (class Input_objects): Remove system_library_directory_ field.
14760         * object.cc (Input_objects::add_object): Don't set
14761         system_library_directory_.
14762         (input_objects::found_in_system_library_directory): Remove.
14763         * symtab.cc (Symbol_table::write_globals): Remove input_objects
14764         parameter.  Change all callers.
14765         (Symbol_table::sized_write_globals): Likewise.
14766         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
14767         Call Object::is_in_system_directory.
14768         * symtab.h (class Symbol_table): Update declarations.
14769
14770         PR 5990
14771         * descriptors.h (Open_descriptor): Add is_on_stack field.
14772         * descriptors.cc (Descriptors::open): If the descriptor is on the
14773         top of the stack, remove it.  Initialize is_on_stack field.
14774         (Descriptors::release): Only add pod to stack if it is not on the
14775         stack already.
14776         (Descriptors::close_some_descriptor): Clear stack_next and
14777         is_on_stack fields.
14778
14779         PR 7091
14780         * output.cc (Output_section::find_starting_output_address): Rename
14781         from starting_output_address; add PADDR parameter; change return
14782         type.
14783         * output.h (class Output_section): Declare
14784         find_starting_output_address instead of starting_output_address.
14785         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
14786         section symbol for which we can't find a merge section.
14787
14788         PR 9836
14789         * symtab.cc (Symbol_table::add_from_object): If the visibility is
14790         hidden or internal, force the symbol to be local.
14791         * resolve.cc (Symbol::override_visibility): Define.
14792         (Symbol::override_base): Use override_visibility.
14793         (Symbol_table::resolve): Likewise.
14794         (Symbol::override_base_with_special): Likewise.
14795         (Symbol_table::override_with_special): If the visibility is hidden
14796         or internal, force the symbol to be local.
14797         * symtab.h (class Symbol): Add set_visibility and
14798         override_visibility.
14799         * testsuite/ver_test_1.sh: New file.
14800         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
14801         (check_DATA): Add ver_test_1.syms.
14802         (ver_test_1.syms): New target.
14803         * testsuite/Makefile.in: Rebuild.
14804
14805 2009-02-25  Cary Coutant  <ccoutant@google.com>
14806
14807         * layout.cc (Layout::choose_output_section): Don't rename sections
14808         when using a linker script that has a SECTIONS clause.
14809         * Makefile.in: Regenerate.
14810
14811         * testsuite/Makefile.am (script_test_5.sh): New test case.
14812         * testsuite/Makefile.in: Regenerate.
14813         * testsuite/script_test_5.cc: New file.
14814         * testsuite/script_test_5.sh: New file.
14815         * testsuite/script_test_5.t: New file.
14816
14817 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
14818
14819         * archive.cc (Archive::include_member): Update calls to add_symbols.
14820         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
14821         the Layout argument.
14822         * dynobj.h (do_add_symbols): Add the Layout argument.
14823         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
14824         Layout argument.
14825         * object.h (Object::add_symbols): Add the Layout argument.
14826         (Object::do_add_symbols): Add the Layout argument.
14827         (Sized_relobj::do_add_symbols): Add the Layout argument.
14828         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
14829         Unify the two versions.
14830         (Add_plugin_symbols): Remove.
14831         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
14832         (Sized_pluginobj::do_add_symbols): Unify the two versions.
14833         (Add_plugin_symbols): Remove.
14834         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
14835         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
14836         (Add_symbols::run): Make it work with Pulginobj.
14837
14838 2009-02-06  Ian Lance Taylor  <iant@google.com>
14839
14840         * object.cc (Sized_relobj::do_layout): Make info message start
14841         with lower case letter.
14842
14843 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
14844
14845         * binary.cc: Fix file comment.
14846
14847         * options.h (enum Incremental_disposition): Define.
14848         (class General_options): Add new options: --incremental,
14849         --incremental_changed, --incremental_unchanged,
14850         --incremental_unknown.  Add incremental_disposition_ and
14851         implicit_incremental_ fields.
14852         (General_options::incremental_disposition): New function.
14853         (class Position_dependent_options): Add incremental_disposition
14854         option.
14855         (Position_dependent_options::copy_from_options): Set incremental
14856         dispositions.
14857         * options.cc (General_options::parse_incremental_changed): New
14858         function.
14859         (General_options::parse_incremental_unchanged): New function.
14860         (General_options::parse_incremental_unknown): New function.
14861         (General_options::General_options): Initialize new fields
14862         incremental_disposition_ and implicit_incremental_.
14863         (General_options::finalize): Check for uasge of --incremental-*
14864         without --incremental.
14865
14866 2009-02-06  Chris Demetriou  <cgd@google.com>
14867
14868         * gold.h (gold_undefined_symbol): Change to take only a Symbol
14869         pointer and to report location as the file name associated with
14870         the symbol.
14871         (gold_undefined_symbol_at_location): New function to replace the
14872         old gold_undefined_symbol functionality.
14873         * target-reloc.h (relocate_section): Update to use
14874         gold_undefined_symbol_at_location.
14875         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14876         Call gold_undefined_symbol function rather than gold_error.
14877         * errors.h (Errors::undefined_symbol): Take location as a
14878         string, rather than calculating it from a relocation.
14879         * errors.cc (Errors::fatal): Print "fatal error:" before the
14880         formatted message.
14881         (Errors::error, Errors::error_at_location): Print "error: "
14882         before the formatted message.
14883         (Errors::undefined_symbol): Take location as a string, rather
14884         than calculating it from a relocation.
14885         (gold_undefined_symbol_at_location): New function akin to
14886         old gold_undefined_symbol, calculates location from relocation.
14887         (gold_undefined_symbol): Change to take only a Symbol pointer
14888         and to report location as the file name associated with the symbol.
14889         * testsuite/debug_msg.sh: Update for changed error messages.
14890         * testsuite/undef_symbol.sh: Likewise.
14891
14892 2009-02-04  Duncan Sands  <baldrick@free.fr>
14893
14894         PR 9812
14895         * reduced_debug_output.h
14896         (Output_reduced_debug_abbrev_section::failed): Use format for
14897         gold_warning.
14898         (Output_reduced_debug_info_section::faild): Likewise.
14899
14900 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
14901
14902         * script.cc (Lazy_demangler): New class.
14903         (Version_script_info::get_symbol_version_helper): Demangle a
14904         symbol only once.
14905
14906 2009-01-29  Cary Coutant  <ccoutant@google.com>
14907
14908         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
14909         to __tls_get_addr.
14910         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14911
14912 2009-01-28  Ian Lance Taylor  <iant@google.com>
14913
14914         * version.cc (version_string): Bump to 1.9.
14915
14916         * gold.h: Include <cstring> and <stdint.h>.
14917         * version.cc: Include <cstdio>.
14918         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
14919         warning.
14920         * reduced_debug_output.cc (insert_into_vector): Rename from
14921         Insert_into_vector; change all callers.  Use Swap_unaligned to
14922         avoid aliasing issue; remove union since it is unnecessary.
14923
14924 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
14925
14926         * Makefile.am (CCFILES): Add gc.cc.
14927         (HFILES): Add gc.h.
14928         * Makefile.in: Regenerate.
14929         * gold.cc (Gc_runner): New class.
14930         (queue_initial_tasks): Call garbage collection related tasks
14931         when corresponding options are invoked.
14932         (queue_middle_gc_tasks): New function.
14933         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
14934         processed early before laying out sections during garbage collection.
14935         * gold.h (queue_middle_gc_tasks): New function.
14936         (is_prefix_of): Move from "layout.cc".
14937         * i386.cc (Target_i386::gc_process_relocs): New function.
14938         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
14939         * main.cc (main): Create object of class "Garbage_collection".
14940         * object.cc (Relobj::copy_symbols_data): New function.
14941         (Relobj::is_section_name_included): New function.
14942         (Sized_relobj::do_layout): Allow this function to be called twice
14943         during garbage collection and defer layout of section during the
14944         first call.
14945         * object.h (Relobj::get_symbols_data): New function.
14946         (Relobj::is_section_name_included): New function.
14947         (Relobj::copy_symbols_data): New function.
14948         (Relobj::set_symbols_data): New function.
14949         (Relobj::get_relocs_data): New function.
14950         (Relobj::set_relocs_data): New function.
14951         (Relobj::is_output_section_offset_invalid): New pure virtual function.
14952         (Relobj::gc_process_relocs): New function.
14953         (Relobj::do_gc_process_relocs): New pure virtual function.
14954         (Relobj::sd_): New data member.
14955         (Sized_relobj::is_output_section_offset_invalid): New function.
14956         (Sized_relobj::do_gc_process_relocs): New function.
14957         * options.h (General_options::gc_sections): Modify to not be a no-op.
14958         (General_options::print_gc_sections): New option.
14959         * plugin.cc (Plugin_finish::run): Remove function call to
14960         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
14961         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
14962         * reloc.cc (Read_relocs::run): Add task to process relocs and
14963         determine unreferenced sections when doing garbage collection.
14964         (Gc_process_relocs): New class.
14965         (Sized_relobj::do_gc_process_relocs): New function.
14966         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
14967         sections that are garbage collected.
14968         * reloc.h (Gc_process_relocs): New class.
14969         * sparc.cc (Target_sparc::gc_process_relocs): New function.
14970         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
14971         symbols whose corresponding sections are garbage collected.
14972         (Symbol_table::Symbol_table): Add new parameter for the garbage
14973         collection object.
14974         (Symbol_table::gc_mark_undef_symbols): New function.
14975         (Symbol_table::gc_mark_symbol_for_shlib): New function.
14976         (Symbol_table::gc_mark_dyn_syms): New function.
14977         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
14978         as garbage.
14979         (Symbol_table::add_from_object): Likewise.
14980         (Symbol_table::add_from_relobj): When building shared objects, do not
14981         treat externally visible symbols as garbage.
14982         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
14983         table information for static and relocatable links.
14984         * symtab.h (Symbol_table::set_gc): New function.
14985         (Symbol_table::gc): New function.
14986         (Symbol_table::gc_mark_undef_symbols): New function.
14987         (Symbol_table::gc_mark_symbol_for_shlib): New function.
14988         (Symbol_table::gc_mark_dyn_syms): New function.
14989         (Symbol_table::gc_): New data member.
14990         * target.h (Sized_target::gc_process_relocs): New pure virtual
14991         function.
14992         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
14993         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
14994
14995 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
14996
14997         * options.h (General_options::gc_sections): Define as a no-op for now.
14998         (General_options::no_keep_memory): Ditto.
14999         (General_options::Bshareable): Define.
15000         * options.cc (General_options::finalize): Honor -Bshareable.
15001
15002 2009-01-20  Andreas Schwab  <schwab@suse.de>
15003
15004         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
15005         read the value in the contents, since we don't use it.  Use the
15006         template endianness when writing.
15007         (Relocate::relocate): Use it for R_PPC_REL16_HA.
15008
15009 2009-01-19  Andreas Schwab  <schwab@suse.de>
15010
15011         * configure.tgt (powerpc64-*): Fix targ_obj.
15012
15013 2009-01-15  Ian Lance Taylor  <iant@google.com>
15014
15015         * object.cc (Sized_relobj::write_local_symbols): Don't write out
15016         local symbols when stripping all symbols.
15017
15018 2009-01-14  Cary Coutant  <ccoutant@google.com>
15019
15020         * output.cc (Output_reloc): Add explicit instantiations.
15021
15022 2009-01-14  Cary Coutant  <ccoutant@google.com>
15023
15024         * archive.cc (Archive::get_elf_object_for_member): Remove call
15025         to File_read::claim_for_plugin.
15026         * descriptors.cc (Descriptors::open): Remove reference to
15027         is_claimed.
15028         (Descriptors::claim_for_plugin): Remove.
15029         * descriptors.h (Descriptors::claim_for_plugin): Remove.
15030         (Descriptors::is_claimed): Remove.
15031         (claim_descriptor_for_plugin): Remove.
15032         * fileread.cc (File_read::claim_for_plugin): Remove.
15033         * fileread.h (File_read::claim_for_plugin): Remove.
15034         (File_read::descriptor): Reopen descriptor if necessary.
15035         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
15036         (Plugin_manager::all_symbols_read): Add task parameter. Change
15037         all callers.
15038         (Plugin_manager::get_input_file): New function.
15039         (Plugin_manager::release_input_file): New function.
15040         (Pluginobj::Pluginobj): Add filesize parameter and initialize
15041         corresponding data member.
15042         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
15043         and pass to base constructor. Change all callers.
15044         (get_input_file, release_input_file): New functions.
15045         (make_sized_plugin_object): Add filesize parameter. Change all callers.
15046         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
15047         (Plugin_manager::all_symbols_read): Add task parameter.
15048         (Plugin_manager::get_input_file): New function.
15049         (Plugin_manager::release_input_file): New function.
15050         (Plugin_manager::task_): New data member.
15051         (Pluginobj::Pluginobj): Add filesize parameter.
15052         (Pluginobj::filename): New function.
15053         (Pluginobj::descriptor): New function.
15054         (Pluginobj::filesize): New function.
15055         (Pluginobj::filesize_): New data member.
15056         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
15057         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
15058         File_read::claim_for_plugin; use Object::unlock to unlock the file.
15059
15060         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
15061         with archive libraries.
15062         * testsuite/Makefile.in: Regenerate.
15063         * testsuite/plugin_test.c (struct sym_info): New type.
15064         (get_input_file, release_input_file): New static variables.
15065         (onload): Capture new transfer vector entries.
15066         (claim_file_hook): Stop reading at end of file according to filesize.
15067         Factor out parsing of readelf output into separate function.
15068         (all_symbols_read_hook): Exercise get_input_file and release_input_file
15069         APIs and get the source file name from the symbol table.  Convert
15070         source file name to corresponding object file name.  Print info
15071         message when adding new input files.
15072         (parse_readelf_line): New function.
15073         * testsuite/plugin_test_1.sh: Add checks for new info messages.
15074         * testsuite/plugin_test_2.sh: Likewise.
15075         * testsuite/plugin_test_3.sh: Likewise.
15076         * testsuite/plugin_test_4.sh: New test case.
15077
15078 2009-01-07  Ian Lance Taylor  <iant@google.com>
15079
15080         * version.cc (version_string): Bump to 1.8.
15081
15082 2008-12-23  Cary Coutant  <ccoutant@google.com>
15083
15084         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
15085         * plugin.cc (Plugin_manager::finish): Rename as
15086         layout_deferred_objects.  Move cleanup to separate function.
15087         (Plugin_manager::cleanup): New function.
15088         (Plugin_finish::run): Call layout_deferred_objects and cleanup
15089         separately.
15090         * plugin.h (Plugin_manager::finish): Rename as
15091         layout_deferred_objects.
15092         (Plugin_manager::cleanup): New function.
15093         (Plugin_manager::cleanup_done): New field.
15094
15095 2008-12-23  Cary Coutant  <ccoutant@google.com>
15096
15097         * plugin.cc (is_visible_from_outside): New function.
15098         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
15099         so we don't return "IR only" status for exported symbols or -r links.
15100
15101         * testsuite/Makefile.am (plugin_test_3): New test case.
15102         * testsuite/Makefile.in: Regenerate.
15103         * testsuite/plugin_test_3.sh: New file.
15104
15105 2008-12-22  Cary Coutant  <ccoutant@google.com>
15106
15107         * object.cc (Sized_relobj::layout_section): New function.
15108         (Sized_relobj::do_layout): Defer layout of input sections until after
15109         plugin has provided replacement files.
15110         (Sized_relobj::do_layout_deferred_sections): New function.
15111         * object.h (Relobj::set_section_offset): Remove virtual keyword.
15112         (Relobj::layout_deferred_sections): New function.
15113         (Relobj::do_layout_deferred_sections): New function.
15114         (Sized_relobj::do_layout_deferred_sections): New function.
15115         (Sized_relobj::layout_section): New function.
15116         (Sized_relobj::Deferred_layout): New structure.
15117         (Sized_relobj::deferred_layout_): New field.
15118         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
15119         Change all callers.  Layout deferred sections.
15120         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
15121         references.
15122         (Plugin_hook::run): Move code from do_plugin_hook inline.
15123         (Plugin_hook::do_plugin_hook): Remove.
15124         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
15125         (Plugin_manager::finish): Renamed, was cleanup.
15126         (Plugin_manager::should_defer_layout): New function.
15127         (Plugin_manager::add_deferred_layout_object): New function.
15128         (Plugin_manager::Deferred_layout_list): New type.
15129         (Plugin_manager::deferred_layout_objects_): New field.
15130         (Plugin_hook::do_plugin_hook): Remove.
15131
15132 2008-12-17  Ian Lance Taylor  <iant@google.com>
15133
15134         * options.h (class General_options): Add --no case for
15135         --export-dynamic.
15136
15137 2008-12-16  Cary Coutant  <ccoutant@google.com>
15138
15139         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
15140         vector.
15141         (Plugin_manager::claim_file): Create plugin object even if
15142         plugin did not call the add_symbols callback.
15143         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
15144         asking for more symbols than were added.
15145         * testsuite/Makefile.am (plugin_test_1): Add test case with
15146         no global symbols.
15147         (empty.syms): New target.
15148         * testsuite/Makefile.in: Regenerate.
15149         * testsuite/plugin_test.c (claim_file_hook): Add new debug
15150         message. Don't call add_symbols if no globals.
15151         (all_symbols_read_hook): Don't provide replacement for empty
15152         claimed file.
15153
15154 2008-12-12  Ian Lance Taylor  <iant@google.com>
15155
15156         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
15157         r_type == 0 for a local symbol with r_sym == 0.
15158         (scan_relocatable_relocs): Pass r_sym to
15159         local_non_section_strategy.
15160         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
15161         r_sym parameter.
15162
15163         * configure.ac: Update test for TLS descriptors: they are
15164         supported as of glibc 2.9.
15165         * configure: Rebuild.
15166
15167 2008-12-11  Ian Lance Taylor  <iant@google.com>
15168
15169         PR 7091
15170         * target-reloc.h (Default_scan_relocatable_relocs): For each
15171         function, map r_type == 0 to RELOC_DISCARD.
15172
15173 2008-12-10  Cary Coutant  <ccoutant@google.com>
15174
15175         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
15176         object to override a kept COMDAT group from a plugin object.
15177
15178 2008-12-09  Ian Lance Taylor  <iant@google.com>
15179
15180         PR 7088
15181         * yyscript.y (file_cmd): Handle INPUT.
15182
15183         * testsuite/initpri1.c: Change all declarations to be full
15184         prototypes by adding void, to avoid compiler warnings.
15185
15186 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
15187
15188         * options.cc (General_options::parse_plugin_opt): New.
15189         (General_options::add_plugin): The argument now is just the filename.
15190         (General_options::add_plugin_option): New.
15191         * options.h (plugin_opt): New.
15192         (add_plugin): Change argument name.
15193         (add_plugin_option): New.
15194         * plugin.cc (Plugin::load): Don't parse the plugin option.
15195         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
15196         (Plugin::add_option): New.
15197         (Plugin::args_): Change type.
15198         (Plugin::filename_): New.
15199         (Plugin_manager::add_plugin_option): New.
15200         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
15201         * testsuite/Makefile.in: Regenerate.
15202
15203 2008-12-05  Cary Coutant  <ccoutant@google.com>
15204
15205         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
15206         Handle --strip-lto-sections option.
15207         * options.h (strip_lto_sections): New option.
15208
15209 2008-12-01  Cary Coutant  <ccoutant@google.com>
15210
15211         * plugin.cc (ld_plugin_message): Change format parameter to const.
15212         Fix mismatch between new[] and delete.
15213
15214 2008-11-14  Cary Coutant  <ccoutant@google.com>
15215
15216         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
15217         instead of -1U.
15218
15219 2008-11-05  Craig Silverstein  <csilvers@google.com>
15220
15221         * options.cc (General_options::parse_dynamic_list): New function.
15222         * options.h (General_options): New flags dynamic_list,
15223         dynamic_list_data, dynamic_list_cpp_new, and
15224         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
15225         (General_options::in_dynamic_list): New function.
15226         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
15227         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
15228         (Lex::can_continue_name): Likewise.
15229         (yylex): Likewise.
15230         (read_script_file): New parameter script_options.
15231         (read_dynamic_list): New function.
15232         (Script_options::define_dynamic_list): New function.
15233         (dynamic_list_keyword_parsecodes): New variable.
15234         (dynamic_list_keywords): New variable.
15235         * script.h (Script_options::define_dynamic_list): New function
15236         prototype.
15237         (read_dynamic_list): New function prototype.
15238         * symtab.cc (strprefix): New macro.
15239         (Symbol::should_add_dynsym_entry): Support dynamic_list,
15240         dynamic_list_data, dynamic_list_cpp_new, and
15241         dynamic_list_cpp_typeinfo.
15242         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
15243         (dynamic_list_expr): New rule.
15244         (dynamic_list_nodes): Likewise.
15245         (dynamic_list_node): Likewise.
15246         * testsuite/Makefile.am (dynamic_list): New test.
15247         * testsuite/Makefile.in: Regenerated.
15248         * testsuite/dynamic_list.t: New file.
15249         * testsuite/dynamic_list.sh: New file.
15250
15251 2008-11-05  Craig Silverstein  <csilvers@google.com>
15252
15253         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
15254         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
15255         (t11_last): Likewise.
15256         * testsuite/ver_test_6.c (main): Likewise.
15257
15258 2008-10-07  Cary Coutant  <ccoutant@google.com>
15259
15260         * options.c (General_options::finalize): Add check for -static and
15261         -shared.
15262         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
15263         is not empty.
15264
15265 2008-10-02  Cary Coutant  <ccoutant@google.com>
15266
15267         * plugin.cc (make_sized_plugin_object): Fix conditional
15268         compilation to work when not all targets are enabled.
15269
15270 2008-09-29  Cary Coutant  <ccoutant@google.com>
15271
15272         * archive.cc (Archive::get_file_and_offset): Use filename instead
15273         of name to get library path.
15274         (Archive::include_member): Unlock external member of a thin archive.
15275
15276         * testsuite/Makefile.am (TEST_AR): New variable.
15277         (thin_archive_test_1): New test.
15278         (thin_archive_test_2): New test.
15279         * testsuite/Makefile.in: Regenerate.
15280         * testsuite/thin_archive_main.cc: New file.
15281         * testsuite/thin_archive_test_1.cc: New file.
15282         * testsuite/thin_archive_test_2.cc: New file.
15283         * testsuite/thin_archive_test_3.cc: New file.
15284         * testsuite/thin_archive_test_4.cc: New file.
15285
15286 2008-09-29  Cary Coutant  <ccoutant@google.com>
15287
15288         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
15289         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
15290         instead of -1U.
15291         (Sized_relobj::do_finalize_local_symbols): Likewise.
15292         (Sized_relobj::map_to_kept_section): Likewise.
15293         * object.h (Sized_relobj::invalid_address): New constant.
15294         (Sized_relobj::do_output_section_offset): Check for invalid_address
15295         and return -1ULL.
15296         * output.cc (Output_reloc::local_section_offset): Use constant
15297         invalid_address instead of -1U.
15298         (Output_reloc::get_address): Likewise.
15299         (Output_section::output_address): Change -1U to -1ULL.
15300         * output.h (Output_reloc::invalid_address): New constant.
15301         * reloc.cc (Sized_relobj::write_sections): Use constant
15302         invalid_address instead of -1U.
15303         (Sized_relobj::relocate_sections): Likewise.
15304         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
15305         values for merge sections.
15306         * target-reloc.h (relocate_for_relocatable): Use constant
15307         invalid_address instead of -1U.
15308
15309 2008-09-19  Cary Coutant  <ccoutant@google.com>
15310
15311         Add plugin functionality for link-time optimization (LTO).
15312         * configure.ac (plugins): Add --enable-plugins option.
15313         * configure: Regenerate.
15314         * config.in: Regenerate.
15315         * Makefile.am (LIBDL): New variable.
15316         (CCFILES): Add plugin.cc.
15317         (HFILES): Add plugin.h.
15318         (ldadd_var): Add LIBDL.
15319         * Makefile.in: Regenerate.
15320
15321         * archive.cc: Include "plugin.h".
15322         (Archive::setup): Don't preread archive symbols when using a plugin.
15323         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
15324         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
15325         files.
15326         (Archive::include_member): Add symbols from plugin objects.
15327         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
15328         * descriptors.cc (Descriptors::open): Check for file descriptors
15329         abandoned by plugins.
15330         (Descriptors::claim_for_plugin): New function.
15331         * descriptors.h (Descriptors::claim_for_plugin): New function.
15332         (Open_descriptor::is_claimed): New field.
15333         (claim_descriptor_for_plugin): New function.
15334         * fileread.cc (File_read::claim_for_plugin): New function.
15335         * fileread.h (File_read::claim_for_plugin): New function.
15336         (File_read::descriptor): New function.
15337         * gold.cc: Include "plugin.h".
15338         (queue_initial_tasks): Add task to call plugin hooks for generating
15339         new object files.
15340         * main.cc: Include "plugin.h".
15341         (main): Load plugin libraries.
15342         * object.h (Pluginobj): Declare.
15343         (Object::pluginobj): New function.
15344         (Object::do_pluginobj): New function.
15345         (Object::set_target): New function.
15346         * options.cc: Include "plugin.h".
15347         (General_options::parse_plugin): New function.
15348         (General_options::General_options): Initialize plugins_ field.
15349         (General_options::add_plugin): New function.
15350         * options.h (Plugin_manager): Declare.
15351         (General_options): Add --plugin option.
15352         (General_options::has_plugins): New function.
15353         (General_options::plugins): New function.
15354         (General_options::add_plugin): New function.
15355         (General_options::plugins_): New field.
15356         * plugin.cc: New file.
15357         * plugin.h: New file.
15358         * readsyms.cc: Include "plugin.h".
15359         (Read_symbols::do_read_symbols): Check for archive before checking
15360         for ELF file.  Call plugin hooks to claim files.
15361         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
15362         from a real object file; force override when processing replacement
15363         files.
15364         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
15365         (Symbol::init_base_object): Likewise.
15366         (Symbol::init_base_output_data): Likewise.
15367         (Symbol::init_base_output_segment): Likewise.
15368         (Symbol::init_base_constant): Likewise.
15369         (Symbol::init_base_undefined): Likewise.
15370         (Symbol::output_section): Assert that object is not a plugin.
15371         (Symbol_table::add_from_pluginobj): New function.
15372         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
15373         undefined.
15374         (Symbol_table::sized_write_globals): Likewise.
15375         (Symbol_table::add_from_pluginobj): Instantiate template.
15376         * symtab.h (Sized_pluginobj): Declare.
15377         (Symbol::in_real_elf): New function.
15378         (Symbol::set_in_real_elf): New function.
15379         (Symbol::in_real_elf_): New field.
15380         (Symbol_table::add_from_pluginobj): New function.
15381
15382         * testsuite/Makefile.am (AM_CFLAGS): New variable.
15383         (LIBDL): New variable.
15384         (LDADD): Add LIBDL.
15385         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
15386         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
15387         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
15388         (MOSTLYCLEANFILES): Likewise.
15389         * testsuite/Makefile.in: Regenerate.
15390         * testsuite/plugin_test.c: New file.
15391         * testsuite/plugin_test_1.sh: New file.
15392         * testsuite/plugin_test_2.sh: New file.
15393
15394 2008-09-16  Ian Lance Taylor  <iant@google.com>
15395
15396         * target-reloc.h (relocate_section): Check whether a symbol is
15397         defined by the ABI before reporting an undefined symbol error.
15398         * target.h (Target::is_defined_by_abi): Make parameter const.
15399         (Target::do_is_defined_by_abi): Likewise.
15400         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
15401         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
15402         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
15403         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
15404         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
15405         * testsuite/Makefile.in: Rebuild.
15406
15407         * fileread.cc (make_view): Add casts to avoid warning.
15408
15409 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15410
15411         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
15412         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15413
15414 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15415
15416         * options.h (General_options::output_is_executable): New.
15417         (General_options::output_is_pie): New.
15418         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
15419         for shared libraries.
15420         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15421
15422 2008-09-11  Chris Demetriou  <cgd@google.com>
15423
15424         * options.h (origin): New -z option.
15425         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
15426         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
15427         in DT_FLAGS_1.
15428
15429 2008-09-05  Cary Coutant  <ccoutant@google.com>
15430
15431         * fileread.cc (File_read::make_view): Add check for attempt to map
15432         beyond end of file.
15433
15434 2008-09-05  Cary Coutant  <ccoutant@google.com>
15435
15436         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
15437         explicit instantiations.
15438
15439 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
15440
15441         PR gold/6858
15442         * options.cc (General_options::finalize): Allow undefined symbols
15443         in shlibs if linking -shared.
15444
15445         PR gold/6859
15446         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
15447         symbols as not needing a dynsym entry.
15448
15449 2008-08-20  Craig Silverstein  <csilvers@google.com>
15450
15451         * fileread.cc (File_read::open): Do not lock the file unless it
15452         was successfully opened.
15453
15454 2008-08-14  Cary Coutant  <ccoutant@google.com>
15455
15456         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
15457         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
15458         * testsuite/tls_test.cc (struct int128): 128-bit struct
15459         for testing TLS relocs with non-zero addend.
15460         (v12): New TLS variable.
15461         (t12): New test.
15462         (t_last): Add check for v12.
15463         * testsuite/tls_test.h (t12): New function.
15464         * testsuite/tls_test_main.cc (thread_routine): Call new test.
15465
15466 2008-08-13  Ian Lance Taylor  <iant@google.com>
15467
15468         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
15469         set tls_segment_ or relro_segment_.
15470         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
15471         when appropriate.
15472         * output.h (Output_section::clear_is_relro): New function.
15473         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
15474         sections specially even when output_data_ is empty.
15475         (Output_segment::maximum_alignment): When first section is relro,
15476         only force alignment for PT_LOAD segments.
15477         * script.cc (script_data_segment_align): New function.
15478         (script_data_segment_relro_end): New function.
15479         * script-c.h (script_data_segment_align): Declare.
15480         (script_data_segment_relro_end): Declare.
15481         * script-sections.h (class Script_sections): Declare
15482         data_segment_align and data_segment_relro_end.  Add fields
15483         segment_align_index_ and saw_relro_end_.
15484         * script-sections.cc (class Sections_element): Add set_is_relro
15485         virtual function.  Add new bool* parameter to place_orphan_here.
15486         Add get_output_section virtual function.
15487         (class Output_section_definition): Add set_is_relro.  Add new
15488         bool* parameter to place_orphan_here.  Add get_output_section.
15489         Add is_relro_ field.
15490         (Output_section_definition::Output_section_definition): Initialize
15491         evaluated_address_, evaluated_load_address, evaluated_addralign_,
15492         and is_relro_ fields.
15493         (Output_section_definition::place_orphan_here): Add is_relro
15494         parameter.
15495         (Output_section_definition::set_section_addresses): Set relro for
15496         output section.
15497         (Output_section_definition::alternate_constraint): Likewise.
15498         (class Orphan_output_section): Add new bool* parameter to
15499         place_orphan_here.  Add get_output_section.
15500         (Orphan_output_section::place_orphan_here): Add is_relro
15501         parameter.
15502         (Script_sections::Script_sections): Initialize
15503         data_segment_align_index_ and saw_relro_end_.
15504         (Script_sections::data_segment_align): New function.
15505         (Script_sections::data_segment_relro_end): New function.
15506         (Script_sections::place_orphan): Set or clear is_relro.
15507         (Script_sections::set_section_addresses): Force alignment of first
15508         TLS section.
15509         * yyscript.y (exp): Call script_data_segment_align and
15510         script_data_segment_relro_end.
15511         * testsuite/relro_script_test.t: New file.
15512         * testsuite/relro_test.cc (using_script): Declare.
15513         (t1, t2): Test using_script.
15514         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
15515         (relro_script_test_SOURCES): Define.
15516         (relro_script_test_DEPENDENCIES): Define.
15517         (relro_script_test_LDFLAGS): Define.
15518         (relro_script_test_LDADD): Define.
15519         (relro_script_test.so): New target.
15520         * testsuite/Makefile.in: Rebuild.
15521
15522 2008-08-06  Cary Coutant <ccoutant@google.com>
15523
15524         * archive.cc (Archive::total_archives, Archive::total_members)
15525         (Archive::total_members_loaded): New variables.
15526         (Archive::setup): Add parameter.  Add option to preread
15527         archive symbols.
15528         (Archive::read_armap): Add counter.
15529         (Archive::get_file_and_offset): New function.
15530         (Archive::get_elf_object_for_member): New function.
15531         (Archive::read_all_symbols): New function.
15532         (Archive::read_symbols): New function.
15533         (Archive::add_symbols): Add counters.
15534         (Archive::include_all_members): Use armap to find members if it's
15535         already built.
15536         (Archive::include_member): Skip reading symbols if already read.
15537         Factored code into Archive::get_file_and_offset and
15538         Archive::get_elf_object_for_member.  Changed call to
15539         Mapfile::report_include_archive_member.
15540         (Archive::print_stats): New function.
15541         * archive.h: Declare Object and Read_symbols_data classes.
15542         (Archive::Archive): Add initializers for new members.
15543         (Archive::setup): Add parameter.
15544         (Archive::print_stats): New function.
15545         (Archive::total_archives, Archive::total_members)
15546         (Archive::total_members_loaded): New variables.
15547         (Archive::get_file_and_offset): New function.
15548         (Archive::get_elf_object_for_member): New function.
15549         (Archive::read_all_symbols): New function.
15550         (Archive::read_symbols): New function.
15551         (Archive::Archive_member): New class.
15552         (Archive::members_): New member.
15553         (Archive::num_members_): New member.
15554         * main.cc: Include archive.h.
15555         (main): Call Archive::print_stats.
15556         * mapfile.cc (Mapfile::report_include_archive_member): Delete
15557         archive parameter; member_name is now the fully-decorated name.
15558         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
15559         * options.h: (General_options): Add --preread-archive-symbols option.
15560         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
15561         Archive::setup.
15562
15563 2008-08-04  Ian Lance Taylor  <iant@google.com>
15564
15565         * symtab.h (Symbol::use_plt_offset): New function.
15566         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
15567         * powerpc.cc (Relocate::relocate): Likewise.
15568         * sparc.cc (Relocate::relocate): Likewise.
15569         * x86_64.cc (Relocate::relocate): Likewise.
15570         * testsuite/weak_plt.sh: New test.
15571         * testsuite/weak_plt_main.cc: New test.
15572         * testsuite/weak_plt_shared.cc: New test.
15573         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
15574         (check_PROGRAMS): Add weak_plt.
15575         (check_DATA): Add weak_plt_shared.so.
15576         (weak_plt_main_pic.o, weak_plt): New targets.
15577         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
15578         * testsuite/Makefile.in: Rebuild.
15579
15580         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
15581         gcctestdir/ld.
15582         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
15583         * testsuite/Makefile.in: Rebuild.
15584
15585 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
15586
15587         * Makefile.am (POTFILES.in): Set LC_ALL=C.
15588         * Makefile.in: Regenerate.
15589         * po/POTFILES.in: Regenerate.
15590
15591 2008-07-29  Ian Lance Taylor  <iant@google.com>
15592
15593         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
15594         symbols before other symbols.
15595         * testsuite/script_test_2.cc (test_addr): Declare.
15596         (test_addr_alias): Declare.
15597         (main): Check that test_addr and test_addr_alias have the right
15598         values.
15599         * testsuite/script_test_2.t: Define test_addr_alias and
15600         test_addr.
15601
15602 2008-07-24  Ian Lance Taylor  <iant@google.com>
15603
15604         PR 5990
15605         * descriptors.cc: New file.
15606         * descriptors.h: New file.
15607         * gold-threads.h (class Hold_optional_lock): New class.
15608         * fileread.cc: Include "descriptors.h".
15609         (File_read::~File_read): Release descriptor rather than closing
15610         it.
15611         (File_read::open) [file]: Call open_descriptor rather than open.
15612         Set is_descriptor_opened_.
15613         (File_read::open) [memory]: Assert that descriptor is not open.
15614         (File_read::reopen_descriptor): New function.
15615         (File_read::release): Release descriptor.
15616         (File_read::do_read): Make non-const.  Reopen descriptor.
15617         (File_read::read): Make non-const.
15618         (File_read::make_view): Reopen descriptor.
15619         (File_read::do_readv): Likewise.
15620         * fileread.h (class File_read): Add is_descriptor_opened_ field.
15621         Update declarations.
15622         * layout.cc: Include "descriptors.h".
15623         (Layout::create_build_id): Use open_descriptor rather than open.
15624         * output.cc: Include "descriptors.h".
15625         (Output_file::open): Use open_descriptor rather than open.
15626         * archive.cc (Archive::const_iterator): Change Archive to be
15627         non-const.
15628         (Archive::begin, Archive::end): Make non-const.
15629         (Archive::count_members): Likewise.
15630         * archive.h (class Archive): Update declarations.
15631         * object.h (Object::read): Make non-const.
15632         * Makefile.am (CCFILES): Add descriptors.cc.
15633         (HFILES): Add descriptors.h.
15634         * Makefile.in: Rebuild.
15635
15636         PR 6716
15637         * gold.h: Always include <clocale>.  Add Solaris workarounds
15638         following code in binutils/sysdep.h.
15639
15640         PR 6048
15641         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
15642         this->eh_frame_hdr_ is NULL before using it.
15643
15644         * dynobj.cc (Versions::Versions): Update comment.
15645
15646         * dynobj.cc (Versions::Versions): If there is an soname, use it as
15647         the base version name.
15648
15649         * stringpool.cc (Stringpool_template::add_with_length): Set key to
15650         array size plus one.
15651         (Stringpool_template::set_string_offsets): Subtract one from key
15652         before using it as an array index.
15653         (Stringpool_template::get_offset_with_length): Likewise.
15654         (Stringpool_template::write_to_buffer): Likewise.
15655         * stringpool.h (Stringpool_template::get_offset_from_key):
15656         Likewise.
15657
15658 2008-07-23  Ian Lance Taylor  <iant@google.com>
15659
15660         PR 6658
15661         * object.h (Merged_symbol_value::value): Do our best to handle a
15662         negative addend.
15663
15664         PR 6647
15665         * script.cc (Version_script_info::get_versions): Don't add empty
15666         version tag to return value.
15667         (Version_script_info::get_symbol_version_helper): Change return
15668         type to bool.  Add pversion parameter.  Change all callers.
15669         (script_register_vers_node): Don't require a non-NULL tag.
15670         * script.h (class Version_script_info): Update declarations.
15671         (Version_script_info::get_symbol_version): Change return type to
15672         bool.  Add version parameter.  Change all callers.
15673         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
15674         handling.  Handle an empty version from a version script.
15675         (Symbol_table::define_special_symbol): Likewise.
15676         * testsuite/ver_test_10.script: New file.
15677         * testsuite/ver_test_10.sh: New file.
15678         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
15679         (check_DATA): Add ver_test_10.syms.
15680         (ver_test_10.syms, ver_test_10.so): New target.
15681         * testsuite/Makefile.in: Rebuild.
15682
15683 2008-07-23  Simon Baldwin  <simonb@google.com>
15684
15685         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
15686         to zero for undefined symbols from dynamic libraries.
15687
15688 2008-07-23  Ian Lance Taylor  <iant@google.com>
15689
15690         * symtab.cc (Symbol_table::resolve): Remove version parameter.
15691         Change all callers.
15692         * symtab.h (class Symbol_table): Update declaration.
15693         * testsuite/ver_test_9.cc: New file.
15694         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
15695         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
15696         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
15697         (ver_test_9.so, ver_test_9.o): New targets.
15698         * testsuite/Makefile.in: Rebuild.
15699
15700 2008-07-22  Ian Lance Taylor  <iant@google.com>
15701
15702         * options.h (class General_options): Define --check-sections.
15703         * layout.cc (Layout::set_segment_offsets): Handle
15704         --check-sections.
15705
15706         * options.h (class General_options): Define -n/--nmagic and
15707         -N/--omagic.
15708         * options.cc (General_options::finalize): For -n/--nmagic or
15709         -N/--omagic, set -static.
15710         * layout.cc (Layout::attach_allocated_section_to_segment): If
15711         -N/--omagic, don't put read-only and read-write sections in
15712         different segments.
15713         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
15714         finding a read-only segment.
15715         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
15716         don't set the minimum segment alignment to the common page size,
15717         and don't set the file offset to the address modulo the page size.
15718         * script-sections.cc (Script_sections::create_segments): If
15719         -n/--omagic, don't put read-only and read-write sections in
15720         different segments.
15721
15722         * cref.cc: New file.
15723         * cref.h: New file.
15724         * options.h (class General_options): Add --print-symbol-counts.
15725         * main.cc (main): Issue defined symbol report if requested.
15726         * archive.cc (Archive::interpret_header): Make into a const member
15727         function.
15728         (Archive::add_symbols): Call Input_objects::archive_start and
15729         archive_stop.
15730         (Archive::const_iterator): Define new class.
15731         (Archive::begin, Archive::end): New functions.
15732         (Archive::include_all_members): Rewrite to use iterator.
15733         (Archive::count_members): New function.
15734         * archive.h (class Archive): Update declarations.
15735         (Archive::filename): New function.
15736         * object.cc: Include "cref.h".
15737         (Sized_relobj::Sized_relobj): Initialize defined_count_.
15738         (Sized_relobj::do_get_global_symbol_counts): New function.
15739         (Input_objects::add_object): Add object to cross-referencer.
15740         (Input_objects::archive_start): New function.
15741         (Input_objects::archive_stop): New function.
15742         (Input_objects::print_symbol_counts): New function.
15743         * object.h: Declare Cref and Archive.
15744         (Object::get_global_symbol_counts): New function.
15745         (Object::do_get_global_symbol_counts): New pure virtual function.
15746         (class Sized_relobj): Add defined_count_ field.  Update
15747         declarations.
15748         (class Input_objects): Add cref_ field.  Update constructor.
15749         Update declarations.
15750         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
15751         defined_count_.
15752         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
15753         symbol counts.
15754         (Sized_dynobj::do_get_global_symbol_counts): New function.
15755         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
15756         defined_count_.  Update declarations.  Define Symbols typedef.
15757         * symtab.cc (Symbol_table::add_from_relobj): Add defined
15758         parameter.  Change all callers.
15759         (Symbol_table::add_from_dynobj): Add sympointers and defined
15760         parameters.  Change all callers.
15761         * symtab.h (class Symbol_table): Update declarations.
15762         * Makefile.am (CCFILES): Add cref.cc.
15763         (HFILES): Add cref.h.
15764         * Makefile.in: Rebuild.
15765
15766 2008-07-22  Simon Baldwin  <simonb@google.com>
15767
15768         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
15769         to zero when writing undefined symbols.
15770
15771 2008-07-22  Ian Lance Taylor  <iant@google.com>
15772
15773         * output.cc (Output_section::add_input_section): Don't try to
15774         merge empty merge sections.
15775
15776 2008-07-21  Craig Silverstein  <csilvers@google.com>
15777
15778         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15779         Include symbol version in error message.
15780
15781 2008-07-20  Chris Demetriou  <cgd@google.com>
15782
15783         * configure.ac (gold_cv_c_random_seed): New configured variable.
15784         (RANDOM_SEED_CFLAGS): New substituted variable.
15785         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
15786         * configure: Rebuild.
15787         * Makefile.in: Likewise.
15788         * testsuite/Makefile.in: Likewise.
15789
15790 2008-07-18  Ian Lance Taylor  <iant@google.com>
15791
15792         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
15793         where we see NAME/NULL and NAME/VERSION  as separate symbols.
15794         * testsuite/ver_test_main.cc (main): Call t4.
15795         (t4, t4_2a): Define.
15796         * testsuite/ver_test_2.cc (t4_2): Define.
15797         * testsuite/ver_test_2.script: Put t4_2a in VER2.
15798         * testsuite/ver_test_4.cc (t4_2a): Define.
15799         * testsuite/ver_test_4.script: Put t4_2a in VER2.
15800         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
15801
15802 2008-07-17  Ian Lance Taylor  <iant@google.com>
15803
15804         * dynobj.cc (Versions::add_def): If we give an error about a
15805         missing version, go ahead and create the version anyhow.
15806
15807 2008-07-10  Ian Lance Taylor  <iant@google.com>
15808
15809         Handle output sections with more than 0x7fffffff bytes.
15810         * object.h (class Relobj): Change map_to_output_ to
15811         output_sections_, and just keep a section pointer.  Change all
15812         uses.  Move comdat group support to Sized_relobj.
15813         (Relobj::is_section_specially_mapped): Remove.
15814         (Relobj::output_section): Remove poff parameter.  Change all
15815         callers.
15816         (Relobj::output_section_offset): New function.
15817         (Relobj::set_section_offset): Rewrite.
15818         (Relobj::map_to_output): Remove.
15819         (Relobj::output_sections): New function.
15820         (Relobj::do_output_section_offset): New pure virtual function.
15821         (Relobj::do_set_section_offset): Likewise.
15822         (class Sized_relobj): Add section_offsets_ field.  Add comdat
15823         group support from Relobj.  Update declarations.
15824         (Sized_relobj::get_output_section_offset): New function.
15825         (Sized_relobj::do_output_section_offset): New function.
15826         (Sized_relobj::do_set_section_offset): New function.
15827         * object.cc (Relobj::output_section_address): Remove.
15828         (Sized_relobj::Sized_relobj): Initialize new fields.
15829         (Sized_relobj::include_section_group): Cast find_kept_object to
15830         Sized_relobj.
15831         (Sized_relobj::include_linkonce_section): Likewise.
15832         (Sized_relobj::do_layout): Use separate arrays for output section
15833         and output offset.
15834         (Sized_relobj::do_count_local_symbols): Change map_to_output to
15835         output_sections.
15836         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
15837         output_sections and section_offsets.
15838         (Sized_relobj::write_local_symbols): Likewise.
15839         (map_to_kept_section): Compute output address directly.
15840         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
15841         output_sections and section_offsets.
15842         (Sized_relobj::write_sections): Likewise.
15843         (Sized_relobj::relocate_sections): Likewise.
15844         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
15845         * output.h (class Output_reloc): Update declarations.  Change
15846         u2_.relobj to Sized_relobj*.
15847         (class Output_data_reloc): Change add functions to use
15848         Sized_relobj*.
15849         * output.cc (Output_reloc::Output_reloc): Change relobj to
15850         Sized_relobj*.
15851         (Output_reloc::local_section_offset): Change return type to
15852         Elf_Addr.  Use get_output_section_offset.
15853         (Output_reloc::get_address): Likewise.
15854         (Output_section::is_input_address_mapped): Don't call
15855         is_section_specially_mapped.
15856         (Output_section::output_offset): Likewise.
15857         (Output_section::output_address): Likewise.
15858         (Output_section::starting_output_address): Likewise.
15859         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
15860         parameter to Sized_relobj*.
15861         (Copy_relocs::need_copy_reloc): Likewise.
15862         (Copy_relocs::save): Likewise.
15863         * copy-relocs.h (class Copy_relocs): Update declarations.
15864         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
15865         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
15866         * target-reloc.h (relocate_for_relocatable): Change
15867         offset_in_output_section type to Elf_Addr.  Change code that uses
15868         it as well.
15869         * layout.cc (Layout::layout): Always set *off.
15870         * mapfile.cc (Mapfile::print_input_section): Use
15871         output_section_offset.
15872         * i386.cc (Target_i386::copy_reloc): Change object parameter to
15873         Sized_relobj*.
15874         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
15875         * sparc.cc (Target_sparc::copy_reloc): Likewise.
15876         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
15877
15878 2008-07-03  Ian Lance Taylor  <iant@google.com>
15879
15880         * layout.cc (Layout::include_section): Do not discard unrecognized
15881         SHT_STRTAB sections.
15882
15883 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
15884
15885         * script.cc (Lex::can_continue_name): Make '?' allowable in
15886         version-script names.
15887         * testsuite/version_script.map: Change glob pattern to use '?'
15888
15889 2008-06-30  Manish Singh  <yosh@gimp.org>
15890
15891         PR 6585
15892         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
15893         Correct typo.
15894
15895 2008-06-30  Ian Lance Taylor  <iant@google.com>
15896
15897         PR 6660
15898         PR 6682
15899         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
15900         versions]: Don't try to read the value in the contents, since we
15901         don't use it.  Use the template endianness when writing.
15902
15903 2008-06-25  Cary Coutant  <ccoutant@google.com>
15904
15905         * fileread.cc (File_read::make_view): Assert on zero-length view.
15906         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
15907         symbol table when there are no symbols to read.
15908
15909 2008-06-23  Craig Silverstein  <csilvers@google.com>
15910
15911         * version.cc (version_string): Bump to 1.7
15912
15913 2008-06-18  Craig Silverstein  <csilvers@google.com>
15914
15915         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
15916         constant 0xFFFF to type Valtype.
15917         (Powerpc_relocate_functions::rel16_ha): Likewise.
15918
15919 2008-06-17  Ian Lance Taylor  <iant@google.com>
15920
15921         * output.h (Output_section::Input_section): Initialize p2align_ to
15922         zero for Output_section_data constructors.
15923         (Output_section::Input_section::addralign): If not an input
15924         section, return the alignment of the Output_section_data.
15925         * testsuite/copy_test.cc: New file.
15926         * testsuite/copy_test_1.cc: New file.
15927         * testsuite/copy_test_2.cc: New file.
15928         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
15929         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
15930         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
15931         (copy_test_1_pic.o, copy_test_1.so): New targets.
15932         (copy_test_2_pic.o, copy_test_2.so): New targets.
15933         * testsuite/Makefile.in: Rebuild.
15934
15935         * script-sections.cc (Script_sections::place_orphan): Initialize
15936         local variable exact.
15937
15938 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
15939
15940         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
15941
15942 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
15943             David S. Miller  <davem@davemloft.net>
15944
15945         * powerpc.cc: New file.
15946         * Makefile.am (TARGETSOURCES): Add powerpc.cc
15947         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
15948         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
15949         * Makefile.in: Rebuild.
15950
15951 2008-06-09  Ian Lance Taylor  <iant@google.com>
15952
15953         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
15954         <exception>.
15955         (throwing, orig_terminate): New static variables.
15956         (terminate_handler): New static function.
15957         (t2): Set terminate handler.
15958
15959 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
15960
15961         PR 6584
15962         * binary.cc (Binary_to_elf::sized_convert): Fix .data
15963         alignment.
15964
15965 2008-05-30  Cary Coutant  <ccoutant@google.com>
15966
15967         * archive.cc (Archive::include_all_members) Correct to step
15968         over symbol table and extended name table in thin archives.
15969
15970 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
15971
15972         PR 6407
15973         * target-reloc.h (relocate_for_relocatable): Fix new_offset
15974         calculation.
15975
15976 2008-05-28  Caleb Howe  <cshowe@google.com>
15977
15978         * reduced_debug_output.cc: New file.
15979         * reduced_debug_output.h: New file.
15980         * options.h (class General_options): Add --strip-debug-non-line.
15981         * options.cc (General_options::finalize): Add strip_debug_non_line
15982         to the strip heirarchy.
15983         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
15984         fields.
15985         * layout.cc: Include "reduced_debug_output.h".
15986         (Layout::Layout): Initialize new fields.
15987         (line_only_debug_sections): New static array.
15988         (is_lines_only_debug_sections): New static inline function.
15989         (Layout::include_section): Handle --strip-debug-non-line.
15990         (Layout::make_output_section): If --strip-debug-non-line, build
15991         new output sections for .debug_abbrev and .debug_info.
15992         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
15993         gold.  Warn about possible overflow.
15994         (read_signed_LEB_128): Likewise.
15995         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
15996         (read_signed_LEB_128): Declare.
15997         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
15998         (HFILES): Add reduced_debug_output.h.
15999         * Makefile.in: Rebuild.
16000
16001 2008-05-21  Ian Lance Taylor  <iant@google.com>
16002
16003         * mapfile.cc: New file.
16004         * mapfile.h: New file.
16005         * options.h (class General_options): Add -M/--print-map and -Map.
16006         * options.cc (General_options::finalize): Make -M equivalent to
16007         -Map -.
16008         * main.cc: Include <cstdio> and "mapfile.h".
16009         (main): Open mapfile if requested.
16010         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
16011         constructor.  Change caller.
16012         (queue_initial_tasks): Add mapfile parameter.  Change caller.
16013         (queue_middle_tasks): Likewise.
16014         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
16015         declarations.
16016         * archive.cc: Include "mapfile.h".
16017         (Archive::add_symbols): Add mapfile parameter.  Change all
16018         callers.  Pass mapfile, symbol, and reason to include_member.
16019         (Archive::include_all_members): Add mapfile parameter.  Change all
16020         callers.
16021         (Archive::include_member): Add mapfile, sym, and why parameters.
16022         Change all callers.  Report inclusion to map file.
16023         * archive.h: Include "fileread.h".
16024         (class Archive): Update declarations.
16025         (Archive::file): New const method.
16026         (class Add_archive_symbols): Add mapfile_ field.  Update
16027         constructor.  Change all callers.
16028         * readsyms.h (class Read_symbols): Likewise.
16029         (class Finish_group): Likewise.
16030         (class Read_script): Likewise.
16031         * common.cc: Include "mapfile.h".
16032         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
16033         all callers.
16034         (Symbol_table::do_allocate_commons): Likewise.
16035         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
16036         symbol allocation to mapfile.
16037         * common.h (class Allocate_commons_task): Add mapfile_ field.
16038         Update constructor.  Change all callers.
16039         * symtab.h (class Symbol_table): Update declarations.
16040         * layout.cc: Include "mapfile.h".
16041         (Layout_task_runner::run): Print information to mapfile.
16042         (Layout::create_gold_note): Change Output_data_fixed_space to
16043         Output_data_zero_fill.
16044         (Layout::create_build_id): Likewise.
16045         (Layout::print_to_mapfile): New function.
16046         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
16047         constructor.  Change caller.
16048         (class Layout): Declare print_to_mapfile.
16049         * output.cc (Output_section::Input_section::print_to_mapfile): New
16050         function.
16051         (Output_section::add_input_section): If producing a map, always
16052         add to input_sections_ list.
16053         (Output_section::do_print_to_mapfile): New function.
16054         (Output_segment::print_sections_to_mapfile): New function.
16055         (Output_segment::print_section_list_to_mapfile): New function.
16056         * output.h: Include "mapfile.h".
16057         (Output_data::print_to_mapfile): New function.
16058         (Output_data::do_print_to_mapfile): New virtual function.
16059         (Output_segment_headers::do_print_to_mapfile): New function.
16060         (Output_file_header::do_print_to_mapfile): New function.
16061         (Output_data_const::do_print_to_mapfile): New function.
16062         (class Output_data_const_buffer): Add map_name_ field.  Update
16063         constructor.  Change all callers.  Add do_print_to_mapfile
16064         function.
16065         (class Output_data_fixed_space): Likewise.
16066         (class Output_data_space): Likewise.
16067         (class Output_data_zero_fill): New class.
16068         (Output_data_strtab::do_print_to_mapfile): New function.
16069         (Output_data_reloc_base::do_print_to_mapfile): New function.
16070         (Output_relocatable_relocs::do_print_to_mapfile): New function.
16071         (Output_data_group::do_print_to_mapfile): New function.
16072         (Output_data_got::do_print_to_mapfile): New function.
16073         (Output_data_dynamic::do_print_to_mapfile): New function.
16074         (Output_symtab_xindex::do_print_to_mapfile): New function.
16075         (class Output_section): Declare do_print_to_mapflie.  Declare
16076         print_to_mapfile in Input_section.
16077         (class Output_segment): Declare new functions.
16078         * object.h (Sized_relobj::symbol_count): New function.
16079         * script-sections.cc
16080         (Output_section_element_dot_assignment::set_section_addresses):
16081         Change Output_data_fixed_space to Output_data_zero_fill.
16082         (Output_data_expression::do_print_to_mapfile): New function.
16083         * script.cc (read_input_script): Add mapfile parameter.  Change
16084         all callers.
16085         * script.h (read_input_script): Update declaration.
16086         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
16087         (Eh_frame::do_print_to_mapfile): New function.
16088         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
16089         (Output_merge_string::do_print_to_mapfile): New function.
16090         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
16091         function.
16092         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
16093         function.
16094         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
16095         function.
16096         * Makefile.am (CCFILES): Add mapfile.cc.
16097         (HFILES): Add mapfile.h.
16098         * Makefile.in: Rebuild.
16099
16100 2008-05-19  Ian Lance Taylor  <iant@google.com>
16101
16102         * options.h (class General_options): Add -z relro.
16103         * layout.cc (Layout::Layout): Initialize relro_segment_.
16104         (Layout::add_output_section_data): Return the output section.
16105         (Layout::make_output_section): Rcognize relro sections and mark
16106         them appropriately.
16107         (Layout::attach_allocated_section_to_segment): Put relro sections
16108         in a PT_GNU_RELRO segment.
16109         (Layout::create_initial_dynamic_sections): Mark the .dynamic
16110         section as relro.
16111         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
16112         PT_TLS segments.
16113         (Layout::linkonce_mapping): Map d.rel.ro.local to
16114         .data.rel.ro.local.
16115         (Layout::output_section_name): Us .data.rel.ro.local for any
16116         section which begins with that.
16117         * layout.h (class Layout): Update add_output_section_data
16118         declaration.  Add relro_segment_ field.
16119         * output.cc (Output_section::Output_section): Initialize is_relro_
16120         and is_relro_local_ fields.
16121         (Output_segment::add_output_section): Group relro sections.
16122         (Output_segment::is_first_section_relro): New function.
16123         (Output_segment::maximum_alignment): If there is a relro section,
16124         align the segment to the common page size.
16125         (Output_segment::set_section_addresses): Track whether we are
16126         looking at relro sections.  If the last section is a relro
16127         section, align to the common page size.
16128         (Output_segment::set_section_list_addresses): Add in_relro
16129         parameter.  Change all callers.  Align to the page size when
16130         moving from relro to non-relro section.
16131         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
16132         segment.
16133         * output.h (class Output_section): Add is_relro_ and
16134         is_relro_local_ fields.
16135         (Output_section::is_relro): New function.
16136         (Output_section::set_is_relro): New function.
16137         (Output_section::is_relro_local): New function.
16138         (Output_section::set_is_relro_local): New function.
16139         (class Output_segment): Update declarations.
16140         * i386.cc (Target_i386::got_section): Mark .got section as relro.
16141         * sparc.cc (Target_sparc::got_section): Likewise.
16142         * x86_64.cc (Target_x86_64::got_section): Likewise.
16143         * testsuite/relro_test_main.cc: New file.
16144         * testsuite/relro_test.cc: New file.
16145         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
16146         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
16147         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
16148         (relro_test.so, relro_test_pic.o): New targets.
16149         * testsuite/Makefile.in: Rebuild.
16150
16151 2008-05-16  Ian Lance Taylor  <iant@google.com>
16152
16153         * output.cc (Output_segment::add_output_section): Remove front
16154         parameter.
16155         * output.h (class Output_segment): Remove
16156         add_initial_output_section and overloaded add_output_section.
16157         Update declaration of remaining add_output_section.
16158         * layout.cc (Layout::create_interp): Call add_output_section
16159         rather than add_initial_output_section.
16160         (Layout::finish_dynamic_section): Likewise.
16161
16162         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
16163         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
16164         know the dynamic type.
16165         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
16166         field.  Initialize it in constructor.
16167         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
16168         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
16169         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
16170         reloc.
16171
16172         * output.cc (Output_reloc::get_address): Change return type to
16173         Elf_Addr.
16174         * output.h (class Output_reloc): Update get_address declaration.
16175         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
16176         for section addresses.
16177
16178 2008-05-09  Ian Lance Taylor  <iant@google.com>
16179
16180         PR 6493
16181         * gold.cc (gold_nomem): Use return value of write.
16182
16183 2008-05-08  Ian Lance Taylor  <iant@google.com>
16184
16185         * symtab.c (Symbol::init_base_output_data): Add version
16186         parameter.  Change all callers.
16187         (Symbol::init_base_output_segment): Likewise.
16188         (Symbol::init_base_constant): Likewise.
16189         (Symbol::init_base_undefined): Likewise.
16190         (Sized_symbol::init_output_data): Likewise.
16191         (Sized_symbol::init_output_segment): Likewise.
16192         (Sized_symbol::init_constant): Likewise.
16193         (Sized_symbol::init_undefined): Likewise.
16194         (Symbol_table::do_define_in_output_data): If the new symbol has a
16195         version, mark it as the default.
16196         (Symbol_table::do_define_in_output_segment): Likewise.
16197         (Symbol_table::do_define_as_constant): Likewise.
16198         * symtab.h (class Symbol): Update declarations.
16199         (class Sized_symbol): Likewise.
16200         * resolve.cc (Symbol::override_version): New function.
16201         (Symbol::override_base): Call override_version.
16202         (Symbol::override_base_with_special): Likewise.
16203         * testsuite/ver_script_8.script: New file.
16204         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
16205         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
16206         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
16207         (ver_test_8_1.so, ver_test_8_2.so): New targets.
16208
16209 2008-05-06  Ian Lance Taylor  <iant@google.com>
16210
16211         PR 6049
16212         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
16213         functions.
16214         (class General_options): Remove existing --undefined, and add
16215         --no-undefined instead.  Add new --undefined as synonym for -u.
16216         * archive.cc (Archive::add_symbols): Check whether symbol was
16217         named with -u.
16218         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
16219         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
16220         all uses.  Add IS_UNDEFINED.  Update declarations to split
16221         different versions of init_base.  Declare init_base_undefined.
16222         (Symbol::is_defined): Handle IS_UNDEFINED.
16223         (Symbol::is_undefined): Likewise.
16224         (Symbol::is_weak_undefined): Call is_undefined.
16225         (Symbol::is_absolute): Handle IS_CONSTANT.
16226         (class Sized_symbol): Update declarations to split different
16227         versions of init.  Declare init_undefined.
16228         (class Symbol_table): Declare new functions.
16229         * symtab.cc (Symbol::init_base_object): Rename from init_base.
16230         Change all callers.
16231         (Symbol::init_base_output_data): Likewise.
16232         (Symbol::init_base_output_segment): Likewise.
16233         (Symbol::init_base_constant): Likewise.
16234         (Symbol::init_base_undefined): New function.
16235         (Sized_symbol::init_object): Rename from init.  Change all
16236         callers.
16237         (Sized_symbol::init_output_data): Likewise.
16238         (Sized_symbol::init_output_segment): Likewise.
16239         (Sized_symbol::init_constant): Likewise.
16240         (Sized_symbol::init_undefined): New function.
16241         (Symbol_table::add_undefined_symbols_from_command_line): New
16242         function.
16243         (Symbol_table::do_add_undefined_symbols_from_command_line): New
16244         function.
16245         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
16246         (Symbol::output_section): Likewise.
16247         (Symbol::set_output_section): Likewise.
16248         (Symbol_table::sized_finalize_symbol): Likewise.
16249         (Symbol_table::sized_write_globals): Likewise.
16250         * resolve.cc (Symbol_table::should_override): Likewise.
16251         (Symbol::override_base_with_special): Likewise.
16252
16253         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
16254         symbol, change it to have default visibility.
16255         * testsuite/protected_1.cc: New file.
16256         * testsuite/protected_2.cc: New file.
16257         * testsuite/protected_3.cc: New file.
16258         * testsuite/protected_main_1.cc: New file.
16259         * testsuite/protected_main_2.cc: New file.
16260         * testsuite/protected_main_3.cc: New file.
16261         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
16262         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
16263         (protected_1_LDFLAGS, protected_1_LDADD): Define.
16264         (protected_1.so): New target.
16265         (protected_1_pic.o, protected_2_pic.o): New targets.
16266         (protected_3_pic.o): New target.
16267         (check_PROGRAMS): Add protected_2.
16268         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
16269         (protected_2_LDFLAGS, protected_2_LDADD): Define.
16270         * testsuite/Makefile.in: Rebuild.
16271
16272         * options.h (DEFINE_var): Add set_user_set_##varname__.
16273         (DEFINE_bool_alias): New macro.
16274         (class General_options): Define -Bstatic using DEFINE_bool_alias
16275         rather than DEFINE_special.  Add --undefined as an alias for -z
16276         defs.
16277         * options.cc (General_options::parse_Bstatic): Remove.
16278
16279         * options.h (class General_options): Add --fatal-warnings.
16280         * main.cc (main): Implement --fatal-warnings.
16281         * errors.h (Errors::warning_count): New function.
16282
16283         * options.h (class General_options): Add -Bsymbolic-functions.
16284         * symtab.h (Symbol::is_preemptible): Check for
16285         -Bsymbolic-functions.
16286
16287 2008-05-05  Ian Lance Taylor  <iant@google.com>
16288
16289         * options.h (DEFINE_bool): For DASH_Z, create the negative option
16290         as noVARNAME rather than no-VARNAME.
16291         (class General_options): Add option -z combreloc.
16292         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
16293         get_address.
16294         (Output_reloc::sort_before) [SHT_REL]: New function.
16295         (Output_reloc::sort_before) [SHT_RELA]: New function.
16296         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
16297         Sort_relocs_comparison.
16298         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
16299         parameter.  Change all callers.
16300         (Output_data_reloc::Output_data_reloc) [both versions]: Add
16301         sort_relocs parameter.  Change all callers.
16302         * output.cc (Output_reloc::get_address): New function, broken out
16303         of write_rel.
16304         (Output_reloc::write_rel): Call it.
16305         (Output_reloc::compare): New function.
16306         (Output_data_reloc_base::do_write): Optionally sort relocs.
16307
16308         * configure.ac: If targ_extra_obj is set, link it in.
16309         * configure.tgt: Initialize all variables.
16310         (x86_64*): Set targ_extra_obj and targ_extra_size.
16311         * configure: Rebuild.
16312
16313         * object.cc (Sized_relobj::include_section_group): Adjust section
16314         indexes read from group data.  Build vector to pass to
16315         layout_group.
16316         * layout.cc (Layout::layout_group): Add flags and shndxes
16317         parameters.  Remove contents parameter.  Change caller.  Update
16318         explicit instantiations.
16319         * layout.h (class Layout): Update layout_group declaration.
16320         * output.cc (Output_data_group::Output_data_group): Add flags and
16321         input_shndxes parameters.  Remove contents parameter.  Change
16322         caller.
16323         (Output_data_group::do_write): Change input_sections_ to
16324         input_shndxes_.
16325         * output.h (class Output_data_group): Update constructor
16326         declaration.  Rename input_sections_ to input_shndxes_.
16327         * testsuite/many_sections_test.cc: Add template.
16328
16329 2008-04-30  Cary Coutant  <ccoutant@google.com>
16330
16331         * target-reloc.h (relocate_section): Fix dead-pointer bug.
16332
16333         * layout.cc (Layout::include_section): Refactored check for debug
16334         info section.
16335         (Layout::add_comdat): Add new parameters.  Change type
16336         of signature parameter.  Add object and shndx to signatures table.
16337         (Layout::find_kept_object): New function.
16338         * layout.h: Include <cstring>.
16339         (Layout::is_debug_info_section): New function.
16340         (Layout::add_comdat): Add new parameters.
16341         (Layout::find_kept_object): New function.
16342         (Layout::Kept_section): New struct.
16343         (Layout::Signatures): Change type of map range.
16344         * object.cc (Relobj::output_section_address): New function.
16345         (Sized_relobj::include_section_group): Add new parameters.  Change
16346         calls to Layout::add_comdat.  Change to build table of kept comdat
16347         groups and table mapping discarded sections to kept sections.
16348         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
16349         (Sized_relobj::do_layout): Change calls to include_section_group and
16350         include_linkonce_section.
16351         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
16352         value to zero when section is discarded.
16353         (Sized_relobj::map_to_kept_section): New function.
16354         * object.h (Relobj::output_section_address): New function.
16355         (Relobj::Comdat_group): New type.
16356         (Relobj::find_comdat_group): New function.
16357         (Relobj::Comdat_group_table): New type.
16358         (Relobj::Kept_comdat_section): New type.
16359         (Relobj::Kept_comdat_section_table): New type.
16360         (Relobj::add_comdat_group): New function.
16361         (Relobj::set_kept_comdat_section): New function.
16362         (Relobj::get_kept_comdat_section): New function.
16363         (Relobj::comdat_groups_): New field.
16364         (Relobj::kept_comdat_sections_): New field.
16365         (Symbol_value::input_value): Update comment.
16366         (Sized_relobj::map_to_kept_section) New function.
16367         (Sized_relobj::include_linkonce_section): Add new parameter.
16368         * target-reloc.h (Comdat_behavior): New type.
16369         (get_comdat_behavior): New function.
16370         (relocate_section): Add code to map a discarded section to the
16371         corresponding kept section when applying a relocation.
16372
16373 2008-04-30  Craig Silverstein  <csilvers@google.com>
16374
16375         * dwarf_reader.cc (next_generation_count): New static var.
16376         (Addr2line_cache_entry): New struct.
16377         (addr2line_cache): New static var.
16378         (Dwarf_line_info::one_addr2line): Added caching.
16379         (Dwarf_line_info::clear_addr2line_cache): New function.
16380         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
16381         cache-size parameter.
16382         (Dwarf_line_info::one_addr2line_cache): New function.
16383         * symtab.cc (Symbol_table::detect_odr_violations): Pass
16384         new cache-size argument to one_addr2line(), and clear cache.
16385
16386 2008-04-28  Cary Coutant  <ccoutant@google.com>
16387
16388         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
16389         R_386_PC8 relocations.
16390
16391 2008-04-23  Ian Lance Taylor  <iant@google.com>
16392
16393         * object.cc (Sized_relobj::include_section_group): Check for
16394         invalid section group.
16395
16396         * object.cc (make_elf_object): Correct test for 64-bit ELF file
16397         header size.
16398
16399         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
16400         than read for file header.
16401         * archive.cc (Archive::include_member): Likewise.
16402
16403 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
16404
16405         * aclocal.m4: Regenerate.
16406         * configure: Regenerate.
16407
16408 2008-04-19  Ian Lance Taylor  <iant@google.com>
16409
16410         * version.cc (version_string): Bump to 1.6.
16411
16412         * testsuite/Makefile.am (many_sections_r_test): New target.
16413         (many_sections_r_test_SOURCES): Remove.
16414         (many_sections_r_test_DEPENDENCIES): Remove.
16415         (many_sections_r_test_LDFLAGS): Remove.
16416         (many_sections_r_test_LDADD): Remove.
16417
16418         * object.cc (Sized_relobj::do_add_symbols): Always pass
16419         local_symbol_count_ to add_from_relobj.
16420
16421         * testsuite/Makefile.am (many_sections_check.h): Only check one in
16422         every thousand variables.
16423         * testsuite/Makefile.in: Rebuild.
16424
16425         * object.cc (Xindex::initialize_symtab_xindex): New function.
16426         (Xindex::read_symtab_xindex): New function.
16427         (Xindex::sym_xindex_to_shndx): New function.
16428         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
16429         available.
16430         (Sized_relobj::do_initialize_xindex): New function.
16431         (Sized_relobj::do_read_symbols): Adjust section links.
16432         (Sized_relobj::symbol_section_and_value): Add is_ordinary
16433         parameter.  Change all callers.
16434         (Sized_relobj::include_section_group): Adjust section links and
16435         symbol section indexes.
16436         (Sized_relobj::do_layout): Adjust section links.
16437         (Sized_relobj::do_count_local_symbols): Adjust section links and
16438         symbol section indexes.
16439         (Sized_relobj::do_finalize_local_symbols): Distinguish between
16440         ordinary and special symbols.
16441         (Sized_relobj::write_local_symbols): Add symtab_xindex and
16442         dynsym_xindex parameters.  Change all callers.  Adjust section
16443         links.  Use SHN_XINDEX when needed.
16444         (Sized_relobj::get_symbol_location_info): Adjust section links.
16445         Don't get fooled by special symbols.
16446         * object.h (class Xindex): Define.
16447         (class Object): Add xindex_ parameter.  Declare virtual functoin
16448         do_initialize_xindex.
16449         (Object::adjust_sym_shndx): New function.
16450         (Object::set_xindex): New protected function.
16451         (class Symbol_value): Add is_ordinary_shndx_ field.
16452         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
16453         (Symbol_value::value): Assert ordinary section.
16454         (Symbol_value::initialize_input_to_output_map): Likewise.
16455         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
16456         Change all callers.
16457         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
16458         all callers.
16459         (class Sized_relobj): Update declarations.
16460         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
16461         parameter.  Change all callers.
16462         (Sized_relobj::adjust_shndx): New function.
16463         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
16464         field.
16465         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
16466         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
16467         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
16468         (Sized_dynobj::read_dynsym_section): Adjust section links.
16469         (Sized_dynobj::read_dynamic): Likewise.
16470         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
16471         section links.
16472         (Sized_dynobj::do_initialize_xindex): New function.
16473         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
16474         do_initialize_xindex.
16475         (Sized_dynobj::adjust_shndx): New function.
16476         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
16477         dynsym_xindex_ fields.
16478         (Layout::finalize): Add a call to set_section_indexes before
16479         creating the symtab sections.
16480         (Layout::set_section_indexes): Don't do anything if the section
16481         already has a section index.
16482         (Layout::create_symtab_sections): Add shnum parameter.  Change
16483         caller.  Create .symtab_shndx section if needed.
16484         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
16485         caller.
16486         (Layout::allocated_output_section_count): New function.
16487         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
16488         needed.
16489         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
16490         fields.  Update declarations.
16491         (Layout::symtab_xindex): New function.
16492         (Layout::dynsym_xindex): New function.
16493         (class Write_symbols_task): Add layout_ field.
16494         (Write_symbols_task::Write_symbols_task): Add layout parameter.
16495         Change caller.
16496         * output.cc (Output_section_headers::Output_section_headers): Add
16497         shstrtab_section parameter.  Change all callers.
16498         (Output_section_headers::do_sized_write): Store overflow values
16499         for section count and section string table section index in
16500         section header zero.
16501         (Output_file_header::do_sized_write): Check for overflow of
16502         section count and section string table section index.
16503         (Output_symtab_xindex::do_write): New function.
16504         (Output_symtab_xindex::endian_do_write): New function.
16505         * output.h (class Output_section_headers): Add shstrtab_section_.
16506         Update declarations.
16507         (class Output_symtab_xindex): Define.
16508         (Output_section::has_out_shndx): New function.
16509         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
16510         field.
16511         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
16512         Change all callers.
16513         (Sized_symbol::init): Likewise.
16514         (Symbol::output_section): Check for ordinary symbol.
16515         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
16516         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
16517         callers.
16518         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
16519         Change all callers.  Simplify handling of symbols from sections
16520         not included in the link.
16521         (Symbol_table::add_from_dynobj): Handle ordinary symbol
16522         distinction.
16523         (Weak_alias_sorter::operator()): Assert that symbols are
16524         ordinary.
16525         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
16526         distinction.
16527         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
16528         parameters.  Change all callers.
16529         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
16530         symbol distinction.  Use SHN_XINDEX when needed.
16531         (Symbol_table::write_section_symbol): Add symtab_xindex
16532         parameter.  Change all callers.
16533         (Symbol_table::sized_write_section_symbol): Likewise.  Use
16534         SHN_XINDEX when needed.
16535         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
16536         declarations.
16537         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
16538         (Symbol::is_defined): Check is_ordinary.
16539         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
16540         (Symbol::is_absolute, Symbol::is_common): Likewise.
16541         (class Sized_symbol): Update declarations.
16542         (class Symbol_table): Update declarations.
16543         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
16544         parameters.  Change all callers.
16545         (Sized_symbol::override): Likewise.
16546         (Symbol_table::override): Likewise.
16547         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
16548         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
16549         is_ordinary, and orig_st_shndx parameters.  Change all callers.
16550         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
16551         to be in an ordinary section.
16552         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
16553         object and is_ordinary parameters.  Change all callers.
16554         (Sized_dwarf_line_info::read_relocs): Add object parameter.
16555         Change all callers.  Don't add undefined or non-ordinary symbols
16556         to reloc_map_.
16557         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
16558         Change all callers.
16559         * dwarf_reader.h (class Sized_dwarf_line_info): Update
16560         declarations.
16561         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
16562         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
16563         (Sized_relobj::relocate_sections): Likewise.
16564         * target-reloc.h (scan_relocs): Adjust section symbol index.
16565         (scan_relocatable_relocs): Likewise.
16566         * i386.cc (Scan::local): Check for ordinary symbols.
16567         * sparc.cc (Scan::local): Likewise.
16568         * x86_64.cc (Scan::local): Likewise.
16569         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
16570         to symbol_section_and_value.
16571         * testsuite/many_sections_test.cc: New file.
16572         * testsuite/Makefile.am (BUILT_SOURCES): Define.
16573         (check_PROGRAMS): Add many_sections_test.
16574         (many_sections_test_SOURCES): Define.
16575         (many_sections_test_DEPENDENCIES): Define.
16576         (many_sections_test_LDFLAGS): Define.
16577         (BUILT_SOURCES): Add many_sections_define.h.
16578         (many_sections_define.h): New target.
16579         (BUILT_SOURCES): Add many_sections_check.h.
16580         (many_sections_check.h): New target.
16581         (check_PROGRAMS): Add many_sections_r_test.
16582         (many_sections_r_test_SOURCES): Define.
16583         (many_sections_r_test_DEPENDENCIES): Define.
16584         (many_sections_r_test_LDFLAGS): Define.
16585         (many_sections_r_test_LDADD): Define.
16586         (many_sections_r_test.o): New target.
16587         * testsuite/Makefile.in: Rebuild.
16588
16589 2008-04-17  Cary Coutant  <ccoutant@google.com>
16590
16591         * errors.cc (Errors::info): New function.
16592         (gold_info): New function.
16593         * errors.h (Errors::info): New function.
16594         * gold.h (gold_info): New function.
16595         * object.cc (Input_objects::add_object): Print trace output.
16596         * options.cc (options::parse_set): New function.
16597         (General_options::parse_wrap): Deleted.
16598         (General_options::General_options): Deleted initializer.
16599         * options.h (options::String_set): New typedef.
16600         (options::parse_set): New function.
16601         (DEFINE_set): New macro.
16602         (General_options::wrap): Changed to use DEFINE_set. Changed
16603         callers of any_wrap_symbols and is_wrap_symbol.
16604         (General_options::trace, General_options::trace_symbol):
16605         New options.
16606         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
16607         (General_options::wrap_symbols_): Deleted.
16608         * symtab.cc (Symbol_table::add_from_object): Print trace output.
16609
16610 2008-04-17  David S. Miller  <davem@davemloft.net>
16611
16612         * options.cc (General_options::parse_V): New function.
16613         * options.h: Add entries for -V and -Qy.
16614
16615 2008-04-17  Ian Lance Taylor  <iant@google.com>
16616
16617         * common.cc (Symbol_table::allocate_commons): Remove options
16618         parameter.  Change caller.
16619         (Symbol_table::do_allocate_commons): Remove options parameter.
16620         Change caller.  Just call do_allocate_commons_list twice.
16621         (Symbol_table::do_allocate_commons_list): New function, broken out
16622         of do_allocate_commons.
16623         * common.h (class Allocate_commons_task): Remove options_ field.
16624         Update constructor.
16625         * symtab.cc (Symbol_table::Symbol_table): Initialize
16626         tls_commons_.
16627         (Symbol_table::add_from_object): Put TLS common symbols on
16628         tls_commons_ list.
16629         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
16630         which are IN_OUTPUT_DATA.
16631         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
16632         allocate_commons and do_allocate_commons declarations.  Declare
16633         do_allocate_commons_list.
16634         * gold.cc (queue_middle_tasks): Update creation of
16635         Allocate_commons_task to not pass options.
16636         * testsuite/Makefile.am (INCLUDES): Add -I.. .
16637         (TLS_TEST_C_FLAGS): New variable.
16638         (tls_test_c_pic.o): New target.
16639         (tls_test_shared.so): Link in tls_test_c_pic.o.
16640         (tls_test_c_pic_ie.o): New target.
16641         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
16642         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
16643         (tls_test_c.o): New target.
16644         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
16645         (tls_pic_test_LDADD): Likewise.
16646         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
16647         (tls_shared_gd_to_ie_test_LDADD): Likewise.
16648         (tls_test_c_gnu2.o): New target.
16649         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
16650         tls_test_c_gnu2.o.
16651         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
16652         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
16653         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
16654         * testsuite/tls_test.cc: Include "config.h".
16655         (t_last): Call t11_last.
16656         * testsuite/tls_test.h (t11, t11_last): Declare.
16657         * testsuite/tls_test_c.c: New file.
16658         * testsuite/tls_test_main.cc (thread_routine): Call t11.
16659         * configure.ac: Check for OpenMP support.
16660         * configure, config.in, Makefile.in: Rebuild.
16661         * testsuite/Makefile.in: Rebuild.
16662
16663 2008-04-16  Cary Coutant  <ccoutant@google.com>
16664
16665         * i386.cc (Target_i386::define_tls_base_symbol): New function.
16666         (Target_i386::tls_base_symbol_defined_): New field.
16667         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16668         (Target_i386::Scan::global): Likewise.
16669         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
16670         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
16671         (Target_x86_64::tls_base_symbol_defined_): New field.
16672         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16673         (Target_x86_64::Scan::global): Likewise.
16674
16675 2008-04-16  Cary Coutant  <ccoutant@google.com>
16676
16677         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
16678         (Symbol::needs_plt_entry): Allow weak undefined symbols.
16679         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
16680         building shared libraries.
16681         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
16682         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
16683         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
16684         * testsuite/Makefile.in: Rebuild.
16685         * testsuite/weak_undef.h: New file.
16686         * testsuite/weak_undef_file1.cc: Add extra test cases.
16687         * testsuite/weak_undef_file2.cc: Likewise.
16688         * testsuite/weak_undef_test.cc: Likewise.
16689
16690 2008-04-16  David S. Miller  <davem@davemloft.net>
16691
16692         * sparc.cc (Target_sparc::Scan): Change from struct to class.
16693         Add issued_non_pic_error_ field.  Declare check_non_pic.
16694         (Target_sparc::Scan::check_non_pic): New function.
16695         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
16696         (Target_sparc::Scan::global): Likewise.
16697
16698         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
16699         * configure: Rebuild.
16700
16701         * options.h (DEFINE_enable): New macro.
16702         (new_dtags): New enable option.
16703         (initfirst, interpose, loadfltr, nodefaultlib,
16704         nodelete, nodlopen, nodump): New -z options.
16705         * layout.cc (Layout:finish_dynamic_section): If new
16706         dtags enabled, emit DT_RUNPATH.  Also, emit a
16707         DT_FLAGS_1 containing any specified -z flags.
16708
16709 2008-04-16  Ian Lance Taylor  <iant@google.com>
16710
16711         * copy-relocs.cc: New file.
16712         * copy-relocs.h: New file.
16713         * reloc.cc: Remove Copy_relocs code.
16714         * reloc.h: Likewise.
16715         * reloc-types.h (struct Reloc_types) [both versions]: Add
16716         get_reloc_addend_noerror.
16717         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
16718         variants of add_global which take an addend which must be zero.
16719         * i386.cc: Include "copy-relocs.h".
16720         (class Target_i386): Change type of copy_relocs_ to variable,
16721         update initializer.
16722         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
16723         Change all callers.
16724         (Target_i386::do_finalize_sections): Change handling of
16725         copy_relocs_.
16726         * sparc.cc: Include "copy-relocs.h".
16727         (class Target_sparc): Change type of copy_relocs_ to variable,
16728         update initializer.
16729         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
16730         Change all callers.
16731         (Target_sparc::do_finalize_sections): Change handling of
16732         copy_relocs_.
16733         * x86_64.cc: Include "copy-relocs.h".
16734         (class Target_x86_64): Change type of copy_relocs_ to variable,
16735         update initializer.
16736         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
16737         class.  Change all callers.
16738         (Target_x86_64::do_finalize_sections): Change handling of
16739         copy_relocs_.
16740         * Makefile.am (CCFILES): Add copy-relocs.cc.
16741         (HFILES): Add copy-relocs.h.
16742
16743         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
16744
16745         * testsuite/script_test_4.sh: Permit leading zeroes.
16746
16747 2008-04-15  Ian Lance Taylor  <iant@google.com>
16748
16749         * script-sections.cc (Script_sections::create_segments): Use
16750         header_size_adjustment even when there is enough room for the
16751         headers.
16752         * testsuite/script_test_4.sh: New file.
16753         * testsuite/script_test_4.t: New file.
16754         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
16755         (check_DATA): Add script_test_4.stdout.
16756         (MOSTLYCLEANFILES): Likewise.
16757         (script_test_4): New target.
16758         (script_test_4.stdout): New target.
16759         * testsuite/Makefile.in: Rebuild.
16760
16761         * sparc.cc: Add definitions for Output_data_plt_sparc class
16762         constants.
16763
16764 2008-04-14  David S. Miller  <davem@davemloft.net>
16765
16766         * sparc.cc: New file.
16767         * Makefile.am (TARGETSOURCES): Add sparc.cc
16768         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
16769         * configure.tgt: Document targ_extra_size and
16770         targ_extra_big_endian.  Add entries for sparc-* and
16771         sparc64-*.
16772         * configure.ac: Handle targ_extra_size and
16773         targ_extra_big_endian.
16774         * Makefile.in: Rebuild.
16775         * configure: Likewise.
16776         * po/POTFILES.in: Likewise.
16777         * po/gold.pot: Likewise.
16778
16779 2008-04-14  Ian Lance Taylor  <iant@google.com>
16780
16781         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
16782         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
16783         in the name/type/flags to section mapping.  Don't call
16784         allocate_output_section.
16785         (Layout::choose_output_section): Change parameter from adjust_name
16786         to is_input_section.  Don't permit input sections after sections
16787         are attached to segments.  Don't call allocate_output_section.
16788         (Layout::layout_eh_frame): Call update_flags_for_input_section,
16789         not write_enable_output_section.
16790         (Layout::make_output_section): Don't push to
16791         unattached_section_list_ nor call attach_to_segment.  Call
16792         attach_section_to_segment if sections are attached.
16793         (Layout::attach_sections_to_segments): New function.
16794         (Layout::attach_section_to_segment): New function.
16795         (Layout::attach_allocated_section_to_segment): Rename from
16796         attach_to_segment.  Remove flags parameter.
16797         (Layout::allocate_output_section): Remove function.
16798         (Layout::write_enable_output_section): Remove function.
16799         * layout.h (class Layout): Update for above changes.  Add new
16800         field sections_are_attached_.
16801         * output.h (Output_section::update_flags_for_input_section): New
16802         function.
16803         * output.cc (Output_section::add_input_section): Call
16804         update_flags_for_input_section.
16805         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
16806
16807 2008-04-11  Cary Coutant  <ccoutant@google.com>
16808
16809         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
16810         thought unnecessary.
16811         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
16812
16813 2008-04-11  Ian Lance Taylor  <iant@google.com>
16814
16815         * output.h (class Output_section_data): Remove inline definition
16816         of set_addralign.
16817         * output.cc (Output_section_data::set_addralign): New function.
16818
16819 2008-04-11  Cary Coutant  <ccoutant@google.com>
16820
16821         Add support for TLS descriptors for i386 and x86_64.
16822         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
16823         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
16824         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
16825         GOT_TYPE_TLS_DESC.
16826         (Target_i386::got_mod_index_entry): Remove unnecessary code.
16827         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
16828         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
16829         relocations.
16830         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
16831         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
16832         Fix problem with initial-exec relocations.
16833         (Target_i386::Relocate::relocate_tls): Likewise.
16834         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
16835         relaxation.
16836         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
16837         support for section-plus-offset dynamic table entries.
16838         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
16839         (Output_data_dynamic::Dynamic_entry): Add support for
16840         section-plus-offset dynamic table entries.
16841         (Output_data_dynamic::Classification): Likewise.
16842         (Output_data_dynamic::classification_): Renamed offset_.
16843         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
16844         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
16845         (Target_x86_64::make_plt_section): New function.
16846         (Target_x86_64::reserve_tlsdesc_entries): New function.
16847         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
16848         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
16849         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
16850         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
16851         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
16852         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
16853         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
16854         add extra PLT entry for TLS descriptors.
16855         (Output_data_plt_x86_64::got_): New field.
16856         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
16857         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
16858         fields.
16859         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
16860         descriptors.
16861         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
16862         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
16863         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
16864         R_386_TLS_DESC_CALL relocations.
16865         (Target_x86_64::Scan::global): Likewise.
16866         (Target_x86_64::do_finalize_sections): Add dynamic table entries
16867         for TLS descriptors.
16868         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
16869         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
16870         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
16871         GD-to-IE relaxation.
16872         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
16873         and TLS_DESCRIPTORS.
16874         * Makefile.in: Rebuild.
16875         * configure: Rebuild.
16876         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
16877         (tls_test_shared2.so): New target.
16878         (tls_shared_gd_to_ie_test_SOURCES): New variable.
16879         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
16880         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
16881         (tls_shared_gd_to_ie_test_LDADD): New variable.
16882         (tls_shared_gnu2_gd_to_ie_test): New target.
16883         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
16884         New targets.
16885         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
16886         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
16887         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
16888         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
16889         (tls_shared_gnu2_test): New target.
16890         (tls_test_gnu2_shared.so): New target.
16891         (tls_shared_gnu2_test_SOURCES): New variable.
16892         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
16893         (tls_shared_gnu2_test_LDFLAGS): New variable.
16894         (tls_shared_gnu2_test_LDADD): New variable.
16895         * testsuite/Makefile.in: Rebuild.
16896         * testsuite/Makefile.
16897
16898 2008-04-11  Ian Lance Taylor  <iant@google.com>
16899
16900         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
16901         justsyms.t.
16902         * testsuite/Makefile.in: Rebuild.
16903
16904         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
16905         long.
16906         * testsuite/script_test_2.cc (main): Adjust test.
16907
16908 2008-04-11  David S. Miller  <davem@davemloft.net>
16909             Ian Lance Taylor  <iant@google.com>
16910
16911         * options.h (General_options): Add entries for '-Y' and
16912         '-relax'.
16913         * options.cc (General_options:finalize): If -Y was used, add those
16914         entries to the library path instead of the default "/lib" and
16915         "/usr/lib".
16916
16917 2008-04-11  David S. Miller  <davem@davemloft.net>
16918
16919         * testsuite/justsyms.t: Start at 0x100.
16920         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
16921         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
16922         long.
16923         * testsuite/script_test_2.cc: Adjust string and section length
16924         checks.
16925
16926 2008-04-09  Ian Lance Taylor  <iant@google.com>
16927
16928         PR gold/5996
16929         * script-sections.cc (Sections_element::allocate_to_segment): Add
16930         orphan parameter.
16931         (Output_section_definition::allocate_to_segment): Likewise.
16932         (Orphan_output_section::allocate_to_segment): Likewise.
16933         (Script_sections::attach_sections_using_phdrs_clause): Don't
16934         propagate non-PT_LOAD segments to orphan sections.
16935         * testsuite/Makefile.am (script_test_3.stdout): Generate using
16936         readelf rather than objdump.
16937         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
16938         .interp section and PT_INTERP segment are the same size.
16939         * testsuite/Makefile.in: Rebuild.
16940
16941         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
16942         aliases for symbols defined in the same object.
16943         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
16944         (weak_alias_test_SOURCES): New variable.
16945         (weak_alias_test_DEPENDENCIES): New variable.
16946         (weak_alias_test_LDFLAGS): New variable.
16947         (weak_alias_test_LDADD): New variable.
16948         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
16949         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
16950         (weak_alias_test_3.o): New target.
16951         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
16952         * testsuite/weak_alias_test_main.cc: New file.
16953         * testsuite/weak_alias_test_1.cc: New file.
16954         * testsuite/weak_alias_test_2.cc: New file.
16955         * testsuite/weak_alias_test_3.cc: New file.
16956
16957 2008-04-08  Ian Lance Taylor  <iant@google.com>
16958
16959         * options.h (class General_options): Add --noinhibit-exec option.
16960         * main.cc (main): Check --noinhibit-exec.
16961
16962         * options.h (class General_options): Define --wrap as a special
16963         option.  Add wrap_symbols_ field.
16964         (General_options::any_wrap_symbols): New function.
16965         (General_options::is_wrap_symbol): New function.
16966         * options.cc (General_options::parse_wrap): New function.
16967         (General_options::General_options): Initialize wrap_symbols_.
16968         * symtab.cc (Symbol_table::wrap_symbol): New function.
16969         (Symbol_table::add_from_object): Handle --wrap.
16970         * symtab.h (class Symbol_table): Declare wrap_symbol.
16971         * target.h (Target::wrap_char): New function.
16972         (Target::Target_info): Add wrap_char field.
16973         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
16974         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
16975         * testsuite/testfile.cc (Target_test::test_target_info):
16976         Likewise.
16977
16978         * errors.cc (Errors::undefined_symbol): Mention symbol version if
16979         there is one.
16980
16981         * layout.h (class Layout): Add added_eh_frame_data_ field.
16982         * layout.cc (Layout::Layout): Initialize new field.
16983         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
16984         output section until we find a section we merged successfully.
16985         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
16986         that the size be non-zero.
16987
16988         * merge.cc (Object_merge_map::get_output_offset): Remove inline
16989         qualifier.
16990
16991 2008-04-08  Craig Silverstein  <csilvers@google.com>
16992
16993         * configure.ac: Export new conditional variable HAVE_ZLIB.
16994         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
16995         on HAVE_ZLIB.
16996         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
16997         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16998
16999 2008-04-07  Ian Lance Taylor  <iant@google.com>
17000
17001         * version.cc (version_string): Set to "1.5".
17002
17003         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
17004         Add issued_non_pic_error_ field.  Declare check_non_pic.
17005         (Target_x86_64::Scan::check_non_pic): New function.
17006         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
17007         (Target_x86_64::Scan::global): Likewise.
17008
17009         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
17010         addend parameter.  Change caller.  Handle merge sections.
17011         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
17012         Address to Addend.  Don't add in the result of
17013         local_section_offset, pass down the addend and use the returned
17014         value.
17015         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
17016         Update declarations of local_section_offset and symbol_value.
17017         * testsuite/two_file_test_1.cc (t18): New function.
17018         * testsuite/two_file_test_2.cc (f18): New function.
17019         * testsuite/two_file_test_main.cc (main): Call t18.
17020         * testsuite/two_file_test.h (t18, f18): Declare.
17021
17022         * configure.ac: Don't test for objdump, c++filt, or readelf.
17023         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
17024         conditionals.
17025         (TEST_READELF): New variable.
17026         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
17027         (check_PROGRAMS): Add two_file_strip_test.
17028         (two_file_strip_test): New target.
17029         (check_PROGRAMS): Add two_file_same_shared_strip_test.
17030         (two_file_same_shared_strip_test_SOURCES): New variable.
17031         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
17032         (two_file_same_shared_strip_test_LDFLAGS): New variable.
17033         (two_file_same_shared_strip_test_LDADD): New variable.
17034         (two_file_shared_strip.so): New target.
17035         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
17036         (ver_test_5.syms, ver_test_7.syms): Likewise.
17037         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
17038         (strip_test_3.stdout): Use TEST_OBJDUMP.
17039         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17040
17041 2008-04-04  Cary Coutant  <ccoutant@google.com>
17042
17043         * symtab.h (Symbol::is_weak_undefined): New function.
17044         (Symbol::is_strong_undefined): New function.
17045         (Symbol::is_absolute): New function.
17046         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
17047         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
17048         absolute symbols.
17049         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
17050         (weak_undef_test): New target.
17051         * testsuite/Makefile.in: Rebuild.
17052         * testsuite/weak_undef_file1.cc: New file.
17053         * testsuite/weak_undef_file2.cc: New file.
17054         * testsuite/weak_undef_test.cc: New file.
17055
17056 2008-04-03  Craig Silverstein  <csilvers@google.com>
17057
17058         * compressed_output.h (class Output_compressed_section): Use
17059         unsigned buffer.
17060         * compressed_output.cc (zlib_compress): Use unsigned buffers,
17061         add zlib header.
17062         (zlib_compressed_suffix): Removed.
17063         (Output_compressed_section::set_final_data_size): Use unsigned
17064         buffers.
17065         * testsuite/Makefile.am (flagstest_compress_debug_sections):
17066         Fix linker invocation.
17067         (flagstest_o_specialfile_and_compress_debug_sections):
17068         Likewise.
17069         * testsuite/Makefile.in: Regenerated.
17070
17071 2008-04-02  David S. Miller  <davem@davemloft.net>
17072
17073         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
17074         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
17075
17076 2008-04-02  Craig Silverstein  <csilvers@google.com>
17077
17078         * TODO: New file.
17079
17080 2008-04-02  Ian Lance Taylor  <iant@google.com>
17081
17082         * fileread.cc (File_read::find_view): Add byteshift and vshifted
17083         parameters.  Update for new key type to views_.  Change all
17084         callers.
17085         (File_read::read): Adjust for byteshift in returned view.
17086         (File_read::add_view): New function, broken out of
17087         find_and_make_view.
17088         (File_read::make_view): New function, broken out of
17089         find_and_make_view.
17090         (File_read::find_or_make_view): Add offset and aligned
17091         parameters.  Rewrite accordingly.  Change all callers.
17092         (File_read::get_view): Add offset and aligned parameters.  Adjust
17093         for byteshift in return value.
17094         (File_read::get_lasting_view): Likewise.
17095         * fileread.h (class File_read): Update declarations.
17096         (class File_read::View): Add byteshift_ field.  Add byteshift to
17097         constructor.  Add byteshift method.
17098         * archive.h (Archive::clear_uncached_views): New function.
17099         (Archive::get_view): Add aligned parameter.  Change all callers.
17100         * object.h (Object::get_view): Add aligned parameter.  Change all
17101         callers.
17102         (Object::get_lasting_view): Likewise.
17103
17104         * fileread.cc (File_read::release): Don't call clear_views if
17105         there are multiple objects.
17106         * fileread.h (File_read::clear_uncached_views): New function.
17107         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
17108         on the archive.
17109
17110 2008-03-31  Cary Coutant  <ccoutant@google.com>
17111
17112         Add thin archive support.
17113         * archive.cc (Archive::armagt): New const.
17114         (Archive::setup): Remove task parameter and calls to unlock.
17115         (Archive::unlock_nested_archives): New function.
17116         (Archive::read_header): Add nested_off parameter. Change
17117         all callers.
17118         (Archive::interpret_header): Likewise.
17119         (Archive::include_all_members): Change to handle thin
17120         archives.
17121         (Archive::include_member): Likewise.
17122         * archive.h (Archive::Archive): Add new parameters and
17123         initializers.
17124         (Archive::armagt): New const.
17125         (Archive::setup): Remove task parameter.
17126         (Archive::unlock_nested_archives): New function.
17127         (Archive::read_header): Add nested_off parameter.
17128         (Archive::interpret_header): Likewise.
17129         (Archive::Nested_archive_table): New typedef.
17130         (Archive::is_thin_archive_): New field.
17131         (Archive::nested_archives_): New field.
17132         (Archive::options_): New field.
17133         (Archive::dirpath_): New field.
17134         (Archive::task_): New field.
17135         * readsyms.cc (Read_symbols::do_read_symbols): Add check
17136         for thin archives.  Pass additional parameters to
17137         Archive::Archive.  Unlock the archive file after calling
17138         Archive::setup.
17139
17140 2008-03-29  Ian Lance Taylor  <iant@google.com>
17141
17142         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
17143         version symbol to be local.
17144         * testsuite/ver_test_4.sh: New file.
17145         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
17146         (check_DATA): Add ver_test_4.syms.
17147         (ver_test_4.syms): New target.
17148         * testsuite/Makefile.in: Rebuild.
17149
17150         * output.cc
17151         (Output_section::Input_section_sort_entry::has_priority): New
17152         function.
17153         (Output_section::Input_section_sort_entry::match_file_name): New
17154         function.
17155         (Output_section::Input_section_sort_entry::match_section_name):
17156         Remove.
17157         (Output_section::Input_section_sort_entry::match_section_name_prefix):
17158         Remove.
17159         (Output_section::Input_section_sort_entry::match_section_file):
17160         Remove.
17161         (Output_section::Input_section_sort_compare::operator()): Rewrite
17162         using new Input_section_sort_entry functions.  Sort crtbegin and
17163         crtend first.  Sort sections with no priority before sections with
17164         a priority.
17165         * testsuite/initpri1.c (d3): Check j != 4.
17166         (cd5): New constructor/destructor function.
17167         (main): Check j != 2.
17168
17169         * symtab.cc (Symbol_table::add_from_object): If we don't use the
17170         new symbol when resolving, don't call set_is_default.
17171         * testsuite/ver_test_7.cc: New file.
17172         * testsuite/ver_test_7.sh: New file.
17173         * testsuite/Makefile.am (ver_test_7.so): New target.
17174         (ver_test_7.o): New target.
17175         (check_SCRIPTS): Add ver_test_7.sh.
17176         (check_DATA): Add ver_test_7.syms.
17177         (ver_test_7.syms): New target.
17178
17179 2008-03-28  Ian Lance Taylor  <iant@google.com>
17180
17181         * layout.cc (Layout::layout): If we see an input section with a
17182         name that needs sorting, set the must_sort flag for the output
17183         section.
17184         (Layout::make_output_section): If the name of the output section
17185         indicates that it might require sorting, set the may_sort flag.
17186         * output.h (Output_section::may_sort_attached_input_sections): New
17187         function.
17188         (Output_section::set_may_sort_attached_input_sections): New
17189         function.
17190         (Output_section::must_sort_attached_input_sections): New
17191         function.
17192         (Output_section::set_must_sort_attached_input_sections): New
17193         function.
17194         (class Output_section): Declare Input_section_sort_entry.  Define
17195         Input_section_sort_compare.  Declare
17196         sort_attached_input_sections.  Add new fields:
17197         may_sort_attached_input_sections_,
17198         must_sort_attached_input_sections_,
17199         attached_input_sections_are_sorted_.
17200         * output.cc (Output_section::Output_section): Initialize new
17201         fields.
17202         (Output_section::add_input_section): Add an entry to
17203         input_sections_ if may_sort or must_sort are true.
17204         (Output_section::set_final_data_size): Call
17205         sort_attached_input_sections if necessary.
17206         (Output_section::Input_section_sort_entry): Define new class.
17207         (Output_section::Input_section_sort_compare::operator()): New
17208         function.
17209         (Output_section::sort_attached_input_sections): New function.
17210         * configure.ac: Check whether the compiler supports constructor
17211         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
17212         * testsuite/initpri1.c: New file.
17213         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
17214         CONSTRUCTOR_PRIORITY.
17215         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
17216         (initpri1_LDFLAGS): New variable.
17217         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17218
17219 2008-03-27  Ian Lance Taylor  <iant@google.com>
17220
17221         * common.cc (Sort_commons::operator): Correct sorting algorithm.
17222         * testsuite/common_test_1.c: New file.
17223         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
17224         (common_test_1_SOURCES): New variable.
17225         (common_test_1_DEPENDENCIES): New variable.
17226         (common_test_1_LDFLAGS): New variable.
17227
17228         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
17229         and commons_ correctly when NAME/VERSION does not override
17230         NAME/NULL.
17231         * testsuite/ver_test_6.c: New file.
17232         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
17233         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
17234         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
17235
17236 2008-03-26  Ian Lance Taylor  <iant@google.com>
17237
17238         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
17239         of an undefined symbol from a version script.
17240         * testsuite/Makefile.am (ver_test_5.so): New target.
17241         (ver_test_5.o): New target.
17242         (check_SCRIPTS): Add ver_test_5.sh.
17243         (check_DATA): Add ver_test_5.syms.
17244         (ver_test_5.syms): New target.
17245         * testsuite/ver_test_5.cc: New file.
17246         * testsuite/ver_test_5.script: New file.
17247         * testsuite/ver_test_5.sh: New file.
17248         * Makefile.in, testsuite/Makefile.in: Rebuild.
17249
17250         PR gold/5986
17251         Fix problems building gold with gcc 4.3.0.
17252         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
17253         (gold_error_at_location, gold_warning_at_location): Use it.
17254         * configure.ac: Check whether we can compile and use a template
17255         function with a printf attribute.
17256         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
17257         when jumping over bytes.
17258         * object.cc: Instantiate Object::read_section_data.
17259         * debug.h: Include <cstring>
17260         * dwarf_reader.cc: Include <algorithm>
17261         * main.cc: Include <cstring>.
17262         * options.cc: Include <cstring>.
17263         * output.cc: Include <cstring>.
17264         * script.cc: Include <cstring>.
17265         * script.h: Include <string>.
17266         * symtab.cc: Include <cstring> and <algorithm>.
17267         * target-select.cc: Include <cstring>.
17268         * version.cc: Include <string>.
17269         * testsuite/testmain.cc: Include <cstdlib>.
17270         * configure, config.in: Rebuild.
17271
17272 2008-03-25  Ian Lance Taylor  <iant@google.com>
17273
17274         * options.cc: Include "../bfd/bfdver.h".
17275         (options::help): Print bug reporting address.
17276
17277         * version.cc (print_version): Adjust output for current value of
17278         BFD_VERSION_STRING.
17279
17280         * NEWS: New file.
17281
17282         * options.cc (options::help): Print list of supported targets.
17283         * target-select.h: Include <vector>.
17284         (class Target_selector): Make machine_, size_, and is_big_endian_
17285         fields const.  Add bfd_name_ and instantiated_target_ fields.
17286         (Target_selector::Target_selector): Add bfd_name parameter.
17287         (Target_selector::recognize): Make non-virtual, call
17288         do_recognize.
17289         (Target_selector::recognize_by_name): Make non-virtual, call
17290         do_recognize_by_name.
17291         (Target_selector::supported_names): New function.
17292         (Target_selector::bfd_name): New function.
17293         (Target_selector::do_instantiate_target): New pure virtual
17294         function.
17295         (Target_selector::do_recognize): New virtual function.
17296         (Target_selector::do_recognize_by_name): New virtual function.
17297         (Target_selector::instantiate_target): New private function.
17298         (supported_target_names): Declare.
17299         * target-select.cc (Target_selector::Target_selector): Update for
17300         new parameter and fields.
17301         (select_target_by_name): Check that the name matches before
17302         calling recognize_by_name.
17303         (supported_target_names): New function.
17304         * i386.cc (class Target_selector_i386): Update Target_selector
17305         constructor call.  Remove recognize and recognize_by_name.  Add
17306         do_instantiate_target.
17307         * x86_64.cc (class Target_selector_x86_64): Likewise.
17308         * testsuite/testfile.cc (class Target_selector_test): Update for
17309         changes to Target_selector.
17310
17311         * README: Rewrite, with some notes on unsupported features.
17312
17313 2008-03-24  Cary Coutant  <ccoutant@google.com>
17314
17315         * i386.cc (Target_i386::Got_type): New enum declaration.
17316         (Target_i386::Scan::local): Updated callers of Output_data_got
17317         member functions.
17318         (Target_i386::Scan::global): Likewise.
17319         (Target_i386::Relocate::relocate): Likewise.
17320         (Target_i386::Relocate::relocate_tls): Likewise.
17321         * object.h (Got_offset_list): New class.
17322         (Sized_relobj::local_has_got_offset): Added got_type parameter.
17323         (Sized_relobj::local_got_offset): Likewise.
17324         (Sized_relobj::set_local_got_offset): Likewise.
17325         (Sized_relobj::local_has_tls_got_offset): Removed.
17326         (Sized_relobj::local_tls_got_offset): Removed.
17327         (Sized_relobj::set_local_tls_got_offset): Removed.
17328         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
17329         * output.cc (Output_data_got::add_global): Added got_type parameter.
17330         (Output_data_got::add_global_with_rel): Likewise.
17331         (Output_data_got::add_global_with_rela): Likewise.
17332         (Output_data_got::add_global_pair_with_rel): New function.
17333         (Output_data_got::add_global_pair_with_rela): New function.
17334         (Output_data_got::add_local): Added got_type parameter.
17335         (Output_data_got::add_local_with_rel): Likewise.
17336         (Output_data_got::add_local_with_rela): Likewise.
17337         (Output_data_got::add_local_pair_with_rel): New function.
17338         (Output_data_got::add_local_pair_with_rela): New function.
17339         (Output_data_got::add_global_tls): Removed.
17340         (Output_data_got::add_global_tls_with_rel): Removed.
17341         (Output_data_got::add_global_tls_with_rela): Removed.
17342         (Output_data_got::add_local_tls): Removed.
17343         (Output_data_got::add_local_tls_with_rel): Removed.
17344         (Output_data_got::add_local_tls_with_rela): Removed.
17345         * output.h (Output_data_got::add_global): Added got_type parameter.
17346         (Output_data_got::add_global_with_rel): Likewise.
17347         (Output_data_got::add_global_with_rela): Likewise.
17348         (Output_data_got::add_global_pair_with_rel): New function.
17349         (Output_data_got::add_global_pair_with_rela): New function.
17350         (Output_data_got::add_local): Added got_type parameter.
17351         (Output_data_got::add_local_with_rel): Likewise.
17352         (Output_data_got::add_local_with_rela): Likewise.
17353         (Output_data_got::add_local_pair_with_rel): New function.
17354         (Output_data_got::add_local_pair_with_rela): New function.
17355         (Output_data_got::add_global_tls): Removed.
17356         (Output_data_got::add_global_tls_with_rel): Removed.
17357         (Output_data_got::add_global_tls_with_rela): Removed.
17358         (Output_data_got::add_local_tls): Removed.
17359         (Output_data_got::add_local_tls_with_rel): Removed.
17360         (Output_data_got::add_local_tls_with_rela): Removed.
17361         * resolve.cc (Symbol::override_base_with_special): Removed
17362         reference to has_got_offset_ field.
17363         * symtab.cc (Symbol::init_fields): Replaced initialization
17364         of got_offset_ with got_offsets_.  Removed initialization
17365         of has_got_offset_
17366         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
17367         (Symbol::got_offset): Likewise.
17368         (Symbol::set_got_offset): Likewise.
17369         (Symbol::has_tls_got_offset): Removed.
17370         (Symbol::tls_got_offset): Removed.
17371         (Symbol::set_tls_got_offset): Removed.
17372         (Symbol::got_offset_): Removed.
17373         (Symbol::tls_mod_got_offset_): Removed.
17374         (Symbol::tls_pair_got_offset_): Removed.
17375         (Symbol::got_offsets_): New field.
17376         (Symbol::has_got_offset): Removed.
17377         (Symbol::has_tls_mod_got_offset): Removed.
17378         (Symbol::has_tls_pair_got_offset): Removed.
17379         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
17380         (Target_x86_64::Scan::local): Updated callers of Output_data_got
17381         member functions.
17382         (Target_x86_64::Scan::global): Likewise.
17383         (Target_x86_64::Relocate::relocate): Likewise.
17384         (Target_x86_64::Relocate::relocate_tls): Likewise.
17385
17386 2008-03-25  Ben Elliston  <bje@au.ibm.com>
17387
17388         * yyscript.y: Fix spelling error in comment.
17389
17390 2008-03-24  Ian Lance Taylor  <iant@google.com>
17391
17392         * options.h (class General_options): Define build_id option.
17393         * layout.h (class Layout): Declare write_build_id, create_note,
17394         create_build_id.  Add build_id_note_ member.
17395         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
17396         "libiberty.h", "md5.h", "sha1.h".
17397         (Layout::Layout): Initialize eh_frame_data_,
17398         eh_frame_hdr_section_, and build_id_note_.
17399         (Layout::finalize): Call create_build_id.
17400         (Layout::create_note): New function, broken out of
17401         Layout::create_gold_note.
17402         (Layout::create_gold_note): Call create_note.
17403         (Layout::create_build_id): New function.
17404         (Layout::write_build_id): New function.
17405         (Close_task_runner::run): Call write_build_id.
17406
17407         * x86_64.cc: Correct license to GPLv3.
17408
17409 2008-03-23  Ian Lance Taylor  <iant@google.com>
17410
17411         * options.cc: Include "demangle.h".
17412         (parse_optional_string): New function.
17413         (parse_long_option): Handle takes_optional_argument.
17414         (parse_short_option): Update dash_z initializer.  Handle
17415         takes_optional_argument.
17416         (General_options::General_options): Initialize do_demangle_.
17417         (General_options::finalize): Set do_demangle_.  Handle demangling
17418         style.
17419         * options.h (parse_optional_string): Declare.
17420         (struct One_option): Add optional_arg field.  Update constructor.
17421         Update call constructor calls.  Add takes_optional_argument
17422         function.
17423         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
17424         (DEFINE_optional_string): Define.
17425         (General_options::demangle): Change from DEFINE_bool to
17426         DEFINE_optional_string.
17427         (General_options::no_demangle): New function.
17428         (General_options::do_demangle): New function.
17429         (General_options::set_do_demangle): New function.
17430         (General_options::execstack_status_): Move definition to end of
17431         class definition.
17432         (General_options::static_): Likewise.
17433         (General_options::do_demangle_): New field.
17434         * object.cc (big_endian>::get_symbol_location_info): Call
17435         Options::do_demangle, not Options::demangle.
17436         * symtab.cc (demangle): Likewise.
17437
17438 2008-03-22  Ian Lance Taylor  <iant@google.com>
17439
17440         * gold.h: Include <cstddef> and <sys/types.h>
17441         * options.h: Include <cstring>.
17442
17443 2008-03-21  Ian Lance Taylor  <iant@google.com>
17444
17445         * Added source code to GNU binutils.
17446 \f
17447 Copyright (C) 2008-2015 Free Software Foundation, Inc.
17448
17449 Copying and distribution of this file, with or without modification,
17450 are permitted in any medium without royalty provided the copyright
17451 notice and this notice are preserved.
17452
17453 Local Variables:
17454 mode: change-log
17455 left-margin: 8
17456 fill-column: 74
17457 version-control: never
17458 End: