Patch for gold internal error while fixing erratum 843419.
[external/binutils.git] / gold / ChangeLog
1 2015-06-29  Han Shen  <shenhan@google.com>
2
3         Patch for erratum 843419 internal error.
4
5         * AArch64.cc (Erratum_stub::Insn_utilities): New typedef.
6         (Erratum_stub::update_erratum_insn): New method.
7         (Stub_table::relocate_stubs): Modified to place relocated insn.
8         (AArch64_relobj::fix_errata): Modified gold_assert.
9
10 2015-06-12  Han Shen  <shenhan@google.com>
11
12         Fix erratum 835769.
13
14         * aarch64.cc (AArch64_insn_utilities::BYTES_PER_INSN): Move
15         defintion outside class definition.
16         (AArch64_insn_utilities::AARCH64_ZR): New static constant.
17         (AArch64_insn_utilities::aarch64_op31): New member.
18         (AArch64_insn_utilities::aarch64_ra): New member.
19         (AArch64_insn_utilities::aarch64_mac): New member.
20         (AArch64_insn_utilities::aarch64_mlxl): New member.
21         (ST_E_835769): New global enum member.
22         (Stub_table::relocate_stubs): Add 835769 handler.
23         (Stub_template_repertoire::Stub_template_repertoire): Install new
24         stub type.
25         (AArch64_relobj::scan_errata): This func is renamed from
26         scan_erratum_843419.
27         (AArch64_relobj::do_count_local_symbols): Add 835769 handler.
28         (AArch64_relobj::do_relocate_sections): Add 835769 handler.
29         (AArch64_relobj::scan_sections_for_stubs): Add 835769 handler.
30         (Target_aarch64::scan_erratum_835769_span): New method.
31         (Target_aarch64::create_erratum_stub): New method.
32         (Target_aarch64::is_erratum_835769_sequence): New method.
33         (Target_aarch64::scan_erratum_843419_sequence): Move part of the
34         code into create_erratum_stub.
35         * options.h (fix_cortex_a53_835769): New option.
36
37 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
38
39         * aarch64.cc (Erratum_stub::STUB_ADDR_ALIGN): Move initialization
40         outside class body.
41         (Reloc_stub::STUB_ADDR_ALIGN): Likewise.
42
43 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
44
45         PR gold/17731
46         * layout.cc (corresponding_uncompressed_section_name): New function.
47         (Layout::choose_output_section): Call it.
48         * layout.h (corresponding_uncompressed_section_name): New function.
49         * script-sections.cc (Input_section_info::set_section_name): Check
50         for compressed debug section (.zdebug style).
51
52 2015-06-11  Jing Yu  <jingyu@google.com>
53
54         * testsuite/Makefile.am: Add -O0 for script_test_12 test.
55         * testsuite/Makefile.in: Regenerate.
56
57 2015-06-11  Davide Italiano  <dccitaliano@gmail.com>
58
59         * gold.h (is_cident): Correct typo.
60
61 2015-06-10  Han Shen  <shenhan@google.com>
62         Patch for erratum-843419 (2 of 2 - fix erratum occurrences).
63
64         Now fixing for 843419 is fully functional.
65
66         The first part of the erratum fix CL is here -
67         https://sourceware.org/ml/binutils/2015-04/msg00229.html
68
69         * aarch64.cc(global enum): New constants representing stub types.
70         (Stub_template): New POD struct.
71         (Stub_template_repertoire): New class.
72         (Stub_base): New class.
73         (Erratum_stub): New class.
74         (Reloc_stub): Refactored to be a subclass of Stub_base.
75         (Reloc_stub::Stub_type): Removed.
76         (Reloc_stub::offset): Moved to Stub_base.
77         (Reloc_stub::set_offset): Moved to Stub_base.
78         (Reloc_stub::destination_address): Moved to Stub_base.
79         (Reloc_stub::set_destination_address): Moved to Stub_base.
80         (Reloc_stub::reset_destination_address): Moved to Stub_base.
81         (Reloc_stub::stub_type): Renamed and moved to Stub_base.
82         (Reloc_stub::stub_size): Renamed and moved to Stub_base.
83         (Reloc_stub::stub_insns): Renamed and moved to Stub_base.
84         (Reloc_stub::write): Moved to Stub_base.
85         (Reloc_stub::invalid_offset): Moved to Stub_base.
86         (Reloc_stub::invalid_address): Moved to Stub_base.
87         (Reloc_stub::stub_type_): Renamed and moved to Stub_base.
88         (Reloc_stub::stub_insns_): Moved to Stub_base.
89         (Reloc_stub::offset_): Moved to Stub_base.
90         (Reloc_stub::destination_address_): Moved to Stub_base.
91         (Stub_table::The_aarch64_relobj): New typedef.
92         (Stub_table::The_erratum_stub): New typedef.
93         (Stub_table::The_erratum_stub_less): New typedef.
94         (Stub_table::The_erratum_stub_set): New typedef.
95         (Stub_table::The_erratum_stub_set_iter): New typedef.
96         (Stub_table::empty): Added emptiness testing for erratum stubs.
97         (Stub_table::add_erratum_stub): New method to add an erratum stub.
98         (Stub_table::find_erratum_stub): New method.
99         (Stub_table::find_erratum_stubs_for_input_section): New method.
100         (Stub_table::erratum_stub_address): New method.
101         (Stub_table::update_date_size_changed_p): Modified to handle erratum stubs.
102         (Stub_table::do_addralign): Modified to handle erratum stubs.
103         (Stub_table::erratum_stubs_): New member.
104         (Stub_table::erratum_stub_size_): New member.
105         (Stub_table::relocate_stubs): Modified to handle erratum stubs.
106         (Stub_table::do_write): Modified to handle erratum stubs.
107         (AArch64_relobj::The_erratum_stub): New typedef.
108         (AArch64_relobj::Erratum_stub_set_iter): New typedef.
109         (AArch64_relobj::fix_errata): New method.
110         (Target_aarch64::The_reloc_stub_type): Removed.
111         (Target_aarch64::The_erratum_stub): New typede.
112         (AArch64_relocate_functions::construct_b): New method.
113
114 2015-06-08  Nick Clifton  <nickc@redhat.com>
115
116         * po/fr.po: New French Translation.
117
118 2015-06-07  Cary Coutant  <ccoutant@gmail.com>
119
120         PR gold/18288
121         * resolve.cc (symbol_to_bits): Remove type parameter; adjust all
122         callers. Don't use STT_COMMON to check for common symbols.
123         (Symbol_table::resolve): Warn if relocatable object has STT_COMMON
124         symbol that's not in a common section.
125         * symtab.h (Symbol::is_common): Don't use STT_COMMON to check for
126         common symbols.
127
128 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
129
130         PR gold/18200
131         * Makefile.am (diststuff): Add target.
132         * Makefile.in: Regenerate.
133
134 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
135
136         PR gold/17498
137         * object.cc (Sized_relobj_file::do_count_local_symbols): Discard
138         temporary locals in merge sections.
139         * options.cc (General_options::parse_discard_all): New method.
140         (General_options::parse_discard_locals): New method.
141         (General_options::parse_discard_none): New method.
142         (General_options::General_options): Initialize discard_locals_.
143         * options.h (--discard-all): Convert to special option.
144         (--discard-locals): Likewise.
145         (--discard-none): New option.
146         (General_options::discard_all): New method.
147         (General_options::discard_locals): New method.
148         (General_options::discard_sec_merge): New method.
149         (General_options::Discard_locals): New enum.
150         (General_options::discard_locals_): New data member.
151
152 2015-06-03  Cary Coutant  <cary@google.com>
153
154         * script-sections.cc (Script_sections::Script_sections): Initialize
155         segments_created_.
156         (Script_sections::create_note_and_tls_segments): Set flag when
157         segments are created.
158         (Script_sections::expected_segment_count): Count PT_INTERP.
159         (Script_sections::attach_sections_using_phdrs_clause): Set flag when
160         segments are created.
161         * script-sections.h (Script_sections::segments_created_): New data
162         member.
163
164 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
165
166         PR gold/15370
167         * script-sections.cc
168         (Output_section_element_input::set_section_addresses): When there
169         are several patterns with no sort spec, put all sections in the same
170         bin.
171         * testsuite/Makefile.am (script_test_12): New testcase.
172         (script_test_12i): New testcase.
173         * testsuite/Makefile.in: Regenerate.
174         * testsuite/script_test_12.t: New test linker script.
175         * testsuite/script_test_12i.t: New test linker script.
176         * testsuite/script_test_12a.c: New test source file.
177         * testsuite/script_test_12b.c: New test source file.
178
179 2015-06-02  Cary Coutant  <ccoutant@gmail.com>
180
181         * nacl.h (Sniff_file): Switch parameters to get_view to get an
182         aligned view.
183
184 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
185
186         PR gold/17819
187         * gold.cc (queue_final_tasks): When --build-id=tree, queue a
188         separate task to schedule the build id computation.
189         * layout.cc (Hash_task::Hash_task): Remove build_id_blocker,
190         add Output_file and offset.
191         (Hash_task::run): Get and release the input views.
192         (Hash_task::is_runnable): Always return NULL (always runnable).
193         (Layout::queue_build_id_tasks): Remove.
194         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
195         parameters; use them instead of class members.
196         (Build_id_task_runner::run): New function.
197         (Close_task_runner::run): Pass array_of_hashes and size_of_hashes
198         to write_build_id.
199         * layout.h (Layout::queue_build_id_tasks): Remove.
200         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
201         parameters.
202         (Layout::array_of_hashes_): Remove.
203         (Layout::size_of_array_of_hashes_): Remove.
204         (Layout::input_view_): Remove.
205         (Build_id_task_runner): New class.
206         (Close_task_runner::Close_task_runner): Add array_of_hashes and
207         size_of_hashes parameters.
208         (Close_task_runner::array_of_hashes_): New data member.
209         (Close_task_runner::size_of_hashes_): New data member.
210         * testsuite/Makefile.am
211         (flagstest_compress_debug_sections_and_build_id_tree): New test.
212         * testsuite/Makefile.in: Regenerate.
213
214 2015-06-01  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
215
216         * merge.cc (get_input_merge_map): Update for data structure change.
217         (get_or_make_input_merge_map): Update for data structure change.
218         * merge.h (Object_merge_map): Use a std::vector<std::pair>> instead of
219         a std::map. Remove first_shnum_, first_map_, second_shnum_, second_map_.
220
221 2015-05-16  Alan Modra  <amodra@gmail.com>
222
223         * reloc.cc (Sized_relobj_file::find_functions): Use function_location.
224         * powerpc.cc (Target_powerpc::do_calls_non_split): New function.
225         (addi_12_1, addis_2_12, addis_12_1, cmpld_7_12_0): New constants.
226         (lis_0): Rename from lis_0_0.
227
228 2015-04-29  Cary Coutant  <cary@google.com>
229             Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
230
231         * gc.h (Garbage_collection::is_section_garbage): Change Object*
232         to Relobj*.
233         (Garbage_collection::add_reference): Likewise.
234         (Garbage_collection::gc_process_relocs): Likewise. Don't push
235         object/shndx pair onto *secvec for dynamic objects. Don't follow
236         relocations pointing to dynamic objects for GC.
237         * icf.cc (Icf::find_identical_sections): Change Object* to Relobj*.
238         (Icf::unfold_section): Likewise.
239         (Icf::is_section_folded): Likewise.
240         (Icf::get_folded_section): Likewise.
241         * icf.h: (Icf::get_folded_section): Likewise.
242         (Icf::unfold_section): Likewise.
243         (Icf::is_section_folded): Likewise.
244         (Icf::section_has_function_pointers): Likewise.
245         (Icf::set_section_has_function_pointers): Likewise.
246         * object.h (Section_id): Likewise.
247         (Const_section_id): Likewise.
248         * output.cc (Output_section::update_section_layout): Likewise.
249         * output.h: (Output_section_lookup_maps::find_relaxed_input_section):
250         Likewise.
251         * plugin.cc (update_section_order): Likewise.
252         (unique_segment_for_sections): Likewise.
253         * powerpc.cc (Powerpc_relobj::add_reference): Likewise.
254         (Target_powerpc::do_gc_add_reference): Likewise.
255         (Target_powerpc::gc_process_relocs): Likewise.
256         (Target_powerpc::do_gc_add_reference): Likewise.
257         * symtab.cc (Symbol_table::is_section_folded): Likewise.
258         (Symbol_table::gc_mark_symbol): Likewise.
259         * symtab.h: (Symbol_table::is_section_folded): Likewise.
260         * target.h: (Sized_target::gc_add_reference): Likewise.
261         (Sized_target::do_gc_add_reference): Likewise.
262
263 2015-04-29  Nick Clifton  <nickc@redhat.com>
264
265         * po/fi.po: Updated Finnish translation.
266
267 2015-04-28  Alan Modra  <amodra@gmail.com>
268
269         * powerpc.cc (Target_powerpc::do_dynsym_value): Use Address rather
270         than unsigned int for find_global_entry result temp.  Compare
271         against invalid_address.
272         (Target_powerpc::do_plt_address_for_global): Likewise.
273         (Target_powerpc::Relocate::relocate): Likewise.  Don't assert
274         on plt call stub existence for debug info.  Do assert for plt
275         and global entry stub existence if an alloc section.
276
277 2015-04-28  Alan Modra  <amodra@gmail.com>
278
279         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't assert
280         on missing global entry stub due to bogus debug info.
281
282 2015-04-27  Han Shen  <shenhan@google.com>
283
284         * options.h (--fix-cortex-a53-843419): Rename option.
285         * aarch64.cc (AArch64_relobj::do_count_local_symbols): Use renamed
286         option.
287         (AArch64_relobj::scan_sections_for_stubs): Use renamed option.
288
289 2015-04-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
290
291         PR gold/18327
292         * output.cc (Output_section::is_input_address_mapped): Assume a missing
293         entry is mapped.
294         * testsuite/Makefile.am: Add the eh_test test.
295         * testsuite/Makefile.in: Regenerate.
296         * testsuite/eh_test_a.cc: New test.
297         * testsuite/eh_test_b.cc: New test.
298
299 2015-04-23  Sriraman Tallam  <tmsriram@google.com>
300
301         * options.h (--weak-unresolved-symbols): New option.
302         * symtab.cc (Symbol_table::sized_write_globals): Change symbol
303         binding to weak with new option.
304         * symtab.h (is_weak_undefined): Check for new option.
305         (is_strong_undefined): Check for new option.
306         * testsuite/Makefile.am (weak_unresolved_symbols_test): New test.
307         * testsuite/Makefile.in: Regenerate.
308         * testsuite/weak_unresolved_symbols_test.cc: New file.
309
310 2015-04-20  Ian Coolidge  <icoolidge@google.com>
311
312         * symtab.cc (Symbol::should_add_dynsym_entry): Return true for
313         GNU_UNIQUE.
314
315 2015-04-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
316
317         * gc.cc (Garbage_collection::do_transitive_closure): Use back and
318         push_back.
319         * gc.h (Garbage_collection): Use a std::vector instead of a std::queue.
320         * object.cc (Sized_relobj_file::do_layout): Use push_back.
321         * powerpc.cc (process_gc_mark): Use push_back.
322         (Target_powerpc::do_gc_mark_symbol): Use push_back.
323         * symtab.cc (Symbol_table::gc_mark_symbol): Use push_back.
324
325 2015-04-16  Han Shen  <shenhan@google.com>
326
327         * aarch64.cc (AArch64_insn_utilities): New utility class.
328         (AArch64_relobj::Mapping_symbol_position): New struct.
329         (AArch64_relobj::Mapping_symbol_info): New typedef.
330         (AArch64_relobj::do_count_local_symbols): New function overriding
331         parent's implementation.
332         (AArch64_relobj::mapping_symbol_info_): New member
333         (AArch64_relobj::scan_erratum_843419): New method.
334         (Target_aarch64::scan_erratum_843419_span): New method.
335         (Target_aarch64::is_erratum_843419_sequence): New method.
336         * options.h (fix_cortex_a53): New option.
337
338 2015-04-09  Cary Coutant  <ccoutant@google.com>
339
340         * symtab.cc (Symbol::final_value_is_known): Check for TLS symbol
341         in a PIE link.
342         * testsuite/Makefile.am (tls_pie_test.sh): New test.
343         * testsuite/Makefile.in: Regenerate.
344         * testsuite/tls_pie_test.sh: New.
345
346 2015-04-09  Cary Coutant  <ccoutant@google.com>
347
348         * debug.h (DEBUG_LOCATION): New.
349         (DEBUG_ALL): Include DEBUG_LOCATION.
350         (debug_string_to_enum): Add DEBUG_LOCATION.
351         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug
352         output to print correct context.
353         (Sized_dwarf_line_info::do_addr2line): Add debug output. Return
354         up to 4 more locations at the beginning of the function.
355         * symtab.cc (Symbol_table::detect_odr_violations): Get canonical
356         result before sorting list of line numbers.
357         * testsuite/debug_msg.sh: Allow range of line numbers for
358         canonical results on optimized code.
359
360 2015-04-07  HC Yen <hc.yen@mediatek.com>
361
362         Add AArch32 support for gold linker.
363         gold/
364         * arm.cc: Add V8 arch combine table.
365
366 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
367
368         * aarch64.cc (do_reloc_addend): Fix signature to match the parent one.
369
370 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
371
372         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a call
373         to find by using the return value of insert.
374
375 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
376
377         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a copy
378         constructor call.
379
380 2015-04-06  Ilya Tocar  <ilya.tocar@intel.com>
381
382         PR gold/17641
383         * x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
384         (Target_x86_64::Scan::local): Don't create GOT entry, when we
385         can convert mov to lea.
386         (Target_x86_64::Scan::global): Ditto.
387         (Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
388         %reg to lea foo(%rip), %reg if possible.
389         * testsuite/Makefile.am (x86_64_mov_to_lea): New test.
390         * testsuite/x86_64_mov_to_lea1.s: New.
391         * testsuite/x86_64_mov_to_lea2.s: Ditto.
392         * testsuite/x86_64_mov_to_lea3.s: Ditto.
393         * testsuite/x86_64_mov_to_lea4.s: Ditto.
394         * testsuite/x86_64_mov_to_lea.sh: Ditto.
395
396 2015-04-02  H.J. Lu  <hongjiu.lu@intel.com>
397
398         * configure: Regenerated.
399
400 2015-04-01  Ilya Tocar  <ilya.tocar@intel.com>
401
402         PR gold/17640
403         * i386.cc (Target_i386::can_convert_mov_to_lea): New.
404         (Target_i386::Scan::local): Don't create GOT entry, when we
405         can convert GOT to GOTOFF.
406         (Target_i386::Scan::global): Ditto.
407         (Target_i386::Relocate::relocate): Convert  mov foo@GOT(%reg), %reg to
408         lea foo@GOTOFF(%reg), %reg if possible.
409         * testsuite/Makefile.am (i386_mov_to_lea): New test.
410         * testsuite/i386_mov_to_lea1.s: New.
411         * testsuite/i386_mov_to_lea2.s: Ditto.
412         * testsuite/i386_mov_to_lea3.s: Ditto.
413         * testsuite/i386_mov_to_lea4.s: Ditto.
414         * testsuite/i386_mov_to_lea5.s: Ditto.
415         * testsuite/i386_mov_to_lea.sh: Ditto.
416
417 2015-04-01  H.J. Lu  <hongjiu.lu@intel.com>
418
419         * Makefile.am (ZLIB): New.
420         (ZLIBINC): Likewise.
421         (AM_CFLAGS): Add $(ZLIBINC).
422         (AM_CXXFLAGS): Likewise.
423         (ldadd_varldadd_var): Add $(ZLIB).
424         (incremental_dump_LDADD): Likewise.
425         (dwp_LDADD): Likewise.
426         * compressed_output.cc: Don't check HAVE_ZLIB_H to include
427         <zlib.h>.
428         (zlib_compress): Don't check HAVE_ZLIB_H.
429         (zlib_decompress): Likewise.
430         * options.h (compress_debug_sections): Likewise.
431         * configure.ac (AM_CONDITIONAL): Removed.
432         * testsuite/Makefile.am (ZLIB): New.
433         (LDADD): Add $(ZLIB).
434         Don't check HAVE_ZLIB.
435         * Makefile.in: Regenerated.
436         * config.in: Likewise.
437         * configure: Likewise.
438         * testsuite/Makefile.in: Likewise.
439
440 2015-03-30  Jing Yu  <jingyu@google.com>
441
442         * aarch64-reloc.def: New TLSLD_ADD_DTPREL_HI12,
443         TLSLD_ADD_DTPREL_LO12_NC.
444         * aarch64.cc (Target_aarch64::define_tls_base_symbol): Always let
445         _TLS_MODULE_BASE_ point to the start of tls segment.
446         (Target_aarch64::optimize_tls_reloc): Add cases for
447         R_AARCH64_TLSLD_ADD_DTPREL_HI12 and
448         R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
449         (Target_aarch64::Scan::local): Likewise.
450         (Target_aarch64::Scan::global): Likewise.
451         (Target_aarch64::Relocate::relocate): Likewise.
452         (Target_aarch64::Relocate::relocate_tls): Likewise. And remove
453         subtracting tls segment size from symbol value for TLSLD_*_DTPREL
454         relocations.
455
456 2015-03-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
457
458         * merge.cc (Object_merge_map::add_mapping): call
459         Object_merge_map::Input_merge_map::add_mapping.
460         (Object_merge_map::Input_merge_map::add_mapping): New.
461         (Output_merge_data::do_add_input_section): Call
462         get_or_make_input_merge_map before a loop.
463         (Output_merge_string<Char_type>::finalize_merged_data): Call
464         get_or_make_input_merge_map before a loop.
465         * merge.h (Object_merge_map): Make Input_merge_map public.
466         * object.cc (Relobj::add_merge_mapping): Use get_or_create_merge_map.
467         (Relobj::get_or_create_merge_map): New.
468         * object.h (Relobj::get_or_create_merge_map): New.
469
470 2015-03-24  Alan Modra  <amodra@gmail.com>
471
472         PR 18147
473         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
474         relocation errors for branches to strong undefined symbols.
475
476 2015-03-23  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
477
478         * merge.cc (Object_merge_map::get_input_merge_map): Make it const.
479         (Object_merge_map::is_merge_section_for): Remove.
480         (Object_merge_map::find_merge_section): New.
481         * merge.h (Object_merge_map::is_merge_section_for): Remove.
482         (Object_merge_map::find_merge_section): New.
483         (Object_merge_map::get_input_merge_map): Add a const version.
484         * object.cc (Relobj::is_merge_section_for): Remove.
485         (Relobj::find_merge_section): New.
486         * object.h (Relobj::is_merge_section_for): Remove.
487         (Relobj::find_merge_section): New.
488         * output.cc
489         (Output_section::Input_section::is_merge_section_for): Remove.
490         (Output_section::add_merge_input_section): Don't call
491         add_merge_input_section.
492         (Output_section::find_merge_section): Return const. Use
493         object->find_merge_section.
494         (Output_section::build_lookup_maps): Don't build a map for
495         merge sections.
496         (Output_section::is_input_address_mapped): Return false if
497         section is not found.
498         (Output_section::find_starting_output_address): Use
499         find_merge_section instead of is_merge_section_for.
500         (Output_section::add_script_input_section):  Don't build a map for
501         merge sections.
502         * output.h (Output_section_lookup_maps::merge_sections_by_id_): Remove.
503         (Output_section_lookup_maps::find_merge_section): Remove.
504         (Output_section_lookup_maps::add_merge_input_section) Remove.
505         (Output_section::find_merge_section): Return const.
506
507 2015-03-22  Cary Coutant  <cary@google.com>
508
509         PR gold/18106
510         * i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
511         non-SIB form of lea, with nop after the call.
512
513 2015-03-21  Cary Coutant  <cary@google.com>
514
515         PR gold/14217
516         * output.cc (Output_segment::is_first_section_relro): Don't ignore
517         .tdata section.
518         (Output_segment::set_section_addresses): Don't align size of relro
519         segment for .tbss.
520
521 2015-03-21  Cary Coutant  <cary@google.com>
522
523         PR gold/18010
524         * stringpool.cc (Stringpool_template): Don't optimize if section
525         alignment is greater than sizeof(char).
526
527 2015-03-21  Cary Coutant  <cary@google.com>
528
529         PR gold/18048
530         * script-c.h (script_include_directive): Add first_token parameter.
531         * script.cc (script_include_directive): Add first_token parameter, and
532         pass it to read_script_file.
533         * yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
534         (PARSING_MEMORY_DEF): New tokens.
535         (top): Add new productions for INCLUDE files.
536         (file_cmd): Replace file_or_sections_cmd with copy of its productions.
537         Pass PARSING_LINKER_SCRIPT to script_include_directive.
538         (section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
539         (section_cmd): Pass PARSING_SECTION_CMDS.
540         (file_or_sections_cmd): Remove.
541         (memory_def): Pass PARSING_MEMORY_DEF.
542         * testsuite/Makefile.am (memory_test_2): New test.
543         * testsuite/Makefile.in: Regenerate.
544         * testsuite/memory_test_inc.t: New script file.
545         * testsuite/memory_test_inc_1.t.src: New script file.
546         * testsuite/memory_test_inc_2.t.src: New script file.
547         * testsuite/memory_test_inc_3.t.src: New script file.
548
549 2015-03-21  Cary Coutant  <cary@google.com>
550
551         * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
552         (Sized_relobj_dwo::setup): Build compressed section map.
553         (Sized_relobj_dwo::do_decompressed_section_contents): Delete.
554         * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
555         section map.
556         * object.cc (Sized_relobj_file::Sized_relobj_file): Remove
557         compressed_sections_ field.
558         (build_compressed_section_map): Take Object instead of
559         Sized_relobj_file parameter; add decompress_if_needed parameter.
560         (Sized_relobj_file::do_find_special_sections): Store compressed
561         section map in parent Object.
562         (Sized_relobj_file::do_decompressed_section_contents): Move
563         implementation to Object::decompressed_section_contents.
564         (Sized_relobj_file::do_discard_decompressed_sections): Move
565         implementation to Object::discard_decompressed_sections.
566         * object.h (build_compressed_section_map): Declare.
567         (Object::Object): Add compressed_sections_ field.
568         (Object::section_is_compressed): Move implementation here.
569         (Object::decompressed_section_contents): De-virtualize.
570         (Object::discard_decompressed_sections): De-virtualize.
571         (Object::do_section_is_compressed): Delete.
572         (Object::do_decompressed_section_contents): Delete.
573         (Object::set_compressed_sections): New method.
574         (Object::compressed_sections): New method.
575         (Object::compressed_sections_): New data member.
576         (Compressed_section_info, Compressed_section_map): Move to top of file.
577         (Sized_relobj_file::do_section_is_compressed): Delete.
578         (Sized_relobj_file::do_decompressed_section_contents): Delete.
579         (Sized_relobj_file::do_discard_decompressed_sections): Delete.
580         (Sized_relobj_file::compressed_sections_): Move to Object class.
581
582 2015-03-21  Cary Coutant  <ccoutant@google.com>
583
584         PR gold/18152
585         * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
586         deferred objects.
587
588 2015-03-11  Cary Coutant  <ccoutant@google.com>
589
590         * options.cc (General_options::finalize): Don't allow -z relro
591         with incremental linking.
592         * testsuite/Makefile.am (incremental_test): Add -z norelro.
593         (incremental_test_2): Likewise.
594         (incremental_test_3): Likewise.
595         (incremental_test_4): Likewise.
596         (incremental_test_5): Likewise.
597         (incremental_test_6): Likewise.
598         (incremental_copy_test): Likewise.
599         (incremental_common_test_1): Likewise.
600         (incremental_comdat_test_1): Likewise.
601         * testsuite/Makefile.in: Regenerate.
602
603 2015-03-09  Cary Coutant  <ccoutant@google.com>
604
605         PR gold/14675
606         * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
607         return enum indicating whether .eh_frame section is empty, optimizable,
608         unrecognized, or an end marker. Adjust explicit instantiations.
609         * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
610         (Eh_frame::add_ehframe_input_section): Change return type.
611         * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
612         * layout.cc (Layout::layout_eh_frame): Don't add optimized sections
613         to the .eh_frame output section until we see the end marker.
614         (Layout::finalize_eh_frame_section): New.
615         * layout.h: (Layout::finalize_eh_frame_section): New.
616
617 2015-03-05  H.J. Lu  <hongjiu.lu@intel.com>
618
619         * output.cc (Relobj::initialize_input_to_output_map<size>):
620         Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
621
622 2015-03-04  Cary Coutant  <ccoutant@google.com>
623
624         * parameters.cc (Parameters::set_target_once): Call
625         Target::select_as_default_target just once from here...
626         (set_parameters_target): ...instead of from here.
627
628 2015-03-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
629
630         * ehframe.cc (Cie::set_output_offset): Pass in and use a
631         Output_section_data instead of a Merge_map.
632         (Eh_frame::Eh_frame): Don't initialize merge_map_.
633         (Eh_frame::read_cie): Use add_merge_mapping instead of
634         Merge_map::add_mapping.
635         (Eh_frame::read_fde): Ditto.
636         (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
637         (Eh_frame::do_output_offset): Use merge_output_offset istead of
638         merge_map_->get_output_offset.
639         (Eh_frame::do_is_merge_section_for): Delete.
640         * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
641         instead of a Merge_map.
642         (Cie::set_output_offset): Pass in a Output_section_data instead of a
643         Merge_map.
644         (Eh_frame::do_is_merge_section_for): Delete.
645         (Eh_frame::merge_map_): Delete.
646         * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
647         and use a Output_section_data instead of a Merge_map.
648         (Object_merge_map::add_mapping): Ditto.
649         (Object_merge_map::get_output_offset): Remove the merge_map argument.
650         (Object_merge_map::is_merge_section_for): Pass in and use a
651         Output_section_data instead of a Merge_map.
652         (Merge_map): Delete.
653         (Output_merge_base::do_output_offset): Use merge_output_offset instead
654         of merge_map_.get_output_offset.
655         (Output_merge_base::do_is_merge_section_for): Delete.
656         (Output_merge_data::do_add_input_section): Use
657         object->add_merge_mapping instead of add_mapping.
658         (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
659         * merge.h (Merge_map): Delete forward declaration.
660         (Object_merge_map::add_mapping): Pass in and use a Output_section_data
661         instead of a Merge_map.
662         (Object_merge_map::get_output_offset): Remove the merge_map argument.
663         (Object_merge_map::is_merge_section_for): Pass in and use a
664         Output_section_data instead of a Merge_map.
665         (Input_merge_map::Object_merge_map::merge_map): Replace with
666         output_data.
667         (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
668         Output_section_data instead of a Merge_map.
669         (Merge_map): Delete.
670         (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
671         (Output_merge_base::do_is_merge_section_for): Delete.
672         (Output_merge_base::add_mapping): Delete.
673         (Output_merge_base::merge_map_): Delete.
674         * object.cc (Relobj::initialize_input_to_output_map): New.
675         (Relobj::initialize_input_to_output_map): New.
676         (Relobj::merge_output_offset): New.
677         (Relobj::is_merge_section_for): New.
678         (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
679         bits.
680         * object.h (Relobj::merge_map): Delete.
681         (initialize_input_to_output_map): New.
682         (set_merge_map): Delete.
683         (add_merge_mapping): New.
684         (merge_output_offset): New.
685         (is_merge_section_for): New.
686         * output.cc (Output_section::Input_section::is_merge_section_for):
687         Use object->is_merge_section_for.
688         * output.h (Output_section_data::is_merge_section_for): Delete.
689         (Output_section_data::do_is_merge_section_for): Delete.
690         * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
691         Use object->initialize_input_to_output_map.
692         (Merged_symbol_value<size>::value_from_output_section): Use
693         object->merge_output_offset.
694
695 2015-03-02  Peter Collingbourne  <pcc@google.com>
696             Cary Coutant  <ccoutant@google.com>
697
698         * output.cc (Output_section::add_merge_input_section): Do not
699         attempt to merge sections with an entsize of 0.
700
701 2015-03-02  Khem Raj  <raj.khem@gmail.com>
702
703         * attributes.h (class Output_attributes_section_data ): Add
704         do_print_to_mapfile function.
705
706 2015-02-24  Alan Modra  <amodra@gmail.com>
707
708         PR 18010
709         * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
710         complain if value is not a multiple of four.
711         (Target_powerpc::Relocate::relocate): Correct handling of
712         R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
713
714 2015-02-21  H.J. Lu  <hongjiu.lu@intel.com>
715
716         * configure.ac (default_size): Set to 32 for x32.
717         * configure: Regenerated.
718
719 2015-02-18  Alan Modra  <amodra@gmail.com>
720
721         PR 17954
722         * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
723         visibility.
724
725 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
726
727         * gc.h (Garbage_collection::add_reference): Don't use find.
728
729 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
730
731         * object.cc (write_local_symbols): avoid std::vector copy.
732
733 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
734
735         * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
736
737 2015-02-09  Mark Wielaard  <mjw@redhat.com>
738
739         * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
740         DW_LANG_Fortran03 and DW_LANG_Fortran08.
741
742 2015-02-16  Cary Coutant  <ccoutant@google.com>
743
744         PR gold/13577
745         PR gold/16992
746         * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
747         DF_SYMBOLIC if --dynamic-list option is used.
748         * options.cc (General_options::finalize): --dynamic-list is not
749         mutually exclusive with -Bsymbolic.
750         * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
751         listed in --dynamic-list.
752         * testsuite/Makefile.am (dynamic_list_lib2.so): Add
753         -Bsymbolic-functions.
754         * testsuite/Makefile.in: Regenerate.
755
756 2015-02-16  Cary Coutant  <ccoutant@google.com>
757
758         PR gold/17971
759         * incremental.cc: Remove redundant include of "output.h".
760
761 2015-02-12  Jing Yu  <jingyu@google.com>
762
763         * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
764         TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
765         New relocation.
766         * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
767         TLSLE_MOVW_* relocations.
768         (Target_aarch64::Scan::global): Likewise.
769         (Target_aarch64::Relocate::relocate): Likewise.
770         (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
771         for new TLSLE_MOVW_* relocations.
772
773 2015-02-11  Will Newton  <will.newton@linaro.org>
774
775         PR gold/13321
776         * arm.cc (Target_arm::make_plt_section): Create an ARM
777         state mapping symbol at the start of the PLT.
778
779 2015-02-09  H.J. Lu  <hongjiu.lu@intel.com>
780
781         * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
782         Replace two_file_shared_2.so with two_file_shared_1.so.
783         * testsuite/Makefile.in: Regenerated.
784
785 2015-02-09  Alan Modra  <amodra@gmail.com>
786
787         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
788         plugin_test_thin.a and defsym_test.
789         * testsuite/Makefile.in: Regenerate.
790
791 2015-02-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
792
793         * merge.cc (do_add_input_section): Combine loop epilogue into main loop
794         body.
795
796 2015-02-04  Peter Collingbourne  <pcc@google.com>
797
798         * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
799         forwarding symbols when computing symbol resolution info for plugins.
800         * plugin.h (Plugin_manager::symtab): New method.
801         (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
802
803 2015-02-03  Cary Coutant  <ccoutant@google.com>
804             Peter Collingbourne  <pcc@google.com>
805
806         PR gold/15660
807         * archive.cc (Thin_archive_object_unlocker): New class.
808         (Archive::include_member): Unlock external members of thin archives.
809         * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
810         (plugin_test_2): Likewise.
811         (plugin_test_3): Likewise.
812         (plugin_test_4): Likewise.
813         (plugin_test_5): Likewise.
814         (plugin_test_6): Likewise.
815         (plugin_test_7): Likewise.
816         (plugin_test_8): Likewise.
817         (plugin_test_9): Likewise.
818         (plugin_test_10): Likewise.
819         (plugin_test_11): New test case.
820         * testsuite/Makefile.in: Regenerate.
821         * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
822         file to decide whether to claim file.
823         (all_symbols_read_hook): Likewise.
824         * testsuite/plugin_test_1.sh: Adjust expected output.
825         * testsuite/plugin_test_2.sh: Likewise.
826         * testsuite/plugin_test_3.sh: Likewise.
827         * testsuite/plugin_test_6.sh: Likewise.
828         * testsuite/plugin_test_tls.sh: Likewise.
829         * testsuite/plugin_test_11.sh: New testcase.
830
831 2015-02-03  Cary Coutant  <ccoutant@google.com>
832
833         * descriptors.cc (Descriptors::open): Set artificially-low limit for
834         file descriptors when debugging enabled. Add debug output.
835         (Descriptors::release): Add debug output.
836         (Descriptors::close_some_descriptor): Likewise.
837         (Descriptors::close_all): Likewise.
838         * fileread.cc (File_read::lock): Likewise.
839         (File_read::unlock): Likewise.
840
841 2015-02-02  Cary Coutant  <ccoutant@google.com>
842
843         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
844         executable output file.
845
846 2015-01-22  Han Shen  <shenhan@google.com>
847
848         * arm.cc (Target_arm::Target_arm): Add initialization for new members.
849         (Target_arm::do_plt_address_for_global): New method.
850         (Target_arm::do_plt_address_for_local): New method.
851         (Target_arm::rel_irelative_section): New method.
852         (Target_arm::make_data_plt): Add more parameters for plt ctor.
853         (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
854         (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
855         (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
856         (Target_arm::Scan::check_non_pic): Add ifunc support.
857         (Target_arm::Scan::local): Add ifunc support.
858         (Target_arm::Scan::global): Add ifunc support.
859         (Target_arm::make_plt_section): New method.
860         (Target_arm::make_plt_entry): Change to call to make_plt_section.
861         (Target_arm::make_local_ifunc_plt_entry): New method.
862         (Target_arm::got_irelative_): New member.
863         (Target_arm::rel_irelative_): New member.
864         (Target_arm::got_section): Add creation for got_irelative_.
865         (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
866         (Target_arm::Relocate::relocate): Properly set local ifunc address.
867         (Target_arm::do_dynsym_value): Properly set global ifunc address.
868         (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
869         (Output_data_plt_arm::IRelative_data): New type.
870         (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
871         (Output_data_plt_arm::add_entry): Add more parameters.
872         (Output_data_plt_arm::add_relocation): New method.
873         (Output_data_plt_arm::add_local_ifunc_entry): New method.
874         (Output_data_plt_arm::rel_irelative): New method.
875         (Output_data_plt_arm::entry_count): Modified.
876         (Output_data_plt_arm::address_for_global): New method.
877         (Output_data_plt_arm::address_for_local): New method.
878 gold/
879         (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
880         (Output_data_plt_arm::insert_irelative_data): New method.
881         (Output_data_plt_arm::irelative_rel_): New member.
882         (Output_data_plt_arm::got_): New member.
883         (Output_data_plt_arm::got_irelative_): New member.
884         (Output_data_plt_arm::irelative_count_): New member.
885         (Output_data_plt_arm::IRelative_data_vec): New typedef.
886         (Output_data_plt_arm::irelative_data_vec_): New member.
887         (Output_data_plt_arm::do_write): Write out irelative entries.
888         (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
889         more parameters to ctor.
890         (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
891         more parameters to ctor.
892         * output.h (Output_data_reloc::add_local_relative): New method.
893         * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
894
895 2015-01-29  Alan Modra  <amodra@gmail.com>
896
897         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
898         and GOT_TLSGD to LE optimization.
899
900 2015-01-28  Cary Coutant  <ccoutant@google.com>
901
902         * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
903         for undef TLS symbols.
904         (Target_x86_64::Relocate::relocate_tls): Likewise.
905         (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
906
907 2015-01-25  Cary Coutant  <ccoutant@google.com>
908
909         * output.cc (Output_segment::set_section_addresses): Fix calculation
910         of size of relro segment.
911
912 2015-01-22  Alan Modra  <amodra@gmail.com>
913
914         * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
915         condition for need of ifunc plt entry.
916         (Target_powerpc::Scan::global <got relocs>): Likewise.
917
918 2015-01-14  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
919
920         * mips.cc (reloc_high): Add r_sym.
921         (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
922         reloc_high constructor.
923         (Mips_relocate_functions::relgot16_local): Likewise.
924         (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
925         r_type to decide whether LO16 matches HI16.
926         (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
927         rello16 and relgot16_local.
928
929 2015-01-09  Cary Coutant  <ccoutant@google.com>
930
931         * layout.cc (Layout::set_segment_offsets): Don't align start of segment
932         unless alignment is larger than page size.
933
934 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
935             Cary Coutant  <ccoutant@google.com>
936
937         PR gold/17729
938         * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
939         (DEFAULT_TARGET_X32): Set for x32.
940         * x86_64.cc (cmp_insn_32): New.
941         (lea_r10_insn_32): Likewise.
942         (lea_r11_insn_32): Likewise.
943         (cmp_insn_64): Likewise.
944         (lea_r10_insn_64): Likewise.
945         (lea_r11_insn_64): Likewise.
946         (Target_x86_64<size>::do_calls_non_split): Handle x32.
947         * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
948         (check_DATA): Add split_x32 files.
949         (split_x32_[1234n].o): New targets.
950         (split_x32_[124]): New targets.
951         (split_x32_[1234r].stdout): New targets.
952         * testsuite/split_x32.sh: New file.
953         * testsuite/split_x32_1.s: Likewise.
954         * testsuite/split_x32_2.s: Likewise.
955         * testsuite/split_x32_3.s: Likewise.
956         * testsuite/split_x32_4.s: Likewise.
957         * testsuite/split_x32_n.s: Likewise.
958         * configure: Regenerated.
959         * testsuite/Makefile.in: Likewise.
960
961 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
962
963         PR gold/17809
964         * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
965         x32.
966
967 2015-01-02  Alan Modra  <amodra@gmail.com>
968
969         * version.cc (print_version): Just print current year.
970         * dwp.cc (print_version): Likewise.
971
972 2015-01-01  Alan Modra  <amodra@gmail.com>
973
974         Update year range in copyright notice of all files.
975
976 2014-12-25  Alan Modra  <amodra@gmail.com>
977
978         * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
979         new enums.
980         (Target_arm::merge_object_attributes, ): Likewise.
981
982 2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
983
984         * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
985         as hard float only when Tag_ABI_VFP_args is 1, using new enum value
986         AEABI_VFP_args_vfp to check that.
987         (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
988         value and replace hardcoded values by enum values.
989
990 2014-12-22  Cary Coutant  <ccoutant@google.com>
991
992         * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
993
994 2014-12-20  H.J. Lu  <hongjiu.lu@intel.com>
995
996         PR gold/14608
997         * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
998         to "return i * i * 3;".
999
1000 2014-12-16  Cary Coutant  <ccoutant@google.com>
1001
1002         * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
1003         (Mapfile::print_output_data): Use current_data_size() to avoid
1004         assert for sections requiring postprocessing; if address is not valid,
1005         print 0.
1006         (Mapfile::print_output_section): Use current_data_size(); print note
1007         that addresses and sizes are before compression.
1008
1009 2014-12-14  H.J. Lu  <hongjiu.lu@intel.com>
1010
1011         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1012         Cast current_group_size to unsigned long when reporting error.
1013
1014 2014-12-10  Jing Yu  <jingyu@google.com>
1015
1016         * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
1017         (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
1018         Update error message.
1019         (Target_aarch64::do_relax): Use absolute value of option
1020         stub_group_size. Replace local variable with class member
1021         stub_group_size_.
1022
1023 2014-12-04  Alan Modra  <amodra@gmail.com>
1024
1025         * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
1026         addend of PLTREL24 reloc when not generating a plt stub.  Make
1027         max_branch_offset an "Address".
1028         (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
1029         (Target_powerpc::Relocate::relocate): Likewise.
1030
1031 2014-12-04  Alan Modra  <amodra@gmail.com>
1032
1033         PR 17670
1034         * symtab.cc (Symbol::set_undefined): Remove assertion.
1035         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1036         on symbols defined in discarded sections, instead return false.
1037         Rearrange params, update all callers.
1038         (Target_powerpc::Branch_info::make_stub): Don't make stubs for
1039         branches to syms in discarded sections.
1040         (Global_symbol_visitor_opd::operator()): Set discarded opd syms
1041         undefined and flag as discarded.
1042         (Target_powerpc::Relocate::relocate): Localize variable.
1043
1044 2014-12-03  H.J. Lu  <hongjiu.lu@intel.com>
1045
1046         PR gold/17675
1047         * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
1048         * testsuite/Makefile.in: Regenerated.
1049
1050 2014-12-03  Alan Modra  <amodra@gmail.com>
1051
1052         PR 17566
1053         * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
1054         when adding dynamic relocations against section symbols.
1055
1056 2014-12-01  Dimitry Ivanov <dimitry@google.com>
1057
1058         * layout.cc (Layout::finish_dynamic_section): When '-z global'
1059         is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
1060         * options.h (General_options): New -z option (global).
1061
1062 2014-12-01  Cary Coutant  <ccoutant@google.com>
1063
1064         PR gold/17578
1065         * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
1066         is given.
1067         (Layout::create_executable_stack_info): Warn when -z noexecstack is
1068         given but some inputs require executable stack.
1069
1070 2014-11-26  Cary Coutant  <ccoutant@google.com>
1071
1072         * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
1073         .debug_str_offsets; strip .debug_gnu_pubnames and
1074         .debug_gnu_pubtypes.
1075         (lines_only_debug_sections): Strip all four new sections.
1076
1077 2014-11-26  Jing Yu  <jingyu@google.com>
1078
1079         * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
1080         register to be x0 when to relax TLSDESC_LD64_LO12.
1081
1082 2014-11-26  Alan Modra  <amodra@gmail.com>
1083
1084         * powerpc.cc (struct Stub_table_owner): New.
1085         (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
1086         unsigned int vector.  Update all references.
1087         (powerpc_relobj::set_stub_table): Take an unsigned int param
1088         rather than a Stub_table.  Update callers.
1089         (Powerpc_relobj::clear_stub_table): New function.
1090         (Target_powerpc): Add relax_failed_, relax_fail_count_ and
1091         stub_group_size_ vars.
1092         (Target_powerpc::new_stub_table): Delete.
1093         (max_branch_delta): New function, extracted from..
1094         (Target_powerpc::Relocate::relocate): ..here..
1095         (Target_powerpc::Branch_info::make_stub): ..and here.  Return
1096         status on whether stub created successfully.
1097         (Stub_control::Stub_control): Add "no_size_errors" param.  Move
1098         default sizing to..
1099         (Target_powerpc::do_relax): ..here.  Init stub_group_size_ and
1100         reduce on relax failure.
1101         (Target_powerpc::group_sections): Add "no_size_errors" param.
1102         Use stub_group_size_.  Set up group info in a temp vector,
1103         before building Stub_table vector.  Account for input sections
1104         possibly already converted to relaxed sections.
1105         (Stub_table::init): Delete.  Merge into..
1106         (Stub_table::Stub_table): ..here.
1107         (Stub_table::can_reach_stub): New function.
1108         (Stub_table::add_plt_call_entry): Add "from" parameter and
1109         return true iff stub could be reached.
1110         (Stub_table::add_long_branch_entry): Similarly.  Add "r_type"
1111         param too.
1112         (Stub_table::clear_stubs): Add "all" param.
1113
1114 2014-11-26  Alan Modra  <amodra@gmail.com>
1115
1116         * powerpc.cc (Stub_control::set_output_and_owner): New function.
1117         (Target_powerpc::group_sections): Use it.
1118
1119 2014-11-25  Cary Coutant  <ccoutant@google.com>
1120
1121         * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
1122         (Binary_to_elf::write_symbol): Add st_size parameter.
1123         * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
1124
1125 2014-11-25  Cary Coutant  <ccoutant@google.com>
1126
1127         PR gold/17639
1128         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
1129         (Sized_relobj_file::do_layout): Handle deferred sections properly
1130         during GC pass 1. Don't add reloc sections to deferred list twice.
1131         * object.h (Sized_relobj_file::is_deferred_layout): New function.
1132         (Sized_relobj_file::is_deferred_layout_): New data member.
1133
1134 2014-11-21  H.J. Lu  <hongjiu.lu@intel.com>
1135
1136         PR gold/17619
1137         * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
1138         Check PC-relative offset overflow in PLT entry.
1139
1140 2014-11-21  Alan Modra  <amodra@gmail.com>
1141
1142         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
1143         for undefined weaks.
1144
1145 2014-11-20  Alan Modra  <amodra@gmail.com>
1146
1147         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
1148         from --stub-group-size parameter divided by 1024.
1149         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
1150         template parameter.  Update all uses.
1151         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
1152         has_stub_value.  Set for long branches.  Don't report overflow for
1153         branch to undefined weak symbols.  Print info message on
1154         overflowing branch to stub.
1155
1156 2014-11-20  Alan Modra  <amodra@gmail.com>
1157
1158         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
1159
1160 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
1161
1162         * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
1163         entry for R_X86_64_GOTPLT64.
1164         (Target_x86_64<size>::Relocate::relocate): Update comments for
1165         R_X86_64_GOTPLT64.
1166
1167 2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>
1168
1169         * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
1170         * plugin.h: add lock definition
1171
1172 2014-10-29  Han Shen  <shenhan@google.com>
1173             Jing Yu   <jingyu@google.com>
1174
1175         * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
1176         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1177         TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
1178         Symbol::TLS_REF.
1179         * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
1180         method.
1181         (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
1182         (Target_aarch64::tls_ld_to_le): New method.
1183         (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
1184         for 64bit targets.
1185         (Output_data_plt_aarch64::irelative_rel_): New data member.
1186         (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
1187         (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
1188         (Output_data_plt_aarch64::add_relocation): New method.
1189         (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
1190         offset. Add got_irelative size to got size.
1191         (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
1192         type string with the new typename.
1193         (AArch64_relocate_functions::update_adr): Replace parameter x with
1194         immed.
1195         (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
1196         (AArch64_relocate_functions::reloc_common): New method.
1197         (AArch64_relocate_funcsions::rela_general): Extract common part out
1198         into reloc_common method.
1199         (AArch64_relocate_functions::rela_general): Likewise.
1200         (AArch64_relocate_functions::pcrela_general): Likewise.
1201         (AArch64_relocate_functions::adr): New method.
1202         (AArch64_relocate_functions::adrp): Calculate immed before calling
1203         update_adr.
1204         (AArch64_relocate_functions::adrp): Likewise.
1205         (AArch64_relocate_functions::movnz): Cast x to SignedW type when
1206         comparing x to 0. Calculate immed from ~x when x < 0.
1207         (Target_aarch64::optimize_tls_reloc): Add new cases for
1208         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1209         TLSLD_MOVW_DTPREL_G0_NC.
1210         (Target_aarch64::possible_function_pointer_reloc): Implement this
1211         method.
1212         (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
1213         comment.
1214         (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
1215         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1216         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1217         (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
1218         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1219         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1220         (Target_aarch64::make_plt_entry): Call add_entry with two more
1221         parameters.
1222         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1223         (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
1224         ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1225         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1226         (Target_aarch64::Relocate::relocate_tls): Add cases for
1227         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1228         TLSLD_MOVW_DTPREL_G0_NC.
1229         * testsuite/icf_safe_so_test.cc: Correct test comment.
1230         * testsuite/icf_safe_test.sh: Add AArch64 arch.
1231
1232 2014-10-22  Alan Modra  <amodra@gmail.com>
1233
1234         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
1235         thread_starter.
1236
1237 2014-10-18  Andreas Schwab  <schwab@linux-m68k.org>
1238
1239         * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
1240
1241 2014-10-17  Cary Coutant  <ccoutant@google.com>
1242
1243         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1244         Add "typename" keyword.
1245
1246 2014-10-15  Han Shen  <shenhan@google.com>
1247             Jing Yu   <jingyu@google.com>
1248
1249         Patch for gold aarch64 backend to support relaxation.
1250         * aarch64-reloc.def: Change format.
1251         * aarch64.cc (class Reloc_stub): New class.
1252         (class Stub_table): New class.
1253         (class AArch64_relobj): New class.
1254         (class AArch64_input_section): New class.
1255         (class AArch64_output_section): New class.
1256         (Target_aarch64::new_stub_table): New method.
1257         (Target_aarch64::new_aarch64_input_section): New method.
1258         (Target_aarch64::find_aarch64_input_section): New method.
1259         (Target_aarch64::scan_section_for_stubs): New method.
1260         (Target_aarch64::scan_reloc_section_for_stubs): New method.
1261         (Target_aarch64::relocate_stub): New method.
1262         (Target_aarch64::current_target): New method.
1263         (Target_aarch64::do_make_elf_object): New method.
1264         (Target_aarch64::do_may_relax): New method.
1265         (Target_aarch64::do_relax): New method.
1266         (Target_aarch64::group_sections): New method.
1267         (Target_aarch64::scan_reloc_for_stub): New method.
1268         (Target_aarch64::do_make_output_section): New method.
1269         (Target_aarch64::stub_tables_): New data member.
1270         (Target_aarch64::aarch64_input_section_map_): New data member.
1271         (AArch64_relocate_functions::maybe_apply_stub): New method.
1272
1273 2014-09-30  Cary Coutant  <ccoutant@google.com>
1274
1275         PR gold/17432
1276         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
1277
1278 2014-09-30  Kito Cheng  <kito@0xlab.org>
1279
1280         PR gold/13597
1281         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
1282         hash table before sysv-style hash table.
1283
1284 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
1285
1286         * options.h (--pic-executable): Add negative to alias to -no-pie.
1287
1288 2014-09-26  Cary Coutant  <ccoutant@google.com>
1289
1290         PR gold/16773
1291         * object.cc (Sized_relobj_file): Compute value of section symbols
1292         for TLS sections the same as TLS symbols.
1293
1294 2014-09-25  Cary Coutant  <ccoutant@google.com>
1295
1296         PR gold/17432
1297         * resolve.cc (Symbol_table::resolve): Override common placeholder
1298         symbols, but adjust sizes.
1299         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
1300         symbols to common lists.
1301
1302 2014-09-24  Alan Modra  <amodra@gmail.com>
1303
1304         * po/POTFILES.in: Regenerate.
1305
1306 2014-09-23  Taiju Tsuiki  <tzik@google.com>
1307             Cary Coutant  <ccoutant@google.com>
1308
1309         PR gold/14860
1310         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
1311         on input_sections_blocker.
1312         * layout.cc (Write_sections_task::locks): Unblock
1313         input_sections_blocker_.
1314         * layout.h (Write_sections_task::Write_sections_task): Add
1315         input_sections_blocker.
1316         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
1317         to DEPENDENCIES.
1318         * testsuite/Makefile.in: Regenerate.
1319
1320 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1321
1322         * testsuite/Makefile.am (plugin_test_10): New test.
1323         * testsuite/Makefile.in: Regenerate
1324         * testsuite/plugin_common_test_2.c (c1): Align to 8.
1325         * testsuite/plugin_test_10.sh: New file.
1326
1327 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1328
1329         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
1330         * resolve.cc (Symbol_table::resolve): Don't override common symbols
1331         during the replacement phase.
1332
1333 2014-09-17  Han Shen  <shenhan@google.com>
1334             Jing Yu  <jingyu@google.com>
1335
1336         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
1337         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
1338         * aarch64.cc (Target_aarch64): Add data members
1339         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
1340         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
1341         constructor.
1342         (Target_aarch64::do_reloc_symbol_index): New method.
1343         (Target_aarch64::do_reloc_addend): New method.
1344         (Target_aarch64::add_tlsdesc_info): New method.
1345         (Target_aarch64::do_dynsym_value): New method.
1346         (Target_aarch64::do_make_data_plt): Add new parameters: got,
1347         got_irelative. Pass them to Output_data_plt_aarch64_standard.
1348         (Target_aarch64::make_data_plt): Add new parameters: got,
1349         got_irelative. Pass them to do_make_data_plt.
1350         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
1351         (Target_aarch64::Relocate:tls_gd_to_le): New method.
1352         (Target_aarch64::Relocate:tls_ie_to_le): New method.
1353         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
1354         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
1355         (Target_aarch64::got_tlsdesc_section): New method.
1356         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1357         (Target_aarch64::define_tls_base_symbol): New method.
1358         (Target_aarch64::reserve_tlsdesc_entries): New method.
1359         (Target_aarch64::got_mod_index_entry): New method.
1360         (Target_aarch64::rela_tlsdesc_section): New method.
1361         (Target_aarch64::rela_irelative_section): New method.
1362         (Target_aarch64::Tlsdesc_info): New struct.
1363         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
1364         relocations and tlsdesc relocations.
1365         (Target_aarch64::optimize_tls_reloc): Implement method.
1366         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
1367         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
1368         in constructor.
1369         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
1370         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
1371         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
1372         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
1373         (Output_data_plt_aarch64::rela_tlsdesc): New method.
1374         (Output_data_plt_aarch64::rela_irelative): New method.
1375         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
1376         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
1377         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
1378         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
1379         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
1380         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
1381         (Output_data_plt_aarch64_standard): New member variables:
1382         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
1383         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
1384         New parameter: got, got_irelative.
1385         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
1386         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
1387         (Output_data_plt_aarch64::do_write): Replace got_address with
1388         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
1389         (AArch64_relocate_functions::update_movnz): New method.
1390         (AArch64_relocate_functions): Correct format.
1391         (AArch64_relocate_functions::movnz): New method.
1392         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
1393         before the switch. Add new cases to switch.
1394         Check ie_to_le relaxation on tlsie relocations. Add code handling
1395         tlsgd tlsdesc cases.
1396         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
1397         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
1398         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
1399         Call reloc_name_in_error_message to print unsupported reloc.
1400         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
1401         make_data_plt.
1402         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
1403         relocs. Fill in some more dynamic tags.
1404         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
1405         Skip call tls_get_addr when tlsgd is relaxed.
1406         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
1407         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
1408         tlsdesc->ie relaxation.
1409
1410 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1411
1412         * mips.cc (Target_mips_nacl): New class.
1413         (Target_selector_mips_nacl): New class.
1414         (target_selector_mips32): Rename from target_selector_mips32be and use
1415         Target_selector_mips_nacl instead of Target_selector_mips.
1416         (target_selector_mips32el): Rename from target_selector_mips32 and use
1417         Target_selector_mips_nacl instead of Target_selector_mips.
1418         (target_selector_mips64): Rename from target_selector_mips64be and use
1419         Target_selector_mips_nacl instead of Target_selector_mips.
1420         (target_selector_mips64el): Rename from target_selector_mips64 and use
1421         Target_selector_mips_nacl instead of Target_selector_mips.
1422         (Target_mips::mips_info): Add const attribute.
1423
1424 2014-09-02  Cary Coutant  <ccoutant@google.com>
1425
1426         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
1427         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
1428         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
1429         (Sized_incr_dynobj::do_section_name): Likewise.
1430         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
1431         (Sized_incr_dynobj::do_section_name): Likewise.
1432         * object.h (Object::section_name): Likewise.
1433         (Object::do_section_name): Likewise.
1434         (Sized_relobj_file::do_section_name): Likewise.
1435         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
1436         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
1437
1438 2014-09-02  Cary Coutant  <ccoutant@google.com>
1439
1440         PR gold/17005
1441         * ehframe.cc (Fde::write): Add output_offset parameter.
1442         (Cie::write): Likewise.
1443         (Eh_frame::set_final_data_size): Account for offset within output
1444         section.
1445         (Eh_frame::do_sized_write): Likewise.
1446         * ehframe.h (Fde::write): Add output_offset parameter.
1447         (Cie::write): Likewise.
1448         * output.cc (Output_section::Input_section_sort_entry): Remove
1449         section_has_name_; add output_section_name parameter. Use
1450         output section name for non-input sections.
1451         (Output_section::Input_section_sort_entry::section_has_name): Remove.
1452         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
1453         (Output_section::Input_section_sort_compare): Remove logic for
1454         sections without names.
1455         (Output_section::Input_section_sort_init_fini_compare): Likewise.
1456         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
1457         Likewise.
1458         (Output_section::Input_section_sort_section_name_compare): Likewise.
1459
1460 2014-08-29 Han Shen <shenhan@google.com>
1461            Jing Yu <jingyu@google.com>
1462
1463         * aarch64-reloc-property.cc
1464         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
1465         reference reloc property in the table.
1466         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
1467         3 other entries.
1468         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
1469         2 new overloaded methods.
1470         (Output_data_got_aarch64::do_write): Add code to write out
1471         static relocs.
1472         (class Output_data_got_aarch64::Static_reloc): New class to wrap
1473         static relocs.
1474         (Output_data_got_aarch64::static_relocs): New vector to
1475         hold static relocs.
1476         (Target_aarch64::TCB_SIZE): New const static memeber.
1477         (Target_aarch64::tcb_size): New method.
1478         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
1479         (Target_aarch64::Relocate::relocate_tls): New method.
1480         (Target_aarch64::Scan::local): Add code handling new reloc types.
1481         (Target_aarch64::Scan::global): Add code handling new reloc types.
1482
1483 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
1484
1485         * options.h (-no-pie): Add option.
1486
1487 2014-08-08  Jing Yu  <jingyu@google.com>
1488             Han Shen  <shenhan@google.com>
1489
1490         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
1491         (DEFFILES): add aarch64-reloc.def.
1492         (TARGETSOURCES): Add aarch64-reloc-property.cc.
1493         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
1494         * Makefile.in: Regenerate.
1495         * aarch64-reloc-property.cc: New file.
1496         * aarch64-reloc-property.h: New file.
1497         * aarch64-reloc.def: New file.
1498         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
1499         with tab to make the format consistent.
1500         (Output_data_got_aarch64::symbol_table_): New method.
1501         (Target_aarch64::do_plt_address_for_global): New method.
1502         (Target_aarch64::do_plt_address_for_local): New method.
1503         (Target_aarch64::do_select_as_default_target): New method.
1504         (Target_aarch64::do_make_data_plt): New method.
1505         (Target_aarch64::make_data_plt): New method.
1506         (Output_data_plt_aarch64::has_irelative_section): New method.
1507         (Output_data_plt_aarch64::address_for_global): New method.
1508         (Output_data_plt_aarch64::address_for_local): New method.
1509         (Output_data_plt_aarch64::irelative_rel_): New parameter.
1510         (Output_data_plt_aarch64::add_entry): Implement contents.
1511         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
1512         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
1513         the got_pov entry to plt0.
1514         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
1515         Implement contents.
1516         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
1517         (AArch64_howto): New struct.
1518         (aarch64_howto[]): New static const array.
1519         (AArch64_relocate_functions): New class.
1520         (Target_aarch64::Scan::get_reference_flags): Remove method.
1521         (Target_aarch64::Scan::local): Implement to support a few relocations.
1522         (Target_aarch64::Scan::global): Implement to support a few relocations.
1523         (Target_aarch64::make_plt_section): Implement contents.
1524         (Target_aarch64::make_plt_entry): Implement contents.
1525         (Target_aarch64::do_finalize_sections): Implement contents.
1526         (Target_aarch64::Relocate::relocate): Implement a few relocations.
1527         (Target_aarch64::relocate_section): Implement contents.
1528
1529 2014-08-06  Alan Modra  <amodra@gmail.com>
1530
1531         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
1532
1533 2014-08-06  Alan Modra  <amodra@gmail.com>
1534
1535         PR 13227
1536         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
1537
1538 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
1539
1540         * object.cc (Relobj::is_section_name_included): Add
1541         ".rodata.nptl_version" to not garbage collect this section.
1542
1543 2014-07-08  Cary Coutant  <ccoutant@google.com>
1544
1545         * expression.cc (struct Expression::Expression_eval_info): Add
1546         new fields type_pointer, vis_pointer, and nonvis_pointer.
1547         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
1548         nonvis_pointer parameters. Adjust all calls.
1549         (Symbol_expression::value): Update type, visibility, and nonvis bits
1550         in caller.
1551         * script.cc (Symbol_assignment::sized_finalize): Update type,
1552         visibility, and remaining st_other bits for new symbol.
1553         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
1554         vis_pointer, and nonvis_pointer parameters.
1555         * symtab.h (Symbol::set_type): New method.
1556
1557         * testsuite/Makefile.am (defsym_test): New test.
1558         * testsuite/Makefile.in: Regenerate.
1559         * testsuite/defsym_test.c: New file.
1560         * testsuite/defsym_test.sh: New file.
1561
1562 2014-07-08  Cary Coutant  <ccoutant@google.com>
1563
1564         PR gold/15639
1565         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
1566         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
1567         (Sized_dynobj::base_read_symbols): ...new method.
1568         * object.h (Sized_relobj_file::base_read_symbols): New method.
1569         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
1570         (Sized_relobj_file::base_read_symbols): ...new method.
1571         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
1572         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
1573         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
1574
1575 2014-07-04  Alan Modra  <amodra@gmail.com>
1576
1577         * po/POTFILES.in: Regenerate.
1578
1579 2014-07-02  Jing Yu  <jingyu@google.com>
1580
1581         * aarch64.cc: New file
1582         * Makefile.am (TARGETSOURCES): Add aarch64.cc
1583         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
1584         * Makefile.in: Regenerate.
1585         * configure.tgt: Add entries for aarch64*.
1586         * configure.ac:  Likewise.
1587         * configure: Likewise.
1588
1589 2014-06-27  Alan Modra  <amodra@gmail.com>
1590
1591         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
1592
1593 2014-06-24  Cary Coutant  <ccoutant@google.com>
1594
1595         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
1596         sections.
1597         (Dwo_file::sized_read_unit_index): Likewise.
1598
1599 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1600
1601         * mips.cc: New file.
1602         * Makefile.am (TARGETSOURCES): Add mips.cc
1603         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
1604         * configure.tgt: Add entries for mips*.
1605         * configure.ac: Likewise.
1606         * Makefile.in: Regenerate.
1607         * configure: Likewise.
1608
1609 2014-06-09  Cary Coutant  <ccoutant@google.com>
1610
1611         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
1612         unit_length is within section bounds.
1613
1614 2014-06-09  Cary Coutant  <ccoutant@google.com>
1615
1616         PR gold/16980
1617         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
1618         map.
1619
1620 2014-06-07  Alan Modra  <amodra@gmail.com>
1621
1622         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
1623
1624 2014-06-06  Cary Coutant  <ccoutant@google.com>
1625
1626         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
1627         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
1628         (Dwarf_pubnames_table::read_header): Likewise.
1629         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
1630         .debug_gnu_pubtypes.
1631
1632 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
1633
1634         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
1635         * Makefile.in, configure: Regenerate.
1636
1637 2014-06-03  Alan Modra  <amodra@gmail.com>
1638
1639         * powerpc.cc (addis_12_2): Define.
1640         (Stub_table::do_write): Support fusion on ELFv2 stubs.
1641
1642 2014-06-03  Alan Modra  <amodra@gmail.com>
1643
1644         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
1645         st_other output.
1646
1647 2014-06-02  Alan Modra  <amodra@gmail.com>
1648
1649         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
1650         Only ignore relocs on ELFv1.
1651         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
1652
1653 2014-05-30  Cary Coutant  <ccoutant@google.com>
1654
1655         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
1656         * testsuite/Makefile.in: Regenerate.
1657         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
1658
1659 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
1660
1661         PR gold/16945
1662         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
1663         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
1664
1665 2014-05-15  Alan Modra  <amodra@gmail.com>
1666
1667         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
1668         Compare FDE contents with DW_CFA_nop rather than 0.
1669
1670 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
1671
1672         * symtab.h (may_need_copy_reloc): Remove check for position independent
1673         code.
1674         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
1675         position independence before pc absolute may_need_copy_reloc call.
1676         Add check for executable output befor pc relative may_need_copy_reloc
1677         call.
1678         * i386.cc: Ditto.
1679         * arm.cc: Ditto.
1680         * sparc.cc: Ditto.
1681         * tilegx.cc: Ditto.
1682         * powerpc.cc: Add check for no position independence before
1683         may_need_copy_reloc calls.
1684         * testsuite/pie_copyrelocs_test.cc: New file.
1685         * testsuite/pie_copyrelocs_shared_test.cc: New file.
1686         * Makefile.am (pie_copyrelocs_test): New test.
1687         * Makefile.in: Regenerate.
1688
1689 2014-05-08  Martin Liška  <mliska@suse.cz>
1690
1691         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
1692
1693 2014-05-06  Cary Coutant  <ccoutant@google.com>
1694
1695         PR gold/16900
1696         * i386.cc (Output_data_got_plt_i386): New class.
1697         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
1698         parameter. Change all callers.
1699         (Output_data_plt_i386::layout_): Remove.
1700         (Output_data_plt_i386::got_plt_): Change type.
1701         (Target_i386::got_plt_): Change type. Change all references.
1702         (Target_i386::got_section): Create instance of new class.
1703         (Output_data_got_plt_i386::do_write): New function.
1704         * x86_64.cc (Output_data_got_plt_x86_64): New class.
1705         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
1706         parameter. Change all callers.
1707         (Output_data_plt_x86_64::layout_): Remove.
1708         (Output_data_plt_x86_64::got_plt_): Change type.
1709         (Target_x86_64::got_plt_): Change type. Change all references.
1710         (Target_x86_64::got_section): Create instance of new class.
1711         (Output_data_got_plt_x86_64::do_write): New function.
1712         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
1713         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
1714         class.
1715
1716 2014-05-05  Cary Coutant  <ccoutant@google.com>
1717
1718         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
1719         if we have pubnames/pubtypes.
1720
1721 2014-05-02  Cary Coutant  <ccoutant@google.com>
1722
1723         * defstd.cc (in_segment): Define __ehdr_start here...
1724         * layout.cc (Layout::finalize): ...Instead of here.  Set the
1725         output segment when known.
1726         * resolve.cc (Symbol::override_base_with_special): Remember
1727         the original binding.
1728         * symtab.cc (Symbol::set_output_segment): New function.
1729         (Symbol::set_undefined): New function.
1730         * symtab.h (Symbol::is_weak_undefined): Check original undef
1731         binding.
1732         (Symbol::is_strong_undefined): New function.
1733         (Symbol::set_output_segment): New function.
1734         (Symbol::set_undefined): New function.
1735         * target-reloc.h (is_strong_undefined): Remove.
1736         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
1737         Check for hidden undefs.
1738         (relocate_section): Call Symbol::is_strong_undefined.
1739
1740         * testsuite/Makefile.am (ehdr_start_test_1)
1741         (ehdr_start_test_2, ehdr_start_test_3)
1742         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
1743         * testsuite/Makefile.in: Regenerate.
1744         * testsuite/ehdr_start_def.cc: New source file.
1745         * testsuite/ehdr_start_test.cc: New source file.
1746         * testsuite/ehdr_start_test.t: New linker script.
1747         * testsuite/ehdr_start_test_4.sh: New shell script.
1748
1749 2014-04-23  Cary Coutant  <ccoutant@google.com>
1750
1751         PR gold/16870
1752         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
1753
1754 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1755
1756         * layout.cc (Layout::include_section): Allow a target to decide
1757         whether to include a section.
1758         * target.h (Target::should_include_section): New function.
1759         (Target::do_should_include_section): New function.
1760
1761 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1762
1763         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
1764         inline into ...
1765         (Copy_relocs::emit): ... here.
1766         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
1767         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
1768         (Copy_reloc_entry::entries_): Change from private to protected.
1769
1770 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
1771
1772         * icf.cc (get_section_contents): Replace copies of reloc
1773         vectors with const references.
1774
1775 2014-04-02  Cary Coutant  <ccoutant@google.com>
1776
1777         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
1778         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
1779         * configure: Regenerate.
1780         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
1781         -fno-use-linker-plugin.
1782         (LINK1, CXXLINK1): Add it to the link command.
1783         * testsuite/Makefile.in: Regenerate.
1784
1785 2014-03-12  Alan Modra  <amodra@gmail.com>
1786
1787         * Makefile.in: Regenerate.
1788
1789 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1790
1791         * symtab.h (Symbol::set_nonvis): New function.
1792
1793 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1794
1795         * symtab.cc (Sized_symbol<32>::init_output_data):
1796         Instantiate the template.
1797         (Sized_symbol<64>::init_output_data): Likewise.
1798
1799 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1800
1801         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
1802         adjust dynamic symbol value.
1803         * target.h (Target::adjust_dyn_symbol): New function.
1804         (Target::do_adjust_dyn_symbol): New function.
1805
1806 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1807
1808         * output.cc (Output_data_dynamic::Dynamic_entry::write):
1809         Get the value of DYNAMIC_CUSTOM dynamic entry.
1810         * output.h (Output_data_dynamic::add_custom): New function.
1811         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
1812         dynamic entry.
1813         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
1814         * target.h (Target::dynamic_tag_custom_value): New function.
1815         (Target::do_dynamic_tag_custom_value): New function.
1816
1817 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1818
1819         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
1820         dynsym indexes.
1821         * target.h (Target::has_custom_set_dynsym_indexes): New function.
1822         (Target::do_has_custom_set_dynsym_indexes): New function.
1823         (Target::set_dynsym_indexes): New function.
1824         (Target::do_set_dynsym_indexes): New function.
1825
1826 2014-03-07  Alan Modra  <amodra@gmail.com>
1827
1828         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
1829         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
1830         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
1831         (Powerpc_relocate_functions::has_overflow_bitfield,
1832         overflowed): Use the above.
1833         (Target_powerpc::Relocate::relocate): Correct overflow checking
1834         for a number of relocations.  Modify overflow test for 16-bit
1835         fields in instructions to signed/unsigned according to whether
1836         the field takes a signed or unsigned value.
1837
1838 2014-03-05  Alan Modra  <amodra@gmail.com>
1839
1840         Update copyright years.
1841
1842 2014-03-05  Alan Modra  <amodra@gmail.com>
1843
1844         * powerpc.cc (Target_powerpc::Scan::local, global): Support
1845         R_PPC64_ADDR64_LOCAL.
1846         (Target_powerpc::Relocate::relocate): Likewise.
1847
1848 2014-03-03  Alan Modra  <amodra@gmail.com>
1849
1850         * dwp.cc (print_version): Update copyright year to current.
1851
1852 2014-02-10  Alan Modra  <amodra@gmail.com>
1853
1854         * po/gold.pot: Regenerate.
1855
1856 2014-02-06  Cary Coutant  <ccoutant@google.com>
1857
1858         Fix problem where -u is ignored when a weak undef is seen.
1859
1860         * archive.cc (Library_base::should_include_member): Reorder
1861         code to check for -u option if a weak undef has already been seen.
1862         * testsuite/Makefile.am (weak_undef_test_2): New test case.
1863         * testsuite/Makefile.in: Regenerate.
1864         * testsuite/weak_undef_file3.cc: New file.
1865         * testsuite/weak_undef_file4.cc: New file.
1866         * testsuite/weak_undef_test_2.cc: New file.
1867
1868 2014-02-05  Cary Coutant  <ccoutant@google.com>
1869
1870         Fix issues with gold undefined symbol diagnostics.
1871
1872         PR binutils/15435
1873         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
1874         check to here.
1875         * target-reloc.h (is_strong_undefined): New function.
1876         (relocate_section): Move undef vtable symbol check from here.
1877         Check for is_strong_undefined.
1878
1879 2014-02-05  Cary Coutant  <ccoutant@google.com>
1880
1881         Fix problems with the --dynamic-list option.
1882
1883         PR gold/13577
1884         * options.cc (General_options::parse_dynamic_list):
1885         Set have_dynamic_list_.
1886         (General_options::General_options): Initialize have_dynamic_list_.
1887         (General_options::finalize): Turn off -Bsymbolic and
1888         -Bsymbolic-functions if --dynamic-list provided.
1889         * options.h (General_options::have_dynamic_list): New function.
1890         (General_options::have_dynamic_list_): New data member.
1891         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
1892         correctly.
1893
1894         PR gold/16530
1895         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
1896         in --dynamic-list, mark it.
1897
1898         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
1899         (dynamic_list_2): New test case.
1900         * testsuite/Makefile.in: Regenerate.
1901         * testsuite/dynamic_list_2.cc: New file.
1902         * testsuite/dynamic_list_2.t: New file.
1903         * testsuite/dynamic_list_lib1.cc: New file.
1904         * testsuite/dynamic_list_lib2.cc: New file.
1905         * testsuite/gc_dynamic_list_test.c: New file.
1906         * testsuite/gc_dynamic_list_test.sh: New file.
1907         * testsuite/gc_dynamic_list_test.t: New file.
1908
1909 2014-01-28  Cary Coutant  <ccoutant@google.com>
1910
1911         Add .gdb_index version 7 support.
1912
1913         * gold/dwarf_reader.cc: include <utility> (for make_pair).
1914         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
1915         debug sections.
1916         (Dwarf_ranges_table::read_ranges_table): Likewise.
1917         (Dwarf_pubnames_table::read_section): Check for GNU-style
1918         sections, and for compressed debug sections.
1919         (Dwarf_pubnames_table::read_header): Compute end address of table.
1920         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
1921         for end of list by offset, not by offset == 0.
1922         (Dwarf_info_reader::do_read_string_table): Check for compressed
1923         debug sections.
1924         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1925         Initialize new data members.
1926         (Dwarf_pubnames_table::next_name): return flag_byte.
1927         (Dwarf_pubnames_table::end_of_table_): New data member.
1928         (Dwarf_pubnames_table::is_gnu_style_): New data member.
1929         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
1930         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
1931         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
1932         read skeleton type unit DIEs.
1933         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
1934         (Gdb_index::do_write): Write flag_byte.
1935         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
1936         (Gdb_index::Cu_vector): Store flags along with cu indexes.
1937         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
1938         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
1939
1940 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
1941
1942         * version.cc (print_version): Update copyright year to 2014.
1943
1944 2013-12-19  Dimitry Andric  <dimitry@andric.com>
1945
1946         * stringpool.cc (Stringpool_template::reserve): Add
1947         HAVE_UNORDERED_MAP case.
1948         * stringpool.cc (Stringpool_template::print_stats): Likewise.
1949
1950 2013-12-18  Cary Coutant  <ccoutant@google.com>
1951
1952         * configure.ac: Check for <unordered_set> and <unordered_map>.
1953         * config.in: Regenerate.
1954         * configure: Regenerate.
1955         * system.h: Use <unordered_set> and <unordered_map> if available.
1956
1957 2013-12-10  Roland McGrath  <mcgrathr@google.com>
1958
1959         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
1960         with $(INSTALL_PROGRAM_ENV).
1961         * Makefile.in: Regenerate.
1962
1963 2013-11-22  Cary Coutant  <ccoutant@google.com>
1964
1965         * configure.ac: Add check for which library is needed for
1966         dlopen.
1967         * configure: Regenerate.
1968
1969 2013-11-22  Cary Coutant  <ccoutant@google.com>
1970
1971         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
1972         assembler.
1973         * testsuite/Makefile.in: Regenerate.
1974
1975 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
1976
1977         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
1978         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
1979         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
1980         (Target_x86_64<size>::Scan::local): Likewise.
1981         (Target_x86_64<size>::Scan::global): Likewise.
1982         (Target_x86_64<size>::Relocate::relocate): Likewise.
1983         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
1984         Likewise.
1985         (Target_x86_64<size>::Scan::check_non_pic(): Handle
1986         R_X86_64_PC32_BND.
1987
1988         * testsuite/Makefile.am (check_PROGRAMS): Add
1989         exception_x86_64_bnd_test.
1990         (exception_x86_64_bnd_test_SOURCES): New macro.
1991         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
1992         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
1993         (exception_x86_64_bnd_test_LDADD): Likewise.
1994         (exception_x86_64_bnd_1.o): New rule.
1995         (exception_x86_64_bnd_2.o): Likewise.
1996         * testsuite/Makefile.in: Regenerated.
1997
1998 2013-11-15  Alan Modra  <amodra@gmail.com>
1999
2000         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
2001         accessor.
2002         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
2003         Only call ppc64_local_entry_offset for 64-bit.  Restrict
2004         symval_for_branch lookup to ELFv1.
2005         (Stub_table::add_plt_call_entry): Use unsigned int off.
2006         (Output_data_glink::Address, invalid_address): New.
2007         (Output_data_glink::add_eh_frame): Move out of line.  Add
2008         support for ELFv2.
2009         (Output_data_glink::add_global_entry, find_global_entry,
2010         global_entry_address): New functions.
2011         (Output_data_glink::global_entry_stubs_, end_branch_table_,
2012         ge_size): New variables.
2013         (Output_data_glink::set_final_data_size): Add global entry
2014         stub sizing.
2015         (Output_data_glink::do_write): Write global entry stubs.
2016         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
2017         parameter.  Return true for ELFv2.  Adjust callers.
2018         (Target_powerpc::Scan::local, global): Restrict opd lookup to
2019         ELFv1.  Similarly for ifunc and dynamic relocation processing
2020         specific to ELFv1.  Recognize that symbols are defined on
2021         their plt entries for ELFv2.
2022         (Target_powerpc::symval_for_branch): Assert if called for
2023         ELFv2 or ppc32.
2024         (Target_powerpc::Relocate::relocate): Use global entry plt
2025         stub for symbol value if such exists on ELFv2.
2026         (Target_powerpc::Relocate::relocate): Don't call
2027         symval_for_branch when ELFv2.  Do adjust for local entry
2028         offset when ELFv2.
2029         (Target_powerpc::do_dynsym_value): Set symbols to global entry
2030         plt stub for ELFv2.
2031         (Target_powerpc::do_plt_address_for_global): Similarly.
2032
2033 2013-11-14  Cary Coutant  <ccoutant@google.com>
2034
2035         Revert patch -- this did not fix the problem, and there is
2036         no race there.
2037
2038         2013-11-14  Cary Coutant  <ccoutant@google.com>
2039
2040             PR gold/14860
2041             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2042             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2043             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2044             updating fde_offsets_.
2045             (Eh_frame_hdr::lock_): New data member.
2046
2047 2013-11-14  Cary Coutant  <ccoutant@google.com>
2048
2049         * dwp.cc (Dwo_file_entry): New type.
2050         (File_list): Use Dwo_file_entry.
2051         (Dwo_file::verify): New function.
2052         (Dwo_file::verify_dwo_list): New function.
2053         (Dwo_file::sized_verify_dwo_list): New function.
2054         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
2055         list.
2056         (Dwp_options): New enum type.
2057         (dwp_options): Add --verify-only.
2058         (usage): Likewise.
2059         (main): Likewise.
2060         * dwp.h (gold_info): Add declaration.
2061
2062 2013-11-14  Cary Coutant  <ccoutant@google.com>
2063
2064         PR gold/14860
2065         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2066         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2067         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2068         updating fde_offsets_.
2069         (Eh_frame_hdr::lock_): New data member.
2070
2071 2013-11-06  Cary Coutant  <ccoutant@google.com>
2072
2073         PR gold/15758
2074         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
2075         before reloc sections.
2076
2077 2013-11-04  Alan Modra  <amodra@gmail.com>
2078
2079         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
2080         (Symbol::needs_dynamic_reloc): Test new flag.
2081         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
2082         (Target_powerpc::Scan::get_reference_flags): Add target param.
2083         Return FUNC_DESC_ABI for 64-bit ELFv1.
2084         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
2085         call.
2086         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
2087         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
2088
2089 2013-10-31  Cary Coutant  <ccoutant@google.com>
2090
2091         Restore support for dwp v2 DWARF package file format.
2092
2093         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2094         tu_length parameter.  Adjust all callers.
2095         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2096         * dwp.cc: Include dwarf.h.
2097         (Section_bounds): New struct type.
2098         (Unit_set): New struct type.
2099         (Dwo_file::Dwo_file): Initialize new data member.
2100         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2101         Combine and rename to...
2102         (Dwo_file::read_unit_index): ...this.
2103         (Dwo_file::sized_read_compunit_index)
2104         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2105         (Dwo_file::sized_read_unit_index): ...this.
2106         (Dwo_file::copy_section): Remove section_name, is_str_offsets
2107         parameters; add section_id parameter.
2108         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2109         (Dwo_file::add_unit_set): ...this.
2110         (Dwo_file::shndx_map_): Remove.
2111         (Dwo_file::sect_offsets_): New data member.
2112         (Dwp_output_file::Dwp_output_file): Initialize new data members.
2113         (Dwp_output_file::add_section): Rename to...
2114         (Dwp_output_file::add_contribution): ...this.
2115         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2116         (Dwp_output_file::add_tu_set): Likewise.
2117         (Dwp_output_file::Contribution): New type.
2118         (Dwp_output_file::Section::contributions): New data member.
2119         (Dwp_output_file::Cu_or_tu_set): Remove.
2120         (Dwp_output_file::Section::Section): New ctor.
2121         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2122         (Dwp_output_file::Dwp_index::Section_table): New type.
2123         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2124         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2125         parameter.
2126         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2127         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2128         (Dwp_output_file::Dwp_index::section_table): New member function.
2129         (Dwp_output_file::Dwp_index::section_table_end): New member function.
2130         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2131         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2132         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2133         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2134         (Dwp_output_file::Dwp_index::section_table_): New data member.
2135         (Dwp_output_file::Dwp_index::section_mask_): New data member.
2136         (Dwp_output_file::add_output_section): New member function.
2137         (Dwp_output_file::write_new_section): New member function.
2138         (Dwp_output_file::write_contributions): New member function.
2139         (Dwp_output_file::section_id_map_): New data member.
2140         (class Dwo_id_info_reader): Remove.
2141         (class Unit_reader): New class.
2142         (get_dwarf_section_name): New function.
2143         (Dwo_file::read_executable): Adjust initializations of class data.
2144         (Dwo_file::read): Add support for v2 package file format.
2145         (Dwo_file::read_unit_index): Likewise.
2146         (Dwo_file::sized_read_unit_index): Likewise.
2147         (Dwo_file::copy_section): Likewise.
2148         (Dwo_file::add_unit_set): Likewise.
2149         (Dwp_output_file::add_output_section): Likewise.
2150         (Dwp_output_file::add_contribution): Likewise.
2151         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2152         for empty slot.
2153         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2154         file format.
2155         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2156         slot.
2157         (Dwp_output_file::initialize): Remove unused function.
2158         (Dwp_output_file::finalize): Add support for v2 package file format.
2159         (Dwp_output_file::write_index): Likewise.
2160         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2161         function prototype.
2162
2163 2013-10-31  Cary Coutant  <ccoutant@google.com>
2164
2165         * configure.ac: Fix check for -fmerge-constants.
2166         * configure.ac: Regenerate.
2167
2168 2013-10-30  Roland McGrath  <mcgrathr@google.com>
2169
2170         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
2171         Correct 9-byte nop sequence to match what the assembler generates.
2172
2173 2013-10-30  Alan Modra  <amodra@gmail.com>
2174
2175         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
2176         ppc64_local_entry_offset, ppc64_local_entry_offset,
2177         do_read_symbols): New functions.
2178         (Powerpc_relobj::e_flags_, st_other_): New vars.
2179         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
2180         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
2181         (Powerpc_relobj::e_flags_): New var.
2182         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
2183         and adjust for ELFv2.
2184         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
2185         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
2186         (Powerpc_dynobj::do_find_special_sections): Likewise.
2187         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
2188         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
2189         to ELFv2 local entry.
2190         (Target_powerpc::do_relax): No thread safe barriers needed for
2191         ELFv2.
2192         (Output_data_plt_powerpc::initial_plt_entry_size_,
2193         plt_entry_size): Delete.  Replace all uses with
2194         first_plt_entry_offset() and plt_entry_size().
2195         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
2196         reserved_size parm.  Update callers.
2197         (Output_data_plt_powerpc::entry_count): Update.
2198         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
2199         and use Target_powerpc::first_plt_entry_offset().
2200         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
2201         rename to plt_entry_size.
2202         (Output_data_plt_powerpc::add_ifunc_entry,
2203         add_local_ifunc_entry): Adjust reloc for ELFv2.
2204         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
2205         (glink_eh_frame_fde_64v2): New.
2206         (Stub_table::plt_call_size): Support ELFv2 sizing.
2207         (Output_data_glink::add_eh_frame): Use the new FDE.
2208         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
2209         (Stub_table::do_write): Write ELFv2 stubs and glink.
2210         (Target_powerpc::Relocate::relocate): Replaces nop after call
2211         with ld 2,24(1) and adjust local offset destination for ELFv2.
2212
2213 2013-10-30  Alan Modra  <amodra@gmail.com>
2214
2215         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
2216         (Target_powerpc::Scan::global, local): Likewise.
2217         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
2218         on all ppc64 @h and @ha relocs.
2219
2220 2013-10-14  Alan Modra  <amodra@gmail.com>
2221
2222         * output.h (Output_data_got::add_constant): Tidy.
2223         (Output_data_got::add_constant_pair): New function.
2224         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
2225         methods used so as to first call reserve_ent().
2226
2227 2013-10-11  Roland McGrath  <mcgrathr@google.com>
2228
2229         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
2230         add_got_entry and add_got_entry_pair.
2231
2232         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
2233         (HAVE_PUBNAMES): Likewise.
2234         * configure: Regenerate.
2235
2236         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
2237         * testsuite/Makefile.in: Regenerate.
2238
2239         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
2240         Remove const from declaration.
2241         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
2242         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
2243         * output.h (Output_file_header): Remove const from member target_
2244         and corresponding constructor argument.
2245         * output.cc (Output_file_header::Output_file_header): Update prototype.
2246         (Output_file_header::do_sized_write): Use this->target_ in place
2247         of parameters()->target().
2248
2249         * testsuite/undef_symbol.cc (Foo::get_a): New method.
2250
2251         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
2252         * configure: Regenerate.
2253         * Makefile.in: Regenerate.
2254         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
2255         * testsuite/merge_string_literals_2.c: Likewise.
2256         * testsuite/Makefile.am
2257         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
2258         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
2259         literal -fmerge-constants.
2260         * testsuite/Makefile.in: Regenerate.
2261
2262         * i386.cc (Target_i386): Remove unused member dynbss_.
2263         * arm.cc (Target_arm): Likewise.
2264         * powerpc.cc (Target_powerpc): Likewise.
2265         * sparc.cc (Target_sparc): Likewise.
2266         * tilegx.cc (Target_tilegx): Likewise.
2267         * x86_64.cc (Target_x86_64): Likewise.
2268         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
2269         type_signature_, type_offset_.
2270         * plugin.h (Plugin_hook): Remove unused member layout_.
2271         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
2272         mapfile_.
2273         (Read_member): Remove unused members input_objects_, symtab_,
2274         mapfile_, layout_.
2275         (Check_library): Remove unused member symtab_.
2276         * archive.h (Lib_group): Remove unused member lib_.
2277         * archive.cc (Lib_group::Lib_group): Update initializer.
2278         * incremental.h (Incremental_binary): Remove unused member target_.
2279         (Incremental_script_entry): Removed unused member script_.
2280         * layout.h (Write_symbols_task): Remove unused member input_objects_.
2281         * icf.h (Icf): Remove unused member num_tracked_relocs.
2282
2283         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
2284         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
2285         its only use.
2286         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
2287
2288         * archive.h: Use struct rather than class for forward declaration
2289         of Read_symbols_data.
2290
2291 2013-10-07  Cary Coutant  <ccoutant@google.com>
2292
2293         PR gold/16010
2294         * testsuite/Makefile.am (icf_test): Fix dependencies.
2295         (icf_safe_test): Likewise.
2296         (icf_safe_so_test): Likewise.
2297         (large_symbol_alignment): Add empty _LDADD rule.
2298         * testsuite/Makefile.in: Regenerate.
2299
2300 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
2301
2302         PR gold/15927
2303         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
2304         relocation for R_X86_64_32 on x32.
2305
2306 2013-08-27  Roland McGrath  <mcgrathr@google.com>
2307
2308         * output.cc (Output_segment::set_section_addresses): Take new
2309         Target* argument.  If target->isolate_execinstr() and the segment
2310         is executable and starts at a target->abi_pagesize() boundary,
2311         pad its end out to a target->abi_pagesize() boundary with code fill.
2312         * output.h (Output_segment::set_section_addresses): Update decl.
2313         * layout.h (Layout::check_output_data_for_reset_values): Take new
2314         argument RELAX_OUTPUTS.
2315         (Layout): New member relax_output_list_.
2316         (Layout::add_relax_output): New method.
2317         * layout.cc (Layout::Layout): Update constructor.
2318         (Layout::reset_relax_output): New method.
2319         (Layout::clean_up_after_relaxation): Call it.
2320         (Layout::prepare_for_relaxation): Update caller.
2321         (Layout::set_segment_offsets): Update callers of set_section_addresses.
2322         Call reset_relax_output before re-processing segments for
2323         isolate_execinstr case.
2324         (Layout::write_data): Handle relax_output_list_.
2325         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
2326         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
2327
2328 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
2329
2330         PR binutils/15834
2331         * object.h: Fix typos.
2332
2333 2013-08-16  Roland McGrath  <mcgrathr@google.com>
2334
2335         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
2336         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
2337
2338 2013-08-07  Cary Coutant  <ccoutant@google.com>
2339
2340         Revert support for v2 DWP files:
2341
2342         2013-03-01  Cary Coutant  <ccoutant@google.com>
2343
2344             Add dwp support for v2 DWARF package file format.
2345             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2346             tu_length parameter.  Adjust all callers.
2347             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2348             * dwp.cc: Include dwarf.h.
2349             (Section_bounds): New struct type.
2350             (Unit_set): New struct type.
2351             (Dwo_file::Dwo_file): Initialize new data member.
2352             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2353             Combine and rename to...
2354             (Dwo_file::read_unit_index): ...this.
2355             (Dwo_file::sized_read_compunit_index)
2356             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2357             (Dwo_file::sized_read_unit_index): ...this.
2358             (Dwo_file::copy_section): Remove section_name, is_str_offsets
2359             parameters; add section_id parameter.
2360             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2361             (Dwo_file::add_unit_set): ...this.
2362             (Dwo_file::shndx_map_): Remove.
2363             (Dwo_file::sect_offsets_): New data member.
2364             (Dwp_output_file::Dwp_output_file): Initialize new data members.
2365             (Dwp_output_file::add_section): Rename to...
2366             (Dwp_output_file::add_contribution): ...this.
2367             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2368             (Dwp_output_file::add_tu_set): Likewise.
2369             (Dwp_output_file::Contribution): New type.
2370             (Dwp_output_file::Section::contributions): New data member.
2371             (Dwp_output_file::Cu_or_tu_set): Remove.
2372             (Dwp_output_file::Section::Section): New ctor.
2373             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2374             (Dwp_output_file::Dwp_index::Section_table): New type.
2375             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2376             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2377             parameter.
2378             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2379             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2380             (Dwp_output_file::Dwp_index::section_table): New member function.
2381             (Dwp_output_file::Dwp_index::section_table_end): New member function.
2382             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2383             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2384             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2385             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2386             (Dwp_output_file::Dwp_index::section_table_): New data member.
2387             (Dwp_output_file::Dwp_index::section_mask_): New data member.
2388             (Dwp_output_file::add_output_section): New member function.
2389             (Dwp_output_file::write_new_section): New member function.
2390             (Dwp_output_file::write_contributions): New member function.
2391             (Dwp_output_file::section_id_map_): New data member.
2392             (class Dwo_id_info_reader): Remove.
2393             (class Unit_reader): New class.
2394             (get_dwarf_section_name): New function.
2395             (Dwo_file::read_executable): Adjust initializations of class data.
2396             (Dwo_file::read): Add support for v2 package file format.
2397             (Dwo_file::read_unit_index): Likewise.
2398             (Dwo_file::sized_read_unit_index): Likewise.
2399             (Dwo_file::copy_section): Likewise.
2400             (Dwo_file::add_unit_set): Likewise.
2401             (Dwp_output_file::add_output_section): Likewise.
2402             (Dwp_output_file::add_contribution): Likewise.
2403             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2404             for empty slot.
2405             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2406             file format.
2407             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2408             slot.
2409             (Dwp_output_file::initialize): Remove unused function.
2410             (Dwp_output_file::finalize): Add support for v2 package file format.
2411             (Dwp_output_file::write_index): Likewise.
2412             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2413             function prototype.
2414
2415 2013-07-31  Cary Coutant  <ccoutant@google.com>
2416
2417         * object.cc (Sized_relobj::do_output_section_address): New function.
2418         (Sized_relobj): Instantiate explicitly.
2419         * object.h (Object::output_section_address): New function.
2420         (Object::do_output_section_address): New function.
2421         (Sized_relobj::do_output_section_address): New function.
2422         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
2423
2424 2013-07-30  Cary Coutant  <ccoutant@google.com>
2425             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2426
2427         * parameters.cc (Parameters::entry): Return target-specific entry
2428         symbol name.
2429         * target.h (Target::entry_symbol_name): New function.
2430         (Target_info::entry_symbol_name): New data member.
2431
2432         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
2433         * i386.cc (Target_i386::i386_info): Likewise.
2434         (Target_i386_nacl::i386_nacl_info): Likewise.
2435         * sparc.cc (Target_sparc::sparc_info): Likewise.
2436         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
2437         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
2438         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
2439         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2440
2441 2013-07-22  Sterling Augustine  <saugustine@google.com>
2442
2443         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
2444         Convert parameter shndx to local variable. Add parameters symtab
2445         and symtab_size.  Scan over section names.  Find relocation
2446         section corresponding to current section.  Create and initialize
2447         reloc_mapper_ and reloc_type_.
2448         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
2449         unit_length to off_t.  Initialize member unit_length_.  Fill in field
2450         cu_offset_.
2451         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2452         Initialize new fields unit_length_ and cu_offset_.
2453         (Dwarf_pubnames_table::read_section): Update prototype.
2454         (Dwarf_pubnames_table::cu_offset): New member function.
2455         (Dwarf_pubnames_table::subsection_size): Likewise.
2456         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
2457         New fields.
2458         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
2459         member functions public.
2460         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
2461         Update comment.  Rework logic.  Move repeated parts to...
2462         (Gdb_index_info_reader::read_pubtable): ...here. New function.
2463         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
2464         pubtypes_table_, and stmt_list_offset.
2465         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2466         Gdb_index::find_pubtype_offset,
2467         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
2468         (Gdb_index::pubnames_read): Update prototype and rework logic.
2469         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
2470         Forward declare.
2471         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2472         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
2473         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
2474         Gdb_index::map_pubtable_to_dies):
2475         Declare functions.
2476         (Gdb_index::pubnames_read): Update declaration.
2477         (Gdb_index::Pubname_offset_map): New type.
2478         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
2479         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
2480         Gdb_index::stmt_list_offset): Declare.
2481         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
2482         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
2483         Gdb_index::pubtypes_offset_): Remove.
2484
2485 2013-07-19  Roland McGrath  <mcgrathr@google.com>
2486
2487         * options.h (General_options): Add -Trodata-segment option.
2488         * parameters.cc (Parameters::check_rodata_segment): New function.
2489         (Parameters::set_target_once): Call it.
2490         * parameters.h (Parameters): Declare it (private member function).
2491         * layout.cc (load_seg_unusable_for_headers): New function, broken
2492         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
2493         then validate rodata segment rather than text segment.
2494         (relaxation_loop_body): Call that.
2495         (is_text_segment): New function.  Don't admit a non-executable
2496         segment if TARGET->isolate_execinstr().
2497         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
2498
2499 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
2500
2501         PR gold/15070
2502         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
2503         * nacl.h (Sniff_file::View::View): Request aligned view.
2504
2505 2013-07-11  Cary Coutant  <ccoutant@google.com>
2506
2507         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
2508         correct BRLT entry size.
2509
2510 2013-07-03  Alan Modra  <amodra@gmail.com>
2511
2512         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
2513         comment.
2514
2515 2013-07-01  Cary Coutant  <ccoutant@google.com>
2516
2517         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
2518         reloc_type_.
2519         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
2520         (Dwarf_ranges_table::lookup_reloc): New function.
2521         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
2522         reloc_type_.
2523         (Dwarf_ranges_table::lookup_reloc): New function.
2524         (Dwarf_ranges_table::reloc_type_): New data member.
2525
2526 2013-06-27  Jing Yu  <jingyu@google.com>
2527
2528         PR gold/15662
2529         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
2530         function.
2531         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
2532         (Target_powerpc::do_relax): Call the above.
2533
2534 2013-06-27  Cary Coutant  <ccoutant@google.com>
2535
2536         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
2537         on garbage collected .opd section.
2538
2539 2013-06-27  Alan Modra  <amodra@gmail.com>
2540
2541         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
2542         is non-zero.
2543         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
2544         (Target_powerpc::do_function_location): Likewise for loc->shndx.
2545
2546 2013-06-14  Cary Coutant  <ccoutant@google.com>
2547
2548         * resolve.cc (Symbol::override_base): Don't override st_type
2549         from plugin placeholder symbols.
2550         (Symbol_table::resolve): Likewise.
2551         (Symbol_table::should_override): Don't complain about TLS mismatch
2552         if the TO symbol is a plugin placeholder.
2553         * testsuite/Makefile.am (plugin_test_tls): New test.
2554         * testsuite/Makefile.in: Regenerate.
2555         * testsuite/plugin_test_tls.sh: New test script.
2556         * testsuite/two_file_test_2_tls.cc: New test source.
2557         * testsuite/two_file_test_tls.cc: New test source.
2558
2559 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2560
2561         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
2562         the maximum segment alignment is larger than the page size.
2563         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
2564         correctly aligns the symbols with large alignemnt.
2565         * testsuite/Makefile.in: Regenerate.
2566         * testsuite/large_symbol_alignment.cc: New file.
2567
2568 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2569             Sriraman Tallam  <tmsriram@google.com>
2570
2571         * options.h (sort_section): New option.
2572         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
2573         Rename from Input_section_sort_section_name_special_ordering_compare.
2574         (Input_section_sort_section_name_compare): New struct.
2575         * output.cc (Output_section::Input_section_sort_section_name_compare::
2576         operator()): New function.
2577         (Output_section::sort_attached_input_sections): Use new sort function
2578         for .text if --sort-section=name is specified.
2579         * layout.cc (Layout::make_output_section):
2580         Add sorting by name when --sort-section=name is specified.
2581         * testsuite/Makefile.am (text_section_grouping): Test option
2582         --sort-section=name.
2583         * testsuite/Makefile.in: Regenerate.
2584         * testsuite/section_sorting_name.cc: New file.
2585         * testsuite/section_sorting_name.sh: New file.
2586
2587 2013-05-21  Cary Coutant  <ccoutant@google.com>
2588
2589         * symtab.h (Symbol::is_cxx_vtable): New function.
2590         * target-reloc.h (relocate_section): Check for vtable symbol.
2591         * testsuite/Makefile.am (missing_key_func.sh): New test case.
2592         * testsuite/Makefile.in: Regenerate.
2593         * testsuite/missing_key_func.cc: New test source.
2594         * testsuite/missing_key_func.sh: New test script.
2595
2596 2013-05-21  Cary Coutant  <ccoutant@google.com>
2597
2598         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
2599         type of enclosing symbol.
2600         (Relocate_info::location): Check symbol type when describing symbol.
2601         * object.h (Symbol_location_info): Remove unused line_number;
2602         add enclosing_symbol_type.
2603         * testsuite/debug_msg.sh: Adjust expected output.
2604
2605 2013-05-13  Cary Coutant  <ccoutant@google.com>
2606
2607         * configure.ac: Export DEFAULT_TARGET.
2608         * configure: Regenerate.
2609         * Makefile.in: Regenerate.
2610         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
2611         * testsuite/Makefile.in: Regenerate.
2612         * testsuite/debug_msg.sh: Delete duplicate tests.
2613         Don't check undef_int error message match for powerpc where the
2614         source file and line number aren't available.
2615
2616 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2617
2618         * options.h (General_options): Add --rosegment-gap option.
2619         * options.cc (finalize): --rosegment-gap implies --rosegment.
2620         * layout.cc (set_segment_offsets): Let user option override
2621         target->rosegment_gap().
2622
2623 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2624
2625         * options.h (General_options): Remove leading space from help
2626         messages for -nostdlib and --rosegment.
2627
2628 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
2629
2630         PR ld/15365
2631         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
2632
2633 2013-05-03  Alan Modra  <amodra@gmail.com>
2634
2635         * merge.cc (Output_merge_string::do_add_input_section): Correct
2636         scan for number of strings.  Rename vars to avoid shadowing.
2637         Include missing terminator in input_size_.
2638
2639 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
2640
2641         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
2642         Restore empty string handling.
2643
2644 2013-05-01  Cary Coutant  <ccoutant@google.com>
2645
2646         * stringpool.cc (Stringpool_template::new_key_offset): Fix
2647         uninitialized warning.
2648
2649 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2650
2651         * output.cc (Output_section::add_merge_input_section): Allow
2652         to merge sections if the alignment is more than character size.
2653         * merge.h (Output_merge_string::Output_merge_string): Remove
2654         assert.
2655         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
2656         only not-null strings. Check the alignment of strings.
2657         * stringpool.h
2658         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
2659         alignment as the argument.
2660         (Stringpool_template<Stringpool_char>::addralign_): New class member.
2661         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
2662         Align non-zero length strings according to the addralign_.
2663         (Stringpool_template<Stringpool_char>::set_string_offsets):
2664         Updating offsets according to the given alignment.
2665         * testsuite/Makefile.am (text_section_grouping): Test if string
2666         literals are getting merged.
2667         * testsuite/Makefile.in: Regenerate.
2668         * testsuite/merge_string_literals_1.c: New file.
2669         * testsuite/merge_string_literals_2.c: Ditto.
2670         * testsuite/merge_string_literals.sh: Ditto.
2671
2672 2013-04-26  Ian Lance Taylor  <iant@google.com>
2673
2674         * target-reloc.h (relocate_section): If the reloc offset is out of
2675         range, pass VIEW as NULL to relocate.relocate.
2676         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
2677         * i386.cc (Target_i386::Relocate::relocate): Likewise.
2678         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
2679         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
2680         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
2681         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2682
2683 2013-04-26  Geoff Pike  <gpike@chromium.org>
2684
2685         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
2686         * layout.cc (Hash_task): New class.
2687         (Layout::queue_build_id_tasks): New function.
2688         (Layout::write_build_id): Handle single-thread portion of build ID
2689         computation.  (In some cases, all of it is single-threaded.)  Replace
2690         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
2691         functionality in fewer lines of code.
2692         * layout.h (Layout::queue_build_id_tasks): New function declaration.
2693         * options.h (General_options): make "--build-id" default to tree
2694         rather than sha1.  Add two new options related to --build-id=tree:
2695         --build-id-chunk-size-for-treehash and
2696         --build-id-min-file-size-for-treehash.
2697         * Makefile.am: add testing of --build-id=tree and related new options
2698         (these tests will be invoked by "make check").
2699         * Makefile.in: Regenerate.
2700
2701 2013-04-25  Alan Modra  <amodra@gmail.com>
2702
2703         * configure.tgt: Add powerpcle and powerpc64le.
2704
2705 2013-04-22  Alan Modra  <amodra@gmail.com>
2706
2707         PR gold/15355
2708         * layout.cc (Layout::segment_precedes): Allow more than one
2709         segment with the same type and flags.
2710
2711 2013-04-15  Cary Coutant  <ccoutant@google.com>
2712
2713         * layout.cc (Layout::set_relocatable_section_offsets): Don't
2714         allocate space in file for BSS sections.
2715
2716 2013-04-15  Cary Coutant  <ccoutant@google.com>
2717
2718         * script-sections.cc (Orphan_output_section): Reset address
2719         to zero after each orphaned section for relocatable links.
2720
2721 2013-04-15  Cary Coutant  <ccoutant@google.com>
2722
2723         * symtab.cc (Symbol_table::sized_write_globals): Subtract
2724         section starting address for relocatable link.
2725         * testsuite/Makefile.am (script_test_11): New test.
2726         * testsuite/Makefile.in: Regenerate.
2727         * testsuite/script_test_11.c: New source file.
2728         * testsuite/script_test_11.t: New linker script.
2729
2730 2013-04-13  Alan Modra  <amodra@gmail.com>
2731
2732         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
2733         owner when sections are not adjacent and exceed group size.
2734         (Target_powerpc::group_sections): Handle corner case.
2735         (Target_powerpc::Branch_info::make_stub): Handle case where
2736         stub table doesn't exist due to branches in non-exec sections.
2737         (Target_powerpc::Relocate::relocate): Likewise.
2738
2739 2013-04-11  Alan Modra  <amodra@gmail.com>
2740
2741         PR gold/15354
2742         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
2743         .branch_lt to match bfd ld.  Adjust comments throughout file.
2744
2745 2013-04-04  Ian Lance Taylor  <iant@google.com>
2746
2747         GCC PR c++/56840
2748         * object.cc (do_layout_deferred_sections): Handle .eh_frame
2749         sections before checking whether they are included in the link.
2750
2751 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
2752
2753         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
2754         object before calling the plugin claim_file handler.  Pass the elf
2755         object of the archive to the plugin. Delete the elf object if the
2756         plugin claims the file.
2757
2758 2013-03-21  Alan Modra  <amodra@gmail.com>
2759
2760         * layout.cc (Layout::set_segment_offsets): Accept writable .text
2761         segment when omagic.
2762
2763 2013-03-21  Alan Modra  <amodra@gmail.com>
2764
2765         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
2766         comparison warning.
2767         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
2768         uninitialized" warning.
2769
2770 2013-03-20  Alan Modra  <amodra@gmail.com>
2771
2772         * symtab.h (Symbol::clear_version): New function.
2773         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
2774         is_needed by weak references.  Clear version for symbols defined
2775         in as-needed objects that are not needed.
2776
2777 2013-03-15  Alan Modra  <amodra@gmail.com>
2778
2779         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
2780         static and public.  Add report_err param.  Return false for data refs.
2781         (Target_powerpc::rela_dyn_section): New overloaded function.
2782         (Target_powerpc::plt_, iplt_): Elucidate.
2783         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
2784         (Output_data_plt_powerpc::do_write): Don't write .iplt.
2785         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
2786         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
2787         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
2788         push_branch and make_plt_entry for ifunc syms when
2789         reloc_needs_plt_for_ifunc.
2790         (Target_powerpc::Relocate::relocate): Don't use plt entry value
2791         for ifunc unless reloc_needs_plt_for_ifunc.
2792
2793 2013-03-15  Alan Modra  <amodra@gmail.com>
2794
2795         * gc.h (gc_process_relocs): Don't look through function descriptors.
2796         * icf.cc (get_section_contents): Do so here instead.
2797
2798 2013-03-13  Alan Modra  <amodra@gmail.com>
2799
2800         * powerpc.cc (is_branch_reloc): Forward declare.
2801         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
2802         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
2803         false for 64-bit, true for 32-bit non-branch relocs.
2804         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
2805         * testsuite/Makefile.am (icf_test): Use linker map file instead of
2806         nm output.
2807         (icf_safe_test): Generate linker map file as well as nm output.
2808         (icf_safe_so_test): Likewise.
2809         * testsuite/Makefile.in: Regenerate.
2810         * testsuite/icf_test.sh: Parse linker map file to determine
2811         section folding.
2812         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
2813         * testsuite/icf_safe_so_test.sh: Likewise.
2814         (X86_32_or_ARM_specific_safe_fold): Merge into..
2815         (arch_specific_safe_fold): ..this.
2816         (X86_64_specific_safe_fold): Delete unused function.
2817
2818 2013-03-12  Alan Modra  <amodra@gmail.com>
2819
2820         * gc.h (gc_process_relocs): Look through function descriptors
2821         to determine shndx, symvalue and addend used by ICF.  Tidy
2822         variable duplication.
2823
2824 2013-03-11  Alan Modra  <amodra@gmail.com>
2825
2826         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
2827         * layout.cc (Layout_task_runner::run): ..to here.
2828         * symtab.h (struct Symbol_location): Extract from..
2829         (class Symbol_table): ..here.
2830         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
2831         * target.h (class Target): Add function_location and
2832         do_function_location functions.
2833         (class Sized_target): Add do_function_location.
2834         * object.h (class Sized_relobj_file): Move find_shdr..
2835         (class Object): ..to here.
2836         * object.cc: Likewise.  Update to suit.  Instantiate.
2837         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
2838         * powerpc.cc (class Powerpc_dynobj): New.
2839         (Target_powerpc::do_function_location): New function.
2840         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
2841         (Powerpc_dynobj::do_read_symbols): New function.
2842         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
2843
2844 2013-03-08  Ian Lance Taylor  <iant@google.com>
2845
2846         * options.cc (General_options::string_to_object_format): Accept
2847         "default".
2848
2849 2013-03-08  Alan Modra  <amodra@gmail.com>
2850
2851         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
2852         pointer to Post_fde.
2853         (struct Post_fde): Move definition to here..
2854         * ehframe.cc (struct Post_fde): ..from here.
2855         (Cie::write): Don't alloc Post_fde.
2856         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
2857
2858 2013-03-07  Alan Modra  <amodra@gmail.com>
2859
2860         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
2861         relocation referencing .LC0.
2862         * testsuite/discard_locals_test.sh: Remove FIXMEs.
2863
2864 2013-03-07  Alan Modra  <amodra@gmail.com>
2865
2866         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
2867         always_inline.  Add assembly for powerpc to avoid GOT.
2868
2869 2013-03-07  Alan Modra  <amodra@gmail.com>
2870
2871         * testsuite/script_test_10.sh: Don't test .bss section
2872         header number.
2873
2874 2013-03-06  Alan Modra  <amodra@gmail.com>
2875
2876         * powerpc.cc (class Powerpc_relobj): Move some member functions.
2877         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
2878         all callers.  Handle folded sections.
2879         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
2880         to Powerpc_relobj.
2881         (Global_symbol_visitor_opd::operator()): Likewise.
2882
2883 2013-03-04  Alan Modra  <amodra@gmail.com>
2884
2885         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
2886         * testsuite/Makefile.in: Regenerate.
2887
2888 2013-03-01  Cary Coutant  <ccoutant@google.com>
2889
2890         Add dwp support for v2 DWARF package file format.
2891         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2892         tu_length parameter.  Adjust all callers.
2893         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2894         * dwp.cc: Include dwarf.h.
2895         (Section_bounds): New struct type.
2896         (Unit_set): New struct type.
2897         (Dwo_file::Dwo_file): Initialize new data member.
2898         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2899         Combine and rename to...
2900         (Dwo_file::read_unit_index): ...this.
2901         (Dwo_file::sized_read_compunit_index)
2902         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2903         (Dwo_file::sized_read_unit_index): ...this.
2904         (Dwo_file::copy_section): Remove section_name, is_str_offsets
2905         parameters; add section_id parameter.
2906         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2907         (Dwo_file::add_unit_set): ...this.
2908         (Dwo_file::shndx_map_): Remove.
2909         (Dwo_file::sect_offsets_): New data member.
2910         (Dwp_output_file::Dwp_output_file): Initialize new data members.
2911         (Dwp_output_file::add_section): Rename to...
2912         (Dwp_output_file::add_contribution): ...this.
2913         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2914         (Dwp_output_file::add_tu_set): Likewise.
2915         (Dwp_output_file::Contribution): New type.
2916         (Dwp_output_file::Section::contributions): New data member.
2917         (Dwp_output_file::Cu_or_tu_set): Remove.
2918         (Dwp_output_file::Section::Section): New ctor.
2919         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2920         (Dwp_output_file::Dwp_index::Section_table): New type.
2921         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2922         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2923         parameter.
2924         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2925         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2926         (Dwp_output_file::Dwp_index::section_table): New member function.
2927         (Dwp_output_file::Dwp_index::section_table_end): New member function.
2928         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2929         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2930         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2931         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2932         (Dwp_output_file::Dwp_index::section_table_): New data member.
2933         (Dwp_output_file::Dwp_index::section_mask_): New data member.
2934         (Dwp_output_file::add_output_section): New member function.
2935         (Dwp_output_file::write_new_section): New member function.
2936         (Dwp_output_file::write_contributions): New member function.
2937         (Dwp_output_file::section_id_map_): New data member.
2938         (class Dwo_id_info_reader): Remove.
2939         (class Unit_reader): New class.
2940         (get_dwarf_section_name): New function.
2941         (Dwo_file::read_executable): Adjust initializations of class data.
2942         (Dwo_file::read): Add support for v2 package file format.
2943         (Dwo_file::read_unit_index): Likewise.
2944         (Dwo_file::sized_read_unit_index): Likewise.
2945         (Dwo_file::copy_section): Likewise.
2946         (Dwo_file::add_unit_set): Likewise.
2947         (Dwp_output_file::add_output_section): Likewise.
2948         (Dwp_output_file::add_contribution): Likewise.
2949         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2950         for empty slot.
2951         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2952         file format.
2953         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2954         slot.
2955         (Dwp_output_file::initialize): Remove unused function.
2956         (Dwp_output_file::finalize): Add support for v2 package file format.
2957         (Dwp_output_file::write_index): Likewise.
2958         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2959         function prototype.
2960
2961 2013-03-01  Cary Coutant  <ccoutant@google.com>
2962
2963         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
2964         function into class definition in header file.
2965         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
2966         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
2967         New function.
2968         (Dwarf_info_reader::check_buffer): Move here from .cc file.
2969
2970 2013-02-28  Alan Modra  <amodra@gmail.com>
2971
2972         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
2973         * target.cc (Target::do_plt_fde_location): New function.
2974         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
2975         accessor function, and constructor param.
2976         (struct Post_fde, Post_fdes): Declare.
2977         (Cie::write): Add post_fdes param.
2978         * ehframe.cc (Fde::write): Use plt_fde_location.
2979         (struct Post_fde): Define.
2980         (Cie::write): Stash FDEs added post merge mapping.
2981         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
2982         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
2983         (Eh_frame::do_sized_write): Arrange to write post map FDES after
2984         other FDEs.
2985         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
2986         (Target_powerpc::has_glink): New function.
2987         (Target_powerpc::do_relax): Add eh_frame info for stubs.
2988         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
2989         glink_eh_frame_fde_32, default_fde): New data.
2990         (Stub_table::eh_frame_added_): New var.
2991         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
2992         Make const.
2993         (Stub_table::add_eh_frame): New function.
2994         (Output_data_glink::add_eh_frame): New function.
2995         (Target_powerpc::make_glink_section): Call add_eh_frame.
2996
2997 2013-02-15  Ian Lance Taylor  <iant@google.com>
2998
2999         * options.h (DEFINE_uint64_alias): Define.
3000         (class General_options): Add -Ttext-segment as an alias for
3001         -Ttext.
3002
3003 2013-02-15  Alan Modra  <amodra@gmail.com>
3004
3005         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
3006         (Stub_table::do_write): ..here, two places.
3007         (Stub_table::plt_call_size): Use it here too.
3008
3009 2013-02-11  Ian Lance Taylor  <iant@google.com>
3010
3011         * descriptors.cc (Descriptors::close_all): New function.
3012         * descriptors.h (class Descriptors): Declare close_all.
3013         (close_all_descriptors): New inline function.
3014         * plugin.cc: Include "descriptors.h".
3015         (Plugin_manager::cleanup): Call close_all_descriptors.
3016
3017 2013-02-06  Alan Modra  <amodra@gmail.com>
3018
3019         * README: Update coding style link.
3020
3021 2013-01-28  Cary Coutant  <ccoutant@google.com>
3022
3023         * dwp.cc (File_list): New typedef.
3024         (Dwo_name_info_reader): New class.
3025         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
3026         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
3027         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
3028         (Dwo_file::read_executable): New function.
3029         (Dwo_file::read): Move common setup code to ...
3030         (Dwo_file::make_object): ... here.
3031         (dwp_options): Add --exec/-e.
3032         (usage): Likewise.
3033         (main): Likewise.
3034
3035 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
3036
3037         * layout.cc (Layout::layout): Check for option text_reorder.
3038         (Layout::make_output_section): Ditto.
3039         * options.h (text_reorder): New option.
3040         * output.cc (Input_section_sort_compare): Remove special ordering
3041         of section names.
3042         (Output_section::
3043          Input_section_sort_section_name_special_ordering_compare::
3044          operator()): New function.
3045         (Output_section::sort_attached_input_sections): Use new sort function
3046         for .text.
3047         * output.h (Input_section_sort_section_name_special_ordering_compare):
3048         New struct.
3049         * testsuite/Makefile.am (text_section_grouping): Test option
3050         --no-text-reorder
3051         * testsuite/Makefile.in: Regenerate.
3052         * testsuite/text_section_grouping.sh: Check order of functions without
3053         default text reordering.
3054
3055 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3056
3057         * options.h (General_options): Change default to true for new_dtags.
3058
3059 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3060
3061         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
3062         when enable_new_dtags is false.  Only add DT_RUNPATH when
3063         enable_new_dtags is true.
3064
3065 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
3066
3067         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
3068         used in declaration and definition consistent.
3069         (Target_powerpc::symval_for_branch): Ditto.
3070
3071 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3072
3073         * testsuite/plugin_final_layout.cc: Fix comment.
3074
3075 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3076
3077         * layout.cc (Layout::layout): Do not do default sorting for
3078         text sections when section ordering is specified.
3079         (make_output_section): Ditto.
3080         * testsuite/plugin_final_layout.cc: Name the function sections
3081         to catch reordering issues.
3082
3083 2013-01-15  Alan Modra  <amodra@gmail.com>
3084
3085         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
3086         plt-thread-safe.
3087
3088 2013-01-15  Alan Modra  <amodra@gmail.com>
3089
3090         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
3091         * testsuite/Makefile.in: Regenerate.
3092
3093 2013-01-14  Alan Modra  <amodra@gmail.com>
3094
3095         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
3096         * testsuite/Makefile.in: Regenerate.
3097
3098 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
3099
3100         PR bfd/14430
3101         Fix mingw gold build with plugins enabled
3102         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
3103         * configure.ac: Export DLOPEN_LIBS and add headers check.
3104         * plugin.cc: Handle non-dlfcn case.
3105         * Makefile.in: Regenerate.
3106         * config.in: Regenerate.
3107         * configure: Regenerate.
3108         * testsuite/Makefile.in: Regenerate.
3109
3110 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
3111
3112         * output.h (sort_attached_input_sections): Change to be public.
3113         * script-sections.cc
3114         (Output_section_definition::set_section_addresses): Sort
3115         attached input sections according to section order before linker
3116         script assigns section addresses.
3117         (Orphan_output_section::set_section_addresses): Sort
3118         attached input sections according to section order before linker
3119         script assigns section addresses.
3120         * Makefile.am (final_layout.sh): Use a simple linker script to
3121         check if section ordering still works.
3122         * Makefile.in: Regenerate.
3123
3124 2013-01-09  Ben Cheng  <bccheng@google.com>
3125
3126         * arm.cc (Target_arm::attributes_accept_div): New function.
3127         (Target_arm::attributes_forbid_div): New function.
3128         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
3129         attribute using the same new functions as what bfd/elf32_arm.c
3130         does.
3131
3132 2013-01-07  Cary Coutant  <ccoutant@google.com>
3133
3134         PR gold/14993
3135         * output.cc (Output_section::add_input_section): For incremental
3136         updates, don't track input sections that are allocated from patch
3137         space.
3138
3139 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3140             Ian Lance Taylor  <iant@google.com>
3141
3142         PR gold/14897
3143         * configure.ac (--enable-ld): Removed.
3144         (install_as_default): Set to yes only for --enable-gold=default
3145         or --disable-ld.
3146         * configure: Regenerated.
3147
3148 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3149
3150         * options.h (General_options): Add -fuse-ld= for GCC linker
3151         option compatibility.
3152
3153 2013-01-04  Cary Coutant  <ccoutant@google.com>
3154
3155         * configure.ac: Fix typo restoring CXXFLAGS.
3156         * configure: Regenerate.
3157
3158 2013-01-04  Cary Coutant  <ccoutant@google.com>
3159
3160         * testsuite/Makefile.am (CXXLINK_S): New macro.
3161         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
3162         * testsuite/Makefile.in: Regenerate.
3163
3164 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
3165
3166         * version.cc (print_version): Update copyright year to 2013.
3167
3168 2012-12-20  Ian Lance Taylor  <iant@google.com>
3169
3170         * layout.cc (Layout::special_ordering_of_input_section): New
3171         function.
3172         (Layout::layout): If input section requires special ordering, must
3173         sort input sections.
3174         (Layout::make_output_section): May sort .text input sections.
3175         (Layout::is_section_name_prefix_grouped): Remove.
3176         * layout.h (class Layout): Declare
3177         special_ordering_of_input_section.  Don't declare
3178         is_section_name_prefix_grouped.
3179         * output.cc (Output_section::add_input_section): Revert last
3180         change.
3181         (Output_section::Input_section_sort::match_file_name): Don't crash
3182         if called on output section data.
3183         (Output_section::Input_section_sort_compare): Sort based on
3184         special ordering.
3185         (Output_section::Input_section_sort_section_order_index_compare):
3186         Revert last patch.
3187         (Output_section::sort_attached_input_sections): Likewise.
3188
3189 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
3190
3191         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
3192         * layout.h (Layout::is_section_name_prefix_grouped): New function.
3193         * output.cc (Output_section::add_input_section): Check if section
3194         name contains special prefix.  Keep input sections to sort such
3195         sections.
3196         (Output_section::Input_section_sort_section_order_index_compare
3197          ::operator()): Group sections according to prefixes.
3198         (Output_section::sort_attached_input_sections): Add condition to
3199         Input_section_entry constructor call.
3200         * testsuite/Makefile.am (text_section_grouping): New test.
3201         * testsuite/Makefile.in: Regenerate.
3202         * testsuite/text_section_grouping.cc: New file.
3203         * testsuite/text_section_grouping.sh: New file.
3204
3205 2012-12-17  Nick Clifton  <nickc@redhat.com>
3206
3207         * Makefile.am: Add copyright notice.
3208         * NEWS: Likewise.
3209         * README: Likewise.
3210         * configure.ac: Likewise.
3211         * ftruncate.c: Likewise.
3212         * Makefile.in: Regenerate.
3213
3214 2012-12-14  Cary Coutant  <ccoutant@google.com>
3215
3216         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
3217         --no-as-needed flag.
3218         (exception_separate_shared_12_test): Likewise.
3219         (incremental_copy_test): Likewise.
3220         * testsuite/Makefile.in: Regenerate.
3221
3222 2012-12-14  Cary Coutant  <ccoutant@google.com>
3223
3224         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
3225         (Dwp_output_file::Dwp_index::enter_set): Add assert.
3226
3227 2012-12-12  Alan Modra  <amodra@gmail.com>
3228
3229         * powerpc.cc (class Track_tls): New.
3230         (class Relocate, class Scan): Inherit Track_tls.
3231         (Target_powerpc::Scan::local, global): Track tls optimization
3232         and avoid creating plt entry for __tls_get_addr if all uses
3233         are optimized away.
3234         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
3235
3236 2012-12-12  Alan Modra  <amodra@gmail.com>
3237
3238         * options.h (General_options): Add --toc-sort/--no-toc-sort.
3239         Replace no_toc_optimize with toc_optimize.
3240         * output.h (Output_section::input_sections): Provide non-const variant.
3241         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
3242         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
3243         accessors.
3244         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
3245         (class Sort_toc_sections): New.
3246         (Target_powerpc::do_finalize_sections): Sort toc sections.
3247         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
3248
3249 2012-12-10  Roland McGrath  <mcgrathr@google.com>
3250
3251         * testsuite/binary_unittest.cc (read_all): New function.
3252         (Sized_binary_test): Use it instead of ::read.
3253         * fileread.cc (do_read): Don't assume pread always reads the whole
3254         amount in a single call.
3255
3256 2012-12-10  Alan Modra  <amodra@gmail.com>
3257
3258         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
3259         Set EM_PPC64 or EM_PPC here.
3260         (Target_selector_powerpc::do_recognize): Delete.
3261
3262 2012-12-10  Alan Modra  <amodra@gmail.com>
3263
3264         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
3265         stub_table_.
3266         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
3267
3268 2012-12-07  Roland McGrath  <mcgrathr@google.com>
3269
3270         * testsuite/binary_unittest.cc (Sized_binary_test):
3271         Use open_descriptor rather than ::open.
3272
3273 2012-12-07  Alan Modra  <amodra@gmail.com>
3274
3275         * powerpc.cc (Stub_table::do_write): Delete redundant Address
3276         typedef and invalid_address constant.
3277         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
3278         instantiate constants.
3279
3280 2012-12-06  Roland McGrath  <mcgrathr@google.com>
3281
3282         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
3283         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
3284         * aclocal.m4: Regenerate.
3285         * configure: Regenerate.
3286         * Makefile.in: Regenerate.
3287         * testsuite/Makefile.in: Regenerate.
3288
3289 2012-12-07  Alan Modra  <amodra@gmail.com>
3290
3291         * options.h (General_options): Add no_toc_optimize.
3292         * powerpc.cc (ok_lo_toc_insn): New function.
3293         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
3294
3295 2012-12-06  Alan Modra  <amodra@gmail.com>
3296
3297         * options.h (General_options): Add plt_align, plt_static_chain,
3298         plt_thread_safe.  Update stub_group_size help text.
3299         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
3300         for new plt_thread_safe_ var.
3301         (use_plt_offset): Correct comments.
3302         (Target_powerpc::do_relax): Look for thread creation symbols to
3303         determine default plt_thread_safe value.  Clear plt call stubs
3304         as well as branch stubs each iteration.
3305         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
3306         insn constants.
3307         (l, hi, ha, write_insn): Move earlier.
3308         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
3309         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
3310         plt stubs too.
3311         (Stub_table::update_size): Adjust.
3312         (Stub_table::prev_size, set_prev_size): Delete.
3313         (Stub_table::stub_align): Let --plt-align affect result.
3314         (Stub_table::plt_call_size): Calculate sizes for various stubs.
3315         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
3316         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
3317         (Stub_table::do_write): Support more stub variants.
3318
3319 2012-12-04  Alan Modra  <amodra@gmail.com>
3320
3321         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
3322         (Target_powerpc::do_define_standard_symbols): New function.
3323
3324 2012-12-03  Alan Modra  <amodra@gmail.com>
3325
3326         * output.h: Formatting, whitespace.
3327
3328 2012-12-03  Alan Modra  <amodra@gmail.com>
3329
3330         * layout.h (Layout::get_executable_sections): Declare.
3331         * layout.cc (Layout::get_executable_sections): New function.
3332         * arm.cc (Target_arm::group_sections): Use it.
3333         (Arm_output_section::group_sections): Delete now redundant test.
3334         * output.cc (Output_reloc::Output_reloc): Add is_relative.
3335         param to handle relative relocs.
3336         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
3337         (Output_data_reloc::add_absolute): Adjust.
3338         (Output_data_reloc::add_relative): New function.
3339         (Output_data::reset_data_size): New function.
3340         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
3341         (Output_section::set_addralign): New function.
3342         (Output_section::checkpoint_set_addralign): New function.
3343         (Output_section::clear_section_offsets_need_adjustment): New function.
3344         (Output_section::input_sections): Make public.
3345         * powerpc.cc (class Output_data_brlt_powerpc): New.
3346         (class Stub_table, class Stub_control): New.
3347         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
3348         stub_table_, set_stub_table, stub_table): New vectors and accessor
3349         functions.
3350         (Target_powerpc::do_may_relax, do_relax, push_branch,
3351         new_stub_table, stub_tables, brlt_section, group_sections,
3352         add_branch_lookup_table, find_branch_lookup_table,
3353         write_branch_lookup_table, make_brlt_section): New functions.
3354         (Target_powerpc::struct Sort_sections, class Branch_info): New.
3355         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
3356         branch_info_): New vars.
3357         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
3358         make call stubs here.
3359         (Output_data_glink): Remove all call stub handling from this class.
3360         (Target_powerpc::Scan::local, global): Save interesting branch
3361         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
3362         (Target_powerpc::do_finalize_sections): Only make reg save/restore
3363         functions on final link.
3364         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
3365         Handle long branch destinations too.
3366         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
3367         do_plt_address_for_local): Adjust lookup of plt call stubs.
3368
3369 2012-11-30  Alan Modra  <amodra@gmail.com>
3370
3371         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
3372         relocs against protected symbols when building 32-bit shared libs.
3373
3374 2012-11-30  Alan Modra  <amodra@gmail.com>
3375
3376         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
3377         param.  Call got_section() to make .got.  Update all callers
3378         and their callers and so on.
3379
3380 2012-11-30  Alan Modra  <amodra@gmail.com>
3381
3382         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
3383         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
3384         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
3385         value if it already exists.
3386
3387 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
3388
3389         PR gold/14858
3390         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
3391
3392 2012-11-14  Roland McGrath  <mcgrathr@google.com>
3393
3394         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
3395         than bfc instruction for data sandboxing.
3396
3397 2012-11-08  Alan Modra  <amodra@gmail.com>
3398
3399         * po/POTFILES.in: Regenerate.
3400
3401 2012-11-05  Alan Modra  <amodra@gmail.com>
3402
3403         * configure.ac: Apply 2012-09-10 change to config.in here.
3404         * configure: Regenerate.
3405
3406 2012-11-05  Alan Modra  <amodra@gmail.com>
3407
3408         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
3409         (struct Opd_ent): Use "Address" rather than "Offset".
3410         (Output_data_got_powerpc::got_base_offset): Return Valtype.
3411         (Target_powerpc::got_section): Make public.
3412         (Target_powerpc::scan_relocs): Move code setting symbols..
3413         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
3414         Create _SDA_BASE_ only when referenced.
3415
3416 2012-11-02  Roland McGrath  <mcgrathr@google.com>
3417
3418         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
3419         from last change.
3420
3421 2012-11-01  Roland McGrath  <mcgrathr@google.com>
3422
3423         * target.h (Sized_target::relocate_relocs): Use Elf_Off
3424         for offset_in_output_section parameter.
3425         (Sized_target::relocate_special_relocatable): Likewise.
3426         * arm.cc (Target_arm::relocate_relocs): Likewise.
3427         (Target_arm::relocate_special_relocatable): Likewise.
3428         * i386.cc (Target_i386::relocate_relocs): Likewise.
3429         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
3430         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
3431         * target-reloc.h (relocate_relocs): Likewise.
3432         * testsuite/testfile.cc (Target_test): Likewise.
3433         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
3434         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
3435
3436         * system.h: Move inclusion of <clocale> to after <libintl.h> in
3437         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
3438
3439         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
3440         parameter, which is unused in the [!F_SETFD] case.
3441
3442         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
3443         SYMNDX to off_t before comparing it to this->data_size().
3444         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
3445         * incremental.cc (Output_section_incremental_inputs::do_write):
3446         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
3447
3448         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
3449
3450 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
3451
3452         * gold.cc (Target_arm::do_adjust_elf_header): Add the
3453         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
3454         in EABI_VER5.
3455
3456 2012-10-29  Cary Coutant  <ccoutant@google.com>
3457
3458         * dwp.cc (usage): Add file and exit status parameters;
3459         add --help and --version options.
3460         (print_version): New function.
3461         (main): Add --help and --version options.
3462
3463 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3464
3465         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
3466         final_layout_sequence.txt.
3467         * testsuite/Makefile.in: Regenerated.
3468
3469 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3470
3471         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
3472         COMPILE generated by automake.
3473         (LINK1): Likewise.
3474         (CXXCOMPILE1): Likewise.
3475         (CXXLINK1): Likewise.
3476         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
3477         (LINK): Likewise.
3478         (CXXCOMPILE): Likewise.
3479         (CXXLINK): Likewise.
3480         * testsuite/Makefile.in: Regenerated.
3481
3482 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3483
3484         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
3485         on bad fwrite return.
3486
3487 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3488
3489         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
3490         on val.
3491
3492 2012-10-23  Cary Coutant  <ccoutant@google.com>
3493
3494         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
3495         * testsuite/Makefile.in: Regenerate.
3496         * testsuite/dwp_test.h: New source file.
3497         * testsuite/dwp_test_1.cc: New source file.
3498         * testsuite/dwp_test_1.s: New source file.
3499         * testsuite/dwp_test_1.sh: New source file.
3500         * testsuite/dwp_test_1b.cc: New source file.
3501         * testsuite/dwp_test_1b.s: New source file.
3502         * testsuite/dwp_test_2.cc: New source file.
3503         * testsuite/dwp_test_2.s: New source file.
3504         * testsuite/dwp_test_2.sh: New source file.
3505         * testsuite/dwp_test_main.cc: New source file.
3506         * testsuite/dwp_test_main.s: New source file.
3507
3508 2012-10-23  Cary Coutant  <ccoutant@google.com>
3509
3510         * dwp.h: New header file.
3511         * dwp.cc: New source file.
3512         * gold.h: Move shared declarations to system.h.
3513         * system.h: New header file.
3514         * Makefile.am: Add dwp.
3515         * Makefile.in: Regenerate.
3516
3517 2012-10-23  Cary Coutant  <ccoutant@google.com>
3518
3519         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
3520         Dwarf_info_reader::read_from_pointer.
3521         (Dwarf_pubnames_table::read_header): Likewise.
3522         (Dwarf_pubnames_table::next_name): Likewise.
3523         (Dwarf_die::read_attributes): Likewise.
3524         (Dwarf_die::skip_attributes): Likewise.
3525         (Dwarf_info_reader::read_from_pointer): New function template.
3526         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
3527         (Dwarf_pubnames_table): Likewise.
3528         (Dwarf_info_reader::read_from_pointer): New function template.
3529         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
3530         Dwarf_pubnames_table ctor.
3531
3532 2012-10-23  Cary Coutant  <ccoutant@google.com>
3533
3534         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
3535         abbrev_shndx.
3536         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
3537         abbrev_shndx_.
3538         (Dwarf_info_reader::set_abbrev_shndx): New method.
3539         (Dwarf_info_reader::abbrev_shndx_): New data member.
3540
3541 2012-10-23  Cary Coutant  <ccoutant@google.com>
3542
3543         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
3544         from object, not parameters.
3545         (Dwarf_info_reader::parse): Likewise.
3546         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
3547         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
3548         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
3549         methods.
3550
3551 2012-10-23  Cary Coutant  <ccoutant@google.com>
3552
3553         * fileread.cc (Input_file::Input_file): New constructor.
3554         * fileread.h (class Input_file): Add new constructor.
3555
3556 2012-10-18  Alan Modra  <amodra@gmail.com>
3557
3558         PR gold/14727
3559         * object.cc (Relobj::is_section_name_included): Also match
3560         .sdata personality section.
3561
3562 2012-10-18  Alan Modra  <amodra@gmail.com>
3563
3564         * target-reloc.h (class Default_comdat_behavior): New, package up..
3565         (get_comdat_behaviour): ..this.
3566         (relocate_section): Add Relocate_comdat_behavior template arg,
3567         adjust code to suit.
3568         * arm.cc (Target_arm::relocate_section): Adjust to suit.
3569         (Target_arm::scan_reloc_section): Likewise.
3570         * i386.cc (Target_i386::relocate_section): Likewise.
3571         * sparc.cc (Target_sparc::relocate_section): Likewise.
3572         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
3573         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
3574         * powerpc.cc (class Relocate_comdat_behavior): New.
3575         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
3576         gold::relocate_section with new template arg.
3577
3578 2012-10-18  Alan Modra  <amodra@gmail.com>
3579
3580         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
3581         dynamic relocs for GOT_TPREL got entries, without symbol if
3582         resolving locally.
3583         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
3584         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
3585         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
3586
3587 2012-10-17  Alan Modra  <amodra@gmail.com>
3588
3589         PR gold/14726
3590         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
3591
3592 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
3593
3594         * layout.cc (Layout::include_section): Keep sections marked
3595         SHF_EXCLUDE when doing relocatable links.
3596
3597 2012-10-16  Alan Modra  <amodra@gmail.com>
3598
3599         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
3600         (Target_powerpc::do_finalize_sections): Call it.
3601         (Output_data_save_res): New class and supporting functions.
3602         (Target_powerpc::symval_for_branch): Only look up .opd entry for
3603         normal symbols defined in object files.
3604
3605 2012-10-12  Alan Modra  <amodra@gmail.com>
3606
3607         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
3608         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
3609         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
3610         section if scan_opd_relocs not yet called.
3611         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
3612
3613 2012-10-12  Alan Modra  <amodra@gmail.com>
3614
3615         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3616         add_local_ifunc_entry): Revert last change.
3617         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
3618
3619 2012-10-05  Alan Modra  <amodra@gmail.com>
3620
3621         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
3622         do_plt_address_for_global): New functions.
3623         (Output_data_got_powerpc::do_write): Don't segfault when linking
3624         statically.
3625         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3626         add_local_ifunc_entry): Return true on adding entry..
3627         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
3628         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
3629         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
3630         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
3631         set up symbols here.
3632         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
3633         syms here.  Do so even when no .iplt.  Don't segfault when linking
3634         statically.
3635         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
3636         new variants without reloc param.
3637         (Glink_sym_ent::Glink_sym_ent): Likewise.
3638         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
3639         reloc when refs will resolve to plt call stub.
3640         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
3641         R_PPC_PLTREL24 to resolve locally.
3642         (Target_powerpc::Scan::global): Correct ifunc handling.
3643         (Target_powerpc::Relocate::relocate): Correct local sym glink
3644         lookup.  Don't destroy "value" when we have a plt call stub,
3645         and when checking plt call validity.
3646         (Target_powerpc::do_dynsym_value): Simplify.
3647
3648 2012-10-05  Alan Modra  <amodra@gmail.com>
3649
3650         * i386.cc (Output_data_plt_i386::address_for_global,
3651         address_for_local): Add plt offset to returned value.  Adjust uses.
3652         * sparc.cc (Output_data_plt_sparc::address_for_global,
3653         address_for_local): Likewise.
3654         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
3655         address_for_local): Likewise.
3656         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
3657         address_for_local): Likewise.
3658         * target.h (Target::plt_address_for_global, plt_address_for_local):
3659         Update comment.
3660         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
3661         (Output_data_got::Got_entry::write): Nor here.
3662         * output.h: Comment fix.
3663
3664 2012-10-02  Jiong Wang  <jiwang@tilera.com>
3665
3666         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
3667         global_offset_table_ value for larget got.
3668         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
3669
3670 2012-09-29  Alan Modra  <amodra@gmail.com>
3671
3672         * powerpc.cc (Target_powerpc::iplt_): New output section.
3673         (Target_powerpc::iplt_section, make_iplt_section,
3674         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
3675         (Target_powerpc::make_plt_entry): Handle ifunc syms.
3676         Target_powerpc::plt_entry_count): Count iplt entries too.
3677         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
3678         reloc section in constructor.  New params.
3679         (Target_powerpc::make_plt_section): Create reloc section here instead.
3680         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
3681         functions.
3682         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
3683         (Output_data_glink::add_entry, find_entry): New functions to
3684         deal with local syms.
3685         (Glink_sym_ent): Add support for local syms.
3686         (Output_data_glink::do_write): Handle ifunc plt entries.
3687         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3688         (Target_powerpc::Scan::local, global): Handle ifunc syms.
3689         (Target_powerpc::Relocate::relocate): Likewise.
3690         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
3691
3692 2012-09-25  Alan Modra  <amodra@gmail.com>
3693
3694         * object.h (Sized_relobj_file::adjust_local_symbol,
3695         do_adjust_local_symbol): New functions.
3696         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
3697         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
3698         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
3699         and irregular opd entry spacing.
3700         (Powerpc_relobj::do_read_relocs): Add opd size checks.
3701         (Global_symbol_visitor_opd): New functor.
3702         (Target_powerpc::do_finalize_sections): Omit global symbols defined
3703         on deleted opd entries.
3704
3705 2012-09-15  Jiong Wang  <jiwang@tilera.com>
3706
3707         * tilegx.cc: New file.
3708         * Makefile.am (TARGETSOURCES): Add tilegx.cc
3709         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
3710         * configure.tgt: Add entries for tilegx*.
3711         * configure.ac: Likewise.
3712         * Makefile.in: Rebuild.
3713         * configure: Likewise.
3714         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
3715         tilegx.
3716
3717 2012-09-13  Alan Modra  <amodra@gmail.com>
3718
3719         * target-reloc.h (scan_relocs): Call scan.local for relocs
3720         against symbols in discarded sections.  Pass is_discarded
3721         param.
3722         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
3723         Add is_discarded param.
3724         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
3725         is_discarded to flag opd entry as discarded.  Don't emit dyn
3726         relocs on such entries.
3727         (Target_powerpc::Scan::global): Similarly detect and handle
3728         such opd entries.
3729         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
3730         opd_ent_.  Update all uses.
3731         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
3732         (Target_powerpc::relocate_section): Zero out discarded opd
3733         entry relocs.
3734
3735 2012-09-12  Ian Lance Taylor  <iant@google.com>
3736
3737         PR gold/14570
3738         * output.cc: Rename Output_data_got template parameter from size
3739         to got_size for all functions.  Compile all variants of
3740         Output_data_got.
3741         (Output_data_got::Got_entry::write): Correct use of size for
3742         symbol value.  Use local_is_tls rather than casting to
3743         Sized_relobj_file.
3744         * object.h (class Object): Add local_is_tls and do_local_is_tls.
3745         (class Sized_relobj_file): Add do_local_is_tls.
3746         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
3747
3748 2012-09-11  Alan Modra  <amodra@gmail.com>
3749
3750         PR gold/14566
3751         * layout.cc (Layout::set_segment_offsets): When using
3752         common-page-size alignment, ensure we are on a new max-page-size
3753         page.
3754         * output.cc (Output_segment::set_section_addresses): Use
3755         abi_pagesize, not common_pagesize for relro boundary.
3756         (Output_segment::set_offset): Likewise.
3757
3758 2012-09-11  Alan Modra  <amodra@gmail.com>
3759
3760         * output.h (Output_data_got::add_global_tls, add_local_tls,
3761         add_local_tls_pair): New functions.
3762         (Output_data_got::add_local_pair_with_rel): Remove second
3763         reloc param.  Expand comment.
3764         (Output_data_got::Got_entry): Rename use_plt_offset_ to
3765         use_plt_or_tls_offset_, similarly for constructor param.
3766         (Output_data_got::Got_entry::write): Add got_index param.
3767         * output.cc (Output_data_got::add_global_tls, add_local_tls,
3768         add_local_tls_pair): New functions.
3769         (Output_data_got::Got_entry::write): Handle tls symbols
3770         with use_plt_or_tls_offset_ set specially.
3771         (Output_data_got::add_local_pair_with_rel): Only one reloc.
3772         (Output_data_got::do_write): Replace iterator with index, pass
3773         index to entry write function.
3774         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
3775         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
3776         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
3777         call.
3778         * i386.cc (Target_i386::Scan::local): Likewise.
3779         * sparc.cc (Target_sparc::Scan::local): Likewise.
3780         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
3781         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
3782         do_tls_offset_for_global): New functions.
3783         (Target_powerpc::Scan::local): Correct TLS relocations and got
3784         entry values.
3785         (Target_powerpc::Scan::global): Don't emit unnecessary
3786         dynamic relocations on TLS GOT entries.
3787
3788 2012-09-10  Matthias Klose  <doko@ubuntu.com>
3789
3790         * config.in: Disable sanity check for kfreebsd.
3791
3792 2012-09-10  Sterling Augustine  <saugustine@google.com>
3793
3794         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
3795         (Gdb_index::pubtypes_read): New parameter.
3796         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
3797         to calls.
3798         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
3799         pubtypes_object_.
3800
3801 2012-09-09  Alan Modra  <amodra@gmail.com>
3802
3803         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
3804         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
3805         * gc.h (gc_process_relocs): Call target gc_add_reference.
3806         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
3807         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
3808         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
3809         unnecessary cast.
3810         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
3811         to cater for when we don't need code offset.  Update use.
3812         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
3813         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
3814         set_opd_valid): New functions.
3815         (Target_powerpc::do_gc_add_reference): New function.
3816         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
3817         stashed refs.
3818         (Target_powerpc::do_gc_mark_symbol): New function.
3819
3820 2012-09-06  Cary Coutant  <ccoutant@google.com>
3821
3822         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
3823         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
3824         (Dwarf_die::skip_attributes): Likewise.
3825         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
3826         * testsuite/gdb_index_test.cc (inline_func_1): New function.
3827         (main): Call it.
3828         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
3829
3830 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
3831
3832         * testsuite/script_test_3.t: Add .got.plt output section
3833         statement.
3834         * testsuite/script_test_4.t: Likewise.
3835
3836 2012-09-05  Alan Modra  <amodra@gmail.com>
3837
3838         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
3839         update all uses and lose "enum" when using type.
3840
3841 2012-09-05  Alan Modra  <amodra@gmail.com>
3842
3843         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
3844         * configure: Regenerate.
3845         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
3846         (plugin_final_layout.stdout): Likewise.
3847         (memory_test): Set page sizes to 0x1000.
3848         * testsuite/Makefile.in: Regenerate.
3849         * testsuite/discard_locals_test.sh: Add FIXME comment.
3850         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
3851         * testsuite/pr14265.t: Add .got output section statement.
3852         * testsuite/script_test_2.t: Likewise.
3853         * testsuite/script_test_3.t: Likewise.
3854         * testsuite/script_test_4.t: Likewise.
3855         * testsuite/script_test_5.t: Likewise.
3856         * testsuite/script_test_6.t: Likewise.
3857         * testsuite/script_test_7.t: Likewise.
3858         * testsuite/script_test_9.t: Likewise.
3859
3860 2012-09-05  Alan Modra  <amodra@gmail.com>
3861
3862         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
3863         (Powerpc_relocate_functions::Status): New typedef.
3864         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3865         (Target_powerpc::Scan::local): Handle REL64.
3866         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
3867         for REL32 and REL64.
3868         (Target_powerpc::symval_for_branch): New function, extracted from..
3869         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
3870         checks.  Report overflow errors.
3871
3872 2012-09-05  Alan Modra  <amodra@gmail.com>
3873
3874         * object.h (Sized_relobj_file::emit_relocs): Delete.
3875         (Sized_relobj_file::emit_relocs_reltype): Delete.
3876         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
3877         relocate_relocs for --emit-relocs.
3878         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
3879         * output.h: Update comment.
3880         (Output_segment::first_section): New function.
3881         (Output_segment::first_section_load_address): Use first_section.
3882         * output.cc (Output_segment::first_section): New function extracted..
3883         (Output_segment::first_section_load_address): ..from here.  Delete.
3884         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
3885         * target.h (Sized_target::relocate_for_relocatable): Likewise.
3886         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
3887         adjust call to target.h function.
3888         * i386.cc (Target_i386): Likewise.
3889         * sparc.cc (Target_sparc): Likewise.
3890         * x86_64.cc (Target_x86_64): Likewise.
3891         * powerpc.cc (Target_powerpc): Likewise.
3892         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
3893         first tls section has section symbol for optimised local dynamic
3894         output relocs.
3895         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
3896         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
3897         optimised tls code.
3898         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
3899         Rename to relocate_relocs.  Update error message.
3900
3901 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
3902
3903         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
3904         --just-symbols.
3905
3906 2012-08-31  Alan Modra  <amodra@gmail.com>
3907
3908         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
3909         (Powerpc_relobj::toc_base_offset): New stub function.
3910         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
3911         got_mod_index_offset to tlsld_got_offset.  Update all refs.
3912         (Target_powerpc::Relocate::enum skip_tls): New.
3913         (Target_powerpc::call_tls_get_addr_): New var.
3914         (Target_powerpc::is_branch_reloc): Move to file scope.
3915         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
3916         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
3917         New functions.
3918         (Target_powerpc::enum Got_type): Delete old values, add new ones.
3919         (powerpc_info): Correct common_pagesize for ppc64.
3920         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
3921         (Powerpc_relocate_functions): Add overflow check enums and functions.
3922         Add non-shift version of rela, rela_ua.  Delete all rel public
3923         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
3924         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
3925         addr16_ha3, addr14 functions.
3926         (Output_data_got_powerpc::add_constant_pair): New function.
3927         (Output_data_got_powerpc::got_base_offset): Likewise.
3928         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
3929         (instruction constants): Sort, add some more.
3930         (Output_data_glink::do_write): Add and use Address typedef.  Use
3931         object->toc_base_offset() stub for 64-bit.
3932         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
3933         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3934         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
3935         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
3936         Always treat .opd relocs as against locally defined symbol.
3937         Correct condition for RELATIVE relocs.
3938         (Target_powerpc::do_finalize_sections): Test for NULL sections.
3939         (Target_powerpc::Relocate::relocate): Use plt call stub as value
3940         for 32-bit syms with a plt entry.  Correct ppc64 toc base
3941         calculations.  Handle TLS relocs, and more.  Add overflow
3942         checking and adjust for Powerpc_relocate_functions changes.
3943         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
3944         Reinstate --emit-relocs code with FIXME.
3945
3946 2012-08-30  Alan Modra  <amodra@gmail.com>
3947
3948         * layout.cc (Layout::set_segment_offsets): Set p_align to
3949         abi_pagesize, not common_pagesize.
3950         (Layout::relaxation_loop_body): Similarly use abi_pagesize
3951         to determine whether file header can go in segment.
3952
3953 2012-08-30  Alan Modra  <amodra@gmail.com>
3954
3955         * output.h (Output_reloc::Output_reloc <output section>): Add
3956         is_relative param.  Adjust calls.
3957         (Output_reloc::add_output_section_relative): New functions.
3958         * output.cc (Output_reloc::Output_reloc <output section>): Handle
3959         is_relative.
3960         (Output_reloc::symbol_value): Handle SECTION_CODE.
3961
3962 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
3963
3964         * gold.cc (queue_middle_tasks): Call layout again when unique
3965         segments for sections is desired.
3966         * layout.cc (Layout::Layout): Initialize new members.
3967         (Layout::get_output_section_flags): New function.
3968         (Layout::choose_output_section): Call get_output_section_flags.
3969         (Layout::layout): Make output section for mapping to a unique segment.
3970         (Layout::insert_section_segment_map): New function.
3971         (Layout::attach_allocated_section_to_segment): Make unique segment for
3972         output sections marked so.
3973         (Layout::segment_precedes): Check for unique segments when sorting.
3974         * layout.h (Layout::Unique_segment_info): New struct.
3975         (Layout::Section_segment_map): New typedef.
3976         (Layout::insert_section_segment_map): New function.
3977         (Layout::get_output_section_flags): New function.
3978         (Layout::is_unique_segment_for_sections_specified): New function.
3979         (Layout::set_unique_segment_for_sections_specified): New function.
3980         (Layout::unique_segment_for_sections_specified_): New member.
3981         (Layout::section_segment_map_): New member.
3982         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
3983         Rename is_gc_pass_one to is_pass_one.
3984         Rename is_gc_pass_two to is_pass_two.
3985         Rename is_gc_or_icf to is_two_pass.
3986         Check for which pass based on whether symbols data is present.
3987         Make it two pass when unique segments for sections is desired.
3988         * output.cc (Output_section::Output_section): Initialize new
3989         members.
3990         * output.h (Output_section::is_unique_segment): New function.
3991         (Output_section::set_is_unique_segment): New function.
3992         (Output_section::is_unique_segment_): New member.
3993         (Output_section::extra_segment_flags): New function.
3994         (Output_section::set_extra_segment_flags): New function.
3995         (Output_section::extra_segment_flags_): New member.
3996         (Output_section::segment_alignment): New function.
3997         (Output_section::set_segment_alignment): New function.
3998         (Output_section::segment_alignment_): New member.
3999         (Output_segment::Output_segment): Initialize is_unique_segment_.
4000         (Output_segment::is_unique_segment): New function.
4001         (Output_segment::set_is_unique_segment): New function.
4002         (Output_segment::is_unique_segment_): New member.
4003         * plugin.cc (allow_unique_segment_for_sections): New function.
4004         (unique_segment_for_sections): New function.
4005         (Plugin::load): Add new functions to transfer vector.
4006         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
4007         * Makefile.in: Regenerate.
4008         * testsuite/plugin_final_layout.sh: Check if unique segment
4009         functionality works.
4010         * testsuite/plugin_section_order.c (onload): Check if new interfaces
4011         are available.
4012         (allow_unique_segment_for_sections): New global.
4013         (unique_segment_for_sections): New global.
4014         (claim_file_hook): Call allow_unique_segment_for_sections.
4015         (all_symbols_read_hook): Call unique_segment_for_sections.
4016
4017 2012-08-22  Cary Coutant  <ccoutant@google.com>
4018
4019         * layout.cc (Layout::include_section): Don't assert on GROUP
4020         sections with --emit-relocs.
4021
4022 2012-08-21  Cary Coutant  <ccoutant@google.com>
4023
4024         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
4025         if --export-dynamic-symbol names an undef symbol.
4026
4027 2012-08-18  Alan Modra  <amodra@gmail.com>
4028
4029         * powerpc.cc: Formatting and white space.
4030         (Powerpc_relobj): Rename got2_section_ to special_.
4031         Add opd_ent_shndx_ and opd_ent_off_ vectors.
4032         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
4033         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
4034         (Target_powerpc): Add Address typedef and invalid_address.  Use
4035         throughout.
4036         (Target_powerpc::is_branch_reloc): New function.
4037         (Powerpc_relocate_functions): Add Address typedef, use throughout.
4038         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
4039         for dst_mask, value and addend.
4040         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
4041         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
4042         (Output_data_glink::do_write): Correct toc base.  Don't try to use
4043         uint16_t for 24-bit offset.  Use get_output_section_offset and
4044         check return.
4045         (Target_powerpc::Scan::local): Handle more relocs.
4046         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
4047         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
4048         Plug in toc restoring insn after plt calls.  Translate branches
4049         to function descriptor symbols to corresponding entry point.
4050         (Target_powerpc::relocate_for_relocatable): Check return from
4051         get_output_section_offset.
4052         * symtab.h: Comment typo.
4053
4054 2012-08-14  Ian Lance Taylor  <iant@google.com>
4055
4056         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
4057         unsupported_relocal_local to call unsupported_reloc_global.
4058
4059 2012-08-14  Nick Clifton  <nickc@redhat.com>
4060
4061         PR ld/14265
4062         * script-sections.cc (Sections_element::output_section_name): Add
4063         keep return parameter.
4064         (Output_section_element::match_name): Add keep return parameter.
4065         Return the value of the keep_ member.
4066         * script-sections.h (class Output_section): Update
4067         output_section_name prototype.
4068         * layout.cc (Layout::keep_input_section): New public member
4069         function.
4070         (Layout::choose_output_section): Pass keep parameter to
4071         output_section_name.
4072         * layout.h (class Layout): Add keep_input_section.
4073         * object.cc (Sized_relobj_file::do_layout): Check for kept input
4074         sections.
4075         * testsuite/Makefile.am: Add a test.
4076         * testsuite/Makefile.in: Regenerate.
4077         * testsuite/pr14265.c: Source file for the test.
4078         * testsuite/pr14265.t: Linker script for the test.
4079         * testsuite/pr14265.sh: Shell script for the test.
4080
4081 2012-08-14  Alan Modra  <amodra@gmail.com>
4082
4083         * target.h (Target::output_section_name): New function.
4084         (Target::do_output_section_name): New function.
4085         * layout.cc (Layout::choose_output_section): Call the above.
4086         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
4087
4088 2012-08-14  Alan Modra  <amodra@gmail.com>
4089
4090         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
4091         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
4092         for replace_constant call.
4093         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
4094         (Output_data_glink::do_print_to_mapfile): New function.
4095         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
4096         (Target_powerpc::Relocate::relocate): Likewise.
4097
4098 2012-08-14  Alan Modra  <amodra@gmail.com>
4099
4100         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
4101         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
4102         (Output_data_glink::add_entry,find_entry): Remove shndx param.
4103         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
4104         all references to shndx_.  Handle special case for R_PPC_PLTREL24
4105         here.
4106         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
4107         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
4108         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
4109         here.
4110         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
4111         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
4112
4113 2012-08-12  Alan Modra  <amodra@gmail.com>
4114
4115         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
4116         (glink insn constants): Use uint32_t.
4117         (Output_data_glink::add_entry): Use insert, not [] operator.
4118
4119 2012-08-11  Alan Modra  <amodra@gmail.com>
4120
4121         * object.h (Sized_relobj_file::find_shdr): New function.
4122         (Sized_relobj_file::find_special_sections): New function.
4123         * object.cc (Sized_relobj_file::find_shdr): New function.
4124         (Sized_relobj_file::find_eh_frame): Use find_shdr.
4125         (Sized_relobj_file::find_special_sections): New function, split out..
4126         (Sized_relobj_file::do_read_symbols): ..from here.
4127         * output.h (Output_data_got::replace_constant): New function.
4128         (Output_data_got::num_entries): New function.
4129         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
4130         (Output_data_got::got_offset): Protected rather than private.
4131         (Output_data_got::replace_got_entry): New function.
4132         * output.cc (Output_data_got::replace_got_entry): New function.
4133         * powerpc.cc (class Powerpc_relobj): New.
4134         (class Powerpc_relocate_functions): Delete all psymval variants or
4135         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
4136         Implement _ha functions using corresponding _hi function.
4137         (Powerpc_relobj::find_special_sections): New function.
4138         (Target_powerpc::do_make_elf_object): New function.
4139         (class Output_data_got_powerpc): New.
4140         (class Output_data_glink): New.
4141         (class Powerpc_scan_relocatable_reloc): New.
4142         Many more changes througout file.
4143
4144 2012-08-09  Nick Clifton  <nickc@redhat.com>
4145
4146         * po/vi.po: Updated Vietnamese translation.
4147
4148 2012-08-07  Ian Lance Taylor  <iant@google.com>
4149
4150         * layout.cc (Layout::add_target_dynamic_tags): If
4151         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
4152         plt_rel.
4153
4154 2012-07-30  Nick Clifton  <nickc@redhat.com>
4155
4156         * po/gold.pot: Updated template.
4157         * po/es.po: Updated Spanish translation.
4158
4159 2012-07-18  Cary Coutant  <ccoutant@google.com>
4160
4161         PR gold/14344
4162         * configure.ac: Add check for -gpubnames support.
4163         * configure: Regenerate.
4164         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
4165         support; force -gno-pubnames.
4166         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
4167         support.
4168         (gdb_index_test_4): New test.
4169         * testsuite/Makefile.in: Regenerate.
4170         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
4171         * testsuite/gdb_index_test_2.sh: Likewise.
4172         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
4173         * testsuite/gdb_index_test_4.sh: New script.
4174         * testsuite/gdb_index_test_comm.sh: New script with common code;
4175         don't look for space after colon.
4176
4177 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
4178
4179         * gold.cc (queue_middle_tasks): Update function order only after
4180         deferred objects due to plugins are processed.
4181
4182 2012-07-11  Ian Lance Taylor  <iant@google.com>
4183
4184         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
4185         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
4186         (Target_arm::scan_reloc_for_stub): Likewise.
4187         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
4188         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
4189         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
4190         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
4191         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
4192
4193 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
4194             Ian Lance Taylor  <iant@google.com>
4195
4196         PR gold/14309
4197         * configure.ac: Test whether std::tr1::hash<off_t> works.
4198         * gold.h: Add a specialization for std::tr1::hash<off_t> if
4199         needed.
4200         * output.h (class Output_fill): Add virtual destructor.
4201         * configure, config.in: Rebuild.
4202
4203 2012-06-22  Roland McGrath  <mcgrathr@google.com>
4204
4205         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
4206
4207 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
4208
4209         * plugin.cc (Plugin::load): Handle position independent executables.
4210
4211 2012-06-06  Cary Coutant  <ccoutant@google.com>
4212
4213         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
4214         add .debug_macro.
4215         (lines_only_debug_sections): Likewise.
4216         (gdb_fast_lookup_sections): New static array.
4217         (is_gdb_debug_section): Rename formal parameter.
4218         (is_lines_only_debug_section): Likewise.
4219         (is_gdb_fast_lookup_section): New function.
4220         (Layout::include_section): Check for ".zdebug_" prefix; pass
4221         section name suffix to is_gdb_debug_section, et al.; check for
4222         fast-lookup sections when building .gdb_index.
4223         * options.h (--strip-debug-gdb): Update GDB version number.
4224
4225 2012-06-06  Cary Coutant  <ccoutant@google.com>
4226
4227         * configure.ac: Add check for fallocate.
4228         * configure: Regenerate.
4229         * config.in: Regenerate.
4230
4231         * options.h (class General_options): Add --mmap-output-file and
4232         --posix-fallocate options.
4233         * output.cc: (posix_fallocate): Remove; replace with...
4234         (gold_fallocate): New function.
4235         (Output_file::map_no_anonymous): Call gold_fallocate.
4236         (Output_file::map): Check --mmap-output-file option.
4237
4238 2012-06-05  Jing Yu  <jingyu@google.com>
4239
4240         * gold.h (textdomain): Add do {} to empty while(0).
4241         (bindtextdomain): Likewise.
4242
4243 2012-06-04  Cary Coutant  <ccoutant@google.com>
4244
4245         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
4246         has_dynsym_index.
4247
4248 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
4249
4250         * symtab.cc (Symbol_table::define_special_symbol):
4251         Initialize *poldsym to prevent uninitialized variable errors.
4252
4253 2012-05-23  Cary Coutant  <ccoutant@google.com>
4254
4255         * layout.cc (Layout::section_name_mapping): Add rules to handle
4256         exact match on .data.rel.ro.local or .data.rel.ro.
4257         (Layout::output_section_name): Check for exact matches.
4258
4259 2012-05-23  Cary Coutant  <ccoutant@google.com>
4260
4261         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
4262         more carefully.
4263
4264 2012-05-22  Cary Coutant  <ccoutant@google.com>
4265
4266         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
4267         object before exporting symbol.
4268
4269 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
4270
4271         * testsuite/tls_test.cc: Include "config.h" first.
4272         * testsuite/tls_test_c.c: Likewise.
4273
4274 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
4275             Nick Clifton  <nickc@redhat.com>
4276
4277         PR 14072
4278         * configure.in: Add check that sysdep.h has been included before
4279         any system header files.
4280         * configure: Regenerate.
4281         * config.in: Regenerate.
4282
4283 2012-05-14  Cary Coutant  <ccoutant@google.com>
4284
4285         * layout.cc (Layout::make_output_section): Mark .tdata section
4286         as RELRO.
4287         * testsuite/relro_test.cc: Add a TLS variable.
4288
4289 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
4290
4291         PR gold/14091
4292         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
4293         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
4294         R_X86_64_64.
4295
4296 2012-05-08  Cary Coutant  <ccoutant@google.com>
4297
4298         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
4299         (lines_only_debug_sections): Likewise.
4300
4301 2012-05-02  Roland McGrath  <mcgrathr@google.com>
4302
4303         * nacl.cc: New file.
4304         * nacl.h: New file.
4305         * Makefile.am (CCFILES, HFILES): Add them.
4306         * Makefile.in: Regenerate.
4307         * i386.cc (Output_data_plt_i386_nacl): New class.
4308         (Output_data_plt_i386_nacl_exec): New class.
4309         (Output_data_plt_i386_nacl_dyn): New class.
4310         (Target_i386_nacl): New class.
4311         (Target_selector_i386_nacl): New class.
4312         (target_selector_i386): Use it instead of Target_selector_i386.
4313         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
4314         (Target_x86_64_nacl): New class.
4315         (Target_selector_x86_64_nacl): New class.
4316         (target_selector_x86_64, target_selector_x32): Use it instead of
4317         Target_selector_x86_64.
4318         * arm.cc (Output_data_plt_arm_nacl): New class.
4319         (Target_arm_nacl): New class.
4320         (Target_selector_arm_nacl): New class.
4321         (target_selector_arm, target_selector_armbe): Use it instead of
4322         Target_selector_arm.
4323
4324         * target-select.cc (select_target): Take new Input_file* and off_t
4325         arguments, pass them on to recognize method of selector.
4326         * object.cc (make_elf_sized_object): Update caller.
4327         * parameters.cc (parameters_force_valid_target): Likewise.
4328         * incremental.cc (make_sized_incremental_binary): Likewise.
4329         * target-select.h: Update decl.
4330         (Target_selector::recognize): Take new Input_file* argument,
4331         pass it on to do_recognize.
4332         (Target_selector::do_recognize): Take new Input_file* argument.
4333         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
4334         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
4335         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
4336         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
4337
4338         * target.h (Target::Target_info): New members isolate_execinstr
4339         and rosegment_gap.
4340         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
4341         * arm.cc (Target_arm::arm_info): Update initializer.
4342         * i386.cc (Target_i386::i386_info): Likewise.
4343         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
4344         * sparc.cc (Target_sparc::sparc_info): Likewise.
4345         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4346         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
4347         * layout.cc (Layout::attach_allocated_section_to_segment):
4348         Take new const Target* argument.  If target->isolate_execinstr(), act
4349         like --rosegment.
4350         (Layout::find_first_load_seg): Take new const Target* argument;
4351         if target->isolate_execinstr(), reject PF_X segments.
4352         (Layout::relaxation_loop_body): Update caller.
4353         (Layout::set_segment_offsets): If target->isolate_execinstr(),
4354         reset file offset to zero when we hit LOAD_SEG, and then do a second
4355         loop over the segments before LOAD_SEG to reassign offsets after
4356         addresses have been determined.  Handle target->rosegment_gap().
4357         (Layout::attach_section_to_segment): Take new const Target* argument;
4358         pass it to attach_allocated_section_to_segment.
4359         (Layout::make_output_section): Update caller.
4360         (Layout::attach_sections_to_segments): Take new const Target* argument;
4361         pass it to attach_section_to_segment.
4362         * gold.cc (queue_middle_tasks): Update caller.
4363         * layout.h (Layout): Update method decls with new arguments.
4364
4365         * arm.cc (Target_arm::Target_arm): Take optional argument for the
4366         Target_info pointer to use.
4367         (Target_arm::do_make_data_plt): New virtual method.
4368         (Target_arm::make_data_plt): New method that calls it.
4369         (Target_arm::make_plt_entry): Use it.
4370         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
4371         for the section alignment.
4372         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
4373         method.
4374         (Output_data_plt_arm::first_plt_entry_offset): Call it.
4375         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
4376         method.
4377         (Output_data_plt_arm::get_plt_entry_size): Call it.
4378         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
4379         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
4380         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
4381         method.
4382         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
4383         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
4384         method instead of sizeof(plt_entry).
4385         (Output_data_plt_arm::add_entry): Likewise.
4386         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
4387         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
4388         than static method.
4389         (Target_arm::plt_entry_size): Likewise.
4390         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
4391         Move to ...
4392         (Output_data_plt_arm_standard): ... here, new class.
4393         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
4394         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
4395         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
4396
4397         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4398         Take additional argument for the PLT entry size.
4399         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
4400         Use get_plt_entry_size method rather than plt_entry_size variable.
4401         (Output_data_plt_x86_64::reserve_slot): Likewise.
4402         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
4403         (Output_data_plt_x86_64::add_entry): Likewise.
4404         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
4405         (Output_data_plt_x86_64::address_for_global): Likewise.
4406         (Output_data_plt_x86_64::address_for_local): Likewise.
4407         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4408         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
4409         Make method non-static.
4410         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
4411         method.
4412         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
4413         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
4414         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
4415         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
4416         virtual method.
4417         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
4418         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
4419         virtual method.
4420         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
4421         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
4422         virtual method.
4423         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
4424         (Output_data_plt_x86_64::plt_entry_size)
4425         (Output_data_plt_x86_64::first_plt_entry)
4426         (Output_data_plt_x86_64::plt_entry)
4427         (Output_data_plt_x86_64::tlsdesc_plt_entry)
4428         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
4429         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
4430         (Output_data_plt_x86_64_standard): ... here, new class.
4431         (Target_x86_64::Target_x86_64): Take optional argument for the
4432         Target_info pointer to use.
4433         (Target_x86_64::do_make_data_plt): New virtual method.
4434         (Target_x86_64::make_data_plt): New method to call it.
4435         (Target_x86_64::init_got_plt_for_update): Use that.
4436         Call this->plt_->add_eh_frame method here.
4437         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
4438         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
4439         rather than static method.
4440         (Target_x86_64::plt_entry_size): Likewise.
4441         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
4442         rather than plt_entry_size variable.  Move guts of PLT filling to...
4443         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
4444         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
4445         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
4446
4447         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
4448         additional argument for the section alignment.
4449         Don't do add_eh_frame_for_plt here.
4450         (Output_data_plt_i386::first_plt_entry_offset): Make the method
4451         non-static.  Use get_plt_entry_size method rather than plt_entry_size
4452         variable.
4453         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
4454         method.
4455         (Output_data_plt_i386::get_plt_entry_size): Call it.
4456         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
4457         (Output_data_plt_i386::add_eh_frame): New method to call it.
4458         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
4459         method.
4460         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
4461         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
4462         method.
4463         (Output_data_plt_i386::fill_plt_entry): New method to call it.
4464         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
4465         method instead of plt_entry_size.
4466         (Output_data_plt_i386::plt_entry_size)
4467         (Output_data_plt_i386::plt_eh_frame_fde_size)
4468         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
4469         (Output_data_plt_i386_standard): ... here, new class.
4470         (Output_data_plt_i386_exec): New class.
4471         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
4472         (Output_data_plt_i386_exec::first_plt_entry): ... here.
4473         (Output_data_plt_i386::exec_plt_entry): Move to ...
4474         (Output_data_plt_i386_exec::plt_entry): ... here.
4475         (Output_data_plt_i386_dyn): New class.
4476         (Output_data_plt_i386::first_plt_entry): Move to ...
4477         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
4478         (Output_data_plt_i386::dyn_plt_entry): Move to ...
4479         (Output_data_plt_i386_dyn::plt_entry): ... here.
4480         (Target_i386::Target_i386): Take optional argument for the Target_info
4481         pointer to use.
4482         (Target_i386::do_make_data_plt): New virtual method.
4483         (Target_i386::make_data_plt): New method to call it.
4484         (Target_i386::make_plt_section): Use that.
4485         Call this->plt_->add_eh_frame method here.
4486         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
4487         rather than plt_entry_size variable.
4488         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
4489         (Output_data_plt_i386::address_for_local): Likewise.
4490         (Output_data_plt_i386::do_write): Likewise.
4491         Move guts of PLT filling to...
4492         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
4493         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
4494         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
4495         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
4496
4497 2012-05-01  Cary Coutant  <ccoutant@google.com>
4498
4499         * dwarf_reader.cc (Dwarf_die::read_attributes)
4500         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
4501         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
4502         * reduced_debug_output.cc
4503         (Output_reduced_debug_info_section::get_die_end): Remove
4504         DW_FORM_GNU_ref_index.  Add default case.
4505
4506 2012-04-26  Mark Wielaard  <mjw@redhat.com>
4507
4508         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
4509         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
4510         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
4511         DW_AT_high_pc as offset from DW_AT_low_pc.
4512
4513         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
4514         * testsuite/Makefile.in: Regenerate.
4515         * testsuite/gdb_index_test_3.c: New test source file.
4516         * testsuite/gdb_index_test_3.sh: New test source file.
4517
4518 2012-04-25  Ian Lance Taylor  <iant@google.com>
4519
4520         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
4521         pointer.
4522         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
4523         as a class, not a struct.
4524         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
4525         (Target_arm::apply_cortex_a8_workaround): Likewise.
4526         * gc.h: Declare Reloc_types as a struct, not a class.
4527         * object.h: Declare Symbols_data as a struct.
4528         * reloc.h: Declare Read_relocs_data as a struct.
4529         * target.h: Declare Relocate_info as a struct.
4530
4531 2012-04-24  David S. Miller  <davem@davemloft.net>
4532
4533         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
4534         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
4535         and R_SPARC_WPLT30.
4536
4537 2012-04-24  Cary Coutant  <ccoutant@google.com>
4538
4539         * incremental-dump.cc (find_input_containing_global): Replace
4540         magic number with symbolic constant.
4541         (dump_incremental_inputs): Update version number.
4542         * incremental.cc (Output_section_incremental_inputs): Update version
4543         number; import symbolic constants from Incremental_inputs_reader.
4544         (Incremental_inputs::create_data_sections): Align relocations
4545         section correctly for 64-bit targets.
4546         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
4547         constants; add padding.
4548         (Output_section_incremental_inputs::write_header): Add assert for
4549         header_size.
4550         (Output_section_incremental_inputs::write_input_files): Add assert
4551         for input_entry_size.
4552         (Output_section_incremental_inputs::write_info_blocks): Add padding;
4553         add assert for object_info_size, input_section_entry_size,
4554         global_sym_entry_size.
4555         * incremental.h (Incremental_inputs_reader): Add symbolic constants
4556         for data structure sizes; use them.
4557         (Incremental_input_entry_reader): Import symbolic constants from
4558         Incremental_inputs_reader; use them.
4559
4560 2012-04-23  David S. Miller  <davem@davemloft.net>
4561
4562         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
4563         and elf_flags_set_.
4564         (Target_sparc::Target_sparc): Initialize new fields.
4565         (Target_sparc::do_make_elf_object): New function.
4566         (Target_sparc::do_adjust_elf_header): New function.
4567
4568 2012-04-23  Cary Coutant  <ccoutant@google.com>
4569
4570         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
4571         CU range table of gdb index.
4572
4573 2012-04-20  David S. Miller  <davem@davemloft.net>
4574
4575         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
4576         instead of false.
4577
4578 2012-04-16  David S. Miller  <davem@davemloft.net>
4579
4580         * sparc.cc (Target_sparc::got_address): New function.
4581         (Sparc_relocate_functions::gdop_hix22): New function.
4582         (Sparc_relocate_functions::gdop_lox10): New function.
4583         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
4584         relocs.
4585         (Target_sparc::Scan::local): Likewise if the global symbol is not
4586         preemptible and is not IFUNC.
4587         (Target_sparc::Relocate::relocate): Perform GOTDATA code
4588         transformations for local and non-preemptible non-IFUNC global
4589         symbols.
4590
4591         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
4592         writing out 64-bit part of ranges.
4593
4594         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
4595         -fpic and -fpie respectively.
4596         * Makefile.in: Regenerate.
4597
4598         * sparc.cc (class Target_sparc): Add rela_ifunc_.
4599         (Target_sparc::Target_sparc): Initialize new field.
4600         (Target_sparc::do_plt_section_for_global): New function.
4601         (Target_sparc::do_plt_section_for_local): New function.
4602         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
4603         (Target_sparc::make_plt_section): New function, broken out of
4604         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
4605         (Target_sparc::make_plt_entry): Call make_plt_section.
4606         (Target_sparc::make_local_ifunc_plt_entry): New function.
4607         (Target_sparc::rela_ifunc_section): New function.
4608         (Target_sparc::plt_section): Remove const.
4609         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
4610         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
4611         and ifunc_count_ fields.
4612         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
4613         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
4614         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
4615         (Output_data_plt_sparc::rela_ifunc): New function.
4616         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
4617         (Output_data_plt_sparc::has_ifunc_section): New function.
4618         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
4619         (Output_data_plt_sparc::address_for_global): New function.
4620         (Output_data_plt_sparc::address_for_local): New function.
4621         (Output_data_plt_sparc::plt_index_to_offset): New function.
4622         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
4623         and entry_count.
4624         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
4625         entry_count.
4626         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
4627         R_SPARC_JMP_IREL to switch.
4628         (Target_sparc::Scan::check_non_pic): Likewise.
4629         (Target_sparc::Scan::local): Handle IFUNC symbols.
4630         (Target_sparc::Scan::local): Likewise.
4631         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
4632         and plt_address_for_local.
4633         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
4634         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
4635
4636         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
4637         (class Output_data_reloc): Adjust calls to Output_reloc_type.
4638         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
4639         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
4640         global relocs too.
4641         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
4642         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
4643         calls.
4644         * sparc.cc (Target_sparc::Scan::global): Likewise.
4645         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4646
4647 2012-04-16  Cary Coutant  <ccoutant@google.com>
4648
4649         * archive.cc (Library_base::should_include_member): Check for
4650         --export-dynamic-symbol.
4651         * options.h (class General_options): Add --export-dynamic-symbol.
4652         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
4653         --export-dynamic-symbol.
4654         (Symbol_table::gc_mark_undef_symbols): Likewise.
4655         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
4656
4657 2012-04-12  David S. Miller  <davem@davemloft.net>
4658
4659         * sparc.cc (Reloc::wdisp10): New relocation method.
4660         (Reloc::h34): Likewise.
4661         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
4662         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
4663         R_SPARC_WDISP10.
4664         (Target_sparc::Scan::local): Likewise.
4665         (Target_sparc::Scan::global): Likewise.
4666         (Target_sparc::Relocate::relocate): Likewise.
4667
4668 2012-04-09  Cary Coutant  <ccoutant@google.com>
4669
4670         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
4671         low_pc == 0.
4672
4673 2012-04-06  Ian Lance Taylor  <iant@google.com>
4674
4675         * timer.cc: #include <unistd.h>.
4676
4677 2012-04-06  Roland McGrath  <mcgrathr@google.com>
4678
4679         * configure.in (AC_CHECK_HEADERS): Add locale.h.
4680         * config.in: Regenerate.
4681         * configure: Regenerate.
4682
4683 2012-04-05  Nick Clifton  <nickc@redhat.com>
4684
4685         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
4686         (AM_LC_MESSAGES): Add.
4687         * aclocal.m4: Regenerate.
4688         * config.in: Regenerate.
4689         * configure: Regenerate.
4690
4691 2012-03-21  Cary Coutant  <ccoutant@google.com>
4692
4693         * Makefile.am: Add gdb-index.cc, gdb-index.h.
4694         * Makefile.in: Regenerate.
4695         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
4696         (Sized_elf_reloc_mapper::symbol_section): New function.
4697         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
4698         (make_elf_reloc_mapper): New function.
4699         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
4700         (Dwarf_abbrev_table::do_read_abbrevs): New function.
4701         (Dwarf_abbrev_table::do_get_abbrev): New function.
4702         (Dwarf_ranges_table::read_ranges_table): New function.
4703         (Dwarf_ranges_table::read_range_list): New function.
4704         (Dwarf_pubnames_table::read_section): New function.
4705         (Dwarf_pubnames_table::read_header): New function.
4706         (Dwarf_pubnames_table::next_name): New function.
4707         (Dwarf_die::Dwarf_die): New function.
4708         (Dwarf_die::read_attributes): New function.
4709         (Dwarf_die::skip_attributes): New function.
4710         (Dwarf_die::set_name): New function.
4711         (Dwarf_die::set_linkage_name): New function.
4712         (Dwarf_die::attribute): New function.
4713         (Dwarf_die::string_attribute): New function.
4714         (Dwarf_die::int_attribute): New function.
4715         (Dwarf_die::uint_attribute): New function.
4716         (Dwarf_die::ref_attribute): New function.
4717         (Dwarf_die::child_offset): New function.
4718         (Dwarf_die::sibling_offset): New function.
4719         (Dwarf_info_reader::check_buffer): New function.
4720         (Dwarf_info_reader::parse): New function.
4721         (Dwarf_info_reader::do_parse): New function.
4722         (Dwarf_info_reader::do_read_string_table): New function.
4723         (Dwarf_info_reader::lookup_reloc): New function.
4724         (Dwarf_info_reader::get_string): New function.
4725         (Dwarf_info_reader::visit_compilation_unit): New function.
4726         (Dwarf_info_reader::visit_type_unit): New function.
4727         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
4728         Sized_elf_reloc_mapper.
4729         (Sized_dwarf_line_info::symbol_section): Remove function.
4730         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
4731         (Sized_dwarf_line_info::read_line_mappings): Remove object
4732         parameter, adjust callers.
4733         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
4734         * dwarf_reader.h: Include <sys/types.h>.
4735         (class Track_relocs): Remove forward declaration.
4736         (class Elf_reloc_mapper): New class.
4737         (class Sized_elf_reloc_mapper): New class.
4738         (class Dwarf_abbrev_table): New class.
4739         (class Dwarf_range_list): New class.
4740         (class Dwarf_ranges_table): New class.
4741         (class Dwarf_pubnames_table): New class.
4742         (class Dwarf_die): New class.
4743         (class Dwarf_info_reader): New class.
4744         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
4745         (Sized_dwarf_line_info::symbol_section): Remove member function.
4746         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
4747         base class.
4748         * gdb-index.cc: New source file.
4749         * gdb-index.h: New source file.
4750         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
4751         and .debug_types sections, call Layout::add_to_gdb_index.
4752         (Sized_relobj_incr::do_section_name): Implement.
4753         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
4754         return type; Implement.
4755         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
4756         return type.
4757         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
4758         parameter list and return type.
4759         (Sized_incr_dynobj::do_section_contents): Likewise.
4760         * layout.cc: Include gdb-index.h.
4761         (Layout::Layout): Initialize gdb_index_data_.
4762         (Layout::init_fixed_output_section): Check for .gdb_index section.
4763         (Layout::add_to_gdb_index): New function. Instantiate.
4764         * layout.h: Add forward declaration for class Gdb_index.
4765         (Layout::add_to_gdb_index): New member function.
4766         (Layout::gdb_index_data_): New data member.
4767         * main.cc: Include gdb-index.h.
4768         (main): Print statistics for gdb index.
4769         * object.cc (Object::section_contents): Move code into
4770         do_section_contents.
4771         (need_decompressed_section): Check for sections needed when building
4772         gdb index.
4773         (build_compressed_section_map): Likewise.
4774         (Sized_relobj_file::do_read_symbols): Need local symbols when building
4775         gdb index.
4776         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
4777         sections; call Layout::add_to_gdb_index.
4778         (Sized_relobj_file::do_decompressed_section_contents): Call
4779         do_section_contents directly.
4780         * object.h (Object::do_section_contents): Adjust parameter list and
4781         return type.
4782         (Object::do_decompressed_section_contents): Call do_section_contents
4783         directly.
4784         (Sized_relobj_file::do_section_contents): Adjust parameter list and
4785         return type.
4786         * options.h (class General_options): Add --gdb-index option.
4787         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
4788         list and return type.
4789         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
4790         * reloc.h (Track_relocs::checkpoint): New function.
4791         (Track_relocs::reset): New function.
4792
4793         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
4794         New test cases.
4795         * testsuite/Makefile.in: Regenerate.
4796         * testsuite/gdb_index_test.cc: New test source file.
4797         * testsuite/gdb_index_test_1.sh: New test source file.
4798         * testsuite/gdb_index_test_2.sh: New test source file.
4799
4800 2012-03-19  Doug Kwan  <dougkwan@google.com>
4801
4802         * arm.cc (Target_arm::do_define_standard_symbols): New method.
4803         (Target_arm::do_finalize_sections): Remove code which defines
4804         __exidx_start and __exidx_end.  Make symbol table parameter
4805         anonymous as it is not used.
4806         * gold.cc (queue_middle_tasks): Call target hook to define any
4807         target-specific symbols.
4808         * target.h (Target::define_standard_symbols): New method.
4809         (Target::do_define_standard_symbols): Same.
4810         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
4811         * testsuite/Makefile.in: Regenerate.
4812         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
4813         and __exidx_end.
4814         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
4815         relocations are generated for __exidx_start and __exidx_end.
4816
4817 2012-03-16  Doug Kwan  <dougkwan@google.com>
4818
4819         * testsuite/Makefile.am: Disable test initpri3b.
4820         * testsuite/Makefile.in: Regenerate.
4821
4822 2012-03-15  Doug Kwan  <dougkwan@google.com>
4823
4824         * arm.cc (Target_arm::got_section): Make .got section read-only
4825         if -z now is given.
4826
4827 2012-03-15  Ian Lance Taylor  <iant@google.com>
4828
4829         PR gold/13850
4830         * layout.cc (Layout::make_output_section): Correctly mark
4831         SHT_INIT_ARRAY, et. al., as relro.
4832
4833 2012-03-14  Doug Kwan  <dougkwan@google.com>
4834
4835         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
4836         dynamic relocations for protected symbols in shared objects.
4837
4838 2012-03-13  Ian Lance Taylor  <iant@google.com>
4839
4840         * resolve.cc (Symbol_table::resolve): When merging common symbols,
4841         keep the larger alignment.
4842
4843 2012-03-12  Cary Coutant  <ccoutant@google.com>
4844
4845         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
4846         handling of DW_LNE_define_file.
4847
4848 2012-03-12  Cary Coutant  <ccoutant@google.com>
4849
4850         * reduced_debug_output.cc
4851         (Output_reduced_debug_info_section::get_die_end): Add new FORM
4852         codes to switch.
4853
4854 2012-02-29  Cary Coutant  <ccoutant@google.com>
4855
4856         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
4857
4858 2012-02-29  Cary Coutant  <ccoutant@google.com>
4859
4860         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4861         Call Object::decompressed_section_contents.
4862         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
4863         New dtor.
4864         (Sized_dwarf_line_info::buffer_start_): New data member.
4865         * merge.cc (Output_merge_data::do_add_input_section): Call
4866         Object::decompressed_section_contents.
4867         (Output_merge_string::do_add_input_section): Likewise.
4868         * object.cc (need_decompressed_section): New function.
4869         (build_compressed_section_map): Decompress sections needed later.
4870         (Sized_relobj_file::do_decompressed_section_contents): New function.
4871         (Sized_relobj_file::do_discard_decompressed_sections): New function.
4872         * object.h (Object::decompressed_section_contents): New function.
4873         (Object::discard_decompressed_sections): New function.
4874         (Object::do_decompressed_section_contents): New function.
4875         (Object::do_discard_decompressed_sections): New function.
4876         (Compressed_section_info): New type.
4877         (Compressed_section_map): Include decompressed section contents.
4878         (Sized_relobj_file::do_decompressed_section_contents): New function.
4879         (Sized_relobj_file::do_discard_decompressed_sections): New function.
4880
4881 2012-02-16  Cary Coutant  <ccoutant@google.com>
4882
4883         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
4884         * testsuite/Makefile.in: Regenerate.
4885
4886 2012-02-14  Cary Coutant  <ccoutant@google.com>
4887
4888         * options.cc (General_options::finalize): Disallow -pie and -static.
4889
4890 2012-02-03  Doug Kwan  <dougkwan@google.com>
4891
4892         * arm.cc (Arm_relocate_functions::abs8,
4893         Arm_relocate_functions::abs16): Use
4894         Bits::has_signed_unsigned_overflow32.
4895         (Arm_relocate_functions::thm_abs8): Correct range of
4896         overflow check.
4897         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
4898         in assertions.
4899
4900 2012-02-02  Doug Kwan  <dougkwan@google.com>
4901
4902         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
4903         position independent outputs, not just shared objects.
4904
4905 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
4906
4907         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
4908         * configure: Regenerated.
4909
4910 2012-01-27  Ian Lance Taylor  <iant@google.com>
4911
4912         * reloc.h (Bits): New class with static functions, copied from
4913         namespace utils in arm.cc.
4914         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
4915         instead.
4916
4917 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4918
4919         * incremental.cc (write_info_blocks): Correct relocation offset.
4920
4921 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4922
4923         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
4924         (Relocate::tls_gd_to_le): Likewise.
4925
4926 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4927
4928         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
4929
4930 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4931
4932         * configure.ac: Check if -mcmodel=medium works.
4933         * configure: Regenerated.
4934
4935 2012-01-24  Cary Coutant  <ccoutant@google.com>
4936
4937         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
4938         definition and ...
4939         (read_unsigned_LEB_128_x): ... this new function.
4940         (read_signed_LEB_128): Replaced with inline definition and ...
4941         (read_signed_LEB_128_x): ... this new function.
4942         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
4943         (read_unsigned_LEB_128): Add inline definition.
4944         (read_signed_LEB_128_x): New function.
4945         (read_signed_LEB_128): Add inline definition.
4946         * testsuite/Makefile.am (leb128_unittest): New unit test.
4947         * testsuite/Makefile.in: Regenerate.
4948         * testsuite/leb128_unittest.cc: New unit test.
4949
4950 2012-01-23  Ian Lance Taylor  <iant@google.com>
4951
4952         PR gold/13617
4953         * i386.cc (Target_i386::do_code_fill): When using a jmp
4954         instruction, pad with nop instructions.
4955         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4956
4957 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
4958
4959         * x86_64.cc (gc_process_relocs): Add typename on types used in
4960         template.
4961         (scan_relocs): Likewise.
4962         (relocate_section): Likewise.
4963         (apply_relocation): Likewise.
4964
4965 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
4966
4967         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
4968         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
4969         under x32.
4970
4971 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
4972
4973         * x86_64.cc: Initial support for x32.
4974
4975 2012-01-03  Cary Coutant  <ccoutant@google.com>
4976
4977         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
4978         Use abstract base class for GOT.
4979         * gold/output.h (class Output_data_got_base): New abstract base class.
4980         (class Output_data_got): Derive from new base class, adjust ctors.
4981         (Output_data_got::reserve_slot): Make virtual; rename to
4982         do_reserve_slot; Adjust callers.
4983         * gold/target.h (Sized_target::init_got_plt_for_update): Return
4984         pointer to abstract base class.
4985         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
4986
4987 2011-12-18  Ian Lance Taylor  <iant@google.com>
4988
4989         * object.h (Relobj::local_symbol_value): New function.
4990         (Relobj::local_plt_offset): New function.
4991         (Relobj::local_has_got_offset): New function.
4992         (Relobj::local_got_offset): New function.
4993         (Relobj::set_local_got_offset): New function.
4994         (Relobj::do_local_symbol_value): New pure virtual function.
4995         (Relobj::do_local_plt_offset): Likewise.
4996         (Relobj::do_local_has_got_offset): Likewise.
4997         (Relobj::do_local_got_offset): Likewise.
4998         (Relobj::do_set_local_got_offset): Likewise.
4999         (Sized_relobj::do_local_has_got_offset): Rename from
5000         local_has_got_offset.
5001         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
5002         (Sized_relobj::do_set_local_got_offset): Rename from
5003         set_local_got_offset.
5004         (Sized_relobj_file::do_local_plt_offset): Rename from
5005         local_plt_offset.
5006         (Sized_relobj_file::do_local_symbol_value): New function.
5007         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
5008         local_plt_offset.
5009         * output.cc (Output_data_got::Got_entry::write): Change object to
5010         Relobj.  Use local_symbol_value.
5011         (Output_data_got::add_global_with_rel): Change rel_dyn to
5012         Output_data_reloc_generic*.  Use add_global_generic.
5013         (Output_data_got::add_global_with_rela): Remove.  Change all
5014         callers to use add_global_with_rel.
5015         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
5016         Output_data_reloc_generic*.  Use add_global_generic.
5017         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
5018         callers to use add_global_pair_with_rel.
5019         (Output_data_got::add_local): Change object to Relobj*.
5020         (Output_data_got::add_local_plt): Likewise.
5021         (Output_data_got::add_local_with_rel): Change object to Relobj*,
5022         change rel_dyn to Output_data_reloc_generic*.  Use
5023         add_local_generic.
5024         (Output_data_got::add_local_with_rela): Remove.  Change all
5025         callers to use all_local_with_rel.
5026         (Output_data_got::add_local_pair_with_rel): Change object to
5027         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
5028         add_output_section_generic.
5029         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
5030         callers to use add_local_pair_with_rel.
5031         (Output_data_got::reserve_local): Change object to Relobj*.
5032         * output.h: (class Output_data_reloc_generic): Add pure virtual
5033         declarations for add_global_generic, add_local_generic,
5034         add_output_section_generic.
5035         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
5036         functions for Output_data_reloc_generic.  Update declarations for
5037         changes listed in output.cc.
5038         (class Output_data_got): Change template parameter to got_size.
5039         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
5040         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
5041         function.
5042         (Sized_relobj_incr::do_local_plt_offset): New function.
5043         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
5044         add_global_generic.
5045
5046 2011-12-17  Cary Coutant  <ccoutant@google.com>
5047
5048         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
5049         * resolve.cc (Symbol_table::resolve): Likewise.
5050         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
5051         arrays.
5052         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5053
5054 2011-12-16  Ian Lance Taylor  <iant@google.com>
5055
5056         * output.h (Output_data_reloc_generic::add): Only call
5057         add_dynamic_reloc if this is a dynamic reloc section.
5058
5059 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
5060
5061         PR gold/13505
5062         * target-reloc.h (apply_relocation): Replace <64, false> with
5063         <size, big_endian>.
5064
5065 2011-11-25  Nick Clifton  <nickc@redhat.com>
5066
5067         * po/it.po: New Italian translation.
5068
5069 2011-11-17  Sterling Augustine  <saugustine@google.com>
5070
5071         * script.cc (script_include_directive): Implement.
5072         (read_script_file): New local variables name and search_path. Update
5073         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
5074         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
5075         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
5076
5077 2011-11-11  Sterling Augustine  <saugustine@google.com>
5078
5079         * yyscript.y (section_cmd): Add support for INCLUDE directive.
5080         (file_or_sections_cmd): Likewise.
5081
5082 2011-11-11  Doug Kwan  <dougkwan@google.com>
5083
5084         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
5085         if --just-symbols is given.
5086
5087 2011-11-10  Doug Kwan  <dougkwan@google.com>
5088
5089         PR gold/13362
5090         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
5091         when processing data relocs.
5092         * reloc.h (Relocate_functions::rel_unaligned): New method.
5093         (Relocate_functions::pcrel_unaligned): Ditto.
5094         (Relocate_functions::rel32_unaligned): Ditto.
5095         (Relocate_functions::pcrel32_unaligned): Ditto.
5096
5097 2011-11-09  Doug Kwan  <dougkwan@google.com>
5098
5099         PR gold/13362
5100         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
5101         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
5102         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
5103         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5104         (Relocate_functions::rel_unaligned): New.
5105         (Relocate_functions::rel32_unaligned): New.
5106         * target-reloc.h (relocate_for_relocatable): Add code to handle
5107         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5108         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
5109         arm_unaligned_reloc_r): New targets.
5110         * testsuite/Makefile.in: Regenerate.
5111         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
5112         linking.
5113
5114 2011-11-02  Ian Lance Taylor  <iant@google.com>
5115
5116         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
5117         NATIVE_LINKER.
5118         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
5119         * options.cc (General_options::finalize): Use library search path
5120         from configure script if specified.  If not native and no sysroot,
5121         only search TOOLLIBDIR.
5122         * options.h (Search_directory::Search_directory): Change name to
5123         const std::string&.
5124         (General_options::add_to_library_path_with_sysroot): Change arg to
5125         const std::string&.
5126         * configure, Makefile.in, config.in: Rebuild.
5127
5128 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5129
5130         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
5131         we are working around the ARM1176 Erratum.
5132         * options.h (General_options::fix_arm1176): Add option.
5133         * testsuite/Makefile.am: Add testcases, and keep current ones
5134         working.
5135         * testsuite/Makefile.in: Regenerate.
5136         * testsuite/arm_fix_1176.s: New file.
5137         * testsuite/arm_fix_1176.sh: Likewise.
5138
5139 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5140
5141         * arm.cc (Target_arm::Target_arm): Remove initialisation of
5142         may_use_blx_.
5143         (Target_arm::may_use_blx): Remove method.
5144         (Target_arm::set_may_use_blx): Likewise.
5145         (Target_arm::may_use_v4t_interworking): New method.
5146         (Target_arm::may_use_v5t_interworking): Likewise.
5147         (Target_arm::may_use_blx_): Remove member variable.
5148         (Arm_relocate_functions::arm_branch_common): Check for v5T
5149         interworking.
5150         (Arm_relocate_functions::thumb_branch_common): Likewise.
5151         (Reloc_stub::stub_type_for_reloc): Likewise.
5152         (Target_arm::do_finalize_sections): Correct interworking checks.
5153         * testsuite/Makefile.am: Add new tests.
5154         * testsuite/Makefile.in: Regenerate.
5155         * testsuite/arm_farcall_arm_arm.s: New test.
5156         * testsuite/arm_farcall_arm_arm.sh: Likewise.
5157         * testsuite/arm_farcall_arm_thumb.s: Likewise.
5158         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
5159         * testsuite/arm_farcall_thumb_arm.s: Likewise.
5160         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
5161         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
5162         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
5163
5164 2011-10-31  Cary Coutant  <ccoutant@google.com>
5165
5166         PR gold/13023
5167         * expression.cc (Expression::eval_with_dot): Add
5168         is_section_dot_assignment parameter.
5169         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
5170         absolute and assigning to dot within a section.
5171         * script-sections.cc
5172         (Output_section_element_assignment::set_section_addresses): Pass
5173         dot_section to set_if_absolute.
5174         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
5175         as is_section_dot_assignment flag to eval_with_dot.
5176         (Output_section_element_dot_assignment::set_section_addresses):
5177         Likewise.
5178         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
5179         parameter.  Also set value if relative to dot_section; set the
5180         symbol's output_section.
5181         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
5182         parameter.  Adjust all callers.
5183         (Expression::eval_maybe_dot): Likewise.
5184         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
5185         Adjust all callers.
5186         * testsuite/script_test_2.t: Test assignment of an absolute value
5187         to dot within an output section element.
5188
5189 2011-10-31  Cary Coutant  <ccoutant@google.com>
5190
5191         * options.h (class General_options): Add --[no-]gnu-unique options.
5192         * symtab.cc (Symbol_table::sized_write_globals): Convert
5193         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
5194
5195 2011-10-31  Cary Coutant  <ccoutant@google.com>
5196
5197         PR gold/13359
5198         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
5199         unnecessary assertion.
5200         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
5201
5202 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
5203
5204         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5205         gc_mark_symbol.
5206         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5207         gc_mark_symbol.
5208         Change to just keep the section associated with symbol.
5209         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
5210         they are externally visible and --export-dynamic is turned on.
5211         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
5212
5213 2011-10-19  Ian Lance Taylor  <iant@google.com>
5214
5215         PR gold/13163
5216         * script-sections.cc
5217         (Output_section_element_dot_assignment::needs_output_section): New
5218         function.
5219
5220 2011-10-19  Ian Lance Taylor  <iant@google.com>
5221
5222         PR gold/13204
5223         * layout.cc (Layout::segment_precedes): Don't assert failure if a
5224         --section-start option was seen.
5225         * options.h (General_options::any_section_start): New function.
5226
5227 2011-10-18  David S. Miller  <davem@davemloft.net>
5228
5229         PR binutils/13301
5230         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
5231         member to track relocation locations that have moved during TLS
5232         reloc optimizations.
5233         (Target_sparc::Relocate::Relocate): Initialize to NULL.
5234         (Target_sparc::Relocate::relocate): Adjust view down by 4
5235         bytes if it matches reloc_adjust_addr_.
5236         (Target_sparc::Relocate::relocate_tls): Always move the
5237         __tls_get_addr call delay slot instruction forward 4 bytes when
5238         performing relaxation.
5239
5240 2011-10-18  Cary Coutant  <ccoutant@google.com>
5241
5242         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
5243         (Output_file::map_no_anonymous): Check for non-zero
5244         return code from posix_fallocate.
5245
5246 2011-10-17  Cary Coutant  <ccoutant@google.com>
5247
5248         PR gold/13245
5249         * plugin.cc (is_visible_from_outside): Check for symbols
5250         referenced from dynamic objects.
5251         * resolve.cc (Symbol_table::resolve): Don't count references
5252         from dynamic objects as references from real ELF files.
5253         * testsuite/plugin_test_2.sh: Adjust expected result.
5254
5255 2011-10-17  Cary Coutant  <ccoutant@google.com>
5256
5257         * gold.cc: Include timer.h.
5258         (queue_middle_tasks): Stamp time.
5259         (queue_final_tasks): Likewise.
5260         * main.cc (main): Store timer in parameters.  Print timers
5261         for each pass.
5262         * parameters.cc (Parameters::Parameters): Initialize timer_.
5263         (Parameters::set_timer): New function.
5264         (set_parameters_timer): New function.
5265         * parameters.h (Parameters::set_timer): New function.
5266         (Parameters::timer): New function.
5267         (Parameters::timer_): New data member.
5268         (set_parameters_timer): New function.
5269         * timer.cc (Timer::stamp): New function.
5270         (Timer::get_pass_time): New function.
5271         * timer.h (Timer::stamp): New function.
5272         (Timer::get_pass_time): New function.
5273         (Timer::pass_times_): New data member.
5274
5275 2011-10-17  Cary Coutant  <ccoutant@google.com>
5276
5277         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
5278         task for members of lib groups.
5279
5280 2011-10-17  Cary Coutant  <ccoutant@google.com>
5281
5282         PR gold/13288
5283         * fileread.cc (File_read::find_view): Add assert.
5284         (File_read::make_view): Move bounds check (replace with assert)...
5285         (File_read::find_or_make_view): ... to here.
5286
5287 2011-10-12  Cary Coutant  <ccoutant@google.com>
5288
5289         * output.cc (Output_file::open_base_file): Handle case where
5290         ::read returns less than requested size.
5291
5292 2011-10-10  Cary Coutant  <ccoutant@google.com>
5293
5294         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
5295         Initialize defined_count_.
5296         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
5297         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
5298         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
5299         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
5300         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
5301         * incremental.h (Sized_relobj_incr::defined_count_): New data
5302         member.
5303         (Sized_incr_dynobj::defined_count_): New data member.
5304         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
5305         Return zeroes instead of internal error.
5306
5307 2011-10-10  Cary Coutant  <ccoutant@google.com>
5308
5309         PR gold/13249
5310         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
5311         (Output_reloc::symbol_value): Return PLT offset if flag is set.
5312         * output.h (class Output_reloc): Add use_plt_offset flag.
5313         (Output_reloc::type_): Adjust size of bit field.
5314         (Output_reloc::use_plt_offset_): New bit field.
5315         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
5316         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
5317         flag.  Adjust all callers.
5318         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
5319         creating RELATIVE relocations.
5320
5321 2011-10-10  Nick Clifton  <nickc@redhat.com>
5322
5323         * po/es.po: Updated Spanish translation.
5324         * po/fi.po: Updated Finnish translation.
5325
5326 2011-10-03   Diego Novillo  <dnovillo@google.com>
5327
5328         * options.cc (parse_uint): Fix dereference of RETVAL.
5329
5330 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
5331
5332         * layout.h (section_order_map_): New member.
5333         (get_section_order_map): New member function.
5334         * output.cc (Output_section::add_input_section): Check for patterns
5335         only when --section-ordering-file is specified.
5336         * gold.cc (queue_middle_tasks): Delay updating order of sections till
5337         output_sections have been formed.
5338         * layout.cc (Layout_Layout): Initialize section_order_map_.
5339         * plugin.cc (update_section_order): Store order in order_map. Do not
5340         update the order.
5341         * testsuite/Makefile.am: Add test case for plugin_final_layout.
5342         * testsuite/Makefile.in: Regenerate.
5343         * testsuite/plugin_section_order.c: New file.
5344         * testsuite/plugin_final_layout.cc: New file.
5345         * testsuite/plugin_final_layout.sh: New file.
5346
5347 2011-09-29  Cary Coutant  <ccoutant@google.com>
5348
5349         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5350         Check for NULL.
5351         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
5352         symbols during incremental update.
5353         (Symbol_table::add_from_dynobj): Likewise.
5354
5355 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5356             Ian Lance Taylor  <iant@google.com>
5357
5358         * symtab.cc (Symbol_table::define_special_symbol): Always
5359         canonicalize version string.
5360
5361 2011-09-26  Cary Coutant  <ccoutant@google.com>
5362
5363         * gold.cc (queue_initial_tasks): Move option checks ...
5364         * options.cc (General_options::finalize): ... to here. Disable
5365         some options; make others fatal.
5366
5367 2011-09-26  Cary Coutant  <ccoutant@google.com>
5368
5369         gcc PR lto/47247
5370         * plugin.cc (get_symbols_v2): New function.
5371         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
5372         (is_referenced_from_outside): New function.
5373         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
5374         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
5375         (get_symbols): Pass version parameter.
5376         (get_symbols_v2): New function.
5377         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
5378         parameter.
5379         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
5380         (onload): Add LDPT_GET_SYMBOLS_V2.
5381         (all_symbols_read_hook): Use get_symbols_v2; check for
5382         LDPR_PREVAILING_DEF_IRONLY_EXP.
5383         * testsuite/plugin_test_3.sh: Update expected results.
5384
5385 2011-09-23  Simon Baldwin  <simonb@google.com>
5386
5387         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
5388         configuration options.
5389         * configure: Regenerate.
5390         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
5391         * Makefile.in: Regenerate.
5392         * testsuite/Makefile.in: Regenerate.
5393
5394 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
5395
5396         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
5397
5398 2011-09-19  Cary Coutant  <ccoutant@google.com>
5399
5400         * incremental.cc (can_incremental_update): Fix typo in comment.
5401         * incremental.h (can_incremental_update): Likewise.
5402
5403 2011-09-18  Cary Coutant  <ccoutant@google.com>
5404
5405         * incremental.cc (can_incremental_update): New function.
5406         * incremental.h (can_incremental_update): New function.
5407         * layout.cc (Layout::init_fixed_output_section): Call it.
5408         (Layout::make_output_section): Don't allow patch space in .eh_frame.
5409         * object.cc (Sized_relobj_file::do_layout): Call
5410         can_incremental_update.
5411
5412 2011-09-13  Cary Coutant  <ccoutant@google.com>
5413
5414         * configure.ac: Check for glibc support for gnu_indirect_function
5415         support with static linking, setting automake conditional
5416         IFUNC_STATIC.
5417         * Makefile.in: Regenerate.
5418         * configure: Regenerate.
5419
5420         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
5421         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
5422         for IFUNC_STATIC.
5423         * testsuite/Makefile.in: Regenerate.
5424
5425 2011-09-13  Cary Coutant  <ccoutant@google.com>
5426
5427         * incremental.cc (Sized_relobj_incr::do_layout): Call
5428         report_comdat_group for kept comdat sections.
5429         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
5430         * testsuite/Makefile.in: Regenerate.
5431         * testsuite/incr_comdat_test_1.cc: New source file.
5432         * testsuite/incr_comdat_test_2_v1.cc: New source file.
5433         * testsuite/incr_comdat_test_2_v2.cc: New source file.
5434         * testsuite/incr_comdat_test_2_v3.cc: New source file.
5435
5436 2011-09-13  Ian Lance Taylor  <iant@google.com>
5437
5438         * object.cc (Sized_relobj_file::do_layout): Remove unused local
5439         variable external_symbols_offset.
5440
5441 2011-09-12  Ian Lance Taylor  <iant@google.com>
5442
5443         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
5444         triggered if object has no symbols.
5445
5446 2011-09-09  David S. Miller  <davem@davemloft.net>
5447
5448         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
5449         (Output_fill_debug_line::do_write): Likewise.
5450
5451 2011-08-29  Cary Coutant  <ccoutant@google.com>
5452
5453         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
5454         casts to match formatting specs.
5455         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
5456
5457 2011-08-26  Cary Coutant  <ccoutant@google.com>
5458
5459         * layout.cc (Free_list::allocate): Provide guarantee of minimum
5460         remaining hole size when allocating.
5461         (Layout::make_output_section): Set fill methods for debug sections.
5462         * layout.h (Free_list::Free_list_node): Move from private to
5463         public.
5464         (Free_list::set_min_hole_size): New function.
5465         (Free_list::begin, Free_list::end): New functions.
5466         (Free_list::min_hole_): New data member.
5467         * output.cc: Include dwarf.h.
5468         (Output_fill_debug_info::do_minimum_hole_size): New function.
5469         (Output_fill_debug_info::do_write): New function.
5470         (Output_fill_debug_line::do_minimum_hole_size): New function.
5471         (Output_fill_debug_line::do_write): New function.
5472         (Output_section::Output_section): Initialize new data member.
5473         (Output_section::set_final_data_size): Ensure patch space is larger
5474         than minimum hole size.
5475         (Output_section::do_write): Fill holes in debug sections.
5476         * output.h (Output_fill): New class.
5477         (Output_fill_debug_info): New class.
5478         (Output_fill_debug_line): New class.
5479         (Output_section::set_free_space_fill): New function.
5480         (Output_section::free_space_fill_): New data member.
5481         * testsuite/Makefile.am (incremental_test_3): Add
5482         --incremental-patch option.
5483         (incremental_test_4): Likewise.
5484         (incremental_test_5): Likewise.
5485         (incremental_test_6): Likewise.
5486         (incremental_copy_test): Likewise.
5487         (incremental_common_test_1): Likewise.
5488         * testsuite/Makefile.in: Regenerate.
5489
5490 2011-08-26  Nick Clifton  <nickc@redhat.com>
5491
5492         * po/es.po: Updated Spanish translation.
5493
5494 2011-08-01  Cary Coutant  <ccoutant@google.com>
5495
5496         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
5497         * gold/testsuite/Makefile.in: Regenerate.
5498         * gold/testsuite/justsyms_exec.c: New source file.
5499         * gold/testsuite/justsyms_lib.c: New source file.
5500
5501 2011-08-01  Cary Coutant  <ccoutant@google.com>
5502
5503         * layout.cc (Layout::set_segment_offsets): Don't realign text
5504         segment if -Ttext was specified.
5505         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
5506         file type.
5507         * object.h (Sized_relobj_file::e_type): New function.
5508         (Sized_relobj_file::e_type_): New data member.
5509         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
5510         base address for ET_EXEC files.
5511         * target.cc (Target::do_make_elf_object_implementation): Allow
5512         ET_EXEC files with --just-symbols option.
5513
5514 2011-07-28  Cary Coutant  <ccoutant@google.com>
5515
5516         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
5517         Add thread_number parameter.
5518         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
5519         * workqueue-threads.cc
5520         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
5521         current thread if its thread number is greater than desired thread
5522         count.
5523         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
5524         Add thread_number parameter.
5525         (Workqueue::should_cancel_thread): Likewise.
5526         (Workqueue::find_runnable_or_wait): Pass thread_number to
5527         should_cancel_thread.
5528         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
5529         parameter.
5530
5531 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
5532
5533         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
5534         only after checking if it cannot be forced local.
5535         * symtab.h (is_externally_visible): Check if the symbol is not forced
5536         local.
5537
5538 2011-07-15  Ian Lance Taylor  <iant@google.com>
5539
5540         * options.h (class General_options): Add --print-output-format.
5541         Move -EL next to -EB, for  better --help output.
5542         * target-select.cc: Include <cstdio>, "options.h", and
5543         "parameters.h".
5544         (Target_selector::do_target_bfd_name): New function.
5545         (print_output_format): New function.
5546         * target-select.h (class Target_selector): Update declarations.
5547         (Target_selector::target_bfd_name): New function.
5548         (print_output_format): Declare.
5549         * main.cc: Include "target-select.h".
5550         (main): Handle --print-output-format.
5551         * gold.cc: Include "target-select.h".
5552         (queue_initial_tasks): Handle --print-output-format when there are
5553         no input files.
5554         * parameters.cc (parameters_force_valid_target): Give a better
5555         error message if -EB/-EL does not match target.
5556         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
5557         function.
5558
5559 2011-07-15  Ian Lance Taylor  <iant@google.com>
5560
5561         * i386.cc (class Output_data_plt_i386): Add layout_ field.
5562         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
5563         (Output_data_plt_i386::do_write): Write address of .dynamic
5564         section to first entry in .got.plt section.
5565         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
5566         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5567         Initialize layout_.
5568         (Output_data_plt_x86_64::do_write): Write address of .dynamic
5569         section to first entry in .got.plt section.
5570         * layout.h (Layout::dynamic_section): New function.
5571
5572 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
5573
5574         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
5575         to claim_file call.
5576         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
5577         input_section_position_, and input_section_glob_.
5578         (read_layout_from_file): Call function section_ordering_specified.
5579         * layout.h (is_section_ordering_specified): New function.
5580         (section_ordering_specified): New function.
5581         (section_ordering_specified_): New boolean member.
5582         * main.cc(main): Call load_plugins after layout object is defined.
5583         * output.cc (Output_section::add_input_section): Use
5584         function section_ordering_specified to check if section ordering is
5585         needed.
5586         * output.cc (Output_section::add_relaxed_input_section): Use
5587         function section_ordering_specified to check if section ordering is
5588         needed.
5589         (Output_section::update_section_layout): New function.
5590         (Output_section::sort_attached_input_sections): Check if input section
5591         must be reordered.
5592         * output.h (Output_section::update_section_layout): New function.
5593         * plugin.cc (get_section_count): New function.
5594         (get_section_type): New function.
5595         (get_section_name): New function.
5596         (get_section_contents): New function.
5597         (update_section_order): New function.
5598         (allow_section_ordering): New function.
5599         (Plugin::load): Add the new interfaces to the transfer vector.
5600         (Plugin_manager::load_plugins): New parameter.
5601         (Plugin_manager::all_symbols_read): New parameter.
5602         (Plugin_manager::claim_file): New parameter. Save the elf object for
5603         unclaimed objects.
5604         (Plugin_manager::get_elf_object): New function.
5605         (Plugin_manager::get_view): Change to directly use the bool to check
5606         if get_view is called from claim_file_hook.
5607         * plugin.h (input_objects): New function
5608         (Plugin__manager::load_plugins): New parameter.
5609         (Plugin_manager::claim_file): New parameter.
5610         (Plugin_manager::get_elf_object): New function.
5611         (Plugin_manager::in_claim_file_handler): New function.
5612         (Plugin_manager::in_claim_file_handler_): New member.
5613         (layout): New function.
5614         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
5615         handler with an extra parameter. Make the elf object before calling
5616         claim_file handler.
5617         * testsuite/plugin_test.c (get_section_count): New function pointer.
5618         (get_section_type): New function pointer.
5619         (get_section_name): New function pointer.
5620         (get_section_contents): New function pointer.
5621         (update_section_order): New function pointer.
5622         (allow_section_ordering): New function pointer.
5623         (onload): Check if the new interfaces exist.
5624
5625 2011-07-13  Ian Lance Taylor  <iant@google.com>
5626
5627         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
5628         relro section.
5629         * x86_64.cc (Target_x86_64::got_section): Likewise.
5630         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
5631         (relro_now_test_SOURCES): New variable.
5632         (relro_now_test_DEPENDENCIES): New variable.
5633         (relro_now_test_LDFLAGS): New variable.
5634         (relro_now_test_LDADD): New variable.
5635         (relro_now_test.so): New target.
5636         * testsuite/Makefile.in: Rebuild.
5637
5638 2011-07-12  Ian Lance Taylor  <iant@google.com>
5639
5640         PR gold/12980
5641         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
5642         GLOB_DAT relocation rather than a RELATIVE relocation for a
5643         protected symbol when creating a shared library.
5644         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5645         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
5646         * testsuite/protected_main_1.cc (main): Test that protected
5647         function has same address.
5648
5649 2011-07-11  Ian Lance Taylor  <iant@google.com>
5650
5651         PR gold/12979
5652         * options.h (class General_options): Add -Bgroup.
5653         * options.cc (General_options::finalize): If -Bgroup is set,
5654         default to --unresolved-symbols=report-all.
5655         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
5656         * target-reloc.h (issue_undefined_symbol_error): Handle
5657         --unresolved-symbols=report-all.
5658
5659 2011-07-08  Ian Lance Taylor  <iant@google.com>
5660
5661         PR gold/11985
5662         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
5663         if linker script discards key sections.
5664         (Layout::create_dynamic_symtab): Likewise.
5665         (Layout::assign_local_dynsym_offsets): Likewise.
5666         (Layout::sized_create_version_sections): Likewise.
5667         (Layout::create_interp): Likewise.
5668         (Layout::finish_dynamic_section): Likewise.
5669         (Layout::set_dynamic_symbol_size): Likewise.
5670
5671 2011-07-08  Ian Lance Taylor  <iant@google.com>
5672
5673         PR gold/12386
5674         * options.h (class General_options): Add --unresolved-symbols.
5675         * target-reloc.h (issue_undefined_symbol_error): Check
5676         --unresolved-symbols.  Add comments.
5677
5678 2011-07-08  Ian Lance Taylor  <iant@google.com>
5679
5680         * testsuite/odr_violation2.cc (Ordering::operator()): Make
5681         expression more complex.
5682
5683 2011-07-08  Ian Lance Taylor  <iant@google.com>
5684
5685         PR gold/11317
5686         * target-reloc.h (issue_undefined_symbol_error): New inline
5687         function, broken out of relocate_section.
5688         (relocate_section): Call issue_undefined_symbol_error.
5689         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5690         there is no TLS segment if we are about to issue an undefined
5691         symbol error.
5692         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5693
5694 2011-07-08  Ian Lance Taylor  <iant@google.com>
5695
5696         PR gold/12279
5697         * resolve.cc (Symbol_table::should_override): Add fromtype
5698         parameter.  Change all callers.  Give error when linking together
5699         TLS and non-TLS symbol.
5700         (Symbol_table::should_override_with_special): Add fromtype
5701         parameter.  Change all callers.
5702         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5703         there is no TLS segment if we have reported some errors.
5704         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5705
5706 2011-07-08  Ian Lance Taylor  <iant@google.com>
5707
5708         PR gold/12372
5709         * target.h (Target::plt_address_for_global): New function.
5710         (Target::plt_address_for_local): New function.
5711         (Target::plt_section_for_global): Remove.
5712         (Target::plt_section_for_local): Remove.
5713         (Target::do_plt_address_for_global): New virtual function.
5714         (Target::do_plt_address_for_local): New virtual function.
5715         (Target::do_plt_section_for_global): Remove.
5716         (Target::do_plt_section_for_local): Remove.
5717         (Target::register_global_plt_entry): Add Symbol_table and Layout
5718         parameters.
5719         * output.cc (Output_data_got::Got_entry::write): Use
5720         plt_address_for_global and plt_address_for_local.
5721         * layout.cc (Layout::add_target_dynamic_tags): Use size and
5722         address of output section.
5723         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
5724         got_irelative_, and irelative_count_ fields.  Update
5725         declarations.
5726         (Output_data_plt_i386::has_irelative_section): New function.
5727         (Output_data_plt_i386::entry_count): Add irelative_count_.
5728         (Output_data_plt_i386::set_final_data_size): Likewise.
5729         (class Target_i386): Add got_irelative_ and rel_irelative_
5730         fields.  Update declarations.
5731         (Target_i386::Target_i386): Initialize new fields.
5732         (Target_i386::do_plt_address_for_global): New function replacing
5733         do_plt_section_for_global.
5734         (Target_i386::do_plt_address_for_local): New function replacing
5735         do_plt_section_for_local.
5736         (Target_i386::got_section): Create got_irelative_.
5737         (Target_i386::rel_irelative_section): New function.
5738         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
5739         fields.  Don't define __rel_iplt_{start,end}.
5740         (Output_data_plt_i386::add_entry): Add symtab and layout
5741         parameters.  Change all callers.  Use different PLT and GOT for
5742         IFUNC symbols.
5743         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
5744         layout parameters.  Change all callers.  Use different PLT and
5745         GOT.
5746         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
5747         (Output_data_plt_i386::rel_irelative): New function.
5748         (Output_data_plt_i386::address_for_global): New function.
5749         (Output_data_plt_i386::address_for_local): New function.
5750         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
5751         IRELATIVE GOT when changing IFUNC GOT entries.
5752         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
5753         reloc.
5754         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
5755         if we didn't create an IRELATIVE GOT.
5756         (Target_i386::Relocate::relocate): Use plt_address_for_global and
5757         plt_address_for_local.
5758         (Target_i386::do_dynsym_value): Use plt_address_for_global.
5759         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
5760         got_irelative_, and irelative_count_ fields.  Update
5761         declarations.
5762         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5763         Initialize new fields.  Remove symtab parameter.  Change all
5764         callers.
5765         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
5766         irelative_count_.
5767         (Output_data_plt_x86_64::has_irelative_section): New function.
5768         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
5769         (class Target_x86_64): Add got_irelative_ and rel_irelative_
5770         fields.  Update declarations.
5771         (Target_x86_64::Target_x86_64): Initialize new fields.
5772         (Target_x86_64::do_plt_address_for_global): New function replacing
5773         do_plt_section_for_global.
5774         (Target_x86_64::do_plt_address_for_local): New function replacing
5775         do_plt_section_for_local.
5776         (Target_x86_64::got_section): Create got_irelative_.
5777         (Target_x86_64::rela_irelative_section): New function.
5778         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
5779         all callers.  Don't create __rel_iplt_{start,end}.
5780         (Output_data_plt_x86_64::add_entry): Add symtab and layout
5781         parameters.  Change all callers.  Use different PLT and GOT for
5782         IFUNC symbols.
5783         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
5784         layout parameters.  Change all callers.  Use different PLT and
5785         GOT.
5786         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
5787         parameters.  Change all callers.  Use different PLT and GOT for
5788         IFUNC symbols.
5789         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
5790         (Output_data_plt_x86_64::rela_irelative): New function.
5791         (Output_data_plt_x86_64::address_for_global): New function.
5792         (Output_data_plt_x86_64::address_for_local): New function.
5793         (Output_data_plt_x86_64::set_final_data_size): Likewise.
5794         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
5795         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
5796         (Target_x86_64::register_global_plt_entry): Add symtab and layout
5797         parameters.
5798         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
5799         reloc.
5800         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
5801         symbols if we didn't create an IRELATIVE GOT.
5802         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
5803         plt_address_for_local.
5804         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
5805         * testsuite/ifuncvar1.c: New test file.
5806         * testsuite/ifuncvar2.c: New test file.
5807         * testsuite/ifuncvar3.c: New test file.
5808         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
5809         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
5810         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
5811         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
5812         * testsuite/Makefile.in: Rebuild.
5813
5814 2011-07-07  Cary Coutant  <ccoutant@google.com>
5815
5816         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
5817         (two_file_test_1_ndebug.o): Likewise.
5818         (two_file_test_1b_ndebug.o): Likewise.
5819         (two_file_test_2_ndebug.o): Likewise.
5820         (two_file_test_main_ndebug.o): Likewise.
5821         (incremental_test_2): Link with no-debug versions.
5822
5823 2011-07-06  Cary Coutant  <ccoutant@google.com>
5824
5825         * gold/incremental.cc
5826         (Output_section_incremental_inputs::write_info_blocks): Check for
5827         hidden and internal symbols.
5828
5829 2011-07-06  Cary Coutant  <ccoutant@google.com>
5830
5831         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
5832         Check disposition for startup file.
5833         (Incremental_inputs::report_command_line): Ignore
5834         --incremental-startup-unchanged option.
5835         * options.cc (General_options::parse_incremental_startup_unchanged):
5836         New function.
5837         (General_options::General_options): Initialize new data member.
5838         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
5839         (General_options): Add --incremental-startup-unchanged option.
5840         (General_options::incremental_startup_disposition): New function.
5841         (General_options::incremental_startup_disposition_): New data member.
5842
5843 2011-07-06  Cary Coutant  <ccoutant@google.com>
5844
5845         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
5846         input file index to Script_info ctor.
5847         (Sized_incremental_binary::do_file_has_changed): Find the
5848         command-line argument for files named in scripts.
5849         * incremental.h (Script_info::Script_info): New ctor
5850         with input file index.
5851         (Script_info::input_file_index): New function.
5852         (Script_info::input_file_index_): New data member.
5853         (Incremental_binary::get_library): Add const.
5854         (Incremental_binary::get_script_info): Add const.
5855         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
5856         * testsuite/Makefile.am (incremental_test_5): New test case.
5857         (incremental_test_6): New test case.
5858         * testsuite/Makefile.in: Regenerate.
5859
5860 2011-07-06  Cary Coutant  <ccoutant@google.com>
5861
5862         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
5863         debug output when command lines differ.
5864
5865 2011-07-06  Cary Coutant  <ccoutant@google.com>
5866
5867         * incremental.cc (Incremental_inputs::report_command_line): Ignore
5868         --incremental-patch option.
5869         * layout.cc (Free_list::allocate): Extend allocation beyond original
5870         end if enabled.
5871         (Layout::make_output_section): Mark sections that should get
5872         patch space.
5873         * options.cc (parse_percent): New function.
5874         * options.h (parse_percent): New function.
5875         (DEFINE_percent): New macro.
5876         (General_options): Add --incremental-patch option.
5877         * output.cc (Output_section::Output_section): Initialize new data
5878         members.
5879         (Output_section::add_input_section): Print section name when out
5880         of patch space.
5881         (Output_section::add_output_section_data): Likewise.
5882         (Output_section::set_final_data_size): Add patch space when
5883         doing --incremental-full.
5884         (Output_section::do_reset_address_and_file_offset): Remove patch
5885         space.
5886         (Output_segment::set_section_list_addresses): Print debug output
5887         only if --incremental-update.
5888         * output.h (Output_section::set_is_patch_space_allowed): New function.
5889         (Output_section::is_patch_space_allowed_): New data member.
5890         (Output_section::patch_space_): New data member.
5891         * parameters.cc (Parameters::incremental_full): New function.
5892         * parameters.h (Parameters::incremental_full): New function
5893         * testsuite/Makefile.am (incremental_test_2): Add test for
5894         --incremental-patch option.
5895         * testsuite/Makefile.in: Regenerate.
5896         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
5897         (t18): Remove function body.
5898
5899 2011-07-05  Doug Kwan  <dougkwan@google.com>
5900
5901         PR gold/12771
5902         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
5903         Arm_Address type for relocation result.
5904         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
5905         overflow check.
5906         (Arm_relocate_functions::abs32): Use unaligned access.
5907         (Arm_relocate_functions::rel32): Ditto.
5908         (Arm_relocate_functions::prel31): Ditto.
5909         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
5910         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
5911         static data relocations.
5912         * testsuite/Makefile.in: Regnerate.
5913         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
5914
5915 2011-07-05  Ian Lance Taylor  <iant@google.com>
5916
5917         PR gold/12392
5918         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
5919         symbols if necessary.
5920         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5921
5922 2011-07-05  Ian Lance Taylor  <iant@google.com>
5923
5924         PR gold/12952
5925         * resolve.cc (Symbol::override_base_with_special): Simply override
5926         version with special symbol version, ignoring previous version.
5927
5928 2011-07-05  Ian Lance Taylor  <iant@google.com>
5929
5930         * object.cc (Sized_relobj_file::include_section_group): Add
5931         information to comment about signature location.
5932
5933 2011-07-02  Ian Lance Taylor  <iant@google.com>
5934
5935         PR gold/12957
5936         * options.h (class General_options): Add -f and -F.
5937         * options.cc (General_options::finalize): Fatal error if -f/-F
5938         are used without -shared.
5939         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
5940
5941 2011-07-02  Ian Lance Taylor  <iant@google.com>
5942
5943         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
5944
5945 2011-07-01  Ian Lance Taylor  <iant@google.com>
5946
5947         PR gold/12525
5948         PR gold/12952
5949         * resolve.cc (Symbol::override_base_with_special): Don't override
5950         the version if the overriding symbol has a different name.
5951         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
5952         all callers.  If we give an error about an undefined version,
5953         define the base version if necessary.
5954         * dynobj.h (class Versions): Update declaration.
5955         * testsuite/weak_alias_test_5.cc: New file.
5956         * testsuite/weak_alias_test.script: New file.
5957         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
5958         and versioned_alias have the right value, and call t2.
5959         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
5960         weak_alias_test_5.so.
5961         (weak_alias_test_LDADD): Likewise.
5962         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
5963         * testsuite/Makefile.in: Rebuild.
5964
5965 2011-07-01  Ian Lance Taylor  <iant@google.com>
5966
5967         PR gold/12525
5968         * options.h (class General_options): Support -z notext.
5969         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
5970         -Wl,-z,notext.
5971         (two_file_shared_nonpic.so): Likewise.
5972         (two_file_shared_mixed.so): Likewise.
5973         (two_file_shared_mixed_1.so): Likewise.
5974         (weak_undef_lib_nonpic.so): Likewise.
5975         (alt/weak_undef_lib_nonpic.so): Likewise.
5976         (tls_test_shared_nonpic.so): Likewise.
5977         * testsuite/Makefile.in: Rebuild.
5978
5979 2011-07-01  Ian Lance Taylor  <iant@google.com>
5980
5981         PR gold/12525
5982         * configure.ac: Test whether static linking works, setting
5983         the automake conditional HAVE_STATIC.
5984         * testsuite/Makefile.am: Disable tests using -static if
5985         HAVE_STATIC is not true.
5986         * configure, testsuite/Makefile.in: Rebuild.
5987
5988 2011-07-01  Ian Lance Taylor  <iant@google.com>
5989
5990         PR gold/12525
5991         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
5992         Assert if we see DW_EH_PE_indirect.
5993         * target.h (Target::ehframe_datarel_base): New function.
5994         (Target::do_ehframe_datarel_base): New target function.
5995         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
5996         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
5997         function.
5998
5999 2011-07-01  Ian Lance Taylor  <iant@google.com>
6000
6001         PR gold/12571
6002         * options.h (class General_options): Add
6003         --ld-generated-unwind-info.
6004         * ehframe.cc (Fde::write): Add address parameter.  Change all
6005         callers.  If associated with PLT, fill in address and size.
6006         (Cie::set_output_offset): Only add merge mapping if there is an
6007         object.
6008         (Cie::write): Add address parameter.  Change all callers.
6009         (Eh_frame::add_ehframe_for_plt): New function.
6010         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
6011         input_offset_ fields into union u_, with new plt field.
6012         (Fde::Fde): Adjust for new union field.
6013         (Fde::Fde) [Output_data version]: New constructor.
6014         (Fde::add_mapping): Only add merge mapping if there is an object.
6015         (class Cie): Update declarations.
6016         (class Eh_frame): Declare add_ehframe_for_plt.
6017         * layout.cc (Layout::layout_eh_frame): Break out code into
6018         make_eh_frame_section, and call it.
6019         (Layout::make_eh_frame_section): New function.
6020         (Layout::add_eh_frame_for_plt): New function.
6021         * layout.h (class Layout): Update declarations.
6022         * merge.cc (Merge_map::add_mapping): Add assertion.
6023         * i386.cc: Include "dwarf.h".
6024         (class Output_data_plt_i386): Make first_plt_entry,
6025         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
6026         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6027         and plt_eh_frame_fde.
6028         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
6029         boundary.  Call add_eh_frame_for_plt if appropriate.
6030         * x86_64.cc: Include "dwarf.h".
6031         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
6032         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
6033         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6034         and plt_eh_frame_fde.
6035         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
6036         appropriate.
6037
6038 2011-06-29  Ian Lance Taylor  <iant@google.com>
6039
6040         PR gold/12629
6041         * object.cc (Sized_relobj_file::layout_section): Change shdr
6042         parameter to be const.
6043         (Sized_relobj_file::layout_eh_frame_section): New function, broken
6044         out of do_layout.
6045         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
6046         appropriate.  Call layout_eh_frame_section.
6047         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
6048         sections.
6049         * object.h (class Sized_relobj_file): Update declarations.
6050
6051 2011-06-29  Ian Lance Taylor  <iant@google.com>
6052
6053         PR gold/12652
6054         * script.cc (Token::integer_value): Accept trailing M/m/K/k
6055         modifier.
6056         (Lex::gather_token): Accept trailing M/m/K/k for integers.
6057
6058 2011-06-29  Ian Lance Taylor  <iant@google.com>
6059
6060         PR gold/12675
6061         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
6062         SHT_X86_64_UNWIND.
6063         * layout.cc (Layout::layout_eh_frame): Likewise.
6064
6065 2011-06-29  Ian Lance Taylor  <iant@google.com>
6066
6067         PR gold/12695
6068         * layout.cc (Layout::symtab_section_shndx): New function.
6069         * layout.h (class Layout): Declare symtab_section_shndx.
6070         * output.cc (Output_section::write_header): Call it.
6071
6072 2011-06-29  Ian Lance Taylor  <iant@google.com>
6073
6074         PR gold/12818
6075         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
6076         symbols which are not used in a relocation.
6077
6078 2011-06-28  Ian Lance Taylor  <iant@google.com>
6079
6080         PR gold/12898
6081         * layout.cc (Layout::segment_precedes): Don't crash if a linker
6082         script create indistinguishable segments.
6083         (Layout::set_segment_offsets): Use stable_sort when sorting
6084         segments.  Pass this to Compare_segments constructor.
6085         * layout.h (class Layout): Make segment_precedes non-static.
6086         (class Compare_segments): Change from struct to class.  Add
6087         layout_ field.  Add constructor.
6088         * script-sections.cc
6089         (Script_sections::attach_sections_using_phdrs_clause): Rename
6090         local orphan to is_orphan.  Don't report failure to put empty
6091         section in segment.  On attachment failure, report name of
6092         section, and attach to first PT_LOAD segment.
6093
6094 2011-06-28  Ian Lance Taylor  <iant@google.com>
6095
6096         PR gold/12934
6097         * target-select.cc (Target_selector::Target_selector): Add
6098         emulation parameter.  Change all callers.
6099         (select_target_by_bfd_name): Rename from select_target_by_name.
6100         Change all callers.
6101         (select_target_by_emulation): New function.
6102         (supported_emulation_names): New function.
6103         * target-select.h (class Target_selector): Add emulation_ field.
6104         Update declarations.
6105         (Target_selector::recognize_by_bfd_name): Rename from
6106         recognize_by_name.  Change all callers.
6107         (Target_selector::supported_bfd_names): Rename from
6108         supported_names.  Change all callers.
6109         (Target_selector::recognize_by_emulation): New function.
6110         (Target_selector::supported_emulations): New function.
6111         (Target_selector::emulation): New function.
6112         (Target_selector::do_recognize_by_bfd_name): Rename from
6113         do_recognize_by_name.  Change all callers.
6114         (Target_selector::do_supported_bfd_names): Rename from
6115         do_supported_names.  Change all callers.
6116         (Target_selector::do_recognize_by_emulation): New function.
6117         (Target_selector::do_supported_emulations): New function.
6118         (select_target_by_bfd_name): Change name in declaration.
6119         (select_target_by_emulation): Declare.
6120         (supported_emulation_names): Declare.
6121         * parameters.cc (parameters_force_valid_target): Try to find
6122         target based on emulation from -m option.
6123         * options.h (class General_options): Change doc string for -m.
6124         * options.cc (help): Print emulations.
6125         (General_options::parse_V): Likewise.
6126         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
6127         Add emulation parameter.  Change all callers.
6128
6129 2011-06-28  Ian Lance Taylor  <iant@google.com>
6130
6131         * target.h (class Target): Add osabi_ field.
6132         (Target::osabi): New function.
6133         (Target::set_osabi): New function.
6134         (Target::Target): Initialize osabi_.
6135         (Target::do_adjust_elf_header): Make pure virtual.
6136         (Sized_target::do_adjust_elf_header): Declare.
6137         * target.cc (Sized_target::do_adjust_elf_header): New function.
6138         (class Sized_target): Instantiate all versions.
6139         * freebsd.h (class Target_freebsd): Remove.
6140         (Target_selector_freebsd::do_recognize): Call set_osabi on
6141         Target.
6142         (Target_selector_freebsd::do_recognize_by_name): Likewise.
6143         (Target_selector_freebsd::set_osabi): Remove.
6144         * i386.cc (class Target_i386): Inherit from Sized_target rather
6145         than Target_freebsd.
6146         * x86_64.cc (class Target_x86_64): Likewise.
6147
6148 2011-06-28  Ian Lance Taylor  <iant@google.com>
6149
6150         * target.h (Target::can_check_for_function_pointers): Rewrite.
6151         Make non-virtual.
6152         (Target::can_icf_inline_merge_sections): Likewise.
6153         (Target::section_may_have_icf_unsafe_poineters): Likewise.
6154         (Target::Target_info): Add can_icf_inline_merge_sections field.
6155         (Target::do_can_check_for_function_pointers): New virtual
6156         function.
6157         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
6158         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
6159         from can_check_for_function_pointers, move in file.
6160         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
6161         section_may_have_icf_unsafe_poineters, move in file.
6162         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
6163         * i386.cc (Target_i386::do_can_check_for_function_pointers):
6164         Rename from can_check_for_function_pointers, move in file.
6165         (Target_i386::can_icf_inline_merge_sections): Remove.
6166         (Target_i386::i386_info): Initialize
6167         can_icf_inline_merge_sections.
6168         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
6169         Initialize can_icf_inline_merge_sections.
6170         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
6171         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
6172         Rename from can_check_for_function_pointers, move in file.
6173         (Target_x86_64::can_icf_inline_merge_sections): Remove.
6174         (Target_x86_64::x86_64_info): Initialize
6175         can_icf_inline_merge_sections.
6176         * testsuite/testfile.cc (Target_test::test_target_info):
6177         Likewise.
6178         * icf.cc (get_section_contents): Correct formatting.
6179
6180 2011-06-27  Ian Lance Taylor  <iant@google.com>
6181
6182         * symtab.cc (Symbol::versioned_name): New function.
6183         (Symbol_table::add_to_final_symtab): Use versioned_name when
6184         appropriate.
6185         (Symbol_table::sized_write_symbol): Likewise.
6186         * symtab.h (class Symbol): Declare versioned_name.
6187         * stringpool.h (class Stringpool_template): Add variant of add
6188         which takes a std::basic_string.
6189         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
6190         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
6191         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
6192         (ver_test_12.o): New target.
6193         * testsuite/Makefile.in: Rebuild.
6194
6195 2011-06-27  Doug Kwan  <dougkwan@google.com>
6196
6197         * arm.cc (Arm_relocate_functions::thm_jump8,
6198         Arm_relocate_functions::thm_jump11): Use a wider signed
6199         type to compute offset.
6200         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
6201         arm_thm_jump8.
6202         * testsuite/Makefile.in: Regenerate.
6203         * testsuite/arm_branch_in_range.sh: Check test results of
6204         arm_thm_jump11 and arm_thm_jump8.
6205         * testsuite/arm_thm_jump11.s: New test source file.
6206         * testsuite/arm_thm_jump11.t: New linker script.
6207         * testsuite/arm_thm_jump8.s: New test source file.
6208         * testsuite/arm_thm_jump8.t: New linker script.
6209
6210 2011-06-24  Ian Lance Taylor  <iant@google.com>
6211
6212         * layout.cc: Include "object.h".
6213         (ctors_sections_in_init_array): New static variable.
6214         (Layout::is_ctors_in_init_array): New function.
6215         (Layout::layout): Add entry to ctors_sections_in_init_array if
6216         appropriate.
6217         * layout.h (class Layout): Declare is_ctors_in_init_array.
6218         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
6219         is_ctors_reverse_view is set.
6220         (Sized_relobj_file::write_sections): Add layout parameter.  Change
6221         all callers.  Set is_ctors_reverse_view field of View_size.
6222         (Sized_relobj_file::reverse_words): New function.
6223         * object.h (Sized_relobj_file::View_size): Add
6224         is_ctors_reverse_view field.
6225         (class Sized_relobj_file): Update declarations.
6226         * testsuite/initpri3.c: New test.
6227         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
6228         initpri3b.
6229         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
6230         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
6231         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
6232         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
6233         * testsuite/Makefile.in: Rebuild.
6234
6235 2011-06-24  Cary Coutant  <ccoutant@google.com>
6236
6237         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
6238         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
6239         (debug_msg_cdebug.err): New targets.
6240         * testsuite/Makefile.in: Regenerate.
6241         * testsuite/debug_msg.sh: Check output of link with compressed debug.
6242         Fix checks for link with shared library.
6243
6244 2011-06-24  Doug Kwan  <dougkwan@google.com>
6245
6246         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
6247         skip empty text sections.
6248         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
6249
6250 2011-06-22  Ian Lance Taylor  <iant@google.com>
6251
6252         PR gold/12910
6253         * options.h (class General_options): Add --ctors-in-init-array.
6254         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
6255         friends as SHT_PROGBITS for merging sections.
6256         (Layout::layout): Remove special handling of .init_array and
6257         friends.  Don't sort if doing relocatable link.  Sort for .ctors
6258         and .dtors if ctors_in_init_array.
6259         (Layout::make_output_section): Force correct section types for
6260         .init_array and friends.  Don't sort if doing relocatable link,
6261         Don't sort .ctors and .dtors if ctors_in_init_array.
6262         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
6263         (Layout::output_section_name): Add relobj parameter.  Change all
6264         callers.  Handle .ctors. and .dtors. in code rather than table.
6265         Handle .ctors and .dtors if ctors_in_init_array.
6266         (Layout::match_file_name): New function, moved from output.cc.
6267         * layout.h (class Layout): Update declarations.
6268         * output.cc: Include "layout.h".
6269         (Input_section_sort_entry::get_priority): New function.
6270         (Input_section_sort_entry::match_file_name): Just call
6271         Layout::match_file_name.
6272         (Output_section::Input_section_sort_init_fini_compare::operator()):
6273         Handle .ctors and .dtors.  Sort by explicit priority rather than
6274         by name.
6275         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
6276         * testsuite/initpri2.c: New test.
6277         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
6278         (check_PROGRAMS): Add initpri2.
6279         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
6280         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
6281         * configure, testsuite/Makefile.in: Rebuild.
6282
6283 2011-06-19  Ian Lance Taylor  <iant@google.com>
6284
6285         PR gold/12880
6286         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
6287         .interp section to a PT_INTERP segment even if we have seen a
6288         --dynamic-linker option.  Don't do it if we have seen a PHDRS
6289         clause in a linker script.
6290         (Layout::finalize): Don't create a .interp section if we've
6291         already create a PT_INTERP segment.
6292         (Layout::create_interp): Always call choose_output_section (revert
6293         patch of 2011-06-17).  Don't create PT_INTERP segment.
6294         * script-sections.cc
6295         (Script_sections::create_note_and_tls_segments): Add a .interp
6296         section to a PT_INTERP segment even if we have seen a
6297         --dynamic-linker option.
6298
6299 2011-06-18  Ian Lance Taylor  <iant@google.com>
6300
6301         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
6302         merely because a non-PT_LOAD segment has a dynamic reloc.
6303
6304 2011-06-18  Ian Lance Taylor  <iant@google.com>
6305
6306         * layout.cc (Layout::finish_dynamic_section): Don't create
6307         DT_FLAGS entry if not needed.
6308
6309 2011-06-18  Ian Lance Taylor  <iant@google.com>
6310
6311         PR gold/12745
6312         * layout.cc (Layout::layout_eh_frame): Correct handling of
6313         writable .eh_frame section.
6314
6315 2011-06-17  Ian Lance Taylor  <iant@google.com>
6316
6317         PR gold/12893
6318         * resolve.cc (Symbol_table::resolve): Don't give an error if a
6319         symbol is redefined with the exact same object and value.
6320
6321 2011-06-17  Ian Lance Taylor  <iant@google.com>
6322
6323         PR gold/12880
6324         * layout.h (class Layout): Add interp_segment_ field.
6325         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
6326         (Layout::attach_allocated_section_to_segment): If making shared
6327         library, put .interp section in PT_INTERP segment.
6328         (Layout::finalize): Also call create_interp if -dynamic-linker
6329         option was used.
6330         (Layout::create_interp): Assert that there is no PT_INTERP
6331         segment.  If not using a SECTIONS clause, use make_output_section.
6332         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
6333         * script-sections.cc
6334         (Script_sections::create_note_and_tls_segments): If making shared
6335         library, put .interp section in PT_INTERP segment.
6336
6337 2011-06-17  Ian Lance Taylor  <iant@google.com>
6338
6339         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
6340         when making a shared library.
6341
6342 2011-06-17  Ian Lance Taylor  <iant@google.com>
6343
6344         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
6345         parameter.  Change all callers.  Don't issue warning about PC32
6346         against locally defined symbol.
6347
6348 2011-06-16  Ian Lance Taylor  <iant@google.com>
6349
6350         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
6351         occurs in same object.
6352
6353 2011-06-14  Alan Modra  <amodra@gmail.com>
6354
6355         * po/POTFILES.in: Regenerate.
6356
6357 2011-06-09  Ian Lance Taylor  <iant@google.com>
6358
6359         * script-sections.cc
6360         (Orphan_output_section::set_section_addresses): For a relocatable
6361         link set address to 0.
6362
6363 2011-06-09  Cary Coutant  <ccoutant@google.com>
6364
6365         PR gold/12804
6366         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
6367         used with --compress-debug-sections.
6368         * gold/object.cc (Sized_relobj_file::do_layout): Report
6369         uncompressed size of compressed input sections.
6370
6371 2011-06-08  Cary Coutant  <ccoutant@google.com>
6372
6373         PR gold/12804
6374         * testsuite/two_file_test_2_v1.cc: Change initialization of
6375         v2 to keep it in .data.
6376
6377 2011-06-07  Cary Coutant  <ccoutant@google.com>
6378
6379         * common.cc (Symbol_table::do_allocate_commons_list): Call
6380         gold_fallback.
6381         * errors.cc (Errors::fatal): Adjust call to gold_exit.
6382         (Errors::fallback): New function.
6383         (gold_fallback): New function.
6384         * errors.h (Errors::fallback): New function.
6385         * gold.cc (gold_exit): Change status parameter to enum; adjust
6386         all callers.
6387         (queue_initial_tasks): Call gold_fallback.
6388         * gold.h: Include cstdlib.
6389         (Exit_status): New enum type.
6390         (gold_exit): Change status parameter to enum.
6391         (gold_fallback): New function.
6392         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
6393         (Layout::create_symtab_sections): Likewise.
6394         (Layout::create_shdrs): Likewise.
6395         * main.cc (main): Adjust call to gold_exit.
6396         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
6397         (Output_data_got::add_got_entry_pair): Likewise.
6398         (Output_section::add_input_section): Likewise.
6399         (Output_section::add_output_section_data): Likewise.
6400         (Output_segment::set_section_list_addresses): Likewise.
6401         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
6402
6403 2011-06-07  Cary Coutant  <ccoutant@google.com>
6404
6405         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
6406         for incremental links.
6407         * output.cc (Output_segment::set_section_list_addresses): Remove
6408         FIXME and test for TLS or BSS.
6409
6410 2011-06-07  Cary Coutant  <ccoutant@google.com>
6411
6412         * testsuite/Makefile.am: Add incremental_copy_test,
6413         incremental_common_test_1.
6414         * testsuite/Makefile.in: Regenerate.
6415         * testsuite/common_test_1_v1.c: New source file.
6416         * testsuite/common_test_1_v2.c: New source file.
6417         * testsuite/copy_test_v1.cc: New source file.
6418
6419 2011-06-07  Cary Coutant  <ccoutant@google.com>
6420
6421         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
6422         update, allocate common from bss section's free list.
6423         * incremental-dump.cc (dump_incremental_inputs): Print flag for
6424         linker-defined symbols.
6425         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
6426         Skip GOT and PLT entries that are no longer referenced.
6427         (Output_section_incremental_inputs::write_info_blocks): Mark
6428         linker-defined symbols.
6429         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
6430         * output.cc (Output_section::allocate): New function.
6431         * output.h (Output_section::allocate): New function.
6432         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
6433         linker-defined symbols.
6434         (Symbol::override_base_with_special): Copy is_predefined_ flag.
6435         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
6436         (Symbol::init_base_output_data): Likewise.
6437         (Symbol::init_base_output_segment): Likewise.
6438         (Symbol::init_base_constant): Likewise.
6439         (Sized_symbol::init_output_data): Likewise.
6440         (Sized_symbol::init_output_segment): Likewise.
6441         (Sized_symbol::init_constant): Likewise.
6442         (Symbol_table::do_define_in_output_data): Likewise.
6443         (Symbol_table::do_define_in_output_segment): Likewise.
6444         (Symbol_table::do_define_as_constant): Likewise.
6445         * symtab.h (Symbol::is_predefined): New function.
6446         (Symbol::init_base_output_data): Add is_predefined parameter.
6447         (Symbol::init_base_output_segment): Likewise.
6448         (Symbol::init_base_constant): Likewise.
6449         (Symbol::is_predefined_): New data member.
6450         (Sized_symbol::init_output_data): Add is_predefined parameter.
6451         (Sized_symbol::init_output_segment): Likewise.
6452         (Sized_symbol::init_constant): Likewise.
6453         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
6454
6455 2011-06-07  Cary Coutant  <ccoutant@google.com>
6456
6457         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
6458         instead of emit_copy_reloc.
6459         (Copy_relocs::emit_copy_reloc): Refactor.
6460         (Copy_relocs::make_copy_reloc): New function.
6461         (Copy_relocs::add_copy_reloc): Remove.
6462         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
6463         section.
6464         (Copy_relocs::make_copy_reloc): New function.
6465         (Copy_relocs::add_copy_reloc): Remove.
6466         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
6467         unchanged input files.
6468         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
6469         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
6470         Reserve BSS space for COPY relocations.
6471         (Sized_incremental_binary::do_emit_copy_relocs): New function.
6472         (Output_section_incremental_inputs::write_info_blocks): Record
6473         whether a symbol is copied from a shared object.
6474         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
6475         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
6476         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
6477         (Incremental_input_entry_reader::get_output_symbol_index): Add
6478         is_copy parameter.
6479         (Incremental_binary::emit_copy_relocs): New function.
6480         (Incremental_binary::do_emit_copy_relocs): New function.
6481         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6482         new data member.
6483         (Sized_incremental_binary::add_copy_reloc): New function.
6484         (Sized_incremental_binary::do_emit_copy_relocs): New function.
6485         (Sized_incremental_binary::Copy_reloc): New struct.
6486         (Sized_incremental_binary::Copy_relocs): New typedef.
6487         (Sized_incremental_binary::copy_relocs_): New data member.
6488         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
6489         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
6490         * target.h (Sized_target::emit_copy_reloc): New function.
6491         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
6492
6493 2011-06-02  Cary Coutant  <ccoutant@google.com>
6494
6495         PR gold/12163
6496         * gold/archive.cc (Archive::Archive): Initialize new data member.
6497         (Archive::include_all_members): Return if archive has already been
6498         included.
6499         * gold/archive.h (Archive::include_all_members_): New data member.
6500
6501 2011-06-02  Nick Clifton  <nickc@redhat.com>
6502
6503         * dynobj.h: Fix spelling mistake in comment.
6504         * output.cc: Likewise.
6505
6506 2011-05-31  Doug Kwan  <dougkwan@google.com>
6507             Asier Llano
6508
6509         PR gold/12826
6510         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
6511         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
6512         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
6513         redundant arm_exidx_test.so.
6514         * testsuite/Makefile.in: Regenerate.
6515         (check_SCRIPTS): Add pr12826.sh
6516         (check_DATA): Add pr12826.stdout
6517         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
6518         * testsuite/pr12826.sh: New file.
6519         * testsuite/pr12826_1.s: Ditto.
6520         * testsuite/pr12826_1.s: Ditto.
6521
6522 2011-05-30  Ian Lance Taylor  <iant@google.com>
6523
6524         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
6525         sections.
6526
6527 2011-05-29  Ian Lance Taylor  <iant@google.com>
6528
6529         PR gold/12804
6530         * testsuite/Makefile.am: Use different file name for two_file_test
6531         temporary file for each incremental test.
6532         * testsuite/Makefile.in: Rebuild.
6533
6534 2011-05-29  Ian Lance Taylor  <iant@google.com>
6535
6536         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
6537         binary input file is empty.
6538
6539 2011-05-27  Ian Lance Taylor  <iant@google.com>
6540
6541         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
6542         (ver_test_9.so): Likewise.
6543         * testsuite/Makefile.in: Rebuild.
6544
6545 2011-05-26 Cary Coutant  <ccoutant@google.com>
6546
6547         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
6548         * incremental.cc (Incremental_inputs::report_input_section): Fix
6549         comment, indentation.
6550         (Incremental_inputs::report_comdat_group): New function.
6551         (Output_section_incremental_inputs::set_final_data_size): Adjust size
6552         of data for incremental input file entry.
6553         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
6554         group count, COMDAT group signatures.
6555         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
6556         an unchanged input file.
6557         * incremental.h (Incremental_object_entry::Incremental_object_entry):
6558         Initialize new data member.
6559         (Incremental_object_entry::add_comdat_group): New function.
6560         (Incremental_object_entry::get_comdat_group_count): New function.
6561         (Incremental_object_entry::get_comdat_signature_key): New function.
6562         (Incremental_object_entry::groups_): New data member.
6563         (Incremental_inputs::report_comdat_group): New function.
6564         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
6565         data for incremental input file entry.
6566         (Incremental_input_entry_reader::get_comdat_group_count): New function.
6567         (Incremental_input_entry_reader::get_input_section): Adjust size of
6568         data for incremental input file entry.
6569         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
6570         (Incremental_input_entry_reader::get_comdat_group_signature): New
6571         function.
6572         * object.cc (Sized_relobj::include_section_group): Report kept
6573         COMDAT groups for incremental links.
6574
6575 2011-05-24  David Meyer  <pdox@google.com>
6576
6577         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
6578         with name parameter.  Add found_name parameter.
6579         * fileread.cc (Input_file::find_file): Adjust code accordingly.
6580         * dirsearch.h (class Dirsearch): Update declaration.
6581
6582 2011-05-24  Ian Lance Taylor  <iant@google.com>
6583
6584         * archive.cc (Library_base::should_include_member): Pull in object
6585         from archive if it defines the entry symbol.
6586         * parameters.cc (Parameters::entry): New function.
6587         * parameters.h (class Parameters): Declare entry.
6588         * output.h (class Output_file_header): Remove entry_ field.
6589         * output.cc (Output_file_header::Output_file_header): Remove entry
6590         parameter.  Change all callers.
6591         (Output_file_header::entry): Use parameters->entry.
6592         * gold.cc (queue_middle_tasks): Likewise.
6593         * plugin.cc (Plugin_hook::run): Likewise.
6594
6595 2011-05-24 Cary Coutant  <ccoutant@google.com>
6596
6597         * gold.cc (queue_initial_tasks): Pass incremental base filename
6598         to Output_file::open_base_file; don't print error message.
6599         * incremental-dump.cc (main): Adjust call to
6600         Output_file::open_for_modification.
6601         * incremental-dump.cc (main): Likewise.
6602         * incremental.cc (Incremental_inputs::report_command_line):
6603         Ignore --incremental-base option when comparing command lines.
6604         Ignore parameter when given as separate argument.
6605         * options.h (class General_options): Add --incremental-base.
6606         * output.cc (Output_file::Output_file):
6607         (Output_file::open_base_file): Add base_name and writable parameters;
6608         read base file into new file; print error message here.
6609         (Output_file::map_no_anonymous): Add writable parameter; adjust all
6610         callers.
6611         * output.h (Output_file::open_for_modification): Rename to...
6612         (Output_file::open_base_file): ...this; add base_name and
6613         writable parameters; adjust all callers.
6614         (Output_file::map_no_anonymous): Add writable parameter; adjust all
6615         callers.
6616         * testsuite/Makefile.am (incremental_test_4): Test
6617         --incremental-base.
6618         * testsuite/Makefile.in: Regenerate.
6619
6620 2011-05-24 Cary Coutant  <ccoutant@google.com>
6621
6622         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
6623         incremental_test_4.
6624         * testsuite/Makefile.in: Regenerate.
6625         * testsuite/two_file_test_1_v1.cc: New test source file.
6626         * testsuite/two_file_test_1b_v1.cc: New test source file.
6627         * testsuite/two_file_test_2_v1.cc: New test source file.
6628
6629 2011-05-24 Cary Coutant  <ccoutant@google.com>
6630
6631         * dynobj.h (Dynobj::do_dynobj): New function.
6632         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
6633         flag and soname for shared objects.
6634         * incremental.cc (Incremental_inputs::report_object): Make
6635         either Incremental_object_entry or Incremental_dynobj_entry; add
6636         soname to string table.
6637         (Incremental_inputs::report_input_section): Add assertion.
6638         (Output_section_incremental_inputs::set_final_data_size): Adjust
6639         type of input file entry for shared libraries; adjust size of
6640         shared library info entry.
6641         (Output_section_incremental_inputs::write_input_files): Write
6642         as_needed flag for shared libraries.
6643         (Output_section_incremental_inputs::write_info_blocks): Adjust type
6644         of input file entry for shared libraries; write soname.
6645         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
6646         soname from incremental info.
6647         * incremental.h (enum Incremental_input_flags): Add
6648         INCREMENTAL_INPUT_AS_NEEDED.
6649         (Incremental_input_entry::Incremental_input_entry): Initialize new
6650         data member.
6651         (Incremental_input_entry::set_as_needed): New function.
6652         (Incremental_input_entry::as_needed): New function.
6653         (Incremental_input_entry::do_dynobj_entry): New function.
6654         (Incremental_input_entry::as_needed_): New data member.
6655         (Incremental_object_entry::Incremental_object_entry): Don't check
6656         for shared library.
6657         (Incremental_object_entry::do_type): Likewise.
6658         (class Incremental_dynobj_entry): New class.
6659         (Incremental_input_entry_reader::as_needed): New function.
6660         (Incremental_input_entry_reader::get_soname): New function.
6661         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
6662         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
6663         size of shared library info entry.
6664         * layout.cc (Layout::finish_dynamic_section): Don't test for
6665         incremental link when adding DT_NEEDED entries.
6666         * object.h (Object::Object): Initialize new data member.
6667         (Object::dynobj): New function.
6668         (Object::set_as_needed): New function.
6669         (Object::as_needed): New function.
6670         (Object::do_dynobj): New function.
6671         (Object::as_needed_): New data member.
6672
6673 2011-05-24 Cary Coutant  <ccoutant@google.com>
6674
6675         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
6676         info; adjust display of GOT entries.
6677         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6678         vector of input objects; remove file_status_.
6679         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
6680         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
6681         got_plt reader; call target hooks to reserve GOT entries.
6682         (Output_section_incremental_inputs::set_final_data_size): Adjust size
6683         of input file info header and GOT info entry.
6684         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
6685         relocation info.
6686         (Got_plt_view_info::got_descriptor): Remove.
6687         (Got_plt_view_info::sym_index): New data member.
6688         (Got_plt_view_info::input_index): New data member.
6689         (Local_got_offset_visitor::visit): Write input file index.
6690         (Global_got_offset_visitor::visit): Write 0 for input file index.
6691         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
6692         with sym_index and input_index.
6693         (Output_section_incremental_inputs::write_got_plt): Adjust size of
6694         incremental info GOT entry; replace got_descriptor with input_index.
6695         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
6696         map from input file index to object.
6697         (Sized_relobj_incr::do_layout): Replace direct data member reference
6698         with accessor function.
6699         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
6700         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
6701         Adjust size of input file info header.
6702         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
6703         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
6704         (Incremental_input_entry_reader::get_input_section): Adjust size of
6705         input file info header.
6706         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
6707         of incremental info GOT entry.
6708         (Incremental_got_plt_reader::get_got_desc): Remove.
6709         (Incremental_got_plt_reader::get_got_symndx): New function.
6710         (Incremental_got_plt_reader::get_got_input_index): New function.
6711         (Sized_incremental_binary::Sized_incremental_binary): Remove
6712         file_status_; add input_objects_.
6713         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
6714         (Sized_incremental_binary::set_file_is_unchanged): Remove.
6715         (Sized_incremental_binary::file_is_unchanged): Remove.
6716         (Sized_incremental_binary::set_input_object): New function.
6717         (Sized_incremental_binary::input_object): New function.
6718         (Sized_incremental_binary::file_status_): Remove.
6719         (Sized_incremental_binary::input_objects_): New data member.
6720         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
6721         references.
6722         (Sized_relobj_incr::invalid_address): Move to base class.
6723         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
6724         class.
6725         (Sized_relobj_incr::do_output_section_offset): Likewise.
6726         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
6727         (Sized_relobj_incr::section_offsets_): Likewise.
6728         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
6729         function.
6730         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
6731         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
6732         with accessor function.
6733         (Sized_relobj_file::do_layout): Likewise.
6734         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
6735         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
6736         (Sized_relobj_file::compute_final_local_value): Replace refs to
6737         section_offsets_ with accessor function.
6738         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
6739         * object.h (Relobj::Relobj): Initialize new data members.
6740         (Relobj::add_dyn_reloc): New function.
6741         (Relobj::first_dyn_reloc): New function.
6742         (Relobj::dyn_reloc_count): New function.
6743         (Relobj::first_dyn_reloc_): New data member.
6744         (Relobj::dyn_reloc_count_): New data member.
6745         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
6746         references.
6747         (Sized_relobj::Address): New typedef.
6748         (Sized_relobj::invalid_address): Move here from child class.
6749         (Sized_relobj::Sized_relobj): Initialize new data members.
6750         (Sized_relobj::sized_relobj): New function.
6751         (Sized_relobj::is_output_section_offset_invalid): Move here from
6752         child class.
6753         (Sized_relobj::get_output_section_offset): Likewise.
6754         (Sized_relobj::local_has_got_offset): Likewise.
6755         (Sized_relobj::local_got_offset): Likewise.
6756         (Sized_relobj::set_local_got_offset): Likewise.
6757         (Sized_relobj::do_for_all_local_got_entries): Likewise.
6758         (Sized_relobj::clear_got_offsets): New function.
6759         (Sized_relobj::section_offsets): Move here from child class.
6760         (Sized_relobj::do_output_section_offset): Likewise.
6761         (Sized_relobj::do_set_section_offset): Likewise.
6762         (Sized_relobj::Local_got_offsets): Likewise.
6763         (Sized_relobj::local_got_offsets_): Likewise.
6764         (Sized_relobj::section_offsets_): Likewise.
6765         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
6766         references.
6767         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
6768         class.
6769         (Sized_relobj_file::sized_relobj): New function
6770         (Sized_relobj_file::local_has_got_offset): Move to base class.
6771         (Sized_relobj_file::local_got_offset): Likewise.
6772         (Sized_relobj_file::set_local_got_offset): Likewise.
6773         (Sized_relobj_file::get_output_section_offset): Likewise.
6774         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
6775         (Sized_relobj_file::do_output_section_offset): Likewise.
6776         (Sized_relobj_file::do_set_section_offset): Likewise.
6777         (Sized_relobj_file::Local_got_offsets): Likewise.
6778         (Sized_relobj_file::local_got_offsets_): Likewise.
6779         (Sized_relobj_file::section_offsets_): Likewise.
6780         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
6781         (all constructors).
6782         (set_needs_dynsym_index): Convert relobj to derived class pointer.
6783         (Output_reloc::get_symbol_index): Likewise.
6784         (Output_reloc::local_section_offset): Likewise.
6785         (Output_reloc::get_address): Likewise.
6786         (Output_reloc::symbol_value): Likewise.
6787         (Output_data_got::reserve_slot): Move to class definition.
6788         (Output_data_got::reserve_local): New function.
6789         (Output_data_got::reserve_slot_for_global): Remove.
6790         (Output_data_got::reserve_global): New function.
6791         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
6792         (all constructors, two instantiations).
6793         (Output_reloc::get_relobj): New function (two instantiations).
6794         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
6795         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
6796         (Output_data_reloc::add_global): Adjust type of relobj.
6797         (Output_data_reloc::add_global_relative): Likewise.
6798         (Output_data_reloc::add_symbolless_global_addend): Likewise.
6799         (Output_data_reloc::add_local): Likewise.
6800         (Output_data_reloc::add_local_relative): Likewise.
6801         (Output_data_reloc::add_symbolless_local_addend): Likewise.
6802         (Output_data_reloc::add_local_section): Likewise.
6803         (Output_data_reloc::add_output_section): Likewise.
6804         (Output_data_reloc::add_absolute): Likewise.
6805         (Output_data_reloc::add_target_specific): Likewise.
6806         (Output_data_got::reserve_slot): Move definition here.
6807         (Output_data_got::reserve_local): New function.
6808         (Output_data_got::reserve_global): New function.
6809         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
6810         section_offsets_ with accessor function.
6811         (Sized_relobj_file::write_sections): Likewise.
6812         (Sized_relobj_file::do_relocate_sections): Likewise.
6813         * target.h (Sized_target::reserve_local_got_entry): New function.
6814         (Sized_target::reserve_global_got_entry): New function.
6815         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
6816         (Target_x86_64::reserve_global_got_entry): New function.
6817         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
6818
6819 2011-05-23 Cary Coutant  <ccoutant@google.com>
6820
6821         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
6822         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
6823         bit when checking got_type.
6824         * incremental.cc (Sized_incremental_binary::setup_readers):
6825         Store symbol table and string table locations; initialize bit vector
6826         of file status flags.
6827         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
6828         unchanged files.
6829         (Sized_incremental_binary::do_process_got_plt): New function.
6830         (Sized_incremental_binary::get_symtab_view): Use stored locations.
6831         (Output_section_incremental_inputs::set_final_data_size): Record
6832         file index for each input file.
6833         (Output_section_incremental_inputs::write_got_plt): Store file index
6834         instead of input entry offset for each GOT entry.
6835         * incremental.h
6836         (Incremental_input_entry::Incremental_input_entry): Initialize new
6837         data member.
6838         (Incremental_input_entry::set_offset): Store file index.
6839         (Incremental_input_entry::get_file_index): New function.
6840         (Incremental_input_entry::file_index_): New data member.
6841         (Incremental_binary::process_got_plt): New function.
6842         (Incremental_binary::do_process_got_plt): New function.
6843         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6844         data members.
6845         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
6846         (Sized_incremental_binary::set_file_is_unchanged): New function.
6847         (Sized_incremental_binary::file_is_unchanged): New function.
6848         (Sized_incremental_binary::do_process_got_plt): New function.
6849         (Sized_incremental_binary::file_status_): New data member.
6850         (Sized_incremental_binary::main_symtab_loc_): New data member.
6851         (Sized_incremental_binary::main_strtab_loc_): New data member.
6852         * output.cc (Output_data_got::Got_entry::write): Add case
6853         RESERVED_CODE.
6854         (Output_data_got::add_global): Call add_got_entry.
6855         (Output_data_got::add_global_plt): Likewise.
6856         (Output_data_got::add_global_with_rel): Likewise.
6857         (Output_data_got::add_global_with_rela): Likewise.
6858         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
6859         (Output_data_got::add_global_pair_with_rela): Likewise.
6860         (Output_data_got::add_local): Call add_got_entry.
6861         (Output_data_got::add_local_plt): Likewise.
6862         (Output_data_got::add_local_with_rel): Likewise.
6863         (Output_data_got::add_local_with_rela): Likewise.
6864         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
6865         (Output_data_got::add_local_pair_with_rela): Likewise.
6866         (Output_data_got::reserve_slot): New function.
6867         (Output_data_got::reserve_slot_for_global): New function.
6868         (Output_data_got::add_got_entry): New function.
6869         (Output_data_got::add_got_entry_pair): New function.
6870         (Output_section::add_output_section_data): Edit FIXME.
6871         * output.h
6872         (Output_section_data_build::Output_section_data_build): New
6873         constructor with size parameter.
6874         (Output_data_space::Output_data_space): Likewise.
6875         (Output_data_got::Output_data_got): Initialize new data member; new
6876         constructor with size parameter.
6877         (Output_data_got::add_constant): Call add_got_entry.
6878         (Output_data_got::reserve_slot): New function.
6879         (Output_data_got::reserve_slot_for_global): New function.
6880         (class Output_data_got::Got_entry): Add RESERVED_CODE.
6881         (Output_data_got::add_got_entry): New function.
6882         (Output_data_got::add_got_entry_pair): New function.
6883         (Output_data_got::free_list_): New data member.
6884         * target.h (Sized_target::init_got_plt_for_update): New function.
6885         (Sized_target::register_global_plt_entry): New function.
6886         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
6887         Initialize new data member; call init; add constructor with PLT count.
6888         (Output_data_plt_x86_64::init): New function.
6889         (Output_data_plt_x86_64::add_relocation): New function.
6890         (Output_data_plt_x86_64::reserve_slot): New function.
6891         (Output_data_plt_x86_64::free_list_): New data member.
6892         (Target_x86_64::init_got_plt_for_update): New function.
6893         (Target_x86_64::register_global_plt_entry): New function.
6894         (Output_data_plt_x86_64::add_entry): Allocate from free list for
6895         incremental updates.
6896         (Output_data_plt_x86_64::add_relocation): New function.
6897         * testsuite/object_unittest.cc (Object_test): Set default options.
6898
6899 2011-05-16  Ian Lance Taylor  <iant@google.com>
6900
6901         * options.h (class General_options): Make -i a synonym for -r.
6902
6903 2011-05-16  Ian Lance Taylor  <iant@google.com>
6904
6905         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
6906
6907 2011-05-10 Cary Coutant  <ccoutant@google.com>
6908
6909         * object.cc (Sized_relobj::do_count_local_symbols): Check for
6910         strip_all (-s).
6911
6912 2011-05-06  Ian Lance Taylor  <iant@google.com>
6913
6914         * layout.cc (Layout::layout): If the output section flags change,
6915         update the ordering.
6916
6917 2011-04-25 Cary Coutant  <ccoutant@google.com>
6918
6919         * incremental-dump.cc (dump_incremental_inputs): Print local
6920         symbol info for each input file.
6921         * incremental.cc
6922         (Output_section_incremental_inputs::set_final_data_size): Add local
6923         symbol info to input file entries in incremental info.
6924         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6925         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
6926         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
6927         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
6928         implementation.
6929         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
6930         (Sized_incr_relobj::do_relocate): Write the local symbols.
6931         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
6932         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
6933         Adjust size of input file header.
6934         (Incremental_inputs_reader::get_local_symbol_offset): New function.
6935         (Incremental_inputs_reader::get_local_symbol_count): New function.
6936         (Incremental_inputs_reader::get_input_section): Adjust size of input
6937         file header.
6938         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
6939         (Sized_incr_relobj::This): New typedef.
6940         (Sized_incr_relobj::sym_size): New const data member.
6941         (Sized_incr_relobj::Local_symbol): New struct.
6942         (Sized_incr_relobj::do_output_local_symbol_count): New function.
6943         (Sized_incr_relobj::do_local_symbol_offset): New function.
6944         (Sized_incr_relobj::local_symbol_count_): New data member.
6945         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
6946         (Sized_incr_relobj::local_symbol_index_): New data member.
6947         (Sized_incr_relobj::local_symbol_offset_): New data member.
6948         (Sized_incr_relobj::local_dynsym_offset_): New data member.
6949         (Sized_incr_relobj::local_symbols_): New data member.
6950         * object.h (Relobj::output_local_symbol_count): New function.
6951         (Relobj::local_symbol_offset): New function.
6952         (Relobj::do_output_local_symbol_count): New function.
6953         (Relobj::do_local_symbol_offset): New function.
6954         (Sized_relobj::do_output_local_symbol_count): New function.
6955         (Sized_relobj::do_local_symbol_offset): New function.
6956
6957 2011-04-22  Vladimir Simonov  <sv@sw.ru>
6958
6959         * descriptors.cc (set_close_on_exec): New function.
6960         (Descriptors::open): Use set_close_on_exec.
6961         * output.cc (S_ISLNK): Define if not defined.
6962
6963 2011-04-22 Cary Coutant  <ccoutant@google.com>
6964
6965         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6966         global symbol map.
6967         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6968         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
6969         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
6970         relocations.
6971         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
6972         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
6973         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
6974         * incremental.h
6975         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
6976         function.
6977         (Incremental_binary::apply_incremental_relocs): New function.
6978         (Incremental_binary::do_apply_incremental_relocs): New function.
6979         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6980         data member.
6981         (Sized_incremental_binary::add_global_symbol): New function.
6982         (Sized_incremental_binary::global_symbol): New function.
6983         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6984         (Sized_incremental_binary::symbol_map_): New data member.
6985         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
6986         * target.h (Sized_target::apply_relocation): New function.
6987         * target-reloc.h (apply_relocation): New function.
6988         * x86_64.cc (Target_x86_64::apply_relocation): New function.
6989
6990 2011-04-22  Doug Kwan  <dougkwan@google.com>
6991
6992         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
6993         flag of a SHT_ARM_EXIDX section.
6994         * testsuite/Makefile.am (arm_exidx_test): New test rules.
6995         * testsuite/Makefile.in: Regenerate.
6996         * testsuite/arm_exidx_test.s: New file.
6997         * testsuite/arm_exidx_test.sh: Same.
6998
6999 2011-04-20 Cary Coutant  <ccoutant@google.com>
7000
7001         PR gold/12689
7002         * archive.h (Incremental_archive_entry::Archive_member):
7003         Initialize arg_serial_ (second constructor).
7004
7005 2011-04-17  Ian Lance Taylor  <iant@google.com>
7006
7007         * object.cc (Relocate_info::location): Simplify location string.
7008         * errors.cc (Errors::error_at_location): Don't print program
7009         name.
7010         (Errors::warning_at_location): Likewise.
7011         (Errors::undefined_symbol): Likewise.
7012         * testsuite/debug_msg.sh: Update accordingly.
7013
7014 2011-04-14 Cary Coutant  <ccoutant@google.com>
7015
7016         * gold/layout.cc (Layout::symtab_section_offset): New function.
7017         * gold/layout.h (Layout::symtab_section_offset): New function.
7018         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
7019
7020 2011-04-12  Ian Lance Taylor  <iant@google.com>
7021
7022         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
7023         with MREMAP_MAYMOVE.
7024         * output.h (class Output_file): Add map_is_allocated_ field.
7025         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
7026         not available, provide stubs.  If mremap is not available, #define
7027         it to gold_mremap.
7028         (MREMAP_MAYMOVE): Define if not defined.
7029         (Output_file::Output_file): Initialize map_is_allocated_.
7030         (Output_file::resize): Check map_is_allocated_.
7031         (Output_file::map_anonymous): If mmap fails, use malloc.
7032         (Output_file::unmap): Don't do anything for an anonymous map.
7033         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
7034         is not available, provide stubs.
7035         (File_read::View::~View): Use free rather than delete[].
7036         (File_read::make_view): Use malloc rather than new[].  If mmap
7037         fails, use malloc.
7038         (File_read::find_or_make_view): Use malloc rather than new[].
7039         * gold.h: Remove HAVE_REMAP code.
7040         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
7041         exists.  Rename mremap to gold_mremap.  If mmap is not available
7042         don't do anything.
7043         * configure, config.in: Rebuild.
7044
7045 2011-04-11  Ian Lance Taylor  <iant@google.com>
7046
7047         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
7048         initialize local variable v.
7049
7050 2011-04-11  Cary Coutant  <ccoutant@google.com>
7051
7052         * archive.cc (Archive::include_member): Adjust call to
7053         report_object.
7054         (Add_archive_symbols::run): Track argument serial numbers.
7055         (Lib_group::include_member): Likewise.
7056         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
7057         * archive.h (Incremental_archive_entry::Archive_member):
7058         Initialize arg_serial_.
7059         (Archive_member::arg_serial_): New data member.
7060         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
7061         (Sized_dynobj::do_add_symbols): Track symbols when doing an
7062         incremental link.
7063         (Sized_dynobj::do_for_all_local_got_entries): New function.
7064         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
7065         function.
7066         * fileread.cc (get_mtime): New function.
7067         * fileread.h (get_mtime): New function.
7068         * gold.cc (queue_initial_tasks): Check for incremental update.
7069         (process_incremental_input): New function.
7070         (queue_middle_tasks): Don't force valid target for incremental
7071         update.
7072         * incremental-dump.cc (find_input_containing_global): Adjust
7073         size of symbol info entry.
7074         (dump_incremental_inputs): Dump argument serial number and
7075         in_system_directory flag; bias shndx by 1; print symbol names
7076         when dumping per-file symbol lists; use new symbol info readers.
7077         * incremental.cc
7078         (Output_section_incremental_inputs:update_data_size): New function.
7079         (Sized_incremental_binary::setup_readers): Setup input readers
7080         for each input file; build maps for files added from libraries
7081         and scripts.
7082         (Sized_incremental_binary::check_input_args): New function.
7083         (Sized_incremental_binary::do_check_inputs): Build map of argument
7084         serial numbers to input arguments.
7085         (Sized_incremental_binary::do_file_has_changed): Rename
7086         do_file_is_unchanged to this; compare file modification times.
7087         (Sized_incremental_binary::do_init_layout): New function.
7088         (Sized_incremental_binary::do_reserve_layout): New function.
7089         (Sized_incremental_binary::do_get_input_reader): Remove.
7090         (Sized_incremental_binary::get_symtab_view): New function.
7091         (Incremental_checker::can_incrementally_link_output_file): Remove.
7092         (Incremental_inputs::report_command_line): Exclude --debug options.
7093         (Incremental_inputs::report_archive_begin): Add parameter; track
7094         argument serial numbers; don't put input file entry for archive
7095         before archive members.
7096         (Incremental_inputs::report_archive_end): Put input file entry
7097         for archive after archive members.
7098         (Incremental_inputs::report_object): Add parameter; track argument
7099         serial numbers and in_system_directory flag.
7100         (Incremental_inputs::report_script): Add parameter; track argument
7101         serial numbers.
7102         (Output_section_incremental_inputs::set_final_data_size): Adjust
7103         size of symbol info entry; check for forwarding symbols.
7104         (Output_section_incremental_inputs::write_input_files): Write
7105         in_system_directory flag and argument serial number.
7106         (Output_section_incremental_inputs::write_info_blocks): Map section
7107         indices between incremental info and original input file; store
7108         input section index for each symbol.
7109         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
7110         change operator() to visit().
7111         (class Global_got_offset_visitor): Likewise.
7112         (class Global_symbol_visitor_got_plt):
7113         (Output_section_incremental_inputs::write_got_plt): Use new visitor
7114         classes.
7115         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
7116         (Sized_incr_relobj::do_read_symbols): New function.
7117         (Sized_incr_relobj::do_layout): New function.
7118         (Sized_incr_relobj::do_layout_deferred_sections): New function.
7119         (Sized_incr_relobj::do_add_symbols): New function.
7120         (Sized_incr_relobj::do_should_include_member): New function.
7121         (Sized_incr_relobj::do_for_all_global_symbols): New function.
7122         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
7123         (Sized_incr_relobj::do_section_size): New function.
7124         (Sized_incr_relobj::do_section_name): New function.
7125         (Sized_incr_relobj::do_section_contents): New function.
7126         (Sized_incr_relobj::do_section_flags): New function.
7127         (Sized_incr_relobj::do_section_entsize): New function.
7128         (Sized_incr_relobj::do_section_address): New function.
7129         (Sized_incr_relobj::do_section_type): New function.
7130         (Sized_incr_relobj::do_section_link): New function.
7131         (Sized_incr_relobj::do_section_info): New function.
7132         (Sized_incr_relobj::do_section_addralign): New function.
7133         (Sized_incr_relobj::do_initialize_xindex): New function.
7134         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
7135         (Sized_incr_relobj::do_read_relocs): New function.
7136         (Sized_incr_relobj::do_gc_process_relocs): New function.
7137         (Sized_incr_relobj::do_scan_relocs): New function.
7138         (Sized_incr_relobj::do_count_local_symbols): New function.
7139         (Sized_incr_relobj::do_finalize_local_symbols): New function.
7140         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
7141         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
7142         (Sized_incr_relobj::do_relocate): New function.
7143         (Sized_incr_relobj::do_set_section_offset): New function.
7144         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
7145         (Sized_incr_dynobj::do_read_symbols): New function.
7146         (Sized_incr_dynobj::do_layout): New function.
7147         (Sized_incr_dynobj::do_add_symbols): New function.
7148         (Sized_incr_dynobj::do_should_include_member): New function.
7149         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
7150         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
7151         (Sized_incr_dynobj::do_section_size): New function.
7152         (Sized_incr_dynobj::do_section_name): New function.
7153         (Sized_incr_dynobj::do_section_contents): New function.
7154         (Sized_incr_dynobj::do_section_flags): New function.
7155         (Sized_incr_dynobj::do_section_entsize): New function.
7156         (Sized_incr_dynobj::do_section_address): New function.
7157         (Sized_incr_dynobj::do_section_type): New function.
7158         (Sized_incr_dynobj::do_section_link): New function.
7159         (Sized_incr_dynobj::do_section_info): New function.
7160         (Sized_incr_dynobj::do_section_addralign): New function.
7161         (Sized_incr_dynobj::do_initialize_xindex): New function.
7162         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
7163         (make_sized_incremental_object): New function.
7164         (Incremental_library::copy_unused_symbols): New function.
7165         (Incremental_library::do_for_all_unused_symbols): New function.
7166         * incremental.h (enum Incremental_input_flags): New type.
7167         (class Incremental_checker): Remove.
7168         (Incremental_input_entry::Incremental_input_entry): Add argument
7169         serial number.
7170         (Incremental_input_entry::arg_serial): New function.
7171         (Incremental_input_entry::set_is_in_system_directory): New function.
7172         (Incremental_input_entry::is_in_system_directory): New function.
7173         (Incremental_input_entry::arg_serial_): New data member.
7174         (Incremental_input_entry::is_in_system_directory_): New data member.
7175         (class Script_info): Move here from script.h.
7176         (Script_info::Script_info): Add filename parameter.
7177         (Script_info::filename): New function.
7178         (Script_info::filename_): New data member.
7179         (Incremental_script_entry::Incremental_script_entry): Add argument
7180         serial number.
7181         (Incremental_object_entry::Incremental_object_entry): Likewise.
7182         (Incremental_object_entry::add_input_section): Build list of input
7183         sections with map to original shndx.
7184         (Incremental_object_entry::get_input_section_index): New function.
7185         (Incremental_object_entry::shndx_): New data member.
7186         (Incremental_object_entry::name_key_): Rename; adjust all refs.
7187         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
7188         (Incremental_archive_entry::Incremental_archive_entry): Add argument
7189         serial number.
7190         (Incremental_inputs::report_archive_begin): Likewise.
7191         (Incremental_inputs::report_object): Likewise.
7192         (Incremental_inputs::report_script): Likewise.
7193         (class Incremental_global_symbol_reader): New class.
7194         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
7195         and store flags and input file type.
7196         (Incremental_input_entry_reader::arg_serial): New function.
7197         (Incremental_input_entry_reader::type): Extract type from flags.
7198         (Incremental_input_entry_reader::is_in_system_directory): New function.
7199         (Incremental_input_entry_reader::get_input_section_count): Call
7200         accessor function for type.
7201         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
7202         function for type; adjust size of global symbol entry.
7203         (Incremental_input_entry_reader::get_global_symbol_count): Call
7204         accessor function for type.
7205         (Incremental_input_entry_reader::get_object_count): Likewise.
7206         (Incremental_input_entry_reader::get_object_offset): Likewise.
7207         (Incremental_input_entry_reader::get_member_count): Likewise.
7208         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
7209         (Incremental_input_entry_reader::get_member_offset): Likewise.
7210         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
7211         (Incremental_input_entry_reader::Global_symbol_info): Remove.
7212         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
7213         (Incremental_input_entry_reader::get_global_symbol_reader): New
7214         function.
7215         (Incremental_input_entry_reader::get_output_symbol_index): New
7216         function.
7217         (Incremental_input_entry_reader::type_): Remove.
7218         (Incremental_input_entry_reader::flags_): New data member.
7219         (Incremental_inputs_reader::input_file_offset): New function.
7220         (Incremental_inputs_reader::input_file_index): New function.
7221         (Incremental_inputs_reader::input_file): Call input_file_offset.
7222         (Incremental_inputs_reader::input_file_at_offset): New function.
7223         (Incremental_relocs_reader::get_r_type): Reformat.
7224         (Incremental_relocs_reader::get_r_shndx): Reformat.
7225         (Incremental_relocs_reader::get_r_offset): Reformat.
7226         (Incremental_relocs_reader::data): New function.
7227         (Incremental_binary::Incremental_binary): Initialize new data members.
7228         (Incremental_binary::check_inputs): Add cmdline parameter.
7229         (Incremental_binary::file_is_unchanged): Remove.
7230         (Input_reader::arg_serial): New function.
7231         (Input_reader::get_unused_symbol_count): New function.
7232         (Input_reader::get_unused_symbol): New function.
7233         (Input_reader::do_arg_serial): New function.
7234         (Input_reader::do_get_unused_symbol_count): New function.
7235         (Input_reader::do_get_unused_symbol): New function.
7236         (Incremental_binary::input_file_count): New function.
7237         (Incremental_binary::get_input_reader): Change signature to use
7238         index instead of filename.
7239         (Incremental_binary::file_has_changed): New function.
7240         (Incremental_binary::get_input_argument): New function.
7241         (Incremental_binary::get_library): New function.
7242         (Incremental_binary::get_script_info): New function.
7243         (Incremental_binary::init_layout): New function.
7244         (Incremental_binary::reserve_layout): New function.
7245         (Incremental_binary::output_file): New function.
7246         (Incremental_binary::do_check_inputs): New function.
7247         (Incremental_binary::do_file_is_unchanged): Remove.
7248         (Incremental_binary::do_file_has_changed): New function.
7249         (Incremental_binary::do_init_layout): New function.
7250         (Incremental_binary::do_reserve_layout): New function.
7251         (Incremental_binary::do_input_file_count): New function.
7252         (Incremental_binary::do_get_input_reader): Change signature.
7253         (Incremental_binary::input_args_map_): New data member.
7254         (Incremental_binary::library_map_): New data member.
7255         (Incremental_binary::script_map_): New data member.
7256         (Sized_incremental_binary::Sized_incremental_binary): Initialize
7257         new data members.
7258         (Sized_incremental_binary::output_section): New function.
7259         (Sized_incremental_binary::inputs_reader): Add const.
7260         (Sized_incremental_binary::symtab_reader): Add const.
7261         (Sized_incremental_binary::relocs_reader): Add const.
7262         (Sized_incremental_binary::got_plt_reader): Add const.
7263         (Sized_incremental_binary::get_symtab_view): New function.
7264         (Sized_incremental_binary::Inputs_reader): New typedef.
7265         (Sized_incremental_binary::Input_entry_reader): New typedef.
7266         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
7267         (Sized_incremental_binary::do_file_is_unchanged): Remove.
7268         (Sized_incremental_binary::do_file_has_changed): New function.
7269         (Sized_incremental_binary::do_init_layout): New function.
7270         (Sized_incremental_binary::do_reserve_layout): New function.
7271         (Sized_input_reader::Inputs_reader): Remove.
7272         (Sized_input_reader::Input_entry_reader): Remove.
7273         (Sized_input_reader::do_arg_serial): New function.
7274         (Sized_input_reader::do_get_unused_symbol_count): New function.
7275         (Sized_input_reader::do_get_unused_symbol): New function.
7276         (Sized_incremental_binary::do_input_file_count): New function.
7277         (Sized_incremental_binary::do_get_input_reader): Change signature;
7278         use index instead of filename.
7279         (Sized_incremental_binary::section_map_): New data member.
7280         (Sized_incremental_binary::input_entry_readers_): New data member.
7281         (class Sized_incr_relobj): New class.
7282         (class Sized_incr_dynobj): New class.
7283         (make_sized_incremental_object): New function.
7284         (class Incremental_library): New class.
7285         * layout.cc (Free_list::num_lists): New static data member.
7286         (Free_list::num_nodes): New static data member.
7287         (Free_list::num_removes): New static data member.
7288         (Free_list::num_remove_visits): New static data member.
7289         (Free_list::num_allocates): New static data member.
7290         (Free_list::num_allocate_visits): New static data member.
7291         (Free_list::init): New function.
7292         (Free_list::remove): New function.
7293         (Free_list::allocate): New function.
7294         (Free_list::dump): New function.
7295         (Free_list::print_stats): New function.
7296         (Layout_task_runner::run): Resize output file for incremental updates.
7297         (Layout::Layout): Initialize new data members.
7298         (Layout::set_incremental_base): New function.
7299         (Layout::init_fixed_output_section): New function.
7300         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
7301         incremental updates.
7302         (Layout::create_gold_note): Do not create gold note section for
7303         incremental updates.
7304         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
7305         for incremental updates.
7306         (Layout::set_section_offsets): For incremental updates, allocate space
7307         from free list.
7308         (Layout::create_symtab_sections): Layout with offsets relative to
7309         start of section; for incremental updates, allocate space from free
7310         list.
7311         (Layout::create_shdrs): For incremental updates, allocate space from
7312         free list.
7313         (Layout::finish_dynamic_section): For incremental updates, do not
7314         check --as-needed (fixed in subsequent patch).
7315         * layout.h (class Free_list): New class.
7316         (Layout::set_incremental_base): New function.
7317         (Layout::incremental_base): New function.
7318         (Layout::init_fixed_output_section): New function.
7319         (Layout::allocate): New function.
7320         (Layout::incremental_base_): New data member.
7321         (Layout::free_list_): New data member.
7322         * main.cc (main): Print Free_list statistics.
7323         * object.cc (Relobj::finalize_incremental_relocs): Add
7324         clear_counts parameter; clear counts only when clear_counts is set.
7325         (Sized_relobj::Sized_relobj): Initialize new base class.
7326         (Sized_relobj::do_layout): Don't report special sections.
7327         (Sized_relobj::do_for_all_local_got_entries): New function.
7328         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
7329         symtab_off to all symbol table offsets.
7330         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
7331         * object.h (class Got_offset_list): Move to top of file.
7332         (Object::Object): Allow case where input_file == NULL.
7333         (Object::~Object): Likewise.
7334         (Object::input_file): Assert that input_file != NULL.
7335         (Object::lock): Allow case where input_file == NULL.
7336         (Object::unlock): Likewise.
7337         (Object::is_locked): Likewise.
7338         (Object::token): Likewise.
7339         (Object::release): Likewise.
7340         (Object::is_incremental): New function.
7341         (Object::get_mtime): New function.
7342         (Object::for_all_local_got_entries): New function.
7343         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
7344         (Object::set_is_in_system_directory): New function.
7345         (Object::is_in_system_directory): New function.
7346         (Object::do_is_incremental): New function.
7347         (Object::do_get_mtime): New function.
7348         (Object::do_for_all_local_got_entries): New function.
7349         (Object::is_in_system_directory_): New data member.
7350         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
7351         (class Sized_relobj_base): New class.
7352         (class Sized_relobj): Derive from Sized_relobj_base.
7353         (class Sized_relobj::Symbols): Redeclare from base class.
7354         (class Sized_relobj::local_got_offset_list): Remove.
7355         (class Sized_relobj::Output_sections): Redeclare from base class.
7356         (class Sized_relobj::do_for_all_local_got_entries): New function.
7357         (class Sized_relobj::write_local_symbols): Add offset parameter.
7358         (class Sized_relobj::local_symbol_offset_): Update comment.
7359         (class Sized_relobj::local_dynsym_offset_): Update comment.
7360         * options.cc (Input_arguments::add_file): Remove const.
7361         * options.h (Input_file_argument::Input_file_argument):
7362         Initialize arg_serial_ (all constructors).
7363         (Input_file_argument::set_arg_serial): New function.
7364         (Input_file_argument::arg_serial): New function.
7365         (Input_file_argument::arg_serial_): New data member.
7366         (Input_arguments::Input_arguments): Initialize file_count_.
7367         (Input_arguments::add_file): Remove const.
7368         (Input_arguments::number_of_input_files): New function.
7369         (Input_arguments::file_count_): New data member.
7370         (Command_line::number_of_input_files): Call
7371         Input_arguments::number_of_input_files.
7372         * output.cc (Output_segment_headers::Output_segment_headers):
7373         Set current size.
7374         (Output_section::Input_section::current_data_size): New function.
7375         (Output_section::Output_section): Initialize new data members.
7376         (Output_section::add_input_section): Don't do merge sections for
7377         an incremental link; allocate space from free list for an
7378         incremental update.
7379         (Output_section::add_output_section_data): Allocate space from
7380         free list for an incremental update.
7381         (Output_section::update_data_size): New function.
7382         (Output_section::set_fixed_layout): New function.
7383         (Output_section::reserve): New function.
7384         (Output_segment::set_section_addresses): Remove const.
7385         (Output_segment::set_section_list_addresses): Remove const; allocate
7386         space from free list for an incremental update.
7387         (Output_segment::set_offset): Adjust size of RELRO segment for an
7388         incremental update.
7389         * output.h (Output_data::current_data_size): Move here from
7390         child classes.
7391         (Output_data::pre_finalize_data_size): New function.
7392         (Output_data::update_data_size): New function.
7393         (Output_section_headers::update_data_size): new function.
7394         (Output_section_data_build::current_data_size): Move to Output_data.
7395         (Output_data_strtab::update_data_size): New function.
7396         (Output_section::current_data_size): Move to Output_data.
7397         (Output_section::set_fixed_layout): New function.
7398         (Output_section::has_fixed_layout): New function.
7399         (Output_section::reserve): New function.
7400         (Output_section::update_data_size): New function.
7401         (Output_section::has_fixed_layout_): New data member.
7402         (Output_section::free_list_): New data member.
7403         (Output_segment::set_section_addresses): Remove const.
7404         (Output_segment::set_section_list_addresses): Remove const.
7405         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
7406         New function.
7407         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
7408         New function.
7409         * readsyms.cc (Read_symbols::do_read_symbols): Add library
7410         parameter when calling Add_symbols constructor; store argument
7411         serial number for members of a lib group.
7412         (Add_symbols::locks): Allow case where token == NULL.
7413         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
7414         (Read_member::~Read_member): New function.
7415         (Read_member::is_runnable): New function.
7416         (Read_member::locks): New function.
7417         (Read_member::run): New function.
7418         (Check_script::~Check_script): New function.
7419         (Check_script::is_runnable): New function.
7420         (Check_script::locks): New function.
7421         (Check_script::run): New function.
7422         (Check_library::~Check_library): New function.
7423         (Check_library::is_runnable): New function.
7424         (Check_library::locks): New function.
7425         (Check_library::run): New function.
7426         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
7427         (Add_symbols::library_): New data member.
7428         (class Read_member): New class.
7429         (class Check_script): New class.
7430         (class Check_library): New class.
7431         * reloc.cc (Read_relocs::is_runnable): Allow case where
7432         token == NULL.
7433         (Read_relocs::locks): Likewise.
7434         (Scan_relocs::locks): Likewise.
7435         (Relocate_task::locks): Likewise.
7436         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
7437         to clear counters.
7438         (Sized_relobj::incremental_relocs_scan): Fix comment.
7439         (Sized_relobj::do_relocate): Pass output file offset to
7440         write_local_symbols.
7441         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
7442         from class declaration.
7443         * script.cc (read_input_script): Allocate Script_info; pass
7444         argument serial number to report_script.
7445         * script.h (class Script_info): Move to incremental.h.
7446         * symtab.cc (Symbol_table::add_from_incrobj): New function.
7447         * symtab.h (Symbol_table::add_from_incrobj): New function.
7448         (Symbol_table::set_file_offset): New function.
7449
7450 2011-04-05  Cary Coutant  <ccoutant@google.com>
7451
7452         * incremental-dump.cc (dump_incremental_inputs): Change signature
7453         to take a Sized_incremental_binary; change caller.  Use readers
7454         in Sized_incremental_binary.
7455         * incremental.cc
7456         (Sized_incremental_binary::find_incremental_inputs_sections):
7457         Rename do_find_incremental_inputs_sections to this.
7458         (Sized_incremental_binary::setup_readers): New function.
7459         (Sized_incremental_binary::do_check_inputs): Check
7460         has_incremental_info_ flag; move setup code to setup_readers;
7461         use input readers.
7462         (Sized_incremental_binary::do_file_is_unchanged): New function.
7463         (Sized_incremental_binary::do_get_input_reader): New function.
7464         * incremental.h (class Incremental_binary): Move to end of file.
7465         (Incremental_binary::file_is_unchanged): New function.
7466         (Incremental_binary::do_file_is_unchanged): New function.
7467         (Incremental_binary::Input_reader): New class.
7468         (Incremental_binary::get_input_reader): New function.
7469         (class Sized_incremental_binary): Move to end of file.
7470         (Sized_incremental_binary::Sized_incremental_binary): Setup the
7471         input section reader classes.
7472         (Sized_incremental_binary::has_incremental_info): New function.
7473         (Sized_incremental_binary::inputs_reader): New function.
7474         (Sized_incremental_binary::symtab_reader): New function.
7475         (Sized_incremental_binary::relocs_reader): New function.
7476         (Sized_incremental_binary::got_plt_reader): New function.
7477         (Sized_incremental_binary::do_file_is_unchanged): New function.
7478         (Sized_incremental_binary::Sized_input_reader): New class.
7479         (Sized_incremental_binary::get_input_reader): New function.
7480         (Sized_incremental_binary::find_incremental_inputs_sections):
7481         Rename do_find_incremental_inputs_sections to this.
7482         (Sized_incremental_binary::setup_readers): New function.
7483         (Sized_incremental_binary::has_incremental_info_): New data member.
7484         (Sized_incremental_binary::inputs_reader_): New data member.
7485         (Sized_incremental_binary::symtab_reader_): New data member.
7486         (Sized_incremental_binary::relocs_reader_): New data member.
7487         (Sized_incremental_binary::got_plt_reader_): New data member.
7488         (Sized_incremental_binary::current_input_file_): New data member.
7489
7490 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
7491
7492         PR gold/12640
7493         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
7494         violation.
7495
7496 2011-03-30  Cary Coutant  <ccoutant@google.com>
7497
7498         * archive.cc (Archive::include_member): Adjust call to report_object.
7499         (Add_archive_symbols::run): Add script_info to call to
7500         report_archive_begin.
7501         (Lib_group::include_member): Adjust call to report_object.
7502         (Add_lib_group_symbols::run): Adjust call to report_object.
7503         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
7504         blocks.  Add object count for script input files.
7505         * incremental.cc (Incremental_inputs::report_archive_begin): Add
7506         script_info parameter; change all callers.
7507         (Incremental_inputs::report_object): Add script_info parameter;
7508         change all callers.
7509         (Incremental_inputs::report_script): Store backpointer to
7510         incremental info entry.
7511         (Output_section_incremental_inputs::set_final_data_size): Record
7512         additional information for scripts.
7513         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7514         * incremental.h (Incremental_script_entry::add_object): New function.
7515         (Incremental_script_entry::get_object_count): New function.
7516         (Incremental_script_entry::get_object): New function.
7517         (Incremental_script_entry::objects_): New data member; adjust
7518         constructor.
7519         (Incremental_inputs::report_archive_begin): Add script_info parameter.
7520         (Incremental_inputs::report_object): Add script_info parameter.
7521         (Incremental_inputs_reader::get_object_count): New function.
7522         (Incremental_inputs_reader::get_object_offset): New function.
7523         * options.cc (Input_arguments::add_file): Return reference to
7524         new input argument.
7525         * options.h (Input_argument::set_script_info): New function.
7526         (Input_argument::script_info): New function.
7527         (Input_argument::script_info_): New data member; adjust all
7528         constructors.
7529         (Input_file_group::add_file): Return reference to new input argument.
7530         (Input_file_lib::add_file): Likewise.
7531         (Input_arguments::add_file): Likewise.
7532         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
7533         * script.cc (Parser_closure::Parser_closure): Add script_info
7534         parameter; adjust all callers.
7535         (Parser_closure::script_info): New function.
7536         (Parser_closure::script_info_): New data member.
7537         (read_input_script): Report scripts earlier to incremental info.
7538         (script_add_file): Set script_info in Input_argument.
7539         (script_add_library): Likewise.
7540         * script.h (Script_options::Script_info): Rewrite class.
7541
7542 2011-03-29  Cary Coutant  <ccoutant@google.com>
7543
7544         * archive.cc (Library_base::should_include_member): Move
7545         method here from class Archive.
7546         (Archive::Archive): Initialize base class.
7547         (Archive::should_include_member): Move to base class.
7548         (Archive::do_for_all_unused_symbols): New function.
7549         (Add_archive_symbols::run): Remove redundant access to
7550         incremental_inputs.
7551         (Lib_group::Lib_group): Initialize base class.
7552         (Lib_group::do_filename): New function.
7553         (Lib_group::include_member): Pass pointer to Lib_group to
7554         report_object.
7555         (Lib_group::do_for_all_unused_symbols): New function.
7556         (Add_lib_group_symbols::run): Report archive information for
7557         incremental links.
7558         * archive.h (class Library_base): New base class.
7559         (class Archive): Derive from Library_base.
7560         (Archive::filename): Move to base class.
7561         (Archive::set_incremental_info): Likewise.
7562         (Archive::incremental_info): Likewise.
7563         (Archive::Should_include): Likewise.
7564         (Archive::should_include_member): Likewise.
7565         (Archive::Armap_entry): Remove.
7566         (Archive::Unused_symbol_iterator): Remove.
7567         (Archive::unused_symbols_begin): Remove.
7568         (Archive::unused_symbols_end): Remove.
7569         (Archive::do_filename): New function.
7570         (Archive::do_get_mtime): New function.
7571         (Archive::do_for_all_unused_symbols): New function.
7572         (Archive::task_): Move to base class.
7573         (Archive::incremental_info_): Likewise.
7574         (class Lib_group): Derive from Library_base.
7575         (Lib_group::do_filename): New function.
7576         (Lib_group::do_get_mtime): New function.
7577         (Lib_group::do_for_all_unused_symbols): New function.
7578         (Lib_group::task_): Move to base class.
7579         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
7580         function.
7581         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
7582         function.
7583         * incremental.cc (Incremental_inputs::report_archive_begin):
7584         Use Library_base; call library's get_mtime; add incremental inputs
7585         entry before members.
7586         (class Unused_symbol_visitor): New class.
7587         (Incremental_inputs::report_archive_end): Use Library_base; use
7588         visitor class to record unused symbols; don't add incremental inputs
7589         entry after members.
7590         (Incremental_inputs::report_object): Use Library_base.
7591         * incremental.h
7592         (Incremental_archive_entry::Incremental_archive_entry): Remove
7593         unused Archive parameter.
7594         (Incremental_inputs::report_archive_begin): Use Library_base.
7595         (Incremental_inputs::report_archive_end): Likewise.
7596         (Incremental_inputs::report_object): Likewise.
7597         * object.cc (Sized_relobj::do_for_all_global_symbols): New
7598         function.
7599         * object.h (Object::for_all_global_symbols): New function.
7600         (Object::do_for_all_global_symbols): New function.
7601         (Sized_relobj::do_for_all_global_symbols): New function.
7602         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
7603         function.
7604         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
7605         function.
7606
7607 2011-03-27  Ian Lance Taylor  <iant@google.com>
7608
7609         * archive.cc (Archive::interpret_header): Return -1 if something
7610         goes wrong.  Change callers accordingly.
7611
7612 2011-03-25  Cary Coutant  <ccoutant@google.com>
7613
7614         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
7615         * testsuite/Makefile.in: Regenerate.
7616
7617 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
7618
7619         * plugin.cc (get_view): New.
7620         (Plugin::load): Pass get_view to the plugin.
7621         (Plugin_manager::get_view): New.
7622
7623 2011-03-21  Ian Lance Taylor  <iant@google.com>
7624
7625         * testsuite/final_layout.sh: Rewrite to not use dc.
7626         * testsuite/relro_test.sh: Fail if dc is not present.
7627
7628 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
7629
7630         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
7631         Change == to -eq.
7632         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
7633         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
7634         Change == to -eq.
7635         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
7636         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
7637
7638 2011-03-14  Ian Lance Taylor  <iant@google.com>
7639
7640         * script-sections.cc (Sort_output_sections::script_compare):
7641         Rename from is_before, change return type.
7642         (Sort_output_sections::operator()): Adjust accordingly.
7643
7644 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
7645
7646         PR gold/12572
7647         * testsuite/odr_violation2.cc: Add comment to make all error line
7648         numbers double digits.
7649         * testsuite/debug_msg.sh: Adjust expected errors.
7650
7651 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
7652
7653         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
7654         but mark earlier ones as non-canonical
7655         (offset_to_iterator): Update search target and example
7656         (do_addr2line): Return extra lines in a vector*
7657         (format_file_lineno): Extract from do_addr2line
7658         (one_addr2line): Add vector* out-param
7659         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
7660         when a lineno entry appeared last for its instruction
7661         (Dwarf_line_info): Add vector* out-param
7662         * object.cc (Relocate_info): Pass NULL for the vector* out-param
7663         * symtab.cc (Odr_violation_compare): Include the lineno in the
7664         comparison again.
7665         (linenos_from_loc): New. Combine the canonical line for an
7666         address with its other lines.
7667         (True_if_intersect): New. Helper functor to make
7668         std::set_intersection a query.
7669         (detect_odr_violations): Compare sets of lines instead of just
7670         one line for each function. This became less deterministic, but
7671         has fewer false positives.
7672         * symtab.h: Declarations.
7673         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
7674         mix an optimized and non-optimized object in the same binary
7675         (odr_violation2.so): Same.
7676         * testsuite/Makefile.in: Regenerate from Makefile.am.
7677         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
7678         * testsuite/debug_msg.sh: Update line numbers and add
7679         assertions.
7680         * testsuite/odr_violation1.cc: Use OdrDerived, in a
7681         non-optimized context.
7682         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
7683         isn't inlined, and use OdrDerived in an optimized context.
7684         * testsuite/odr_header1.h: Defines OdrDerived, where
7685         optimization will change the
7686         first-instruction-in-the-destructor's file and line number.
7687         * testsuite/odr_header2.h: Defines OdrBase.
7688
7689 2011-03-09  Ian Lance Taylor  <iant@google.com>
7690
7691         * fileread.cc (File_read::clear_views): Don't delete the whole
7692         file view.
7693
7694 2011-03-08  Ian Lance Taylor  <iant@google.com>
7695
7696         PR gold/12525
7697         * fileread.cc: #include <climits>.
7698         (GOLD_IOV_MAX): Define.
7699         (File_read::read_multiple): Limit number of entries by iov_max.
7700         * fileread.h (class File_read): Always set max_readv_entries to
7701         128.
7702
7703 2011-03-07  Ian Lance Taylor  <iant@google.com>
7704
7705         PR gold/12525
7706         * options.h (class General_options): Add -dy and -dn.
7707
7708 2011-03-02  Cary Coutant  <ccoutant@google.com>
7709
7710         * testsuite/script_test_9.t: Add TLS segment.
7711
7712 2011-03-02  Simon Baldwin  <simonb@google.com>
7713
7714         * configure.ac: Add check for gnu_indirect_function support in
7715         the toolchain building binutils.
7716         * configure: Rebuild.
7717
7718 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
7719
7720         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
7721         plugin only symbols.
7722         (Symbol_table::sized_finalize_symbol) Mark symbol only present
7723         in plugin files as not needed in the symbol table.
7724
7725 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
7726
7727         * output.cc (Output_section::add_input_section): Delay fill
7728         generation for section ordering.
7729
7730 2011-02-09  Ian Lance Taylor  <iant@google.com>
7731
7732         PR gold/12316
7733         * object.h (class Sized_relobj): Remove clear_local_symbols.
7734         * reloc.cc (Sized_relobj::do_relocate): Don't call
7735         clear_local_symbols.
7736
7737 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
7738
7739         * plugin.cc (is_visible_from_outside): Return true for symbols
7740         in the -u option.
7741
7742 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
7743
7744         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
7745         filename.
7746
7747 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
7748
7749         * icf.h (is_section_foldable_candidate): Change type of parameter
7750         to std::string.
7751         * icf.cc (Icf::find_identical_sections): Change type of local variable
7752         section_name to be std::string.
7753         (is_function_ctor_or_dtor): Change type of parameter to std::string.
7754
7755 2011-01-25  Ian Lance Taylor  <iant@google.com>
7756
7757         * script.cc (script_add_extern): Rewrite to use
7758         add_symbol_reference.
7759
7760 2011-01-25  Doug Kwan  <dougkwan@google.com>
7761
7762         * icf.cc (get_section_contents): Always lock section's object.
7763
7764 2011-01-24  Ian Lance Taylor  <iant@google.com>
7765
7766         * options.h (class General_options): Accept
7767         --no-detect-odr-violations.
7768
7769 2011-01-24  Ian Lance Taylor  <iant@google.com>
7770
7771         * version.cc (version_string): Bump to 1.11.
7772
7773 2011-01-24  Ian Lance Taylor  <iant@google.com>
7774
7775         * plugin.cc (class Plugin_rescan): Define new class.
7776         (Plugin_manager::claim_file): Set any_claimed_.
7777         (Plugin_manager::save_archive): New function.
7778         (Plugin_manager::save_input_group): New function.
7779         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
7780         necessary.
7781         (Plugin_manager::new_undefined_symbol): New function.
7782         (Plugin_manager::rescan): New function.
7783         (Plugin_manager::rescannable_defines): New function.
7784         (Plugin_manager::add_input_file): Set any_added_.
7785         * plugin.h (class Plugin_manager): define new fields rescannable_,
7786         undefined_symbols_, any_claimed_, and any_added_.  Declare
7787         Plugin_rescan as friend.  Declare new functions.
7788         (Plugin_manager::Rescannable): Define type.
7789         (Plugin_manager::Rescannable_list): Define type.
7790         (Plugin_manager::Undefined_symbol_list): Define type.
7791         (Plugin_manager::Plugin_manager): Initialize new fields.
7792         * archive.cc (Archive::defines_symbol): New function.
7793         (Add_archive_symbols::run): Pass archive to plugins if any.
7794         * archive.h (class Archive): Declare defines_symbol.
7795         * readsyms.cc (Input_group::~Input_group): New function.
7796         (Finish_group::run): Pass input_group to plugins if any.
7797         * readsyms.h (class Input_group): Declare destructor.
7798         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
7799         any.
7800
7801 2011-01-10  Ian Lance Taylor  <iant@google.com>
7802
7803         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
7804         section as relro.
7805         (Layout::set_segment_offsets): Reset increase_relro before calling
7806         set_section_addresses a second time.
7807
7808 2011-01-04  Cary Coutant  <ccoutant@google.com>
7809
7810         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
7811         sections before NOBITS sections.
7812
7813 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
7814
7815         * version.cc (print_version): Update copyright to 2011.
7816
7817 2010-12-23  Cary Coutant  <ccoutant@google.com>
7818
7819         * output.h (Output_data_reloc::add_output_section): Pass OD instead
7820         of OS to this->add.  Add OD parameter to second form of the function.
7821
7822 2010-12-20  Ian Lance Taylor  <iant@google.com>
7823
7824         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
7825         second of two consecutive entries with same offset.
7826
7827 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7828
7829         * testsuite/Makefile.am (ifuncmain2static_LDADD)
7830         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
7831         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
7832         to avoid unneeded links against $(LDADD).
7833         * testsuite/Makefile.in: Regenerate.
7834
7835 2010-12-15  Ian Lance Taylor  <iant@google.com>
7836
7837         PR gold/12324
7838         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
7839         for R_X86_64_32 and R_X86_64_PC32.
7840         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
7841         ver_matching_def_pic.o.
7842         (ver_matching_def_pic.o): New target.
7843
7844 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7845
7846         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
7847         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
7848         Move definition before File_read::View member definitions.
7849         (File_read::View::~View): Initialize and hold lock before
7850         updating current_mapped_bytes.
7851
7852 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7853
7854         * dwarf_reader.cc: Remove outdated comment.
7855         * gold-threads.cc: Fix typo in error message.
7856         * archive.cc: Fix typos in comments.
7857         * archive.h: Likewise.
7858         * arm-reloc-property.cc: Likewise.
7859         * arm-reloc-property.h: Likewise.
7860         * arm-reloc.def: Likewise.
7861         * arm.cc: Likewise.
7862         * attributes.h: Likewise.
7863         * cref.cc: Likewise.
7864         * ehframe.cc: Likewise.
7865         * fileread.h: Likewise.
7866         * gold.h: Likewise.
7867         * i386.cc: Likewise.
7868         * icf.cc: Likewise.
7869         * incremental.h: Likewise.
7870         * int_encoding.cc: Likewise.
7871         * layout.h: Likewise.
7872         * main.cc: Likewise.
7873         * merge.h: Likewise.
7874         * object.cc: Likewise.
7875         * object.h: Likewise.
7876         * options.cc: Likewise.
7877         * readsyms.cc: Likewise.
7878         * reduced_debug_output.cc: Likewise.
7879         * reloc.cc: Likewise.
7880         * script-sections.cc: Likewise.
7881         * sparc.cc: Likewise.
7882         * symtab.h: Likewise.
7883         * target-reloc.h: Likewise.
7884         * target.cc: Likewise.
7885         * target.h: Likewise.
7886         * timer.cc: Likewise.
7887         * timer.h: Likewise.
7888         * x86_64.cc: Likewise.
7889
7890 2010-12-09  Cary Coutant  <ccoutant@google.com>
7891
7892         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
7893         stack.
7894         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
7895         parameter; change all callers.
7896         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
7897         * options.h (warn_execstack): New option.
7898
7899 2010-12-07  Doug Kwan  <dougkwan@google.com>
7900
7901         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
7902         like function call relocations.
7903
7904 2010-12-07  Ian Lance Taylor  <iant@google.com>
7905
7906         * archive.cc (Archive::get_elf_object_for_member): Permit
7907         punconfigured to be NULL.
7908         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
7909         (Archive::include_member): Pass NULL to get_elf_object_for_member
7910         if we searched for the archive and this is the first included
7911         object.
7912
7913 2010-12-01  Ian Lance Taylor  <iant@google.com>
7914
7915         * dwarf_reader.h (class Sized_dwarf_line_info): Add
7916         track_relocs_type_ field.
7917         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7918         Set track_relocs_type_.
7919         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
7920         contents when using RELA relocs.
7921         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
7922         reloc_map_.
7923         * reloc.cc (Track_relocs::next_addend): New function.
7924         * reloc.h (class Track_relocs): Declare next_addend.
7925
7926 2010-12-01  Ian Lance Taylor  <iant@google.com>
7927
7928         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
7929         virtual destructor.
7930
7931 2010-12-01  Ian Lance Taylor  <iant@google.com>
7932
7933         * README: Update compilers known to work and fail.
7934
7935 2010-11-23  Matthias Klose  <doko@ubuntu.com>
7936
7937         * configure.in: For --enable-gold, handle value `default' instead of
7938         `both*'.  Always install ld as ld.bfd, install as ld if gold is
7939         not the default.
7940         * configure: Regenerate.
7941
7942 2010-11-18  Doug Kwan  <dougkwan@google.com>
7943
7944         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
7945         and right_alignment to be zero.  Store result alignment only if it is
7946         greater than existing alignment.
7947
7948 2010-11-16  Cary Coutant  <ccoutant@google.com>
7949
7950         PR gold/12220
7951         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7952         Check for ".zdebug_line".
7953
7954 2010-11-16  Doug Kwan  <dougkwan@google.com>
7955             Cary Coutant  <ccoutant@google.com>
7956
7957         * output.h (Output_segment::set_section_addresses): Pass increase_relro
7958         by reference; adjust all callers.
7959         * output.cc (Output_segment::set_section_addresses): Adjust references
7960         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
7961         list is empty.
7962         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
7963         end at page boundary.
7964
7965 2010-11-16  Cary Coutant  <ccoutant@google.com>
7966
7967         PR gold/12220
7968         * layout.cc (Layout::choose_output_section): Transform names of
7969         compressed sections even when using a script with a SECTIONS clause.
7970         (Layout::output_section_name): Remove code to transform
7971         compressed debug section names.
7972         * output.cc (Output_section::add_input_section): Use uncompressed
7973         section size when tracking input sections.
7974
7975 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
7976
7977         * symtab.h (Symbol::NON_PIC_REF): Remove.
7978         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
7979         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
7980         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
7981         (Symbol::use_plt_offset): Take a flags argument and pass it
7982         directly to needs_dynamic_reloc.  Restrict check for undefined
7983         weak symbols to function calls.
7984         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
7985         (Target_arm::Scan::global): Use it.
7986         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
7987         (Target_arm::Relocate::relocate): Likewise.
7988         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
7989         parameter with an r_type parameter.  Use get_reference_flags
7990         to get the flags.
7991         (Target_arm::Relocate::relocate): Update accordingly.
7992         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
7993         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
7994         (Target_i386::Scan::global): Likewise.
7995         (Target_i386::Relocate::relocate): Likewise.
7996         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
7997         parameter with an r_type parameter.  Use get_reference_flags
7998         to get the flags.
7999         (Target_i386::Relocate::relocate): Update accordingly.
8000         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
8001         (Target_powerpc::Scan::global): Use it.
8002         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
8003         (Target_powerpc::Relocate::relocate): Likewise.
8004         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
8005         (Target_sparc::Scan::global): Use it.
8006         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
8007         (Target_sparc::Relocate::relocate): Likewise.
8008         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
8009         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
8010         (Target_x86_64::Scan::global): Likewise.
8011         (Target_x86_64::Relocate::relocate): Likewise.
8012
8013 2010-11-08  Doug Kwan  <dougkwan@google.com>
8014             Cary Coutant  <ccoutant@google.com>
8015
8016         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
8017         (Arm_exidx_merge_section::section_contents_): New data member.
8018         (Arm_input_section::Arm_input_section): Initialize original_contents_.
8019         (Arm_input_section::~Arm_input_section): De-allocate memory.
8020         (Arm_input_section::original_contents_): New data member.
8021         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
8022         in parameters instead of calling Object::section_contents without
8023         locking.
8024         (Arm_output_section::group_section): New parameter TASK.  Pass it
8025         to callees that need locking objects.
8026         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
8027         to lock EXIDX input sections.  Fix a formatting issue.  Call
8028         Arm_exidx_merged_section::build_contents to create merged section
8029         contents.
8030         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
8031         to lock object of stub table owner.
8032         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
8033         TEXT_SIZE to initialize data member TEXT_SIZE_.
8034         (Arm_exidx_input_section::addralign): Fix typo in comment.
8035         (Arm_exidx_input_section::text_size): New method.
8036         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
8037         that require locking objects.  Lock objects before scanning for stubs
8038         and updating local symbols.
8039         (Arm_input_section<big_endian>::init): Copy contents of original
8040         input section.
8041         (Arm_input_section<big_endian>::do_write): Use saved contents of
8042         original input section instead of calling Object::section_contents
8043         without locking.
8044         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
8045         size without calling Object::section_size().
8046         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
8047         for size.  Allocate a buffer for merged EXIDX entries.
8048         (Arm_exidx_merged_section::build_contents): New method.
8049         (Arm_exidx_merged_section::do_write): Move merge section contents
8050         building code to Arm_exidx_merged_section::build_contetns.  Write
8051         out contetns in buffer instead of building it on the fly.
8052         (Arm_relobj::make_exidx_input_section): Also pass text section size
8053         to Arm_exidx_input_section constructor.
8054         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
8055         (Arm_dynobj::do_read_symbols): Fix memory leak.
8056         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
8057         * target.h: (class Task): Add forward declaration.
8058         (Target::relax): Add new parameter TASK and pass it to
8059         Target::do_relax().
8060         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
8061
8062 2010-11-05  Cary Coutant  <ccoutant@google.com>
8063
8064         PR gold/10708
8065         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
8066         object when reading from the file.
8067         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
8068         second layout pass.
8069         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
8070         when reading section contents.
8071         (get_section_contents): Likewise.
8072         (icf::find_identical_sections): Likewise.
8073         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
8074         object when reading from the file.
8075         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
8076         the object when doing deferred section layout.
8077
8078 2010-11-03  Nick Clifton  <nickc@redhat.com>
8079
8080         PR gold/12001
8081         * script.h (class Symbol_assignment: name): New member.  Returns
8082         the name of the symbol.
8083         * scrfipt.cc (Script_options::is_pending_assignment): New member.
8084         Returns true if the given symbol name is on the list of
8085         assignments wating to be processed.
8086         * archive.cc (should_incldue_member): If the symbol is undefined,
8087         check to see if it is on the list of symbols pending assignment.
8088
8089 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
8090
8091         * script-sections.cc (Script_sections::find_memory_region): Check
8092         for a NULL output section pointer.
8093
8094 2010-10-29  Doug Kwan  <dougkwan@google.com>
8095
8096         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
8097         Output_section::add_relaxed_input_section.
8098         * output.cc (Output_section::add_relaxed_input_section): Add new
8099         arguments LAYOUT and NAME.  Set section order index.
8100         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8101         Copy section order index.
8102         * output.h (Output_section::add_relaxed_input_section): Add new
8103         arguments LAYOUT and NAME.
8104
8105 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8106
8107         * testsuite/Makefile.am: Move gcctestdir/ld rule to
8108         NATIVE_OR_CROSS_LINKER.
8109         * testsuite/Makefile.in: Regenerate.
8110
8111 2010-10-20  Doug Kwan  <dougkwan@google.com>
8112
8113         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
8114         without SHF_LINK_ORDER flags.
8115         * layout.cc (Layout::choose_output_section): Do not filter
8116         SHF_LINK_ORDER flag in a relocatable link.
8117
8118 2010-10-17  Cary Coutant  <ccoutant@google.com>
8119
8120         * output.h (Output_segment::set_section_addresses): Change function
8121         signature.  Update all callers.
8122         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
8123         sections.
8124         (Output_segment::set_section_addresses): Align after last TLS
8125         section.  Add padding before last relro section instead of after.
8126
8127 2010-10-17  Doug Kwan  <dougkwan@google.com>
8128
8129         * gold/arm.cc (Target_arm::got_section): Use correct order and set
8130         GOT output section to be writable.
8131
8132 2010-10-14  Cary Coutant  <ccoutant@google.com>
8133
8134         * debug.h (DEBUG_INCREMENTAL): New flag.
8135         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
8136         * gold.cc (queue_initial_tasks): Check parameters for incremental link
8137         mode.
8138         * incremental.cc (report_command_line): Ignore all forms of
8139         --incremental.
8140         * layout.cc (Layout::Layout): Check parameters for incremental link
8141         mode.
8142         * options.cc (General_options::parse_incremental): New function.
8143         (General_options::parse_no_incremental): New function.
8144         (General_options::parse_incremental_full): New function.
8145         (General_options::parse_incremental_update): New function.
8146         (General_options::incremental_mode_): New data member.
8147         (General_options::finalize): Check incremental_mode_.
8148         * options.h (General_options): Update help text for --incremental.
8149         Add --no-incremental, --incremental-full, --incremental-update.
8150         (General_options::Incremental_mode): New enum type.
8151         (General_options::incremental_mode): New function.
8152         (General_options::incremental_mode_): New data member.
8153         * parameters.cc (Parameters::incremental_mode_): New data member.
8154         (Parameters::set_options): Set incremental_mode_.
8155         (Parameters::set_incremental_full): New function.
8156         (Parameters::incremental): New function.
8157         (Parameters::incremental_update): New function.
8158         (set_parameters_incremental_full): New function.
8159         * parameters.h (Parameters::set_incremental_full): New function.
8160         (Parameters::incremental): New function.
8161         (Parameters::incremental_update): New function.
8162         (Parameters::incremental_mode_): New data member.
8163         (set_parameters_incremental_full): New function.
8164         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
8165         incremental link mode.
8166         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
8167         (Sized_relobj::do_relocate_sections): Likewise.
8168         * testsuite/Makefile.am (incremental_test): Use --incremental-full
8169         option.
8170         * testsuite/Makefile.in: Regenerate.
8171         * testsuite/incremental_test.sh: Filter all forms of --incremental.
8172
8173 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8174
8175         * script-sections.h (class Script_sections): Make
8176         Sections_elements typedef public.
8177         * script-sections.cc (class Sort_output_sections): Add elements_
8178         field.  Add constructor which sets it; change all callers.
8179         (Sort_output_sections::is_before): New function.
8180         (Sort_output_sections::operator()): Call is_before.
8181         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
8182         conditional.
8183         * testsuite/script_test_10.sh: New test. Test script section
8184         order.
8185         * testsuite/script_test_10.t: Likewise.
8186         * testsuite/script_test_10.s: Likewise.
8187         * testsuite/Makefile.am: Wrap the cross linker tests and the
8188         common tests into NATIVE_OR_CROSS_LINKER.
8189         (check_SCRIPTS): Add script_test_10.sh.
8190         (check_DATA): Add script_test_10.stdout.
8191         (script_test_10.o, script_test_10): New targets.
8192         (script_test_10.stdout): New target.
8193         * configure, testsuite/Makefile.in: Regenerate.
8194
8195 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8196
8197         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
8198         error for the deprecated relocations.
8199         (Target_arm::Scan::global): Likewise.
8200         (Target_arm::Relocate::relocate): Likewise.
8201
8202 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
8203
8204         * fileread.cc (Input_file::find_file): Initialize *found_name
8205         and *namep when using the fallback search for case 4.
8206
8207 2010-10-11  Cary Coutant  <ccoutant@google.com>
8208
8209         * options.h (class General_options): Redefine -z lazy as an alias for
8210         the negation of -z now.
8211
8212 2010-10-11  Ian Lance Taylor  <iant@google.com>
8213
8214         * resolve.cc (symbol_to_bits): Report the value of the unsupported
8215         binding.
8216
8217 2010-10-06  Nick Clifton  <nickc@redhat.com>
8218
8219         * script-sections.cc(class Memory_region): Remove
8220         current_lma_offset_ field.  Rename current_vma_offset_ to
8221         current_offset_.  Add last_section_ field.
8222         (Memory_region::get_current_vma_address): Rename to
8223         get_current_address.
8224         (Memory_region::get_current_lma_address): Delete.
8225         (Memory_region::increment_vma_offset): Rename to
8226         increment_offset.
8227         (Memory_region::increment_lma_offset): Delete.
8228         (Memory_region::attributes_compatible): New method.  Returns
8229         true if the provided section is compatible with the region.
8230         (Memory_region::get_last_section): New method.  Returns the last
8231         section to use the region.
8232         (Memory_region::set_last_section): New method.  Stores the last
8233         section to use the region.
8234         (Script_sections::block_in_region): New method.  Returns true if
8235         a block of memory is contained within a region.
8236         (Script_sections::find_memory_region): New method.  Locates a
8237         memory region to be used to set a VMA or LMA address.
8238         (Output_section_definition::set_section_addresses): Add code to
8239         check for addresses set by memory regions.
8240         (Output_segment::set_section_addresses): Remove memory region
8241         walking code.
8242         (Script_sections::create_segment): Add a warning if a header
8243         segment is created outside of any region.
8244         * script-sections.h (class Script_sections): Add prototypes for
8245         find_memory_region and block_in_region methods.
8246         * testsuite/memory_test.s: Use .long instead of .word.
8247         * testsuite/memory_test.t: Add some more output sections.
8248         * testsuite/memory_test.sh: Update expected output.
8249
8250 2010-10-02  Doug Kwan  <dougkwan@google.com>
8251
8252         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
8253         defintion to symtab.h
8254         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
8255         declaration to defintion.
8256
8257 2010-10-01  Nick Clifton  <nickc@redhat.com>
8258
8259         * expression.cc (eval): Replace dummy argument with NULL.
8260         (eval_maybe_dot): Check for a NULL result section pointer.
8261         (Symbol_expression::value): Likewise.
8262         (Dot_expression::value): Likewise.
8263         (BINARY_EXPRESSION): Likewise.
8264         (Max_expression::value): Likewise.
8265         (Min_expression::value): Likewise.
8266         (Absolute_expression::value): Likewise.
8267         (Addr_expression::value_from_output_section): Likewise.
8268         (Loaddddr_expression::value_from_output_section): Likewise.
8269         (Segment_start_expression::value): Likewise.
8270         * script-sections.cc
8271         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
8272         argument with NULL.
8273         (Sections_elememt_dot_assignment::set_section_addresses):
8274         Likewise.
8275         (Output_data_expression::do_write_to_buffer): Likewise.
8276         (Output_section_definition::finalize_symbols): Likewise.
8277         (Output_section_definition::set_section_addresses): Likewise.
8278
8279 2010-09-30  Doug Kwan  <dougkwan@google.com>
8280
8281         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
8282
8283 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
8284
8285         * target.h (Target::can_icf_inline_merge_sections): New virtual
8286         function.
8287         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
8288         virtual function.
8289         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
8290         virtual function.
8291         * icf.cc (get_section_contents): Inline merge sections only when
8292         target allows it.
8293
8294 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8295
8296         * configure: Regenerate.
8297
8298 2010-09-17  Ian Lance Taylor  <iant@google.com>
8299
8300         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
8301         * testsuite/Makefile.am (memory_test.o): New target.
8302         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
8303         memory_test.t.
8304         * testsuite/Makefile.in: Rebuild.
8305
8306 2010-09-17  Doug Kwan  <dougkwan@google.com>
8307
8308         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
8309         defintion if relocation uses GOT entries of the symbol.
8310         * testsuite/icf_safe_test.sh: Fix test.
8311         * testsuite/icf_safe_so_test.sh: Fix test.
8312
8313 2010-09-16  Cary Coutant  <ccoutant@google.com>
8314
8315         * script_sections.cc (class Memory_region): Remove "NULL" from
8316         vector initializations.
8317
8318 2010-09-15  Cary Coutant  <ccoutant@google.com>
8319
8320         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
8321         Resolve forwarding symbols.
8322
8323 2010-09-15  Doug Kwan  <dougkwan@google.com>
8324
8325         * gold/testsuite/script_test_3.t: Add ARM special sections.
8326         * gold/testsuite/script_test_4.t: Same.
8327         * gold/testsuite/script_test_5.t: Same.
8328         * gold/testsuite/script_test_6.t: Same.
8329         * gold/testsuite/script_test_7.t: Same.
8330         * gold/testsuite/script_test_7.t: Same.
8331         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
8332
8333 2010-09-14  Cary Coutant  <ccoutant@google.com>
8334
8335         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
8336         (Target_x86_64::Relocate::relocate_tls): Replace check for
8337         saw_tls_block_reloc_ with test for executable section.
8338
8339 2010-09-12  Cary Coutant  <ccoutant@google.com>
8340
8341         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
8342         position-independent executables to shared libraries need dynamic
8343         relocations.
8344         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
8345         position-independent executables.
8346         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
8347         * testsuite/Makefile.in: Regenerate.
8348
8349 2010-09-10  Nick Clifton  <nickc@redhat.com>
8350
8351         PR gold/11997
8352         * testsuite/memory_test.t: Discard any sections that are not
8353         needed.
8354
8355 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
8356
8357         PR gold/11996
8358         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
8359         "This::" to work around a bug in gcc 4.2.
8360
8361         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
8362
8363 2010-09-09  Rafael Espindola  <espindola@google.com>
8364
8365         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
8366         sections with different PF_X flags in the same segment.
8367         (Layout::find_first_load_seg): Search all segments to find the first
8368         one.
8369         * options.h (rosegment): New.
8370
8371 2010-09-08  Rafael Espindola  <espindola@google.com>
8372
8373         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
8374
8375 2010-09-08  Doug Kwan  <dougkwan@google.com>
8376
8377         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
8378         (Arm_relobj::do_relocate_sections): Add new parameter for output
8379         file to match the parent.
8380         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
8381         of local symbols instead of input values.  Update code to track
8382         changes in gold::relocate_section.
8383         * object.cc (Sized_relobj::compute_final_local_value): New methods.
8384         (Sized_relobj::compute_final_local_value_internal): New methods.
8385         (Sized_relobj::do_finalize_local_symbols): Move code from loop
8386         body into private version of Sized_relobj::compute_final_local_value.
8387         Call the inline method.
8388         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
8389         merged symbol value if there is one.
8390         (Symbol_value::has_output_value): New method defintiion.
8391         (Sized_relobj::Compute_final_local_value_status): New enum type.
8392         (Sized_relobj::compute_final_local_value): New methods.
8393         (Sized_relobj::compute_final_local_value_internal): New methods.
8394         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
8395         and arm_cortex_a8.sh.
8396         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
8397         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
8398         New tests.
8399         * Makefile.in: Regenerate.
8400         * testsuite/arm_bl_out_of_range.s: Update test.
8401         * testsuite/thumb_bl_out_of_range.s: Ditto.
8402         * testsuite/thumb_blx_out_of_range.s: Ditto.
8403         * testsuite/arm_branch_out_of_range.sh: New file.
8404         * testsuite/arm_cortex_a8.sh: Ditto.
8405         * testsuite/arm_cortex_a8_b.s: Ditto.
8406         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
8407         * testsuite/arm_cortex_a8_b_local.s: Ditto.
8408         * testsuite/arm_cortex_a8_bl.s: Ditto.
8409         * testsuite/arm_cortex_a8_blx.s: Ditto.
8410         * testsuite/arm_cortex_a8_local.s: Ditto.
8411         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
8412         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
8413
8414 2010-09-08  Rafael Espindola  <espindola@google.com>
8415
8416         * Makefile.am (memory_test.stdout): Run readelf with -W.
8417         * Makefile.in: Regenerate.
8418         * testsuite/memory_test.sh: Make the regexps accept both 32 and
8419         64 bit output.
8420
8421 2010-09-08  Rafael Espindola  <espindola@google.com>
8422
8423         * script-sections.cc (Script_sections::add_memory_region): Convert
8424         field precision to int.
8425         * script.cc (script_set_section_region, script_set_section_region):
8426         Convert field precision to int.
8427
8428 2010-09-08  Rafael Espindola  <espindola@google.com>
8429
8430         * arm.cc (do_finalize_sections): Create the __exidx_start and
8431         __exdix_end symbols even when the section is missing.
8432
8433 2010-09-08  Nick Clifton  <nickc@redhat.com>
8434
8435         * README: Remove claim that MEMORY is not supported.
8436         * expression.cc (script_exp_function_origin)
8437         (script_exp_function_length): Move from here to ...
8438         * script.cc: ... here.
8439         (script_set_section_region, script_add_memory)
8440         (script_parse_memory_attr, script_include_directive): New
8441         functions.
8442         * script-sections.cc
8443         (class Memory_region): New class.
8444         (class Output_section_definition): Add set_memory_region,
8445         set_section_vma, set_section_lma and get_section_name methods.
8446         (class Script_Sections): Add add_memory_region,
8447         find_memory_region, find_memory_region_origin,
8448         find_memory_region_length and set_memory_region methods.
8449         Have set_section_addresses method walk the list of set memory
8450         regions.
8451         Extend the print methos to display memory regions.
8452         * script-sections.h: Add prototypes for new methods.
8453         Add enum for MEMORY region attributes.
8454         * yyscript.y: Add support for parsing MEMORY regions.
8455         * script-c.h: Add prototypes for new functions.
8456         * testsuite/Makefile.am: Add test of MEMORY region functionality.
8457         * testsuite/Makefile.in: Regenerate.
8458         * testsuite/memory_test.sh: New script.
8459         * testsuite/memory_test.s: New assembler source file.
8460         * testsuite/memory_test.t: New linker script.
8461
8462 2010-08-27  Doug Kwan  <dougkwan@google.com>
8463
8464         * gold/resolve.cc (Symbol_table::should_override): Let a weak
8465         reference override an existing dynamic weak reference.
8466         * testsuite/Makefile.am: Add new test dyn_weak_ref.
8467         * testsuite/Makefile.in: Regenerate.
8468         * testsuite/dyn_weak_ref.sh: New file.
8469         * testsuite/dyn_weak_ref_1.c: Ditto.
8470         * testsuite/dyn_weak_ref_2.c: Ditto.
8471
8472 2010-08-27  Ian Lance Taylor  <iant@google.com>
8473
8474         * incremental.h (class Incremental_input_entry): Add virtual
8475         destructor.
8476
8477 2010-08-27  Ian Lance Taylor  <iant@google.com>
8478
8479         * testsuite/start_lib_test_3.c: Mark t3 as used.
8480
8481 2010-08-27  Nick Clifton  <nickc@redhat.com>
8482
8483         * options.cc (version_script): Fix small typo in previous
8484         whitespace tidyup.
8485
8486 2010-08-25  Nick Clifton  <nickc@redhat.com>
8487
8488         * archive.cc: Formatting fixes: Remove whitespace between
8489         typename and following asterisk.  Remove whitespace between
8490         function name and opening parenthesis.
8491         * archive.h: Likewise.
8492         * arm.cc: Likewise.
8493         * attributes.cc: Likewise.
8494         * attributes.h: Likewise.
8495         * common.cc: Likewise.
8496         * copy-relocs.cc: Likewise.
8497         * dirsearch.h: Likewise.
8498         * dynobj.cc: Likewise.
8499         * ehframe.cc: Likewise.
8500         * ehframe.h: Likewise.
8501         * expression.cc: Likewise.
8502         * fileread.cc: Likewise.
8503         * fileread.h: Likewise.
8504         * gc.h: Likewise.
8505         * gold-threads.cc: Likewise.
8506         * gold.cc: Likewise.
8507         * i386.cc: Likewise.
8508         * icf.h: Likewise.
8509         * incremental-dump.cc: Likewise.
8510         * incremental.cc: Likewise.
8511         * layout.cc: Likewise.
8512         * layout.h: Likewise.
8513         * main.cc: Likewise.
8514         * merge.cc: Likewise.
8515         * merge.h: Likewise.
8516         * object.cc: Likewise.
8517         * object.h: Likewise.
8518         * options.cc: Likewise.
8519         * options.h: Likewise.
8520         * output.cc: Likewise.
8521         * output.h: Likewise.
8522         * plugin.cc: Likewise.
8523         * plugin.h: Likewise.
8524         * powerpc.cc: Likewise.
8525         * reloc.cc: Likewise.
8526         * script-c.h: Likewise.
8527         * script-sections.cc: Likewise.
8528         * script.cc: Likewise.
8529         * stringpool.cc: Likewise.
8530         * symtab.cc: Likewise.
8531         * symtab.h: Likewise.
8532         * target.cc: Likewise.
8533         * timer.cc: Likewise.
8534         * timer.h: Likewise.
8535         * version.cc: Likewise.
8536         * x86_64.cc: Likewise.
8537
8538 2010-08-24  Nick Clifton  <nickc@redhat.com>
8539
8540         PR 11899
8541         * layout.cc (segment_precedes): Sort segments by their physical
8542         addresses, if they have been set.
8543
8544 2010-08-23  Cary Coutant  <ccoutant@google.com>
8545
8546         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
8547         symbols data.
8548         (Lib_group::include_member): Unlock object after deleting its
8549         symbols data.
8550         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
8551         the bug fixed here.
8552
8553 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
8554             Cary Coutant  <ccoutant@google.com>
8555
8556         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
8557         constructor, and set_blocker.
8558         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
8559         readsyms_blocker_.
8560         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
8561         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
8562         * testsuite/Makefile.am (start_lib_test): New test case.
8563         * testsuite/Makefile.in: Regenerate.
8564         * testsuite/start_lib_test_main.c: New file.
8565         * testsuite/start_lib_test_1.c: New file.
8566         * testsuite/start_lib_test_2.c: New file.
8567         * testsuite/start_lib_test_3.c: New file.
8568
8569 2010-08-19  Ian Lance Taylor  <iant@google.com>
8570
8571         * Makefile.in: Rebuild with automake 1.11.1.
8572         * aclocal.m4: Likewise.
8573         * testsuite/Makefile.in: Likewise.
8574
8575 2010-08-19  Ian Lance Taylor  <iant@google.com>
8576
8577         PR 10893
8578         * i386.cc (class Output_data_plt_i386): Update declarations.
8579         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
8580         local_ifuncs_ fields.
8581         (Target_i386::do_plt_section_for_global): New function.
8582         (Target_i386::do_plt_section_for_local): New function.
8583         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
8584         parameter; change all callers.  Initialize global_ifuncs_ and
8585         local_ifuncs_.  If doing a static link define __rel_iplt_start and
8586         __rel_iplt_end.
8587         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
8588         (Output_data_plt_i386::add_local_ifunc_entry): New function.
8589         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
8590         symbols.
8591         (Target_i386::make_plt_section): New function, broken out of
8592         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
8593         (Target_i386::make_plt_entry): Call make_plt_section.
8594         (Target_i386::make_local_ifunc_plt_entry): New function.
8595         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
8596         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
8597         R_386_IRELATIVE to switch.
8598         (Target_i386::Scan::global): Likewise.
8599         (Target_i386::Relocate::relocate): Likewise.
8600         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
8601         switch.
8602         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
8603         (Target_x86_64::do_plt_section_for_global): New function.
8604         (Target_x86_64::do_plt_section_for_local): New function.
8605         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
8606         parameter; change all callers.  If doing a static link define
8607         __rela_iplt_start and __rela_iplt_end.
8608         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
8609         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
8610         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
8611         to point to .plt.
8612         (Target_x86_64::make_local_ifunc_plt_entry): New function.
8613         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
8614         switch.
8615         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
8616         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
8617         R_X86_64_IRELATIVE to switch.
8618         (Target_x86_64::Scan::global): Likewise.
8619         (Target_x86_64::Relocate::relocate): Likewise.
8620         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
8621         switch.
8622         * target.h (class Target): Add plt_section_for_global and
8623         plt_section_for_local functions.  Add do_plt_section_for_global
8624         and do_plt_section_for_local virtual functions.
8625         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
8626         clarifying comments.
8627         (Symbol::use_plt_offset): Handle IFUNC symbol.
8628         * object.cc (Sized_relobj::Sized_relobj): Initialize
8629         local_plt_offsets_.
8630         (Sized_relobj::local_has_plt_offset): New function.
8631         (Sized_relobj::local_plt_offset): New function.
8632         (Sized_relobj::set_local_plt_offset): New function.
8633         (Sized_relobj::do_count): Handle IFUNC symbol.
8634         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
8635         a bit away from input_shndx_ field.  Add set_is_func_symbol and
8636         is_ifunc_symbol functions.
8637         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
8638         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
8639         local_plt_offsets_ field.
8640         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
8641         * output.h (class Output_section_data): Add non-const
8642         output_section function.
8643         (class Output_data_got): Update declarations.
8644         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
8645         Add use_plt_offset parameter to global and local constructors.
8646         Change all callers.  Change local_sym_index_ field to 31 bits.
8647         Change GSYM_CODE and CONSTANT_CODE accordingly.
8648         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
8649         doing a static link don't set sh_link field.
8650         (Output_data_got::Got_entry::write): Use PLT offset if
8651         appropriate.
8652         (Output_data_got::add_global_plt): New function.
8653         (Output_data_got::add_local_plt): New function.
8654         * target-reloc.h (relocate_section): Handle IFUNC symbol.
8655         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
8656         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
8657         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
8658         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
8659         IFUNC conditional.
8660         * testsuite/ifunc-sel.h: New file.
8661         * testsuite/ifuncmain1.c: New file.
8662         * testsuite/ifuncmain1vis.c: New file.
8663         * testsuite/ifuncmod1.c: New file.
8664         * testsuite/ifuncdep2.c: New file.
8665         * testsuite/ifuncmain2.c: New file.
8666         * testsuite/ifuncmain3.c: New file.
8667         * testsuite/ifuncmod3.c: New file.
8668         * testsuite/ifuncmain4.c: New file.
8669         * testsuite/ifuncmain5.c: New file.
8670         * testsuite/ifuncmod5.c: New file.
8671         * testsuite/ifuncmain6pie.c: New file.
8672         * testsuite/ifuncmod6.c: New file.
8673         * testsuite/ifuncmain7.c: New file.
8674         * configure, testsuite/Makefile.in: Rebuild.
8675
8676 2010-08-18  Ian Lance Taylor  <iant@google.com>
8677
8678         * incremental.cc
8679         (Output_section_incremental_inputs::write_input_files): Add cast
8680         to avoid signed/unsigned comparison warning.
8681         (Output_section_incremental_inputs::write_info_blocks): Likewise.
8682
8683 2010-08-12  Cary Coutant  <ccoutant@google.com>
8684
8685         * common.cc (Sort_commons::operator()): Remove unnecessary code.
8686
8687 2010-08-13  Ian Lance Taylor  <iant@google.com>
8688
8689         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
8690
8691 2010-08-12  Cary Coutant  <ccoutant@google.com>
8692             Doug Kwan  <dougkwan@google.com>
8693
8694         * resolve.cc (Symbol_table::should_override): When a weak dynamic
8695         defintion overrides non-weak undef, remember that the original undef
8696         is not weak.
8697         * symtab.cc (Symbol_table::sized_write_global): For undef without
8698         an original weak binding, set binding to global in output.
8699         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
8700         * testsuite/Makefile.in: Regenerate.
8701         * testsuite/strong_ref_weak_def.sh: New file.
8702         * testsuite/strong_ref_weak_def_1.c: Ditto.
8703         * testsuite/strong_ref_weak_def_2.c: Ditto.
8704
8705 2010-08-12  Cary Coutant  <ccoutant@google.com>
8706
8707         * testsuite/incremental_test.sh: Rewrite.
8708         * testsuite/incremental_test_1.c: Rewrite.
8709         * testsuite/incremental_test_2.c: Rewrite.
8710
8711 2010-08-12  Cary Coutant  <ccoutant@google.com>
8712
8713         * arm.cc (Target_arm::got_size): Add const.
8714         (Target_arm::got_entry_count): New function.
8715         (Target_arm::plt_entry_count): New function.
8716         (Target_arm::first_plt_entry_offset): New function.
8717         (Target_arm::plt_entry_size): New function.
8718         (Output_data_plt_arm::entry_count): New function.
8719         (Output_data_plt_arm::first_plt_entry_offset): New function.
8720         (Output_data_plt_arm::get_plt_entry_size): New function.
8721         * i386.cc (Target_i386::got_size): Add const.
8722         (Target_i386::got_entry_count): New function.
8723         (Target_i386::plt_entry_count): New function.
8724         (Target_i386::first_plt_entry_offset): New function.
8725         (Target_i386::plt_entry_size): New function.
8726         (Output_data_plt_i386::entry_count): New function.
8727         (Output_data_plt_i386::first_plt_entry_offset): New function.
8728         (Output_data_plt_i386::get_plt_entry_size): New function.
8729         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
8730         find_incremental_inputs_sections.  Dump incremental_got_plt section.
8731         * incremental.cc: Include target.h.
8732         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
8733         parameter.  Adjust all callers.  Find incremental_got_plt section.
8734         (Incremental_inputs::create_data_sections): Create incremental_got_plt
8735         section.
8736         (Output_section_incremental_inputs::set_final_data_size): Calculate
8737         size of incremental_got_plt section.
8738         (Output_section_incremental_inputs::do_write): Write the
8739         incremental_got_plt section.
8740         (Got_plt_view_info): New struct.
8741         (Local_got_offset_visitor): New class.
8742         (Global_got_offset_visitor): New class.
8743         (Global_symbol_visitor_got_plt): New class.
8744         (Output_section_incremental_inputs::write_got_plt): New function.
8745         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
8746         Add parameter.  Adjust all callers.
8747         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8748         (Incremental_inputs::got_plt_section): New function.
8749         (Incremental_inputs::got_plt_section_): New data member.
8750         (Incremental_got_plt_reader): New class.
8751         * layout.cc (Layout::create_incremental_info_sections): Add the
8752         incremental_got_plt section.
8753         * object.h (Got_offset_list::get_list): New function.
8754         (Got offset_list::for_all_got_offsets): New function.
8755         (Sized_relobj::local_got_offset_list): New function.
8756         * powerpc.cc (Target_powerpc::got_size): Add const.
8757         (Target_powerpc::got_entry_count): New function.
8758         (Target_powerpc::plt_entry_count): New function.
8759         (Target_powerpc::first_plt_entry_offset): New function.
8760         (Target_powerpc::plt_entry_size): New function.
8761         (Output_data_plt_powerpc::entry_count): New function.
8762         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
8763         (Output_data_plt_powerpc::get_plt_entry_size): New function.
8764         * sparc.cc (Target_sparc::got_size): Add const.
8765         (Target_sparc::got_entry_count): New function.
8766         (Target_sparc::plt_entry_count): New function.
8767         (Target_sparc::first_plt_entry_offset): New function.
8768         (Target_sparc::plt_entry_size): New function.
8769         (Output_data_plt_sparc::entry_count): New function.
8770         (Output_data_plt_sparc::first_plt_entry_offset): New function.
8771         (Output_data_plt_sparc::get_plt_entry_size): New function.
8772         * symtab.h (Symbol::got_offset_list): New function.
8773         (Symbol_table::for_all_symbols): New function.
8774         * target.h (Sized_target::got_entry_count): New function.
8775         (Sized_target::plt_entry_count): New function.
8776         (Sized_target::plt_entry_size): New function.
8777         * x86_64.cc (Target_x86_64::got_size): Add const.
8778         (Target_x86_64::got_entry_count): New function.
8779         (Target_x86_64::plt_entry_count): New function.
8780         (Target_x86_64::first_plt_entry_offset): New function.
8781         (Target_x86_64::plt_entry_size): New function.
8782         (Output_data_plt_x86_64::entry_count): New function.
8783         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
8784         (Output_data_plt_x86_64::get_plt_entry_size): New function.
8785
8786 2010-08-12  Cary Coutant  <ccoutant@google.com>
8787
8788         * archive.cc: Include incremental.h.
8789         (Archive::Archive): Initialize incremental_info_.
8790         (Archive::include_member): Record archive members in incremental info.
8791         (Add_archive_symbols::run): Record begin and end of an archive in
8792         incremental info.
8793         (Lib_group::include_member): Record objects in incremental info.
8794         * archive.h (Incremental_archive_entry): Forward declaration.
8795         (Archive::set_incremental_info): New member function.
8796         (Archive::incremental_info): New member function.
8797         (Archive::Unused_symbol_iterator): New class.
8798         (Archive::unused_symbols_begin): New member function.
8799         (Archive::unused_symbols_end): New member function.
8800         (Archive::incremental_info_): New data member.
8801         * incremental-dump.cc (find_input_containing_global): New function.
8802         (dump_incremental_inputs): Dump new incremental info sections.
8803         * incremental.cc: Include symtab.h.
8804         (Output_section_incremental_inputs): New class.
8805         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
8806         new incremental info sections.
8807         (Sized_incremental_binary::do_check_inputs): Likewise.
8808         (Incremental_inputs::report_archive): Remove.
8809         (Incremental_inputs::report_archive_begin): New function.
8810         (Incremental_inputs::report_archive_end): New function.
8811         (Incremental_inputs::report_object): New function.
8812         (Incremental_inputs::finalize_inputs): Remove.
8813         (Incremental_inputs::report_input_section): New function.
8814         (Incremental_inputs::report_script): Rewrite.
8815         (Incremental_inputs::finalize): Do nothing but finalize string table.
8816         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8817         (Incremental_inputs::sized_create_inputs_section_data): Remove.
8818         (Incremental_inputs::create_data_sections): New function.
8819         (Incremental_inputs::relocs_entsize): New function.
8820         (Output_section_incremental_inputs::set_final_data_size): New function.
8821         (Output_section_incremental_inputs::do_write): New function.
8822         (Output_section_incremental_inputs::write_header): New function.
8823         (Output_section_incremental_inputs::write_input_files): New function.
8824         (Output_section_incremental_inputs::write_info_blocks): New function.
8825         (Output_section_incremental_inputs::write_symtab): New function.
8826         * incremental.h (Incremental_script_entry): Forward declaration.
8827         (Incremental_object_entry): Forward declaration.
8828         (Incremental_archive_entry): Forward declaration.
8829         (Incremental_inputs): Forward declaration.
8830         (Incremental_inputs_header_data): Remove.
8831         (Incremental_inputs_header): Remove.
8832         (Incremental_inputs_header_write): Remove.
8833         (Incremental_inputs_entry_data): Remove.
8834         (Incremental_inputs_entry): Remove.
8835         (Incremental_inputs_entry_write): Remove.
8836         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
8837         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
8838         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8839         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
8840         Likewise.
8841         (Incremental_input_entry): New class.
8842         (Incremental_script_entry): New class.
8843         (Incremental_object_entry): New class.
8844         (Incremental_archive_entry): New class.
8845         (Incremental_inputs::Incremental_inputs): Initialize new data members.
8846         (Incremental_inputs::report_inputs): Remove.
8847         (Incremental_inputs::report_archive): Remove.
8848         (Incremental_inputs::report_archive_begin): New function.
8849         (Incremental_inputs::report_archive_end): New function.
8850         (Incremental_inputs::report_object): Change prototype.
8851         (Incremental_inputs::report_input_section): New function.
8852         (Incremental_inputs::report_script): Change prototype.
8853         (Incremental_inputs::get_reloc_count): New function.
8854         (Incremental_inputs::set_reloc_count): New function.
8855         (Incremental_inputs::create_data_sections): New function.
8856         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8857         (Incremental_inputs::inputs_section): New function.
8858         (Incremental_inputs::symtab_section): New function.
8859         (Incremental_inputs::relocs_section): New function.
8860         (Incremental_inputs::get_stringpool): Add const.
8861         (Incremental_inputs::command_line): Add const.
8862         (Incremental_inputs::inputs): Remove.
8863         (Incremental_inputs::command_line_key): New function.
8864         (Incremental_inputs::input_file_count): New function.
8865         (Incremental_inputs::input_files): New function.
8866         (Incremental_inputs::relocs_entsize): New function.
8867         (Incremental_inputs::sized_create_inputs_section_data): Remove.
8868         (Incremental_inputs::finalize_inputs): Remove.
8869         (Incremental_inputs::Input_info): Remove.
8870         (Incremental_inputs::lock_): Remove.
8871         (Incremental_inputs::inputs_): Change type.
8872         (Incremental_inputs::inputs_map_): Remove.
8873         (Incremental_inputs::current_object_entry_): New data member.
8874         (Incremental_inputs::inputs_section_): New data member.
8875         (Incremental_inputs::symtab_section_): New data member.
8876         (Incremental_inputs::relocs_section_): New data member.
8877         (Incremental_inputs::reloc_count_): New data member.
8878         (Incremental_inputs_reader): New class.
8879         (Incremental_symtab_reader): New class.
8880         (Incremental_relocs_reader): New class.
8881         * layout.cc (Layout::finalize): Move finalization of incremental info
8882         and creation of incremental info sections to follow finalization of
8883         symbol table.  Set offsets for postprocessing sections.
8884         (Layout::create_incremental_info_sections): Call
8885         Incremental_inputs::create_data_sections.  Add incremental symtab
8886         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
8887         sections to layout after input sections.
8888         * layout.h (struct Timespec): Forward declaration.
8889         (Layout::incremental_inputs): Add const.
8890         (Layout::create_incremental_info_sections): Add parameter.
8891         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
8892         * object.cc: Include incremental.h.
8893         (Relobj::finalize_incremental_relocs): New function.
8894         (Sized_relobj::do_layout): Record input sections in incremental info.
8895         * object.h (Object::output_section): New function.
8896         (Object::output_section_offset): Moved from Relobj.
8897         (Object::get_incremental_reloc_base): New function.
8898         (Object::get_incremental_reloc_count): New function.
8899         (Object::do_output_section): New function.
8900         (Object::do_output_section_offset): Moved from Relobj.
8901         (Object::do_get_incremental_reloc_base): New function.
8902         (Object::do_get_incremental_reloc_count): New function.
8903         (Object::Object): Initialize new data members.
8904         (Relobj::output_section): Renamed do_output_section and moved to
8905         protected.
8906         (Relobj::output_section_offset): Moved to Object.
8907         (Relobj::do_get_incremental_reloc_base): New function.
8908         (Relobj::do_get_incremental_reloc_count): New function.
8909         (Relobj::allocate_incremental_reloc_counts): New function.
8910         (Relobj::count_incremental_reloc): New function.
8911         (Relobj::finalize_incremental_relocs): New function.
8912         (Relobj::next_incremental_reloc_index): New function.
8913         (Relobj::reloc_counts_): New data member.
8914         (Relobj::reloc_bases_): New data member.
8915         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
8916         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
8917         (Sized_relobj::incremental_relocs_scan): New function.
8918         (Sized_relobj::incremental_relocs_scan_reltype): New function.
8919         (Sized_relobj::incremental_relocs_write): New function.
8920         (Sized_relobj::incremental_relocs_write_reltype): New function.
8921         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
8922         incremental link.
8923         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
8924         archives and object files elsewhere.
8925         (Add_symbols::run): Report object files here.
8926         (Finish_group::run): Report end of archive at end of group.
8927         * reloc.cc: Include layout.h, incremental.h.
8928         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
8929         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
8930         (Sized_relobj::incremental_relocs_scan): New function.
8931         (Sized_relobj::incremental_relocs_scan_reltype): New function.
8932         (Sized_relobj::do_relocate_sections): Write incremental relocations.
8933         (Sized_relobj::incremental_relocs_write): New function.
8934         (Sized_relobj::incremental_relocs_write_reltype): New function.
8935         * script.cc (read_input_script): Rewrite test for incremental link.
8936         Change call to Incremental_inputs::report_script.
8937         * symtab.h (Symbol_table::first_global_index): New function.
8938         (Symbol_table::output_count): New function.
8939
8940 2010-08-12  Doug Kwan  <dougkwan@google.com>
8941
8942         * arm.cc (Target_arm::merge_object_attributes): Check command line
8943         options --no-wchar-size-warning and --no-enum-size-warning.
8944         * options.h (General_options): Add ld-compatible options
8945         --no-enum-size-warning and --no-wchar-size-warning.
8946
8947 2010-08-04  Ian Lance Taylor  <iant@google.com>
8948
8949         * x86_64.cc (Target_x86_64::Scan::local): Use
8950         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
8951         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
8952         (Target_x86_64::Scan::global): Likewise.
8953         (Target_x86_64::Relocate::relocate): Likewise.
8954         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
8955         Likewise.
8956
8957 2010-08-03  Cary Coutant  <ccoutant@google.com>
8958
8959         * merge.cc (Output_merge_string::do_add_input_section): Count strings
8960         to reserve space in merged_strings vector. Keep total input size
8961         for stats.
8962         (Output_merge_string::do_print_merge_stats): Print total input size.
8963         * merge.h (Output_merge_string): Add input_size_ field.
8964         * stringpool.cc (Stringpool_template::string_length): Move
8965         implementations out of Stringpool_template class and place in
8966         stringpool.h.
8967         * stringpool.h (string_length): Move out of Stringpool_template.
8968
8969 2010-08-03  Ian Lance Taylor  <iant@google.com>
8970
8971         PR 11712
8972         * layout.cc (relaxation_loop_body): If address of load segment is
8973         set, adjust address to include headers if possible.
8974
8975 2010-08-03  Ian Lance Taylor  <iant@google.com>
8976
8977         * version.cc (version_string): Bump to 1.10.
8978
8979 2010-08-03  Ian Lance Taylor  <iant@google.com>
8980
8981         PR 11805
8982         * layout.h (enum Output_section_order): Define.
8983         (class Layout): Update declarations.
8984         * layout.cc (Layout::get_output_section): Add order parameter.
8985         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
8986         is_first_non_relro parameters.  Change all callers.
8987         (Layout::choose_output_section): Likewise.
8988         (Layout::add_output_section_data): Likewise.
8989         (Layout::make_output_section): Likewise.  Set order.
8990         (Layout::default_section_order): New function.
8991         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
8992         * output.cc (Output_section::Output_section): Initialize order_.
8993         Don't initialize deleted fields.
8994         (Output_segment::Output_segment): Don't initialize deleted
8995         fields.
8996         (Output_segment::add_output_section_to_load): New function
8997         replacing add_output_section.  Change all callers to call this or
8998         add_output_section_to_nonload.
8999         (Output_segment::add_output_section_to_nonload): New function.
9000         (Output_segment::remove_output_section): Rewrite.
9001         (Output_segment::add_initial_output_data): Likewise.
9002         (Output_segment::has_any_data_sections): Likewise.
9003         (Output_segment::is_first_section_relro): Likewise.
9004         (Output_segment::maximum_alignment): Likewise.
9005         (Output_segment::has_dynamic_reloc): New function replacing
9006         dynamic_reloc_count.  Change all callers.
9007         (Output_segment::has_dynamic_reloc_list): New function replacing
9008         dynamic_reloc_count_list.  Change all callers.
9009         (Output_segment::set_section_addresses): Rewrite.
9010         (Output_segment::set_offset): Rewrite.
9011         (Output_segment::find_first_and_last_list): Remove.
9012         (Output_segment::set_tls_offsets): Rewrite.
9013         (Output_segment::first_section_load_address): Likewise.
9014         (Output_segment::output_section_count): Likewise.
9015         (Output_segment::section_with_lowest_load_address): Likewise.
9016         (Output_segment::write_section_headers): Likewise.
9017         (Output_segment::print_sections_to_map): Likewise.
9018         * output.h (class Output_data): Remove dynamic_reloc_count_
9019         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
9020         (Output_data::add_dynamic_reloc): Rewrite.
9021         (Output_data::has_dynamic_reloc): New function.
9022         (Output_data::dynamic_reloc_count): Remove.
9023         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
9024         is_last_relro_, is_first_non_relro_, is_interp_,
9025         is_dynamic_linker_section_ fields.  Add order and set_order
9026         functions.  Remove is_relro_local, set_is_relro_local,
9027         is_last_relro, set_is_last_relro, is_first_non_relro,
9028         set_is_first_non_relro functions, is_interp, set_is_interp,
9029         is_dynamic_linker_section, and set_is_dynamic_linker_section
9030         functions.
9031         (class Output_segment): Change Output_data_list from std::list to
9032         std:;vector.  Add output_lists_ field.  Remove output_data_ and
9033         output_bss_ fields.  Update declarations.
9034
9035 2010-08-02  Ian Lance Taylor  <iant@google.com>
9036
9037         * arm.cc (Target_arm::gc_process_relocs): Use typename.
9038         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
9039         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
9040
9041 2010-08-02  Ian Lance Taylor  <iant@google.com>
9042
9043         PR 11855
9044         * script.cc (Script_options::Script_options): Initialize
9045         symbol_definitions_ and symbol_references_.
9046         (Script_options::add_symbol_assignment): Update
9047         symbol_definitions_ and symbol_references_.
9048         (Script_options::add_symbol_reference): New function.
9049         (script_symbol): New function.
9050         * script.h (class Script_options): Add symbol_definitions_ and
9051         symbol_references_ fields.
9052         (Script_options::referenced_const_iterator): New type.
9053         (Script_options::referenced_begin): New function.
9054         (Script_options::referenced_end): New function.
9055         (Script_options::is_referenced): New function.
9056         (Script_options::any_unreferenced): New function.
9057         * script-c.h (script_symbol): Declare.
9058         * yyscript.y (exp): Call script_symbol.
9059         * symtab.cc: Include "script.h".
9060         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
9061         Change all callers.  Check symbols referenced by scripts.
9062         (Symbol_table::add_undefined_symbols_from_command_line): Add
9063         layout parameter.  Change all callers.
9064         (Symbol_table::do_add_undefined_symbols_from_command_line):
9065         Likewise.  Break out loop body.  Check symbols referenced by
9066         scripts.
9067         (Symbol_table::add_undefined_symbol_from_command_line): New
9068         function broken out of
9069         do_add_undefined_symbols_from_command_line.
9070         * symtab.h (class Symbol_table): Update declarations.
9071         * archive.cc: Include "layout.h".
9072         (Archive::should_include_member): Add layout parameter.  Change
9073         all callers.  Check for symbol mentioned in expression.
9074         * archive.h (class Archive): Update declaration.
9075         * object.cc (Sized_relobj::do_should_include_member): Add layout
9076         parameter.
9077         * object.h (Object::should_include_member): Add layout parameter.
9078         Change all callers.
9079         (Object::do_should_include_member): Add layout parameter.
9080         (class Sized_relobj): Update declaration.
9081         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
9082         parameter.
9083         * dynobj.h (class Sized_dynobj): Update declaration.
9084         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
9085         layout parameter.
9086         * plugin.h (class Sized_pluginobj): Update declaration.
9087
9088 2010-08-02  Ian Lance Taylor  <iant@google.com>
9089
9090         PR 11866
9091         * output.cc (Output_segment::set_offset): Search for the first and
9092         last sections rather than assuming that the list is in order.
9093         (Output_segment::find_first_and_last_list): New function.
9094         * output.h (class Output_segment): Update declarations.
9095         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
9096         (relro_strip_test_SOURCES): New variable.
9097         (relro_strip_test_DEPENDENCIES): New variable.
9098         (relro_strip_test_LDFLAGS): New variable.
9099         (relro_strip_test_LDADD): New variable.
9100         (relro_strip_test.so): New target.
9101
9102 2010-08-02  Ian Lance Taylor  <iant@google.com>
9103
9104         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
9105         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
9106         (Target_i386::got_tlsdesc_section): New function.
9107         (Target_i386::got_section): Create space for GOT entries for
9108         TLSDESC relocations.
9109         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
9110         R_386_TLS_GOTDESC.
9111         (Target_i386::Scan::global): Likewise.
9112         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
9113         using TLSDESC GOT.
9114         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
9115         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
9116         (Target_x86_64::got_tlsdesc_section): New function.
9117         (Target_x86_64::got_section): Create space for GOT entries for
9118         TLSDESC relocations.
9119         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
9120         R_386_TLS_GOTDESC.
9121         (Target_x86_64::Scan::global): Likewise.
9122         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
9123         using TLSDESC GOT.
9124
9125 2010-08-02  Ian Lance Taylor  <iant@google.com>
9126
9127         * testsuite/final_layout.sh: Use dc to convert from hex to
9128         decimal.
9129
9130 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
9131
9132         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
9133         paramter to the call to gold::gc_process_relocs.
9134         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
9135         paramter to the call to gold::gc_process_relocs.
9136         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
9137         parameter to the call to gold::gc_process_relocs.
9138         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
9139         template parameter to the call to gold::gc_process_relocs.
9140         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
9141         paramter to the call to gold::gc_process_relocs.
9142         * gc.h (get_embedded_addend_size): New function.
9143         (gc_process_relocs): Save the size of the reloc for use by ICF.
9144         * icf.cc (get_section_contents): Get the addend from the text section
9145         for SHT_REL relocation sections.
9146         * icf.h (Icf::Reloc_addend_size_info): New typedef.
9147         (Icf::Reloc_info): Add new member reloc_addend_size_info.
9148         * int_encoding.h (read_from_pointer): New overloaded function.
9149         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
9150         * testsuite/icf_sht_rel_addend_test.sh: New file.
9151         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
9152         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
9153
9154 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9155
9156         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
9157         * Makefile.in: Regenerate.
9158         * testsuite/Makefile.in: Regenerate.
9159
9160 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
9161
9162         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
9163         * gold/testsuite/debug_msg.cc: Likewise.
9164         * gold/testsuite/odr_violation1.cc
9165         * gold/testsuite/odr_violation2.cc
9166
9167 2010-07-21  Cary Coutant  <ccoutant@google.com>
9168
9169         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
9170         string, and length fields.
9171         (Output_merge_string::Merged_strings_list): New type.
9172         (Output_merge_string::Merged_strings_lists): New typedef.
9173         (Output_merge_string): Replace merged_strings_ with
9174         merged_strings_lists_.
9175         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
9176         Merged_strings_list per input object and section.  Don't store pointer
9177         to the string.  Don't store length with each merged string entry.
9178         (Output_merge_string::finalize_merged_data): Loop over list of merged
9179         strings lists.  Recompute length of each merged string.
9180
9181 2010-07-15  Cary Coutant  <ccoutant@google.com>
9182
9183         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
9184         here.
9185
9186 2010-07-14  Ian Lance Taylor  <iant@google.com>
9187
9188         * descriptors.cc (Descriptors::open): Report correct name in error
9189         message.
9190
9191 2010-07-13  Doug Kwan  <dougkwan@google.com>
9192
9193         * arm.cc (Arm_input_section::Arm_input_section): For a
9194         SHT_ARM_EXIDX section, always keeps the input sections.
9195         (Arm_input_section::set_exidx_section_link): New method.
9196         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
9197         has_errors_ to false.
9198         (Arm_exidx_input_section::has_errors,
9199         Arm_exidx_input_section::set_has_errors): New methods.
9200         (Arm_exidx_input_section::has_errors_): New data member.
9201         (Arm_relobj::get_exidx_shndx_list): New method.
9202         (Arm_output_section::append_text_sections_to_list): Do not skip
9203         section without SHF_EXECINSTR.
9204         (Arm_output_section::fix_exidx_coverage): Skip input sections with
9205         errors.
9206         (Arm_relobj::make_exidx_input_section): Add new parameter for text
9207         section header.  Make error messages more verbose.  Check for
9208         a non-executable section linked to an EXIDX section.
9209         (Arm_relobj::do_read_symbols): Remove error checking, which has been
9210         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
9211         check that there is no deferred EXIDX section if we exit early.
9212         Instead of not making an EXIDX section in case of an error, make one
9213         and set the has_errors flag of it.
9214         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
9215         in a relocatable link.
9216         (Target_arm::do_relax): Look for the EXIDX output section instead of
9217         assuming that it is called .ARM.exidx.
9218         (Target_arm::fix_exidx_coverage): Add a new parameter for input
9219         section list.  Do not check for SHF_EXECINSTR section flags but
9220         skip any input section with errors.
9221         * output.cc (Output_section::Output_section): Initialize
9222         always_keeps_input_sections_ to false.
9223         (Output_section::add_input_section): Check for
9224         always_keeps_input_sections_.
9225         *  output.h (Output_section::always_keeps_input_sections,
9226         Output_section::set_always_keeps_input_sections): New methods.
9227         (Output_section::always_keeps_input_sections): New data member.
9228
9229 2010-07-13  Rafael Espindola  <espindola@google.com>
9230
9231         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
9232         * fileread.h (Input_file): Add try_extra_search_path and find_file.
9233
9234 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
9235             Ian Lance Taylor  <iant@google.com>
9236
9237         * output.h (Output_section_lookup_maps::add_merge_section):
9238         Correct check of whether value was inserted.
9239         (Output_section_lookup_maps::add_merge_input_section): Likewise.
9240         (Output_section_lookup_maps::add_relaxed_input_section):
9241         Likewise.
9242         * arm.cc (Target_arm::got_section): Remove used local os.
9243         * i386.cc (Target_i386::got_section): Likewise.
9244         * x86_64.cc (Target_x86_64::got_section): Likewise.
9245         * sparc.cc (Target_sparc::got_section): Likewise.
9246         (Target_sparc::relocate): Remove unused local have_got_offset.
9247         * powerpc.cc (Target_powerpc::relocate): Likewise.
9248
9249 2010-07-13  Ian Lance Taylor  <iant@google.com>
9250
9251         * compressed_output.cc (zlib_decompress): Fix signature in
9252         !HAVE_ZLIB_H case.
9253
9254         * archive.cc (Archive::include_member): Unlock an external member
9255         of a thin archive.  Don't bother to delete an object we know is
9256         NULL.
9257
9258 2010-07-12  Cary Coutant  <ccoutant@google.com>
9259
9260         * compressed_output.cc (zlib_decompress): New function.
9261         (get_uncompressed_size): New function.
9262         (decompress_input_section): New function.
9263         * compressed_output.h (get_uncompressed_size): New function.
9264         (decompress_input_section): New function.
9265         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
9266         Handle compressed debug sections.
9267         * layout.cc (is_compressed_debug_section): New function.
9268         (Layout::output_section_name): Map compressed section names to
9269         canonical names.
9270         * layout.h (is_compressed_debug_section): New function.
9271         (is_debug_info_section): Recognize compressed debug sections.
9272         * merge.cc: Include compressed_output.h.
9273         (Output_merge_data::do_add_input_section): Handle compressed
9274         debug sections.
9275         (Output_merge_string::do_add_input_section): Handle compressed
9276         debug sections.
9277         * object.cc: Include compressed_output.h.
9278         (Sized_relobj::Sized_relobj): Initialize new data members.
9279         (build_compressed_section_map): New function.
9280         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
9281         * object.h (Object::section_is_compressed): New method.
9282         (Object::do_section_is_compressed): New method.
9283         (Sized_relobj::Compressed_section_map): New type.
9284         (Sized_relobj::do_section_is_compressed): New method.
9285         (Sized_relobj::compressed_sections_): New data member.
9286         * output.cc (Output_section::add_input_section): Handle compressed
9287         debug sections.
9288         * reloc.cc: Include compressed_output.h.
9289         (Sized_relobj::write_sections): Handle compressed debug sections.
9290
9291 2010-07-08  Cary Coutant  <ccoutant@google.com>
9292
9293         * resolve.cc (Symbol_table::resolve): Remember whether undef was
9294         weak when resolving to a dynamic def.
9295         (Symbol_table::should_override): Add adjust_dyndef flag; set it
9296         for weak undef/dynamic def cases. Adjust callers.
9297         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
9298         undef_binding_weak_.
9299         (Symbol_table::sized_write_globals): Adjust symbol binding.
9300         (Symbol_table::sized_write_symbol): Add binding parameter.
9301         * symtab.h (Symbol::set_undef_binding): New method.
9302         (Symbol::is_undef_binding_weak): New method.
9303         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
9304         (Symbol_table::should_override): Add new parameter.
9305         (Symbol_table::sized_write_symbol): Add new parameter.
9306
9307         * testsuite/weak_undef_file1.cc: Add new test case.
9308         * testsuite/weak_undef_file2.cc: Fix header comment.
9309         * testsuite/weak_undef_test.cc: Add new test case.
9310
9311 2010-06-29  Doug Kwan  <dougkwan@google.com>
9312
9313         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
9314         Initialize USE_SYMBOL_.
9315         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
9316         definition.
9317         (Arm_reloc_property::uses_symbol_): New data member declaration.
9318         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
9319         uses symbol value and symbol is undefined but not weakly undefined.
9320
9321 2010-06-28  Rafael Espindola  <espindola@google.com>
9322
9323         * plugin.cc (Plugin::load): Use dlerror.
9324
9325 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
9326
9327         * symtab.cc (detect_odr_violations): When reporting an ODR
9328         violation, report an object where the symbol is defined.
9329
9330 2010-06-25  Doug Kwan  <dougkwan@google.com>
9331
9332         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
9333         (Target_arm::section_may_have_icf_unsafe_pointers): New method
9334         definition.
9335         (Target_arm::Scan::local_reloc_may_be_function_pointer,
9336         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
9337         target hook to detect function points.
9338         (Target_arm::Scan::possible_function_pointer_reloc): New method.
9339         * icf.h (Icf::check_section_for_function_pointers): Change type of
9340         parameter SECTION_NAME to const reference to std::string.  Use
9341         target hook to determine if section may have unsafe pointers.
9342         * target.h (Target::section_may_have_icf_unsafe_pointers): New
9343         method definition.
9344
9345 2010-06-21  Rafael Espindola  <espindola@google.com>
9346
9347         * fileread.cc (Input_file::find_fie): New
9348         (Input_file::open): Use Input_file::find_fie.
9349         * fileread.h (Input_file::find_fie): New
9350         * plugin.cc (set_extra_library_path): New.
9351         (Plugin::load): Add set_extra_library_path to the transfer vector.
9352         (Plugin_manager::set_extra_library_path): New.
9353         (Plugin_manager::add_input_file): Use the extra search path if set.
9354         (set_extra_library_path(): New.
9355         * plugin.h (Plugin_manager): Add set_extra_library_path and
9356         extra_search_path_.
9357
9358 2010-06-19  Cary Coutant  <ccoutant@google.com>
9359
9360         * layout.cc (gdb_sections): Add .debug_types.
9361         (lines_only_debug_sections): Likewise.
9362
9363 2010-06-18  Rafael Espindola  <espindola@google.com>
9364
9365         * plugin.cc (add_input_file,add_input_library)
9366         (Plugin_manager::add_input_file): Make filename arguments const.
9367         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
9368         const.
9369
9370 2010-06-16  Doug Kwan  <dougkwan@google.com>
9371
9372         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
9373         .ARM.attributes section if we have not merged any input
9374         attributes sections.
9375
9376 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9377
9378         * arm.cc: Allow combining objects with no EABI version
9379         information.
9380
9381 2010-06-15  Rafael Espindola  <espindola@google.com>
9382
9383         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
9384
9385 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9386
9387         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
9388         (struct iovec): Correct !HAVE_READV definition.
9389
9390 2010-06-10  Cary Coutant  <ccoutant@google.com>
9391
9392         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
9393         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
9394         reloc sections.
9395         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
9396
9397         PR 11683
9398         * symtab.h (Symbol::is_placeholder): New member function.
9399         * target-reloc.h (relocate_section): Check for placeholder symbols.
9400
9401         * testsuite/Makefile.am (plugin_test_8): New test.
9402         (plugin_test_9): New test.
9403         * testsuite/Makefile.in: Regenerate.
9404
9405 2010-06-09  Nick Clifton  <nickc@redhat.com>
9406
9407         * yyscript.y (input_list_element): Allow strings prefixed with
9408         the '-' character.  Treat these as libraries.
9409         * script.cc (script_add_library): New function.  Adds a library
9410         specified by "-l<name>" found in an input script.
9411         * script-c.h: Add prototype for script_add_library.
9412
9413 2010-06-07  Doug Kwan  <dougkwan@google.com>
9414
9415         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
9416         Restrict stub-group size to be within long conditional branch
9417         range when working around cortex-A8 erratum.
9418
9419 2010-06-07  Damien Diederen  <dd@crosstwine.com>
9420
9421         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
9422         #ifdef typo.
9423
9424 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
9425
9426         PR gold/11658
9427         * output.cc
9428         (Output_section::Input_section_sort_entry::compare_section_ordering):
9429         Change to return non-zero correctly.
9430         (Output_section::Input_section_sort_section_order_index_compare
9431         ::operator()): Change to fix ambiguity in comparisons.
9432
9433 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
9434
9435         * gold.h (is_wildcard_string): New function.
9436         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
9437         (Layout::layout_eh_frame): Ditto.
9438         (Layout::find_section_order_index): New method.
9439         (Layout::read_layout_from_file): New method.
9440         * layout.h (Layout::find_section_order_index): New method.
9441         (Layout::read_layout_from_file): New method.
9442         (Layout::input_section_position_): New private member.
9443         (Layout::input_section_glob_): New private member.
9444         * main.cc (main): Call read_layout_from_file here.
9445         * options.h (--section-ordering-file): New option.
9446         * output.cc (Output_section::input_section_order_specified_): New
9447         member.
9448         (Output_section::Output_section): Initialize new member.
9449         (Output_section::add_input_section): Add new parameter.
9450         Keep input sections when --section-ordering-file is used.
9451         (Output_section::set_final_data_size): Sort input sections when
9452         section ordering file is specified.
9453         (Output_section::Input_section_sort_entry): Add new parameter.
9454         Check sorting type.
9455         (Output_section::Input_section_sort_entry::compare_section_ordering):
9456         New method.
9457         (Output_section::Input_section_sort_compare::operator()): Change to
9458         consider section_order_index.
9459         (Output_section::Input_section_sort_init_fini_compare::operator()):
9460         Change to consider section_order_index.
9461         (Output_section::Input_section_sort_section_order_index_compare
9462         ::operator()): New method.
9463         (Output_section::sort_attached_input_sections): Change to sort
9464         according to section order when specified.
9465         (Output_section::add_input_section<32, true>): Add new parameter.
9466         (Output_section::add_input_section<64, true>): Add new parameter.
9467         (Output_section::add_input_section<32, false>): Add new parameter.
9468         (Output_section::add_input_section<64, false>): Add new parameter.
9469         * output.h (Output_section::add_input_section): Add new parameter.
9470         (Output_section::input_section_order_specified): New
9471         method.
9472         (Output_section::set_input_section_order_specified): New method.
9473         (Input_section::Input_section): Initialize section_order_index_.
9474         (Input_section::section_order_index): New method.
9475         (Input_section::set_section_order_index): New method.
9476         (Input_section::section_order_index_): New member.
9477         (Input_section::Input_section_sort_section_order_index_compare): New
9478         struct.
9479         (Output_section::input_section_order_specified_): New member.
9480         * script-sections.cc (is_wildcard_string): Delete and move modified
9481         method to gold.h.
9482         (Output_section_element_input::Output_section_element_input): Modify
9483         call to is_wildcard_string.
9484         (Output_section_element_input::Input_section_pattern
9485         ::Input_section_pattern): Ditto.
9486         (Output_section_element_input::Output_section_element_input): Ditto.
9487         * testsuite/Makefile.am (final_layout): New test case.
9488         * testsuite/Makefile.in: Regenerate.
9489         * testsuite/final_layout.cc: New file.
9490         * testsuite/final_layout.sh: New file.
9491
9492 2010-06-01  Rafael Espindola  <espindola@google.com>
9493
9494         * plugin.cc (Plugin::load): Pass the output name to the plugin.
9495
9496 2010-06-01  Rafael Espindola  <espindola@google.com>
9497
9498         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
9499         visibility of symbols.
9500
9501 2010-05-27  Doug Kwan  <dougkwan@google.com>
9502
9503         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
9504         from start of output section instead of address for a local symbol
9505         in a merged or relaxed section when doing a relocatable link.
9506
9507 2010-05-26  Rafael Espindola  <espindola@google.com>
9508
9509         PR 11604
9510         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
9511         adding sections the garbage collector removed.
9512         * gold/testsuite/Makefile.am: Add test.
9513         * gold/testsuite/Makefile.in: Regenerate.
9514         * gold/testsuite/plugin_test_7.sh: New.
9515         * gold/testsuite/plugin_test_7_1.c: New.
9516         * gold/testsuite/plugin_test_7_2.c: New.
9517
9518 2010-05-26  Rafael Espindola  <espindola@google.com>
9519
9520         * script-sections.cc (Output_section_definition::set_section_addresses):
9521         Check for --section-start.
9522
9523 2010-05-26  Doug Kwan  <dougkwan@google.com>
9524
9525         * arm.cc (Arm_scan_relocatable_relocs): New class.
9526         (Target_arm::relocate_special_relocatable): New method.
9527         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
9528         (Arm_relocate_functions::thumb_branch_common): Same.
9529         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
9530         instead of Default_scan_relocatable_relocs.
9531         * target-reloc.h (relocate_for_relocatable): Let target handle
9532         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
9533         * target.h (Sized_target::relocate_special_relocatable): New method.
9534
9535 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9536
9537         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
9538
9539 2010-05-23  Doug Kwan  <dougkwan@google.com>
9540
9541         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
9542         instead of a cast.
9543         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
9544         with a direct branch, not a conditional branch, to a stub.
9545         * merge.cc (Output_merge_base::record_input_section): New method
9546         defintion.
9547         (Output_merge_data::do_add_input_section): Record input section if
9548         keeps-input-sections flag is set.
9549         (Output_merge_string::do_add_input_section): Ditto.
9550         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
9551         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
9552         INPUT_SECTIONS_.
9553         (Output_merge_base::keeps_input_sections,
9554         Output_merge_base::set_keeps_input_sections,
9555         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
9556         method definitions.
9557         (Output_merge_base::Input_sections): New type declaration.
9558         (Output_merge_base::input_sections_begin,
9559         Output_merge_base::input_sections_end,
9560         Output_merge_base::do_set_keeps_input_sections): New method definitions.
9561         (Output_merge_base::bool keeps_input_sections_,
9562         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
9563         Output_merge_base::input_sections_): New data members.
9564         (Output_merge_data::do_set_keeps_input_sections): New method
9565         defintion.
9566         (Output_merge_string::do_set_keeps_input_sections): Ditto.
9567         * output.cc (Output_section::Input_section::relobj): Move method
9568         defintion from class declaration to here and handle merge sections.
9569         (Output_section::Input_section::shndx): Ditto.
9570         (Output_section::Output_section): Remove initializations of removed
9571         data members and initialize new data member LOOKUP_MAPS_.
9572         (Output_section::add_input_section): Set keeps-input-sections flag
9573         for a newly created merge output section as appropriate.  Adjust code
9574         to use Output_section_lookup_maps class.
9575         (Output_section::add_relaxed_input_section): Adjst code for lookup
9576         maps code refactoring.
9577         (Output_section::add_merge_input_section): Add a new parameter
9578         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
9579         class.  If adding input section to a newly created merge output
9580         section fails, remove the new merge section.
9581         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
9582         Adjust code for use of the Output_section_lookup_maps class.
9583         (Output_section::find_merge_section): Ditto.
9584         (Output_section::build_lookup_maps): New method defintion.
9585         (Output_section::find_relaxed_input_section): Adjust code to use
9586         Output_section_lookup_maps class.
9587         (Output_section::get_input_sections): Export merge sections.  Adjust
9588         code to use Output_section_lookup_maps class.
9589         (Output_section:::add_script_input_section): Adjust code to use
9590         Output_section_lookup_maps class.  Update lookup maps for merge
9591         sections also.
9592         (Output_section::discard_states): Use Output_section_lookup_maps.
9593         (Output_section::restore_states): Same.
9594         * output.h (Merge_section_properties): Move class defintion out of
9595         Output_section.
9596         (Output_section_lookup_maps): New class.
9597         (Output_section::Input_section::is_merge_section): New method
9598         defintion.
9599         (Output_section::Input_section::relobj): Move defintion out of class
9600         defintion.  Declare method only.
9601         (Output_section::Input_section::shndx): Ditto.
9602         (Output_section::Input_section::output_merge_base): New method defintion.
9603         (Output_section::Input_section::u2_.pomb): New union field.
9604         (Output_section::Merge_section_by_properties_map,
9605         Output_section::Output_section_data_by_input_section_map,
9606         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
9607         Remove types.
9608         (Output_section::add_merge_input_section): Add new parameter
9609         KEEPS_INPUT_SECTIONS.
9610         (Output_section::build_lookup_maps): New method declaration.
9611         (Output_section::merge_section_map_,
9612         Output_section::merge_section_by_properties_map_,
9613         Output_section::relaxed_input_section_map_,
9614         Output_section::is_relaxed_input_section_map_valid_): Remove data
9615         members.
9616         (Output_section::lookup_maps_): New data member.
9617
9618 2010-05-21  Doug Kwan  <dougkwan@google.com>
9619
9620         PR gold/11619
9621         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
9622         avoid a compilation error.
9623
9624 2010-05-19  Rafael Espindola  <espindola@google.com>
9625
9626         * script-sections.cc (Output_section_definition::allocate_to_segment):
9627         Update the phdrs_list even when the output section is NULL.
9628         * testsuite/Makefile.am: Add test.
9629         * testsuite/Makefile.in: Regenerate.
9630         * testsuite/script_test_9.cc: New.
9631         * testsuite/script_test_9.sh: New.
9632         * testsuite/script_test_9.t: New.
9633
9634 2010-05-19  Doug Kwan  <dougkwan@google.com>
9635
9636         * arm.cc (Arm_input_section::original_size): New method.
9637         (Arm_input_section::do_addralign): Add a cast.
9638         (Arm_input_section::do_output_offset): Remove static cast.
9639         (Arm_input_section::original_addralign,
9640          Arm_input_section::original_size_): Change type to uint32_t.
9641         (Arm_input_section::init): Add safe casts for section alignment
9642         and size.
9643         (Arm_input_section::set_final_data_size): Do not set address and
9644         offset of stub table.
9645         (Arm_output_section::fix_exidx_coverage): Change use of of
9646         Output_section::Simple_input_section to that of
9647         Output_section::Input_section.
9648         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
9649         except for the first pass.
9650         * output.cc (Output_section::get_input_sections): Change type of
9651         input_sections to std::list<Input_section>.
9652         (Output_section::add_script_input_section): Rename from
9653         Output_section::add_simple_input_section.  Change type of SIS
9654         parameter from Simple_input_section to Input_section.
9655         * output.h (Output_section::Simple_input_section): Remove class.
9656         (Output_section::Input_section): Change class visibility to public.
9657         (Output_section::Input_section::addralign): Use stored alignments
9658         for special input sections if set.
9659         (Output_section::Input_section::set_addralign): New method.
9660         (Output_section::get_input_sections): Change parameter type from
9661         list of Simple_input_section to list of Input_section.
9662         (Output_section::add_script_input_section): Rename from
9663         Output_section::add_simple_input_section. Change first parameter's
9664         type from Simple_input_section to Input_section and remove the
9665         second and third parameters.
9666         * script-sections.cc (Input_section::Input_section_list): Change
9667         type to list of Output_section::Input_section/
9668         (Input_section_info::Input_section_info): Change parameter type of
9669         INPUT_SECTION to Output_section::Input_section.
9670         (Input_section_info::input_section): Change return type.
9671         (Input_section_info::input_section_): Change type to
9672         Output_section::Input_section.
9673         (Output_section_element_input::set_section_addresses): Adjust code
9674         to use Output_section::Input_section instead of
9675         Output_section::Simple_input_section.  Adjust code for renaming
9676         of Output_section::add_simple_input_section.
9677         (Orphan_output_section::set_section_addresses): Ditto.
9678
9679 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9680
9681         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
9682         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
9683
9684 2010-05-18  Rafael Espindola  <espindola@google.com>
9685
9686         * options.cc (General_options::finalize): Handle -nostdlib.
9687         * options.h (nostdlib): New option.
9688         * script.cc (script_add_search_dir): Handle -nostdlib.
9689
9690 2010-05-12  Doug Kwan  <dougkwan@google.com>
9691
9692         * arm.cc (Target_arm::do_finalize_sections): Create an empty
9693         attributes section only if there no attributes section after merging.
9694         (Target_arm::merge_object_attributes): Move value of
9695         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
9696         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
9697         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
9698         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
9699         and arm_attr_merge_7.stdout.
9700         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
9701         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
9702         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
9703         arm_attr_merge_7b.o): New rules.
9704         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
9705         arm_attr_merge_7
9706         * testsuite/Makefile.in: Regenerate.
9707         * testsuite/arm_attr_merge.sh: New file.
9708         * testsuite/arm_attr_merge_[67][ab].s: Same.
9709
9710 2010-05-05  Nick Clifton  <nickc@redhat.com>
9711
9712         * po/es.po: Updated Spanish translation.
9713
9714 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
9715
9716         * Makefile.am (install-exec-local): Properly install gold as
9717         default cross linker.
9718         * Makefile.in: Regenerated.
9719
9720 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
9721             Nick Clifton  <nickc@redhat.com>
9722
9723         * configure.ac (install_as_default): Define and set to false
9724         unless --enable-gold or --enable-gold=both/gold has been
9725         specified.
9726         * configure: Regenerate.
9727
9728         * Makefile.am (install-exec-local): Install the executable as
9729         'ld.gold'.  If install_as_default is true then also install it as
9730         'ld'.
9731         * Makefile.in: Regenerated.
9732
9733 2010-04-24  Ian Lance Taylor  <iant@google.com>
9734
9735         * layout.cc (Layout::layout_reloc): In relocatable link don't
9736         combine reloc sections for grouped sections.
9737
9738 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
9739
9740         * gc.h (gc_process_relocs): Pass information on relocs pointing to
9741         sections that are not ordinary to icf.
9742         * icf.cc (get_section_contents): Handle relocation pointing to section
9743         with no object or shndx information.
9744         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
9745         * testsuite/Makefile.in: Regenerate.
9746         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
9747         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
9748
9749 2010-04-22  Ian Lance Taylor  <iant@google.com>
9750
9751         * expression.cc (Expression::Expression_eval_info): Add
9752         result_alignment_pointer field.
9753         (Expression::eval_with_dot): Add result_alignment_pointer
9754         parameter.  Change all callers.
9755         (Expression::eval_maybe_dot): Likewise.
9756         (class Binary_expression): Add alignment_pointer parameter to
9757         left_value and right_value.  Change all callers.
9758         (BINARY_EXPRESSION): Set result alignment.
9759         (class Trinary_expression): Add alignment_pointer parameter to
9760         arg2_value and arg3_value.  Change all callers.
9761         (Trinary_cond::value): Set result alignment.
9762         (Max_expression::value, Min_expression::value): Likewise.
9763         (Align_expression::value): Likewise.
9764         * script-sections.cc (class Sections_element): Add dot_alignment
9765         parameter to set_section_addresses virtual function.  Update
9766         instantiations.
9767         (class Output_section_element): Likewise.
9768         (Script_sections::create_segments): Add dot_alignment parameter.
9769         Change all callers.
9770         (Script_sections::create_segments_from_phdrs_clause): Likewise.
9771         (Script_sections::set_phdrs_clause_addresses): Likewise.
9772         * script-sections.h: Update declarations.
9773         * script.h: Update declarations.
9774         * output.h (Output_segment::set_minimum_p_align): Don't decrease
9775         min_p_align.
9776         * testsuite/script_test_3.t: Set large alignment.
9777         * testsuite/script_test_3.sh: Make sure that at least one LOAD
9778         segment has expected alignment.
9779
9780 2010-04-22  Nick Clifton  <nickc@redhat.com>
9781
9782         * po/gold.pot: Updated by the Translation project.
9783         * po/vi.po: Updated Vietnamese translation.
9784
9785 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
9786
9787         * testsuite/Makefile.am (check_PROGRAMS): Add
9788         icf_virtual_function_folding_test.
9789         * testsuite/Makefile.in: Regenerated.
9790
9791 2010-04-15  Andrew Haley  <aph@redhat.com>
9792
9793         * options.h (merge_exidx_entries): New option.
9794         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
9795         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
9796         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
9797         (Target_arm::merge_exidx_entries): New function.
9798         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
9799         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
9800         to Arm_exidx_fixup constructor.
9801         Add new arg, merge_exidx_entries.
9802         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
9803         Arm_output_section::fix_exidx_coverage.
9804
9805 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
9806
9807         * icf.cc (get_section_contents): Check for preemptible functions.
9808         Ignore addend when appropriate.
9809         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
9810         section folded.
9811         (add_from_relobj): Check for section folded.
9812         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
9813         * symtab.h (should_add_dynsym_entry): Add new parameter.
9814         * target-reloc.h (scan_relocs): Check for section folded.
9815         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
9816         Check reloc types for function pointers in shared objects.
9817         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
9818         case.
9819         (icf_preemptible_functions_test): New test case.
9820         (icf_string_merge_test): New test case.
9821         * testsuite.Makefile.in: Regenerate.
9822         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
9823         bar_glob.  Refactor code.
9824         * testsuite/icf_preemptible_functions_test.cc: New file.
9825         * testsuite/icf_preemptible_functions_test.sh: New file.
9826         * testsuite/icf_string_merge_test.cc: New file.
9827         * testsuite/icf_string_merge_test.sh: New file.
9828         * testsuite/icf_virtual_function_folding_test.cc: New file.
9829         * testsuite/icf_virtual_function_folding_test.sh: New file.
9830
9831 2010-04-14  Doug Kwan  <dougkwan@google.com>
9832
9833         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
9834         for local symbol recounting if we remove a section due to ICF.
9835         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
9836         there are no regular objects in input.
9837
9838 2010-04-13  Doug Kwan  <dougkwan@google.com>
9839
9840         * arm.cc (Arm_input_section::set_final_data_size): Compute
9841         accurate final data size instead of using current data size.
9842
9843 2010-04-09  Doug Kwan  <dougkwan@google.com>
9844
9845         * layout.cc (Layout::choose_output_section): Handle script section
9846         types.
9847         (Layout::make_output_section_for_script): Add section type parameter.
9848         Handle script section types.
9849         * layout.h (Layout::make_output_section_for_script): Add section
9850         type parameter.
9851         * output.cc (Output_section::Output_section): Initialize data member
9852         is_noload_.
9853         (Output_section::do_reset_address_and_file_offset): Do not set address
9854         to 0 if section is a NOLOAD section.
9855         * output.h (Output_section::is_noload): New method.
9856         (Output_section::set_is_noload): Ditto.
9857         (Output_section::is_noload_): New data member.
9858         * script-c.h (Script_section_type): New enum type.
9859         (struct Parser_output_section_header): Add new file section_type.
9860         * script-sections.cc (Sections_element::output_section_name): Add
9861         parameter for returning script section type.
9862         (Output_section_definition::output_section_name): Ditto.
9863         (Output_section_definition::section_type)P; New method.
9864         (Output_section_definiton::script_section_type_name): Ditto.
9865         (Output_section_definition::script_section_type_): New data member.
9866         (Output_section_definition::Output_section_definition): Initialize
9867         data member Output_section_definition::script_section_type_.
9868         (Output_section_definition::create_sections): Pass script section type
9869         to Layout::make_output_section_for_script.
9870         (Output_section_definition::output_section_name): Return script
9871         section type to caller.
9872         (Output_section_definition::set_section_address): Do not advance
9873         dot value and load address if section type is NOLOAD.  Set address
9874         of NOLOAD sections regardless of section flags.
9875         (Output_section_definition::print): Print section type if it is
9876         not SCRIPT_SECTION_TYPE_NONE.
9877         (Output_section_definition::section_type): New method.
9878         (Output_section_definition::script_section_type_name): Ditto.
9879         (Script_sections::output_section_name): Add new parameter
9880         PSECTION_TYPE for returning script section type.  Pass it to
9881         section elements.  Handle discard sections.
9882         (Sort_output_sections::operator()): Handle NOLOAD sections.
9883         * script-sections.h (Script_sections::Section_type): New enum type.
9884         (Script_sections::output_section_name): Add a new parameter for
9885         returning script section type.
9886         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
9887         INFO and NOLOAD.
9888         * yyscript.y (union): Add new field SECTION_TYPE.
9889         (COPY, DSECT, INFO, NOLOAD): New tokens.
9890         (opt_address_and_section_type): Change type to output_section_header.
9891         (section_type): New non-terminal
9892         (section_header): Handle section type.
9893         (opt_address_and_section_type): Return section type value.
9894
9895 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
9896
9897         * testsuite/plugin_common_test_1.c (foo): Add prototype.
9898         * testsuite/plugin_common_test_2.c (foo): Likewise.
9899
9900 2010-04-08  Doug Kwan  <dougkwan@google.com>
9901
9902         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
9903         Output_merge_data.
9904         * output.cc (Output_section::add_merge_input_section): Simplify
9905         code and return status of Output_merge_base::add_input_section.
9906         Update merge section map only if Output_merge_base::add_input_section
9907         returns true.
9908
9909 2010-04-07  Doug Kwan  <dougkwan@google.com>
9910
9911         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
9912         if section is marked as containing instructions but has no mapping
9913         symbols.
9914         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
9915         correct section index.
9916         (Arm_relobj::find_linked_text_section): Ditto.
9917
9918 2010-04-07  Cary Coutant  <ccoutant@google.com>
9919
9920         * archive.cc (include_member): Destroy Read_symbols_data object before
9921         releasing file.
9922         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
9923         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
9924         (Read_symbols_data::~Read_symbols_data) New destructor.
9925         (Section_relocs::Section_relocs) New constructor.
9926         (Section_relocs::~Section_relocs) New destructor.
9927         (Read_relocs_data::Read_relocs_data) New constructor.
9928         (Read_relocs_data::~Read_relocs_data) New destructor.
9929         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
9930         pointers to NULL after deleting.
9931
9932 2010-04-07  Doug Kwan  <dougkwan@google.com>
9933
9934         * arm.cc: Replace "endianity" with "endianness" in comments.
9935         (Arm_exidx_cantunwind): Ditto.
9936         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
9937         (Arm_relobj::merge_flags_and_attributes): New method.
9938         (Arm_relobj::merge_flags_and_attributes_): New data member.
9939         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
9940         (Arm_relobj::scan_sections_for_stubs): Ditto.
9941         (Arm_relobj::do_read_symbols): Check to see if we really want to
9942         merge processor-specific flags and attributes.  Exit early if
9943         an object is empty except for section names and the undefined symbol.
9944         (Target_arm::do_finalize_sections): Move check for ELF format to
9945         Arm_relobj::do_read_symbols.  Merge processor specific flags and
9946         attributes from a regular object only when we have determined that
9947         it is aapropriate.  Do not create an .ARM.attributes section in
9948         output if there is no regular input object.
9949         (Target_arm::merge_processor_specific_flags): Check
9950         --warn-mismatch before printing any error.
9951         (Target_arm::merge_object_attributes): Ditto.
9952         * gold.cc (queue_middle_tasks): Handle the case in which there is
9953         no regular object in input.
9954         * options.cc (General_options::parse_EB): New method.
9955         (General_options::parse_EL): Same.
9956         (General_options::General_options): Initialize endianness_.
9957         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
9958         New options.
9959         (General_options::Endianness): New enum.
9960         (General_options::endianness): New method.
9961         (General_options::endianness_): New data member.
9962         * parameters.cc (Parameters::set_options): Check target endianness.
9963         (Parameters::set_target_once): Ditto.
9964         (Parameters::check_target_endianness): New method.
9965         (parameters_force_valid_target): If either -EL or -EB is specified,
9966         use it to define endianness of default target.
9967         * parameters.h (Parameters::check_target_endianness): New method
9968         declaration.
9969         * target.h (class Target): Change "endianity" to "endianness"
9970         in comments.
9971
9972 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9973
9974         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
9975         * configure: Regenerate.
9976         * Makefile.in: Regenerate.
9977         * testsuite/Makefile.in: Regenerate.
9978
9979 2010-04-06  Cary Coutant  <ccoutant@google.com>
9980
9981         gcc PR lto/42757
9982         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
9983         prevailing definitions of common symbols.
9984         * testsuite/plugin_test_6.sh: New test case.
9985         * testsuite/plugin_common_test_1.c: New test case.
9986         * testsuite/plugin_common_test_2.c: New test case.
9987         * testsuite/Makefile.am (plugin_test_6): New test case.
9988         * testsuite/Makefile.in: Regenerate.
9989
9990 2010-04-06  Nick Clifton  <nickc@redhat.com>
9991
9992         * po/vi.po: New Vietnamese translation.
9993
9994 2010-03-30  Doug Kwan  <dougkwan@google.com>
9995
9996         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
9997
9998 2010-03-25  Doug Kwan  <dougkwan@google.com>
9999
10000         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
10001         to avoid a conversion warning on a 32-bit host.
10002
10003 2010-03-24  Ian Lance Taylor  <iant@google.com>
10004
10005         * testsuite/script_test_3.t: Add a TLS segment.
10006         * testsuite/Makefile.am (check_PROGRAMS): Add
10007         tls_phdrs_script_test.
10008         (tls_phdrs_script_test_SOURCES): Define.
10009         (tls_phdrs_script_test_DEPENDENCIES): Define.
10010         (tls_phdrs_script_test_LDFLAGS): Define.
10011         (tls_phdrs_script_test_LDADD): Define.
10012         * testsuite/Makefile.in: Rebuild.
10013
10014 2010-03-23  Cary Coutant  <ccoutant@google.com>
10015
10016         * fileread.cc (find_or_make_view): Fix comment.
10017
10018 2010-03-23  Ian Lance Taylor  <iant@google.com>
10019
10020         * script-sections.cc (class Orphan_section_placement): Define
10021         PLACE_TLS and PLACE_TLS_BSS.
10022         (Orphan_section_placement::Orphan_section_placement): Initialize
10023         new places.
10024         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
10025         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
10026         (tls_script_test_SOURCES): Define.
10027         (tls_script_test_DEPENDENCIES): Define.
10028         (tls_script_test_LDFLAGS): Define.
10029         (tls_script_test_LDADD): Define.
10030         * testsuite/Makefile.in: Rebuild.
10031
10032 2010-03-22  Doug Kwan  <dougkwan@google.com>
10033
10034         * arm.cc (Arm_relocate_functions::abs8,
10035         Arm_relocate_functions::abs16): Use correct check for overflow
10036         specified in the ARM ELF specs.
10037         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
10038         target of a BLX instruction specially.
10039         (Reloc_stub::stub_type_for_reloc): Ditto.
10040         (Relocate::relocate): Use symbolic names instead of numeric relocation
10041         codes to report error.
10042         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
10043         workaround.
10044         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
10045         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
10046         thumb2_blx_out_of_range.stdout
10047         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
10048         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
10049         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
10050         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
10051         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
10052         thumb2_blx_in_range, thumb2_blx_in_range.o,
10053         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
10054         thumb2_blx_out_of_range.o): New rules.
10055         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
10056         thumb2_blx_in_range and thumb2_blx_out_of_range.
10057         * testsuite/Makefile.in: Regenerate.
10058         * arm_branch_in_range.sh: Add tests for THUMB BLX.
10059         * testsuite/thumb_blx_in_range.s: New file.
10060         * testsuite/thumb_blx_out_of_range.s: New file.
10061
10062 2010-03-22  Rafael Espindola  <espindola@google.com>
10063
10064         * archive.cc (Should_include): Move to archive.h.
10065         (should_include_member): Make it a member of Archive.
10066         (Lib_group): New.
10067         (Add_lib_group_symbols): New.
10068         * archive.h: Include options.h.
10069         (Archive_member): Moved from Archive.
10070         (Should_include): Moved from archive.cc.
10071         (Lib_group): New.
10072         (Add_lib_group_symbols): New.
10073         * dynobj.cc (do_should_include_member): New.
10074         * dynobj.h (do_should_include_member): New.
10075         * gold.cc (queue_initial_tasks): Update call to queue.
10076         * main.cc (main): Print lib group stats.
10077         * object.cc (do_should_include_member): New.
10078         * object.h: Include archive.h.
10079         (Object::should_include_member): New.
10080         (Object::do_should_include_member): New.
10081         (Sized_relobj::do_should_include_member): New.
10082         * options.cc (General_options::parse_start_lib): New.
10083         (General_options::parse_end_lib): New.
10084         (Input_arguments::add_file): Handle lib groups.
10085         (Input_arguments::start_group): Check we are not in a lib.
10086         (Input_arguments::start_lib): New.
10087         (Input_arguments::end_lib): New.
10088         * options.h (General_options): Add start_lib and end_lib.
10089         (Input_argument::lib_): New.
10090         (Input_argument::lib): New.
10091         (Input_argument::is_lib): New.
10092         (Input_file_lib): New.
10093         (Input_arguments::in_lib_): New.
10094         (Input_arguments::in_lib): New.
10095         (Input_arguments::start_lib): New.
10096         (Input_arguments::end_lib_): New.
10097         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
10098         in unused members as preempted.
10099         (Sized_pluginobj::do_should_include_member): New.
10100         * plugin.h (Sized_pluginobj::do_should_include_member): New.
10101         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
10102         return the blocker.
10103         (Read_symbols::do_whole_lib_group): New.
10104         (Read_symbols::do_lib_group): New.
10105         (Read_symbols::do_read_symbols): Handle lib groups.
10106         (Read_symbols::get_name): Handle lib groups.
10107         * readsyms.h (Read_symbols): Add an archive member pointer.
10108         (Read_symbols::do_whole_lib_group): New.
10109         (Read_symbols::do_lib_group): New.
10110         (Read_symbols::member_): New.
10111         * script.cc (read_input_script): Update call to queue_soon.
10112
10113 2010-03-19  Doug Kwan  <dougkwan@google.com>
10114
10115         * arm.cc (Stub_table::Stub_table): Initialize new data members
10116         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10117         (Stub_table::add_reloc_stub): Assign stub offset and update
10118         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10119         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
10120         New data members.
10121         (Stub_table::update_data_size_and_addralign): Use
10122         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
10123         instead of going over all reloc stubs.
10124         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
10125         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10126         Stringpool_template::offset_ to size of Stringpool_char.
10127         (Stringpool_template::new_key_offset): Remove code to initialize
10128         Stringpool_template::offset_.
10129         * stringpool.h (Stringpool_template::set_no_zero_null): Set
10130         Stringpool_template::offset_ to zero.
10131
10132 2010-03-15  Doug Kwan  <dougkwan@google.com>
10133
10134         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10135         offset_.
10136         (Stringpool_template::new_key_offset): New method.
10137         (Stringpool_template::add_string): Assign offsets when adding new
10138         strings.
10139         (Stringpool_template::set_string_offsets): Do not set string offsets
10140         when not optimizing.
10141         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
10142         member size_.
10143         (Chunked_vector::clear): Clear size_.
10144         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
10145         (Chunked_vector::size): Return size_.
10146         (Chunked_vector::push_back): Use size_ to find insert position.
10147         (Chunked_vector::size_): New data member.
10148         (Stringpool_template::set_no_zero_null): Assert string set is empty.
10149         (Stringpool_template::new_key_offset): New method declaration.
10150         (Stringpool_template::offset_): New data member.
10151
10152 2010-03-15   Rafael Espindola  <espindola@google.com>
10153
10154         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
10155         Add_symbols' constructor.
10156         * readsyms.h (Add_symbols): Remove the input_group member.
10157
10158 2010-03-10  Ian Lance Taylor  <iant@google.com>
10159
10160         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
10161         target to ask whether a reference to a symbol requires a stack
10162         split.
10163         * target.h (Target::is_call_to_non_split): New function.
10164         (Target::do_is_call_to_non_split): Declare virtual function.
10165         * target.cc: Include "symtab.h".
10166         (Target::do_is_call_to_non_split): New function.
10167         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
10168
10169 2010-03-10  Cary Coutant  <ccoutant@google.com>
10170
10171         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
10172         (File_read::open[1]): Remove initial mapping of whole_file_view_.
10173         (File_read::open[2]): Add whole_file_view_ to list of views.
10174         (File_read::make_view): Remove test of whole_file_view_.
10175         (File_read::find_or_make_view): Create whole_file_view_ if
10176         necessary.
10177         (File_read::clear_views): Replace bool parameter with enum;
10178         adjust all callers.  Don't delete views with permanent data;
10179         do delete cached views and views from archives if
10180         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
10181         if clearing the corresponding view.
10182         * fileread.h (File_read::Clear_views_mode): New enum.
10183         (File_read::View::is_permanent_view): New method.
10184         (File_read::clear_views): Replace bool parameter
10185         with enum; adjust all callers.
10186         * options.h (General_options): Change keep_files_mapped option;
10187         add map_whole_files.
10188         * readsyms.cc (Add_symbols::run): Delete sd_ object before
10189         releasing the file.
10190         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
10191         the file.
10192
10193 2010-03-10  David S. Miller  <davem@davemloft.net>
10194
10195         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
10196
10197 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
10198
10199         * icf.cc (get_section_contents): Add '@' marker after processing the
10200         merge reloc.
10201
10202 2010-03-08  Doug Kwan  <dougkwan@google.com>
10203
10204         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
10205         due to a conversion warning.
10206         (Arm_relobj::update_output_local_symbol_count): Check for local
10207         symbol with unset output index.
10208
10209 2010-03-05  Ian Lance Taylor  <iant@google.com>
10210
10211         * options.h (class General_options): Add --spare-dynamic-tags.
10212         * output.cc (Output_data_dynamic::set_final_data_size): Implement
10213         --spare-dynamic-tags.
10214
10215 2010-03-05  Ian Lance Taylor  <iant@google.com>
10216
10217         * incremental.cc: Include "libiberty.h".
10218
10219 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
10220
10221         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
10222         function, is_info_ member.
10223         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
10224         (Versions::Versions): Update caller.
10225         (Versions::define_base_version): Likewise.
10226         (Versions::add_def): Likewise.
10227
10228 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
10229
10230         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
10231         (Scan::possible_function_pointer_reloc): New function.
10232         (Scan::local_reloc_may_be_function_pointer): Change to call
10233         possible_function_pointer_reloc.
10234         (Scan::global_reloc_may_be_function_pointer): Ditto.
10235         * icf.h (Icf::check_section_for_function_pointers): Change to reject
10236         relocations in ".data.rel.ro._ZTV" section.
10237         * testsuite/icf_safe_so_test.sh: Change to pass i386.
10238         * testsuite/icf_safe_so_test.cc: Ditto.
10239         * testsuite/icf_safe_test.cc: Ditto.
10240         * testsuite/icf_safe_test.sh: Ditto.
10241
10242 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10243             Ian Lance Taylor  <iant@google.com>
10244
10245         * target-reloc.h (relocate_section): Check the symbol table index
10246         for -1U before setting the local symbol index.
10247         (scan_relocatable_relocs): If copying the relocation, record that
10248         the local symbol is required.
10249         * object.h (Symbol_value::is_output_symtab_index_set): New
10250         function.
10251         (Symbol_value::may_be_discarded_from_output_symtab): New
10252         function.
10253         (Symbol_value::has_output_symtab_entry): New function.
10254         (Symbol_value::needs_output_symtab_entry): Remove.
10255         (Symbol_value::output_symtab_index): Make sure the symbol index is
10256         set.
10257         (Symbol_value::set_output_symtab_index): Make sure the symbol
10258         index is not set.  Make sure the new index is valid.
10259         (Symbol_value::set_must_have_output_symtab_entry): New function.
10260         (Symbol_value::has_output_dynsym_entry): New function.
10261         (Symbol_value::set_output_dynsym_index): Make sure the new index
10262         is valid.
10263         (Sized_relobj::set_must_have_output_symtab_entry): New function.
10264         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
10265         local symbol if permitted.
10266         (Sized_relobj::do_finalize_local_symbols): Call
10267         is_output_symtab_index_set rather than needs_output_symtab_entry.
10268         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
10269         rather than needs_output_symtab_entry.  Call
10270         has_output_dynsym_entry rather than needs_output_dynsym_entry.
10271         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
10272         is_output_symtab_index_set rather than needs_output_symtab_entry.
10273         * testsuite/discard_locals_relocatable_test.c: New file.
10274         * testsuite/discard_locals_test.sh: Test -r.
10275         * testsuite/Makefile.am (check_DATA): Add
10276         discard_locals_relocatable_test1.syms,
10277         discard_local_relocatable_test2.syms.
10278         (MOSTLYCLEANFILES): Likewise.  Also add
10279         discard_locals_relocatable_test1.lout and
10280         discard_locals_relocatable_test2.out.
10281         (discard_locals_relocatable_test1.syms): New target.
10282         (discard_locals_relocatable_test.o): New target.
10283         (discard_locals_relocatable_test1.out): New target.
10284         (discard_locals_relocatable_test2.syms): New target.
10285         (discard_locals_relocatable_test2.out): New target.
10286         (various): Add missing ../ld-new dependencies.
10287         * testsuite/Makefile.in: Rebuild.
10288
10289 2010-03-03  Nick Clifton  <nickc@redhat.com>
10290
10291         * po/fi.po: New Finnish translation.
10292
10293 2010-03-01  Doug Kwan  <dougkwan@google.com>
10294
10295         * layout.cc (Layout::Layout): Force section types of .init_array*,
10296         .preinit_array* and .fini_array* sections.
10297         * output.cc (Output_section::Input_section_sort_entry::has_priority):
10298         Fix check of return value of std::string::find.().
10299         (Output_section::Input_section_sort_compare::operator()): Remove
10300         comment about .init_array.
10301         (Output_section::Input_section_sort_init_fini_compare::operator()):
10302         New method.
10303         (Output_section::sort_attached_input_sections): Handle .init_array
10304         and .fini_array specially.
10305         * output.h (Output_section::Inut_section_sort_compare): Update
10306         comment.
10307         (Output_section::Input_section_sort_init_fini_compare): New struct.
10308
10309 2010-02-26  Doug Kwan  <dougkwan@google.com>
10310
10311         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
10312         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
10313         * testsuite/debug_msg.sh: Avoid matching source line number for
10314         use of global variable undef_int.
10315
10316 2010-02-26  Doug Kwan  <dougkwan@google.com>
10317
10318         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
10319         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
10320         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
10321         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
10322         * options.cc (General_options::General_options): Initialize member
10323         fix_v4bx_.
10324         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
10325         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
10326         and rm_no_fix_v4bx.stdout
10327         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
10328         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
10329         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
10330         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
10331         and arm_no_fix_v4bx.
10332         * Makefile.in: Regenerate.
10333         * testsuite/arm_fix_v4bx.s: New file.
10334         * testsuite/arm_fix_v4bx.sh: Ditto.
10335
10336 2010-02-24  Doug Kwan  <dougkwan@google.com>
10337
10338         * arm.cc (Target_arm::got_section): Make the .got section the first
10339         non RELRO section in the data segment.
10340         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
10341         suffixes of section names.
10342
10343 2010-02-24  Doug Kwan  <dougkwan@google.com>
10344
10345         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
10346         flags and attributes merging if an input file is a binary file.
10347         * fileread.cc (Input_file::open): Record format of original file.
10348         * fileread.h (Input_file::Format): New enum type.
10349         (Input_file::Input_file): Initialize data member format_.
10350         (Input_file::format): New method definition.
10351         (Input_file::format_):: New data member.
10352
10353 2010-02-24  Doug Kwan  <dougkwan@google.com>
10354
10355         * arm.cc (Arm_output_data_got): New class.
10356         (ARM_TCB_SIZE): New constant
10357         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
10358         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
10359         If user uses a script with a SECTIONS clause, issue only a warning
10360         for a misplaced EXIDX input section.  Otherwise, issue an error.
10361         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
10362         garbage collection.
10363         (Target_arm::got_mode_index_entry): Handle static linking.
10364         (Target_arm::Scan::local): Ditto.
10365         (Target_arm::Scan::global): Ditto.
10366         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
10367         all incorrectly implemented relocations.
10368         (Target_arm::fix_exidx_coverage): Pass layout to
10369         Arm_output_section::fix_exidx_coverage.
10370         * layout.cc (Layout::section_name_mapping): Remove trailing dots
10371         from ".ARM.exidx." and ".ARM.extab.".
10372
10373 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10374
10375         * arm.cc (Target_arm::do_finalize_sections): Create attribute
10376         section if it does not already exist.
10377         * attributes.cc (Attributes_section_data::Attributes_section_data):
10378         Don't crash if size is zero.
10379
10380 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10381             Ian Lance Taylor  <iant@google.com>
10382
10383         * gold.cc (queue_middle_tasks): If no input files were opened,
10384         exit.
10385         * workqueue.h (Task_function::Task_function): Assert that there is
10386         a blocker.
10387
10388 2010-02-22  Doug Kwan  <dougkwan@google.com>
10389
10390         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
10391         * icf.cc (get_section_contents): Cast snprintf arguments to long long
10392         types to avoid warnings due to different uint64_t implementations
10393         on different hosts.
10394
10395 2010-02-21  Doug Kwan  <dougkwan@google.com>
10396
10397         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
10398         handling of the maximum backward branch offset.
10399         (Arm_relocate_functions::thumb_branch_common): Ditto.
10400         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
10401         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
10402         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
10403         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
10404         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
10405         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
10406         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
10407         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
10408         thumb_bl_out_of_range thumb_bl_out_of_range.o,
10409         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
10410         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
10411         thumb2_bl_out_of_range.o): New rules.
10412         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
10413         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
10414         thumb2_bl_out_of_range
10415         * testsuite/Makefile.in: Regenerate.
10416         * testsuite/arm_bl_in_range.s: New file.
10417         * testsuite/arm_bl_out_of_range.s: Ditto.
10418         * testsuite/arm_branch_in_range.sh: Ditto.
10419         * testsuite/arm_branch_range.t: Ditto.
10420         * testsuite/thumb2_branch_range.t: Ditto.
10421         * testsuite/thumb_bl_in_range.s: Ditto.
10422         * testsuite/thumb_bl_out_of_range.s: Ditto.
10423         * testsuite/thumb_branch_range.t: Ditto.
10424
10425 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
10426
10427         * gc.h (gc_process_relocs): Change vectors to point to the new list.
10428         Add reloc offset information.
10429         * icf.cc (get_section_contents): Change iterators to point to the new
10430         vectors. Add reloc offset information to the contents.
10431         * icf.h (Icf::Sections_reachable_info): New typedef.
10432         (Icf::Sections_reachable_list): New typedef.
10433         (Icf::Offset_info): New typedef.
10434         (Icf::Reloc_info): New struct typedef.
10435         (Icf::Reloc_info_list): New typedef.
10436         (Icf::symbol_reloc_list): Delete method.
10437         (Icf::addend_reloc_list): Delete method.
10438         (Icf::section_reloc_list): Delete method.
10439         (Icf::reloc_info_list): New method.
10440         (Icf::reloc_info_list_): New member.
10441
10442 2010-02-19  Doug Kwan  <dougkwan@google.com>
10443
10444         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
10445         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
10446         * arm.cc (Arm_relocation_functions): New forward declaration.
10447         (Target_arm::Target_arm): Initialize new data members
10448         got_mod_index_offset_ and tls_base_symbol_defined_.
10449         (Target_arm::Relocate::relocate_tls): New method.
10450         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
10451          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
10452         New methods.
10453         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
10454         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
10455         (Target_arm::got_mod_index_offset_,
10456         Target_arm::tls_base_symbol_defined_): New data members.
10457         (Target_arm::Scan::local, Target::Scan::global,
10458         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
10459         relocations.
10460
10461 2010-02-18  Doug Kwan  <dougkwan@google.com>
10462
10463         * arm.cc (Arm_relobj::find_linked_text_section): New method.
10464         (Arm_relobj::make_exidx_input_section): Pass section index of linked
10465         text section as a parameter becuase some broken tools may not set
10466         the link in section header.
10467         (Target_arm::has_got_section): New method.
10468         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
10469         without any mapping symbol as data only.  Remove warning.
10470         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
10471         link in its section header, try to discover the link by inspecting the
10472         REL31 relocation at the beginning of the section.
10473         (Target_arm::Scan::check_non_pic): Report name of offending relocation
10474         in error message.
10475         (Target_arm::Scan::global): Treat any reference to the symbol
10476         _GLOBAL_OFFSET_TABLE_ as a GOT access.
10477
10478 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
10479
10480         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
10481         (Scan::global_reloc_may_be_function_pointer): New function.
10482         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10483         (Scan::global_reloc_may_be_function_pointer): New function.
10484         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10485         (Scan::global_reloc_may_be_function_pointer): New function.
10486         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
10487         (Scan::global_reloc_may_be_function_pointer): New function.
10488         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
10489         (Scan::global_reloc_may_be_function_pointer): New function.
10490         (Scan::possible_function_pointer_reloc): New function.
10491         (Target_x86_64::can_check_for_function_pointers): New function.
10492         * gc.h (gc_process_relocs): Scan relocation types to determine if
10493         function pointers were taken for targets that support it.
10494         * icf.cc (Icf::find_identical_sections): Include functions for
10495         folding in safe ICF whose pointer is not taken.
10496         * icf.h (Secn_fptr_taken_set): New typedef.
10497         (fptr_section_id_): New member.
10498         (section_has_function_pointers): New function.
10499         (set_section_has_function_pointers): New function.
10500         (check_section_for_function_pointers): New function.
10501         * options.h: Fix comment for safe ICF option.
10502         * target.h (can_check_for_function_pointers): New function.
10503         * testsuite/Makefile.am: Add icf_safe_so_test test case.
10504         Modify icf_safe_test for X86-64.
10505         * testsuite/Makefile.in: Regenerate.
10506         * testsuite/icf_safe_so_test.cc: New file.
10507         * testsuite/icf_safe_so_test.sh: New file.
10508         * testsuite/icf_safe_test.cc (kept_func_3): New function.
10509         (main): Change to take pointer to function kept_func_3.
10510         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
10511         folding is done correctly for X86-64.
10512
10513 2010-02-12  David S. Miller  <davem@davemloft.net>
10514
10515         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
10516         is_symbolless parameter.
10517         (Output_reloc<SHT_REL>::is_symbolless): New.
10518         (Output_reloc<SHT_REL>::is_symbolless_): New.
10519         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
10520         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
10521         (Output_reloc<SHT_RELA>::is_symbolless): New.
10522         (Output_data_reloc::add_global): Handle is_symbolless.
10523         (Output_data_reloc::add_global_relative): Likewise.
10524         (Output_data_reloc::add_local): Likewise.
10525         (Output_data_reloc::add_local_relative): Likewise.
10526         (Output_data_reloc::add_symbolless_global_addend): New.
10527         (Output_data_reloc::add_symbolless_local_addend): New.
10528         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
10529         is_symbolless.
10530         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
10531         instead of ->is_relative_
10532         (Output_reloc::write): Likewise.
10533         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
10534         (Output_reloc::write_rel): Simplify.
10535
10536         * sparc.cc (Target_sparc::Scan::local): Use
10537         ->add_symbolless_local_addend as needed.
10538         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
10539         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
10540         based upon relocation offset.
10541
10542 2010-02-11  Doug Kwan  <dougkwan@google.com>
10543
10544         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
10545         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
10546         beginning of function.
10547         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
10548         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
10549         parameter is_32bit in calls to should_apply_static_reloc.
10550         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
10551         (check_DATA): Add arm_abs_global.stdout.
10552         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
10553         arm_abs_global.stdout): New rules.
10554         (MOSTLLYCLEANFILES): Add arm_abs_global
10555         * Makefile.in: Regenerate.
10556         * testsuite/arm_abs_global.s: New file.
10557         * testsuite/arm_abs_global.sh: Ditto.
10558         * testsuite/arm_abs_lib.s: Ditto.
10559
10560 2010-02-11  Ian Lance Taylor  <iant@google.com>
10561
10562         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
10563         Read_relocs task.
10564         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
10565         Allocate_commons_task first.
10566         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
10567         task, rather than symtab_lock_.
10568         (Gc_process_relocs::~Gc_process_relocs): New function.
10569         (Gc_process_relocs::is_runnable): Check this_blocker_.
10570         (Gc_process_relocs::locks): Use next_blocker_ rather than
10571         blocker_.
10572         (Scan_relocs::~Scan_relocs): New function.
10573         (Scan_relocs::is_runnable): Check this_blocker_ rather than
10574         symtab_lock_.
10575         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
10576         next_blocker_.
10577         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
10578         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
10579         constructor accordingly.
10580         (class Gc_process_relocs): Likewise.
10581         (class Scan_relocs): Likewise.
10582         * common.h (class Allocate_commons_task): Remove symtab_lock_
10583         field, and corresponding constructor parameter.
10584         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
10585         symtab_lock_.
10586         (Allocate_commons_task::locks): Likewise.
10587
10588 2010-02-11  Ian Lance Taylor  <iant@google.com>
10589
10590         * gold-threads.h (class Once): Define.
10591         (class Initialize_lock): Rewrite as child of Once.
10592         * gold-threads.cc (class Once_initialize): Define.
10593         (once_pointer_control): New static variable.
10594         (once_pointer, once_arg): New static variables.
10595         (c_run_once): New static function.
10596         (Once::Once, Once::run_once, Once::internal_run): New functions.
10597         (class Initialize_lock_once): Remove.
10598         (initialize_lock_control): Remove.
10599         (initialize_lock_pointer): Remove.
10600         (initialize_lock_once): Remove.
10601         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
10602         (Initialize_lock::initialize): Rewrite.
10603         (Initialize_lock::do_run_once): New function.
10604         * archive.cc (Archive::interpret_header): Only clear name if it is
10605         not already empty.
10606         * fileread.cc: Include "gold-threads.h"
10607         (file_counts_lock): New static variable.
10608         (file_counts_initialize_lock): Likewise.
10609         (File_read::release): Only increment counts when using --stats.
10610         Use a lock around the increment.
10611         * parameters.cc (class Set_parameters_target_once): Define.
10612         (set_parameters_target_once): New static variable.
10613         (Parameters::Parameters): Move here from parameters.h.
10614         (Parameters::set_target): Rewrite.
10615         (Parameters::set_target_once): New function.
10616         (Parameters::clear_target): Move here and rewrite.
10617         * parameters.h (class Parameters): Update declarations.  Add
10618         set_parameters_target_once_ field.
10619         (Parameters::Parameters): Move to parameters.cc.
10620         (Parameters::clear_target): Likewise.
10621         * readsyms.cc (Read_symbols::do_group): Create a Start_group
10622         task.
10623         (Start_group::~Start_group): New function.
10624         (Start_group::is_runnable): New function.
10625         (Start_group::locks, Start_group::run): New functions.
10626         (Finish_group::run): Change saw_undefined to size_t.
10627         * readsyms.h (class Start_group): Define.
10628         (class Finish_group): Change saw_undefined_ field to size_t.
10629         (Finish_group::Finish_group): Remove saw_undefined and
10630         this_blocker parameters.  Change all callers.
10631         (Finish_group::set_saw_undefined): New function.
10632         (Finish_group::set_blocker): New function.
10633         * symtab.h (class Symbol_table): Change saw_undefined to return
10634         size_t.  Change saw_undefined_ field to size_t.
10635         * target-select.cc (Set_target_once::do_run_once): New function.
10636         (Target_selector::Target_selector): Initialize set_target_once_
10637         field.  Don't initialize lock_ and initialize_lock_ fields.
10638         (Target_selector::instantiate_target): Rewrite.
10639         (Target_selector::set_target): New function.
10640         * target-select.h (class Set_target_once): Define.
10641         (class Target_selector): Update declarations.  Make
10642         Set_target_once a friend.  Remove lock_ and initialize_lock_
10643         fields.  Add set_target_once_ field.
10644
10645 2010-02-10  Ian Lance Taylor  <iant@google.com>
10646
10647         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
10648         queueing any tasks.
10649         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
10650         (queue_middle_tasks): Add all blockers before queueing any tasks.
10651         (queue_final_tasks): Likewise.
10652         * token.h (Task_token::add_blockers): New function.
10653         * object.h (Input_objects::number_of_relobjs): New function.
10654
10655 2010-02-10  Ian Lance Taylor  <iant@google.com>
10656
10657         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
10658         shared, not if not position independent.
10659         * x86_64.cc (Relocate::relocate_tls): Likewise.
10660         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
10661         (tls_pie_pic_test): New target.
10662         * testsuite/Makefile.in: Rebuild.
10663
10664         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
10665         (tls_test_main_pie.o, tls_test_pie.o): New targets.
10666         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
10667         * testsuite/Makefile.in: Rebuild.
10668
10669 2010-02-09  David S. Miller  <davem@davemloft.net>
10670
10671         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
10672         R_SPARC_RELATIVE using ->add_local_relative().
10673         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
10674
10675         * output.h (Output_data_dynamic::add_section_size): New method
10676         that takes two Output_data objects.
10677         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
10678         entry param.  Handle it in initializers.
10679         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
10680         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
10681         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
10682         arg.
10683         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
10684         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
10685         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
10686         for dynrel_includes_plt.
10687         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10688         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10689         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
10690         before .rela.plt
10691         (Target_sparc::do_finalize_sections): Update to pass true for
10692         dynrel_includes_plt.
10693         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
10694         output before .rela.plt
10695         (Target_powerpc::do_finalize_sections): Update to pass true for
10696         dynrel_includes_plt when 32-bit.
10697
10698 2010-02-08  Doug Kwan  <dougkwan@google.com>
10699
10700         * arm.cc (Arm_relobj::simple_input_section_output_address): New
10701         method.
10702         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
10703         Arm_relobj::scan_section_for_cortex_a8_stubs,
10704         Arm_relobj::do_relocation_section): Instead of calling
10705         Output_section::output_address, use faster
10706         Arm_relobj::simple_input_section_output_address.
10707
10708 2010-02-08  David S. Miller  <davem@davemloft.net>
10709
10710         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
10711         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
10712         relocation helper function.
10713
10714         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
10715         just like R_SPARC_GOT{10,13,22}.
10716         (Target_sparc::Scan::local): Likewise.
10717         (Target_sparc::Relocate:relocate): Likewise.
10718
10719 2010-02-06  Ian Lance Taylor  <iant@google.com>
10720
10721         * configure.ac: Rewrite targetobjs duplicate removal code to use
10722         only shell constructs.
10723         * configure: Rebuild.
10724
10725 2010-02-05  Doug Kwan  <dougkwan@google.com>
10726
10727         PR 11247
10728         * arm.cc (Arm_relobj::section_is_scannable): New method.
10729         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
10730         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
10731
10732 2010-02-04  Doug Kwan  <dougkwan@google.com>
10733
10734         PR 11247
10735         * arm-reloc-property.cc (cstdio): Include.
10736         * configure.ac (targetobjs): Remove duplicates.
10737         * configure: Regenerate.
10738         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
10739         big and little endian version for a given address size.
10740
10741 2010-02-03  Doug Kwan  <dougkwan@google.com>
10742
10743         * arm-reloc-property.cc
10744         (Arm_reloc_property_table::reloc_name_in_error_message): New method
10745         definition.
10746         * arm-reloc-property.h
10747         (Arm_reloc_property_table::get_implemented_static_reloc_property):
10748         New method definition.
10749         (Arm_reloc_property_table::reloc_name_in_error_message): New method
10750         declaration.
10751         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
10752         overflow to N.
10753         (GOT_PREL): Change implemented to Y.
10754         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
10755         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
10756         (Arm_relocate_functions::movw_abs_nc): Remove method.
10757         (Arm_relocate_functions::movt_abs): Ditto.
10758         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
10759         (Arm_relocate_functions::thm_movt_abs): Ditto.
10760         (Arm_relocate_functions::movw_rel_nc): Ditto.
10761         (Arm_relocate_functions::movw_rel): Ditto.
10762         (Arm_relocate_functions::movt_rel): Ditto.
10763         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
10764         (Arm_relocate_functions:thm_movw_rel): Ditto.
10765         (Arm_relocate_functions:thm_movt_rel): Ditto.
10766         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
10767         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
10768         New method definitions.
10769         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
10770         (Arm_relocation_functions::arm_grp_ldr): Ditto.
10771         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
10772         (Arm_relocation_functions::arm_grp_ldc): Ditto.
10773         (Target_arm::Relocate::relocate): Check for non-static or
10774         unimplemented relocation code and exit early.  Change calls to
10775         Target_arm::reloc_uses_thumb_bit and
10776         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
10777         instead.  Refactor code to handle similar relocations to increase
10778         code sharing.  Remove check for unsupported relocation code in switch
10779         statement.
10780         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
10781         relocation property table to find out size.  Change error message to
10782         print out the name of a relocation code instead of the numeric value.
10783         (Target_arm::scan_reloc_for_stub): Use relocation property table
10784         instead of calling Target_arm::reloc_uses_thumb_bit().
10785
10786 2010-02-02  Doug Kwan  <dougkwan@google.com>
10787
10788         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
10789         types of relaxed input section.
10790
10791 2010-02-02  Doug Kwan  <dougkwan@google.com>
10792
10793         * Makefile.am (HFILES): Add arm-reloc-property.h.
10794         (DEFFILES): New.
10795         (TARGETSOURCES): Add arm-reloc-property.cc
10796         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
10797         (libgold_a_SOURCES): $(DEFFILES)
10798         * Makefile.in: Regenerate.
10799         * arm-reloc-property.cc: New file.
10800         * arm-reloc-property.h: New file.
10801         * arm-reloc.def: New file.
10802         * arm.cc: Update comments.
10803         (arm-reloc-property.h): New included header.
10804         (arm_reloc_property_table): New global variable.
10805         (Target_arm::do_select_as_default_target): New method definition.
10806         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
10807         arm-reloc-property to targ_extra_obj.
10808         * parameters.cc (set_parameters_target): Call
10809         Target::select_as_default_target().
10810         * target.h (Target::select_as_default_target): New method definition.
10811         (Target::do_select_as_default_target): Same.
10812
10813 2010-02-01  Doug Kwan  <dougkwan@google.com>
10814
10815         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
10816         first_output_text_section_.
10817         (Arm_exidx_fixup::first_output_text_section): New method definition.
10818         (Arm_exidx_fixup::first_output_text_section_): New data member.
10819         (Arm_exidx_fixup::process_exidx_section): Record the first text
10820         output section seen.
10821         (Arm_output_section::fix_exidx_coverage): Set correct linked section
10822         and entsize in output section header.
10823
10824 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10825
10826         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
10827         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
10828         (Arm_relocate_functions::thm_alu11): New Method.
10829         (Arm_relocate_functions::thm_pc8): New Method.
10830         (Arm_relocate_functions::thm_pc12): New Method.
10831         (Target_arm::Scan::local): Handle the relocations.
10832         (Target_arm::Scan::global): Likewise.
10833         (Target_arm::Relocate::relocate): Likewise.
10834         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10835
10836 2010-01-29  Doug Kwan  <dougkwan@google.com>
10837
10838         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
10839         of relocation types as ld.
10840
10841 2010-01-29  Doug Kwan  <dougkwan@google.com>
10842
10843         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
10844         to public.
10845         (Arm_relocate_functions::thumb_branch_common): Ditto.
10846         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
10847         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
10848         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
10849         Arm_relocate_functions::jump24): Remove.
10850         (Target_arm::Relocate::relocate): Adjust code to call
10851         Arm_relocation_functions::arm_branch_common and
10852         Arm_relocation_functions::thumb_branch_common instead of their removed
10853         wrappers.  Merge switch-cases together to reduce source code size.
10854
10855 2010-01-29  Doug Kwan  <dougkwan@google.com>
10856
10857         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
10858         output_local_symbol_count_needs_update_.
10859         (Arm_relobj::output_local_symbol_count_needs_update,
10860          Arm_relobj::set_output_local_symbol_count_needs_update,
10861          Arm_relobj::update_output_local_symbol_count): New methods.
10862         (Arm_relobj::output_local_symbol_count_needs_update_): New data
10863         member.
10864         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
10865         of pointed function as in a R_ARM_PREL31 relocation.
10866         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
10867         for output local symbol count updating.
10868         (Target_arm::do_relax): Update output local symbol counts in objects
10869         if necessary.
10870         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
10871
10872 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10873
10874         * arm.cc: Added support for the ARM relocations:
10875         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
10876         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
10877         (Arm_relocate_functions::movw_rel_nc): Renamed (was
10878         movw_prel_nc).
10879         (Arm_relocate_functions::movw_rel): New method.
10880         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
10881         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
10882         thm_movw_prel_nc).
10883         (Arm_relocate_functions::thm_movw_rel): New method.
10884         (Arm_relocate_functions::thm_movt_rel): Renamed (was
10885         thm_movt_prel).
10886         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
10887         relocations.
10888         (Target_arm::Scan::global): Likewise.
10889         (Target_arm::Relocate::relocate): Likewise.
10890         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10891         Likewise.
10892
10893 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10894
10895         * arm.cc: Added support for ARM group relocations.
10896         (Target_arm::reloc_needs_sym_origin): New method.
10897         (Arm_relocate_functions::calc_grp_kn): New method.
10898         (Arm_relocate_functions::calc_grp_residual): New method.
10899         (Arm_relocate_functions::calc_grp_gn): New method.
10900         (Arm_relocate_functions::arm_grp_alu): New Method.
10901         (Arm_relocate_functions::arm_grp_ldr): New Method.
10902         (Arm_relocate_functions::arm_grp_ldrs): New Method.
10903         (Arm_relocate_functions::arm_grp_ldc): New Method.
10904         (Target_arm::Scan::local): Handle the ARM group relocations.
10905         (Target_arm::Scan::global): Likewise.
10906         (Target_arm::Relocate::relocate): Likewise.
10907         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10908         Likewise.
10909
10910 2010-01-26  Doug Kwan  <dougkwan@google.com>
10911
10912         * arm.cc (set): Include.
10913         (class Arm_exidx_fixup): Change type of last_input_section_ to const
10914         pointer type.
10915         (Arm_output_section::Text_section_list): New type.
10916         (Arm_output_section::append_text_sections_to_list): New method.
10917         (Arm_output_section::fix_exidx_coverage): Ditto.
10918         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
10919         (Arm_relobj::convert_input_section_to_relaxed_section): Use
10920         Relobj::set_section_offset() instead of
10921         Sized_relobj::invalidate_section_offset().
10922         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
10923         parameter for section headers. Ignore relocation sections for
10924         unallocated sections and EXIDX sections.
10925         (Target_arm::fix_exidx_coverage): New method.
10926         (Target_arm::output_section_address_less_than): New type.
10927         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
10928         linked text section instead of the EXIDX section.
10929         (Arm_output_section::create_stub_group): Add an assertion to check
10930         that this is not an EXIDX output section.
10931         (Arm_output_section::append_text_sections_to_list): New method.
10932         (Arm_output_section::fix_exidx_coverage): Ditto.
10933         (Arm_relobj::scan_sections_for_stubs): Adjust call to
10934         Arm_relobj::section_needs_reloc_stub_scanning.
10935         (Target_arm::do_relax): Fix EXIDX output section coverage in the
10936         first pass.
10937         (Target_arm::fix_exidx_coverage): New method.
10938         * object.h (Relobj::set_output_section): New method.
10939         (Sized_relobj::invalidate_section_offset): Remove method.
10940         (Sized_relobj::do_invalidate_section_offset): Remove method.
10941         (Sized_relobj::do_set_section_offset): Handle offset value -1.
10942
10943 2010-01-25  Doug Kwan  <dougkwan@google.com>
10944
10945         * arm.cc (Arm_exidx_merged_section::do_output_offset):
10946         Fix warning due to signed and unsigned comparison on a 32-bit host.
10947
10948 2010-01-22  Doug Kwan  <dougkwan@google.com>
10949
10950         * arm.cc (Target_arm::do_relax): Record an output section for section
10951         offset adjustment it contains any stub table that has changed.
10952         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
10953         offsets in an output section if necessary.
10954         * output.cc (Output_section::Output_section): Initialize
10955         section_offsets_need_adjustments_.
10956         (Output_section::add_input_section_for_script): Renamed to
10957         Output_section::add_simple_input_section.
10958         (Output_section::save_states): Add a comment.
10959         (Output_section::discard_states): New method defintion.
10960         (Output_section::adjust_section_offsets): Same.
10961         * output.h (Output_section::add_input_section_for_script): Renamed to
10962         Output_section::add_simple_input_section.
10963         (Output_section::discard_states): New method declaration.
10964         (Output_section::adjust_section_offsets): Same.
10965         (Output_section::section_offsets_need_adjustment,
10966         Output_section::set_section_offsets_need_adjustment): New method
10967         definitions.
10968         (Output_section::section_offsets_need_adjustment_): New data member.
10969         * script-sections.cc
10970         (Output_section_element_input::set_section_address): Adjust code for
10971         renaming of Output_section::add_input_section_for_script.
10972         (Orphan_output_section::set_section_address): Same.
10973
10974 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10975
10976         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
10977         Fix_v4bx enum values .
10978         * gold/options.h (General_options): New option definitions.
10979         (General_options::fix_v4bx): New method.
10980         (General_options::Fix_v4bx): New enum.
10981         * gold/options.cc (General_options::parse_fix_v4bx): New method.
10982         (General_options::parse_fix_v4bx_interworking): New method.
10983
10984 2010-01-22  Doug Kwan  <dougkwan@google.com>
10985
10986         * arm.cc (Arm_exidx_fixup): New class.
10987
10988 2010-01-21  Doug Kwan  <dougkwan@google.com>
10989
10990         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
10991         classes.
10992         (Arm_exidx_section_offset_map): New type.
10993
10994 2010-01-21  Doug Kwan  <dougkwan@google.com>
10995
10996         * arm.cc (Arm_exidx_input_section): New class.
10997         (Arm_relobj::exidx_input_section_by_link,
10998         Arm_relobj::exidx_input_section_by_shndx,
10999         Arm_relobj::make_exidx_input_section): New methods.
11000         (read_arm_attributes_section): Remove.
11001         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
11002         information about them.
11003         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
11004         to here.
11005
11006 2010-01-20  Doug Kwan  <dougkwan@google.com>
11007
11008         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
11009         Input_section_specifier to Section_id.
11010         (Target_arm::new_arm_input_section: Adjust code for change of key
11011         type.
11012         (Target_arm::find_arm_input_section): Ditto.
11013         * gc.h (object.h): Include for Section_id nand Section_id_hash.
11014         (Section_id): Remove.
11015         (Garbage_collection::Section_id_hash): Remove.
11016         * icf.h (object.h): Include for Section_id nand Section_id_hash.
11017         (Section_id): Remove.
11018         (Icf::Section_id_hash): Remove.
11019         * object.h (Section_id, Const_section_id, Section_id_hash,
11020         Const_section_id_hash): New type definitions.
11021         * output.cc (Output_section::add_relaxed_input_section): Change to
11022         use Const_section_id instead of Input_section_specifier as key type.
11023         (Output_section::add_merge_input_section): Ditto.
11024         (Output_section::build_relaxation_map): Change to use Section_id
11025         instead of Input_section_specifier as key type.
11026         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11027         Ditto.
11028         (Output_section::convert_input_sections_to_relaxed_sections): Change
11029         to use Const_section_id instead of Input_section_specifier as key type.
11030         (Output_section::find_merge_section): Ditto.
11031         (Output_section::find_relaxed_input_section): Ditto.
11032         * output.h (Input_section_specifier): Remove class.
11033         (Output_section::Output_section_data_by_input_section_map): Change
11034         key type to Const_section_id.
11035         (Output_section::Output_relaxed_input_section_by_input_section_map):
11036         Ditto.
11037         (Output_section::Relaxation_map): Change key type to Section_id.
11038
11039 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11040
11041         * gold/arm.cc: Added support for R_ARM_V4BX relocation
11042         (class Arm_v4bx_stub): New class.
11043         (DEF_STUBS): Updated definition to support v4_veneer_bx.
11044         (Stub_factory::make_arm_v4bx_stub): New method.
11045         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
11046         (Stub_table::empty): Handle v4bx stubs.
11047         (Stub_table::add_arm_v4bx_stub): New method.
11048         (Stub_table::find_arm_v4bx_stub): New method.
11049         (Arm_relocate_functions::v4bx): New method.
11050         (Target_arm::fix_v4bx): New method.
11051         (Target_arm::Target_arm): Handle R_ARM_V4BX.
11052         (Stub_table::relocate_stubs): Likewise.
11053         (Stub_table::do_write): Likewise.
11054         (Stub_table::update_data_size_and_addralign): Likewise.
11055         (Stub_table::finalize_stubs):  Likewise.
11056         (Target_arm::Scan::local): Likewise.
11057         (Target_arm::Scan::global): Likewise.
11058         (Target_arm::do_finalize_sections): Likewise.
11059         (Target_arm::Relocate::relocate): Likewise.
11060         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11061         Likewise.
11062         (Target_arm::scan_reloc_for_stub): Likewise.
11063         (Target_arm::scan_reloc_section_for_stubs): Likewise.
11064
11065 2010-01-19  Ian Lance Taylor  <iant@google.com>
11066
11067         * output.cc (Output_section_headers::do_sized_write): Write large
11068         segment count to sh_info field.
11069         (Output_file_header::do_sized_write): For large segment count,
11070         write PN_XNUM to e_phnum field.
11071
11072 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11073
11074         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
11075         (Arm_relocate_functions::thm_jump8): New function.
11076         (Arm_relocate_functions::thm_jump11): New function.
11077         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
11078         R_ARM_THM_JUMP11.
11079         (Target_arm::Scan::global): Likewise.
11080         (Target_arm::Relocate::relocate): Likewise.
11081         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11082         Likewise.
11083
11084 2010-01-14  Doug Kwan  <dougkwan@google.com>
11085
11086         * arm.cc (map, utility): Include headers.
11087         (Target_arm::apply_cortex_a8_workaround): New method.
11088         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
11089         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
11090         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
11091         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
11092         the --[no-]fix-cortex-a8 command line options.
11093         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
11094         (Target_arm::relocate_stub): Use addend in instruction template.
11095         * options.h (DEFINE_bool): Set the user-set flag.
11096         (General_options): Add --[no-]-fix-cortex options.
11097         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
11098         : Update fast look-up map after conversion.
11099
11100 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
11101
11102         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
11103         in the first pass of do_layout.
11104
11105 2010-01-13  Doug Kwan  <dougkwan@google.com>
11106
11107         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11108         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
11109         apparent compiler problem of not folding static constant integral
11110         data members of elfcpp::Elf_sizes<32>.
11111
11112 2010-01-13  Doug Kwan  <dougkwan@google.com>
11113
11114         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11115         Arm_relobj::section_needs_cortex_a8_stub_scanning,
11116         Arm_relobj::scan_section_for_cortex_a8_erratum,
11117         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
11118         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
11119         sections to scan for relocation stubs into a new method
11120         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
11121         relocation and Cortex-A8 stub scanning.
11122         (Target_arm::do_relax): Force stubs to be after stubbed sections
11123         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
11124         the beginning of a new relaxation pass.  Update a comment.
11125         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
11126
11127 2010-01-12  Ian Lance Taylor  <iant@google.com>
11128
11129         * target-reloc.h (visibility_error): New inline function.
11130         (relocate_section): Call visibility_error.
11131         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
11132         (MOSTLYCLEANFILES): Likewise.
11133         (protected_4_pic.o, protected_3.err): New targets.
11134         * testsuite/protected_4.cc: New file.
11135
11136 2010-01-12  Doug Kwan  <dougkwan@google.com>
11137
11138         * arm.cc (Cortex_a8_reloc): New class.
11139         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
11140         and cortex_a8_relocs_info_.
11141         (Target_arm::fix_cortex_a8): New method definition.
11142         (Target_arm::Cortex_a8_relocs_info): New type.
11143         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
11144         New data member declarations.
11145         (Target_arm::scan_reloc_for_stub): Record information about
11146         relocations for THUMB branches that might be exempted from the
11147         Cortex-A8 workaround.
11148         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
11149         at the beginning of a relaxation pass.
11150
11151 2010-01-12  Doug Kwan  <dougkwan@google.com>
11152
11153         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
11154         (Arm_relobj::Mapping_symbol_position,
11155          Arm_reloj::Mapping_symbol_position_less,
11156          Arm_relobj::Mapping_symbols_info): New types.
11157         (Target_arm::is_mapping_symbol_name): New method definition.
11158         (Arm_relobj::do_count_local_symbols): Save information about mapping
11159         symbols.
11160
11161 2010-01-11  Doug Kwan  <dougkwan@google.com>
11162
11163         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
11164         Arm_relocate_functions::thumb32_branch_upper,
11165         Arm_relocate_functions::thumb32_branch_lower,
11166         Arm_relocate_functions::thumb32_cond_branch_offset,
11167         Arm_relocate_functions::thumb32_cond_branch_upper,
11168         Arm_relocate_functions::thumb32_cond_branch_lower,
11169         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
11170         branch offset encoding.
11171         (Arm_relocate_functions::thumb_branch_common): Use new branch
11172         offset encoding methods to avoid code duplication.
11173         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
11174         (Stub_addend_reader::operator()): Use new branch encoding method
11175         to avoid code duplication.
11176
11177 2010-01-11  Doug Kwan  <dougkwan@google.com>
11178
11179         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
11180         (Target_arm::do_finalize_sections): Define special EXIDX section
11181         symbols only if referenced.
11182         * gc.h (Garbage_collection::add_reference): New method.
11183         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
11184         code duplication.
11185
11186 2010-01-11  Ian Lance Taylor  <iant@google.com>
11187
11188         * script.cc (Version_script_info::build_expression_list_lookup):
11189         Change complaing about duplicate wildcard match from error to
11190         warning.
11191
11192         * script.cc (class Lazy_demangler): Recreate--revert part of patch
11193         of 2009-12-30.
11194         (Version_script_info::Version_script_info): Initialize globs_,
11195         default_version_, default_is_global_, and exact_.  Don't
11196         initialize globals_ or locals_.
11197         (Version_script_info::build_lookup_tables): Build local symbols
11198         first.
11199         (Version_script_info::unquote): New function.
11200         (Version_script_info::add_exact_match): New function.
11201         (Version_script_info::build_expression_list_lookup): Remove lookup
11202         parameter.  Add is_global parameter.  Change all callers.  Handle
11203         wildcard pattern specially.  Unquote pattern.  Call
11204         add_exact_match.
11205         (Version_script_info::get_name_to_match): New function.
11206         (Version_script_info::get_symbol_version): New function.
11207         (Version_script_info::get_symbol_version_helper): Remove.
11208         (Version_script_info::check_unmatched_names): Call unquote.
11209         * script.h (class Version_script_info): Change get_symbol_version
11210         to be non-inline and add is_global parameter; change all callers.
11211         Rewrite symbol_is_local.  Update declarations.  Define struct
11212         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
11213         Remove globals_ and locals_ members.  Add exact_, globs_,
11214         default_version_, is_global_.
11215         (Version_script_info::Glob): Remove pattern, add expression and
11216         is_global.  Update constructor.  Change all callers.
11217         * dynobj.cc (Versions::finalize): Mark the version symbol as the
11218         default version.
11219         (Versions::symbol_section_contents): If a symbol is undefined, or
11220         defined in a dynamic object, set the version index to
11221         VER_NDX_LOCAL.
11222         * symtab.cc (Symbol_table::add_from_relobj): Don't call
11223         symbol_is_local.
11224         (Symbol_table::add_from_pluginobj): Likewise.
11225         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
11226
11227 2010-01-11  Doug Kwan  <dougkwan@google.com>
11228
11229         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
11230         (incremental_dump_LDADD): Add linking option for libintl.
11231         * Makefile.in: Regenerate.
11232
11233 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
11234
11235         PR gold/11144
11236         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
11237         instead of -Ds.
11238         * testsuite/Makefile.in: Regenerated.
11239
11240 2010-01-10  Doug Kwan  <dougkwan@google.com>
11241
11242         * options.h (DEFINE_var): Use parentheses around argument varname__
11243         in macro body to avoid any unintended subsequent substitutions.
11244
11245 2010-01-10  Ian Lance Taylor  <iant@google.com>
11246
11247         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
11248         candidates before doing symbol resolution.
11249
11250         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
11251         ODR candidates if only one is weak.
11252
11253 2010-01-08  Ian Lance Taylor  <iant@google.com>
11254
11255         * script.cc (Version_script_info::build_expression_list_lookup):
11256         Don't warn about ambiguous version, just record the ambiguity.
11257         (Version_script_info::get_symbol_version_helper): Give error if
11258         version is ambiguous.
11259
11260 2010-01-08  Doug Kwan  <dougkwan@google.com>
11261
11262         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
11263         prev_data_size_ and prev_addralign_.  Remove initializer for
11264         deleted data member has_been_changed_.
11265         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
11266         to determine if the table is empty.
11267         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
11268         Remove.
11269         (Stub_table::add_reloc_stub): Define method in class definition
11270         instead of just declaring it there.
11271         (Stub_table::add_cortex_a8_stub): New method definition.
11272         (Stub_table::update_data_size_and_addralign): Ditto.
11273         (Stub_table::finalize_stubs): Ditto.
11274         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
11275         (Stub_table::do_addralign_): Return address alignment in the
11276         (Stub_table::do_reset_address_and_file_offset): Define method in
11277         class definition instead of declaring it there.  Set current data
11278         size to be the data size of the previous pass.
11279         (Stub_table::set_final_data_size): Use current data size as the
11280         final data size.
11281         (Stub_table::relocate_stub): Change parameter type of stub from
11282         Reloc_stub pointer to Stub pointer.
11283         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
11284         (Stub_table::Cortex_a8_stub_list): New typedef.
11285         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
11286          Stub_table::prev_addralign_): New data member.
11287         (Arm_relobj::Arm_relobj): Initialize data member
11288         section_has_cortex_a8_workaround_.
11289         (Arm_relobj::section_has_cortex_a8_workaround,
11290          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
11291          definitions.
11292         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
11293         declarations.
11294         (Target_arm::relocate_stub): Change parameter type of stub from
11295         Reloc_stub pointer to Stub pointer.
11296         (Insn_template::size, Insn_template::alignment): Handle
11297         THUMB16_SPECIAL_TYPE.
11298         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
11299          Stub_table::update_data_size_and_addralign,
11300          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
11301         definitions.
11302         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
11303         (Stub_table::do_write): Ditto.
11304         (Target_arm::do_relax): Adjust code for changes in Stub_table.
11305
11306 2010-01-08  Ian Lance Taylor  <iant@google.com>
11307
11308         PR 11108
11309         * symtab.h (class Symbol): Remove fields is_target_special_ and
11310         has_plt_offset_.  Add field is_defined_in_discarded_section_.
11311         (Symbol::is_defined_in_discarded_section): New function.
11312         (Symbol::set_is_defined_in_discarded_section): New function.
11313         (Symbol::has_plt_offset): Rewrite.
11314         (Symbol::set_plt_offset): Verify that new offset is not -1U.
11315         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
11316         Don't initialize is_target_special_ or has_plt_offset_.
11317         Initialize is_defined_in_discarded_section_.
11318         (Symbol_table::add_from_relobj): If appropriate, set
11319         is_defined_in_discarded_section.
11320         * resolve.cc (Symbol::override_base_with_special): Don't test
11321         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
11322         * target-reloc.h (relocate_section): Do special handling for
11323         symbols defined in discarded sections for global symbols as well
11324         as local symbols.
11325
11326 2010-01-08  Ian Lance Taylor  <iant@google.com>
11327
11328         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
11329         the SHT_SYMTAB case.
11330
11331 2010-01-08  Ian Lance Taylor  <iant@google.com>
11332
11333         * object.cc (Sized_relobj::do_layout): Don't get confused if
11334         layout_eh_frame returns NULL.
11335
11336 2010-01-08  Ian Lance Taylor  <iant@google.com>
11337
11338         PR 11084
11339         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
11340         dynamic symbol table, use the normal symbol table.
11341         (Sized_dynobj::do_read_symbols): Remove assertion about type of
11342         symbol table.
11343
11344 2010-01-08  Ian Lance Taylor  <iant@google.com>
11345
11346         PR 11072
11347         * layout.cc (Layout::include_section): Remove .gnu_debuglink
11348         sections.
11349
11350 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
11351
11352         * version.cc (print_version): Change to "Copyright 2010".
11353
11354 2010-01-08  Ian Lance Taylor  <iant@google.com>
11355
11356         PR 10287
11357         PR 11063
11358         * i386.cc (class Target_i386): Change return type of plt_section
11359         to be non-const.
11360         (class Output_data_plt_i386): Add tls_desc_rel_ field.
11361         (Output_data_plt_i386::Output_data_plt_i386): Initialize
11362         tls_desc_rel_ field.
11363         (Output_data_plt_i386::rel_tls_desc): New function.
11364         (Target_i386::rel_tls_desc_section): New function.
11365         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
11366         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
11367         R_386_TLS_DESC reloc in rel_tls_desc_section.
11368         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
11369         Define struct Tlsdesc_info.
11370         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
11371         (Target_x86_64::do_reloc_symbol_index): New function.
11372         (Target_x86_64::add_tlsdesc_info): New function.
11373         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
11374         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
11375         tlsdesc_rel_ field.
11376         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
11377         all callers.
11378         (Output_data_plt_x86_64::rela_tlsdesc): New function.
11379         (Target_x86_64::rela_tlsdesc_section): New function.
11380         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
11381         handling.
11382         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
11383         (Target_x86_64::do_reloc_addend): New function.
11384         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
11385         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
11386         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
11387         (Output_reloc::type): New function.
11388         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
11389         (Output_reloc::is_target_specific): New function.
11390         (Output_reloc::target_arg): New function.
11391         (class Output_reloc) [SHT_RELA]: Add four new constructors for
11392         absolute relocs and target specific relocs.
11393         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
11394         add_target_specific.
11395         (class Output_data_reloc) [SHT_RELA]: Likewise.
11396         * output.cc (Output_reloc::Output_reloc): Add four new versions
11397         for absolute relocs and target specific relocs.
11398         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
11399         (Output_reloc::get_symbol_index): Likewise.
11400         (Output_reloc::local_section_offset): Check that local_sym_index_
11401         is not TARGET_CODE or 0.
11402         (Output_reloc::symbol_value): Likewise.
11403         (Output_reloc::write) [SHT_RELA]: Call target for target specific
11404         reloc.
11405         * target.h (class Target): Add reloc_symbol_index and reloc_addend
11406         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
11407         functions.
11408         * layout.cc (add_target_dynamic_tags): Use output section for
11409         DT_PLTRELSZ and DT_JMPREL.
11410
11411 2010-01-07  Ian Lance Taylor  <iant@google.com>
11412
11413         PR 11061
11414         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
11415         function.
11416         (class Output_data_reloc_generic): Define.
11417         (class Output_data_reloc_base): Change base class to
11418         Output_data_reloc_generic.  Change add() method to call
11419         bump_relative_reloc_count for a relative reloc.  Remove
11420         sort_relocs_ field.
11421         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
11422         to sort_relocs().
11423         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
11424         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
11425         appropriate.
11426         * layout.h (class Layout): Update declaration.
11427
11428 2010-01-07  Ian Lance Taylor  <iant@google.com>
11429
11430         * output.h (class Output_data): Add const version of
11431         output_section and do_output_section.
11432         (class Output_section_data): Add const version of
11433         do_output_section.
11434         (class Output_section): Likewise.
11435         * layout.cc (Layout::add_target_dynamic_tags): New function.
11436         * layout.h (class Layout): Update declarations.
11437         * arm.cc (Target_arm::do_finalize_sections): Use
11438         add_target_dynamic_tags.
11439         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11440         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11441         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11442         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11443
11444 2010-01-07  Ian Lance Taylor  <iant@google.com>
11445
11446         PR 11042
11447         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
11448         object as needed.
11449
11450 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
11451             Ian Lance Taylor  <iant@google.com>
11452
11453         PR 11019
11454         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
11455         Xindex::read_symtab_xindex.
11456
11457 2010-01-07  Doug Kwan  <dougkwan@google.com>
11458
11459         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
11460         (Insn_template::thumb16_bcond_insn): New method declaration.
11461         (Insn_template): Fix spelling.
11462         (Stub::thumb16_special): New method declaration.
11463         (Stub::do_write): Define virtual method which was previously pure
11464         virtual.
11465         (Stub::do_thumb16_special): New method declaration.
11466         (Stub::do_fixed_endian_write): New template member.
11467         (Reloc_stub::do_write): Remove.
11468         (Reloc_stub::do_fixed_endian_write): Remove.
11469         (Cortex_a8_stub): New class definition.
11470         (Stub_factory::make_cortex_a8_stub): New method definition.
11471         (Stub_factory::Stub_factory): Add missing static storage class
11472         qualifier for elf32_arm_stub_a8_veneer_blx.
11473
11474 2010-01-07  Ian Lance Taylor  <iant@google.com>
11475
11476         PR 10980
11477         * options.h (class General_options): Add --warn-unresolved-symbols
11478         and --error-unresolved-symbols.
11479         * errors.cc (Errors::undefined_symbol): Implement
11480         --warn-unresolved-symbols.
11481
11482         * options.h (class General_options): Add -z text and -z textoff.
11483         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
11484
11485 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
11486
11487         * gc.h (Garbage_collection::Cident_section_map): New typedef.
11488         (Garbage_collection::cident_sections): New function.
11489         (Garbage_collection::add_cident_section): New function.
11490         (Garbage_collection::cident_sections_): New member.
11491         (gc_process_relocs): Add references to sections whose names are C
11492         identifiers.
11493         * gold.h (cident_section_start_prefix): New constant.
11494         (cident_section_stop_prefix): New constant.
11495         (is_cident): New function.
11496         * layout.cc (Layout::define_section_symbols): Replace string constants
11497         with the newly defined constants.
11498         * object.cc (Sized_relobj::do_layout): Track sections whose names are
11499         C identifiers.
11500         * testsuite/Makefile.am: Add gc_orphan_section_test.
11501         * testsuite/Makefile.in: Regenerate.
11502         * testsuite/gc_orphan_section_test.cc: New file.
11503         * testsuite/gc_orphan_section_test.sh: New file.
11504
11505 2010-01-06  Ian Lance Taylor  <iant@google.com>
11506
11507         PR 10980
11508         * options.h (class General_options): Add --warn-shared-textrel.
11509         * layout.cc (Layout::finish_dynamic_section): Implement
11510         --warn-shared-textrel.
11511
11512         PR 10980
11513         * options.h (class General_options): Add --warn-multiple-gp.
11514
11515 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11516
11517         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
11518         $(THREADSLIB) and $(LIBDL).
11519         * Makefile.in: Rebuild.
11520
11521 2010-01-06  Ian Lance Taylor  <iant@google.com>
11522
11523         PR 10980
11524         * options.cc (General_options::parse_section_start): New function.
11525         (General_options::section_start): New function.
11526         (General_options::General_options): Initialize all members.
11527         * options.h: Include <map>
11528         (class General_options): Add --section-start.  Add section_starts_
11529         member.
11530         * layout.cc (Layout::attach_allocated_section_to_segment): If
11531         --section-start was used, set the address of the segment.  Remove
11532         local sort_sections.
11533         (Layout::relaxation_loop_body): If the address of the load segment
11534         has been set by --section-start, don't use it.
11535         * output.h (Output_segment::update_flags_for_output_section): New
11536         function.
11537         * output.cc (Output_segment::add_output_section): Call
11538         update_flags_for_output_section.
11539
11540 2010-01-05  Ian Lance Taylor  <iant@google.com>
11541
11542         PR 10980
11543         * options.h (class General_options): Add --undefined-version.
11544         * script.cc (struct Version_expression): Add was_matched_by_symbol
11545         field.
11546         (Version_script_info::matched_symbol): New function.
11547         (Version_script_info::get_symbol_version_helper): Call
11548         matched_symbol.
11549         (Version_script_info::check_unmatched_names): New function.
11550         * script.h (class Version_script_info): Update declarations.
11551         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
11552
11553         * options.h (class General_options): Use DEFINE_bool_alias for
11554         allow_multiple_definition.
11555         * resolve.cc (Symbol_table::should_override): Don't test
11556         allow_multiple_definition.
11557
11558         PR 10980
11559         * options.h (class General_options): Add --cref.
11560         * main.cc (main): Print cref table if --cref.  Don't close mapfile
11561         until after printing cref table.
11562         * cref.cc: Include "symtab.h".
11563         (class Cref_inputs): Define Cref_table_compare and Cref_table.
11564         (Cref_table_compare::operator()): New function.
11565         (Cref_inputs::gather_cref): New function.
11566         (filecol): New static const.
11567         (Cref_inputs::print_cref): New function.
11568         (Cref::print_cref): New function.
11569         * cref.h: Include <cstdio>.
11570         (class Cref): Update declarations.
11571         * mapfile.h (Mapfile::file): New function.
11572         * object.h (class Object): Define Symbols.  Declare virtual
11573         do_get_global_symbols.
11574         (Object::get_global_symbols): New function.
11575         * object.cc (Input_objects::add_object): Pass object to cref_ if
11576         --cref.
11577         (Input_objects::archive_start): Likewise.
11578         (Input_objects::archive_stop): Likewise.
11579         (Input_objects::print_cref): New function.
11580         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
11581         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
11582         --cref.
11583         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
11584         function.
11585         * plugin.h (class Sized_pluginobj): Update declarations.
11586
11587 2010-01-05  Ian Lance Taylor  <iant@google.com>
11588
11589         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
11590         to is_default_version.  Rename insdef to insdefault.
11591         (Symbol_table::add_from_relobj): Rename def to is_default_version
11592         and local to is_forced_local.
11593         (Symbol_table::add_from_pluginobj): Likewise.
11594         (Symbol_table::add_from_dynobj): Likewise.
11595         (Symbol_table::define_special_symbol): Rename insdef to
11596         insdefault.
11597
11598 2010-01-04  Ian Lance Taylor  <iant@google.com>
11599
11600         PR 10980
11601         * options.h (class General_options): Add
11602         --allow-multiple-definition and -z muldefs.
11603         * resolve.cc (Symbol_table::should_override): Don't warn about a
11604         multiple symbol definition if --allow-multiple-definition or -z
11605         muldefs.
11606
11607         PR 10980
11608         * options.h (class General_options): Add --add-needed and
11609         --copy-dt-needed-entries.  Tweak --as-needed help entry.
11610         * object.cc (Input_objects::check_dynamic_dependencies): Give an
11611         error if --copy-dt-needed-entries aka --add-needed is used and
11612         would cause a change in behaviour.
11613
11614         PR 10980
11615         * options.h (class General_options): Add -G as a short version of
11616         --shared.  Add no-op options -assert, -g, and -i.
11617
11618 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
11619
11620         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
11621         check for .text or .gnu.linkonce.t sections.
11622         * icf.cc (Icf::find_identical_sections): Ditto.
11623         Change the detection for mangled function name within the section
11624         name.
11625         * icf.h (is_section_foldable_candidate): New function.
11626
11627 2009-12-30  Ian Lance Taylor  <iant@google.com>
11628
11629         PR 10980
11630         * options.h (class General_options): Permit two dashes with
11631         --retain-symbols-file.
11632
11633 2009-12-30  Ian Lance Taylor  <iant@google.com>
11634
11635         PR 10979
11636         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
11637         don't put the file header and segment headers in the text
11638         segment.
11639
11640         PR 10979
11641         * common.cc (Sort_commons::operator()): Stabilize sort when both
11642         entries are NULL.
11643         (Symbol_table::do_allocate_commons_list): When allocating common
11644         symbols, skip a symbol which is no longer common.
11645         * symtab.h (Symbol::is_common): Test whether the symbol comes from
11646         an object before checking its type.
11647         * testsuite/common_test_2.c: New file.
11648         * testsuite/common_test_3.c: New file.
11649         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
11650         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
11651         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
11652         (common_test_2_pic.o, common_test_2.so): New targets.
11653         (common_test_3_pic.o, common_test_3.so): New targets.
11654         * testsuite/Makefile.in: Rebuild.
11655
11656         PR 10979
11657         * script.cc (read_input_script): If we see a new SECTIONS clause,
11658         and we have added an input section, give an error.
11659         * layout.h (class Layout): Add have_added_input_section function.
11660         Add have_added_input_section_ field.
11661         * layout.cc (Layout::Layout): Initialize
11662         have_added_input_section_.
11663         (Layout::layout): Set have_added_input_section_.
11664         (Layout::layout_eh_frame): Likewise.
11665
11666 2009-12-30  Ian Lance Taylor  <iant@google.com>
11667
11668         PR 10931
11669         * options.h (class General_options): Add --sort-common option.
11670         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
11671         * common.cc (Sort_common): Add sort_order parameter to
11672         constructor.  Add sort_order_ field.
11673         (Sort_commons::operator): Check sort_order_.
11674         (Symbol_table::allocate_commons): Determine the sort order.
11675         (Symbol_table::do_allocate_commons): Add sort_order parameter.
11676         Change all callers.
11677         (Symbol_table::do_allocate_commons_list): Likewise.
11678
11679 2009-12-30  Ian Lance Taylor  <iant@google.com>
11680
11681         PR 10916
11682         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
11683         symbols from this object, don't change the visibility of an
11684         undefined symbol.
11685         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
11686
11687 2009-12-30  Ian Lance Taylor  <iant@google.com>
11688
11689         PR 10861
11690         * script.h (class Version_script_info): Define Language enum.
11691         Update declarations.  Define Glob, Exact, and Lookup types.  Add
11692         new fields globals_, locals_, and is_finalized_.
11693         * script.cc: Various formatting fixes.
11694         (class Parser_closure): Change language_stack_ from a vector of
11695         std::string to one of Version_script_info::Language.  Adjust all
11696         uses accordingly.
11697         (class Lazy_demangler): Remove.
11698         (struct Version_expression): Change language from std::string to
11699         Version_script_info::Language.
11700         (Version_script_info::Version_script_info): New function.
11701         (Version_script_info::~Version_script_info): Don't call clear.
11702         (Version_script_info::finalize): New function.
11703         (Version_script_info::build_lookup_tables): New function.
11704         (Version_script_info::build_expression_list_lookup): New
11705         function.
11706         (Version_script_info::get_symbol_version_helper): Rewrite to use
11707         lookup tables.
11708         (Version_script_info::print_expression_list): Adjust to use
11709         Version_script_info::Language.
11710         (script_push_lex_into_version_mode): Check that the version script
11711         has not been finalized.
11712         (version_script_push_lang): Change language string to
11713         Version_script_info::Language.
11714         * options.cc (Command_line::version_script): New function.
11715         * options.h (class General_options): Add finalize_dynamic_list
11716         function.  Change version_script from declaration to definition.
11717         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
11718         * testsuite/version_script.map: Remove duplicate def of foo.
11719         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
11720         version_script.map.
11721         * testsuite/Makefile.in: Rebuild.
11722
11723 2009-12-30  Ian Lance Taylor  <iant@google.com>
11724
11725         PR 10843
11726         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
11727         if the input symbol index is 0, make the output symbol index 0.
11728
11729 2009-12-30  Ian Lance Taylor  <iant@google.com>
11730
11731         PR 10670
11732         * options.h (class General_options): Add -x/--discard-all.
11733         * object.cc (Sized_relobj::do_count_local_symbols): Handle
11734         --discard-all.  If the local symbol needs a dynamic entry, check
11735         that before handling --discard-locals.
11736
11737 2009-12-30  Ian Lance Taylor  <iant@google.com>
11738
11739         PR 10450
11740         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
11741         flags to PF_R.
11742         (Output_segment::add_output_section): Don't change the flags if
11743         the type is PT_TLS.
11744
11745         PR 10450
11746         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
11747         GNU hash table if they need a dynamic value.  Otherwise, don't add
11748         them if they are defined in a dynamic object or are forced local.
11749
11750 2009-12-29  Ian Lance Taylor  <iant@google.com>
11751
11752         PR 10450
11753         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
11754         .gnu.hash table for a 32-bit target.
11755
11756         PR 10450
11757         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
11758         regular and a dynamic object only needs a dynamic symbol table
11759         entry if it is externally visible.
11760
11761         PR 10450
11762         * i386.cc (class Target_i386): Initialize global_offset_table_ in
11763         constructor.  Add global_offset_table_ field.
11764         (Target_i386::got_section): Set global_offset_table_.
11765         (Target_i386::do_finalize_sections): Set global_offset_table_
11766         size.
11767         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
11768         in constructor.  Add global_offset_table_ field.
11769         (Target_x86_64::got_section): Set global_offset_table_.
11770         (Target_x86_64::do_finalize_sections): Set global_offset_table_
11771         size.
11772
11773         * layout.cc (Layout::Layout): Initialize increase_relro_.
11774         (Layout::get_output_section): Add is_relro, is_last_relro, and
11775         is_first_non_relro parameters.  Change all callers.
11776         (Layout::choose_output_section): Likewise.
11777         (Layout::add_output_section_data): Likewise.
11778         (Layout::make_output_section): Likewise.
11779         (Layout::set_segment_offsets): Clear increase_relro when using a
11780         linker script.
11781         * layout.h (class Layout): Add increase_relro method.  Add
11782         increase_relro_ field.  Update declarations.
11783         * output.cc (Output_section::Output_section): Initialize
11784         is_last_relro_ and is_first_non_relro_.
11785         (Output_segment::add_output_section): Group relro sections is
11786         do_sort is true.  Handle is_last_relro and is_first_non_relro.
11787         (Output_segment::maximum_alignment): Remove relro handling.
11788         (Output_segment::set_section_addresses): Add increase_relro
11789         parameter.  Change all callers.  Add initial alignment to align
11790         relro sections on separate page.  Remove old relro handling.
11791         (Output_segment::set_section_list_addresses): Remove in_relro
11792         parameter.  Change all callers.
11793         (Output_segment::set_offset): Add increase parameter.  Change all
11794         callers.  Remove old relro handling.
11795         * output.h (class Output_section): Add new methods: is_last_relro,
11796         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
11797         Add is_last_relro_ and is_first_non_relro_ fields.
11798         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
11799         Create separate .got.plt section.  Call increase_relro.
11800         * x86_64.cc (Target_x86_64::got_section): Likewise.
11801         * testsuite/relro_script_test.t: Add .got.plt.
11802
11803         PR 10450
11804         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
11805         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
11806         (Layout::finalize): Call set_dynamic_symbol_size.
11807         (Layout::set_dynamic_symbol_size): New function.
11808         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
11809         set_dynamic_symbol_size.
11810
11811         PR 10450
11812         * output.h (class Output_section): Add is_entsize_zero_ field.
11813         * output.cc (Output_section::Output_section): Initialize
11814         is_entsize_zero_.
11815         (Output_section::set_entsize): If two different entsizes are
11816         requested, force it to zero.
11817         (Output_section::add_input_section): Set flags for .debug_str
11818         before updating section flags.  Set entsize.
11819         (Output_section::update_flags_for_input_section): Set SHF_MERGE
11820         and SHF_STRING if all input sections have those flags.
11821
11822 2009-12-29   Rafael Espindola  <espindola@google.com>
11823
11824         * main.cc (main): Fix the sys time reporting.
11825         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
11826         reporting.
11827
11828 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
11829
11830         * options.cc (General_options::parse_version): Allow -v to exit
11831         without an error if there is nothing to link.
11832
11833 2009-12-29  Ian Lance Taylor  <iant@google.com>
11834
11835         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
11836         using a version of gcc before 4.1.
11837         * configure: Rebuild.
11838
11839 2009-12-28  Chris Demetriou  <cgd@google.com>
11840
11841         * attributes.cc (Output_attributes_section_data::do_write): Use
11842         std::vector::front rather than std::vector::data.
11843
11844 2009-12-28  Ian Lance Taylor  <iant@google.com>
11845
11846         * symtab.h (class Symbol_table): Add enum Defined.
11847         * resolve.cc (Symbol_table::should_override): Add defined
11848         parameter.  Change all callers.  Test whether object is NULL
11849         before calling a method on it.
11850         (Symbol_table::report_resolve_problem): Add defined parameter.
11851         Change all callers.
11852         (Symbol_table::should_override_with_special): Likewise.
11853         * symtab.cc (Symbol_table::define_in_output_data): Add defined
11854         parameter.  Change all callers.
11855         (Symbol_table::do_define_in_output_data): Likewise.
11856         (Symbol_table::define_in_output_segment): Likewise.
11857         (Symbol_table::do_define_in_output_segment): Likewise.
11858         (Symbol_table::define_as_constant): Likewise.
11859         (Symbol_table::do_define_as_constant): Likewise.
11860         * script.h (class Symbol_assignment): Add is_defsym parameter to
11861         constructor; change all callers.
11862         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
11863         parameter.  Change all callers.  Add is_defsym_ field.
11864         (class Parser_closure): Add parsing_defsym parameter to
11865         constructor; change all callers.  Add parsing_defsym accessor
11866         function.  Add parsing_defsym_ field.
11867
11868 2009-12-28  Ian Lance Taylor  <iant@google.com>
11869
11870         * gold.cc (queue_middle_tasks): Fix formatting.
11871         * object.cc (Relobj::is_section_name_included): Likewise.
11872
11873 2009-12-23  Ian Lance Taylor  <iant@google.com>
11874
11875         * i386.cc (Target_i386::do_calls_non_split): Recognize
11876         -fsplit-stack prologue for a function with a static chain.
11877         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
11878         -fsplit-stack prologue when using %r11.
11879
11880 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
11881
11882         * options.cc (General_options::parse_version): Make -v continue and do
11883         the link like GNU ld does.
11884
11885 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
11886
11887         * Makefile.am (CCFILES): Add timer.cc.
11888         (HFILES): Add timer.h.
11889         * configure.ac: Check for sysconf and times.
11890         * main.cc: include timer.h.
11891         (main): Use Timer instead of get_run_time.
11892         * timer.cc: New.
11893         * timer.h: New.
11894         * workqueue.cc: include timer.h.
11895         (Workqueue::find_and_run_task):
11896         Report user, sys and wall time.
11897         * Makefile.in: Regenerate.
11898         * config.in: Regenerate.
11899         * configure: Regenerate.
11900
11901 2009-12-16  Doug Kwan  <dougkwan@google.com>
11902
11903         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
11904         sections.
11905         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
11906         relaxed input sections.
11907         * output.cc (Output_section::find_relaxed_input_section): Change
11908         return type to Output_relaxed_input_section pointer.  Adjust code
11909         for new type of relaxed_input_section_map_.
11910         * output.h (Output_section::find_relaxed_input_section): Change
11911         return type to Output_relaxed_input_section pointer.
11912         (Output_section::Output_relaxed_input_section_by_input_section_map):
11913         New type.
11914         (Output_section::relaxed_input_section_map_): Change type to
11915         Output_section::Output_relaxed_input_section_by_input_section_map.
11916         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
11917         input section.
11918
11919 2009-12-15  Ian Lance Taylor  <iant@google.com>
11920
11921         * layout.cc (Layout::create_shstrtab): Only write out after input
11922         sections if we are compressing debug sections.
11923
11924 2009-12-15  Ian Lance Taylor  <iant@google.com>
11925
11926         * archive.cc (Archive::add_symbols): Only look up a symbol without
11927         a version if there is, in fact, a version.
11928
11929 2009-12-14  Ian Lance Taylor  <iant@google.com>
11930
11931         Revert -Wshadow changes, all changes from:
11932         2009-12-11  Doug Kwan  <dougkwan@google.com>
11933         2009-12-11  Nick Clifton  <nickc@redhat.com>
11934         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
11935
11936 2009-12-11  Doug Kwan  <dougkwan@google.com>
11937
11938         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
11939         due to -Wshadow.
11940         * attributes.cc (Object_attribute::size): Ditto.
11941         (Attributes_section_data::size): Ditto.
11942         (Attributes_section_data::Attributes_section_data): Ditto.
11943         (Output_attributes_section_data::do_write): Ditto.
11944         * attributes.h (Object_attribute::set_type): Ditto.
11945         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
11946
11947 2009-12-11  Nick Clifton  <nickc@redhat.com>
11948
11949         * archive.cc: Fix shadowed variable warnings.
11950         * arm.cc: Likewise.
11951         * compressed_output.cc: Likewise.
11952         * compressed_output.h: Likewise.
11953         * configure: Likewise.
11954         * dwarf_reader.cc: Likewise.
11955         * dynobj.cc: Likewise.
11956         * dynobj.h: Likewise.
11957         * ehframe.cc: Likewise.
11958         * ehframe.h: Likewise.
11959         * errors.cc: Likewise.
11960         * expression.cc: Likewise.
11961         * fileread.cc: Likewise.
11962         * fileread.h: Likewise.
11963         * freebsd.h: Likewise.
11964         * i386.cc: Likewise.
11965         * icf.cc: Likewise.
11966         * incremental.h: Likewise.
11967         * layout.cc: Likewise.
11968         * layout.h: Likewise.
11969         * mapfile.cc: Likewise.
11970         * merge.cc: Likewise.
11971         * merge.h: Likewise.
11972         * object.cc: Likewise.
11973         * object.h: Likewise.
11974         * options.h: Likewise.
11975         * output.cc: Likewise.
11976         * output.h: Likewise.
11977         * parameters.cc: Likewise.
11978         * plugin.cc: Likewise.
11979         * powerpc.cc: Likewise.
11980         * reduced_debug_output.cc: Likewise.
11981         * reduced_debug_output.h: Likewise.
11982         * reloc.cc: Likewise.
11983         * reloc.h: Likewise.
11984         * resolve.cc: Likewise.
11985         * script-sections.cc: Likewise.
11986         * script.cc: Likewise.
11987         * script.h: Likewise.
11988         * sparc.cc: Likewise.
11989         * symtab.cc: Likewise.
11990         * symtab.h: Likewise.
11991         * target-select.cc: Likewise.
11992         * target-select.h: Likewise.
11993         * token.h: Likewise.
11994         * workqueue.cc: Likewise.
11995         * workqueue.h: Likewise.
11996         * x86_64.cc: Likewise.
11997
11998 2009-12-10  Doug Kwan  <dougkwan@google.com>
11999
12000         * arm.cc (attributes.h): New include.
12001         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
12002         (Arm_relobj::~Arm_relobj): Delete object pointed by
12003         attributes_section_data_.
12004         (Arm_relobj::attributes_section_data): New method definition.
12005         (Arm_relobj::attributes_section_data_): New data member declaration.
12006         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
12007         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
12008         attributes_section_data_.
12009         (Arm_dynobj::attributes_section_data): New method definition.
12010         (Arm_dynobj::attributes_section_data_): New data member declaration.
12011         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
12012         initialization value of may_use_blx_ to false.
12013         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
12014         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
12015         object attributes to compute results instead of hard-coding.
12016         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
12017         Target_arm::get_secondary_compatible_arch,
12018         Target_arm::set_secondary_compatible_arch
12019         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12020         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
12021         New method declarations.
12022         (Target_arm::get_aeabi_object_attribute): New method definition.
12023         (Target_arm::attributes_section_data_): New data member declaration.
12024         (read_arm_attributes_section): New template definition.
12025         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
12026         (Arm_dynobj::do_read_symbols): Ditto.
12027         (Target_arm::do_finalize_sections): Merge attributes sections from
12028         input.  Check for BLX use after attributes section merging.
12029         Fix __exidx_start and __exidx_end visibility.  Create an
12030         .ARM.attributes section if necessary.
12031         (Target_arm::get_secondary_compatible_arch,
12032         Target_arm::set_secondary_compatible_arch,
12033         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12034         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
12035         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
12036         New method definitions.
12037
12038 2009-12-09  Ian Lance Taylor  <iant@google.com>
12039
12040         * plugin.cc (Plugin::load): Don't cast from void* to a function
12041         pointer.
12042
12043 2009-12-09  Ian Lance Taylor  <iant@google.com>
12044
12045         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
12046         information fields.
12047
12048 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
12049
12050         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
12051         Replace two_file_shared_1.so with two_file_shared_2.so.
12052         * testsuite/Makefile.in: Regenerated.
12053
12054 2009-12-08  Doug Kwan  <dougkwan@google.com>
12055
12056         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
12057         (HFILES): Add attributes.h and int_encoding.h.
12058         * Makefile.in: Regenerate.
12059         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
12060         function definitions to int_encoding.cc
12061         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
12062         prototypes to int_encoding.h
12063         * reduced_debug_output.cc (int_encoding.h): New include.
12064         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
12065         function definitions to int_encoding.cc
12066         (insert_into_vector, read_from_pointer): Move template definitions to
12067         int_encoding.h
12068         * attributes.cc: New file.
12069         * attributes.h: New file.
12070         * int_encoding.cc: New file.
12071         * int_encoding.h: New file.
12072
12073 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
12074
12075         PR gold/11055
12076         * incremental-dump.cc (dump_incremental_inputs): New.
12077         (main): Use dump_incremental_inputs.
12078
12079 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
12080
12081         PR gold/10893
12082         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
12083         checking elfcpp::STT_FUNC.
12084         (Target_i386::Relocate::relocate): Likewise.
12085         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
12086
12087         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
12088         symbols from shared libraries into normal FUNC symbols.
12089
12090         * symtab.h (Symbol): Add is_func and use it.
12091
12092 2009-12-05  Doug Kwan  <dougkwan@google.com>
12093
12094         * arm.cc (Target_arm::arm_info): Initialize new fields
12095         attributes_section and attributes_vendor.
12096         * i386.cc (Target_i386::i386_info): Same.
12097         * object.cc (Sized_relobj::do_layout): Skip attribute section.
12098         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
12099         fields attributes_section and attributes_vendor.
12100         * sparc.cc (Target_sparc::sparc_info): Same.
12101         * target.h (Target::attributes_section, Target::attributes_vendor,
12102         Target::is_attributes_section, Target::attribute_arg_type,
12103         Target::attributes_order): New method definitions.
12104         (Target::Target_info::attributes_section,
12105         Target::Target_info::attributes_vendor): New fields.
12106         (Target::do_attribute_arg_type, Target::do_attributes_order): New
12107         virtual method definitions.
12108         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
12109         attributes_section and attributes_vendor.
12110         * testsuite/testfile.cc (Target_test::test_target_info): Same.
12111
12112 2009-12-05  Doug Kwan  <dougkwan@google.com>
12113
12114         * arm.cc: Update comments about interworking and stub generation.
12115         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
12116         considered as non-PIC.
12117         (Arm_relocate_functions::base_abs): Fix formatting.
12118         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
12119         of function to use GOT entry address instead of offset.
12120         (Target_arm::Scan::global): Issue an error if a symbol would need a
12121         PLT does not get one because it is untyped.  Remove code to create
12122         dynamic symbols for relative branches.
12123         (Target_arm::Relocate::relocate: Use 0 instead of false since function
12124         takes unsigned integer instead of boolean.
12125
12126 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
12127
12128         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
12129         (two_file_test_LDADD): Likewise.
12130         (common_test_1_LDADD): Likewise.
12131         (exception_test_LDADD) Likewise.
12132         (weak_test_LDADD): Likewise.
12133         (many_sections_test_LDADD): Likewise.
12134         (initpri1_LDADD): Likewise.
12135         (script_test_1_LDADD): Likewise.
12136         (script_test_2_LDADD): Likewise.
12137         (justsyms_LDADD): Likewise.
12138         (binary_test_LDADD): Likewise.
12139         (large_LDADD): Likewise.
12140         * testsuite/Makefile.in: Regenerated.
12141
12142 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
12143
12144         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
12145         (Symbol_table::override_with_special): Likewise.
12146         (Symbol_table::add_from_object): Likewise.
12147
12148 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12149
12150         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12151         Don't set the data_offset twice.
12152
12153 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12154
12155         * testsuite/Makefile.in: Regenerate.
12156
12157 2009-12-03  Doug Kwan  <dougkwan@google.com>
12158
12159         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
12160         (Target_arm::do_finalize_sections): Add parameter for symbol table
12161         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
12162         * i386.cc (Target_i386::do_finalize_sections): Add an additional
12163         parameter for symbol table pointer.
12164         * layout.cc (Layout::finalize): Call Target::finalize_sections with
12165         an additional parameter for a pointer to symbol table.
12166         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
12167         parameter for a symbol table pointer.
12168         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
12169         * target.h (Target::finalize_sections, Target::do_finalize_sections):
12170         Ditto.
12171         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
12172         parameter for a symbol table pointer.
12173
12174 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
12175
12176         * incremental.cc (Incremental_inputs_header)
12177         (Incremental_inputs_header_write, Incremental_inputs_entry)
12178         (Incremental_inputs_entry_write): Move ...
12179         * incremental.h (Incremental_inputs_header)
12180         (Incremental_inputs_header_write, Incremental_inputs_entry)
12181         (Incremental_inputs_entry_write): here.
12182
12183 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12184
12185         * incremental.cc (make_sized_incremental_binary): Set the target.
12186         Error if it is incompatible.
12187         * output.h (Output_file): Add filename method.
12188
12189 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12190
12191         * incremental.cc (Incremental_inputs_entry): Remove unused argument
12192         from the get_* methods.
12193
12194 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12195
12196         * incremental-dump.cc (main): Check that the offeset of a script is 0.
12197         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12198         Write 0 for the data_offset of scripts.
12199
12200 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12201
12202         * testsuite/Makefile.am: Add the incremental_test.sh test.
12203         * testsuite/incremental_test.sh: New.
12204         * testsuite/incremental_test_1.c: New.
12205         * testsuite/incremental_test_2.c: New.
12206
12207 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
12208
12209         * incremental-dump.cc (main): Fix typos.
12210
12211 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
12212
12213         PR gold/11025
12214         * incremental-dump.cc (main): Use llu to print 64 bit values.
12215
12216 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
12217             H.J. Lu  <hongjiu.lu@intel.com>
12218
12219         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
12220         $(LIBDL).
12221         (incremental_dump_LDADD): Likewise.
12222         * Makefile.in: Regenerated.
12223
12224 2009-11-25  Doug Kwan  <dougkwan@google.com>
12225
12226         Revert:
12227
12228         2009-11-25  Doug Kwan  <dougkwan@google.com>
12229
12230                 * arm.cc (Target_arm::Target_arm): Move method definition
12231                 outside of class definition.  Add code to handle
12232                 --target1-rel, --target1-abs and --target2= options.
12233                 (Target_arm::get_reloc_reloc_type): Change method to be
12234                 non-static and const.
12235                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
12236                 New data member declaration.
12237                 (Target_arm::Scan::local, Target_arm::Scan::global,
12238                 Target_arm::Relocate::relocate,
12239                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12240                 Adjust call to Target_arm::get_real_reloc_type.
12241                 (Target_arm::get_real_reloc_type): Use command line options
12242                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12243                 * options.h (--target1-rel, --target1-abs, --target2): New
12244                 ARM-only options.
12245
12246 2009-11-25  Doug Kwan  <dougkwan@google.com>
12247
12248         * arm.cc (Target_arm::Target_arm): Move method definition outside of
12249         class definition.  Add code to handle --target1-rel, --target1-abs
12250         and --target2= options.
12251         (Target_arm::get_reloc_reloc_type): Change method to be non-static
12252         and const.
12253         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
12254         member declaration.
12255         (Target_arm::Scan::local, Target_arm::Scan::global,
12256         Target_arm::Relocate::relocate,
12257         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
12258         call to Target_arm::get_real_reloc_type.
12259         (Target_arm::get_real_reloc_type): Use command line options to
12260         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12261         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
12262         options.
12263
12264 2009-11-25  Doug Kwan  <dougkwan@google.com>
12265
12266         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
12267         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
12268         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
12269         formatting.
12270         (Arm_relocate_functions::thm_call): Replace body with a call to
12271         Arm_relocate_functions::thumb_branch_common.
12272         (Arm_relocate_functions::thm_jump24,
12273         Arm_relocate_functions::thm_xpc22): New method definitions.
12274         (Arm_relocate_functions::thumb_branch_common): New method definition.
12275         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
12276         operator.
12277         (Target_arm::Relocate::relocate): Adjust call to thm_call.
12278         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
12279
12280 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12281
12282         * Makefile.am: Build incremental-dump
12283         * Makefile.in: Regenerate.
12284         * incremental-dump.cc: New.
12285         * incremental.cc (Incremental_inputs_header_data,
12286         Incremental_inputs_entry_data): Move to incremental.h
12287         * incremental.h: (Incremental_inputs_header_data,
12288         Incremental_inputs_entry_data): Move from incremental.cc
12289
12290 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12291
12292         * incremental.cc (Incremental_inputs_header,
12293         Incremental_inputs_header_write, Incremental_inputs_entry,
12294         Incremental_inputs_entry_write): Add a typedef with the data type.
12295
12296 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12297
12298         * incremental.cc (Incremental_inputs_header,
12299         Incremental_inputs_header_write, Incremental_inputs_entry,
12300         Incremental_inputs_entry_write): Update comment about which
12301         type has the filed descriptions.
12302
12303 2009-11-15  Doug Kwan  <dougkwan@google.com>
12304
12305         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
12306         (Arm_relocate_functions::arm_branch_common): Change method defintion
12307         in class definition to a method declaration and update list of formal
12308         parameters.
12309         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
12310         Arm_relocation_functions::jump24): Adjust call to
12311         Arm_relocate_functions::arm_branch_common.  Update list of formal
12312         parameters.
12313         (Arm_relocate_functions::xpc25): New method definition.
12314         (Arm_relocate_functions::arm_branch_common): Move method defintion
12315         out from class definition.  Use stubs for mode-switching and extending
12316         branch ranges.
12317         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
12318         specially.  Change code to enable use of stubs in ARM branches.
12319
12320 2009-11-10  Doug Kwan  <dougkwan@google.com>
12321
12322         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
12323         in method declaration.
12324         (Target_arm::relocate_stub): New method declaration.
12325         (Target_arm::default_target): Change to return a pointer instead of
12326         a const reference.
12327         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
12328         Target_arm::default_target.
12329         (Arm_Relobj::do_relocate_sections): Remove options paramater in
12330         method definition.
12331         (Target_arm::relocate_section): Adjust view.
12332         (Target_arm::relocate_stub): New method definition.
12333
12334 2009-11-10  Doug Kwan  <dougkwan@google.com>
12335
12336         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
12337         a format warning.
12338         * incremental.cc (open_incremental_binary): Initialized local
12339         variables to avoid warnings.
12340         * object.cc (make_elf_object): Ditto.
12341         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
12342         a format warning.
12343
12344 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
12345
12346         PR gold/10930
12347         * testsuite/plugin_test.c: Include "config.h".
12348
12349 2009-11-09  Doug Kwan  <dougkwan@google.com>
12350
12351         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
12352         (arm_symbol_value): Remove.
12353         (Arm_relocate_functions::arm_branch_common,
12354         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
12355         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
12356         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
12357         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
12358         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
12359         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
12360         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
12361         Arm_relocate_functions::thm_mobw_abs_nc,
12362         Arm_relocate_functions::thm_mov_abs,
12363         Arm_relocate_functions::movw_prel_nc,
12364         Arm_relocate_functions::thm_movt_abs,
12365         Arm_relocate_functions::movt_prel,
12366         Arm_relocate_functions::thm_movw_prel_nc,
12367         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
12368         (Target_arm::Relocate::relocate): Only decompose address into two
12369         parts if relocation type uses the thumb-bit and pass the actual
12370         bit instead of a flag indicating that the thumb-bit is used.  Adjust
12371         calls to methods in Arm_relocate_functions for this change.
12372
12373 2009-11-08  Ian Lance Taylor  <iant@google.com>
12374
12375         PR 10925
12376         * reloc.cc: Instantiate
12377         Sized_relobj::initialize_input_to_output_maps and
12378         Sized_relobj:free_input_to_output_maps.
12379
12380 2009-11-06  Ian Lance Taylor  <iant@google.com>
12381
12382         PR 10876
12383         * defstd.cc (in_segment): Set only_if_ref true for "end".
12384
12385 2009-11-06  Doug Kwan  <dougkwan@google.com>
12386
12387         * arm.cc (class Reloc_stub): Correct a comment.
12388         (Target_arm::Target_arm): Initialize arm_input_section_map_.
12389         (Target_arm::scan_section_for_stubs): New method declaration.
12390         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
12391         Change methods from private to protected.
12392         (Target_arm::do_may_relax): New method definition.
12393         (Target_arm::do_relax, Target_arm::group_sections,
12394         Target_arm::scan_reloc_for_stub,
12395         Target_arm::scan_reloc_section_for_stubs): New method declarations.
12396         (Target_arm::arm_input_section_map_): New data member declaration.
12397         (Target_arm::scan_reloc_for_stub,
12398         Target_arm::scan_reloc_section_for_stubs,
12399         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
12400         Target_arm::do_relax): New method definitions.
12401
12402 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
12403
12404         * configure.ac: Check for (struct stat)::st_mtim
12405         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
12406         * config.in: Regenerate.
12407         * configure: Regenerate.
12408
12409 2009-11-05  Ian Lance Taylor  <iant@google.com>
12410
12411         PR 10910
12412         * output.cc (Output_segment::add_output_section): Add missing
12413         return statement.
12414
12415 2009-11-04  Ian Lance Taylor  <iant@google.com>
12416
12417         PR 10880
12418         * object.h (class Object): Add is_needed and set_is_needed
12419         methods.  Add is_needed_ field.  Make bool fields into bitfields.
12420         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
12421         defined in a dynamic object and referenced by a regular object,
12422         set is_needed for the dynamic object.
12423         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
12424         if the file is marked with as_needed and it is not needed.
12425
12426 2009-11-04  Ian Lance Taylor  <iant@google.com>
12427
12428         PR 10887
12429         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
12430         tags if data is discarded by linker script.
12431         * i386.cc (Target_i386::do_finalize_sections): Likewise.
12432         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
12433         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
12434         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
12435
12436 2009-11-04  Ian Lance Taylor  <iant@google.com>
12437
12438         * layout.cc (Layout::get_output_section): Add is_interp and
12439         is_dynamic_linker_section parameters.  Change all callers.
12440         (Layout::choose_output_section): Likewise.
12441         (Layout::make_output_section): Likewise.
12442         (Layout::add_output_section_data): Add is_dynamic_linker_section
12443         parameter.  Change all callers.
12444         * layout.h (class Layout): Update declarations.
12445         * output.h (class Output_section): Add is_interp, set_is_interp,
12446         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
12447         Add is_interp_, is_dynamic_linker_section_ fields.  Change
12448         generate_code_fills_at_write_ to a bitfield.
12449         * output.cc (Output_section::Output_sections): Initialize new
12450         fields.
12451         (Output_segment::add_output_section): Add do_sort parameter.
12452         Change all callers.
12453
12454 2009-11-03  Ian Lance Taylor  <iant@google.com>
12455
12456         PR 10860
12457         * options.h (class General_options): Add --warn-common.
12458         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
12459         merging two common symbols.
12460         (Symbol_table::should_override): Handle --warn-common when merging
12461         a common symbol with a defined symbol.  Use report_resolve_problem
12462         for multiple definitions.
12463         (Symbol_table::report_resolve_problem): New function.
12464         * symtab.h (class Symbol_table): Declare report_resolve_problem.
12465
12466 2009-11-03  Doug Kwan  <dougkwan@google.com>
12467
12468         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
12469         stub_factory_.
12470         (Target_arm::stub_factory): New method definition.
12471         (Target_arm::new_arm_input_section,
12472         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
12473         Target_arm::reloc_uses_thumb_bit): New method declarations.
12474         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
12475         New type definitions.
12476         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
12477         member declarations.
12478         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
12479         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
12480         New method definitions.
12481
12482 2009-11-03  Ian Lance Taylor  <iant@google.com>
12483
12484         * options.h (class General_options): Add --warn_constructors.
12485
12486 2009-11-03  Ian Lance Taylor  <iant@google.com>
12487
12488         PR 10893
12489         * defstd.cc (in_section): Add entries for __rel_iplt_start,
12490         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
12491
12492 2009-11-03  Ian Lance Taylor  <iant@google.com>
12493
12494         PR 10895
12495         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
12496         --msgid-bugs-address.
12497         (install-pdf): New target.
12498         (install-data_yes): Look up one directory to find mkinstalldirs.
12499
12500 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
12501
12502         * po/Make-in (.po.gmo): Don't generate .gmo files in source
12503         tree.
12504
12505 2009-10-30  Doug Kwan  <dougkwan@google.com>
12506
12507         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
12508
12509 2009-10-30  Doug Kwan  <dougkwan@google.com>
12510
12511         * arm.cc (Stub_addend_reader): New struct template definition
12512         and partial specializations.
12513         (Stub_addend_reader::operator()): New method definition for a
12514         partially specialized template.
12515
12516 2009-10-30  Doug Kwan  <dougkwan@google.com>
12517
12518         * arm.cc (Arm_relobj::processor_specific_flags): New method
12519         definition.
12520         (Arm_relobj::do_read_symbols): New method declaration.
12521         (Arm_relobj::processor_specific_flags_): New data member declaration.
12522         (Arm_dynobj): New class definition.
12523         (Target_arm::do_finalize_sections): Add input_objects parameter.
12524         (Target_arm::do_adjust_elf_header): New method declaration.
12525         (Target_arm::are_eabi_versions_compatible,
12526         (Target_arm::merge_processor_specific_flags): New method declaration.
12527         (Target_arm::do_make_elf_object): New overloaded method definitions
12528         and declaration.
12529         (Arm_relobj::do_read_symbols): New method definition.
12530         (Arm_dynobj::do_read_symbols): Ditto.
12531         (Target_arm::do_finalize_sections): Add input_objects parameters.
12532         Merge processor-specific flags from all input objects.
12533         (Target_arm::are_eabi_versions_compatible,
12534         Target_arm::merge_processor_specific_flags,
12535         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
12536         New method definitions.
12537         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
12538         Input_objects pointer type parameter.
12539         * layout.cc (Layout::finalize): Pass input objects to target's.
12540         finalize_sections function.
12541         * output.cc (Output_file_header::do_sized_write): Set ELF file
12542         header's processor-specific flags.
12543         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
12544         Input_objects pointer type parameter.
12545         * sparc.cc (Target_sparc::do_finalize_sections): Same.
12546         * target.h (Input_objects): New forward class declaration.
12547         (Target::processor_specific_flags,
12548         Target::are_processor_specific_flags_sect): New method definitions.
12549         (Target::finalize_sections): Add input_objects parameter.
12550         (Target::Target): Initialize processor_specific_flags_ and
12551         are_processor_specific_flags_set_.
12552         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
12553         parameter.
12554         (Target::set_processor_specific_flags): New method definition.
12555         (Target::processor_specific_flags_,
12556         Target::are_processor_specific_flags_set_): New data member
12557         declarations.
12558         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
12559         Input_objects pointer type parameter.
12560
12561 2009-10-30  Doug Kwan  <dougkwan@google.com>
12562
12563         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
12564
12565 2009-10-28  Ian Lance Taylor  <iant@google.com>
12566
12567         * object.h (class Relobj): Drop options parameter from
12568         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
12569         do_scan_relocs, do_relocate.  Change all callers.
12570         (class Sized_relobj): Drop options parameters from
12571         do_gc_process_relocs, do_scan_relocs, do_relocate,
12572         do_relocate_sections, relocate_sections, emit_relocs_scan,
12573         emit_relocs_scan_reltype.  Change all callers.
12574         (struct Relocate_info): Remove options field and all references to
12575         it.
12576         * reloc.h (class Read_relocs): Remove options constructor
12577         parameter and options_ field.  Change all callers.
12578         (class Gc_process_relocs, class Scan_relocs): Likewise.
12579         (class Relocate_task): Likewise.
12580         * target-reloc.h (scan_relocs): Remove options parameter.  Change
12581         all callers.
12582         (scan_relocatable_relocs): Likewise.
12583         * target.h (class Sized_target): Remove options parameter from
12584         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
12585         all callers.
12586         * gc.h (gc_process_relocs): Remove options parameter.  Change all
12587         callers.
12588         * arm.cc: Update functions to remove options parameters.
12589         * i386.cc: Likewise.
12590         * powerpc.cc: Likewise.
12591         * sparc.cc: Likewise.
12592         * x86_64.cc: Likewise.
12593         * testsuite/testfile.cc: Likewise.
12594
12595 2009-10-28  Doug Kwan  <dougkwan@google.com>
12596
12597         * arm.cc (Arm_relobj): New class definition.
12598         (Arm_relobj::scan_sections_for_stubs,
12599         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
12600         New method definitions.
12601
12602 2009-10-28  Cary Coutant  <ccoutant@google.com>
12603
12604         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
12605         (Plugin::cleanup_done_): New member.
12606         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
12607         (Plugin_manager::cleanup_done_): Remove.
12608         (Plugin_manager::add_input_file): Edit error message.
12609         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
12610         (Plugin_manager::cleanup): Remove use of cleanup_done_.
12611
12612 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
12613
12614         * fileread.cc: (File_read::View::~View): Use the new
12615         data_ownership_ filed.
12616         (File_read::~File_read): Dispose the new whole_file_view_.
12617         (File_read::open): Mmap the whole file if needed.
12618         (File_read::open): Use whole_file_view_ instead of contents_.
12619         (File_read::find_view): Use whole_file_view_ if applicable.
12620         (File_read::do_read): Use whole_file_view_ instead of contents_.
12621         (File_read::make_view): Use whole_file_view_ instead of contents_,
12622         update File_read::View::View call.
12623         (File_read::find_or_make_view): Update File_read::View::View
12624         call.
12625         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
12626         remove contents_
12627         (File_read::View::Data_ownership): New enum.
12628         (File_read::View::View): Replace bool mapped_ with Data_ownership
12629         argument.
12630         (File_read::View::mapped_): Remove (replaced by data_ownership_).
12631         (File_read::View::data_ownership_): New field.
12632         (File_read::contents_): Remove (replaced by whole_file_view_).
12633         (File_read::whole_file_view_): New field.
12634         * options.h (class General_options): Add --keep-files-mapped.
12635
12636 2009-10-27  Cary Coutant  <ccoutant@google.com>
12637
12638         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
12639         * testsuite/Makefile.am (plugin_test_5): New test case.
12640         * testsuite/Makefile.in: Regenerate.
12641
12642 2009-10-25  Doug Kwan  <dougkwan@google.com>
12643
12644         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
12645         from private to protected to allow access by child class.
12646         (Sized_relobj::do_relocate_sections): New method declaration.
12647         (Sized_relobj::relocate_sections): Virtualize.
12648         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
12649         Sized_relobj::relocate_sections.  Instantiate template explicitly
12650         for different target sizes and endianity.
12651
12652 2009-10-24  Doug Kwan  <dougkwan@google.com>
12653
12654         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
12655         (Arm_input_section::as_arm_input_section): New method.
12656         (Arm_output_section): New class definition.
12657         (Arm_output_section::create_stub_group,
12658         Arm_output_section::group_sections): New method definitions.
12659
12660 2009-10-22  Doug Kwan  <dougkwan@google.com>
12661
12662         * arm.cc (Arm_input_section): New class definition.
12663         (Arm_input_section::init, Arm_input_section:do_write,
12664         Arm_input_section::set_final_data_size,
12665         Arm_input_section::do_reset_address_and_file_offset): New method
12666         definitions.
12667
12668 2009-10-21  Doug Kwan  <dougkwan@google.com>
12669
12670         * arm.cc (Stub_table, Arm_input_section): New forward class
12671         declarations.
12672         (Stub_table): New class defintion.
12673         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
12674         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
12675         New method definition.
12676
12677 2009-10-21  Doug Kwan  <dougkwan@google.com>
12678
12679         * arm.cc: Update copyright comments.
12680         (Target_arm): New forward class template declaration.
12681         (Arm_address): New type.
12682         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
12683         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
12684         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
12685         constants.
12686         (Insn_template): Same.
12687         (DEF_STUBS): New macro.
12688         (Stub_type): New enum type.
12689         (Stub_template): New class definition.
12690         (Stub): Same.
12691         (Reloc_stub): Same.
12692         (Stub_factory): Same.
12693         (Target_arm::Target_arm): Initialize may_use_blx_ and
12694         should_force_pic_veneer_.
12695         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
12696         Target_arm::should_force_pic_veneer,
12697         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
12698         Target_arm::using_thumb_only, Target_arm:;default_target): New
12699         method defintions.
12700         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
12701         New data member declarations.
12702         (Insn_template::size, Insn_template::alignment): New method defintions.
12703         (Stub_template::Stub_template): New method definition.
12704         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
12705         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
12706         (Stub_factory::Stub_factory): New method definition.
12707         * gold.h (string_hash): New template.
12708         * output.h (Input_section_specifier::hash_value): Use
12709         gold::string_hash.
12710         (Input_section_specifier::string_hash): Remove.
12711         * stringpool.cc (Stringpool_template::string_hash): Use
12712         gold::string_hash.
12713
12714 2009-10-20  Doug Kwan  <dougkwan@google.com>
12715
12716         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
12717         symbols of relaxed input sections.
12718         * output.h (Output_section::find_relaxed_input_section): Make
12719         method public.
12720
12721 2009-10-16  Doug Kwan  <dougkwan@google.com>
12722
12723         * dynobj.cc (Versions::Versions): Initialize version_script_.
12724         Only insert base version symbol definition for a shared object
12725         if version script defines any version versions.
12726         (Versions::define_base_version): New method definition.
12727         (Versions::add_def): Check that base version is not needed.
12728         (Versions::add_need): Define base version lazily.
12729         * dynobj.h (Versions::define_base_version): New method declaration.
12730         (Versions::needs_base_version_): New data member declaration.
12731         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
12732         (check_DATA): Add no_version_test.stdout.
12733         (libno_version_test.so, no_version_test.o no_version_test.stdout):
12734         New make rules.
12735         * testsuite/Makefile.in: Regenerate.
12736         * testsuite/no_version_test.c: New file.
12737         * testsuite/no_version_test.sh: Ditto.
12738
12739 2009-10-16  Doug Kwan  <dougkwan@google.com>
12740
12741         * expression.cc (class Segment_start_expression): New class definition.
12742         (Segment_start_expression::value): New method definition.
12743         (script_exp_function_segment_start): Return a new
12744         Segment_start_expression.
12745         * gold/script-c.h (script_saw_segment_start_expression): New function
12746         prototype.
12747         * script-sections.cc (Script_sections::Script_sections): Initialize
12748         SAW_SEGMENT_START_EXPRESSION_ to false.
12749         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
12750         and -Tbbs options to specify section addresses if given in
12751         command line and no SEGMENT_START expression is seen in a script.
12752         * script-sections.h (Script_sections::saw_segment_start_expression,
12753         Script_sections::set_saw_segment_start_expression): New method
12754         definition.
12755         (Script_sections::saw_segment_start_expression_): New data member
12756         declaration.
12757         * script.cc (script_saw_segment_start_expression): New function.
12758         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
12759         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
12760         script_test_7.sh and script_test_8.sh.
12761         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
12762         script_test_8.stdout.
12763         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
12764         (script_test_6, script_test_6.stdout, script_test_7,
12765         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
12766         * Makefile.in: Regenerate.
12767         * testsuite/script_test_6.sh: New file.
12768         * testsuite/script_test_6.t: Same.
12769         * testsuite/script_test_7.sh: Same.
12770         * testsuite/script_test_7.t: Same.
12771         * testsuite/script_test_8.sh: Same.
12772
12773 2009-10-16  Doug Kwan  <dougkwan@google.com>
12774
12775         * output.cc (Output_segment::set_section_list_address): Cast
12776         expressions to unsigned long long type to avoid format warnings.
12777
12778 2009-10-15  Ian Lance Taylor  <iant@google.com>
12779
12780         * script.cc (Script_options::add_symbol_assignment): Always add a
12781         dot assignment to script_sections_.
12782         * script-sections.cc (Script_sections::add_dot_assignment):
12783         Initialize if necessary.
12784
12785         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
12786         program headers with no load segment if there is a linker script.
12787
12788         * layout.cc (Layout::set_segment_offsets): Align the file offset
12789         to the segment aligment for -N or -n with no load segment.
12790         * output.cc (Output_segment::add_output_section): Don't crash if
12791         the first section is a TLS section.
12792         (Output_segment::set_section_list_addresses): Print an error
12793         message if the address moves backward in a linker script.
12794         * script-sections.cc
12795         (Output_section_element_input::set_section_addresses): Don't
12796         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
12797         (Orphan_output_section::set_section_addresses): Likewise.
12798
12799 2009-10-15  Doug Kwan  <dougkwan@google.com>
12800
12801         * layout.cc (Layout::finish_dynamic_section): Generate tags
12802         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
12803         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
12804         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
12805
12806 2009-10-14  Ian Lance Taylor  <iant@google.com>
12807
12808         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
12809         fields.
12810         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
12811         data_shdr fields of relinfo.
12812         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
12813         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
12814         R_386_TLS_LDO_32, adjust based on section flags.
12815         (Target_i386::Relocate::fix_up_ldo): Remove.
12816
12817 2009-10-13  Ian Lance Taylor  <iant@google.com>
12818
12819         Add support for -pie.
12820         * options.h (class General_options): Add -pie and
12821         --pic-executable.
12822         (General_options::output_is_position_independent): Test -pie.
12823         (General_options::output_is_executable): Return true if not shared
12824         and not relocatable.
12825         (General_options::output_is_pie): Remove.
12826         * options.cc (General_options::finalize): Reject incompatible uses
12827         of -pie.
12828         * gold.cc (queue_middle_tasks): A -pie link is not static.
12829         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
12830         * symtab.cc (Symbol::final_value_is_known): Return false if
12831         output_is_position_independent.
12832         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
12833         output_is_position_independent.
12834         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
12835         output_is_position_independent.
12836         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
12837         output_is_position_independent.
12838         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
12839         two_file_pie_test.
12840         (basic_pie_test.o, basic_pie_test): New targets.
12841         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
12842         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
12843         (two_file_pie_test): New target.
12844         * testsuite/Makefile.in: Rebuild.
12845         * README: Remove note saying that -pie is not supported.
12846
12847 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
12848
12849         * options.h (class General_options): Add -init and -fini.
12850         * layout.cc (Layout::finish_dynamic_section): Emit
12851         given init and fini functions.
12852
12853 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
12854
12855         * gc.h (gc_process_relocs): Check if icf is enabled using new
12856         function.
12857         * gold.cc (queue_initial_tasks): Likewise.
12858         (queue_middle_tasks): Likewise.
12859         * object.cc (do_layout): Likewise.
12860         * symtab.cc (is_section_folded): Likewise.
12861         * main.cc (main): Likewise.
12862         * reloc.cc (Read_relocs::run): Likewise.
12863         (Sized_relobj::do_scan_relocs): Likewise.
12864         * icf.cc (is_function_ctor_or_dtor): New function.
12865         (Icf::find_identical_sections): Check if function is ctor or dtor when
12866         safe icf is chosen.
12867         * options.h (General_options::icf): Change option to be an enum.
12868         (Icf_status): New enum.
12869         (icf_enabled): New method.
12870         (icf_safe_folding): New method.
12871         (set_icf_status): New method.
12872         (icf_status_): New variable.
12873         * (options.cc) (General_options::finalize): Set icf_status_.
12874         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
12875         icf_test and icf_keep_unique_test to use the --icf enum flag.
12876         * testsuite/icf_safe_test.sh: New file.
12877         * testsuite/icf_safe_test.cc: New file.
12878
12879 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
12880
12881         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
12882         includes to gc.h and icf.h.
12883         * arm.cc: Include gc.h.
12884         * gold.cc: Likewise.
12885         * i386.cc: Likewise.
12886         * powerpc.cc: Likewise.
12887         * sparc.cc: Likewise.
12888         * x86_64.cc: Likewise.
12889         * gc.h: Include icf.h.
12890
12891 2009-10-11  Ian Lance Taylor  <iant@google.com>
12892
12893         * plugin.cc: Include "gold.h" before other header files.
12894
12895 2009-10-10  Chris Demetriou  <cgd@google.com>
12896
12897         * options.h (Input_file_argument::Input_file_type): New enum.
12898         (Input_file_argument::is_lib_): Replace with...
12899         (Input_file_argument::type_): New member.
12900         (Input_file_argument::Input_file_argument): Take Input_file_type
12901         'type' rather than boolean 'is_lib' as second argument.
12902         (Input_file_argument::is_lib): Use type_.
12903         (Input_file_argument::is_searched_file): New function.
12904         (Input_file_argument::may_need_search): Handle is_searched_file.
12905         * options.cc (General_options::parse_library): Support -l:filename.
12906         (General_options::parse_just_symbols): Update for Input_file_argument
12907         changes.
12908         (Command_line::process): Likewise.
12909         * archive.cc (Archive::get_file_and_offset): Likewise.
12910         * plugin.cc (Plugin_manager::release_input_file): Likewise.
12911         * script.cc (read_script_file, script_add_file): Likewise.
12912         * fileread.cc (Input_file::Input_file): Likewise.
12913         (Input_file::will_search_for): Handle is_searched_file.
12914         (Input_file::open): Likewise.
12915         * readsyms.cc (Read_symbols::get_name): Likewise.
12916         * testsuite/Makefile.am (searched_file_test): New test.
12917         * testsuite/Makefile.in: Regenerate.
12918         * testsuite/searched_file_test.cc: New file.
12919         * testsuite/searched_file_test_lib.cc: New file.
12920
12921 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12922             Ian Lance Taylor  <iant@google.com>
12923
12924         * descriptor.cc: Include <cstdio> and "binary-io.h".
12925         (Descriptors::open): Open the files in binary mode always.
12926         * script.cc (Lex::get_token): Treat \r as whitespace.
12927
12928 2009-10-09  Ian Lance Taylor  <iant@google.com>
12929
12930         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
12931
12932 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12933             Ian Lance Taylor  <iant@google.com>
12934
12935         * configure.ac: Check for readv function also.
12936         * fileread.cc (readv): Define if not HAVE_READV.
12937         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
12938         does not exist.
12939         * config.in: Regenerate.
12940         * configure: Regenerate.
12941
12942 2009-10-09  Doug Kwan  <dougkwan@google.com>
12943
12944         * layout.cc (Layout::make_output_section): Call target hook to make
12945         ordinary output section.
12946         (Layout::finalize): Adjust parameter list of call the
12947         Target::may_relax().
12948         * layout.h (class Layout::section_list): New method.
12949         * merge.h (Output_merge_base::entsize): Change visibility to public.
12950         (Output_merge_base::is_string, Output_merge_base::do_is_string):
12951         New methods.
12952         (Output_merge_string::do_is_string): New method.
12953         * object.cc (Sized_relobj::do_setup): renamed from
12954         Sized_relobj::set_up.
12955         * object.h (Sized_relobj::adjust_shndx,
12956         Sized_relobj::initializ_input_to_output_maps,
12957         Sized_relobj::free_input_to_output_maps): Change visibilities to
12958         protected.
12959         (Sized_relobj::setup): Virtualize.
12960         (Sized_relobj::do_setup): New method declaration.
12961         (Sized_relobj::invalidate_section_offset,
12962         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
12963         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
12964         * options.cc (parse_int): New function.
12965         * options.h (parse_int): New declaration.
12966         (DEFINE_int): New macro.
12967         (stub_group_size): New option.
12968         * output.cc (Output_section::Output_section): Initialize memebers
12969         merge_section_map_, merge_section_by_properties_map_,
12970         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
12971         (Output_section::add_input_section): Handled deferred code-fill
12972         generation and remove an old comment.
12973         (Output_section::add_relaxed_input_section): New method definition.
12974         (Output_section::add_merge_input_section): Use merge section by
12975         properties map to speed to search.  Update merge section maps
12976         as appropriate.
12977         (Output_section::build_relaxation_map): New method definition.
12978         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
12979         Same.
12980         (Output_section::relax_input_section): Renamed to
12981         Output_section::convert_input_sections_to_relaxed_sections and change
12982         interface to take a vector of pointers to relaxed sections.
12983         (Output_section::find_merge_section,
12984         Output_section::find_relaxed_input_section): New method definitions.
12985         (Output_section::is_input_address_mapped,
12986         Output_section::output_offset, Output_section::output_address):
12987         Use output section data maps to speed up searching.
12988         (Output_section::find_starting_output_address): Add comments.
12989         (Output_section::do_write,
12990         Output_section::write_to_postprocessing_buffer): Do code-fill
12991         generation as appropriate.
12992         (Output_section::get_input_sections): Invalidate relaxed input section
12993         map.
12994         (Output_section::restore_states): Adjust type of checkpoint .
12995         Invalidate relaxed input section map.
12996         * output.h (Output_merge_base): New class declaration.
12997         (Input_section_specifier): New class defintion.
12998         (class Output_relaxed_input_section) Change base class to
12999         Output_section_data_build.
13000         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
13001         base class initializer.
13002         (Output_section::add_relaxed_input_section): New method declaration.
13003         (Output_section::Input_section): Change visibility to protected.
13004         (Output_section::Input_section::relobj,
13005         Output_section::Input_section::shndx): Handle relaxed input sections.
13006         Output_section::input_sections) Change visibility to protected.  Also
13007         define overload to return a non-const pointer.
13008         (Output_section::Merge_section_properties): New class defintion.
13009         (Output_section::Merge_section_by_properties_map,
13010         Output_section::Output_section_data_by_input_section_map,
13011         Output_section::Relaxation_map): New types.
13012         (Output_section::relax_input_section): Rename method to
13013         Output_section::convert_input_sections_to_relaxed_sections and change
13014         interface to take a vector of relaxed section pointers.
13015         (Output_section::find_merge_section,
13016         Output_section::find_relaxed_input_section,
13017         Output_section::build_relaxation_map,
13018         Output_section::convert_input_sections_in_list_to_relaxed_sections):
13019         New method declarations.
13020         (Output_section::merge_section_map_
13021         Output_section::merge_section_by_properties_map_,
13022         Output_section::relaxed_input_section_map_,
13023         Output_section::is_relaxed_input_section_map_valid_,
13024         Output_section::generate_code_fills_at_write_): New data members.
13025         * script-sections.cc
13026         (Output_section_element_input::set_section_addresses): Call
13027         current_data_size and addralign methods of relaxed input sections.
13028         (Orphan_output_section::set_section_addresses): Call current_data_size
13029         and addralign methods of relaxed input sections.
13030         * symtab.cc (Symbol_table::compute_final_value): Extract template
13031         from the body of Symbol_table::sized_finalize_symbol.
13032         (Symbol_table::sized_finalized_symbol): Call
13033         Symbol_table::compute_final_value.
13034         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
13035         (Symbol_table::compute_final_value): New templated method declaration.
13036         * target.cc (Target::do_make_output_section): New method defintion.
13037         * target.h (Target::make_output_section): New method declaration.
13038         (Target::relax): Add more parameters for input objects, symbol table
13039         and layout.  Adjust call to do_relax.
13040         (Target::do_make_output_section): New method declaration.
13041         (Target::do_relax): Add parameters for input objects, symbol table
13042         and layout.
13043
13044 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13045
13046         * pread.c: Include stdio.h.
13047
13048 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13049
13050         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
13051         defined.
13052
13053 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13054
13055         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
13056         Change read_shndx type to unsigned int.
13057         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13058         int.
13059         (Sized_dwarf_line_info::read_line_mappings): Likewise.
13060         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
13061         Change read_shndx type to unsigned int.
13062         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13063         int.
13064         (Sized_dwarf_line_info::read_line_mappings): Likewise.
13065         * layout.cc (Layout::create_symtab_sections): Cast the result of
13066         local_symcount * symsize to off_t in the gold_assert.
13067
13068 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13069
13070         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
13071         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
13072         R_ARM_BASE_ABS.
13073         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
13074         (Arm_relocate_functions::thm_abs5): New function.
13075         (Arm_relocate_functions::abs12): New function.
13076         (Arm_relocate_functions::abs16): New function.
13077         (Arm_relocate_functions::base_abs): New function.
13078         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
13079         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
13080         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
13081         R_ARM_BASE_ABS.
13082         (Scan::global): Likewise.
13083         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
13084         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
13085         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
13086         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
13087         R_ARM_BASE_ABS.
13088
13089 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13090
13091         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
13092         (Arm_relocate_functions::movt_prel): New function.
13093         (Arm_relocate_functions::thm_movw_prel_nc): New function.
13094         (Arm_relocate_functions::thm_movt_prel): New function.
13095         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
13096         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
13097         (Scan::global, Relocate::relocate): Likewise.
13098         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13099
13100 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13101
13102         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
13103         Incremental_checker.
13104         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
13105         unsigned int.
13106         (class Incremental_inputs_header): New class.
13107         (Incremental_inputs_header_writer): Edit comment.
13108         (Incremental_inputs_entry): New class.
13109         (Incremental_inputs_entry_writer): Edit comment.
13110         (Sized_incremental_binary::do_find_incremental_inputs_section):
13111         Add *strtab_shndx parameter, fill it.
13112         (Sized_incremental_binary::do_check_inputs): New method.
13113         (Incremental_checker::can_incrementally_link_output_file): Use
13114         Sized_incremental_binary::check_inputs.
13115         (Incremental_inputs::report_command_line): Save command line in
13116         command_line_.
13117         * incremental.h:
13118         (Incremental_binary::find_incremental_inputs_section): New
13119         method.
13120         (Incremental_binary::do_find_incremental_inputs_section): Add
13121         strtab_shndx parameter.
13122         (Incremental_binary::do_check_inputs): New pure virtual method.
13123         (Sized_incremental_binary::do_check_inputs): Declare.
13124         (Incremental_checker::Incremental_checker): Add incremental_inputs
13125         parameter, use it to initialize incremental_inputs_.
13126         (Incremental_checker::incremental_inputs_): New field.
13127         (Incremental_checker::command_line): New method.
13128         (Incremental_checker::inputs): New method.
13129         (Incremental_checker::command_line_): New field.
13130
13131 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13132
13133         * incremental.cc: Include <cstdarg> and "target-select.h".
13134         (vexplain_no_incremental): New function.
13135         (explain_no_incremental): New function.
13136         (Incremental_binary::error): New method.
13137         (Sized_incremental_binary::do_find_incremental_inputs_section): New
13138         method.
13139         (make_sized_incremental_binary): New function.
13140         (open_incremental_binary): New function.
13141         (can_incrementally_link_file): Add checks if output is ELF and has
13142         inputs section.
13143         * incremental.h: Include "elfcpp_file.h" and "output.h".
13144         (Incremental_binary): New class.
13145         (Sized_incremental_binary): New class.
13146         (open_incremental_binary): Declare.
13147         * object.cc (is_elf_object): Use
13148         elfcpp::Elf_recognizer::is_elf_file.
13149         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
13150         * output.h (Output_file::filesize): New method.
13151
13152 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13153
13154         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
13155         New function.
13156         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
13157         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
13158         function.
13159         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
13160         function.
13161         (Arm_relocate_functions::movw_abs_nc): New function.
13162         (Arm_relocate_functions::movt_abs): New function.
13163         (Arm_relocate_functions::thm_movw_abs_nc): New function.
13164         (Arm_relocate_functions::thm_movt_abs): New function.
13165         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
13166         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
13167         (Scan::global): Likewise.
13168         (Relocate::relocate): Likewise.
13169         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13170
13171 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13172
13173         * arm.cc (Arm_relocate_functions::got_prel) New function.
13174         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
13175         (Relocate::relocate): Likewise.
13176         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13177
13178 2009-10-06  Ian Lance Taylor  <iant@google.com>
13179
13180         * options.h (class General_options): Define
13181         split_stack_adjust_size parameter.
13182         * object.h (class Object): Add uses_split_stack_ and
13183         has_no_split_stack_ fields.  Add uses_split_stack and
13184         has_no_split_stack accessor functions.  Declare
13185         handle_split_stack_section.
13186         (class Reloc_symbol_changes): Define.
13187         (class Sized_relobj): Define Function_offsets.  Declare
13188         split_stack_adjust, split_stack_adjust_reltype, and
13189         find_functions.
13190         * object.cc (Object::handle_split_stack_section): New function.
13191         (Sized_relobj::do_layout): Call handle_split_stack_section.
13192         * dynobj.cc (Sized_dynobj::do_layout): Call
13193         handle_split_stack_section.
13194         * reloc.cc (Sized_relobj::relocate_sections): Call
13195         split_stack_adjust for executable sections in split_stack
13196         objects.  Pass reloc_map to relocate_section.
13197         (Sized_relobj::split_stack_adjust): New function.
13198         (Sized_relobj::split_stack_adjust_reltype): New function.
13199         (Sized_relobj::find_functions): New function.
13200         * target-reloc.h: Include "object.h".
13201         (relocate_section): Add reloc_symbol_changes parameter.  Change
13202         all callers.
13203         * target.h (class Target): Add calls_non_split method.  Declare
13204         do_calls_non_split virtual method.  Declare match_view and
13205         set_view_to_nop.
13206         * target.cc: Include "elfcpp.h".
13207         (Target::do_calls_non_split): New function.
13208         (Target::match_view): New function.
13209         (Target::set_view_to_nop): New function.
13210         * gold.cc (queue_middle_tasks): Give an error if mixing
13211         split-stack and non-split-stack objects with -r.
13212         * i386.cc (Target_i386::relocate_section): Add
13213         reloc_symbol_changes parameter.
13214         (Target_i386::do_calls_non_split): New function.
13215         * x86_64.cc (Target_x86_64::relocate_section): Add
13216         reloc_symbol_changes parameter.
13217         (Target_x86_64::do_calls_non_split): New function.
13218         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
13219         parameter.
13220         * powerpc.cc (Target_powerpc::relocate_section): Add
13221         reloc_symbol_changes parameter.
13222         * sparc.cc (Target_sparc::relocate_section): Add
13223         reloc_symbol_changes parameter.
13224         * configure.ac: Call AM_CONDITIONAL for the default target.
13225         * configure: Rebuild.
13226         * testsuite/Makefile.am (TEST_AS): New variable.
13227         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
13228         (check_DATA): Add split_i386 and split_x86_64 files.
13229         (SPLIT_DEFSYMS): Define.
13230         (split_i386_[1234n].o): New targets.
13231         (split_i386_[124]): New targets.
13232         (split_i386_[1234r].stdout): New targets.
13233         (split_x86_64_[1234n].o): New targets.
13234         (split_x86_64_[124]): New targets.
13235         (split_x86_64_[1234r].stdout): New targets.
13236         (MOSTLYCLEANFILES): Add new executables.
13237         * testsuite/split_i386.sh: New file.
13238         * testsuite/split_x86_64.sh: New file.
13239         * testsuite/split_i386_1.s: New file.
13240         * testsuite/split_i386_2.s: New file.
13241         * testsuite/split_i386_3.s: New file.
13242         * testsuite/split_i386_4.s: New file.
13243         * testsuite/split_i386_n.s: New file.
13244         * testsuite/split_x86_64_1.s: New file.
13245         * testsuite/split_x86_64_2.s: New file.
13246         * testsuite/split_x86_64_3.s: New file.
13247         * testsuite/split_x86_64_4.s: New file.
13248         * testsuite/split_x86_64_n.s: New file.
13249         * testsuite/testfile.cc (Target_test): Update relocation_section
13250         function.
13251         * testsuite/Makefile.in: Rebuild.
13252
13253 2009-10-06  Ian Lance Taylor  <iant@google.com>
13254
13255         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
13256         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
13257         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
13258         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
13259         the address on ldo_addrs_.
13260         (Target_i386::Relocate::fix_up_ldo): New function.
13261
13262 2009-10-06   Rafael Espindola  <espindola@google.com>
13263
13264         * plugin.cc (add_input_library): New.
13265         (Plugin::load): Add add_input_library to tv.
13266         (Plugin_manager::add_input_file): Add the is_lib argument.
13267         (add_input_file): Update call to Plugin_manager::add_input_file.
13268         (add_input_library): New.
13269         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
13270
13271 2009-09-30  Doug Kwan  <dougkwan@google.com>
13272
13273         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
13274         symbol and call Symbol::may_need_copy_reloc to determine if
13275         a copy reloc is needed.
13276         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
13277         nocopyreloc is given in command line.
13278         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
13279         given in command line.
13280         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
13281         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
13282         of the removed Target_i386::may_need_copy_reloc.
13283         * options.h (copyreloc): New option with default value false.
13284         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13285         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
13286         instead of the removed Target_powerpc::may_need_copy_reloc.
13287         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13288         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
13289         instead of the removed Target_sparc::may_need_copy_reloc.
13290         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
13291         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
13292         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
13293         instead of the removed Target_x86_64::may_need_copy_reloc.
13294
13295 2009-09-30  Ian Lance Taylor  <iant@google.com>
13296
13297         * object.h (class Object): Remove target_ field, and target,
13298         sized_target, and set_target methods.
13299         (Object::sized_target): Remove.
13300         (class Sized_relobj): Update declarations.  Remove sized_target.
13301         * object.cc (Sized_relobj::setup): Remove target parameter.
13302         Change all callers.
13303         (Input_objects::add_object): Don't do anything with the target.
13304         (make_elf_sized_object): Add punconfigured parameter.  Change all
13305         callers.  Set or test parameter target.
13306         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
13307         Change all callers.
13308         * parameters.cc (Parameters::set_target): Change parameter type to
13309         be non-const.
13310         (Parameters::default_target): Remove.
13311         (set_parameters_target): Change parameter type to be non-const.
13312         (parameters_force_valid_target): New function.
13313         (parameters_clear_target): New function.
13314         * parameters.h (class Parameters): Update declarations.  Remove
13315         default_target method.  Add sized_target and clear_target
13316         methods.  Change target_ to be non-const.
13317         (set_parameters_target): Update declaration.
13318         (parameters_force_valid_target): Declare.
13319         (parameters_clear_target): Declare.
13320         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
13321         as NULL if we aren't searching.
13322         (Add_symbols::run): Don't check for compatible target.
13323         * fileread.cc (Input_file::open_binary): Call
13324         parameters_force_valid_target.
13325         * gold.cc (queue_middle_tasks): Likewise.
13326         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
13327         set_target on object.
13328         * dynobj.h (class Sized_dynobj): Update declarations.
13329         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
13330         make_elf_object returns NULL.
13331         (Archive::include_member): Don't check whether object target is
13332         compatible.
13333         * output.cc (Output_section::add_input_section): Get target from
13334         parameters.
13335         (Output_section::relax_input_section): Likewise.
13336         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
13337         parameters.
13338         (Sized_relobj::do_scan_relocs): Likewise.
13339         (Sized_relobj::relocate_sections): Likewise.
13340         * resolve.cc (Symbol_table::resolve): Likewise.
13341         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
13342         parameter.  Change all callers.
13343         (Symbol_table::add_from_object): Get target from parameters.
13344         (Symbol_table::add_from_relobj): Don't check object target.
13345         (Symbol_table::add_from_dynobj): Likewise.
13346         (Symbol_table::define_special_symbol): Get target from
13347         parameters.
13348         * symtab.h (class Symbol_table): Update declaration.
13349         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
13350         parameter.  Change all callers.  Clear parameter target.
13351         (Binary_test): Test target here.
13352         * testsuite/object_unittest.cc (gold_testsuite): Remove
13353         target_test_pointer parameter.  Change all callers.
13354         (Object_test): Test target here.
13355
13356 2009-09-26  Ian Lance Taylor  <iant@google.com>
13357
13358         * testsuite/initpri1.c: Don't try to use constructor priorities if
13359         compiling with gcc before 4.3.
13360
13361 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
13362
13363         * testsuite/retain_symbols_file_test.sh (check_present): Change
13364         output file name to retain_symbols_file_test.stdout.
13365         (check_absent): Likewise.
13366
13367 2009-09-18  Craig Silverstein  <csilvers@google.com>
13368
13369         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
13370         * options.cc: Include <cerrno> and <fstream>.
13371         (General_options::finalize): Parse -retain-symbols-file tag.
13372         * options.h: New flag.
13373         (General_options): New method should_retain_symbol, new
13374         variable symbols_to_retain.
13375         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
13376         should_retain_symbol map.
13377         * testsuite/Makefile.am (retain_symbols_file_test): New test.
13378         * testsuite/Makefile.in: Regenerate.
13379         * testsuite/retain_symbols_file_test.sh: New file.
13380
13381 2009-09-18  Nick Clifton  <nickc@redhat.com>
13382
13383         * po/es.po: Updated Spanish translation.
13384
13385 2009-09-17  Doug Kwan  <dougkwan@google.com>
13386
13387         * debug.h (DEBUG_RELAXATION): New constant.
13388         (DEBUG_ALL): Add DEBUG_RELAXATION.
13389         (debug_string_to_enum): Add relaxation debug option.
13390         * layout.cc
13391         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
13392         Layout::Relaxation_debug_check::read_sections,
13393         Layout::Relaxation_debug_check::read_sections): New method definitions.
13394         (Layout::Layout): Initialize data members
13395         record_output_section_data_from_scrips_,
13396         script_output_section_data_list_ and relaxation_debug_check_.
13397         (Layout::save_segments, Layout::restore_segments,
13398         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13399         Layout::relaxation_loop_body): New method definitions.
13400         (Layout::finalize): Support relaxation.  Move section layout code to
13401         Layout::relaxation_loop_body.
13402         (Layout::set_asection_address_from_script): Move code for orphan
13403         section placement out.
13404         (Layout::place_orphan_sections_in_script): New method definition.
13405         * layout.h (Output_segment_headers, Output_file_header):
13406         New forward class declarations.
13407         (Layout::~Layout): Define.
13408         (Layout::new_output_section_data_from_script): New method definition.
13409         (Layout::place_orphan_sections_in_script): New method declaration.
13410         (Layout::Segment_states): New type declaration.
13411         (Layout::save_segments, Layout::restore_segments,
13412         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13413         Layout::relaxation_loop_body): New method declarations.
13414         (Layout::Output_section_data_list): New type declaration.
13415         (Layout::Relaxation_debug_check): New class definition.
13416         (Layout::record_output_section_data_from_script_,
13417         Layout::script_output_section_data_list_, Layout::segment_states_,
13418         Layout::relaxation_debug_check_): New data members.
13419         * output.cc: (Output_section_headers::do_size): New method definition.
13420         (Output_section_headers::Output_section_headers): Move size
13421         computation to Output_section_headers::do_size.
13422         (Output_segment_headers::do_size): New method definition.
13423         (Output_file_header::Output_file_header): Move size computation to
13424         Output_file_header::do_size and call it.
13425         (Output_file_header::do_size): New method definition.
13426         (Output_data_group::Output_data_group): Adjust call to
13427         Output_section_data.
13428         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
13429         (Output_symtab_xindex::do_write): Add array bound check.
13430         (Output_section::Input_section::print_to_mapfile): Handle
13431         RELAXED_INPUT_SECTION_CODE.
13432         (Output_section::Output_section): Initialize data member checkpoint_.
13433         (Output_section::~Output_section): Delete checkpoint object pointed
13434         by checkpoint_.
13435         (Output_section::add_input_section): Always add an Input_section if
13436         relaxing.
13437         (Output_section::add_merge_input_section): Add assert.
13438         (Output_section::relax_input_section): New method definition.
13439         (Output_section::set_final_data_size): Set load address to zero for
13440         an unallocated section.
13441         (Output_section::do_address_and_file_offset_have_reset_values):
13442         New method definition.
13443         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
13444         Handle relaxed input section.
13445         (Output_section::sort_attached_input_sections): Checkpoint input
13446         section list lazily.
13447         (Output_section::get_input_sections): Change type of input_sections to
13448         list of Simple_input_section pointers.  Checkpoint input section list
13449         lazily.  Also handle relaxed input sections.
13450         (Output_section::add_input_section_for_script): Take a reference to
13451         a Simple_input_section object instead of Relobj pointer and section
13452         index as parameter.  Handle relaxed input sections.
13453         (Output_section::save_states, Output_section::restore_states): New
13454         method definitions.
13455         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
13456         (Output_data::is_data_size_fixed): New method definition.
13457         (Output_data::reset_addresss_and_file_offset): Do not reset data size
13458         if it is fixed.
13459         (Output_data::address_and_file_offset_have_reset_values): New method
13460         definition.
13461         (Output_data::do_address_and_file_offset_have_reset_values): New method
13462         definition.
13463         (Output_data::set_data_size): Check that data size is not fixed.
13464         (Output_data::fix_data_size): New method definition.
13465         (Output_data::is_data_size_fixed_): New data member.
13466         (Output_section_headers::set_final_data_size): New method definition.
13467         (Output_section_headers::do_size): New method declaration.
13468         (Output_segment_headers::set_final_data_size): New method definition.
13469         (Output_segment_headers::do_size): New method declaration.
13470         (Output_file_header::set_final_data_size)::New method definition.
13471         (Output_file_header::do_size)::New method declaration.
13472         (Output_section_data::Output_section_data): Add new parameter
13473         is_data_size_fixed and use it to fix data size.
13474         (Output_data_const::Output_data_const): Adjust call to base class
13475         constructor and fix data size.
13476         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
13477         base class constructor and fix data size.
13478         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
13479         base class constructor and fix data size.
13480         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
13481         class constructor and fix data size.
13482         (Output_data_group::set_final_data_size): New method definition.
13483         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
13484         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
13485         class constructor and fix data size.
13486         (Output_relaxed_input_section): New class definition.
13487         (Output_section::Simple_input_section): New class definition.
13488         (Output_section::get_input_sections): Adjust parameter list.
13489         (Output_section::add_input_section_for_script): Same.
13490         (Output_section::save_states, Output_section::restore_states,
13491         Output_section::do_address_and_file_offset_have_reset_values,
13492         (Output_section::Input_section::Input_section): Handle
13493         RELAXED_INPUT_SECTION_CODE.  Add new overload for
13494         Output_relaxed_input_section.
13495         (Output_section::Input_section::is_input_section,
13496         Output_section::Input_section::set_output_section): Handle relaxed
13497         input section.
13498         (Output_section::Input_section::is_relaxed_input_section,
13499         Output_section::Input_section::output_section_data,
13500         Output_section::Input_section::relaxed_input_section): New method
13501         definitions.
13502         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
13503         value.
13504         (Output_section::Input_section::u1_): Update comments.
13505         (Output_section::Input_section::u2_): Add new union member poris.
13506         (Output_section::Checkpoint_output_section): New classs definition.
13507         (Output_section::relax_input_section): New method declaration.
13508         (Output_section::checkpoint_): New data member.
13509         (Output_segment): Update comments.
13510         (Output_segment::Output_segment): Un-privatize copy constructor.
13511         (Output_segment::operator=): Un-privatize.
13512         * script-sections.cc (Output_section_element::Input_section_list):
13513         Change element type to Output_section::Simple_input_section.
13514         (Output_section_element_dot_assignment::set_section_addresses):
13515         Register output section data for relaxation clean up.
13516         (Output_data_exression::Output_data_expression): Adjust call to base
13517         constructor to fix data size.
13518         (Output_section_element_data::set_section_addresses): Register
13519         Output_data_expression object for relaxation clean up.
13520         (struct Input_section_info): Replace Relobj pointer and section index
13521         pair with Output_section::Simple_input_section and Convert struct to a
13522         class.
13523         (Input_section_sorter::operator()): Adjust access to
13524         Input_section_info data member to use accessors.
13525         (Output_section_element_input::set_section_addresses): Use layout
13526         parameter.  Adjust code to use Output_section::Simple_input_section
13527         and Input_secction_info classes.  Register filler for relaxation
13528         clean up.
13529         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
13530         and section index pair with Output_section::Simple_input_section
13531         class.  Adjust code accordingly.
13532         (Phdrs_element::release_segment): New method definition.
13533         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
13534         segment list.
13535         (Script_sections::release_segments): New method definition.
13536         * gold/script-sections.h (Script_sections::release_segments): New
13537         method declaration.
13538         * gold/target.h (Target::may_relax, Target::relax,
13539         Target::do_may_relax, Target::do_relax): New method definitions.
13540
13541 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13542
13543         * arm.cc (has_signed_unsigned_overflow): New function.
13544         (Arm_relocate_functions::abs8): New function.
13545         (Target_arm::Scan::local): Handle R_ARM_ABS8.
13546         (Target_arm::Scan::global): Likewise.
13547         (Target_arm::relocate::relocate): Likewise.
13548         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
13549         Likewise.
13550
13551 2009-09-16  Cary Coutant  <ccoutant@google.com>
13552
13553         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
13554         * testsuite/Makefile.in: Regenerate.
13555
13556 2009-09-11  Nick Clifton  <nickc@redhat.com>
13557
13558         * po/gold.pot: Updated by the Translation project.
13559
13560 2009-09-08  Cary Coutant  <ccoutant@google.com>
13561
13562         * output.cc (Output_file::open): Add execute permission to empty file.
13563         * testsuite/Makefile.am (permission_test): New test.
13564         * testsuite/Makefile.in: Regenerate.
13565
13566 2009-09-02  Ian Lance Taylor  <iant@google.com>
13567
13568         * output.cc (Output_file::resize): Call map_no_anonymous rather
13569         than map.
13570
13571 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
13572
13573         * gold.cc: Include "incremental.h".
13574         (queue_initial_tasks): Call Incremental_checker methods.
13575         * incremental.cc: Include "output.h".
13576         (Incremental_checker::can_incrementally_link_output_file): New
13577         method.
13578         * incremental.h (Incremental_checker): New class.
13579
13580         * output.cc (Output_file::open_for_modification): New method.
13581         (Output_file::map_anonymous): Changed return type to bool.  Record
13582         map in base_ field.
13583         (Output_file::map_no_anonymous): New method, broken out of map.
13584         (Output_file::map): Use map_no_anonymous and map_anonymous.
13585         * output.h (class Output_file): Update declarations.
13586
13587 2009-08-24  Cary Coutant  <ccoutant@google.com>
13588
13589         * options.h (Command_line::Pre_options): New class.
13590         (Command_line::pre_options): New member.
13591         * options.cc (gold::options::ready_to_register): New variable.
13592         (One_option::register_option): Do nothing if not registering options.
13593         Assert if same short option registered twice.
13594         (General_options::General_options): Turn off option registration when
13595         done constructing.
13596         (Command_line::Pre_options::Pre_options): New constructor.
13597
13598 2009-08-24  Cary Coutant  <ccoutant@google.com>
13599
13600         * options.h (General_options::no_keep_memory): Remove incorrect
13601         short option.
13602
13603 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
13604
13605         * Makefile.am (am__skiplex, am__skipyacc): New.
13606         * Makefile.in: Regenerate.
13607
13608 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
13609
13610         * Makefile.am (AM_CPPFLAGS): Renamed from ...
13611         (INCLUDES): ... this.
13612         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
13613         (AM_CPPFLAGS): Renamed from ...
13614         (INCLUDE): ... this.
13615         * Makefile.in, testsuite/Makefile.in: Regenerate.
13616
13617         * Makefile.in: Regenerate.
13618         * aclocal.m4: Likewise.
13619         * config.in: Likewise.
13620         * configure: Likewise.
13621         * testsuite/Makefile.in: Likewise.
13622
13623         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13624         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13625         * Makefile.in: Regenerate.
13626         * testsuite/Makefile.in: Regenerate.
13627
13628 2009-08-19  Cary Coutant  <ccoutant@google.com>
13629
13630         * resolve.cc (Symbol_table::resolve): Don't complain about defined
13631         symbols in shared libraries overridden by hidden or internal symbols
13632         in the main program.
13633
13634 2009-08-19  Chris Demetriou  <cgd@google.com>
13635
13636         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
13637         checking source file names in error messages.
13638
13639 2009-08-18  Doug Kwan  <dougkwan@google.com>
13640
13641         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
13642         an elcpp::Ehdr as parameter.  Adjust call to set_target.
13643         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
13644         an elfcpp::Ehdr as parameter.
13645         * object.cc (Object::set_target): Remove the version that looks up
13646         a target and sets it.
13647         (Sized_relobj::setup): Take a Target object instead of
13648         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
13649         (make_elf_sized_object): Find target and ask target to
13650         make an ELF object.
13651         * object.h: (Object::set_target): Remove the version that looks up
13652         a target and sets it.
13653         (Sized_relobj::setup): Take a Target object instead of
13654         an elfcpp:Ehdr as parameter.
13655         * target.cc: Include dynobj.h.
13656         (Target::do_make_elf_object_implementation): New.
13657         (Target::do_make_elf_object): New.
13658         * target.h (Target::make_elf_object): New template declaration.
13659         (Target::do_make_elf_object): New method declarations.
13660         (Target::do_make_elf_object_implementation): New template declaration.
13661
13662 2009-08-14  Ian Lance Taylor  <iant@google.com>
13663
13664         * gold.h (FUNCTION_NAME): Define.
13665         (gold_unreachable): Use FUNCTION_NAME.
13666
13667 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
13668
13669         * icf.cc (Icf::find_identical_sections): Issue a warning when a
13670         symbol in the --keep-unique list is not found.
13671
13672 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
13673
13674         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
13675         been maked as --keep-unique.
13676         (Icf::unfold_section): New function.
13677         * icf.h (Icf::unfold_section): New function.
13678         * options.h (General_options::keep_unique): New option.
13679         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
13680         * testsuite/Makefile.in: Regenerate.
13681         * testsuite/icf_keep_unique_test.sh: New file.
13682         * testsuite/icf_keep_unique_test.cc: New file.
13683
13684 2009-08-12  Cary Coutant  <ccoutant@google.com>
13685
13686         PR 10471
13687         * resolve.cc (Symbol_table::resolve): Check for references from
13688         dynamic objects to hidden and internal symbols.
13689         * testsuite/Makefile.am (hidden_test.sh): New test.
13690         * testsuite/Makefile.in: Regenerate.
13691         * testsuite/hidden_test.sh: New script.
13692         * testsuite/hidden_test_1.c: New test source.
13693         * testsuite/hidden_test_main.c: New test source.
13694
13695 2009-08-11  Doug Kwan  <dougkwan@google.com>
13696
13697         * arm.cc: Update comments.
13698         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
13699         segment to locate the .ARM.exidx section if present.
13700
13701 2009-08-09  Doug Kwan  <dougkwan@google.com>
13702
13703         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
13704         patch.
13705
13706 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
13707         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
13708         compiler warnings.
13709
13710 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
13711
13712         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
13713         valid tls_segment only for non-debug-section relocations.
13714         * testsuite/Makefile.am: Add gc_tls_test.
13715         * testsuite/Makefile.in: Regenerate.
13716         * testsuite/gc_tls_test.cc: New file.
13717         * testsuite/gc_tls_test.sh: New file.
13718
13719 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
13720
13721         * icf.cc: New file.
13722         * icf.h: New file.
13723         * Makefile.am (CCFILES): Add icf.cc.
13724         (HFILES): Add icf.h
13725         * Makefile.in: Regenerate.
13726         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
13727         * gc.h (gc_process_relocs): Populate lists used by icf to contain
13728         section, symbol and addend information for the relocs.
13729         * gold.cc (queue_middle_tasks): Call identical code folding.
13730         * gold.h: Add defines for multimap.
13731         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
13732         to the call of finalize_local_symbols.
13733         * main.cc (main): Create object of class Icf.
13734         * object.cc (Sized_relobj::do_layout): Allow this function to be
13735         called twice during icf.
13736         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
13737         to sections marked as identical by icf.
13738         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
13739         when available.
13740         (Sized_relobj::do_section_entsize): New function.
13741         * object.h (Object::section_entsize): New function.
13742         (Object::do_section_entsize): New pure virtual function.
13743         (Relobj::finalize_local_symbols): Add new parameter.
13744         (Relobj::do_section_entsize): New function.
13745         * options.h (General_options::icf): New option.
13746         (General_options::icf_iterations): New option.
13747         (General_options::print_icf_sections): New option.
13748         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
13749         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
13750         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
13751         icf.
13752         * symtab.cc (Symbol_table::is_section_folded): New function.
13753         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
13754         to sections marked as identical by icf.
13755         * symtab.h (Symbol_table::set_icf): New function.
13756         (Symbol_table::icf): New function.
13757         (Symbol_table::is_section_folded): New function.
13758         (Symbol_table::icf_): New data member.
13759         * target-reloc.h (relocate_section): Ignore sections folded by icf.
13760         * testsuite/Makefile.am: Add commands to build icf_test.
13761         * testsuite/Makefile.in: Regenerate.
13762         * testsuite/icf_test.sh: New file.
13763         * testsuite/icf_test.cc: New file.
13764
13765 2009-07-24  Chris Demetriou  <cgd@google.com>
13766
13767         * layout.cc (is_compressible_debug_section): Fix incorrect
13768         comment about compressed section names.
13769
13770 2009-07-20  Ian Lance Taylor  <ian@airs.com>
13771
13772         PR 10419
13773         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
13774
13775 2009-07-16  Ian Lance Taylor  <iant@google.com>
13776
13777         PR 10400
13778         * layout.h: #include <map>.
13779         (class Kept_section): Change from struct to class.  Add accessors
13780         and setters.  Add section size to Comdat_group mapping.  Change
13781         Comdat_group to std::map.  Add is_comdat_ field.  Add
13782         linkonce_size field in union.
13783         (class Layout): Update declaration of find_or_add_kept_section.
13784         Don't declare find_kept_object.
13785         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
13786         parameter.  Add object, shndx, is_comdat, and is_group_name
13787         parameters.  Change all callers.  Adjust for new Kept_section.
13788         (Layout::find_kept_object): Remove.
13789         * object.cc (Sized_relobj::include_section_group): Update use of
13790         Kept_section.  Rename secnum to shndx.  Only record
13791         Kept_comdat_section if sections are the same size.
13792         (Sized_relobj::include_linkonce_section): Update use of
13793         Kept_section.  Only record Kept_comdat_section if sections are the
13794         same size.  Set size of linkonce section.
13795         (Sized_relobj::map_to_kept_section): Update call to
13796         get_kept_comdat_section.
13797         * object.h (class Sized_relobj): Rename fields in
13798         Kept_comdat_section to drop trailing underscores; change object
13799         field to Relobj*.  Change Kept_comdat_section_table to store
13800         struct rather than pointer.
13801         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
13802         Add kept_object and kept_shndx parameters.  Change all callers.
13803         (Sized_relobj::get_kept_comdat_section): Change return type to
13804         bool.  Add kept_object and kept_shndx parameters.  Change all
13805         callers.
13806         * plugin.cc (Pluginobj::include_comdat_group): Update call to
13807         Layout::find_or_add_kept_section.
13808
13809 2009-07-09  Ian Lance Taylor  <iant@google.com>
13810
13811         * merge.cc (Object_merge_map::initialize_input_to_output_map):
13812         Reserve space in the hash table.
13813
13814 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
13815
13816         * fileread.cc (File_read::get_mtime): New method.
13817         * fileread.h (Timespec): New structure.
13818         (File_read::get_mtime): New method.
13819         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
13820         Renamed from timestamp_nsec.
13821         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
13822         Elf_Xword.
13823         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
13824         timestamp_nsec.
13825         (Incremental_inputs::report_archive): Save mtime; style fix.
13826         (Incremental_inputs::report_obejct): Save mtime; style fix.
13827         (Incremental_inputs::report_script): Save mtime; style fix.
13828         (Incremental_inputs::finalize_inputs): Style fix.
13829         (Incremental_inputs::finalize): Style fix.
13830         (Incremental_inputs::create_input_section_data): Store inputs
13831         mtime.
13832         * incremental.h (Incremental_inputs::report_script): Add mtime
13833         argument.
13834         (Incremental_inputs::Input_info::Input_info): Intialize only one
13835         union member.
13836         (Incremental_inputs::Input_info::archive): Move to nameless
13837         union.
13838         (Incremental_inputs::Input_info::obejct): Move to nameless union.
13839         (Incremental_inputs::Input_info::script): Move to nameless union.
13840         (Incremental_inputs::mtime): New field.
13841         * script.cc (read_input_script): Pass file mtime to
13842         Incremental_input.
13843         * script.h (Script_info::inputs): Style fix.
13844
13845 2009-07-01  Ian Lance Taylor  <ian@airs.com>
13846
13847         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
13848         instead of 32.
13849
13850 2009-06-24  Ian Lance Taylor  <iant@google.com>
13851
13852         PR 10156
13853         * layout.cc (Layout::choose_output_section): If we find an
13854         existing section, update the flags.
13855         (Layout::create_notes): New function, broken out of
13856         Layout::finalize.
13857         (Layout::finalize): Don't create note sections.
13858         (Layout::create_note): Don't crash if linker script discards
13859         section.
13860         (Layout::create_gold_note): Likewise.
13861         (Layout::create_build_id): Likewise.  Don't set
13862         after_input_sections on the section.
13863         (Layout::create_executable_stack_info): Remove target parameter.
13864         Change caller.
13865         * layout.h (class Layout): Declare create_notes.  Update
13866         declaration of create_executable_stack_info.
13867         * gold.cc (queue_middle_tasks): Call create_notes.
13868         * output.cc (Output_section::update_flags_for_input_section): Move
13869         here from output.h.  If SHF_ALLOC flag is newly set, mark address
13870         invalid.
13871         * output.h (Output_data::mark_address_invalid): New function.
13872         (class Output_section): Only declare, not define,
13873         update_flags_for_input_section.  Remove set_flags.
13874
13875 2009-06-24  Ian Lance Taylor  <iant@google.com>
13876
13877         * script-sections.cc (Output_section_definition::
13878         set_section_addresses): Rename shadowing local load_address to
13879         laddr.
13880
13881 2009-06-24  Ian Lance Taylor  <iant@google.com>
13882
13883         PR 10244
13884         * reloc.cc (relocate_sections): Skip empty relocation sections.
13885
13886 2009-06-23  Ian Lance Taylor  <iant@google.com>
13887
13888         PR 10156
13889         * layout.cc (Layout::create_note): Use choose_output_section
13890         rather than make_output_section.
13891
13892 2009-06-23  Ian Lance Taylor  <iant@google.com>
13893
13894         PR 10237
13895         * options.cc (General_options::parse_V): Set printed_version_.
13896         (General_options::General_options): Initialize printed_version_.
13897         * options.h (class General_options): Add printed_version_ field.
13898         * gold.cc (queue_initial_tasks): If there are no input files,
13899         don't give a fatal error if we printed the version information.
13900         (queue_middle_tasks): If using -r with a shared object, give a
13901         fatal error rather than an ordinary error.
13902
13903 2009-06-23  Ian Lance Taylor  <iant@google.com>
13904
13905         PR 10219
13906         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
13907         (Layout::make_output_section): Set have_stabstr_section_ if we see
13908         a .stab*str section.
13909         (Layout::finalize): Call link_stabs_sections.
13910         (Layout::link_stabs_sections): New file.
13911         * layout.h (class Layout): Add have_stabstr_section_ field.
13912         Declare link_stabs_sections.
13913
13914 2009-06-23  Doug Kwan  <dougkwan@google.com>
13915
13916         * Makefile.am (libgold_a_LIBADD): New.
13917         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
13918         * Makefile.in: Regenerate.
13919         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
13920         * configure: Regenerate.
13921         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
13922         * fileread.cc: Include sys/state.h
13923         * gold.h: Declare memmem and strndup if found missing.
13924         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
13925
13926 2009-06-23  Ian Lance Taylor  <iant@google.com>
13927
13928         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
13929         * configure: Rebuild.
13930
13931 2009-06-23  Ian Lance Taylor  <iant@google.com>
13932
13933         PR 10147
13934         * object.cc (Object::section_contents): Don't try to get a view if
13935         the section has length zero.
13936         (Object::handle_gnu_warning_section): If the section is empty, use
13937         the name of the section as the warning.
13938
13939 2009-06-23  Ian Lance Taylor  <iant@google.com>
13940
13941         PR 10133
13942         * stringpool.h (class Stringpool_template): Add optimize_ field.
13943         (Stringpool_template::set_optimize): New function.
13944         * stringpool.cc (Stringpool_template::Stringpool_template):
13945         Initialize optimize_ field.
13946         (Stringpool_template::set_string_offsets): Test local optimize
13947         fild rather than parameter.
13948         * layout.cc (Layout::Layout): Call set_optimize on the section
13949         name stringpool.
13950
13951 2009-06-22  Ian Lance Taylor  <iant@google.com>
13952
13953         PR 10030
13954         * yyscript.y: Parse TARGET.
13955         * script.cc (script_set_target): New function.
13956         * script-c.h (script_set_target): Declare.
13957         * options.cc (General_options::string_to_object_format): Rename
13958         from string_to_object_format in anonymous namespace.  Change
13959         callers.
13960         * options.h (class General_options): Declare
13961         string_to_object_format.
13962
13963 2009-06-22  Ian Lance Taylor  <iant@google.com>
13964
13965         * script-sections.cc (Script_sections::create_segments): Don't put
13966         program headers in a PT_LOAD segment if -n or -N.
13967
13968 2009-06-22  Ian Lance Taylor  <iant@google.com>
13969
13970         PR 10141
13971         * options.h (class General_options): Add -z lazy and -z now.  Sort
13972         -z options into alphabetical order.
13973         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
13974
13975 2009-06-21  Ian Lance Taylor  <iant@google.com>
13976
13977         * layout.cc (Layout::make_output_section): Call
13978         Target::new_output_section.
13979         (Layout::attach_allocated_section_to_segment): Put large section
13980         sections in a separate load segment with the large segment flag
13981         set.
13982         (Layout::segment_precedes): Sort large data segments after other
13983         load segments.
13984         (align_file_offset): New static function.
13985         (Layout::set_segment_offsets): Use align_file_offset.
13986         * output.h (class Output_section): Add is_small_section_ and
13987         is_large_section_ fields.
13988         (Output_section::is_small_section): New function.
13989         (Output_section::set_is_small_section):  New function.
13990         (Output_section::is_large_section): New function.
13991         (Output_section::set_is_large_section): New function.
13992         (Output_section::is_large_data_section): New function.
13993         (class Output_segment): Add is_large_data_segment_ field.
13994         (Output_segment::is_large_data_segment): New function.
13995         (Output_segment::set_is_large_data_segment): New function.
13996         * output.cc (Output_section::Output_section): Initialize new
13997         fields.
13998         (Output_segment::Output_segment): Likewise.
13999         (Output_segment::add_output_section): Add assertion that large
14000         data sections always go in large data segments.  Force small data
14001         sections to the end of the list of data sections.  Force small BSS
14002         sections to the start of the list of BSS sections.  For large BSS
14003         sections to the end of the list of BSS sections.
14004         * symtab.h (class Symbol): Declare is_common_shndx.
14005         (Symbol::is_defined): Check Symbol::is_common_shndx.
14006         (Symbol::is_common): Likewise.
14007         (class Symbol_table): Define enum Commons_section_type.  Update
14008         declarations.  Add small_commons_ and large_commons_ fields.
14009         * symtab.cc (Symbol::is_common_shndx): New function.
14010         (Symbol_table::Symbol_table): Initialize new fields.
14011         (Symbol_table::add_from_object): Put small and large common
14012         symbols in the right list.
14013         (Symbol_table::sized_finalized_symbol): Check
14014         Symbol::is_common_shndx.
14015         (Symbol_table::sized_write_globals): Likewise.
14016         * common.cc (Symbol_table::do_allocate_commons): Allocate new
14017         common symbol lists.  Don't call do_allocate_commons_list if the
14018         list is empty.
14019         (Symbol_table::do_allocate_commons_list): Remove is_tls
14020         parameter.  Add comons_section_type parameter.  Change all
14021         callers.  Handle small and large common symbols.
14022         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
14023         Symbol::is_common_shndx.
14024         * resolve.cc (symbol_to_bits): Likewise.
14025         * target.h (Target::small_common_shndx): New function.
14026         (Target::small_common_section_flags): New function.
14027         (Target::large_common_shndx): New function.
14028         (Target::large_common_section_flags): New function.
14029         (Target::new_output_section): New function.
14030         (Target::Target_info): Add small_common_shndx, large_common_shndx,
14031         small_common_section_flags, and large_common_section_flags
14032         fields.
14033         (Target::do_new_output_section): New virtual function.
14034         * arm.cc (Target_arm::arm_info): Initialize new fields.
14035         * i386.cc (Target_i386::i386_info): Likewise.
14036         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
14037         Likewise.
14038         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
14039         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14040         (Target_x86_64::do_new_output_section): New function.
14041         * configure.ac: Define conditional MCMODEL_MEDIUM.
14042         * testsuite/Makefile.am (check_PROGRAMS): Add large.
14043         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
14044         (large_LDFLAGS): Define.
14045         * testsuite/large.c: New file.
14046         * testsuite/testfile.cc (Target_test::test_target_info):
14047         Initialize new fields.
14048         * configure, testsuite/Makefile.in: Rebuild.
14049
14050 2009-06-05  Doug Kwan  <dougkwan@google.com>
14051
14052         * Makefile.am (CCFILES): Add target.cc.
14053         * Makefile.in: Regenerate.
14054         * i386.cc (class Target_i386): Define new virtual method to
14055         override do_is_local_label_name in parent.
14056         * object.cc (Sized_relobj::do_count_local_symbols): Discard
14057         local symbols if --discard-locals or -X is given.
14058         * options.h (class General_options): Declare new options
14059         '--discard-locals' and '-X' for discarding locals.
14060         * target.h (class Target): Define new methods is_local_label_name.
14061         Declare new virtual method do_is_local_label_name.
14062         * target.cc: New file.
14063         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
14064         (check_SCRIPTS): Add discard_locals_test.sh.
14065         (check_DATA): Add discard_local_tests.syms.
14066         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
14067         (discard_local_tests.syms, discard_locals_test.o): New make rules.
14068         * testsuite/Makefile.in: Regenerate.
14069         * testsuite/discard_locals_test.c: New file.
14070         * testsuite/discard_locals_test.sh: Same.
14071
14072 2009-06-05  Doug Kwan  <dougkwan@google.com>
14073
14074         * object.cc (Sized_relobj::Sized_relobj): Initialize
14075         discarded_eh_frame_shndx_ to -1U.
14076         (Sized_relobj::do_layout): Record index of a discard .eh_frame
14077         section.
14078         (Sized_relobj::do_count_local_symbols): Skip local symbols in
14079         a discarded .eh_frame section.
14080         (Sized_relobj::do_finalize_local_symbols): Ditto.
14081         * object.h (class Sized_relobj): Declare new member
14082         discarded_eh_frame_shndx_.
14083         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
14084         (local_labels_test.o, local_labels_test): New rules.
14085         * testsuite/Makefile.in: Regenerate.
14086
14087 2009-06-04  Doug Kwan  <dougkwan@google.com>
14088
14089         * layout.cc (Layout::section_name_mapping): Add mapping for
14090         special ARM sections.
14091
14092 2009-06-03  Doug Kwan  <dougkwan@google.com>
14093
14094         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
14095         (utils::has_overflow): Same.
14096
14097 2009-06-03  Ian Lance Taylor  <iant@google.com>
14098
14099         * layout.cc (Layout::section_name_mapping): New array, replacing
14100         Layout::linkonce_mapping.
14101         (Layout::section_name_mapping_count): New variable, replacing
14102         Layout::linkonce_mapping_count.
14103         (Layout::linkonce_output_name): Remove.
14104         (Layout::output_section_name): Rewrite.
14105         * layout.h (class Layout): Rename Linkonce_mapping to
14106         Section_name_mapping, linkonce_mapping to section_name_mapping,
14107         linkonce_mapping_count to section_name_mapping_count.  Don't
14108         declare linkonce_output_name.
14109
14110 2009-06-03  Doug Kwan  <dougkwan@google.com>
14111
14112         * gold/arm.cc (namespace utils): New.
14113         (Target_arm::reloc_is_non_pic): Define new method.
14114         (class Arm_relocate_functions): New.
14115         (Target_arm::Relocate::relocate): Handle relocation types used by
14116         Android.
14117
14118 2009-06-03  Ian Lance Taylor  <iant@google.com>
14119
14120         * arm.cc (Target_arm::scan::global): Use || instead of |.
14121
14122 2009-06-02  Doug Kwan  <dougkwan@google.com>
14123
14124         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
14125         issued_non_pic_error_.
14126         (class Target_arm::Scan): Declare new method check_non_pic.
14127         Define new method symbol_needs_plt_entry.
14128         Declare new data member issued_non_pic_error_.
14129         (class Target_arm::Relocate): Declare new method
14130         should_apply_static_reloc.
14131         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
14132         (Target_arm::Scan::check_non_pic): Define new method.
14133         (Target_arm::Scan::local): Handle a small subset of reloc types used
14134         by Android.
14135         (Target_arm::Scan::local): Same.
14136         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
14137
14138 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
14139
14140         * incremental.cc (Incremental_inputs::report_command_line): Filter
14141         out --incremental-* options.
14142
14143 2009-05-29  Doug Kwan  <dougkwan@google.com>
14144
14145         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
14146         template class.
14147         (class Target_arm): Update comment.
14148         (Target_arm::Target_arm): Initialize new data members GOT_,
14149         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
14150         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
14151         and Target_arm::rel_dyn_section.
14152         Declare new_enum Target_arm::Got_type.
14153         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
14154         and DYNBSS_.
14155         Update commments for member do_dynsym_value.
14156         (Target_arm::got_size, Target_arm::plt_section,
14157         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
14158         new methods inside class defintion.
14159         (Target_arm::got_section): Define new method.
14160         (Target_arm::rel_dyn_section): Same.
14161         (Output_data_plt_arm): New template class.
14162         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
14163         (Output_data_plt_arm:do_adjust_output_section): Define new method.
14164         (Output_data_plt_arm::add_entry): Same.
14165         (Output_data_plt_arm::first_plt_entry): Define new
14166         static data member for PLT instruction template.
14167         (Output_data_plt_arm::plt_entry): Same.
14168         (Output_data_plt_arm::do_write): Define new method.
14169         (Target_arm::make_plt_entry): Same.
14170         (Target_arm::do_finalize_sections): Same.
14171         (Target_arm::do_dynsym_value): Same.
14172
14173 2009-05-28  Doug Kwan  <dougkwan@google.com>
14174
14175         * Makefile.am (TARGETSOURCES): Add arm.cc.
14176         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
14177         * Makefile.in: Regenerate.
14178         * arm.cc: New file.
14179         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
14180
14181 2009-05-26  Doug Kwan  <dougkwan@google.com>
14182
14183         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
14184         (General_options::check_excluded_libs): Strip off directories in
14185         archive name before matching like GNU ld does.
14186         * testsuite/Makefile.am (MOSTLYCLEANFILES,
14187         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
14188         (exclude_libs_test_LDFLAGS): Add linker option
14189         -Wl,--exclude-libs,libexclude_libs_test_3
14190         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
14191         an explicit archive without using -l.
14192         (alt/libexclude_libs_test_3.a): New make rule.
14193         * testsuite/Makefile.in: Regenerate.
14194         * testsuite/exclude_libs_test.c : Declare lib3_default().
14195         (main): Call it.
14196         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
14197         * exclude_libs_test_3.c: New file.
14198
14199 2009-05-26  Nick Clifton  <nickc@redhat.com>
14200
14201         * po/id.po: New Indonesian translation.
14202         * po/gold.pot: Updated template file.
14203
14204 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
14205
14206         * testsuite/Makefile.am: Add -ffunction-sections to compile
14207         gc_comdat_test files.  Add -Wl,--gc-sections to build
14208         gc_comdat_test.
14209         * testsuite/Makefile.in: Regenerate.
14210         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
14211
14212 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
14213
14214         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
14215         kept comdat section was garbage collected.
14216         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
14217         * testsuite/Makefile.in: Regenerate.
14218         * testsuite/gc_comdat_test.sh: New file.
14219         * testsuite/gc_comdat_test_1.cc: New file.
14220         * testsuite/gc_comdat_test_2.cc: New file.
14221
14222 2009-05-19  Doug Kwan  <dougkwan@google.com>
14223
14224         * archive.cc (Archive::Archive): Move constructor from archive.h
14225         to here.  Initialize no_export_.
14226         (Archive::get_elf_object_for_member): Set no_export flag of object.
14227         * archive.h (Archive::Archive): Move constructor body to
14228         archive.cc.
14229         (Archive::no_export): New method.
14230         (Archive::no_export_): New field.
14231         * object.h (Object::Object): Initialize no_export_ to false.
14232         (Object::no_export, Object::set_no_export): New methods.
14233         (Object::no_export_): New field.
14234         * options.cc (General_options::parse_exclude_libs): New method.
14235         (General_options::check_excluded_libs) Same.
14236         * options.h (exclude_libs): New option.
14237         (General_options::check_excluded_libs): New method declaration.
14238         (General_options::excluded_libs_): New field.
14239         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
14240         default or protected visibility if an object has no-export flag set.
14241         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
14242         (check_SCRIPTS): Add exclude_libs_test.sh.
14243         (check_DATA): Add exclude_libs_test.syms.
14244         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
14245         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
14246         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
14247         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
14248         (exclude_libs_test.syms, libexclude_libs_test_1.a,
14249         libexclude_libs_test_2.a): New rules.
14250         * testsuite/Makefile.in: Regenerate.
14251         * testsuite/exclude_libs_test.c: New file.
14252         * testsuite/exclude_libs_test.sh: Ditto.
14253         * testsuite/exclude_libs_test_1.c: Ditto.
14254         * testsuite/exclude_libs_test_2.c: Ditto.
14255
14256 2009-05-15  Ian Lance Taylor  <iant@google.com>
14257
14258         * configure.ac: Check for declarations for cases where libiberty.h
14259         checks HAVE_DECL_xxx.
14260         * configure, config.in: Rebuild.
14261
14262 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
14263
14264         * gold.h (Incremental_argument_list): Remove (invalid) forward
14265         declaration.
14266         * incremental.cc (Incremental_inputs::report_achive): New method.
14267         (Incremental_inputs::report_object): New method.
14268         (Incremental_inputs::report_script): New method.
14269         (Incremental_inputs::finalize_inputs): New method.
14270         (Incremental_inputs::finalize): Call finalize_inputs().
14271         (Incremental_inputs::sized_create_incremental_inputs_section_data):
14272         Create inputs entries.
14273         * incremental.h (Incremental_input_type): New enum.
14274         (Incremental_inputs::Incremental_input): Initialize new fields.
14275         (Incremental_inputs::report_inputs): New method.
14276         (Incremental_inputs::report_achive): New method.
14277         (Incremental_inputs::report_object): New method.
14278         (Incremental_inputs::report_script): New method.
14279         (Incremental_inputs::finalize_inputs): New method.
14280         (Incremental_inputs::Input_info): New struct.
14281         (Incremental_inputs::Input_info_map): New typedef.
14282         (Incremental_inputs::lock_): New field.
14283         (Incremental_inputs::Inputs_): New field.
14284         (Incremental_inputs::Inputs_map): New field.
14285         * main.cc (main): Call Incremental_input::report_inputs.
14286         * options.h (Input_argument_list): Typedef moved from
14287         Input_arguments.
14288         (Input_file_group::Files): Remove, use ::Input_argument_list.
14289         (Input_file_group::Input_argument_list): Remove, use
14290         ::Input_argument_list.
14291         * plugin.cc (Plugin_manager::add_input_file): Add error in
14292         incremental build.
14293         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
14294         functions.
14295         * script.cc (read_input_script): Call
14296         Incremental_input::report_script.
14297         * script.h (Script_info): New class.
14298
14299 2009-04-27  Ian Lance Taylor  <iant@google.com>
14300
14301         * x86_64.cc (do_adjust_output_section): Set entsize to
14302         plt_entry_size.
14303
14304 2009-04-23  Elliott Hughes  <enh@google.com>
14305
14306         * output.cc (Output_file::close): After short writes, continue
14307         writing from the correct offset in the buffer being written.
14308
14309 2009-04-23  Chris Demetriou  <cgd@google.com>
14310
14311         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
14312         * configure: Regenerate.
14313         * config.in: Regenerate.
14314         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
14315         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
14316
14317 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
14318
14319         * incremental.cc (Incremental_inputs_header_data): Renamed from
14320         Incremental_input_header_data.
14321         (Incremental_inputs_header_data::data_size): New field.
14322         (Incremental_inputs_header_data::put_input_file_count): Renamed
14323         from input_file_count.
14324         (Incremental_inputs_header_data::put_command_line_offset): Renamed
14325         from command_line_offset.
14326         (Incremental_inputs_header_data::put_reserved): Renamed from
14327         put_reserved.
14328         (Incremental_inputs_entry_data): Renamed from
14329         Incremental_input_entry_data.
14330         (Incremental_inputs_entry_data::data_size): New field.
14331         (Incremental_inputs::report_command_line): New method.
14332         (Incremental_inputs::finalize): New method.
14333         (Incremental_inputs::create_incremental_inputs_data): New method.
14334         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
14335         * incremental.h: New file.
14336         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
14337         (Layout::finalize): Create incremental inputs section in
14338         incremental builds.
14339         (Layout::create_incremental_info_sections): New method.
14340         * layout.h (Layout::incremental_inputs): New method.
14341         (Layout::create_incremental_info_sections): New method.
14342         (Layout::incremental_inputs_): New field.
14343         * main.cc (main): Notify Incremental_input of the command line.
14344
14345 2009-04-01  Ian Lance Taylor  <iant@google.com>
14346             Mikolaj Zalewski  <mikolajz@google.com>
14347
14348         * gold.h (reserve_unordered_map): Define, three versions, one for
14349         each version of Unordered_map.
14350         * layout.cc (Layout::Layout): Remove options parameter.  Add
14351         number_of_input_files parameter.  Don't initialize options_.
14352         Initialize number_of_input_files_ and resized_signatures_.  Move
14353         sections_are_attached_.
14354         (Layout::layout_group): Reserve space for group_signatures_.
14355         (Layout::find_or_add_kept_section): Change name parameter to be a
14356         reference.  Resize signatures_ map when it gets large enough.
14357         (Layout::layout_eh_frame): Use parameters->options() instead of
14358         this->options_.
14359         (Layout::make_output_section): Likewise.
14360         (Layout::attach_allocated_section_to_segment): Likewise.
14361         (Layout::finalize, Layout::create_executable_stack): Likewise.
14362         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
14363         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
14364         * layout.h (class Layout): Update declarations.  Remove options_
14365         field.  Add number_of_input_files_ and resized_signatures_
14366         fields.  Move sections_are_attached_ field.
14367         * main.cc (main): Pass number of input files to Layout
14368         constructor.  Don't pass options.
14369
14370 2009-03-30  Ian Lance Taylor  <iant@google.com>
14371
14372         * ffsll.c (ffsll): Correct implementation.
14373
14374 2009-03-27  Ian Lance Taylor  <iant@google.com>
14375
14376         * ffsll.c: New file.
14377         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
14378         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
14379         * ftruncate.c (ftruncate): Declare before definition.
14380         * mremap.c (mremap): Likewise.
14381         * pread.c (pread): Likewise.
14382         * configure, Makefile.in, config.in: Rebuild.
14383
14384         * mremap.c: New file.
14385         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
14386         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
14387         (mremap): Declare if HAVE_MREMAP is not defined.
14388         * configure, Makefile.in, config.in: Rebuild.
14389
14390 2009-03-27  Cary Coutant  <ccoutant@google.com>
14391
14392         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
14393         position independent.
14394         * sparc.cc (Target_sparc::check_non_pic): Likewise.
14395         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
14396
14397 2009-03-24  Cary Coutant  <ccoutant@google.com>
14398
14399         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
14400         an executable.
14401         (needs_dynamic_reloc): Likewise.
14402
14403 2009-03-24  Ian Lance Taylor  <iant@google.com>
14404
14405         * yyscript.y (file_cmd): Recognize EXTERN.
14406         (extern_name_list, extern_name_list_body): New nonterminals.
14407         * script.cc (script_add_extern): Define.
14408         * script-c.h (script_add_extern): Declare.
14409
14410 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
14411
14412         * object.cc (is_elf_object): Define.
14413         * object.h (is_elf_object): Declare.
14414         * archive.cc (Archive::get_elf_object_for_member): Call
14415         is_elf_object.
14416         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
14417
14418 2009-03-24  Elliott Hughes  <enh@google.com>
14419
14420         * output.cc (Output_file::map_anonymous): Define.
14421         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
14422         try an anonymous one.  Report the size if the mmap fails.
14423         * output.h (class Output_file): Declare map_anonymous.
14424
14425 2009-03-24  Ian Lance Taylor  <iant@google.com>
14426
14427         * target-select.cc (instantiate_target): Don't acquire the lock if
14428         the instantiated_target_ field has already been set.
14429
14430 2009-03-23  Ian Lance Taylor  <iant@google.com>
14431
14432         * gold-threads.h (class Initialize_lock): Define.
14433         * gold-threads.cc (class Initialize_lock_once): Define.
14434         (initialize_lock_control): New static variable.
14435         (initialize_lock_pointer): New static variable.
14436         (initialize_lock_once): New static function.
14437         (Initialize_lock::Initialize_lock): Define.
14438         (Initialize_lock::initialize): Define.
14439         * target-select.h: Include "gold-threads.h".
14440         (class Target_selector): Add lock_ and initialize_lock_ fields.
14441         Don't define instantiate_target, just declare it.
14442         * target-select.cc (Target_selector::Target_selector): Initialize
14443         new fields.
14444         (Target_selector::instantiate_target): Define.
14445         * descriptors.h: Include "gold-threads.h".
14446         (class Descriptors): Add initialize_lock_ field.
14447         * descriptors.cc (Descriptors::Descriptors): Initialize new
14448         field.
14449         (Descriptors::open): Use initialize_lock_ field
14450         * errors.h (class Errors): Add initialize_lock_ field.
14451         * errors.cc (Errors::Errors): Initialize new field.
14452         (Errors::initialize_lock): Use initialize_lock_ field.
14453         * powerpc.cc (class Target_selector_powerpc): Remove
14454         instantiated_target_ field.  In do_recognize call
14455         instantiate_target rather than do_instantiate_target.  In
14456         do_instantiate_target just allocate a new target.
14457         * sparc.cc (class Target_selector_sparc): Likewise.
14458
14459         * freebsd.h: New file.
14460         * i386.cc: Include "freebsd.h".
14461         (Target_i386): Derive from Target_freebsd rather than
14462         Sized_target.
14463         (Target_selector_i386): Derive from Target_selector_freebsd rather
14464         than Target_selector.
14465         * x86_64.cc: Include "freebsd.h".
14466         (Target_x86_64): Derive from Target_freebsd rather than
14467         Sized_target.
14468         (Target_selector_x86_64): Derive from Target_selector_freebsd
14469         rather than Target_selector.
14470         * target.h (class Target): Add adjust_elf_header and
14471         do_adjust_elf_header.
14472         * output.cc (Output_file_header:: do_sized_write): Call target
14473         adjust_elf_header routine.
14474         * configure.tgt: Set targ_osabi.
14475         * configure.ac: Define GOLD_DEFAULT_OSABI.
14476         * parameters.cc (Parameters::default_target): Pass
14477         GOLD_DEFAULT_OSABI to select_target.
14478         * target-select.h (class Target_selector): Make instantiate_target
14479         protected rather than private.
14480         * Makefile.am (HFILES): Add freebsd.h.
14481         * configure, Makefile.in, config.in: Rebuild.
14482
14483         * merge.cc (do_add_input_section): Correct pend value.  Change
14484         message about last entry not being null terminated from error to
14485         warning.
14486
14487 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
14488
14489         * incremental.cc: New file.
14490         * Makefile.am (CCFILES): Add incremental.cc.
14491         * Makefile.in: Rebuild.
14492
14493 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
14494
14495         * layout.cc (Layout::output_section_name): Preserve names
14496         of '.note.' sections.
14497
14498 2009-03-19  Ian Lance Taylor  <iant@google.com>
14499
14500         * descriptors.cc (Descriptors::open): Check that the options are
14501         valid before using them.
14502
14503 2009-03-18  Ian Lance Taylor  <iant@google.com>
14504
14505         * script-sections.h: Include <list>.
14506         (class Script_sections): Change Sections_elements from std::vector
14507         to std::list.  Typedef public Elements_iterator.  Add
14508         orphan_section_placement_, data_segment_align_start_, and
14509         saw_data_segment_align_ fields.  Remove data_segment_align_index_
14510         field.
14511         * script-sections.cc (class Orphan_section_placement): New class.
14512         (class Sections_element): Add virtual functions is_relro and
14513         orphan_section_init.  Remove virtual function place_orphan_here.
14514         (class Output_section_definition): Add is_relro and
14515         orphan_section_init.  Remove place_orphan_here.
14516         (class Orphan_output_section): Likewise.
14517         (Script_sections::Script_sections): Update for field changes.
14518         (Script_sections::data_segment_align): Set saw_data_segment_align_
14519         and data_segment_align_start_, not data_segment_align_index.
14520         (Script_sections::data_segment_relro_end): Check
14521         saw_data_segment_align_.  Use data_segment_align_start_ rather
14522         than data_segment_align_index_.
14523         (Script_sections::place_orphan): Rewrite to use
14524         Orphan_section_placement.
14525
14526 2009-03-17  Ian Lance Taylor  <iant@google.com>
14527
14528         * archive.cc (Archive::add_symbols): Check for a version attached
14529         to the symbol name in the archive map.
14530         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
14531         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
14532         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
14533         (ver_test_11.a): New target.
14534         * testsuite/Makefile.in: Rebuild.
14535
14536         * configure.ac: Check for chsize and posix_fallocate.  Replace
14537         ftruncate.
14538         * ftruncate.c: New file, from gnulib.
14539         * output.cc (posix_fallocate): Define dummy version if not
14540         HAVE_POSIX_FALLOCATE.
14541         (Output_file::map): Call posix_fallocate rather than lseek and
14542         write.
14543         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
14544         * configure, Makefile.in, config.in: Rebuild.
14545
14546 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
14547
14548         * layout.h (Layout::create_note): Add section_name parameter.
14549         * layout.cc (Layout::create_note): Likewise.
14550         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
14551
14552 2009-03-17  Ian Lance Taylor  <iant@google.com>
14553
14554         * descriptors.cc: Include "options.h".
14555         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
14556         (Descriptors::open): Always use O_CLOEXEC when opening a new
14557         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
14558         then set FD_CLOEXEC.
14559
14560         * sparc.cc (class Target_sparc): Add has_got_section.
14561         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
14562         make sure we have a GOT section.
14563
14564         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
14565         (Target_sparc::Scan::local): Likewise.
14566         (Target_sparc::Scan::global): Likewise.
14567         (Target_sparc::Relocate::relocate): Likewise.
14568         (Target_sparc::Relocate::relocate_tls): Likewise.
14569
14570         * symtab.cc (Symbol_table::define_default_version): New function,
14571         broken out of add_from_object.
14572         (Symbol_table::add_from_object): Call define_default_version.
14573         (Symbol_table::define_special_symbol): Add resolve_oldsym
14574         parameter.  Change all callers.  If the version for a symbol comes
14575         from a version script, resolve it with the symbol with the same
14576         name with no version.  Also add the symbol without a version if
14577         appropriate.
14578         (do_define_in_output_data): If resolving with oldsym, don't delete
14579         sym.
14580         (do_define_in_output_segment): Likewise.
14581         (do_define_as_constant): Likewise.
14582         * symtab.h (class Symbol_table): Update declarations.
14583
14584 2009-03-13  Ian Lance Taylor  <iant@google.com>
14585
14586         * readsyms.cc (Read_symbols::incompatible_warning): New function.
14587         (Read_symbols::requeue): New function.
14588         (Read_symbols::do_read_symbols): If make_elf_object fails because
14589         the target type is not configured, and the file was searched for,
14590         issue a warning and retry with the next directory.
14591         (Add_symbols::run): If the file has an incompatible format, and
14592         it was searched for, requeue the Read_symbols task.  On error,
14593         release the object.
14594         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
14595         dirindex parameter to constructor.  Change all callers.  Declare
14596         incompatible_warning and requeue.
14597         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
14598         input_argument_ and input_group_ fields.  Add them to
14599         constructor.  Change all callers.
14600         (class Read_script): Add dirindex_ field.  Add it to constructor.
14601         Change all callers.
14602         * archive.cc (Archive::setup): Remove input_objects parameter.
14603         Change all callers.
14604         (Archive::get_file_and_offset): Likewise.
14605         (Archive::read_all_symbols): Likewise.
14606         (Archive::read_symbols): Likewise.
14607         (Archive::get_elf_object_for_member): Remove input_objects
14608         parameter.  Add punconfigured parameter.  Change all callers.
14609         (Archive::add_symbols): Change return type to bool.  Check return
14610         value of include_member.
14611         (Archive::include_all_members): Likewise.
14612         (Archive::include_member): Change return type to bool.  Return
14613         false if first included object has incompatible target.  Set
14614         included_member_ field.
14615         (Add_archive_symbols::run): If add_symbols returns false, requeue
14616         Read_symbols task.
14617         * archive.h (class Archive): Add included_member_ field.
14618         Initialize it in constructor.  Add input_file and searched_for
14619         methods.  Update declarations.
14620         (class Add_archive_symbols): Add dirpath_, dirindex_, and
14621         input_argument_ fields.  Add them to constructor.  Change all
14622         callers.
14623         * script.cc: Include "target-select.h".
14624         (class Parser_closure): Add skip_on_incompatible_target_ and
14625         found_incompatible_target_ fields.  Add
14626         skip_on_incompatible_target parameter to constructor.  Change all
14627         callers.  Add methods skip_on_incompatible_target,
14628         clear_skip_on_incompatible_target, found_incompatible_target, and
14629         set_found_incompatible_target.
14630         (read_input_script): Add dirindex parameter.  Change all callers.
14631         If parser finds an incompatible target, requeue Read_symbols
14632         task.
14633         (script_set_symbol): Clear skip_on_incompatible_target in
14634         closure.
14635         (script_add_assertion, script_parse_option): Likewise.
14636         (script_start_sections, script_add_phdr): Likewise.
14637         (script_check_output_format): New function.
14638         * script.h (read_input_script): Update declaration.
14639         * script-c.h (script_check_output_format): Declare.
14640         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
14641         (ignore_cmd): Remove OUTPUT_FORMAT.
14642         * fileread.cc (Input_file::Input_file): Add explicit this.
14643         (Input_file::will_search_for): New function.
14644         (Input_file::open): Add pindex parameter.  Change all callers.
14645         * fileread.h (class Input_file): Add input_file_argument method.
14646         Declare will_search_for.  Update declarations.
14647         * object.cc (make_elf_object): Add punconfigured parameter.
14648         Change all callers.
14649         * object.h (class Object): Make input_file public.  Add
14650         searched_for method.
14651         (make_elf_object): Update declaration.
14652         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
14653         restart search.
14654         * dirsearch.h (class Dirsearch): Update declaration.
14655         * options.h (class General_options): Add --warn-search-mismatch.
14656         * parameters.cc (Parameters::is_compatible_target): New function.
14657         * parameters.h (class Parameters): Declare is_compatible_target.
14658         * workqueue.cc (Workqueue::add_blocker): New function.
14659         * workqueue.h (class Workqueue): Declare add_blocker.
14660
14661         * fileread.cc (Input_file::open): Remove options parameter.
14662         Change all callers.
14663         (Input_file::open_binary): Likewise.
14664         * script.cc (read_input_script): Likewise.
14665         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
14666         options parameter from constructor.  Change all callers.
14667         (class Read_script): Likewise.
14668         * fileread.h (class Input_file): Update declarations.
14669         * script.h (read_input_script): Update declaration.
14670
14671 2009-03-10  Nick Clifton  <nickc@redhat.com>
14672
14673         * po/es.po: New Spanish translation.
14674
14675 2009-03-06  Cary Coutant  <ccoutant@google.com>
14676
14677         * options.cc (parse_short_option): Keep dash_z from registering itself.
14678
14679 2009-03-03  Ian Lance Taylor  <iant@google.com>
14680
14681         PR 9918
14682         * target-reloc.h (relocate_section): Pass output_section to
14683         relocate.
14684         * i386.cc (Target_i386::should_apply_static_reloc): Add
14685         output_section parameter.  Change all callers.
14686         (Target_i386::Relocate::relocate): Add output_section parameter.
14687         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14688         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
14689         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
14690         * testsuite/two_file_shared.sh: New script.
14691         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
14692         (check_DATA): Add two_file_shared.dbg.
14693         (two_file_shared.dbg): New target.
14694         * testsuite/Makefile.in: Rebuild.
14695
14696 2009-03-01  Ian Lance Taylor  <iant@google.com>
14697
14698         * configure.ac: Check for byteswap.h.
14699         * configure: Rebuild.
14700         * config.in: Rebuild.
14701
14702 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
14703
14704         * layout.cc (Layout::find_or_add_kept_section): New function.
14705         (Layout::add_comdat): Removed.
14706         * layout.h (struct Kept_section): Move out of class Layout.
14707         Remove trailing underscores from field names.  Add group_sections
14708         field.  Rename group_ field to is_group.  Change all uses.
14709         (class Layout): Declare find_or_add_kept_section, not add_comdat.
14710         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
14711         comdat_groups_ field.
14712         (Sized_relobj::include_section_group): Use
14713         find_or_add_kept_section and Kept_section::group_sections.
14714         (Sized_relobj::include_linkonce_section): Likewise.
14715         * object.cc (class Sized_relobj): Don't define Comdat_group or
14716         Comdat_group_table.  Remove find_comdat_group and
14717         add_comdat_group.  Remove comdat_groups_ field.
14718         * plugin.cc (include_comdat_group): Use
14719         Layout::find_or_add_kept_section.
14720
14721 2009-02-28  Ian Lance Taylor  <iant@google.com>
14722
14723         * README: --gc-sections and map files are now supported.  Document
14724         some build requirements.
14725
14726         PR 6992
14727         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
14728         relocatable link set the value of the section symbol to zero.
14729         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
14730         relocatable link don't include the section address in the local
14731         symbol value.
14732
14733 2009-02-27  Ian Lance Taylor  <iant@google.com>
14734
14735         PR 6811
14736         * options.h (class Search_directory): Add is_system_directory.
14737         (class General_options): Declare is_in_system_directory.
14738         * options.cc (get_relative_sysroot): Make static.
14739         (get_default_sysroot): Make static.
14740         (General_optoins::is_in_system_directory): New function.
14741         * fileread.cc (Input_file::is_in_system_directory): New function.
14742         * fileread.h (class Input_file): Declare is_in_system_directory.
14743         * object.h (class Object): Add is_in_system_directory.
14744         (class Input_objects): Remove system_library_directory_ field.
14745         * object.cc (Input_objects::add_object): Don't set
14746         system_library_directory_.
14747         (input_objects::found_in_system_library_directory): Remove.
14748         * symtab.cc (Symbol_table::write_globals): Remove input_objects
14749         parameter.  Change all callers.
14750         (Symbol_table::sized_write_globals): Likewise.
14751         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
14752         Call Object::is_in_system_directory.
14753         * symtab.h (class Symbol_table): Update declarations.
14754
14755         PR 5990
14756         * descriptors.h (Open_descriptor): Add is_on_stack field.
14757         * descriptors.cc (Descriptors::open): If the descriptor is on the
14758         top of the stack, remove it.  Initialize is_on_stack field.
14759         (Descriptors::release): Only add pod to stack if it is not on the
14760         stack already.
14761         (Descriptors::close_some_descriptor): Clear stack_next and
14762         is_on_stack fields.
14763
14764         PR 7091
14765         * output.cc (Output_section::find_starting_output_address): Rename
14766         from starting_output_address; add PADDR parameter; change return
14767         type.
14768         * output.h (class Output_section): Declare
14769         find_starting_output_address instead of starting_output_address.
14770         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
14771         section symbol for which we can't find a merge section.
14772
14773         PR 9836
14774         * symtab.cc (Symbol_table::add_from_object): If the visibility is
14775         hidden or internal, force the symbol to be local.
14776         * resolve.cc (Symbol::override_visibility): Define.
14777         (Symbol::override_base): Use override_visibility.
14778         (Symbol_table::resolve): Likewise.
14779         (Symbol::override_base_with_special): Likewise.
14780         (Symbol_table::override_with_special): If the visibility is hidden
14781         or internal, force the symbol to be local.
14782         * symtab.h (class Symbol): Add set_visibility and
14783         override_visibility.
14784         * testsuite/ver_test_1.sh: New file.
14785         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
14786         (check_DATA): Add ver_test_1.syms.
14787         (ver_test_1.syms): New target.
14788         * testsuite/Makefile.in: Rebuild.
14789
14790 2009-02-25  Cary Coutant  <ccoutant@google.com>
14791
14792         * layout.cc (Layout::choose_output_section): Don't rename sections
14793         when using a linker script that has a SECTIONS clause.
14794         * Makefile.in: Regenerate.
14795
14796         * testsuite/Makefile.am (script_test_5.sh): New test case.
14797         * testsuite/Makefile.in: Regenerate.
14798         * testsuite/script_test_5.cc: New file.
14799         * testsuite/script_test_5.sh: New file.
14800         * testsuite/script_test_5.t: New file.
14801
14802 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
14803
14804         * archive.cc (Archive::include_member): Update calls to add_symbols.
14805         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
14806         the Layout argument.
14807         * dynobj.h (do_add_symbols): Add the Layout argument.
14808         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
14809         Layout argument.
14810         * object.h (Object::add_symbols): Add the Layout argument.
14811         (Object::do_add_symbols): Add the Layout argument.
14812         (Sized_relobj::do_add_symbols): Add the Layout argument.
14813         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
14814         Unify the two versions.
14815         (Add_plugin_symbols): Remove.
14816         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
14817         (Sized_pluginobj::do_add_symbols): Unify the two versions.
14818         (Add_plugin_symbols): Remove.
14819         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
14820         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
14821         (Add_symbols::run): Make it work with Pulginobj.
14822
14823 2009-02-06  Ian Lance Taylor  <iant@google.com>
14824
14825         * object.cc (Sized_relobj::do_layout): Make info message start
14826         with lower case letter.
14827
14828 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
14829
14830         * binary.cc: Fix file comment.
14831
14832         * options.h (enum Incremental_disposition): Define.
14833         (class General_options): Add new options: --incremental,
14834         --incremental_changed, --incremental_unchanged,
14835         --incremental_unknown.  Add incremental_disposition_ and
14836         implicit_incremental_ fields.
14837         (General_options::incremental_disposition): New function.
14838         (class Position_dependent_options): Add incremental_disposition
14839         option.
14840         (Position_dependent_options::copy_from_options): Set incremental
14841         dispositions.
14842         * options.cc (General_options::parse_incremental_changed): New
14843         function.
14844         (General_options::parse_incremental_unchanged): New function.
14845         (General_options::parse_incremental_unknown): New function.
14846         (General_options::General_options): Initialize new fields
14847         incremental_disposition_ and implicit_incremental_.
14848         (General_options::finalize): Check for uasge of --incremental-*
14849         without --incremental.
14850
14851 2009-02-06  Chris Demetriou  <cgd@google.com>
14852
14853         * gold.h (gold_undefined_symbol): Change to take only a Symbol
14854         pointer and to report location as the file name associated with
14855         the symbol.
14856         (gold_undefined_symbol_at_location): New function to replace the
14857         old gold_undefined_symbol functionality.
14858         * target-reloc.h (relocate_section): Update to use
14859         gold_undefined_symbol_at_location.
14860         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14861         Call gold_undefined_symbol function rather than gold_error.
14862         * errors.h (Errors::undefined_symbol): Take location as a
14863         string, rather than calculating it from a relocation.
14864         * errors.cc (Errors::fatal): Print "fatal error:" before the
14865         formatted message.
14866         (Errors::error, Errors::error_at_location): Print "error: "
14867         before the formatted message.
14868         (Errors::undefined_symbol): Take location as a string, rather
14869         than calculating it from a relocation.
14870         (gold_undefined_symbol_at_location): New function akin to
14871         old gold_undefined_symbol, calculates location from relocation.
14872         (gold_undefined_symbol): Change to take only a Symbol pointer
14873         and to report location as the file name associated with the symbol.
14874         * testsuite/debug_msg.sh: Update for changed error messages.
14875         * testsuite/undef_symbol.sh: Likewise.
14876
14877 2009-02-04  Duncan Sands  <baldrick@free.fr>
14878
14879         PR 9812
14880         * reduced_debug_output.h
14881         (Output_reduced_debug_abbrev_section::failed): Use format for
14882         gold_warning.
14883         (Output_reduced_debug_info_section::faild): Likewise.
14884
14885 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
14886
14887         * script.cc (Lazy_demangler): New class.
14888         (Version_script_info::get_symbol_version_helper): Demangle a
14889         symbol only once.
14890
14891 2009-01-29  Cary Coutant  <ccoutant@google.com>
14892
14893         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
14894         to __tls_get_addr.
14895         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14896
14897 2009-01-28  Ian Lance Taylor  <iant@google.com>
14898
14899         * version.cc (version_string): Bump to 1.9.
14900
14901         * gold.h: Include <cstring> and <stdint.h>.
14902         * version.cc: Include <cstdio>.
14903         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
14904         warning.
14905         * reduced_debug_output.cc (insert_into_vector): Rename from
14906         Insert_into_vector; change all callers.  Use Swap_unaligned to
14907         avoid aliasing issue; remove union since it is unnecessary.
14908
14909 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
14910
14911         * Makefile.am (CCFILES): Add gc.cc.
14912         (HFILES): Add gc.h.
14913         * Makefile.in: Regenerate.
14914         * gold.cc (Gc_runner): New class.
14915         (queue_initial_tasks): Call garbage collection related tasks
14916         when corresponding options are invoked.
14917         (queue_middle_gc_tasks): New function.
14918         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
14919         processed early before laying out sections during garbage collection.
14920         * gold.h (queue_middle_gc_tasks): New function.
14921         (is_prefix_of): Move from "layout.cc".
14922         * i386.cc (Target_i386::gc_process_relocs): New function.
14923         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
14924         * main.cc (main): Create object of class "Garbage_collection".
14925         * object.cc (Relobj::copy_symbols_data): New function.
14926         (Relobj::is_section_name_included): New function.
14927         (Sized_relobj::do_layout): Allow this function to be called twice
14928         during garbage collection and defer layout of section during the
14929         first call.
14930         * object.h (Relobj::get_symbols_data): New function.
14931         (Relobj::is_section_name_included): New function.
14932         (Relobj::copy_symbols_data): New function.
14933         (Relobj::set_symbols_data): New function.
14934         (Relobj::get_relocs_data): New function.
14935         (Relobj::set_relocs_data): New function.
14936         (Relobj::is_output_section_offset_invalid): New pure virtual function.
14937         (Relobj::gc_process_relocs): New function.
14938         (Relobj::do_gc_process_relocs): New pure virtual function.
14939         (Relobj::sd_): New data member.
14940         (Sized_relobj::is_output_section_offset_invalid): New function.
14941         (Sized_relobj::do_gc_process_relocs): New function.
14942         * options.h (General_options::gc_sections): Modify to not be a no-op.
14943         (General_options::print_gc_sections): New option.
14944         * plugin.cc (Plugin_finish::run): Remove function call to
14945         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
14946         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
14947         * reloc.cc (Read_relocs::run): Add task to process relocs and
14948         determine unreferenced sections when doing garbage collection.
14949         (Gc_process_relocs): New class.
14950         (Sized_relobj::do_gc_process_relocs): New function.
14951         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
14952         sections that are garbage collected.
14953         * reloc.h (Gc_process_relocs): New class.
14954         * sparc.cc (Target_sparc::gc_process_relocs): New function.
14955         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
14956         symbols whose corresponding sections are garbage collected.
14957         (Symbol_table::Symbol_table): Add new parameter for the garbage
14958         collection object.
14959         (Symbol_table::gc_mark_undef_symbols): New function.
14960         (Symbol_table::gc_mark_symbol_for_shlib): New function.
14961         (Symbol_table::gc_mark_dyn_syms): New function.
14962         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
14963         as garbage.
14964         (Symbol_table::add_from_object): Likewise.
14965         (Symbol_table::add_from_relobj): When building shared objects, do not
14966         treat externally visible symbols as garbage.
14967         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
14968         table information for static and relocatable links.
14969         * symtab.h (Symbol_table::set_gc): New function.
14970         (Symbol_table::gc): New function.
14971         (Symbol_table::gc_mark_undef_symbols): New function.
14972         (Symbol_table::gc_mark_symbol_for_shlib): New function.
14973         (Symbol_table::gc_mark_dyn_syms): New function.
14974         (Symbol_table::gc_): New data member.
14975         * target.h (Sized_target::gc_process_relocs): New pure virtual
14976         function.
14977         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
14978         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
14979
14980 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
14981
14982         * options.h (General_options::gc_sections): Define as a no-op for now.
14983         (General_options::no_keep_memory): Ditto.
14984         (General_options::Bshareable): Define.
14985         * options.cc (General_options::finalize): Honor -Bshareable.
14986
14987 2009-01-20  Andreas Schwab  <schwab@suse.de>
14988
14989         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
14990         read the value in the contents, since we don't use it.  Use the
14991         template endianness when writing.
14992         (Relocate::relocate): Use it for R_PPC_REL16_HA.
14993
14994 2009-01-19  Andreas Schwab  <schwab@suse.de>
14995
14996         * configure.tgt (powerpc64-*): Fix targ_obj.
14997
14998 2009-01-15  Ian Lance Taylor  <iant@google.com>
14999
15000         * object.cc (Sized_relobj::write_local_symbols): Don't write out
15001         local symbols when stripping all symbols.
15002
15003 2009-01-14  Cary Coutant  <ccoutant@google.com>
15004
15005         * output.cc (Output_reloc): Add explicit instantiations.
15006
15007 2009-01-14  Cary Coutant  <ccoutant@google.com>
15008
15009         * archive.cc (Archive::get_elf_object_for_member): Remove call
15010         to File_read::claim_for_plugin.
15011         * descriptors.cc (Descriptors::open): Remove reference to
15012         is_claimed.
15013         (Descriptors::claim_for_plugin): Remove.
15014         * descriptors.h (Descriptors::claim_for_plugin): Remove.
15015         (Descriptors::is_claimed): Remove.
15016         (claim_descriptor_for_plugin): Remove.
15017         * fileread.cc (File_read::claim_for_plugin): Remove.
15018         * fileread.h (File_read::claim_for_plugin): Remove.
15019         (File_read::descriptor): Reopen descriptor if necessary.
15020         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
15021         (Plugin_manager::all_symbols_read): Add task parameter. Change
15022         all callers.
15023         (Plugin_manager::get_input_file): New function.
15024         (Plugin_manager::release_input_file): New function.
15025         (Pluginobj::Pluginobj): Add filesize parameter and initialize
15026         corresponding data member.
15027         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
15028         and pass to base constructor. Change all callers.
15029         (get_input_file, release_input_file): New functions.
15030         (make_sized_plugin_object): Add filesize parameter. Change all callers.
15031         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
15032         (Plugin_manager::all_symbols_read): Add task parameter.
15033         (Plugin_manager::get_input_file): New function.
15034         (Plugin_manager::release_input_file): New function.
15035         (Plugin_manager::task_): New data member.
15036         (Pluginobj::Pluginobj): Add filesize parameter.
15037         (Pluginobj::filename): New function.
15038         (Pluginobj::descriptor): New function.
15039         (Pluginobj::filesize): New function.
15040         (Pluginobj::filesize_): New data member.
15041         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
15042         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
15043         File_read::claim_for_plugin; use Object::unlock to unlock the file.
15044
15045         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
15046         with archive libraries.
15047         * testsuite/Makefile.in: Regenerate.
15048         * testsuite/plugin_test.c (struct sym_info): New type.
15049         (get_input_file, release_input_file): New static variables.
15050         (onload): Capture new transfer vector entries.
15051         (claim_file_hook): Stop reading at end of file according to filesize.
15052         Factor out parsing of readelf output into separate function.
15053         (all_symbols_read_hook): Exercise get_input_file and release_input_file
15054         APIs and get the source file name from the symbol table.  Convert
15055         source file name to corresponding object file name.  Print info
15056         message when adding new input files.
15057         (parse_readelf_line): New function.
15058         * testsuite/plugin_test_1.sh: Add checks for new info messages.
15059         * testsuite/plugin_test_2.sh: Likewise.
15060         * testsuite/plugin_test_3.sh: Likewise.
15061         * testsuite/plugin_test_4.sh: New test case.
15062
15063 2009-01-07  Ian Lance Taylor  <iant@google.com>
15064
15065         * version.cc (version_string): Bump to 1.8.
15066
15067 2008-12-23  Cary Coutant  <ccoutant@google.com>
15068
15069         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
15070         * plugin.cc (Plugin_manager::finish): Rename as
15071         layout_deferred_objects.  Move cleanup to separate function.
15072         (Plugin_manager::cleanup): New function.
15073         (Plugin_finish::run): Call layout_deferred_objects and cleanup
15074         separately.
15075         * plugin.h (Plugin_manager::finish): Rename as
15076         layout_deferred_objects.
15077         (Plugin_manager::cleanup): New function.
15078         (Plugin_manager::cleanup_done): New field.
15079
15080 2008-12-23  Cary Coutant  <ccoutant@google.com>
15081
15082         * plugin.cc (is_visible_from_outside): New function.
15083         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
15084         so we don't return "IR only" status for exported symbols or -r links.
15085
15086         * testsuite/Makefile.am (plugin_test_3): New test case.
15087         * testsuite/Makefile.in: Regenerate.
15088         * testsuite/plugin_test_3.sh: New file.
15089
15090 2008-12-22  Cary Coutant  <ccoutant@google.com>
15091
15092         * object.cc (Sized_relobj::layout_section): New function.
15093         (Sized_relobj::do_layout): Defer layout of input sections until after
15094         plugin has provided replacement files.
15095         (Sized_relobj::do_layout_deferred_sections): New function.
15096         * object.h (Relobj::set_section_offset): Remove virtual keyword.
15097         (Relobj::layout_deferred_sections): New function.
15098         (Relobj::do_layout_deferred_sections): New function.
15099         (Sized_relobj::do_layout_deferred_sections): New function.
15100         (Sized_relobj::layout_section): New function.
15101         (Sized_relobj::Deferred_layout): New structure.
15102         (Sized_relobj::deferred_layout_): New field.
15103         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
15104         Change all callers.  Layout deferred sections.
15105         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
15106         references.
15107         (Plugin_hook::run): Move code from do_plugin_hook inline.
15108         (Plugin_hook::do_plugin_hook): Remove.
15109         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
15110         (Plugin_manager::finish): Renamed, was cleanup.
15111         (Plugin_manager::should_defer_layout): New function.
15112         (Plugin_manager::add_deferred_layout_object): New function.
15113         (Plugin_manager::Deferred_layout_list): New type.
15114         (Plugin_manager::deferred_layout_objects_): New field.
15115         (Plugin_hook::do_plugin_hook): Remove.
15116
15117 2008-12-17  Ian Lance Taylor  <iant@google.com>
15118
15119         * options.h (class General_options): Add --no case for
15120         --export-dynamic.
15121
15122 2008-12-16  Cary Coutant  <ccoutant@google.com>
15123
15124         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
15125         vector.
15126         (Plugin_manager::claim_file): Create plugin object even if
15127         plugin did not call the add_symbols callback.
15128         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
15129         asking for more symbols than were added.
15130         * testsuite/Makefile.am (plugin_test_1): Add test case with
15131         no global symbols.
15132         (empty.syms): New target.
15133         * testsuite/Makefile.in: Regenerate.
15134         * testsuite/plugin_test.c (claim_file_hook): Add new debug
15135         message. Don't call add_symbols if no globals.
15136         (all_symbols_read_hook): Don't provide replacement for empty
15137         claimed file.
15138
15139 2008-12-12  Ian Lance Taylor  <iant@google.com>
15140
15141         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
15142         r_type == 0 for a local symbol with r_sym == 0.
15143         (scan_relocatable_relocs): Pass r_sym to
15144         local_non_section_strategy.
15145         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
15146         r_sym parameter.
15147
15148         * configure.ac: Update test for TLS descriptors: they are
15149         supported as of glibc 2.9.
15150         * configure: Rebuild.
15151
15152 2008-12-11  Ian Lance Taylor  <iant@google.com>
15153
15154         PR 7091
15155         * target-reloc.h (Default_scan_relocatable_relocs): For each
15156         function, map r_type == 0 to RELOC_DISCARD.
15157
15158 2008-12-10  Cary Coutant  <ccoutant@google.com>
15159
15160         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
15161         object to override a kept COMDAT group from a plugin object.
15162
15163 2008-12-09  Ian Lance Taylor  <iant@google.com>
15164
15165         PR 7088
15166         * yyscript.y (file_cmd): Handle INPUT.
15167
15168         * testsuite/initpri1.c: Change all declarations to be full
15169         prototypes by adding void, to avoid compiler warnings.
15170
15171 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
15172
15173         * options.cc (General_options::parse_plugin_opt): New.
15174         (General_options::add_plugin): The argument now is just the filename.
15175         (General_options::add_plugin_option): New.
15176         * options.h (plugin_opt): New.
15177         (add_plugin): Change argument name.
15178         (add_plugin_option): New.
15179         * plugin.cc (Plugin::load): Don't parse the plugin option.
15180         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
15181         (Plugin::add_option): New.
15182         (Plugin::args_): Change type.
15183         (Plugin::filename_): New.
15184         (Plugin_manager::add_plugin_option): New.
15185         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
15186         * testsuite/Makefile.in: Regenerate.
15187
15188 2008-12-05  Cary Coutant  <ccoutant@google.com>
15189
15190         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
15191         Handle --strip-lto-sections option.
15192         * options.h (strip_lto_sections): New option.
15193
15194 2008-12-01  Cary Coutant  <ccoutant@google.com>
15195
15196         * plugin.cc (ld_plugin_message): Change format parameter to const.
15197         Fix mismatch between new[] and delete.
15198
15199 2008-11-14  Cary Coutant  <ccoutant@google.com>
15200
15201         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
15202         instead of -1U.
15203
15204 2008-11-05  Craig Silverstein  <csilvers@google.com>
15205
15206         * options.cc (General_options::parse_dynamic_list): New function.
15207         * options.h (General_options): New flags dynamic_list,
15208         dynamic_list_data, dynamic_list_cpp_new, and
15209         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
15210         (General_options::in_dynamic_list): New function.
15211         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
15212         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
15213         (Lex::can_continue_name): Likewise.
15214         (yylex): Likewise.
15215         (read_script_file): New parameter script_options.
15216         (read_dynamic_list): New function.
15217         (Script_options::define_dynamic_list): New function.
15218         (dynamic_list_keyword_parsecodes): New variable.
15219         (dynamic_list_keywords): New variable.
15220         * script.h (Script_options::define_dynamic_list): New function
15221         prototype.
15222         (read_dynamic_list): New function prototype.
15223         * symtab.cc (strprefix): New macro.
15224         (Symbol::should_add_dynsym_entry): Support dynamic_list,
15225         dynamic_list_data, dynamic_list_cpp_new, and
15226         dynamic_list_cpp_typeinfo.
15227         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
15228         (dynamic_list_expr): New rule.
15229         (dynamic_list_nodes): Likewise.
15230         (dynamic_list_node): Likewise.
15231         * testsuite/Makefile.am (dynamic_list): New test.
15232         * testsuite/Makefile.in: Regenerated.
15233         * testsuite/dynamic_list.t: New file.
15234         * testsuite/dynamic_list.sh: New file.
15235
15236 2008-11-05  Craig Silverstein  <csilvers@google.com>
15237
15238         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
15239         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
15240         (t11_last): Likewise.
15241         * testsuite/ver_test_6.c (main): Likewise.
15242
15243 2008-10-07  Cary Coutant  <ccoutant@google.com>
15244
15245         * options.c (General_options::finalize): Add check for -static and
15246         -shared.
15247         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
15248         is not empty.
15249
15250 2008-10-02  Cary Coutant  <ccoutant@google.com>
15251
15252         * plugin.cc (make_sized_plugin_object): Fix conditional
15253         compilation to work when not all targets are enabled.
15254
15255 2008-09-29  Cary Coutant  <ccoutant@google.com>
15256
15257         * archive.cc (Archive::get_file_and_offset): Use filename instead
15258         of name to get library path.
15259         (Archive::include_member): Unlock external member of a thin archive.
15260
15261         * testsuite/Makefile.am (TEST_AR): New variable.
15262         (thin_archive_test_1): New test.
15263         (thin_archive_test_2): New test.
15264         * testsuite/Makefile.in: Regenerate.
15265         * testsuite/thin_archive_main.cc: New file.
15266         * testsuite/thin_archive_test_1.cc: New file.
15267         * testsuite/thin_archive_test_2.cc: New file.
15268         * testsuite/thin_archive_test_3.cc: New file.
15269         * testsuite/thin_archive_test_4.cc: New file.
15270
15271 2008-09-29  Cary Coutant  <ccoutant@google.com>
15272
15273         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
15274         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
15275         instead of -1U.
15276         (Sized_relobj::do_finalize_local_symbols): Likewise.
15277         (Sized_relobj::map_to_kept_section): Likewise.
15278         * object.h (Sized_relobj::invalid_address): New constant.
15279         (Sized_relobj::do_output_section_offset): Check for invalid_address
15280         and return -1ULL.
15281         * output.cc (Output_reloc::local_section_offset): Use constant
15282         invalid_address instead of -1U.
15283         (Output_reloc::get_address): Likewise.
15284         (Output_section::output_address): Change -1U to -1ULL.
15285         * output.h (Output_reloc::invalid_address): New constant.
15286         * reloc.cc (Sized_relobj::write_sections): Use constant
15287         invalid_address instead of -1U.
15288         (Sized_relobj::relocate_sections): Likewise.
15289         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
15290         values for merge sections.
15291         * target-reloc.h (relocate_for_relocatable): Use constant
15292         invalid_address instead of -1U.
15293
15294 2008-09-19  Cary Coutant  <ccoutant@google.com>
15295
15296         Add plugin functionality for link-time optimization (LTO).
15297         * configure.ac (plugins): Add --enable-plugins option.
15298         * configure: Regenerate.
15299         * config.in: Regenerate.
15300         * Makefile.am (LIBDL): New variable.
15301         (CCFILES): Add plugin.cc.
15302         (HFILES): Add plugin.h.
15303         (ldadd_var): Add LIBDL.
15304         * Makefile.in: Regenerate.
15305
15306         * archive.cc: Include "plugin.h".
15307         (Archive::setup): Don't preread archive symbols when using a plugin.
15308         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
15309         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
15310         files.
15311         (Archive::include_member): Add symbols from plugin objects.
15312         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
15313         * descriptors.cc (Descriptors::open): Check for file descriptors
15314         abandoned by plugins.
15315         (Descriptors::claim_for_plugin): New function.
15316         * descriptors.h (Descriptors::claim_for_plugin): New function.
15317         (Open_descriptor::is_claimed): New field.
15318         (claim_descriptor_for_plugin): New function.
15319         * fileread.cc (File_read::claim_for_plugin): New function.
15320         * fileread.h (File_read::claim_for_plugin): New function.
15321         (File_read::descriptor): New function.
15322         * gold.cc: Include "plugin.h".
15323         (queue_initial_tasks): Add task to call plugin hooks for generating
15324         new object files.
15325         * main.cc: Include "plugin.h".
15326         (main): Load plugin libraries.
15327         * object.h (Pluginobj): Declare.
15328         (Object::pluginobj): New function.
15329         (Object::do_pluginobj): New function.
15330         (Object::set_target): New function.
15331         * options.cc: Include "plugin.h".
15332         (General_options::parse_plugin): New function.
15333         (General_options::General_options): Initialize plugins_ field.
15334         (General_options::add_plugin): New function.
15335         * options.h (Plugin_manager): Declare.
15336         (General_options): Add --plugin option.
15337         (General_options::has_plugins): New function.
15338         (General_options::plugins): New function.
15339         (General_options::add_plugin): New function.
15340         (General_options::plugins_): New field.
15341         * plugin.cc: New file.
15342         * plugin.h: New file.
15343         * readsyms.cc: Include "plugin.h".
15344         (Read_symbols::do_read_symbols): Check for archive before checking
15345         for ELF file.  Call plugin hooks to claim files.
15346         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
15347         from a real object file; force override when processing replacement
15348         files.
15349         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
15350         (Symbol::init_base_object): Likewise.
15351         (Symbol::init_base_output_data): Likewise.
15352         (Symbol::init_base_output_segment): Likewise.
15353         (Symbol::init_base_constant): Likewise.
15354         (Symbol::init_base_undefined): Likewise.
15355         (Symbol::output_section): Assert that object is not a plugin.
15356         (Symbol_table::add_from_pluginobj): New function.
15357         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
15358         undefined.
15359         (Symbol_table::sized_write_globals): Likewise.
15360         (Symbol_table::add_from_pluginobj): Instantiate template.
15361         * symtab.h (Sized_pluginobj): Declare.
15362         (Symbol::in_real_elf): New function.
15363         (Symbol::set_in_real_elf): New function.
15364         (Symbol::in_real_elf_): New field.
15365         (Symbol_table::add_from_pluginobj): New function.
15366
15367         * testsuite/Makefile.am (AM_CFLAGS): New variable.
15368         (LIBDL): New variable.
15369         (LDADD): Add LIBDL.
15370         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
15371         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
15372         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
15373         (MOSTLYCLEANFILES): Likewise.
15374         * testsuite/Makefile.in: Regenerate.
15375         * testsuite/plugin_test.c: New file.
15376         * testsuite/plugin_test_1.sh: New file.
15377         * testsuite/plugin_test_2.sh: New file.
15378
15379 2008-09-16  Ian Lance Taylor  <iant@google.com>
15380
15381         * target-reloc.h (relocate_section): Check whether a symbol is
15382         defined by the ABI before reporting an undefined symbol error.
15383         * target.h (Target::is_defined_by_abi): Make parameter const.
15384         (Target::do_is_defined_by_abi): Likewise.
15385         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
15386         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
15387         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
15388         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
15389         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
15390         * testsuite/Makefile.in: Rebuild.
15391
15392         * fileread.cc (make_view): Add casts to avoid warning.
15393
15394 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15395
15396         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
15397         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15398
15399 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15400
15401         * options.h (General_options::output_is_executable): New.
15402         (General_options::output_is_pie): New.
15403         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
15404         for shared libraries.
15405         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15406
15407 2008-09-11  Chris Demetriou  <cgd@google.com>
15408
15409         * options.h (origin): New -z option.
15410         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
15411         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
15412         in DT_FLAGS_1.
15413
15414 2008-09-05  Cary Coutant  <ccoutant@google.com>
15415
15416         * fileread.cc (File_read::make_view): Add check for attempt to map
15417         beyond end of file.
15418
15419 2008-09-05  Cary Coutant  <ccoutant@google.com>
15420
15421         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
15422         explicit instantiations.
15423
15424 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
15425
15426         PR gold/6858
15427         * options.cc (General_options::finalize): Allow undefined symbols
15428         in shlibs if linking -shared.
15429
15430         PR gold/6859
15431         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
15432         symbols as not needing a dynsym entry.
15433
15434 2008-08-20  Craig Silverstein  <csilvers@google.com>
15435
15436         * fileread.cc (File_read::open): Do not lock the file unless it
15437         was successfully opened.
15438
15439 2008-08-14  Cary Coutant  <ccoutant@google.com>
15440
15441         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
15442         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
15443         * testsuite/tls_test.cc (struct int128): 128-bit struct
15444         for testing TLS relocs with non-zero addend.
15445         (v12): New TLS variable.
15446         (t12): New test.
15447         (t_last): Add check for v12.
15448         * testsuite/tls_test.h (t12): New function.
15449         * testsuite/tls_test_main.cc (thread_routine): Call new test.
15450
15451 2008-08-13  Ian Lance Taylor  <iant@google.com>
15452
15453         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
15454         set tls_segment_ or relro_segment_.
15455         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
15456         when appropriate.
15457         * output.h (Output_section::clear_is_relro): New function.
15458         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
15459         sections specially even when output_data_ is empty.
15460         (Output_segment::maximum_alignment): When first section is relro,
15461         only force alignment for PT_LOAD segments.
15462         * script.cc (script_data_segment_align): New function.
15463         (script_data_segment_relro_end): New function.
15464         * script-c.h (script_data_segment_align): Declare.
15465         (script_data_segment_relro_end): Declare.
15466         * script-sections.h (class Script_sections): Declare
15467         data_segment_align and data_segment_relro_end.  Add fields
15468         segment_align_index_ and saw_relro_end_.
15469         * script-sections.cc (class Sections_element): Add set_is_relro
15470         virtual function.  Add new bool* parameter to place_orphan_here.
15471         Add get_output_section virtual function.
15472         (class Output_section_definition): Add set_is_relro.  Add new
15473         bool* parameter to place_orphan_here.  Add get_output_section.
15474         Add is_relro_ field.
15475         (Output_section_definition::Output_section_definition): Initialize
15476         evaluated_address_, evaluated_load_address, evaluated_addralign_,
15477         and is_relro_ fields.
15478         (Output_section_definition::place_orphan_here): Add is_relro
15479         parameter.
15480         (Output_section_definition::set_section_addresses): Set relro for
15481         output section.
15482         (Output_section_definition::alternate_constraint): Likewise.
15483         (class Orphan_output_section): Add new bool* parameter to
15484         place_orphan_here.  Add get_output_section.
15485         (Orphan_output_section::place_orphan_here): Add is_relro
15486         parameter.
15487         (Script_sections::Script_sections): Initialize
15488         data_segment_align_index_ and saw_relro_end_.
15489         (Script_sections::data_segment_align): New function.
15490         (Script_sections::data_segment_relro_end): New function.
15491         (Script_sections::place_orphan): Set or clear is_relro.
15492         (Script_sections::set_section_addresses): Force alignment of first
15493         TLS section.
15494         * yyscript.y (exp): Call script_data_segment_align and
15495         script_data_segment_relro_end.
15496         * testsuite/relro_script_test.t: New file.
15497         * testsuite/relro_test.cc (using_script): Declare.
15498         (t1, t2): Test using_script.
15499         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
15500         (relro_script_test_SOURCES): Define.
15501         (relro_script_test_DEPENDENCIES): Define.
15502         (relro_script_test_LDFLAGS): Define.
15503         (relro_script_test_LDADD): Define.
15504         (relro_script_test.so): New target.
15505         * testsuite/Makefile.in: Rebuild.
15506
15507 2008-08-06  Cary Coutant <ccoutant@google.com>
15508
15509         * archive.cc (Archive::total_archives, Archive::total_members)
15510         (Archive::total_members_loaded): New variables.
15511         (Archive::setup): Add parameter.  Add option to preread
15512         archive symbols.
15513         (Archive::read_armap): Add counter.
15514         (Archive::get_file_and_offset): New function.
15515         (Archive::get_elf_object_for_member): New function.
15516         (Archive::read_all_symbols): New function.
15517         (Archive::read_symbols): New function.
15518         (Archive::add_symbols): Add counters.
15519         (Archive::include_all_members): Use armap to find members if it's
15520         already built.
15521         (Archive::include_member): Skip reading symbols if already read.
15522         Factored code into Archive::get_file_and_offset and
15523         Archive::get_elf_object_for_member.  Changed call to
15524         Mapfile::report_include_archive_member.
15525         (Archive::print_stats): New function.
15526         * archive.h: Declare Object and Read_symbols_data classes.
15527         (Archive::Archive): Add initializers for new members.
15528         (Archive::setup): Add parameter.
15529         (Archive::print_stats): New function.
15530         (Archive::total_archives, Archive::total_members)
15531         (Archive::total_members_loaded): New variables.
15532         (Archive::get_file_and_offset): New function.
15533         (Archive::get_elf_object_for_member): New function.
15534         (Archive::read_all_symbols): New function.
15535         (Archive::read_symbols): New function.
15536         (Archive::Archive_member): New class.
15537         (Archive::members_): New member.
15538         (Archive::num_members_): New member.
15539         * main.cc: Include archive.h.
15540         (main): Call Archive::print_stats.
15541         * mapfile.cc (Mapfile::report_include_archive_member): Delete
15542         archive parameter; member_name is now the fully-decorated name.
15543         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
15544         * options.h: (General_options): Add --preread-archive-symbols option.
15545         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
15546         Archive::setup.
15547
15548 2008-08-04  Ian Lance Taylor  <iant@google.com>
15549
15550         * symtab.h (Symbol::use_plt_offset): New function.
15551         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
15552         * powerpc.cc (Relocate::relocate): Likewise.
15553         * sparc.cc (Relocate::relocate): Likewise.
15554         * x86_64.cc (Relocate::relocate): Likewise.
15555         * testsuite/weak_plt.sh: New test.
15556         * testsuite/weak_plt_main.cc: New test.
15557         * testsuite/weak_plt_shared.cc: New test.
15558         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
15559         (check_PROGRAMS): Add weak_plt.
15560         (check_DATA): Add weak_plt_shared.so.
15561         (weak_plt_main_pic.o, weak_plt): New targets.
15562         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
15563         * testsuite/Makefile.in: Rebuild.
15564
15565         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
15566         gcctestdir/ld.
15567         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
15568         * testsuite/Makefile.in: Rebuild.
15569
15570 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
15571
15572         * Makefile.am (POTFILES.in): Set LC_ALL=C.
15573         * Makefile.in: Regenerate.
15574         * po/POTFILES.in: Regenerate.
15575
15576 2008-07-29  Ian Lance Taylor  <iant@google.com>
15577
15578         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
15579         symbols before other symbols.
15580         * testsuite/script_test_2.cc (test_addr): Declare.
15581         (test_addr_alias): Declare.
15582         (main): Check that test_addr and test_addr_alias have the right
15583         values.
15584         * testsuite/script_test_2.t: Define test_addr_alias and
15585         test_addr.
15586
15587 2008-07-24  Ian Lance Taylor  <iant@google.com>
15588
15589         PR 5990
15590         * descriptors.cc: New file.
15591         * descriptors.h: New file.
15592         * gold-threads.h (class Hold_optional_lock): New class.
15593         * fileread.cc: Include "descriptors.h".
15594         (File_read::~File_read): Release descriptor rather than closing
15595         it.
15596         (File_read::open) [file]: Call open_descriptor rather than open.
15597         Set is_descriptor_opened_.
15598         (File_read::open) [memory]: Assert that descriptor is not open.
15599         (File_read::reopen_descriptor): New function.
15600         (File_read::release): Release descriptor.
15601         (File_read::do_read): Make non-const.  Reopen descriptor.
15602         (File_read::read): Make non-const.
15603         (File_read::make_view): Reopen descriptor.
15604         (File_read::do_readv): Likewise.
15605         * fileread.h (class File_read): Add is_descriptor_opened_ field.
15606         Update declarations.
15607         * layout.cc: Include "descriptors.h".
15608         (Layout::create_build_id): Use open_descriptor rather than open.
15609         * output.cc: Include "descriptors.h".
15610         (Output_file::open): Use open_descriptor rather than open.
15611         * archive.cc (Archive::const_iterator): Change Archive to be
15612         non-const.
15613         (Archive::begin, Archive::end): Make non-const.
15614         (Archive::count_members): Likewise.
15615         * archive.h (class Archive): Update declarations.
15616         * object.h (Object::read): Make non-const.
15617         * Makefile.am (CCFILES): Add descriptors.cc.
15618         (HFILES): Add descriptors.h.
15619         * Makefile.in: Rebuild.
15620
15621         PR 6716
15622         * gold.h: Always include <clocale>.  Add Solaris workarounds
15623         following code in binutils/sysdep.h.
15624
15625         PR 6048
15626         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
15627         this->eh_frame_hdr_ is NULL before using it.
15628
15629         * dynobj.cc (Versions::Versions): Update comment.
15630
15631         * dynobj.cc (Versions::Versions): If there is an soname, use it as
15632         the base version name.
15633
15634         * stringpool.cc (Stringpool_template::add_with_length): Set key to
15635         array size plus one.
15636         (Stringpool_template::set_string_offsets): Subtract one from key
15637         before using it as an array index.
15638         (Stringpool_template::get_offset_with_length): Likewise.
15639         (Stringpool_template::write_to_buffer): Likewise.
15640         * stringpool.h (Stringpool_template::get_offset_from_key):
15641         Likewise.
15642
15643 2008-07-23  Ian Lance Taylor  <iant@google.com>
15644
15645         PR 6658
15646         * object.h (Merged_symbol_value::value): Do our best to handle a
15647         negative addend.
15648
15649         PR 6647
15650         * script.cc (Version_script_info::get_versions): Don't add empty
15651         version tag to return value.
15652         (Version_script_info::get_symbol_version_helper): Change return
15653         type to bool.  Add pversion parameter.  Change all callers.
15654         (script_register_vers_node): Don't require a non-NULL tag.
15655         * script.h (class Version_script_info): Update declarations.
15656         (Version_script_info::get_symbol_version): Change return type to
15657         bool.  Add version parameter.  Change all callers.
15658         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
15659         handling.  Handle an empty version from a version script.
15660         (Symbol_table::define_special_symbol): Likewise.
15661         * testsuite/ver_test_10.script: New file.
15662         * testsuite/ver_test_10.sh: New file.
15663         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
15664         (check_DATA): Add ver_test_10.syms.
15665         (ver_test_10.syms, ver_test_10.so): New target.
15666         * testsuite/Makefile.in: Rebuild.
15667
15668 2008-07-23  Simon Baldwin  <simonb@google.com>
15669
15670         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
15671         to zero for undefined symbols from dynamic libraries.
15672
15673 2008-07-23  Ian Lance Taylor  <iant@google.com>
15674
15675         * symtab.cc (Symbol_table::resolve): Remove version parameter.
15676         Change all callers.
15677         * symtab.h (class Symbol_table): Update declaration.
15678         * testsuite/ver_test_9.cc: New file.
15679         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
15680         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
15681         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
15682         (ver_test_9.so, ver_test_9.o): New targets.
15683         * testsuite/Makefile.in: Rebuild.
15684
15685 2008-07-22  Ian Lance Taylor  <iant@google.com>
15686
15687         * options.h (class General_options): Define --check-sections.
15688         * layout.cc (Layout::set_segment_offsets): Handle
15689         --check-sections.
15690
15691         * options.h (class General_options): Define -n/--nmagic and
15692         -N/--omagic.
15693         * options.cc (General_options::finalize): For -n/--nmagic or
15694         -N/--omagic, set -static.
15695         * layout.cc (Layout::attach_allocated_section_to_segment): If
15696         -N/--omagic, don't put read-only and read-write sections in
15697         different segments.
15698         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
15699         finding a read-only segment.
15700         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
15701         don't set the minimum segment alignment to the common page size,
15702         and don't set the file offset to the address modulo the page size.
15703         * script-sections.cc (Script_sections::create_segments): If
15704         -n/--omagic, don't put read-only and read-write sections in
15705         different segments.
15706
15707         * cref.cc: New file.
15708         * cref.h: New file.
15709         * options.h (class General_options): Add --print-symbol-counts.
15710         * main.cc (main): Issue defined symbol report if requested.
15711         * archive.cc (Archive::interpret_header): Make into a const member
15712         function.
15713         (Archive::add_symbols): Call Input_objects::archive_start and
15714         archive_stop.
15715         (Archive::const_iterator): Define new class.
15716         (Archive::begin, Archive::end): New functions.
15717         (Archive::include_all_members): Rewrite to use iterator.
15718         (Archive::count_members): New function.
15719         * archive.h (class Archive): Update declarations.
15720         (Archive::filename): New function.
15721         * object.cc: Include "cref.h".
15722         (Sized_relobj::Sized_relobj): Initialize defined_count_.
15723         (Sized_relobj::do_get_global_symbol_counts): New function.
15724         (Input_objects::add_object): Add object to cross-referencer.
15725         (Input_objects::archive_start): New function.
15726         (Input_objects::archive_stop): New function.
15727         (Input_objects::print_symbol_counts): New function.
15728         * object.h: Declare Cref and Archive.
15729         (Object::get_global_symbol_counts): New function.
15730         (Object::do_get_global_symbol_counts): New pure virtual function.
15731         (class Sized_relobj): Add defined_count_ field.  Update
15732         declarations.
15733         (class Input_objects): Add cref_ field.  Update constructor.
15734         Update declarations.
15735         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
15736         defined_count_.
15737         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
15738         symbol counts.
15739         (Sized_dynobj::do_get_global_symbol_counts): New function.
15740         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
15741         defined_count_.  Update declarations.  Define Symbols typedef.
15742         * symtab.cc (Symbol_table::add_from_relobj): Add defined
15743         parameter.  Change all callers.
15744         (Symbol_table::add_from_dynobj): Add sympointers and defined
15745         parameters.  Change all callers.
15746         * symtab.h (class Symbol_table): Update declarations.
15747         * Makefile.am (CCFILES): Add cref.cc.
15748         (HFILES): Add cref.h.
15749         * Makefile.in: Rebuild.
15750
15751 2008-07-22  Simon Baldwin  <simonb@google.com>
15752
15753         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
15754         to zero when writing undefined symbols.
15755
15756 2008-07-22  Ian Lance Taylor  <iant@google.com>
15757
15758         * output.cc (Output_section::add_input_section): Don't try to
15759         merge empty merge sections.
15760
15761 2008-07-21  Craig Silverstein  <csilvers@google.com>
15762
15763         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15764         Include symbol version in error message.
15765
15766 2008-07-20  Chris Demetriou  <cgd@google.com>
15767
15768         * configure.ac (gold_cv_c_random_seed): New configured variable.
15769         (RANDOM_SEED_CFLAGS): New substituted variable.
15770         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
15771         * configure: Rebuild.
15772         * Makefile.in: Likewise.
15773         * testsuite/Makefile.in: Likewise.
15774
15775 2008-07-18  Ian Lance Taylor  <iant@google.com>
15776
15777         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
15778         where we see NAME/NULL and NAME/VERSION  as separate symbols.
15779         * testsuite/ver_test_main.cc (main): Call t4.
15780         (t4, t4_2a): Define.
15781         * testsuite/ver_test_2.cc (t4_2): Define.
15782         * testsuite/ver_test_2.script: Put t4_2a in VER2.
15783         * testsuite/ver_test_4.cc (t4_2a): Define.
15784         * testsuite/ver_test_4.script: Put t4_2a in VER2.
15785         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
15786
15787 2008-07-17  Ian Lance Taylor  <iant@google.com>
15788
15789         * dynobj.cc (Versions::add_def): If we give an error about a
15790         missing version, go ahead and create the version anyhow.
15791
15792 2008-07-10  Ian Lance Taylor  <iant@google.com>
15793
15794         Handle output sections with more than 0x7fffffff bytes.
15795         * object.h (class Relobj): Change map_to_output_ to
15796         output_sections_, and just keep a section pointer.  Change all
15797         uses.  Move comdat group support to Sized_relobj.
15798         (Relobj::is_section_specially_mapped): Remove.
15799         (Relobj::output_section): Remove poff parameter.  Change all
15800         callers.
15801         (Relobj::output_section_offset): New function.
15802         (Relobj::set_section_offset): Rewrite.
15803         (Relobj::map_to_output): Remove.
15804         (Relobj::output_sections): New function.
15805         (Relobj::do_output_section_offset): New pure virtual function.
15806         (Relobj::do_set_section_offset): Likewise.
15807         (class Sized_relobj): Add section_offsets_ field.  Add comdat
15808         group support from Relobj.  Update declarations.
15809         (Sized_relobj::get_output_section_offset): New function.
15810         (Sized_relobj::do_output_section_offset): New function.
15811         (Sized_relobj::do_set_section_offset): New function.
15812         * object.cc (Relobj::output_section_address): Remove.
15813         (Sized_relobj::Sized_relobj): Initialize new fields.
15814         (Sized_relobj::include_section_group): Cast find_kept_object to
15815         Sized_relobj.
15816         (Sized_relobj::include_linkonce_section): Likewise.
15817         (Sized_relobj::do_layout): Use separate arrays for output section
15818         and output offset.
15819         (Sized_relobj::do_count_local_symbols): Change map_to_output to
15820         output_sections.
15821         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
15822         output_sections and section_offsets.
15823         (Sized_relobj::write_local_symbols): Likewise.
15824         (map_to_kept_section): Compute output address directly.
15825         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
15826         output_sections and section_offsets.
15827         (Sized_relobj::write_sections): Likewise.
15828         (Sized_relobj::relocate_sections): Likewise.
15829         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
15830         * output.h (class Output_reloc): Update declarations.  Change
15831         u2_.relobj to Sized_relobj*.
15832         (class Output_data_reloc): Change add functions to use
15833         Sized_relobj*.
15834         * output.cc (Output_reloc::Output_reloc): Change relobj to
15835         Sized_relobj*.
15836         (Output_reloc::local_section_offset): Change return type to
15837         Elf_Addr.  Use get_output_section_offset.
15838         (Output_reloc::get_address): Likewise.
15839         (Output_section::is_input_address_mapped): Don't call
15840         is_section_specially_mapped.
15841         (Output_section::output_offset): Likewise.
15842         (Output_section::output_address): Likewise.
15843         (Output_section::starting_output_address): Likewise.
15844         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
15845         parameter to Sized_relobj*.
15846         (Copy_relocs::need_copy_reloc): Likewise.
15847         (Copy_relocs::save): Likewise.
15848         * copy-relocs.h (class Copy_relocs): Update declarations.
15849         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
15850         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
15851         * target-reloc.h (relocate_for_relocatable): Change
15852         offset_in_output_section type to Elf_Addr.  Change code that uses
15853         it as well.
15854         * layout.cc (Layout::layout): Always set *off.
15855         * mapfile.cc (Mapfile::print_input_section): Use
15856         output_section_offset.
15857         * i386.cc (Target_i386::copy_reloc): Change object parameter to
15858         Sized_relobj*.
15859         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
15860         * sparc.cc (Target_sparc::copy_reloc): Likewise.
15861         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
15862
15863 2008-07-03  Ian Lance Taylor  <iant@google.com>
15864
15865         * layout.cc (Layout::include_section): Do not discard unrecognized
15866         SHT_STRTAB sections.
15867
15868 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
15869
15870         * script.cc (Lex::can_continue_name): Make '?' allowable in
15871         version-script names.
15872         * testsuite/version_script.map: Change glob pattern to use '?'
15873
15874 2008-06-30  Manish Singh  <yosh@gimp.org>
15875
15876         PR 6585
15877         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
15878         Correct typo.
15879
15880 2008-06-30  Ian Lance Taylor  <iant@google.com>
15881
15882         PR 6660
15883         PR 6682
15884         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
15885         versions]: Don't try to read the value in the contents, since we
15886         don't use it.  Use the template endianness when writing.
15887
15888 2008-06-25  Cary Coutant  <ccoutant@google.com>
15889
15890         * fileread.cc (File_read::make_view): Assert on zero-length view.
15891         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
15892         symbol table when there are no symbols to read.
15893
15894 2008-06-23  Craig Silverstein  <csilvers@google.com>
15895
15896         * version.cc (version_string): Bump to 1.7
15897
15898 2008-06-18  Craig Silverstein  <csilvers@google.com>
15899
15900         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
15901         constant 0xFFFF to type Valtype.
15902         (Powerpc_relocate_functions::rel16_ha): Likewise.
15903
15904 2008-06-17  Ian Lance Taylor  <iant@google.com>
15905
15906         * output.h (Output_section::Input_section): Initialize p2align_ to
15907         zero for Output_section_data constructors.
15908         (Output_section::Input_section::addralign): If not an input
15909         section, return the alignment of the Output_section_data.
15910         * testsuite/copy_test.cc: New file.
15911         * testsuite/copy_test_1.cc: New file.
15912         * testsuite/copy_test_2.cc: New file.
15913         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
15914         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
15915         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
15916         (copy_test_1_pic.o, copy_test_1.so): New targets.
15917         (copy_test_2_pic.o, copy_test_2.so): New targets.
15918         * testsuite/Makefile.in: Rebuild.
15919
15920         * script-sections.cc (Script_sections::place_orphan): Initialize
15921         local variable exact.
15922
15923 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
15924
15925         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
15926
15927 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
15928             David S. Miller  <davem@davemloft.net>
15929
15930         * powerpc.cc: New file.
15931         * Makefile.am (TARGETSOURCES): Add powerpc.cc
15932         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
15933         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
15934         * Makefile.in: Rebuild.
15935
15936 2008-06-09  Ian Lance Taylor  <iant@google.com>
15937
15938         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
15939         <exception>.
15940         (throwing, orig_terminate): New static variables.
15941         (terminate_handler): New static function.
15942         (t2): Set terminate handler.
15943
15944 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
15945
15946         PR 6584
15947         * binary.cc (Binary_to_elf::sized_convert): Fix .data
15948         alignment.
15949
15950 2008-05-30  Cary Coutant  <ccoutant@google.com>
15951
15952         * archive.cc (Archive::include_all_members) Correct to step
15953         over symbol table and extended name table in thin archives.
15954
15955 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
15956
15957         PR 6407
15958         * target-reloc.h (relocate_for_relocatable): Fix new_offset
15959         calculation.
15960
15961 2008-05-28  Caleb Howe  <cshowe@google.com>
15962
15963         * reduced_debug_output.cc: New file.
15964         * reduced_debug_output.h: New file.
15965         * options.h (class General_options): Add --strip-debug-non-line.
15966         * options.cc (General_options::finalize): Add strip_debug_non_line
15967         to the strip heirarchy.
15968         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
15969         fields.
15970         * layout.cc: Include "reduced_debug_output.h".
15971         (Layout::Layout): Initialize new fields.
15972         (line_only_debug_sections): New static array.
15973         (is_lines_only_debug_sections): New static inline function.
15974         (Layout::include_section): Handle --strip-debug-non-line.
15975         (Layout::make_output_section): If --strip-debug-non-line, build
15976         new output sections for .debug_abbrev and .debug_info.
15977         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
15978         gold.  Warn about possible overflow.
15979         (read_signed_LEB_128): Likewise.
15980         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
15981         (read_signed_LEB_128): Declare.
15982         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
15983         (HFILES): Add reduced_debug_output.h.
15984         * Makefile.in: Rebuild.
15985
15986 2008-05-21  Ian Lance Taylor  <iant@google.com>
15987
15988         * mapfile.cc: New file.
15989         * mapfile.h: New file.
15990         * options.h (class General_options): Add -M/--print-map and -Map.
15991         * options.cc (General_options::finalize): Make -M equivalent to
15992         -Map -.
15993         * main.cc: Include <cstdio> and "mapfile.h".
15994         (main): Open mapfile if requested.
15995         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
15996         constructor.  Change caller.
15997         (queue_initial_tasks): Add mapfile parameter.  Change caller.
15998         (queue_middle_tasks): Likewise.
15999         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
16000         declarations.
16001         * archive.cc: Include "mapfile.h".
16002         (Archive::add_symbols): Add mapfile parameter.  Change all
16003         callers.  Pass mapfile, symbol, and reason to include_member.
16004         (Archive::include_all_members): Add mapfile parameter.  Change all
16005         callers.
16006         (Archive::include_member): Add mapfile, sym, and why parameters.
16007         Change all callers.  Report inclusion to map file.
16008         * archive.h: Include "fileread.h".
16009         (class Archive): Update declarations.
16010         (Archive::file): New const method.
16011         (class Add_archive_symbols): Add mapfile_ field.  Update
16012         constructor.  Change all callers.
16013         * readsyms.h (class Read_symbols): Likewise.
16014         (class Finish_group): Likewise.
16015         (class Read_script): Likewise.
16016         * common.cc: Include "mapfile.h".
16017         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
16018         all callers.
16019         (Symbol_table::do_allocate_commons): Likewise.
16020         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
16021         symbol allocation to mapfile.
16022         * common.h (class Allocate_commons_task): Add mapfile_ field.
16023         Update constructor.  Change all callers.
16024         * symtab.h (class Symbol_table): Update declarations.
16025         * layout.cc: Include "mapfile.h".
16026         (Layout_task_runner::run): Print information to mapfile.
16027         (Layout::create_gold_note): Change Output_data_fixed_space to
16028         Output_data_zero_fill.
16029         (Layout::create_build_id): Likewise.
16030         (Layout::print_to_mapfile): New function.
16031         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
16032         constructor.  Change caller.
16033         (class Layout): Declare print_to_mapfile.
16034         * output.cc (Output_section::Input_section::print_to_mapfile): New
16035         function.
16036         (Output_section::add_input_section): If producing a map, always
16037         add to input_sections_ list.
16038         (Output_section::do_print_to_mapfile): New function.
16039         (Output_segment::print_sections_to_mapfile): New function.
16040         (Output_segment::print_section_list_to_mapfile): New function.
16041         * output.h: Include "mapfile.h".
16042         (Output_data::print_to_mapfile): New function.
16043         (Output_data::do_print_to_mapfile): New virtual function.
16044         (Output_segment_headers::do_print_to_mapfile): New function.
16045         (Output_file_header::do_print_to_mapfile): New function.
16046         (Output_data_const::do_print_to_mapfile): New function.
16047         (class Output_data_const_buffer): Add map_name_ field.  Update
16048         constructor.  Change all callers.  Add do_print_to_mapfile
16049         function.
16050         (class Output_data_fixed_space): Likewise.
16051         (class Output_data_space): Likewise.
16052         (class Output_data_zero_fill): New class.
16053         (Output_data_strtab::do_print_to_mapfile): New function.
16054         (Output_data_reloc_base::do_print_to_mapfile): New function.
16055         (Output_relocatable_relocs::do_print_to_mapfile): New function.
16056         (Output_data_group::do_print_to_mapfile): New function.
16057         (Output_data_got::do_print_to_mapfile): New function.
16058         (Output_data_dynamic::do_print_to_mapfile): New function.
16059         (Output_symtab_xindex::do_print_to_mapfile): New function.
16060         (class Output_section): Declare do_print_to_mapflie.  Declare
16061         print_to_mapfile in Input_section.
16062         (class Output_segment): Declare new functions.
16063         * object.h (Sized_relobj::symbol_count): New function.
16064         * script-sections.cc
16065         (Output_section_element_dot_assignment::set_section_addresses):
16066         Change Output_data_fixed_space to Output_data_zero_fill.
16067         (Output_data_expression::do_print_to_mapfile): New function.
16068         * script.cc (read_input_script): Add mapfile parameter.  Change
16069         all callers.
16070         * script.h (read_input_script): Update declaration.
16071         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
16072         (Eh_frame::do_print_to_mapfile): New function.
16073         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
16074         (Output_merge_string::do_print_to_mapfile): New function.
16075         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
16076         function.
16077         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
16078         function.
16079         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
16080         function.
16081         * Makefile.am (CCFILES): Add mapfile.cc.
16082         (HFILES): Add mapfile.h.
16083         * Makefile.in: Rebuild.
16084
16085 2008-05-19  Ian Lance Taylor  <iant@google.com>
16086
16087         * options.h (class General_options): Add -z relro.
16088         * layout.cc (Layout::Layout): Initialize relro_segment_.
16089         (Layout::add_output_section_data): Return the output section.
16090         (Layout::make_output_section): Rcognize relro sections and mark
16091         them appropriately.
16092         (Layout::attach_allocated_section_to_segment): Put relro sections
16093         in a PT_GNU_RELRO segment.
16094         (Layout::create_initial_dynamic_sections): Mark the .dynamic
16095         section as relro.
16096         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
16097         PT_TLS segments.
16098         (Layout::linkonce_mapping): Map d.rel.ro.local to
16099         .data.rel.ro.local.
16100         (Layout::output_section_name): Us .data.rel.ro.local for any
16101         section which begins with that.
16102         * layout.h (class Layout): Update add_output_section_data
16103         declaration.  Add relro_segment_ field.
16104         * output.cc (Output_section::Output_section): Initialize is_relro_
16105         and is_relro_local_ fields.
16106         (Output_segment::add_output_section): Group relro sections.
16107         (Output_segment::is_first_section_relro): New function.
16108         (Output_segment::maximum_alignment): If there is a relro section,
16109         align the segment to the common page size.
16110         (Output_segment::set_section_addresses): Track whether we are
16111         looking at relro sections.  If the last section is a relro
16112         section, align to the common page size.
16113         (Output_segment::set_section_list_addresses): Add in_relro
16114         parameter.  Change all callers.  Align to the page size when
16115         moving from relro to non-relro section.
16116         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
16117         segment.
16118         * output.h (class Output_section): Add is_relro_ and
16119         is_relro_local_ fields.
16120         (Output_section::is_relro): New function.
16121         (Output_section::set_is_relro): New function.
16122         (Output_section::is_relro_local): New function.
16123         (Output_section::set_is_relro_local): New function.
16124         (class Output_segment): Update declarations.
16125         * i386.cc (Target_i386::got_section): Mark .got section as relro.
16126         * sparc.cc (Target_sparc::got_section): Likewise.
16127         * x86_64.cc (Target_x86_64::got_section): Likewise.
16128         * testsuite/relro_test_main.cc: New file.
16129         * testsuite/relro_test.cc: New file.
16130         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
16131         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
16132         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
16133         (relro_test.so, relro_test_pic.o): New targets.
16134         * testsuite/Makefile.in: Rebuild.
16135
16136 2008-05-16  Ian Lance Taylor  <iant@google.com>
16137
16138         * output.cc (Output_segment::add_output_section): Remove front
16139         parameter.
16140         * output.h (class Output_segment): Remove
16141         add_initial_output_section and overloaded add_output_section.
16142         Update declaration of remaining add_output_section.
16143         * layout.cc (Layout::create_interp): Call add_output_section
16144         rather than add_initial_output_section.
16145         (Layout::finish_dynamic_section): Likewise.
16146
16147         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
16148         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
16149         know the dynamic type.
16150         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
16151         field.  Initialize it in constructor.
16152         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
16153         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
16154         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
16155         reloc.
16156
16157         * output.cc (Output_reloc::get_address): Change return type to
16158         Elf_Addr.
16159         * output.h (class Output_reloc): Update get_address declaration.
16160         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
16161         for section addresses.
16162
16163 2008-05-09  Ian Lance Taylor  <iant@google.com>
16164
16165         PR 6493
16166         * gold.cc (gold_nomem): Use return value of write.
16167
16168 2008-05-08  Ian Lance Taylor  <iant@google.com>
16169
16170         * symtab.c (Symbol::init_base_output_data): Add version
16171         parameter.  Change all callers.
16172         (Symbol::init_base_output_segment): Likewise.
16173         (Symbol::init_base_constant): Likewise.
16174         (Symbol::init_base_undefined): Likewise.
16175         (Sized_symbol::init_output_data): Likewise.
16176         (Sized_symbol::init_output_segment): Likewise.
16177         (Sized_symbol::init_constant): Likewise.
16178         (Sized_symbol::init_undefined): Likewise.
16179         (Symbol_table::do_define_in_output_data): If the new symbol has a
16180         version, mark it as the default.
16181         (Symbol_table::do_define_in_output_segment): Likewise.
16182         (Symbol_table::do_define_as_constant): Likewise.
16183         * symtab.h (class Symbol): Update declarations.
16184         (class Sized_symbol): Likewise.
16185         * resolve.cc (Symbol::override_version): New function.
16186         (Symbol::override_base): Call override_version.
16187         (Symbol::override_base_with_special): Likewise.
16188         * testsuite/ver_script_8.script: New file.
16189         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
16190         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
16191         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
16192         (ver_test_8_1.so, ver_test_8_2.so): New targets.
16193
16194 2008-05-06  Ian Lance Taylor  <iant@google.com>
16195
16196         PR 6049
16197         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
16198         functions.
16199         (class General_options): Remove existing --undefined, and add
16200         --no-undefined instead.  Add new --undefined as synonym for -u.
16201         * archive.cc (Archive::add_symbols): Check whether symbol was
16202         named with -u.
16203         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
16204         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
16205         all uses.  Add IS_UNDEFINED.  Update declarations to split
16206         different versions of init_base.  Declare init_base_undefined.
16207         (Symbol::is_defined): Handle IS_UNDEFINED.
16208         (Symbol::is_undefined): Likewise.
16209         (Symbol::is_weak_undefined): Call is_undefined.
16210         (Symbol::is_absolute): Handle IS_CONSTANT.
16211         (class Sized_symbol): Update declarations to split different
16212         versions of init.  Declare init_undefined.
16213         (class Symbol_table): Declare new functions.
16214         * symtab.cc (Symbol::init_base_object): Rename from init_base.
16215         Change all callers.
16216         (Symbol::init_base_output_data): Likewise.
16217         (Symbol::init_base_output_segment): Likewise.
16218         (Symbol::init_base_constant): Likewise.
16219         (Symbol::init_base_undefined): New function.
16220         (Sized_symbol::init_object): Rename from init.  Change all
16221         callers.
16222         (Sized_symbol::init_output_data): Likewise.
16223         (Sized_symbol::init_output_segment): Likewise.
16224         (Sized_symbol::init_constant): Likewise.
16225         (Sized_symbol::init_undefined): New function.
16226         (Symbol_table::add_undefined_symbols_from_command_line): New
16227         function.
16228         (Symbol_table::do_add_undefined_symbols_from_command_line): New
16229         function.
16230         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
16231         (Symbol::output_section): Likewise.
16232         (Symbol::set_output_section): Likewise.
16233         (Symbol_table::sized_finalize_symbol): Likewise.
16234         (Symbol_table::sized_write_globals): Likewise.
16235         * resolve.cc (Symbol_table::should_override): Likewise.
16236         (Symbol::override_base_with_special): Likewise.
16237
16238         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
16239         symbol, change it to have default visibility.
16240         * testsuite/protected_1.cc: New file.
16241         * testsuite/protected_2.cc: New file.
16242         * testsuite/protected_3.cc: New file.
16243         * testsuite/protected_main_1.cc: New file.
16244         * testsuite/protected_main_2.cc: New file.
16245         * testsuite/protected_main_3.cc: New file.
16246         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
16247         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
16248         (protected_1_LDFLAGS, protected_1_LDADD): Define.
16249         (protected_1.so): New target.
16250         (protected_1_pic.o, protected_2_pic.o): New targets.
16251         (protected_3_pic.o): New target.
16252         (check_PROGRAMS): Add protected_2.
16253         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
16254         (protected_2_LDFLAGS, protected_2_LDADD): Define.
16255         * testsuite/Makefile.in: Rebuild.
16256
16257         * options.h (DEFINE_var): Add set_user_set_##varname__.
16258         (DEFINE_bool_alias): New macro.
16259         (class General_options): Define -Bstatic using DEFINE_bool_alias
16260         rather than DEFINE_special.  Add --undefined as an alias for -z
16261         defs.
16262         * options.cc (General_options::parse_Bstatic): Remove.
16263
16264         * options.h (class General_options): Add --fatal-warnings.
16265         * main.cc (main): Implement --fatal-warnings.
16266         * errors.h (Errors::warning_count): New function.
16267
16268         * options.h (class General_options): Add -Bsymbolic-functions.
16269         * symtab.h (Symbol::is_preemptible): Check for
16270         -Bsymbolic-functions.
16271
16272 2008-05-05  Ian Lance Taylor  <iant@google.com>
16273
16274         * options.h (DEFINE_bool): For DASH_Z, create the negative option
16275         as noVARNAME rather than no-VARNAME.
16276         (class General_options): Add option -z combreloc.
16277         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
16278         get_address.
16279         (Output_reloc::sort_before) [SHT_REL]: New function.
16280         (Output_reloc::sort_before) [SHT_RELA]: New function.
16281         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
16282         Sort_relocs_comparison.
16283         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
16284         parameter.  Change all callers.
16285         (Output_data_reloc::Output_data_reloc) [both versions]: Add
16286         sort_relocs parameter.  Change all callers.
16287         * output.cc (Output_reloc::get_address): New function, broken out
16288         of write_rel.
16289         (Output_reloc::write_rel): Call it.
16290         (Output_reloc::compare): New function.
16291         (Output_data_reloc_base::do_write): Optionally sort relocs.
16292
16293         * configure.ac: If targ_extra_obj is set, link it in.
16294         * configure.tgt: Initialize all variables.
16295         (x86_64*): Set targ_extra_obj and targ_extra_size.
16296         * configure: Rebuild.
16297
16298         * object.cc (Sized_relobj::include_section_group): Adjust section
16299         indexes read from group data.  Build vector to pass to
16300         layout_group.
16301         * layout.cc (Layout::layout_group): Add flags and shndxes
16302         parameters.  Remove contents parameter.  Change caller.  Update
16303         explicit instantiations.
16304         * layout.h (class Layout): Update layout_group declaration.
16305         * output.cc (Output_data_group::Output_data_group): Add flags and
16306         input_shndxes parameters.  Remove contents parameter.  Change
16307         caller.
16308         (Output_data_group::do_write): Change input_sections_ to
16309         input_shndxes_.
16310         * output.h (class Output_data_group): Update constructor
16311         declaration.  Rename input_sections_ to input_shndxes_.
16312         * testsuite/many_sections_test.cc: Add template.
16313
16314 2008-04-30  Cary Coutant  <ccoutant@google.com>
16315
16316         * target-reloc.h (relocate_section): Fix dead-pointer bug.
16317
16318         * layout.cc (Layout::include_section): Refactored check for debug
16319         info section.
16320         (Layout::add_comdat): Add new parameters.  Change type
16321         of signature parameter.  Add object and shndx to signatures table.
16322         (Layout::find_kept_object): New function.
16323         * layout.h: Include <cstring>.
16324         (Layout::is_debug_info_section): New function.
16325         (Layout::add_comdat): Add new parameters.
16326         (Layout::find_kept_object): New function.
16327         (Layout::Kept_section): New struct.
16328         (Layout::Signatures): Change type of map range.
16329         * object.cc (Relobj::output_section_address): New function.
16330         (Sized_relobj::include_section_group): Add new parameters.  Change
16331         calls to Layout::add_comdat.  Change to build table of kept comdat
16332         groups and table mapping discarded sections to kept sections.
16333         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
16334         (Sized_relobj::do_layout): Change calls to include_section_group and
16335         include_linkonce_section.
16336         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
16337         value to zero when section is discarded.
16338         (Sized_relobj::map_to_kept_section): New function.
16339         * object.h (Relobj::output_section_address): New function.
16340         (Relobj::Comdat_group): New type.
16341         (Relobj::find_comdat_group): New function.
16342         (Relobj::Comdat_group_table): New type.
16343         (Relobj::Kept_comdat_section): New type.
16344         (Relobj::Kept_comdat_section_table): New type.
16345         (Relobj::add_comdat_group): New function.
16346         (Relobj::set_kept_comdat_section): New function.
16347         (Relobj::get_kept_comdat_section): New function.
16348         (Relobj::comdat_groups_): New field.
16349         (Relobj::kept_comdat_sections_): New field.
16350         (Symbol_value::input_value): Update comment.
16351         (Sized_relobj::map_to_kept_section) New function.
16352         (Sized_relobj::include_linkonce_section): Add new parameter.
16353         * target-reloc.h (Comdat_behavior): New type.
16354         (get_comdat_behavior): New function.
16355         (relocate_section): Add code to map a discarded section to the
16356         corresponding kept section when applying a relocation.
16357
16358 2008-04-30  Craig Silverstein  <csilvers@google.com>
16359
16360         * dwarf_reader.cc (next_generation_count): New static var.
16361         (Addr2line_cache_entry): New struct.
16362         (addr2line_cache): New static var.
16363         (Dwarf_line_info::one_addr2line): Added caching.
16364         (Dwarf_line_info::clear_addr2line_cache): New function.
16365         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
16366         cache-size parameter.
16367         (Dwarf_line_info::one_addr2line_cache): New function.
16368         * symtab.cc (Symbol_table::detect_odr_violations): Pass
16369         new cache-size argument to one_addr2line(), and clear cache.
16370
16371 2008-04-28  Cary Coutant  <ccoutant@google.com>
16372
16373         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
16374         R_386_PC8 relocations.
16375
16376 2008-04-23  Ian Lance Taylor  <iant@google.com>
16377
16378         * object.cc (Sized_relobj::include_section_group): Check for
16379         invalid section group.
16380
16381         * object.cc (make_elf_object): Correct test for 64-bit ELF file
16382         header size.
16383
16384         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
16385         than read for file header.
16386         * archive.cc (Archive::include_member): Likewise.
16387
16388 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
16389
16390         * aclocal.m4: Regenerate.
16391         * configure: Regenerate.
16392
16393 2008-04-19  Ian Lance Taylor  <iant@google.com>
16394
16395         * version.cc (version_string): Bump to 1.6.
16396
16397         * testsuite/Makefile.am (many_sections_r_test): New target.
16398         (many_sections_r_test_SOURCES): Remove.
16399         (many_sections_r_test_DEPENDENCIES): Remove.
16400         (many_sections_r_test_LDFLAGS): Remove.
16401         (many_sections_r_test_LDADD): Remove.
16402
16403         * object.cc (Sized_relobj::do_add_symbols): Always pass
16404         local_symbol_count_ to add_from_relobj.
16405
16406         * testsuite/Makefile.am (many_sections_check.h): Only check one in
16407         every thousand variables.
16408         * testsuite/Makefile.in: Rebuild.
16409
16410         * object.cc (Xindex::initialize_symtab_xindex): New function.
16411         (Xindex::read_symtab_xindex): New function.
16412         (Xindex::sym_xindex_to_shndx): New function.
16413         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
16414         available.
16415         (Sized_relobj::do_initialize_xindex): New function.
16416         (Sized_relobj::do_read_symbols): Adjust section links.
16417         (Sized_relobj::symbol_section_and_value): Add is_ordinary
16418         parameter.  Change all callers.
16419         (Sized_relobj::include_section_group): Adjust section links and
16420         symbol section indexes.
16421         (Sized_relobj::do_layout): Adjust section links.
16422         (Sized_relobj::do_count_local_symbols): Adjust section links and
16423         symbol section indexes.
16424         (Sized_relobj::do_finalize_local_symbols): Distinguish between
16425         ordinary and special symbols.
16426         (Sized_relobj::write_local_symbols): Add symtab_xindex and
16427         dynsym_xindex parameters.  Change all callers.  Adjust section
16428         links.  Use SHN_XINDEX when needed.
16429         (Sized_relobj::get_symbol_location_info): Adjust section links.
16430         Don't get fooled by special symbols.
16431         * object.h (class Xindex): Define.
16432         (class Object): Add xindex_ parameter.  Declare virtual functoin
16433         do_initialize_xindex.
16434         (Object::adjust_sym_shndx): New function.
16435         (Object::set_xindex): New protected function.
16436         (class Symbol_value): Add is_ordinary_shndx_ field.
16437         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
16438         (Symbol_value::value): Assert ordinary section.
16439         (Symbol_value::initialize_input_to_output_map): Likewise.
16440         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
16441         Change all callers.
16442         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
16443         all callers.
16444         (class Sized_relobj): Update declarations.
16445         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
16446         parameter.  Change all callers.
16447         (Sized_relobj::adjust_shndx): New function.
16448         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
16449         field.
16450         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
16451         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
16452         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
16453         (Sized_dynobj::read_dynsym_section): Adjust section links.
16454         (Sized_dynobj::read_dynamic): Likewise.
16455         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
16456         section links.
16457         (Sized_dynobj::do_initialize_xindex): New function.
16458         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
16459         do_initialize_xindex.
16460         (Sized_dynobj::adjust_shndx): New function.
16461         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
16462         dynsym_xindex_ fields.
16463         (Layout::finalize): Add a call to set_section_indexes before
16464         creating the symtab sections.
16465         (Layout::set_section_indexes): Don't do anything if the section
16466         already has a section index.
16467         (Layout::create_symtab_sections): Add shnum parameter.  Change
16468         caller.  Create .symtab_shndx section if needed.
16469         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
16470         caller.
16471         (Layout::allocated_output_section_count): New function.
16472         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
16473         needed.
16474         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
16475         fields.  Update declarations.
16476         (Layout::symtab_xindex): New function.
16477         (Layout::dynsym_xindex): New function.
16478         (class Write_symbols_task): Add layout_ field.
16479         (Write_symbols_task::Write_symbols_task): Add layout parameter.
16480         Change caller.
16481         * output.cc (Output_section_headers::Output_section_headers): Add
16482         shstrtab_section parameter.  Change all callers.
16483         (Output_section_headers::do_sized_write): Store overflow values
16484         for section count and section string table section index in
16485         section header zero.
16486         (Output_file_header::do_sized_write): Check for overflow of
16487         section count and section string table section index.
16488         (Output_symtab_xindex::do_write): New function.
16489         (Output_symtab_xindex::endian_do_write): New function.
16490         * output.h (class Output_section_headers): Add shstrtab_section_.
16491         Update declarations.
16492         (class Output_symtab_xindex): Define.
16493         (Output_section::has_out_shndx): New function.
16494         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
16495         field.
16496         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
16497         Change all callers.
16498         (Sized_symbol::init): Likewise.
16499         (Symbol::output_section): Check for ordinary symbol.
16500         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
16501         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
16502         callers.
16503         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
16504         Change all callers.  Simplify handling of symbols from sections
16505         not included in the link.
16506         (Symbol_table::add_from_dynobj): Handle ordinary symbol
16507         distinction.
16508         (Weak_alias_sorter::operator()): Assert that symbols are
16509         ordinary.
16510         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
16511         distinction.
16512         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
16513         parameters.  Change all callers.
16514         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
16515         symbol distinction.  Use SHN_XINDEX when needed.
16516         (Symbol_table::write_section_symbol): Add symtab_xindex
16517         parameter.  Change all callers.
16518         (Symbol_table::sized_write_section_symbol): Likewise.  Use
16519         SHN_XINDEX when needed.
16520         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
16521         declarations.
16522         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
16523         (Symbol::is_defined): Check is_ordinary.
16524         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
16525         (Symbol::is_absolute, Symbol::is_common): Likewise.
16526         (class Sized_symbol): Update declarations.
16527         (class Symbol_table): Update declarations.
16528         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
16529         parameters.  Change all callers.
16530         (Sized_symbol::override): Likewise.
16531         (Symbol_table::override): Likewise.
16532         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
16533         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
16534         is_ordinary, and orig_st_shndx parameters.  Change all callers.
16535         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
16536         to be in an ordinary section.
16537         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
16538         object and is_ordinary parameters.  Change all callers.
16539         (Sized_dwarf_line_info::read_relocs): Add object parameter.
16540         Change all callers.  Don't add undefined or non-ordinary symbols
16541         to reloc_map_.
16542         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
16543         Change all callers.
16544         * dwarf_reader.h (class Sized_dwarf_line_info): Update
16545         declarations.
16546         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
16547         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
16548         (Sized_relobj::relocate_sections): Likewise.
16549         * target-reloc.h (scan_relocs): Adjust section symbol index.
16550         (scan_relocatable_relocs): Likewise.
16551         * i386.cc (Scan::local): Check for ordinary symbols.
16552         * sparc.cc (Scan::local): Likewise.
16553         * x86_64.cc (Scan::local): Likewise.
16554         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
16555         to symbol_section_and_value.
16556         * testsuite/many_sections_test.cc: New file.
16557         * testsuite/Makefile.am (BUILT_SOURCES): Define.
16558         (check_PROGRAMS): Add many_sections_test.
16559         (many_sections_test_SOURCES): Define.
16560         (many_sections_test_DEPENDENCIES): Define.
16561         (many_sections_test_LDFLAGS): Define.
16562         (BUILT_SOURCES): Add many_sections_define.h.
16563         (many_sections_define.h): New target.
16564         (BUILT_SOURCES): Add many_sections_check.h.
16565         (many_sections_check.h): New target.
16566         (check_PROGRAMS): Add many_sections_r_test.
16567         (many_sections_r_test_SOURCES): Define.
16568         (many_sections_r_test_DEPENDENCIES): Define.
16569         (many_sections_r_test_LDFLAGS): Define.
16570         (many_sections_r_test_LDADD): Define.
16571         (many_sections_r_test.o): New target.
16572         * testsuite/Makefile.in: Rebuild.
16573
16574 2008-04-17  Cary Coutant  <ccoutant@google.com>
16575
16576         * errors.cc (Errors::info): New function.
16577         (gold_info): New function.
16578         * errors.h (Errors::info): New function.
16579         * gold.h (gold_info): New function.
16580         * object.cc (Input_objects::add_object): Print trace output.
16581         * options.cc (options::parse_set): New function.
16582         (General_options::parse_wrap): Deleted.
16583         (General_options::General_options): Deleted initializer.
16584         * options.h (options::String_set): New typedef.
16585         (options::parse_set): New function.
16586         (DEFINE_set): New macro.
16587         (General_options::wrap): Changed to use DEFINE_set. Changed
16588         callers of any_wrap_symbols and is_wrap_symbol.
16589         (General_options::trace, General_options::trace_symbol):
16590         New options.
16591         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
16592         (General_options::wrap_symbols_): Deleted.
16593         * symtab.cc (Symbol_table::add_from_object): Print trace output.
16594
16595 2008-04-17  David S. Miller  <davem@davemloft.net>
16596
16597         * options.cc (General_options::parse_V): New function.
16598         * options.h: Add entries for -V and -Qy.
16599
16600 2008-04-17  Ian Lance Taylor  <iant@google.com>
16601
16602         * common.cc (Symbol_table::allocate_commons): Remove options
16603         parameter.  Change caller.
16604         (Symbol_table::do_allocate_commons): Remove options parameter.
16605         Change caller.  Just call do_allocate_commons_list twice.
16606         (Symbol_table::do_allocate_commons_list): New function, broken out
16607         of do_allocate_commons.
16608         * common.h (class Allocate_commons_task): Remove options_ field.
16609         Update constructor.
16610         * symtab.cc (Symbol_table::Symbol_table): Initialize
16611         tls_commons_.
16612         (Symbol_table::add_from_object): Put TLS common symbols on
16613         tls_commons_ list.
16614         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
16615         which are IN_OUTPUT_DATA.
16616         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
16617         allocate_commons and do_allocate_commons declarations.  Declare
16618         do_allocate_commons_list.
16619         * gold.cc (queue_middle_tasks): Update creation of
16620         Allocate_commons_task to not pass options.
16621         * testsuite/Makefile.am (INCLUDES): Add -I.. .
16622         (TLS_TEST_C_FLAGS): New variable.
16623         (tls_test_c_pic.o): New target.
16624         (tls_test_shared.so): Link in tls_test_c_pic.o.
16625         (tls_test_c_pic_ie.o): New target.
16626         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
16627         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
16628         (tls_test_c.o): New target.
16629         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
16630         (tls_pic_test_LDADD): Likewise.
16631         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
16632         (tls_shared_gd_to_ie_test_LDADD): Likewise.
16633         (tls_test_c_gnu2.o): New target.
16634         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
16635         tls_test_c_gnu2.o.
16636         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
16637         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
16638         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
16639         * testsuite/tls_test.cc: Include "config.h".
16640         (t_last): Call t11_last.
16641         * testsuite/tls_test.h (t11, t11_last): Declare.
16642         * testsuite/tls_test_c.c: New file.
16643         * testsuite/tls_test_main.cc (thread_routine): Call t11.
16644         * configure.ac: Check for OpenMP support.
16645         * configure, config.in, Makefile.in: Rebuild.
16646         * testsuite/Makefile.in: Rebuild.
16647
16648 2008-04-16  Cary Coutant  <ccoutant@google.com>
16649
16650         * i386.cc (Target_i386::define_tls_base_symbol): New function.
16651         (Target_i386::tls_base_symbol_defined_): New field.
16652         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16653         (Target_i386::Scan::global): Likewise.
16654         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
16655         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
16656         (Target_x86_64::tls_base_symbol_defined_): New field.
16657         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16658         (Target_x86_64::Scan::global): Likewise.
16659
16660 2008-04-16  Cary Coutant  <ccoutant@google.com>
16661
16662         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
16663         (Symbol::needs_plt_entry): Allow weak undefined symbols.
16664         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
16665         building shared libraries.
16666         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
16667         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
16668         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
16669         * testsuite/Makefile.in: Rebuild.
16670         * testsuite/weak_undef.h: New file.
16671         * testsuite/weak_undef_file1.cc: Add extra test cases.
16672         * testsuite/weak_undef_file2.cc: Likewise.
16673         * testsuite/weak_undef_test.cc: Likewise.
16674
16675 2008-04-16  David S. Miller  <davem@davemloft.net>
16676
16677         * sparc.cc (Target_sparc::Scan): Change from struct to class.
16678         Add issued_non_pic_error_ field.  Declare check_non_pic.
16679         (Target_sparc::Scan::check_non_pic): New function.
16680         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
16681         (Target_sparc::Scan::global): Likewise.
16682
16683         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
16684         * configure: Rebuild.
16685
16686         * options.h (DEFINE_enable): New macro.
16687         (new_dtags): New enable option.
16688         (initfirst, interpose, loadfltr, nodefaultlib,
16689         nodelete, nodlopen, nodump): New -z options.
16690         * layout.cc (Layout:finish_dynamic_section): If new
16691         dtags enabled, emit DT_RUNPATH.  Also, emit a
16692         DT_FLAGS_1 containing any specified -z flags.
16693
16694 2008-04-16  Ian Lance Taylor  <iant@google.com>
16695
16696         * copy-relocs.cc: New file.
16697         * copy-relocs.h: New file.
16698         * reloc.cc: Remove Copy_relocs code.
16699         * reloc.h: Likewise.
16700         * reloc-types.h (struct Reloc_types) [both versions]: Add
16701         get_reloc_addend_noerror.
16702         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
16703         variants of add_global which take an addend which must be zero.
16704         * i386.cc: Include "copy-relocs.h".
16705         (class Target_i386): Change type of copy_relocs_ to variable,
16706         update initializer.
16707         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
16708         Change all callers.
16709         (Target_i386::do_finalize_sections): Change handling of
16710         copy_relocs_.
16711         * sparc.cc: Include "copy-relocs.h".
16712         (class Target_sparc): Change type of copy_relocs_ to variable,
16713         update initializer.
16714         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
16715         Change all callers.
16716         (Target_sparc::do_finalize_sections): Change handling of
16717         copy_relocs_.
16718         * x86_64.cc: Include "copy-relocs.h".
16719         (class Target_x86_64): Change type of copy_relocs_ to variable,
16720         update initializer.
16721         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
16722         class.  Change all callers.
16723         (Target_x86_64::do_finalize_sections): Change handling of
16724         copy_relocs_.
16725         * Makefile.am (CCFILES): Add copy-relocs.cc.
16726         (HFILES): Add copy-relocs.h.
16727
16728         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
16729
16730         * testsuite/script_test_4.sh: Permit leading zeroes.
16731
16732 2008-04-15  Ian Lance Taylor  <iant@google.com>
16733
16734         * script-sections.cc (Script_sections::create_segments): Use
16735         header_size_adjustment even when there is enough room for the
16736         headers.
16737         * testsuite/script_test_4.sh: New file.
16738         * testsuite/script_test_4.t: New file.
16739         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
16740         (check_DATA): Add script_test_4.stdout.
16741         (MOSTLYCLEANFILES): Likewise.
16742         (script_test_4): New target.
16743         (script_test_4.stdout): New target.
16744         * testsuite/Makefile.in: Rebuild.
16745
16746         * sparc.cc: Add definitions for Output_data_plt_sparc class
16747         constants.
16748
16749 2008-04-14  David S. Miller  <davem@davemloft.net>
16750
16751         * sparc.cc: New file.
16752         * Makefile.am (TARGETSOURCES): Add sparc.cc
16753         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
16754         * configure.tgt: Document targ_extra_size and
16755         targ_extra_big_endian.  Add entries for sparc-* and
16756         sparc64-*.
16757         * configure.ac: Handle targ_extra_size and
16758         targ_extra_big_endian.
16759         * Makefile.in: Rebuild.
16760         * configure: Likewise.
16761         * po/POTFILES.in: Likewise.
16762         * po/gold.pot: Likewise.
16763
16764 2008-04-14  Ian Lance Taylor  <iant@google.com>
16765
16766         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
16767         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
16768         in the name/type/flags to section mapping.  Don't call
16769         allocate_output_section.
16770         (Layout::choose_output_section): Change parameter from adjust_name
16771         to is_input_section.  Don't permit input sections after sections
16772         are attached to segments.  Don't call allocate_output_section.
16773         (Layout::layout_eh_frame): Call update_flags_for_input_section,
16774         not write_enable_output_section.
16775         (Layout::make_output_section): Don't push to
16776         unattached_section_list_ nor call attach_to_segment.  Call
16777         attach_section_to_segment if sections are attached.
16778         (Layout::attach_sections_to_segments): New function.
16779         (Layout::attach_section_to_segment): New function.
16780         (Layout::attach_allocated_section_to_segment): Rename from
16781         attach_to_segment.  Remove flags parameter.
16782         (Layout::allocate_output_section): Remove function.
16783         (Layout::write_enable_output_section): Remove function.
16784         * layout.h (class Layout): Update for above changes.  Add new
16785         field sections_are_attached_.
16786         * output.h (Output_section::update_flags_for_input_section): New
16787         function.
16788         * output.cc (Output_section::add_input_section): Call
16789         update_flags_for_input_section.
16790         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
16791
16792 2008-04-11  Cary Coutant  <ccoutant@google.com>
16793
16794         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
16795         thought unnecessary.
16796         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
16797
16798 2008-04-11  Ian Lance Taylor  <iant@google.com>
16799
16800         * output.h (class Output_section_data): Remove inline definition
16801         of set_addralign.
16802         * output.cc (Output_section_data::set_addralign): New function.
16803
16804 2008-04-11  Cary Coutant  <ccoutant@google.com>
16805
16806         Add support for TLS descriptors for i386 and x86_64.
16807         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
16808         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
16809         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
16810         GOT_TYPE_TLS_DESC.
16811         (Target_i386::got_mod_index_entry): Remove unnecessary code.
16812         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
16813         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
16814         relocations.
16815         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
16816         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
16817         Fix problem with initial-exec relocations.
16818         (Target_i386::Relocate::relocate_tls): Likewise.
16819         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
16820         relaxation.
16821         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
16822         support for section-plus-offset dynamic table entries.
16823         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
16824         (Output_data_dynamic::Dynamic_entry): Add support for
16825         section-plus-offset dynamic table entries.
16826         (Output_data_dynamic::Classification): Likewise.
16827         (Output_data_dynamic::classification_): Renamed offset_.
16828         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
16829         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
16830         (Target_x86_64::make_plt_section): New function.
16831         (Target_x86_64::reserve_tlsdesc_entries): New function.
16832         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
16833         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
16834         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
16835         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
16836         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
16837         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
16838         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
16839         add extra PLT entry for TLS descriptors.
16840         (Output_data_plt_x86_64::got_): New field.
16841         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
16842         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
16843         fields.
16844         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
16845         descriptors.
16846         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
16847         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
16848         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
16849         R_386_TLS_DESC_CALL relocations.
16850         (Target_x86_64::Scan::global): Likewise.
16851         (Target_x86_64::do_finalize_sections): Add dynamic table entries
16852         for TLS descriptors.
16853         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
16854         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
16855         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
16856         GD-to-IE relaxation.
16857         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
16858         and TLS_DESCRIPTORS.
16859         * Makefile.in: Rebuild.
16860         * configure: Rebuild.
16861         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
16862         (tls_test_shared2.so): New target.
16863         (tls_shared_gd_to_ie_test_SOURCES): New variable.
16864         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
16865         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
16866         (tls_shared_gd_to_ie_test_LDADD): New variable.
16867         (tls_shared_gnu2_gd_to_ie_test): New target.
16868         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
16869         New targets.
16870         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
16871         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
16872         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
16873         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
16874         (tls_shared_gnu2_test): New target.
16875         (tls_test_gnu2_shared.so): New target.
16876         (tls_shared_gnu2_test_SOURCES): New variable.
16877         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
16878         (tls_shared_gnu2_test_LDFLAGS): New variable.
16879         (tls_shared_gnu2_test_LDADD): New variable.
16880         * testsuite/Makefile.in: Rebuild.
16881         * testsuite/Makefile.
16882
16883 2008-04-11  Ian Lance Taylor  <iant@google.com>
16884
16885         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
16886         justsyms.t.
16887         * testsuite/Makefile.in: Rebuild.
16888
16889         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
16890         long.
16891         * testsuite/script_test_2.cc (main): Adjust test.
16892
16893 2008-04-11  David S. Miller  <davem@davemloft.net>
16894             Ian Lance Taylor  <iant@google.com>
16895
16896         * options.h (General_options): Add entries for '-Y' and
16897         '-relax'.
16898         * options.cc (General_options:finalize): If -Y was used, add those
16899         entries to the library path instead of the default "/lib" and
16900         "/usr/lib".
16901
16902 2008-04-11  David S. Miller  <davem@davemloft.net>
16903
16904         * testsuite/justsyms.t: Start at 0x100.
16905         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
16906         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
16907         long.
16908         * testsuite/script_test_2.cc: Adjust string and section length
16909         checks.
16910
16911 2008-04-09  Ian Lance Taylor  <iant@google.com>
16912
16913         PR gold/5996
16914         * script-sections.cc (Sections_element::allocate_to_segment): Add
16915         orphan parameter.
16916         (Output_section_definition::allocate_to_segment): Likewise.
16917         (Orphan_output_section::allocate_to_segment): Likewise.
16918         (Script_sections::attach_sections_using_phdrs_clause): Don't
16919         propagate non-PT_LOAD segments to orphan sections.
16920         * testsuite/Makefile.am (script_test_3.stdout): Generate using
16921         readelf rather than objdump.
16922         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
16923         .interp section and PT_INTERP segment are the same size.
16924         * testsuite/Makefile.in: Rebuild.
16925
16926         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
16927         aliases for symbols defined in the same object.
16928         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
16929         (weak_alias_test_SOURCES): New variable.
16930         (weak_alias_test_DEPENDENCIES): New variable.
16931         (weak_alias_test_LDFLAGS): New variable.
16932         (weak_alias_test_LDADD): New variable.
16933         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
16934         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
16935         (weak_alias_test_3.o): New target.
16936         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
16937         * testsuite/weak_alias_test_main.cc: New file.
16938         * testsuite/weak_alias_test_1.cc: New file.
16939         * testsuite/weak_alias_test_2.cc: New file.
16940         * testsuite/weak_alias_test_3.cc: New file.
16941
16942 2008-04-08  Ian Lance Taylor  <iant@google.com>
16943
16944         * options.h (class General_options): Add --noinhibit-exec option.
16945         * main.cc (main): Check --noinhibit-exec.
16946
16947         * options.h (class General_options): Define --wrap as a special
16948         option.  Add wrap_symbols_ field.
16949         (General_options::any_wrap_symbols): New function.
16950         (General_options::is_wrap_symbol): New function.
16951         * options.cc (General_options::parse_wrap): New function.
16952         (General_options::General_options): Initialize wrap_symbols_.
16953         * symtab.cc (Symbol_table::wrap_symbol): New function.
16954         (Symbol_table::add_from_object): Handle --wrap.
16955         * symtab.h (class Symbol_table): Declare wrap_symbol.
16956         * target.h (Target::wrap_char): New function.
16957         (Target::Target_info): Add wrap_char field.
16958         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
16959         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
16960         * testsuite/testfile.cc (Target_test::test_target_info):
16961         Likewise.
16962
16963         * errors.cc (Errors::undefined_symbol): Mention symbol version if
16964         there is one.
16965
16966         * layout.h (class Layout): Add added_eh_frame_data_ field.
16967         * layout.cc (Layout::Layout): Initialize new field.
16968         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
16969         output section until we find a section we merged successfully.
16970         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
16971         that the size be non-zero.
16972
16973         * merge.cc (Object_merge_map::get_output_offset): Remove inline
16974         qualifier.
16975
16976 2008-04-08  Craig Silverstein  <csilvers@google.com>
16977
16978         * configure.ac: Export new conditional variable HAVE_ZLIB.
16979         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
16980         on HAVE_ZLIB.
16981         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
16982         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16983
16984 2008-04-07  Ian Lance Taylor  <iant@google.com>
16985
16986         * version.cc (version_string): Set to "1.5".
16987
16988         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
16989         Add issued_non_pic_error_ field.  Declare check_non_pic.
16990         (Target_x86_64::Scan::check_non_pic): New function.
16991         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
16992         (Target_x86_64::Scan::global): Likewise.
16993
16994         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
16995         addend parameter.  Change caller.  Handle merge sections.
16996         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
16997         Address to Addend.  Don't add in the result of
16998         local_section_offset, pass down the addend and use the returned
16999         value.
17000         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
17001         Update declarations of local_section_offset and symbol_value.
17002         * testsuite/two_file_test_1.cc (t18): New function.
17003         * testsuite/two_file_test_2.cc (f18): New function.
17004         * testsuite/two_file_test_main.cc (main): Call t18.
17005         * testsuite/two_file_test.h (t18, f18): Declare.
17006
17007         * configure.ac: Don't test for objdump, c++filt, or readelf.
17008         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
17009         conditionals.
17010         (TEST_READELF): New variable.
17011         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
17012         (check_PROGRAMS): Add two_file_strip_test.
17013         (two_file_strip_test): New target.
17014         (check_PROGRAMS): Add two_file_same_shared_strip_test.
17015         (two_file_same_shared_strip_test_SOURCES): New variable.
17016         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
17017         (two_file_same_shared_strip_test_LDFLAGS): New variable.
17018         (two_file_same_shared_strip_test_LDADD): New variable.
17019         (two_file_shared_strip.so): New target.
17020         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
17021         (ver_test_5.syms, ver_test_7.syms): Likewise.
17022         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
17023         (strip_test_3.stdout): Use TEST_OBJDUMP.
17024         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17025
17026 2008-04-04  Cary Coutant  <ccoutant@google.com>
17027
17028         * symtab.h (Symbol::is_weak_undefined): New function.
17029         (Symbol::is_strong_undefined): New function.
17030         (Symbol::is_absolute): New function.
17031         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
17032         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
17033         absolute symbols.
17034         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
17035         (weak_undef_test): New target.
17036         * testsuite/Makefile.in: Rebuild.
17037         * testsuite/weak_undef_file1.cc: New file.
17038         * testsuite/weak_undef_file2.cc: New file.
17039         * testsuite/weak_undef_test.cc: New file.
17040
17041 2008-04-03  Craig Silverstein  <csilvers@google.com>
17042
17043         * compressed_output.h (class Output_compressed_section): Use
17044         unsigned buffer.
17045         * compressed_output.cc (zlib_compress): Use unsigned buffers,
17046         add zlib header.
17047         (zlib_compressed_suffix): Removed.
17048         (Output_compressed_section::set_final_data_size): Use unsigned
17049         buffers.
17050         * testsuite/Makefile.am (flagstest_compress_debug_sections):
17051         Fix linker invocation.
17052         (flagstest_o_specialfile_and_compress_debug_sections):
17053         Likewise.
17054         * testsuite/Makefile.in: Regenerated.
17055
17056 2008-04-02  David S. Miller  <davem@davemloft.net>
17057
17058         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
17059         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
17060
17061 2008-04-02  Craig Silverstein  <csilvers@google.com>
17062
17063         * TODO: New file.
17064
17065 2008-04-02  Ian Lance Taylor  <iant@google.com>
17066
17067         * fileread.cc (File_read::find_view): Add byteshift and vshifted
17068         parameters.  Update for new key type to views_.  Change all
17069         callers.
17070         (File_read::read): Adjust for byteshift in returned view.
17071         (File_read::add_view): New function, broken out of
17072         find_and_make_view.
17073         (File_read::make_view): New function, broken out of
17074         find_and_make_view.
17075         (File_read::find_or_make_view): Add offset and aligned
17076         parameters.  Rewrite accordingly.  Change all callers.
17077         (File_read::get_view): Add offset and aligned parameters.  Adjust
17078         for byteshift in return value.
17079         (File_read::get_lasting_view): Likewise.
17080         * fileread.h (class File_read): Update declarations.
17081         (class File_read::View): Add byteshift_ field.  Add byteshift to
17082         constructor.  Add byteshift method.
17083         * archive.h (Archive::clear_uncached_views): New function.
17084         (Archive::get_view): Add aligned parameter.  Change all callers.
17085         * object.h (Object::get_view): Add aligned parameter.  Change all
17086         callers.
17087         (Object::get_lasting_view): Likewise.
17088
17089         * fileread.cc (File_read::release): Don't call clear_views if
17090         there are multiple objects.
17091         * fileread.h (File_read::clear_uncached_views): New function.
17092         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
17093         on the archive.
17094
17095 2008-03-31  Cary Coutant  <ccoutant@google.com>
17096
17097         Add thin archive support.
17098         * archive.cc (Archive::armagt): New const.
17099         (Archive::setup): Remove task parameter and calls to unlock.
17100         (Archive::unlock_nested_archives): New function.
17101         (Archive::read_header): Add nested_off parameter. Change
17102         all callers.
17103         (Archive::interpret_header): Likewise.
17104         (Archive::include_all_members): Change to handle thin
17105         archives.
17106         (Archive::include_member): Likewise.
17107         * archive.h (Archive::Archive): Add new parameters and
17108         initializers.
17109         (Archive::armagt): New const.
17110         (Archive::setup): Remove task parameter.
17111         (Archive::unlock_nested_archives): New function.
17112         (Archive::read_header): Add nested_off parameter.
17113         (Archive::interpret_header): Likewise.
17114         (Archive::Nested_archive_table): New typedef.
17115         (Archive::is_thin_archive_): New field.
17116         (Archive::nested_archives_): New field.
17117         (Archive::options_): New field.
17118         (Archive::dirpath_): New field.
17119         (Archive::task_): New field.
17120         * readsyms.cc (Read_symbols::do_read_symbols): Add check
17121         for thin archives.  Pass additional parameters to
17122         Archive::Archive.  Unlock the archive file after calling
17123         Archive::setup.
17124
17125 2008-03-29  Ian Lance Taylor  <iant@google.com>
17126
17127         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
17128         version symbol to be local.
17129         * testsuite/ver_test_4.sh: New file.
17130         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
17131         (check_DATA): Add ver_test_4.syms.
17132         (ver_test_4.syms): New target.
17133         * testsuite/Makefile.in: Rebuild.
17134
17135         * output.cc
17136         (Output_section::Input_section_sort_entry::has_priority): New
17137         function.
17138         (Output_section::Input_section_sort_entry::match_file_name): New
17139         function.
17140         (Output_section::Input_section_sort_entry::match_section_name):
17141         Remove.
17142         (Output_section::Input_section_sort_entry::match_section_name_prefix):
17143         Remove.
17144         (Output_section::Input_section_sort_entry::match_section_file):
17145         Remove.
17146         (Output_section::Input_section_sort_compare::operator()): Rewrite
17147         using new Input_section_sort_entry functions.  Sort crtbegin and
17148         crtend first.  Sort sections with no priority before sections with
17149         a priority.
17150         * testsuite/initpri1.c (d3): Check j != 4.
17151         (cd5): New constructor/destructor function.
17152         (main): Check j != 2.
17153
17154         * symtab.cc (Symbol_table::add_from_object): If we don't use the
17155         new symbol when resolving, don't call set_is_default.
17156         * testsuite/ver_test_7.cc: New file.
17157         * testsuite/ver_test_7.sh: New file.
17158         * testsuite/Makefile.am (ver_test_7.so): New target.
17159         (ver_test_7.o): New target.
17160         (check_SCRIPTS): Add ver_test_7.sh.
17161         (check_DATA): Add ver_test_7.syms.
17162         (ver_test_7.syms): New target.
17163
17164 2008-03-28  Ian Lance Taylor  <iant@google.com>
17165
17166         * layout.cc (Layout::layout): If we see an input section with a
17167         name that needs sorting, set the must_sort flag for the output
17168         section.
17169         (Layout::make_output_section): If the name of the output section
17170         indicates that it might require sorting, set the may_sort flag.
17171         * output.h (Output_section::may_sort_attached_input_sections): New
17172         function.
17173         (Output_section::set_may_sort_attached_input_sections): New
17174         function.
17175         (Output_section::must_sort_attached_input_sections): New
17176         function.
17177         (Output_section::set_must_sort_attached_input_sections): New
17178         function.
17179         (class Output_section): Declare Input_section_sort_entry.  Define
17180         Input_section_sort_compare.  Declare
17181         sort_attached_input_sections.  Add new fields:
17182         may_sort_attached_input_sections_,
17183         must_sort_attached_input_sections_,
17184         attached_input_sections_are_sorted_.
17185         * output.cc (Output_section::Output_section): Initialize new
17186         fields.
17187         (Output_section::add_input_section): Add an entry to
17188         input_sections_ if may_sort or must_sort are true.
17189         (Output_section::set_final_data_size): Call
17190         sort_attached_input_sections if necessary.
17191         (Output_section::Input_section_sort_entry): Define new class.
17192         (Output_section::Input_section_sort_compare::operator()): New
17193         function.
17194         (Output_section::sort_attached_input_sections): New function.
17195         * configure.ac: Check whether the compiler supports constructor
17196         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
17197         * testsuite/initpri1.c: New file.
17198         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
17199         CONSTRUCTOR_PRIORITY.
17200         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
17201         (initpri1_LDFLAGS): New variable.
17202         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17203
17204 2008-03-27  Ian Lance Taylor  <iant@google.com>
17205
17206         * common.cc (Sort_commons::operator): Correct sorting algorithm.
17207         * testsuite/common_test_1.c: New file.
17208         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
17209         (common_test_1_SOURCES): New variable.
17210         (common_test_1_DEPENDENCIES): New variable.
17211         (common_test_1_LDFLAGS): New variable.
17212
17213         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
17214         and commons_ correctly when NAME/VERSION does not override
17215         NAME/NULL.
17216         * testsuite/ver_test_6.c: New file.
17217         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
17218         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
17219         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
17220
17221 2008-03-26  Ian Lance Taylor  <iant@google.com>
17222
17223         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
17224         of an undefined symbol from a version script.
17225         * testsuite/Makefile.am (ver_test_5.so): New target.
17226         (ver_test_5.o): New target.
17227         (check_SCRIPTS): Add ver_test_5.sh.
17228         (check_DATA): Add ver_test_5.syms.
17229         (ver_test_5.syms): New target.
17230         * testsuite/ver_test_5.cc: New file.
17231         * testsuite/ver_test_5.script: New file.
17232         * testsuite/ver_test_5.sh: New file.
17233         * Makefile.in, testsuite/Makefile.in: Rebuild.
17234
17235         PR gold/5986
17236         Fix problems building gold with gcc 4.3.0.
17237         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
17238         (gold_error_at_location, gold_warning_at_location): Use it.
17239         * configure.ac: Check whether we can compile and use a template
17240         function with a printf attribute.
17241         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
17242         when jumping over bytes.
17243         * object.cc: Instantiate Object::read_section_data.
17244         * debug.h: Include <cstring>
17245         * dwarf_reader.cc: Include <algorithm>
17246         * main.cc: Include <cstring>.
17247         * options.cc: Include <cstring>.
17248         * output.cc: Include <cstring>.
17249         * script.cc: Include <cstring>.
17250         * script.h: Include <string>.
17251         * symtab.cc: Include <cstring> and <algorithm>.
17252         * target-select.cc: Include <cstring>.
17253         * version.cc: Include <string>.
17254         * testsuite/testmain.cc: Include <cstdlib>.
17255         * configure, config.in: Rebuild.
17256
17257 2008-03-25  Ian Lance Taylor  <iant@google.com>
17258
17259         * options.cc: Include "../bfd/bfdver.h".
17260         (options::help): Print bug reporting address.
17261
17262         * version.cc (print_version): Adjust output for current value of
17263         BFD_VERSION_STRING.
17264
17265         * NEWS: New file.
17266
17267         * options.cc (options::help): Print list of supported targets.
17268         * target-select.h: Include <vector>.
17269         (class Target_selector): Make machine_, size_, and is_big_endian_
17270         fields const.  Add bfd_name_ and instantiated_target_ fields.
17271         (Target_selector::Target_selector): Add bfd_name parameter.
17272         (Target_selector::recognize): Make non-virtual, call
17273         do_recognize.
17274         (Target_selector::recognize_by_name): Make non-virtual, call
17275         do_recognize_by_name.
17276         (Target_selector::supported_names): New function.
17277         (Target_selector::bfd_name): New function.
17278         (Target_selector::do_instantiate_target): New pure virtual
17279         function.
17280         (Target_selector::do_recognize): New virtual function.
17281         (Target_selector::do_recognize_by_name): New virtual function.
17282         (Target_selector::instantiate_target): New private function.
17283         (supported_target_names): Declare.
17284         * target-select.cc (Target_selector::Target_selector): Update for
17285         new parameter and fields.
17286         (select_target_by_name): Check that the name matches before
17287         calling recognize_by_name.
17288         (supported_target_names): New function.
17289         * i386.cc (class Target_selector_i386): Update Target_selector
17290         constructor call.  Remove recognize and recognize_by_name.  Add
17291         do_instantiate_target.
17292         * x86_64.cc (class Target_selector_x86_64): Likewise.
17293         * testsuite/testfile.cc (class Target_selector_test): Update for
17294         changes to Target_selector.
17295
17296         * README: Rewrite, with some notes on unsupported features.
17297
17298 2008-03-24  Cary Coutant  <ccoutant@google.com>
17299
17300         * i386.cc (Target_i386::Got_type): New enum declaration.
17301         (Target_i386::Scan::local): Updated callers of Output_data_got
17302         member functions.
17303         (Target_i386::Scan::global): Likewise.
17304         (Target_i386::Relocate::relocate): Likewise.
17305         (Target_i386::Relocate::relocate_tls): Likewise.
17306         * object.h (Got_offset_list): New class.
17307         (Sized_relobj::local_has_got_offset): Added got_type parameter.
17308         (Sized_relobj::local_got_offset): Likewise.
17309         (Sized_relobj::set_local_got_offset): Likewise.
17310         (Sized_relobj::local_has_tls_got_offset): Removed.
17311         (Sized_relobj::local_tls_got_offset): Removed.
17312         (Sized_relobj::set_local_tls_got_offset): Removed.
17313         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
17314         * output.cc (Output_data_got::add_global): Added got_type parameter.
17315         (Output_data_got::add_global_with_rel): Likewise.
17316         (Output_data_got::add_global_with_rela): Likewise.
17317         (Output_data_got::add_global_pair_with_rel): New function.
17318         (Output_data_got::add_global_pair_with_rela): New function.
17319         (Output_data_got::add_local): Added got_type parameter.
17320         (Output_data_got::add_local_with_rel): Likewise.
17321         (Output_data_got::add_local_with_rela): Likewise.
17322         (Output_data_got::add_local_pair_with_rel): New function.
17323         (Output_data_got::add_local_pair_with_rela): New function.
17324         (Output_data_got::add_global_tls): Removed.
17325         (Output_data_got::add_global_tls_with_rel): Removed.
17326         (Output_data_got::add_global_tls_with_rela): Removed.
17327         (Output_data_got::add_local_tls): Removed.
17328         (Output_data_got::add_local_tls_with_rel): Removed.
17329         (Output_data_got::add_local_tls_with_rela): Removed.
17330         * output.h (Output_data_got::add_global): Added got_type parameter.
17331         (Output_data_got::add_global_with_rel): Likewise.
17332         (Output_data_got::add_global_with_rela): Likewise.
17333         (Output_data_got::add_global_pair_with_rel): New function.
17334         (Output_data_got::add_global_pair_with_rela): New function.
17335         (Output_data_got::add_local): Added got_type parameter.
17336         (Output_data_got::add_local_with_rel): Likewise.
17337         (Output_data_got::add_local_with_rela): Likewise.
17338         (Output_data_got::add_local_pair_with_rel): New function.
17339         (Output_data_got::add_local_pair_with_rela): New function.
17340         (Output_data_got::add_global_tls): Removed.
17341         (Output_data_got::add_global_tls_with_rel): Removed.
17342         (Output_data_got::add_global_tls_with_rela): Removed.
17343         (Output_data_got::add_local_tls): Removed.
17344         (Output_data_got::add_local_tls_with_rel): Removed.
17345         (Output_data_got::add_local_tls_with_rela): Removed.
17346         * resolve.cc (Symbol::override_base_with_special): Removed
17347         reference to has_got_offset_ field.
17348         * symtab.cc (Symbol::init_fields): Replaced initialization
17349         of got_offset_ with got_offsets_.  Removed initialization
17350         of has_got_offset_
17351         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
17352         (Symbol::got_offset): Likewise.
17353         (Symbol::set_got_offset): Likewise.
17354         (Symbol::has_tls_got_offset): Removed.
17355         (Symbol::tls_got_offset): Removed.
17356         (Symbol::set_tls_got_offset): Removed.
17357         (Symbol::got_offset_): Removed.
17358         (Symbol::tls_mod_got_offset_): Removed.
17359         (Symbol::tls_pair_got_offset_): Removed.
17360         (Symbol::got_offsets_): New field.
17361         (Symbol::has_got_offset): Removed.
17362         (Symbol::has_tls_mod_got_offset): Removed.
17363         (Symbol::has_tls_pair_got_offset): Removed.
17364         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
17365         (Target_x86_64::Scan::local): Updated callers of Output_data_got
17366         member functions.
17367         (Target_x86_64::Scan::global): Likewise.
17368         (Target_x86_64::Relocate::relocate): Likewise.
17369         (Target_x86_64::Relocate::relocate_tls): Likewise.
17370
17371 2008-03-25  Ben Elliston  <bje@au.ibm.com>
17372
17373         * yyscript.y: Fix spelling error in comment.
17374
17375 2008-03-24  Ian Lance Taylor  <iant@google.com>
17376
17377         * options.h (class General_options): Define build_id option.
17378         * layout.h (class Layout): Declare write_build_id, create_note,
17379         create_build_id.  Add build_id_note_ member.
17380         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
17381         "libiberty.h", "md5.h", "sha1.h".
17382         (Layout::Layout): Initialize eh_frame_data_,
17383         eh_frame_hdr_section_, and build_id_note_.
17384         (Layout::finalize): Call create_build_id.
17385         (Layout::create_note): New function, broken out of
17386         Layout::create_gold_note.
17387         (Layout::create_gold_note): Call create_note.
17388         (Layout::create_build_id): New function.
17389         (Layout::write_build_id): New function.
17390         (Close_task_runner::run): Call write_build_id.
17391
17392         * x86_64.cc: Correct license to GPLv3.
17393
17394 2008-03-23  Ian Lance Taylor  <iant@google.com>
17395
17396         * options.cc: Include "demangle.h".
17397         (parse_optional_string): New function.
17398         (parse_long_option): Handle takes_optional_argument.
17399         (parse_short_option): Update dash_z initializer.  Handle
17400         takes_optional_argument.
17401         (General_options::General_options): Initialize do_demangle_.
17402         (General_options::finalize): Set do_demangle_.  Handle demangling
17403         style.
17404         * options.h (parse_optional_string): Declare.
17405         (struct One_option): Add optional_arg field.  Update constructor.
17406         Update call constructor calls.  Add takes_optional_argument
17407         function.
17408         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
17409         (DEFINE_optional_string): Define.
17410         (General_options::demangle): Change from DEFINE_bool to
17411         DEFINE_optional_string.
17412         (General_options::no_demangle): New function.
17413         (General_options::do_demangle): New function.
17414         (General_options::set_do_demangle): New function.
17415         (General_options::execstack_status_): Move definition to end of
17416         class definition.
17417         (General_options::static_): Likewise.
17418         (General_options::do_demangle_): New field.
17419         * object.cc (big_endian>::get_symbol_location_info): Call
17420         Options::do_demangle, not Options::demangle.
17421         * symtab.cc (demangle): Likewise.
17422
17423 2008-03-22  Ian Lance Taylor  <iant@google.com>
17424
17425         * gold.h: Include <cstddef> and <sys/types.h>
17426         * options.h: Include <cstring>.
17427
17428 2008-03-21  Ian Lance Taylor  <iant@google.com>
17429
17430         * Added source code to GNU binutils.
17431 \f
17432 Copyright (C) 2008-2015 Free Software Foundation, Inc.
17433
17434 Copying and distribution of this file, with or without modification,
17435 are permitted in any medium without royalty provided the copyright
17436 notice and this notice are preserved.
17437
17438 Local Variables:
17439 mode: change-log
17440 left-margin: 8
17441 fill-column: 74
17442 version-control: never
17443 End: