If a range is missing, assume the input address is mapped.
[external/binutils.git] / gold / ChangeLog
1 2015-04-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
2
3         PR gold/18327
4         * output.cc (Output_section::is_input_address_mapped): Assume a missing
5         entry is mapped.
6         * testsuite/Makefile.am: Add the eh_test test.
7         * testsuite/Makefile.in: Regenerate.
8         * testsuite/eh_test_a.cc: New test.
9         * testsuite/eh_test_b.cc: New test.
10
11 2015-04-23  Sriraman Tallam  <tmsriram@google.com>      
12         * options.h (--weak-unresolved-symbols): New option.
13         * symtab.cc (Symbol_table::sized_write_globals): Change symbol
14         binding to weak with new option.
15         * symtab.h (is_weak_undefined): Check for new option.
16         (is_strong_undefined): Check for new option.
17         * testsuite/Makefile.am (weak_unresolved_symbols_test): New test.
18         * testsuite/Makefile.in: Regenerate.
19         * testsuite/weak_unresolved_symbols_test.cc: New file.
20
21 2015-04-20  Ian Coolidge  <icoolidge@google.com>
22
23         * symtab.cc (Symbol::should_add_dynsym_entry): Return true for
24         GNU_UNIQUE.
25
26 2015-04-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
27
28         * gc.cc (Garbage_collection::do_transitive_closure): Use back and
29         push_back.
30         * gc.h (Garbage_collection): Use a std::vector instead of a std::queue.
31         * object.cc (Sized_relobj_file::do_layout): Use push_back.
32         * powerpc.cc (process_gc_mark): Use push_back.
33         (Target_powerpc::do_gc_mark_symbol): Use push_back.
34         * symtab.cc (Symbol_table::gc_mark_symbol): Use push_back.
35
36 2015-04/16  Han Shen  <shenhan@google.com>
37
38     * aarch64.cc (AArch64_insn_utilities): New utility class.
39     (AArch64_relobj::Mapping_symbol_position): New struct.
40     (AArch64_relobj::Mapping_symbol_info): New typedef.
41     (AArch64_relobj::do_count_local_symbols): New function overriding
42     parent's implementation.
43     (AArch64_relobj::mapping_symbol_info_): New member
44     (AArch64_relobj::scan_erratum_843419): New method.
45     (Target_aarch64::scan_erratum_843419_span): New method.
46     (Target_aarch64::is_erratum_843419_sequence): New method.
47     * options.h (fix_cortex_a53): New option.
48
49 2015-04-09  Cary Coutant  <ccoutant@google.com>
50
51         * symtab.cc (Symbol::final_value_is_known): Check for TLS symbol
52         in a PIE link.
53         * testsuite/Makefile.am (tls_pie_test.sh): New test.
54         * testsuite/Makefile.in: Regenerate.
55         * testsuite/tls_pie_test.sh: New.
56
57 2015-04-09  Cary Coutant  <ccoutant@google.com>
58
59         * debug.h (DEBUG_LOCATION): New.
60         (DEBUG_ALL): Include DEBUG_LOCATION.
61         (debug_string_to_enum): Add DEBUG_LOCATION.
62         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug
63         output to print correct context.
64         (Sized_dwarf_line_info::do_addr2line): Add debug output. Return
65         up to 4 more locations at the beginning of the function.
66         * symtab.cc (Symbol_table::detect_odr_violations): Get canonical
67         result before sorting list of line numbers.
68         * testsuite/debug_msg.sh: Allow range of line numbers for
69         canonical results on optimized code.
70
71 2015-04-07  HC Yen <hc.yen@mediatek.com>
72
73         Add AArch32 support for gold linker.
74         gold/
75         * arm.cc: Add V8 arch combine table.
76
77 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
78
79         * aarch64.cc (do_reloc_addend): Fix signature to match the parent one.
80
81 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
82
83         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a call
84         to find by using the return value of insert.
85
86 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
87
88         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a copy
89         constructor call.
90
91 2015-04-06  Ilya Tocar  <ilya.tocar@intel.com>
92
93         PR gold/17641
94         * x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
95         (Target_x86_64::Scan::local): Don't create GOT entry, when we
96         can convert mov to lea.
97         (Target_x86_64::Scan::global): Ditto.
98         (Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
99         %reg to lea foo(%rip), %reg if possible.
100         * testsuite/Makefile.am (x86_64_mov_to_lea): New test.
101         * testsuite/x86_64_mov_to_lea1.s: New.
102         * testsuite/x86_64_mov_to_lea2.s: Ditto.
103         * testsuite/x86_64_mov_to_lea3.s: Ditto.
104         * testsuite/x86_64_mov_to_lea4.s: Ditto.
105         * testsuite/x86_64_mov_to_lea.sh: Ditto.
106
107 2015-04-02  H.J. Lu  <hongjiu.lu@intel.com>
108
109         * configure: Regenerated.
110
111 2015-04-01  Ilya Tocar  <ilya.tocar@intel.com>
112
113         PR gold/17640
114         * i386.cc (Target_i386::can_convert_mov_to_lea): New.
115         (Target_i386::Scan::local): Don't create GOT entry, when we
116         can convert GOT to GOTOFF.
117         (Target_i386::Scan::global): Ditto.
118         (Target_i386::Relocate::relocate): Convert  mov foo@GOT(%reg), %reg to
119         lea foo@GOTOFF(%reg), %reg if possible.
120         * testsuite/Makefile.am (i386_mov_to_lea): New test.
121         * testsuite/i386_mov_to_lea1.s: New.
122         * testsuite/i386_mov_to_lea2.s: Ditto.
123         * testsuite/i386_mov_to_lea3.s: Ditto.
124         * testsuite/i386_mov_to_lea4.s: Ditto.
125         * testsuite/i386_mov_to_lea5.s: Ditto.
126         * testsuite/i386_mov_to_lea.sh: Ditto.
127
128 2015-04-01  H.J. Lu  <hongjiu.lu@intel.com>
129
130         * Makefile.am (ZLIB): New.
131         (ZLIBINC): Likewise.
132         (AM_CFLAGS): Add $(ZLIBINC).
133         (AM_CXXFLAGS): Likewise.
134         (ldadd_varldadd_var): Add $(ZLIB).
135         (incremental_dump_LDADD): Likewise.
136         (dwp_LDADD): Likewise.
137         * compressed_output.cc: Don't check HAVE_ZLIB_H to include
138         <zlib.h>.
139         (zlib_compress): Don't check HAVE_ZLIB_H.
140         (zlib_decompress): Likewise.
141         * options.h (compress_debug_sections): Likewise.
142         * configure.ac (AM_CONDITIONAL): Removed.
143         * testsuite/Makefile.am (ZLIB): New.
144         (LDADD): Add $(ZLIB).
145         Don't check HAVE_ZLIB.
146         * Makefile.in: Regenerated.
147         * config.in: Likewise.
148         * configure: Likewise.
149         * testsuite/Makefile.in: Likewise.
150
151 2015-03-30  Jing Yu  <jingyu@google.com>
152
153         * aarch64-reloc.def: New TLSLD_ADD_DTPREL_HI12,
154         TLSLD_ADD_DTPREL_LO12_NC.
155         * aarch64.cc (Target_aarch64::define_tls_base_symbol): Always let
156         _TLS_MODULE_BASE_ point to the start of tls segment.
157         (Target_aarch64::optimize_tls_reloc): Add cases for
158         R_AARCH64_TLSLD_ADD_DTPREL_HI12 and
159         R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
160         (Target_aarch64::Scan::local): Likewise.
161         (Target_aarch64::Scan::global): Likewise.
162         (Target_aarch64::Relocate::relocate): Likewise.
163         (Target_aarch64::Relocate::relocate_tls): Likewise. And remove
164         subtracting tls segment size from symbol value for TLSLD_*_DTPREL
165         relocations.
166
167 2015-03-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
168
169         * merge.cc (Object_merge_map::add_mapping): call
170         Object_merge_map::Input_merge_map::add_mapping.
171         (Object_merge_map::Input_merge_map::add_mapping): New.
172         (Output_merge_data::do_add_input_section): Call
173         get_or_make_input_merge_map before a loop.
174         (Output_merge_string<Char_type>::finalize_merged_data): Call
175         get_or_make_input_merge_map before a loop.
176         * merge.h (Object_merge_map): Make Input_merge_map public.
177         * object.cc (Relobj::add_merge_mapping): Use get_or_create_merge_map.
178         (Relobj::get_or_create_merge_map): New.
179         * object.h (Relobj::get_or_create_merge_map): New.
180
181 2015-03-24  Alan Modra  <amodra@gmail.com>
182
183         PR 18147
184         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
185         relocation errors for branches to strong undefined symbols.
186
187 2015-03-23  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
188
189         * merge.cc (Object_merge_map::get_input_merge_map): Make it const.
190         (Object_merge_map::is_merge_section_for): Remove.
191         (Object_merge_map::find_merge_section): New.
192         * merge.h (Object_merge_map::is_merge_section_for): Remove.
193         (Object_merge_map::find_merge_section): New.
194         (Object_merge_map::get_input_merge_map): Add a const version.
195         * object.cc (Relobj::is_merge_section_for): Remove.
196         (Relobj::find_merge_section): New.
197         * object.h (Relobj::is_merge_section_for): Remove.
198         (Relobj::find_merge_section): New.
199         * output.cc
200         (Output_section::Input_section::is_merge_section_for): Remove.
201         (Output_section::add_merge_input_section): Don't call
202         add_merge_input_section.
203         (Output_section::find_merge_section): Return const. Use
204         object->find_merge_section.
205         (Output_section::build_lookup_maps): Don't build a map for
206         merge sections.
207         (Output_section::is_input_address_mapped): Return false if
208         section is not found.
209         (Output_section::find_starting_output_address): Use
210         find_merge_section instead of is_merge_section_for.
211         (Output_section::add_script_input_section):  Don't build a map for
212         merge sections.
213         * output.h (Output_section_lookup_maps::merge_sections_by_id_): Remove.
214         (Output_section_lookup_maps::find_merge_section): Remove.
215         (Output_section_lookup_maps::add_merge_input_section) Remove.
216         (Output_section::find_merge_section): Return const.
217
218 2015-03-22  Cary Coutant  <cary@google.com>
219
220         PR gold/18106
221         * i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
222         non-SIB form of lea, with nop after the call.
223
224 2015-03-21  Cary Coutant  <cary@google.com>
225
226         PR gold/14217
227         * output.cc (Output_segment::is_first_section_relro): Don't ignore
228         .tdata section.
229         (Output_segment::set_section_addresses): Don't align size of relro
230         segment for .tbss.
231
232 2015-03-21  Cary Coutant  <cary@google.com>
233
234         PR gold/18010
235         * stringpool.cc (Stringpool_template): Don't optimize if section
236         alignment is greater than sizeof(char).
237
238 2015-03-21  Cary Coutant  <cary@google.com>
239
240         PR gold/18048
241         * script-c.h (script_include_directive): Add first_token parameter.
242         * script.cc (script_include_directive): Add first_token parameter, and
243         pass it to read_script_file.
244         * yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
245         (PARSING_MEMORY_DEF): New tokens.
246         (top): Add new productions for INCLUDE files.
247         (file_cmd): Replace file_or_sections_cmd with copy of its productions.
248         Pass PARSING_LINKER_SCRIPT to script_include_directive.
249         (section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
250         (section_cmd): Pass PARSING_SECTION_CMDS.
251         (file_or_sections_cmd): Remove.
252         (memory_def): Pass PARSING_MEMORY_DEF.
253         * testsuite/Makefile.am (memory_test_2): New test.
254         * testsuite/Makefile.in: Regenerate.
255         * testsuite/memory_test_inc.t: New script file.
256         * testsuite/memory_test_inc_1.t.src: New script file.
257         * testsuite/memory_test_inc_2.t.src: New script file.
258         * testsuite/memory_test_inc_3.t.src: New script file.
259
260 2015-03-21  Cary Coutant  <cary@google.com>
261
262         * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
263         (Sized_relobj_dwo::setup): Build compressed section map.
264         (Sized_relobj_dwo::do_decompressed_section_contents): Delete.
265         * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
266         section map.
267         * object.cc (Sized_relobj_file::Sized_relobj_file): Remove
268         compressed_sections_ field.
269         (build_compressed_section_map): Take Object instead of
270         Sized_relobj_file parameter; add decompress_if_needed parameter.
271         (Sized_relobj_file::do_find_special_sections): Store compressed
272         section map in parent Object.
273         (Sized_relobj_file::do_decompressed_section_contents): Move
274         implementation to Object::decompressed_section_contents.
275         (Sized_relobj_file::do_discard_decompressed_sections): Move
276         implementation to Object::discard_decompressed_sections.
277         * object.h (build_compressed_section_map): Declare.
278         (Object::Object): Add compressed_sections_ field.
279         (Object::section_is_compressed): Move implementation here.
280         (Object::decompressed_section_contents): De-virtualize.
281         (Object::discard_decompressed_sections): De-virtualize.
282         (Object::do_section_is_compressed): Delete.
283         (Object::do_decompressed_section_contents): Delete.
284         (Object::set_compressed_sections): New method.
285         (Object::compressed_sections): New method.
286         (Object::compressed_sections_): New data member.
287         (Compressed_section_info, Compressed_section_map): Move to top of file.
288         (Sized_relobj_file::do_section_is_compressed): Delete.
289         (Sized_relobj_file::do_decompressed_section_contents): Delete.
290         (Sized_relobj_file::do_discard_decompressed_sections): Delete.
291         (Sized_relobj_file::compressed_sections_): Move to Object class.
292
293 2015-03-21  Cary Coutant  <ccoutant@google.com>
294
295         PR gold/18152
296         * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
297         deferred objects.
298
299 2015-03-11  Cary Coutant  <ccoutant@google.com>
300
301         * options.cc (General_options::finalize): Don't allow -z relro
302         with incremental linking.
303         * testsuite/Makefile.am (incremental_test): Add -z norelro.
304         (incremental_test_2): Likewise.
305         (incremental_test_3): Likewise.
306         (incremental_test_4): Likewise.
307         (incremental_test_5): Likewise.
308         (incremental_test_6): Likewise.
309         (incremental_copy_test): Likewise.
310         (incremental_common_test_1): Likewise.
311         (incremental_comdat_test_1): Likewise.
312         * testsuite/Makefile.in: Regenerate.
313
314 2015-03-09  Cary Coutant  <ccoutant@google.com>
315
316         PR gold/14675
317         * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
318         return enum indicating whether .eh_frame section is empty, optimizable,
319         unrecognized, or an end marker. Adjust explicit instantiations.
320         * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
321         (Eh_frame::add_ehframe_input_section): Change return type.
322         * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
323         * layout.cc (Layout::layout_eh_frame): Don't add optimized sections
324         to the .eh_frame output section until we see the end marker.
325         (Layout::finalize_eh_frame_section): New.
326         * layout.h: (Layout::finalize_eh_frame_section): New.
327
328 2015-03-05  H.J. Lu  <hongjiu.lu@intel.com>
329
330         * output.cc (Relobj::initialize_input_to_output_map<size>):
331         Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
332
333 2015-03-04  Cary Coutant  <ccoutant@google.com>
334
335         * parameters.cc (Parameters::set_target_once): Call
336         Target::select_as_default_target just once from here...
337         (set_parameters_target): ...instead of from here.
338
339 2015-03-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
340
341         * ehframe.cc (Cie::set_output_offset): Pass in and use a
342         Output_section_data instead of a Merge_map.
343         (Eh_frame::Eh_frame): Don't initialize merge_map_.
344         (Eh_frame::read_cie): Use add_merge_mapping instead of
345         Merge_map::add_mapping.
346         (Eh_frame::read_fde): Ditto.
347         (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
348         (Eh_frame::do_output_offset): Use merge_output_offset istead of
349         merge_map_->get_output_offset.
350         (Eh_frame::do_is_merge_section_for): Delete.
351         * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
352         instead of a Merge_map.
353         (Cie::set_output_offset): Pass in a Output_section_data instead of a
354         Merge_map.
355         (Eh_frame::do_is_merge_section_for): Delete.
356         (Eh_frame::merge_map_): Delete.
357         * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
358         and use a Output_section_data instead of a Merge_map.
359         (Object_merge_map::add_mapping): Ditto.
360         (Object_merge_map::get_output_offset): Remove the merge_map argument.
361         (Object_merge_map::is_merge_section_for): Pass in and use a
362         Output_section_data instead of a Merge_map.
363         (Merge_map): Delete.
364         (Output_merge_base::do_output_offset): Use merge_output_offset instead
365         of merge_map_.get_output_offset.
366         (Output_merge_base::do_is_merge_section_for): Delete.
367         (Output_merge_data::do_add_input_section): Use
368         object->add_merge_mapping instead of add_mapping.
369         (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
370         * merge.h (Merge_map): Delete forward declaration.
371         (Object_merge_map::add_mapping): Pass in and use a Output_section_data
372         instead of a Merge_map.
373         (Object_merge_map::get_output_offset): Remove the merge_map argument.
374         (Object_merge_map::is_merge_section_for): Pass in and use a
375         Output_section_data instead of a Merge_map.
376         (Input_merge_map::Object_merge_map::merge_map): Replace with
377         output_data.
378         (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
379         Output_section_data instead of a Merge_map.
380         (Merge_map): Delete.
381         (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
382         (Output_merge_base::do_is_merge_section_for): Delete.
383         (Output_merge_base::add_mapping): Delete.
384         (Output_merge_base::merge_map_): Delete.
385         * object.cc (Relobj::initialize_input_to_output_map): New.
386         (Relobj::initialize_input_to_output_map): New.
387         (Relobj::merge_output_offset): New.
388         (Relobj::is_merge_section_for): New.
389         (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
390         bits.
391         * object.h (Relobj::merge_map): Delete.
392         (initialize_input_to_output_map): New.
393         (set_merge_map): Delete.
394         (add_merge_mapping): New.
395         (merge_output_offset): New.
396         (is_merge_section_for): New.
397         * output.cc (Output_section::Input_section::is_merge_section_for):
398         Use object->is_merge_section_for.
399         * output.h (Output_section_data::is_merge_section_for): Delete.
400         (Output_section_data::do_is_merge_section_for): Delete.
401         * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
402         Use object->initialize_input_to_output_map.
403         (Merged_symbol_value<size>::value_from_output_section): Use
404         object->merge_output_offset.
405
406 2015-03-02  Peter Collingbourne  <pcc@google.com>
407             Cary Coutant  <ccoutant@google.com>
408
409         * output.cc (Output_section::add_merge_input_section): Do not
410         attempt to merge sections with an entsize of 0.
411
412 2015-03-02  Khem Raj  <raj.khem@gmail.com>
413
414         * attributes.h (class Output_attributes_section_data ): Add
415         do_print_to_mapfile function.
416
417 2015-02-24  Alan Modra  <amodra@gmail.com>
418
419         PR 18010
420         * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
421         complain if value is not a multiple of four.
422         (Target_powerpc::Relocate::relocate): Correct handling of
423         R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
424
425 2015-02-21  H.J. Lu  <hongjiu.lu@intel.com>
426
427         * configure.ac (default_size): Set to 32 for x32.
428         * configure: Regenerated.
429
430 2015-02-18  Alan Modra  <amodra@gmail.com>
431
432         PR 17954
433         * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
434         visibility.
435
436 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
437
438         * gc.h (Garbage_collection::add_reference): Don't use find.
439
440 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
441
442         * object.cc (write_local_symbols): avoid std::vector copy.
443
444 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
445
446         * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
447
448 2015-02-09  Mark Wielaard  <mjw@redhat.com>
449
450         * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
451         DW_LANG_Fortran03 and DW_LANG_Fortran08.
452
453 2015-02-16  Cary Coutant  <ccoutant@google.com>
454
455         PR gold/13577
456         PR gold/16992
457         * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
458         DF_SYMBOLIC if --dynamic-list option is used.
459         * options.cc (General_options::finalize): --dynamic-list is not
460         mutually exclusive with -Bsymbolic.
461         * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
462         listed in --dynamic-list.
463         * testsuite/Makefile.am (dynamic_list_lib2.so): Add
464         -Bsymbolic-functions.
465         * testsuite/Makefile.in: Regenerate.
466
467 2015-02-16  Cary Coutant  <ccoutant@google.com>
468
469         PR gold/17971
470         * incremental.cc: Remove redundant include of "output.h".
471
472 2015-02-12  Jing Yu  <jingyu@google.com>
473
474         * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
475         TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
476         New relocation.
477         * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
478         TLSLE_MOVW_* relocations.
479         (Target_aarch64::Scan::global): Likewise.
480         (Target_aarch64::Relocate::relocate): Likewise.
481         (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
482         for new TLSLE_MOVW_* relocations.
483
484 2015-02-11  Will Newton  <will.newton@linaro.org>
485
486         PR gold/13321
487         * arm.cc (Target_arm::make_plt_section): Create an ARM
488         state mapping symbol at the start of the PLT.
489
490 2015-02-09  H.J. Lu  <hongjiu.lu@intel.com>
491
492         * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
493         Replace two_file_shared_2.so with two_file_shared_1.so.
494         * testsuite/Makefile.in: Regenerated.
495
496 2015-02-09  Alan Modra  <amodra@gmail.com>
497
498         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
499         plugin_test_thin.a and defsym_test.
500         * testsuite/Makefile.in: Regenerate.
501
502 2015-02-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
503
504         * merge.cc (do_add_input_section): Combine loop epilogue into main loop
505         body.
506
507 2015-02-04  Peter Collingbourne  <pcc@google.com>
508
509         * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
510         forwarding symbols when computing symbol resolution info for plugins.
511         * plugin.h (Plugin_manager::symtab): New method.
512         (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
513
514 2015-02-03  Cary Coutant  <ccoutant@google.com>
515             Peter Collingbourne  <pcc@google.com>
516
517         PR gold/15660
518         * archive.cc (Thin_archive_object_unlocker): New class.
519         (Archive::include_member): Unlock external members of thin archives.
520         * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
521         (plugin_test_2): Likewise.
522         (plugin_test_3): Likewise.
523         (plugin_test_4): Likewise.
524         (plugin_test_5): Likewise.
525         (plugin_test_6): Likewise.
526         (plugin_test_7): Likewise.
527         (plugin_test_8): Likewise.
528         (plugin_test_9): Likewise.
529         (plugin_test_10): Likewise.
530         (plugin_test_11): New test case.
531         * testsuite/Makefile.in: Regenerate.
532         * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
533         file to decide whether to claim file.
534         (all_symbols_read_hook): Likewise.
535         * testsuite/plugin_test_1.sh: Adjust expected output.
536         * testsuite/plugin_test_2.sh: Likewise.
537         * testsuite/plugin_test_3.sh: Likewise.
538         * testsuite/plugin_test_6.sh: Likewise.
539         * testsuite/plugin_test_tls.sh: Likewise.
540         * testsuite/plugin_test_11.sh: New testcase.
541
542 2015-02-03  Cary Coutant  <ccoutant@google.com>
543
544         * descriptors.cc (Descriptors::open): Set artificially-low limit for
545         file descriptors when debugging enabled. Add debug output.
546         (Descriptors::release): Add debug output.
547         (Descriptors::close_some_descriptor): Likewise.
548         (Descriptors::close_all): Likewise.
549         * fileread.cc (File_read::lock): Likewise.
550         (File_read::unlock): Likewise.
551
552 2015-02-02  Cary Coutant  <ccoutant@google.com>
553
554         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
555         executable output file.
556
557 2015-01-22  Han Shen  <shenhan@google.com>
558
559         * arm.cc (Target_arm::Target_arm): Add initialization for new members.
560         (Target_arm::do_plt_address_for_global): New method.
561         (Target_arm::do_plt_address_for_local): New method.
562         (Target_arm::rel_irelative_section): New method.
563         (Target_arm::make_data_plt): Add more parameters for plt ctor.
564         (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
565         (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
566         (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
567         (Target_arm::Scan::check_non_pic): Add ifunc support.
568         (Target_arm::Scan::local): Add ifunc support.
569         (Target_arm::Scan::global): Add ifunc support.
570         (Target_arm::make_plt_section): New method.
571         (Target_arm::make_plt_entry): Change to call to make_plt_section.
572         (Target_arm::make_local_ifunc_plt_entry): New method.
573         (Target_arm::got_irelative_): New member.
574         (Target_arm::rel_irelative_): New member.
575         (Target_arm::got_section): Add creation for got_irelative_.
576         (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
577         (Target_arm::Relocate::relocate): Properly set local ifunc address.
578         (Target_arm::do_dynsym_value): Properly set global ifunc address.
579         (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
580         (Output_data_plt_arm::IRelative_data): New type.
581         (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
582         (Output_data_plt_arm::add_entry): Add more parameters.
583         (Output_data_plt_arm::add_relocation): New method.
584         (Output_data_plt_arm::add_local_ifunc_entry): New method.
585         (Output_data_plt_arm::rel_irelative): New method.
586         (Output_data_plt_arm::entry_count): Modified.
587         (Output_data_plt_arm::address_for_global): New method.
588         (Output_data_plt_arm::address_for_local): New method.
589 gold/
590         (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
591         (Output_data_plt_arm::insert_irelative_data): New method.
592         (Output_data_plt_arm::irelative_rel_): New member.
593         (Output_data_plt_arm::got_): New member.
594         (Output_data_plt_arm::got_irelative_): New member.
595         (Output_data_plt_arm::irelative_count_): New member.
596         (Output_data_plt_arm::IRelative_data_vec): New typedef.
597         (Output_data_plt_arm::irelative_data_vec_): New member.
598         (Output_data_plt_arm::do_write): Write out irelative entries.
599         (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
600         more parameters to ctor.
601         (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
602         more parameters to ctor.
603         * output.h (Output_data_reloc::add_local_relative): New method.
604         * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
605
606 2015-01-29  Alan Modra  <amodra@gmail.com>
607
608         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
609         and GOT_TLSGD to LE optimization.
610
611 2015-01-28  Cary Coutant  <ccoutant@google.com>
612
613         * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
614         for undef TLS symbols.
615         (Target_x86_64::Relocate::relocate_tls): Likewise.
616         (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
617
618 2015-01-25  Cary Coutant  <ccoutant@google.com>
619
620         * output.cc (Output_segment::set_section_addresses): Fix calculation
621         of size of relro segment.
622
623 2015-01-22  Alan Modra  <amodra@gmail.com>
624
625         * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
626         condition for need of ifunc plt entry.
627         (Target_powerpc::Scan::global <got relocs>): Likewise.
628
629 2015-01-14  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
630
631         * mips.cc (reloc_high): Add r_sym.
632         (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
633         reloc_high constructor.
634         (Mips_relocate_functions::relgot16_local): Likewise.
635         (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
636         r_type to decide whether LO16 matches HI16.
637         (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
638         rello16 and relgot16_local.
639
640 2015-01-09  Cary Coutant  <ccoutant@google.com>
641
642         * layout.cc (Layout::set_segment_offsets): Don't align start of segment
643         unless alignment is larger than page size.
644
645 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
646             Cary Coutant  <ccoutant@google.com>
647
648         PR gold/17729
649         * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
650         (DEFAULT_TARGET_X32): Set for x32.
651         * x86_64.cc (cmp_insn_32): New.
652         (lea_r10_insn_32): Likewise.
653         (lea_r11_insn_32): Likewise.
654         (cmp_insn_64): Likewise.
655         (lea_r10_insn_64): Likewise.
656         (lea_r11_insn_64): Likewise.
657         (Target_x86_64<size>::do_calls_non_split): Handle x32.
658         * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
659         (check_DATA): Add split_x32 files.
660         (split_x32_[1234n].o): New targets.
661         (split_x32_[124]): New targets.
662         (split_x32_[1234r].stdout): New targets.
663         * testsuite/split_x32.sh: New file.
664         * testsuite/split_x32_1.s: Likewise.
665         * testsuite/split_x32_2.s: Likewise.
666         * testsuite/split_x32_3.s: Likewise.
667         * testsuite/split_x32_4.s: Likewise.
668         * testsuite/split_x32_n.s: Likewise.
669         * configure: Regenerated.
670         * testsuite/Makefile.in: Likewise.
671
672 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
673
674         PR gold/17809
675         * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
676         x32.
677
678 2015-01-02  Alan Modra  <amodra@gmail.com>
679
680         * version.cc (print_version): Just print current year.
681         * dwp.cc (print_version): Likewise.
682
683 2015-01-01  Alan Modra  <amodra@gmail.com>
684
685         Update year range in copyright notice of all files.
686
687 2014-12-25  Alan Modra  <amodra@gmail.com>
688
689         * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
690         new enums.
691         (Target_arm::merge_object_attributes, ): Likewise.
692
693 2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
694
695         * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
696         as hard float only when Tag_ABI_VFP_args is 1, using new enum value
697         AEABI_VFP_args_vfp to check that.
698         (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
699         value and replace hardcoded values by enum values.
700
701 2014-12-22  Cary Coutant  <ccoutant@google.com>
702
703         * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
704
705 2014-12-20  H.J. Lu  <hongjiu.lu@intel.com>
706
707         PR gold/14608
708         * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
709         to "return i * i * 3;".
710
711 2014-12-16  Cary Coutant  <ccoutant@google.com>
712
713         * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
714         (Mapfile::print_output_data): Use current_data_size() to avoid
715         assert for sections requiring postprocessing; if address is not valid,
716         print 0.
717         (Mapfile::print_output_section): Use current_data_size(); print note
718         that addresses and sizes are before compression.
719
720 2014-12-14  H.J. Lu  <hongjiu.lu@intel.com>
721
722         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
723         Cast current_group_size to unsigned long when reporting error.
724
725 2014-12-10  Jing Yu  <jingyu@google.com>
726
727         * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
728         (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
729         Update error message.
730         (Target_aarch64::do_relax): Use absolute value of option
731         stub_group_size. Replace local variable with class member
732         stub_group_size_.
733
734 2014-12-04  Alan Modra  <amodra@gmail.com>
735
736         * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
737         addend of PLTREL24 reloc when not generating a plt stub.  Make
738         max_branch_offset an "Address".
739         (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
740         (Target_powerpc::Relocate::relocate): Likewise.
741
742 2014-12-04  Alan Modra  <amodra@gmail.com>
743
744         PR 17670
745         * symtab.cc (Symbol::set_undefined): Remove assertion.
746         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
747         on symbols defined in discarded sections, instead return false.
748         Rearrange params, update all callers.
749         (Target_powerpc::Branch_info::make_stub): Don't make stubs for
750         branches to syms in discarded sections.
751         (Global_symbol_visitor_opd::operator()): Set discarded opd syms
752         undefined and flag as discarded.
753         (Target_powerpc::Relocate::relocate): Localize variable.
754
755 2014-12-03  H.J. Lu  <hongjiu.lu@intel.com>
756
757         PR gold/17675
758         * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
759         * testsuite/Makefile.in: Regenerated.
760
761 2014-12-03  Alan Modra  <amodra@gmail.com>
762
763         PR 17566
764         * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
765         when adding dynamic relocations against section symbols.
766
767 2014-12-01  Dimitry Ivanov <dimitry@google.com>
768
769         * layout.cc (Layout::finish_dynamic_section): When '-z global'
770         is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
771         * options.h (General_options): New -z option (global).
772
773 2014-12-01  Cary Coutant  <ccoutant@google.com>
774
775         PR gold/17578
776         * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
777         is given.
778         (Layout::create_executable_stack_info): Warn when -z noexecstack is
779         given but some inputs require executable stack.
780
781 2014-11-26  Cary Coutant  <ccoutant@google.com>
782
783         * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
784         .debug_str_offsets; strip .debug_gnu_pubnames and
785         .debug_gnu_pubtypes.
786         (lines_only_debug_sections): Strip all four new sections.
787
788 2014-11-26  Jing Yu  <jingyu@google.com>
789
790         * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
791         register to be x0 when to relax TLSDESC_LD64_LO12.
792
793 2014-11-26  Alan Modra  <amodra@gmail.com>
794
795         * powerpc.cc (struct Stub_table_owner): New.
796         (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
797         unsigned int vector.  Update all references.
798         (powerpc_relobj::set_stub_table): Take an unsigned int param
799         rather than a Stub_table.  Update callers.
800         (Powerpc_relobj::clear_stub_table): New function.
801         (Target_powerpc): Add relax_failed_, relax_fail_count_ and
802         stub_group_size_ vars.
803         (Target_powerpc::new_stub_table): Delete.
804         (max_branch_delta): New function, extracted from..
805         (Target_powerpc::Relocate::relocate): ..here..
806         (Target_powerpc::Branch_info::make_stub): ..and here.  Return
807         status on whether stub created successfully.
808         (Stub_control::Stub_control): Add "no_size_errors" param.  Move
809         default sizing to..
810         (Target_powerpc::do_relax): ..here.  Init stub_group_size_ and
811         reduce on relax failure.
812         (Target_powerpc::group_sections): Add "no_size_errors" param.
813         Use stub_group_size_.  Set up group info in a temp vector,
814         before building Stub_table vector.  Account for input sections
815         possibly already converted to relaxed sections.
816         (Stub_table::init): Delete.  Merge into..
817         (Stub_table::Stub_table): ..here.
818         (Stub_table::can_reach_stub): New function.
819         (Stub_table::add_plt_call_entry): Add "from" parameter and
820         return true iff stub could be reached.
821         (Stub_table::add_long_branch_entry): Similarly.  Add "r_type"
822         param too.
823         (Stub_table::clear_stubs): Add "all" param.
824
825 2014-11-26  Alan Modra  <amodra@gmail.com>
826
827         * powerpc.cc (Stub_control::set_output_and_owner): New function.
828         (Target_powerpc::group_sections): Use it.
829
830 2014-11-25  Cary Coutant  <ccoutant@google.com>
831
832         * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
833         (Binary_to_elf::write_symbol): Add st_size parameter.
834         * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
835
836 2014-11-25  Cary Coutant  <ccoutant@google.com>
837
838         PR gold/17639
839         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
840         (Sized_relobj_file::do_layout): Handle deferred sections properly
841         during GC pass 1. Don't add reloc sections to deferred list twice.
842         * object.h (Sized_relobj_file::is_deferred_layout): New function.
843         (Sized_relobj_file::is_deferred_layout_): New data member.
844
845 2014-11-21  H.J. Lu  <hongjiu.lu@intel.com>
846
847         PR gold/17619
848         * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
849         Check PC-relative offset overflow in PLT entry.
850
851 2014-11-21  Alan Modra  <amodra@gmail.com>
852
853         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
854         for undefined weaks.
855
856 2014-11-20  Alan Modra  <amodra@gmail.com>
857
858         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
859         from --stub-group-size parameter divided by 1024.
860         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
861         template parameter.  Update all uses.
862         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
863         has_stub_value.  Set for long branches.  Don't report overflow for
864         branch to undefined weak symbols.  Print info message on
865         overflowing branch to stub.
866
867 2014-11-20  Alan Modra  <amodra@gmail.com>
868
869         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
870
871 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
872
873         * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
874         entry for R_X86_64_GOTPLT64.
875         (Target_x86_64<size>::Relocate::relocate): Update comments for
876         R_X86_64_GOTPLT64.
877
878 2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>
879
880         * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
881         * plugin.h: add lock definition
882
883 2014-10-29  Han Shen  <shenhan@google.com>
884             Jing Yu   <jingyu@google.com>
885
886         * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
887         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
888         TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
889         Symbol::TLS_REF.
890         * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
891         method.
892         (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
893         (Target_aarch64::tls_ld_to_le): New method.
894         (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
895         for 64bit targets.
896         (Output_data_plt_aarch64::irelative_rel_): New data member.
897         (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
898         (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
899         (Output_data_plt_aarch64::add_relocation): New method.
900         (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
901         offset. Add got_irelative size to got size.
902         (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
903         type string with the new typename.
904         (AArch64_relocate_functions::update_adr): Replace parameter x with
905         immed.
906         (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
907         (AArch64_relocate_functions::reloc_common): New method.
908         (AArch64_relocate_funcsions::rela_general): Extract common part out
909         into reloc_common method.
910         (AArch64_relocate_functions::rela_general): Likewise.
911         (AArch64_relocate_functions::pcrela_general): Likewise.
912         (AArch64_relocate_functions::adr): New method.
913         (AArch64_relocate_functions::adrp): Calculate immed before calling
914         update_adr.
915         (AArch64_relocate_functions::adrp): Likewise.
916         (AArch64_relocate_functions::movnz): Cast x to SignedW type when
917         comparing x to 0. Calculate immed from ~x when x < 0.
918         (Target_aarch64::optimize_tls_reloc): Add new cases for
919         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
920         TLSLD_MOVW_DTPREL_G0_NC.
921         (Target_aarch64::possible_function_pointer_reloc): Implement this
922         method.
923         (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
924         comment.
925         (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
926         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
927         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
928         (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
929         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
930         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
931         (Target_aarch64::make_plt_entry): Call add_entry with two more
932         parameters.
933         (Target_aarch64::make_local_ifunc_plt_entry): New method.
934         (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
935         ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
936         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
937         (Target_aarch64::Relocate::relocate_tls): Add cases for
938         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
939         TLSLD_MOVW_DTPREL_G0_NC.
940         * testsuite/icf_safe_so_test.cc: Correct test comment.
941         * testsuite/icf_safe_test.sh: Add AArch64 arch.
942
943 2014-10-22  Alan Modra  <amodra@gmail.com>
944
945         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
946         thread_starter.
947
948 2014-10-18  Andreas Schwab  <schwab@linux-m68k.org>
949
950         * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
951
952 2014-10-17  Cary Coutant  <ccoutant@google.com>
953
954         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
955         Add "typename" keyword.
956
957 2014-10-15  Han Shen  <shenhan@google.com>
958             Jing Yu   <jingyu@google.com>
959
960         Patch for gold aarch64 backend to support relaxation.
961         * aarch64-reloc.def: Change format.
962         * aarch64.cc (class Reloc_stub): New class.
963         (class Stub_table): New class.
964         (class AArch64_relobj): New class.
965         (class AArch64_input_section): New class.
966         (class AArch64_output_section): New class.
967         (Target_aarch64::new_stub_table): New method.
968         (Target_aarch64::new_aarch64_input_section): New method.
969         (Target_aarch64::find_aarch64_input_section): New method.
970         (Target_aarch64::scan_section_for_stubs): New method.
971         (Target_aarch64::scan_reloc_section_for_stubs): New method.
972         (Target_aarch64::relocate_stub): New method.
973         (Target_aarch64::current_target): New method.
974         (Target_aarch64::do_make_elf_object): New method.
975         (Target_aarch64::do_may_relax): New method.
976         (Target_aarch64::do_relax): New method.
977         (Target_aarch64::group_sections): New method.
978         (Target_aarch64::scan_reloc_for_stub): New method.
979         (Target_aarch64::do_make_output_section): New method.
980         (Target_aarch64::stub_tables_): New data member.
981         (Target_aarch64::aarch64_input_section_map_): New data member.
982         (AArch64_relocate_functions::maybe_apply_stub): New method.
983
984 2014-09-30  Cary Coutant  <ccoutant@google.com>
985
986         PR gold/17432
987         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
988
989 2014-09-30  Kito Cheng  <kito@0xlab.org>
990
991         PR gold/13597
992         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
993         hash table before sysv-style hash table.
994
995 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
996
997         * options.h (--pic-executable): Add negative to alias to -no-pie.
998
999 2014-09-26  Cary Coutant  <ccoutant@google.com>
1000
1001         PR gold/16773
1002         * object.cc (Sized_relobj_file): Compute value of section symbols
1003         for TLS sections the same as TLS symbols.
1004
1005 2014-09-25  Cary Coutant  <ccoutant@google.com>
1006
1007         PR gold/17432
1008         * resolve.cc (Symbol_table::resolve): Override common placeholder
1009         symbols, but adjust sizes.
1010         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
1011         symbols to common lists.
1012
1013 2014-09-24  Alan Modra  <amodra@gmail.com>
1014
1015         * po/POTFILES.in: Regenerate.
1016
1017 2014-09-23  Taiju Tsuiki  <tzik@google.com>
1018             Cary Coutant  <ccoutant@google.com>
1019
1020         PR gold/14860
1021         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
1022         on input_sections_blocker.
1023         * layout.cc (Write_sections_task::locks): Unblock
1024         input_sections_blocker_.
1025         * layout.h (Write_sections_task::Write_sections_task): Add
1026         input_sections_blocker.
1027         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
1028         to DEPENDENCIES.
1029         * testsuite/Makefile.in: Regenerate.
1030
1031 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1032
1033         * testsuite/Makefile.am (plugin_test_10): New test.
1034         * testsuite/Makefile.in: Regenerate
1035         * testsuite/plugin_common_test_2.c (c1): Align to 8.
1036         * testsuite/plugin_test_10.sh: New file.
1037
1038 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1039
1040         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
1041         * resolve.cc (Symbol_table::resolve): Don't override common symbols
1042         during the replacement phase.
1043
1044 2014-09-17  Han Shen  <shenhan@google.com>
1045             Jing Yu  <jingyu@google.com>
1046
1047         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
1048         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
1049         * aarch64.cc (Target_aarch64): Add data members
1050         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
1051         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
1052         constructor.
1053         (Target_aarch64::do_reloc_symbol_index): New method.
1054         (Target_aarch64::do_reloc_addend): New method.
1055         (Target_aarch64::add_tlsdesc_info): New method.
1056         (Target_aarch64::do_dynsym_value): New method.
1057         (Target_aarch64::do_make_data_plt): Add new parameters: got,
1058         got_irelative. Pass them to Output_data_plt_aarch64_standard.
1059         (Target_aarch64::make_data_plt): Add new parameters: got,
1060         got_irelative. Pass them to do_make_data_plt.
1061         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
1062         (Target_aarch64::Relocate:tls_gd_to_le): New method.
1063         (Target_aarch64::Relocate:tls_ie_to_le): New method.
1064         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
1065         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
1066         (Target_aarch64::got_tlsdesc_section): New method.
1067         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1068         (Target_aarch64::define_tls_base_symbol): New method.
1069         (Target_aarch64::reserve_tlsdesc_entries): New method.
1070         (Target_aarch64::got_mod_index_entry): New method.
1071         (Target_aarch64::rela_tlsdesc_section): New method.
1072         (Target_aarch64::rela_irelative_section): New method.
1073         (Target_aarch64::Tlsdesc_info): New struct.
1074         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
1075         relocations and tlsdesc relocations.
1076         (Target_aarch64::optimize_tls_reloc): Implement method.
1077         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
1078         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
1079         in constructor.
1080         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
1081         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
1082         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
1083         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
1084         (Output_data_plt_aarch64::rela_tlsdesc): New method.
1085         (Output_data_plt_aarch64::rela_irelative): New method.
1086         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
1087         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
1088         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
1089         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
1090         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
1091         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
1092         (Output_data_plt_aarch64_standard): New member variables:
1093         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
1094         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
1095         New parameter: got, got_irelative.
1096         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
1097         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
1098         (Output_data_plt_aarch64::do_write): Replace got_address with
1099         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
1100         (AArch64_relocate_functions::update_movnz): New method.
1101         (AArch64_relocate_functions): Correct format.
1102         (AArch64_relocate_functions::movnz): New method.
1103         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
1104         before the switch. Add new cases to switch.
1105         Check ie_to_le relaxation on tlsie relocations. Add code handling
1106         tlsgd tlsdesc cases.
1107         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
1108         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
1109         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
1110         Call reloc_name_in_error_message to print unsupported reloc.
1111         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
1112         make_data_plt.
1113         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
1114         relocs. Fill in some more dynamic tags.
1115         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
1116         Skip call tls_get_addr when tlsgd is relaxed.
1117         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
1118         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
1119         tlsdesc->ie relaxation.
1120
1121 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1122
1123         * mips.cc (Target_mips_nacl): New class.
1124         (Target_selector_mips_nacl): New class.
1125         (target_selector_mips32): Rename from target_selector_mips32be and use
1126         Target_selector_mips_nacl instead of Target_selector_mips.
1127         (target_selector_mips32el): Rename from target_selector_mips32 and use
1128         Target_selector_mips_nacl instead of Target_selector_mips.
1129         (target_selector_mips64): Rename from target_selector_mips64be and use
1130         Target_selector_mips_nacl instead of Target_selector_mips.
1131         (target_selector_mips64el): Rename from target_selector_mips64 and use
1132         Target_selector_mips_nacl instead of Target_selector_mips.
1133         (Target_mips::mips_info): Add const attribute.
1134
1135 2014-09-02  Cary Coutant  <ccoutant@google.com>
1136
1137         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
1138         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
1139         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
1140         (Sized_incr_dynobj::do_section_name): Likewise.
1141         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
1142         (Sized_incr_dynobj::do_section_name): Likewise.
1143         * object.h (Object::section_name): Likewise.
1144         (Object::do_section_name): Likewise.
1145         (Sized_relobj_file::do_section_name): Likewise.
1146         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
1147         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
1148
1149 2014-09-02  Cary Coutant  <ccoutant@google.com>
1150
1151         PR gold/17005
1152         * ehframe.cc (Fde::write): Add output_offset parameter.
1153         (Cie::write): Likewise.
1154         (Eh_frame::set_final_data_size): Account for offset within output
1155         section.
1156         (Eh_frame::do_sized_write): Likewise.
1157         * ehframe.h (Fde::write): Add output_offset parameter.
1158         (Cie::write): Likewise.
1159         * output.cc (Output_section::Input_section_sort_entry): Remove
1160         section_has_name_; add output_section_name parameter. Use
1161         output section name for non-input sections.
1162         (Output_section::Input_section_sort_entry::section_has_name): Remove.
1163         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
1164         (Output_section::Input_section_sort_compare): Remove logic for
1165         sections without names.
1166         (Output_section::Input_section_sort_init_fini_compare): Likewise.
1167         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
1168         Likewise.
1169         (Output_section::Input_section_sort_section_name_compare): Likewise.
1170
1171 2014-08-29 Han Shen <shenhan@google.com>
1172            Jing Yu <jingyu@google.com>
1173
1174         * aarch64-reloc-property.cc
1175         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
1176         reference reloc property in the table.
1177         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
1178         3 other entries.
1179         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
1180         2 new overloaded methods.
1181         (Output_data_got_aarch64::do_write): Add code to write out
1182         static relocs.
1183         (class Output_data_got_aarch64::Static_reloc): New class to wrap
1184         static relocs.
1185         (Output_data_got_aarch64::static_relocs): New vector to
1186         hold static relocs.
1187         (Target_aarch64::TCB_SIZE): New const static memeber.
1188         (Target_aarch64::tcb_size): New method.
1189         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
1190         (Target_aarch64::Relocate::relocate_tls): New method.
1191         (Target_aarch64::Scan::local): Add code handling new reloc types.
1192         (Target_aarch64::Scan::global): Add code handling new reloc types.
1193
1194 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
1195
1196         * options.h (-no-pie): Add option.
1197
1198 2014-08-08  Jing Yu  <jingyu@google.com>
1199             Han Shen  <shenhan@google.com>
1200
1201         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
1202         (DEFFILES): add aarch64-reloc.def.
1203         (TARGETSOURCES): Add aarch64-reloc-property.cc.
1204         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
1205         * Makefile.in: Regenerate.
1206         * aarch64-reloc-property.cc: New file.
1207         * aarch64-reloc-property.h: New file.
1208         * aarch64-reloc.def: New file.
1209         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
1210         with tab to make the format consistent.
1211         (Output_data_got_aarch64::symbol_table_): New method.
1212         (Target_aarch64::do_plt_address_for_global): New method.
1213         (Target_aarch64::do_plt_address_for_local): New method.
1214         (Target_aarch64::do_select_as_default_target): New method.
1215         (Target_aarch64::do_make_data_plt): New method.
1216         (Target_aarch64::make_data_plt): New method.
1217         (Output_data_plt_aarch64::has_irelative_section): New method.
1218         (Output_data_plt_aarch64::address_for_global): New method.
1219         (Output_data_plt_aarch64::address_for_local): New method.
1220         (Output_data_plt_aarch64::irelative_rel_): New parameter.
1221         (Output_data_plt_aarch64::add_entry): Implement contents.
1222         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
1223         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
1224         the got_pov entry to plt0.
1225         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
1226         Implement contents.
1227         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
1228         (AArch64_howto): New struct.
1229         (aarch64_howto[]): New static const array.
1230         (AArch64_relocate_functions): New class.
1231         (Target_aarch64::Scan::get_reference_flags): Remove method.
1232         (Target_aarch64::Scan::local): Implement to support a few relocations.
1233         (Target_aarch64::Scan::global): Implement to support a few relocations.
1234         (Target_aarch64::make_plt_section): Implement contents.
1235         (Target_aarch64::make_plt_entry): Implement contents.
1236         (Target_aarch64::do_finalize_sections): Implement contents.
1237         (Target_aarch64::Relocate::relocate): Implement a few relocations.
1238         (Target_aarch64::relocate_section): Implement contents.
1239
1240 2014-08-06  Alan Modra  <amodra@gmail.com>
1241
1242         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
1243
1244 2014-08-06  Alan Modra  <amodra@gmail.com>
1245
1246         PR 13227
1247         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
1248
1249 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
1250
1251         * object.cc (Relobj::is_section_name_included): Add
1252         ".rodata.nptl_version" to not garbage collect this section.
1253
1254 2014-07-08  Cary Coutant  <ccoutant@google.com>
1255
1256         * expression.cc (struct Expression::Expression_eval_info): Add
1257         new fields type_pointer, vis_pointer, and nonvis_pointer.
1258         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
1259         nonvis_pointer parameters. Adjust all calls.
1260         (Symbol_expression::value): Update type, visibility, and nonvis bits
1261         in caller.
1262         * script.cc (Symbol_assignment::sized_finalize): Update type,
1263         visibility, and remaining st_other bits for new symbol.
1264         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
1265         vis_pointer, and nonvis_pointer parameters.
1266         * symtab.h (Symbol::set_type): New method.
1267
1268         * testsuite/Makefile.am (defsym_test): New test.
1269         * testsuite/Makefile.in: Regenerate.
1270         * testsuite/defsym_test.c: New file.
1271         * testsuite/defsym_test.sh: New file.
1272
1273 2014-07-08  Cary Coutant  <ccoutant@google.com>
1274
1275         PR gold/15639
1276         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
1277         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
1278         (Sized_dynobj::base_read_symbols): ...new method.
1279         * object.h (Sized_relobj_file::base_read_symbols): New method.
1280         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
1281         (Sized_relobj_file::base_read_symbols): ...new method.
1282         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
1283         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
1284         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
1285
1286 2014-07-04  Alan Modra  <amodra@gmail.com>
1287
1288         * po/POTFILES.in: Regenerate.
1289
1290 2014-07-02  Jing Yu  <jingyu@google.com>
1291
1292         * aarch64.cc: New file
1293         * Makefile.am (TARGETSOURCES): Add aarch64.cc
1294         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
1295         * Makefile.in: Regenerate.
1296         * configure.tgt: Add entries for aarch64*.
1297         * configure.ac:  Likewise.
1298         * configure: Likewise.
1299
1300 2014-06-27  Alan Modra  <amodra@gmail.com>
1301
1302         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
1303
1304 2014-06-24  Cary Coutant  <ccoutant@google.com>
1305
1306         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
1307         sections.
1308         (Dwo_file::sized_read_unit_index): Likewise.
1309
1310 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1311
1312         * mips.cc: New file.
1313         * Makefile.am (TARGETSOURCES): Add mips.cc
1314         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
1315         * configure.tgt: Add entries for mips*.
1316         * configure.ac: Likewise.
1317         * Makefile.in: Regenerate.
1318         * configure: Likewise.
1319
1320 2014-06-09  Cary Coutant  <ccoutant@google.com>
1321
1322         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
1323         unit_length is within section bounds.
1324
1325 2014-06-09  Cary Coutant  <ccoutant@google.com>
1326
1327         PR gold/16980
1328         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
1329         map.
1330
1331 2014-06-07  Alan Modra  <amodra@gmail.com>
1332
1333         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
1334
1335 2014-06-06  Cary Coutant  <ccoutant@google.com>
1336
1337         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
1338         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
1339         (Dwarf_pubnames_table::read_header): Likewise.
1340         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
1341         .debug_gnu_pubtypes.
1342
1343 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
1344
1345         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
1346         * Makefile.in, configure: Regenerate.
1347
1348 2014-06-03  Alan Modra  <amodra@gmail.com>
1349
1350         * powerpc.cc (addis_12_2): Define.
1351         (Stub_table::do_write): Support fusion on ELFv2 stubs.
1352
1353 2014-06-03  Alan Modra  <amodra@gmail.com>
1354
1355         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
1356         st_other output.
1357
1358 2014-06-02  Alan Modra  <amodra@gmail.com>
1359
1360         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
1361         Only ignore relocs on ELFv1.
1362         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
1363
1364 2014-05-30  Cary Coutant  <ccoutant@google.com>
1365
1366         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
1367         * testsuite/Makefile.in: Regenerate.
1368         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
1369
1370 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
1371
1372         PR gold/16945
1373         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
1374         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
1375
1376 2014-05-15  Alan Modra  <amodra@gmail.com>
1377
1378         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
1379         Compare FDE contents with DW_CFA_nop rather than 0.
1380
1381 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
1382
1383         * symtab.h (may_need_copy_reloc): Remove check for position independent
1384         code.
1385         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
1386         position independence before pc absolute may_need_copy_reloc call.
1387         Add check for executable output befor pc relative may_need_copy_reloc
1388         call.
1389         * i386.cc: Ditto.
1390         * arm.cc: Ditto.
1391         * sparc.cc: Ditto.
1392         * tilegx.cc: Ditto.
1393         * powerpc.cc: Add check for no position independence before
1394         may_need_copy_reloc calls.
1395         * testsuite/pie_copyrelocs_test.cc: New file.
1396         * testsuite/pie_copyrelocs_shared_test.cc: New file.
1397         * Makefile.am (pie_copyrelocs_test): New test.
1398         * Makefile.in: Regenerate.
1399
1400 2014-05-08  Martin Liška  <mliska@suse.cz>
1401
1402         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
1403
1404 2014-05-06  Cary Coutant  <ccoutant@google.com>
1405
1406         PR gold/16900
1407         * i386.cc (Output_data_got_plt_i386): New class.
1408         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
1409         parameter. Change all callers.
1410         (Output_data_plt_i386::layout_): Remove.
1411         (Output_data_plt_i386::got_plt_): Change type.
1412         (Target_i386::got_plt_): Change type. Change all references.
1413         (Target_i386::got_section): Create instance of new class.
1414         (Output_data_got_plt_i386::do_write): New function.
1415         * x86_64.cc (Output_data_got_plt_x86_64): New class.
1416         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
1417         parameter. Change all callers.
1418         (Output_data_plt_x86_64::layout_): Remove.
1419         (Output_data_plt_x86_64::got_plt_): Change type.
1420         (Target_x86_64::got_plt_): Change type. Change all references.
1421         (Target_x86_64::got_section): Create instance of new class.
1422         (Output_data_got_plt_x86_64::do_write): New function.
1423         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
1424         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
1425         class.
1426
1427 2014-05-05  Cary Coutant  <ccoutant@google.com>
1428
1429         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
1430         if we have pubnames/pubtypes.
1431
1432 2014-05-02  Cary Coutant  <ccoutant@google.com>
1433
1434         * defstd.cc (in_segment): Define __ehdr_start here...
1435         * layout.cc (Layout::finalize): ...Instead of here.  Set the
1436         output segment when known.
1437         * resolve.cc (Symbol::override_base_with_special): Remember
1438         the original binding.
1439         * symtab.cc (Symbol::set_output_segment): New function.
1440         (Symbol::set_undefined): New function.
1441         * symtab.h (Symbol::is_weak_undefined): Check original undef
1442         binding.
1443         (Symbol::is_strong_undefined): New function.
1444         (Symbol::set_output_segment): New function.
1445         (Symbol::set_undefined): New function.
1446         * target-reloc.h (is_strong_undefined): Remove.
1447         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
1448         Check for hidden undefs.
1449         (relocate_section): Call Symbol::is_strong_undefined.
1450
1451         * testsuite/Makefile.am (ehdr_start_test_1)
1452         (ehdr_start_test_2, ehdr_start_test_3)
1453         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
1454         * testsuite/Makefile.in: Regenerate.
1455         * testsuite/ehdr_start_def.cc: New source file.
1456         * testsuite/ehdr_start_test.cc: New source file.
1457         * testsuite/ehdr_start_test.t: New linker script.
1458         * testsuite/ehdr_start_test_4.sh: New shell script.
1459
1460 2014-04-23  Cary Coutant  <ccoutant@google.com>
1461
1462         PR gold/16870
1463         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
1464
1465 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1466
1467         * layout.cc (Layout::include_section): Allow a target to decide
1468         whether to include a section.
1469         * target.h (Target::should_include_section): New function.
1470         (Target::do_should_include_section): New function.
1471
1472 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1473
1474         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
1475         inline into ...
1476         (Copy_relocs::emit): ... here.
1477         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
1478         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
1479         (Copy_reloc_entry::entries_): Change from private to protected.
1480
1481 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
1482
1483         * icf.cc (get_section_contents): Replace copies of reloc
1484         vectors with const references.
1485
1486 2014-04-02  Cary Coutant  <ccoutant@google.com>
1487
1488         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
1489         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
1490         * configure: Regenerate.
1491         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
1492         -fno-use-linker-plugin.
1493         (LINK1, CXXLINK1): Add it to the link command.
1494         * testsuite/Makefile.in: Regenerate.
1495
1496 2014-03-12  Alan Modra  <amodra@gmail.com>
1497
1498         * Makefile.in: Regenerate.
1499
1500 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1501
1502         * symtab.h (Symbol::set_nonvis): New function.
1503
1504 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1505
1506         * symtab.cc (Sized_symbol<32>::init_output_data):
1507         Instantiate the template.
1508         (Sized_symbol<64>::init_output_data): Likewise.
1509
1510 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1511
1512         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
1513         adjust dynamic symbol value.
1514         * target.h (Target::adjust_dyn_symbol): New function.
1515         (Target::do_adjust_dyn_symbol): New function.
1516
1517 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1518
1519         * output.cc (Output_data_dynamic::Dynamic_entry::write):
1520         Get the value of DYNAMIC_CUSTOM dynamic entry.
1521         * output.h (Output_data_dynamic::add_custom): New function.
1522         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
1523         dynamic entry.
1524         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
1525         * target.h (Target::dynamic_tag_custom_value): New function.
1526         (Target::do_dynamic_tag_custom_value): New function.
1527
1528 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1529
1530         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
1531         dynsym indexes.
1532         * target.h (Target::has_custom_set_dynsym_indexes): New function.
1533         (Target::do_has_custom_set_dynsym_indexes): New function.
1534         (Target::set_dynsym_indexes): New function.
1535         (Target::do_set_dynsym_indexes): New function.
1536
1537 2014-03-07  Alan Modra  <amodra@gmail.com>
1538
1539         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
1540         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
1541         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
1542         (Powerpc_relocate_functions::has_overflow_bitfield,
1543         overflowed): Use the above.
1544         (Target_powerpc::Relocate::relocate): Correct overflow checking
1545         for a number of relocations.  Modify overflow test for 16-bit
1546         fields in instructions to signed/unsigned according to whether
1547         the field takes a signed or unsigned value.
1548
1549 2014-03-05  Alan Modra  <amodra@gmail.com>
1550
1551         Update copyright years.
1552
1553 2014-03-05  Alan Modra  <amodra@gmail.com>
1554
1555         * powerpc.cc (Target_powerpc::Scan::local, global): Support
1556         R_PPC64_ADDR64_LOCAL.
1557         (Target_powerpc::Relocate::relocate): Likewise.
1558
1559 2014-03-03  Alan Modra  <amodra@gmail.com>
1560
1561         * dwp.cc (print_version): Update copyright year to current.
1562
1563 2014-02-10  Alan Modra  <amodra@gmail.com>
1564
1565         * po/gold.pot: Regenerate.
1566
1567 2014-02-06  Cary Coutant  <ccoutant@google.com>
1568
1569         Fix problem where -u is ignored when a weak undef is seen.
1570
1571         * archive.cc (Library_base::should_include_member): Reorder
1572         code to check for -u option if a weak undef has already been seen.
1573         * testsuite/Makefile.am (weak_undef_test_2): New test case.
1574         * testsuite/Makefile.in: Regenerate.
1575         * testsuite/weak_undef_file3.cc: New file.
1576         * testsuite/weak_undef_file4.cc: New file.
1577         * testsuite/weak_undef_test_2.cc: New file.
1578
1579 2014-02-05  Cary Coutant  <ccoutant@google.com>
1580
1581         Fix issues with gold undefined symbol diagnostics.
1582
1583         PR binutils/15435
1584         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
1585         check to here.
1586         * target-reloc.h (is_strong_undefined): New function.
1587         (relocate_section): Move undef vtable symbol check from here.
1588         Check for is_strong_undefined.
1589
1590 2014-02-05  Cary Coutant  <ccoutant@google.com>
1591
1592         Fix problems with the --dynamic-list option.
1593
1594         PR gold/13577
1595         * options.cc (General_options::parse_dynamic_list):
1596         Set have_dynamic_list_.
1597         (General_options::General_options): Initialize have_dynamic_list_.
1598         (General_options::finalize): Turn off -Bsymbolic and
1599         -Bsymbolic-functions if --dynamic-list provided.
1600         * options.h (General_options::have_dynamic_list): New function.
1601         (General_options::have_dynamic_list_): New data member.
1602         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
1603         correctly.
1604
1605         PR gold/16530
1606         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
1607         in --dynamic-list, mark it.
1608
1609         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
1610         (dynamic_list_2): New test case.
1611         * testsuite/Makefile.in: Regenerate.
1612         * testsuite/dynamic_list_2.cc: New file.
1613         * testsuite/dynamic_list_2.t: New file.
1614         * testsuite/dynamic_list_lib1.cc: New file.
1615         * testsuite/dynamic_list_lib2.cc: New file.
1616         * testsuite/gc_dynamic_list_test.c: New file.
1617         * testsuite/gc_dynamic_list_test.sh: New file.
1618         * testsuite/gc_dynamic_list_test.t: New file.
1619
1620 2014-01-28  Cary Coutant  <ccoutant@google.com>
1621
1622         Add .gdb_index version 7 support.
1623
1624         * gold/dwarf_reader.cc: include <utility> (for make_pair).
1625         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
1626         debug sections.
1627         (Dwarf_ranges_table::read_ranges_table): Likewise.
1628         (Dwarf_pubnames_table::read_section): Check for GNU-style
1629         sections, and for compressed debug sections.
1630         (Dwarf_pubnames_table::read_header): Compute end address of table.
1631         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
1632         for end of list by offset, not by offset == 0.
1633         (Dwarf_info_reader::do_read_string_table): Check for compressed
1634         debug sections.
1635         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1636         Initialize new data members.
1637         (Dwarf_pubnames_table::next_name): return flag_byte.
1638         (Dwarf_pubnames_table::end_of_table_): New data member.
1639         (Dwarf_pubnames_table::is_gnu_style_): New data member.
1640         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
1641         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
1642         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
1643         read skeleton type unit DIEs.
1644         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
1645         (Gdb_index::do_write): Write flag_byte.
1646         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
1647         (Gdb_index::Cu_vector): Store flags along with cu indexes.
1648         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
1649         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
1650
1651 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
1652
1653         * version.cc (print_version): Update copyright year to 2014.
1654
1655 2013-12-19  Dimitry Andric  <dimitry@andric.com>
1656
1657         * stringpool.cc (Stringpool_template::reserve): Add
1658         HAVE_UNORDERED_MAP case.
1659         * stringpool.cc (Stringpool_template::print_stats): Likewise.
1660
1661 2013-12-18  Cary Coutant  <ccoutant@google.com>
1662
1663         * configure.ac: Check for <unordered_set> and <unordered_map>.
1664         * config.in: Regenerate.
1665         * configure: Regenerate.
1666         * system.h: Use <unordered_set> and <unordered_map> if available.
1667
1668 2013-12-10  Roland McGrath  <mcgrathr@google.com>
1669
1670         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
1671         with $(INSTALL_PROGRAM_ENV).
1672         * Makefile.in: Regenerate.
1673
1674 2013-11-22  Cary Coutant  <ccoutant@google.com>
1675
1676         * configure.ac: Add check for which library is needed for
1677         dlopen.
1678         * configure: Regenerate.
1679
1680 2013-11-22  Cary Coutant  <ccoutant@google.com>
1681
1682         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
1683         assembler.
1684         * testsuite/Makefile.in: Regenerate.
1685
1686 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
1687
1688         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
1689         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
1690         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
1691         (Target_x86_64<size>::Scan::local): Likewise.
1692         (Target_x86_64<size>::Scan::global): Likewise.
1693         (Target_x86_64<size>::Relocate::relocate): Likewise.
1694         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
1695         Likewise.
1696         (Target_x86_64<size>::Scan::check_non_pic(): Handle
1697         R_X86_64_PC32_BND.
1698
1699         * testsuite/Makefile.am (check_PROGRAMS): Add
1700         exception_x86_64_bnd_test.
1701         (exception_x86_64_bnd_test_SOURCES): New macro.
1702         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
1703         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
1704         (exception_x86_64_bnd_test_LDADD): Likewise.
1705         (exception_x86_64_bnd_1.o): New rule.
1706         (exception_x86_64_bnd_2.o): Likewise.
1707         * testsuite/Makefile.in: Regenerated.
1708
1709 2013-11-15  Alan Modra  <amodra@gmail.com>
1710
1711         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
1712         accessor.
1713         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
1714         Only call ppc64_local_entry_offset for 64-bit.  Restrict
1715         symval_for_branch lookup to ELFv1.
1716         (Stub_table::add_plt_call_entry): Use unsigned int off.
1717         (Output_data_glink::Address, invalid_address): New.
1718         (Output_data_glink::add_eh_frame): Move out of line.  Add
1719         support for ELFv2.
1720         (Output_data_glink::add_global_entry, find_global_entry,
1721         global_entry_address): New functions.
1722         (Output_data_glink::global_entry_stubs_, end_branch_table_,
1723         ge_size): New variables.
1724         (Output_data_glink::set_final_data_size): Add global entry
1725         stub sizing.
1726         (Output_data_glink::do_write): Write global entry stubs.
1727         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
1728         parameter.  Return true for ELFv2.  Adjust callers.
1729         (Target_powerpc::Scan::local, global): Restrict opd lookup to
1730         ELFv1.  Similarly for ifunc and dynamic relocation processing
1731         specific to ELFv1.  Recognize that symbols are defined on
1732         their plt entries for ELFv2.
1733         (Target_powerpc::symval_for_branch): Assert if called for
1734         ELFv2 or ppc32.
1735         (Target_powerpc::Relocate::relocate): Use global entry plt
1736         stub for symbol value if such exists on ELFv2.
1737         (Target_powerpc::Relocate::relocate): Don't call
1738         symval_for_branch when ELFv2.  Do adjust for local entry
1739         offset when ELFv2.
1740         (Target_powerpc::do_dynsym_value): Set symbols to global entry
1741         plt stub for ELFv2.
1742         (Target_powerpc::do_plt_address_for_global): Similarly.
1743
1744 2013-11-14  Cary Coutant  <ccoutant@google.com>
1745
1746         Revert patch -- this did not fix the problem, and there is
1747         no race there.
1748
1749         2013-11-14  Cary Coutant  <ccoutant@google.com>
1750
1751             PR gold/14860
1752             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1753             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1754             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1755             updating fde_offsets_.
1756             (Eh_frame_hdr::lock_): New data member.
1757
1758 2013-11-14  Cary Coutant  <ccoutant@google.com>
1759
1760         * dwp.cc (Dwo_file_entry): New type.
1761         (File_list): Use Dwo_file_entry.
1762         (Dwo_file::verify): New function.
1763         (Dwo_file::verify_dwo_list): New function.
1764         (Dwo_file::sized_verify_dwo_list): New function.
1765         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
1766         list.
1767         (Dwp_options): New enum type.
1768         (dwp_options): Add --verify-only.
1769         (usage): Likewise.
1770         (main): Likewise.
1771         * dwp.h (gold_info): Add declaration.
1772
1773 2013-11-14  Cary Coutant  <ccoutant@google.com>
1774
1775         PR gold/14860
1776         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1777         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1778         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1779         updating fde_offsets_.
1780         (Eh_frame_hdr::lock_): New data member.
1781
1782 2013-11-06  Cary Coutant  <ccoutant@google.com>
1783
1784         PR gold/15758
1785         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
1786         before reloc sections.
1787
1788 2013-11-04  Alan Modra  <amodra@gmail.com>
1789
1790         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
1791         (Symbol::needs_dynamic_reloc): Test new flag.
1792         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
1793         (Target_powerpc::Scan::get_reference_flags): Add target param.
1794         Return FUNC_DESC_ABI for 64-bit ELFv1.
1795         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
1796         call.
1797         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
1798         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
1799
1800 2013-10-31  Cary Coutant  <ccoutant@google.com>
1801
1802         Restore support for dwp v2 DWARF package file format.
1803
1804         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1805         tu_length parameter.  Adjust all callers.
1806         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1807         * dwp.cc: Include dwarf.h.
1808         (Section_bounds): New struct type.
1809         (Unit_set): New struct type.
1810         (Dwo_file::Dwo_file): Initialize new data member.
1811         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1812         Combine and rename to...
1813         (Dwo_file::read_unit_index): ...this.
1814         (Dwo_file::sized_read_compunit_index)
1815         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1816         (Dwo_file::sized_read_unit_index): ...this.
1817         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1818         parameters; add section_id parameter.
1819         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1820         (Dwo_file::add_unit_set): ...this.
1821         (Dwo_file::shndx_map_): Remove.
1822         (Dwo_file::sect_offsets_): New data member.
1823         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1824         (Dwp_output_file::add_section): Rename to...
1825         (Dwp_output_file::add_contribution): ...this.
1826         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1827         (Dwp_output_file::add_tu_set): Likewise.
1828         (Dwp_output_file::Contribution): New type.
1829         (Dwp_output_file::Section::contributions): New data member.
1830         (Dwp_output_file::Cu_or_tu_set): Remove.
1831         (Dwp_output_file::Section::Section): New ctor.
1832         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1833         (Dwp_output_file::Dwp_index::Section_table): New type.
1834         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1835         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1836         parameter.
1837         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1838         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1839         (Dwp_output_file::Dwp_index::section_table): New member function.
1840         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1841         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1842         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1843         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1844         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1845         (Dwp_output_file::Dwp_index::section_table_): New data member.
1846         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1847         (Dwp_output_file::add_output_section): New member function.
1848         (Dwp_output_file::write_new_section): New member function.
1849         (Dwp_output_file::write_contributions): New member function.
1850         (Dwp_output_file::section_id_map_): New data member.
1851         (class Dwo_id_info_reader): Remove.
1852         (class Unit_reader): New class.
1853         (get_dwarf_section_name): New function.
1854         (Dwo_file::read_executable): Adjust initializations of class data.
1855         (Dwo_file::read): Add support for v2 package file format.
1856         (Dwo_file::read_unit_index): Likewise.
1857         (Dwo_file::sized_read_unit_index): Likewise.
1858         (Dwo_file::copy_section): Likewise.
1859         (Dwo_file::add_unit_set): Likewise.
1860         (Dwp_output_file::add_output_section): Likewise.
1861         (Dwp_output_file::add_contribution): Likewise.
1862         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1863         for empty slot.
1864         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1865         file format.
1866         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1867         slot.
1868         (Dwp_output_file::initialize): Remove unused function.
1869         (Dwp_output_file::finalize): Add support for v2 package file format.
1870         (Dwp_output_file::write_index): Likewise.
1871         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1872         function prototype.
1873
1874 2013-10-31  Cary Coutant  <ccoutant@google.com>
1875
1876         * configure.ac: Fix check for -fmerge-constants.
1877         * configure.ac: Regenerate.
1878
1879 2013-10-30  Roland McGrath  <mcgrathr@google.com>
1880
1881         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
1882         Correct 9-byte nop sequence to match what the assembler generates.
1883
1884 2013-10-30  Alan Modra  <amodra@gmail.com>
1885
1886         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
1887         ppc64_local_entry_offset, ppc64_local_entry_offset,
1888         do_read_symbols): New functions.
1889         (Powerpc_relobj::e_flags_, st_other_): New vars.
1890         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
1891         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
1892         (Powerpc_relobj::e_flags_): New var.
1893         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
1894         and adjust for ELFv2.
1895         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
1896         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
1897         (Powerpc_dynobj::do_find_special_sections): Likewise.
1898         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
1899         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
1900         to ELFv2 local entry.
1901         (Target_powerpc::do_relax): No thread safe barriers needed for
1902         ELFv2.
1903         (Output_data_plt_powerpc::initial_plt_entry_size_,
1904         plt_entry_size): Delete.  Replace all uses with
1905         first_plt_entry_offset() and plt_entry_size().
1906         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
1907         reserved_size parm.  Update callers.
1908         (Output_data_plt_powerpc::entry_count): Update.
1909         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
1910         and use Target_powerpc::first_plt_entry_offset().
1911         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
1912         rename to plt_entry_size.
1913         (Output_data_plt_powerpc::add_ifunc_entry,
1914         add_local_ifunc_entry): Adjust reloc for ELFv2.
1915         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
1916         (glink_eh_frame_fde_64v2): New.
1917         (Stub_table::plt_call_size): Support ELFv2 sizing.
1918         (Output_data_glink::add_eh_frame): Use the new FDE.
1919         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
1920         (Stub_table::do_write): Write ELFv2 stubs and glink.
1921         (Target_powerpc::Relocate::relocate): Replaces nop after call
1922         with ld 2,24(1) and adjust local offset destination for ELFv2.
1923
1924 2013-10-30  Alan Modra  <amodra@gmail.com>
1925
1926         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
1927         (Target_powerpc::Scan::global, local): Likewise.
1928         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
1929         on all ppc64 @h and @ha relocs.
1930
1931 2013-10-14  Alan Modra  <amodra@gmail.com>
1932
1933         * output.h (Output_data_got::add_constant): Tidy.
1934         (Output_data_got::add_constant_pair): New function.
1935         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
1936         methods used so as to first call reserve_ent().
1937
1938 2013-10-11  Roland McGrath  <mcgrathr@google.com>
1939
1940         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
1941         add_got_entry and add_got_entry_pair.
1942
1943         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
1944         (HAVE_PUBNAMES): Likewise.
1945         * configure: Regenerate.
1946
1947         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
1948         * testsuite/Makefile.in: Regenerate.
1949
1950         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
1951         Remove const from declaration.
1952         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
1953         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
1954         * output.h (Output_file_header): Remove const from member target_
1955         and corresponding constructor argument.
1956         * output.cc (Output_file_header::Output_file_header): Update prototype.
1957         (Output_file_header::do_sized_write): Use this->target_ in place
1958         of parameters()->target().
1959
1960         * testsuite/undef_symbol.cc (Foo::get_a): New method.
1961
1962         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
1963         * configure: Regenerate.
1964         * Makefile.in: Regenerate.
1965         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
1966         * testsuite/merge_string_literals_2.c: Likewise.
1967         * testsuite/Makefile.am
1968         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
1969         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
1970         literal -fmerge-constants.
1971         * testsuite/Makefile.in: Regenerate.
1972
1973         * i386.cc (Target_i386): Remove unused member dynbss_.
1974         * arm.cc (Target_arm): Likewise.
1975         * powerpc.cc (Target_powerpc): Likewise.
1976         * sparc.cc (Target_sparc): Likewise.
1977         * tilegx.cc (Target_tilegx): Likewise.
1978         * x86_64.cc (Target_x86_64): Likewise.
1979         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
1980         type_signature_, type_offset_.
1981         * plugin.h (Plugin_hook): Remove unused member layout_.
1982         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
1983         mapfile_.
1984         (Read_member): Remove unused members input_objects_, symtab_,
1985         mapfile_, layout_.
1986         (Check_library): Remove unused member symtab_.
1987         * archive.h (Lib_group): Remove unused member lib_.
1988         * archive.cc (Lib_group::Lib_group): Update initializer.
1989         * incremental.h (Incremental_binary): Remove unused member target_.
1990         (Incremental_script_entry): Removed unused member script_.
1991         * layout.h (Write_symbols_task): Remove unused member input_objects_.
1992         * icf.h (Icf): Remove unused member num_tracked_relocs.
1993
1994         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1995         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1996         its only use.
1997         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1998
1999         * archive.h: Use struct rather than class for forward declaration
2000         of Read_symbols_data.
2001
2002 2013-10-07  Cary Coutant  <ccoutant@google.com>
2003
2004         PR gold/16010
2005         * testsuite/Makefile.am (icf_test): Fix dependencies.
2006         (icf_safe_test): Likewise.
2007         (icf_safe_so_test): Likewise.
2008         (large_symbol_alignment): Add empty _LDADD rule.
2009         * testsuite/Makefile.in: Regenerate.
2010
2011 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
2012
2013         PR gold/15927
2014         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
2015         relocation for R_X86_64_32 on x32.
2016
2017 2013-08-27  Roland McGrath  <mcgrathr@google.com>
2018
2019         * output.cc (Output_segment::set_section_addresses): Take new
2020         Target* argument.  If target->isolate_execinstr() and the segment
2021         is executable and starts at a target->abi_pagesize() boundary,
2022         pad its end out to a target->abi_pagesize() boundary with code fill.
2023         * output.h (Output_segment::set_section_addresses): Update decl.
2024         * layout.h (Layout::check_output_data_for_reset_values): Take new
2025         argument RELAX_OUTPUTS.
2026         (Layout): New member relax_output_list_.
2027         (Layout::add_relax_output): New method.
2028         * layout.cc (Layout::Layout): Update constructor.
2029         (Layout::reset_relax_output): New method.
2030         (Layout::clean_up_after_relaxation): Call it.
2031         (Layout::prepare_for_relaxation): Update caller.
2032         (Layout::set_segment_offsets): Update callers of set_section_addresses.
2033         Call reset_relax_output before re-processing segments for
2034         isolate_execinstr case.
2035         (Layout::write_data): Handle relax_output_list_.
2036         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
2037         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
2038
2039 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
2040
2041         PR binutils/15834
2042         * object.h: Fix typos.
2043
2044 2013-08-16  Roland McGrath  <mcgrathr@google.com>
2045
2046         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
2047         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
2048
2049 2013-08-07  Cary Coutant  <ccoutant@google.com>
2050
2051         Revert support for v2 DWP files:
2052
2053         2013-03-01  Cary Coutant  <ccoutant@google.com>
2054
2055             Add dwp support for v2 DWARF package file format.
2056             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2057             tu_length parameter.  Adjust all callers.
2058             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2059             * dwp.cc: Include dwarf.h.
2060             (Section_bounds): New struct type.
2061             (Unit_set): New struct type.
2062             (Dwo_file::Dwo_file): Initialize new data member.
2063             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2064             Combine and rename to...
2065             (Dwo_file::read_unit_index): ...this.
2066             (Dwo_file::sized_read_compunit_index)
2067             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2068             (Dwo_file::sized_read_unit_index): ...this.
2069             (Dwo_file::copy_section): Remove section_name, is_str_offsets
2070             parameters; add section_id parameter.
2071             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2072             (Dwo_file::add_unit_set): ...this.
2073             (Dwo_file::shndx_map_): Remove.
2074             (Dwo_file::sect_offsets_): New data member.
2075             (Dwp_output_file::Dwp_output_file): Initialize new data members.
2076             (Dwp_output_file::add_section): Rename to...
2077             (Dwp_output_file::add_contribution): ...this.
2078             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2079             (Dwp_output_file::add_tu_set): Likewise.
2080             (Dwp_output_file::Contribution): New type.
2081             (Dwp_output_file::Section::contributions): New data member.
2082             (Dwp_output_file::Cu_or_tu_set): Remove.
2083             (Dwp_output_file::Section::Section): New ctor.
2084             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2085             (Dwp_output_file::Dwp_index::Section_table): New type.
2086             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2087             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2088             parameter.
2089             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2090             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2091             (Dwp_output_file::Dwp_index::section_table): New member function.
2092             (Dwp_output_file::Dwp_index::section_table_end): New member function.
2093             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2094             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2095             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2096             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2097             (Dwp_output_file::Dwp_index::section_table_): New data member.
2098             (Dwp_output_file::Dwp_index::section_mask_): New data member.
2099             (Dwp_output_file::add_output_section): New member function.
2100             (Dwp_output_file::write_new_section): New member function.
2101             (Dwp_output_file::write_contributions): New member function.
2102             (Dwp_output_file::section_id_map_): New data member.
2103             (class Dwo_id_info_reader): Remove.
2104             (class Unit_reader): New class.
2105             (get_dwarf_section_name): New function.
2106             (Dwo_file::read_executable): Adjust initializations of class data.
2107             (Dwo_file::read): Add support for v2 package file format.
2108             (Dwo_file::read_unit_index): Likewise.
2109             (Dwo_file::sized_read_unit_index): Likewise.
2110             (Dwo_file::copy_section): Likewise.
2111             (Dwo_file::add_unit_set): Likewise.
2112             (Dwp_output_file::add_output_section): Likewise.
2113             (Dwp_output_file::add_contribution): Likewise.
2114             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2115             for empty slot.
2116             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2117             file format.
2118             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2119             slot.
2120             (Dwp_output_file::initialize): Remove unused function.
2121             (Dwp_output_file::finalize): Add support for v2 package file format.
2122             (Dwp_output_file::write_index): Likewise.
2123             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2124             function prototype.
2125
2126 2013-07-31  Cary Coutant  <ccoutant@google.com>
2127
2128         * object.cc (Sized_relobj::do_output_section_address): New function.
2129         (Sized_relobj): Instantiate explicitly.
2130         * object.h (Object::output_section_address): New function.
2131         (Object::do_output_section_address): New function.
2132         (Sized_relobj::do_output_section_address): New function.
2133         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
2134
2135 2013-07-30  Cary Coutant  <ccoutant@google.com>
2136             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2137
2138         * parameters.cc (Parameters::entry): Return target-specific entry
2139         symbol name.
2140         * target.h (Target::entry_symbol_name): New function.
2141         (Target_info::entry_symbol_name): New data member.
2142
2143         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
2144         * i386.cc (Target_i386::i386_info): Likewise.
2145         (Target_i386_nacl::i386_nacl_info): Likewise.
2146         * sparc.cc (Target_sparc::sparc_info): Likewise.
2147         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
2148         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
2149         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
2150         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2151
2152 2013-07-22  Sterling Augustine  <saugustine@google.com>
2153
2154         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
2155         Convert parameter shndx to local variable. Add parameters symtab
2156         and symtab_size.  Scan over section names.  Find relocation
2157         section corresponding to current section.  Create and initialize
2158         reloc_mapper_ and reloc_type_.
2159         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
2160         unit_length to off_t.  Initialize member unit_length_.  Fill in field
2161         cu_offset_.
2162         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2163         Initialize new fields unit_length_ and cu_offset_.
2164         (Dwarf_pubnames_table::read_section): Update prototype.
2165         (Dwarf_pubnames_table::cu_offset): New member function.
2166         (Dwarf_pubnames_table::subsection_size): Likewise.
2167         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
2168         New fields.
2169         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
2170         member functions public.
2171         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
2172         Update comment.  Rework logic.  Move repeated parts to...
2173         (Gdb_index_info_reader::read_pubtable): ...here. New function.
2174         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
2175         pubtypes_table_, and stmt_list_offset.
2176         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2177         Gdb_index::find_pubtype_offset,
2178         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
2179         (Gdb_index::pubnames_read): Update prototype and rework logic.
2180         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
2181         Forward declare.
2182         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2183         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
2184         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
2185         Gdb_index::map_pubtable_to_dies):
2186         Declare functions.
2187         (Gdb_index::pubnames_read): Update declaration.
2188         (Gdb_index::Pubname_offset_map): New type.
2189         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
2190         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
2191         Gdb_index::stmt_list_offset): Declare.
2192         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
2193         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
2194         Gdb_index::pubtypes_offset_): Remove.
2195
2196 2013-07-19  Roland McGrath  <mcgrathr@google.com>
2197
2198         * options.h (General_options): Add -Trodata-segment option.
2199         * parameters.cc (Parameters::check_rodata_segment): New function.
2200         (Parameters::set_target_once): Call it.
2201         * parameters.h (Parameters): Declare it (private member function).
2202         * layout.cc (load_seg_unusable_for_headers): New function, broken
2203         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
2204         then validate rodata segment rather than text segment.
2205         (relaxation_loop_body): Call that.
2206         (is_text_segment): New function.  Don't admit a non-executable
2207         segment if TARGET->isolate_execinstr().
2208         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
2209
2210 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
2211
2212         PR gold/15070
2213         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
2214         * nacl.h (Sniff_file::View::View): Request aligned view.
2215
2216 2013-07-11  Cary Coutant  <ccoutant@google.com>
2217
2218         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
2219         correct BRLT entry size.
2220
2221 2013-07-03  Alan Modra  <amodra@gmail.com>
2222
2223         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
2224         comment.
2225
2226 2013-07-01  Cary Coutant  <ccoutant@google.com>
2227
2228         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
2229         reloc_type_.
2230         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
2231         (Dwarf_ranges_table::lookup_reloc): New function.
2232         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
2233         reloc_type_.
2234         (Dwarf_ranges_table::lookup_reloc): New function.
2235         (Dwarf_ranges_table::reloc_type_): New data member.
2236
2237 2013-06-27  Jing Yu  <jingyu@google.com>
2238
2239         PR gold/15662
2240         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
2241         function.
2242         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
2243         (Target_powerpc::do_relax): Call the above.
2244
2245 2013-06-27  Cary Coutant  <ccoutant@google.com>
2246
2247         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
2248         on garbage collected .opd section.
2249
2250 2013-06-27  Alan Modra  <amodra@gmail.com>
2251
2252         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
2253         is non-zero.
2254         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
2255         (Target_powerpc::do_function_location): Likewise for loc->shndx.
2256
2257 2013-06-14  Cary Coutant  <ccoutant@google.com>
2258
2259         * resolve.cc (Symbol::override_base): Don't override st_type
2260         from plugin placeholder symbols.
2261         (Symbol_table::resolve): Likewise.
2262         (Symbol_table::should_override): Don't complain about TLS mismatch
2263         if the TO symbol is a plugin placeholder.
2264         * testsuite/Makefile.am (plugin_test_tls): New test.
2265         * testsuite/Makefile.in: Regenerate.
2266         * testsuite/plugin_test_tls.sh: New test script.
2267         * testsuite/two_file_test_2_tls.cc: New test source.
2268         * testsuite/two_file_test_tls.cc: New test source.
2269
2270 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2271
2272         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
2273         the maximum segment alignment is larger than the page size.
2274         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
2275         correctly aligns the symbols with large alignemnt.
2276         * testsuite/Makefile.in: Regenerate.
2277         * testsuite/large_symbol_alignment.cc: New file.
2278
2279 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2280             Sriraman Tallam  <tmsriram@google.com>
2281
2282         * options.h (sort_section): New option.
2283         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
2284         Rename from Input_section_sort_section_name_special_ordering_compare.
2285         (Input_section_sort_section_name_compare): New struct.
2286         * output.cc (Output_section::Input_section_sort_section_name_compare::
2287         operator()): New function.
2288         (Output_section::sort_attached_input_sections): Use new sort function
2289         for .text if --sort-section=name is specified.
2290         * layout.cc (Layout::make_output_section):
2291         Add sorting by name when --sort-section=name is specified.
2292         * testsuite/Makefile.am (text_section_grouping): Test option
2293         --sort-section=name.
2294         * testsuite/Makefile.in: Regenerate.
2295         * testsuite/section_sorting_name.cc: New file.
2296         * testsuite/section_sorting_name.sh: New file.
2297
2298 2013-05-21  Cary Coutant  <ccoutant@google.com>
2299
2300         * symtab.h (Symbol::is_cxx_vtable): New function.
2301         * target-reloc.h (relocate_section): Check for vtable symbol.
2302         * testsuite/Makefile.am (missing_key_func.sh): New test case.
2303         * testsuite/Makefile.in: Regenerate.
2304         * testsuite/missing_key_func.cc: New test source.
2305         * testsuite/missing_key_func.sh: New test script.
2306
2307 2013-05-21  Cary Coutant  <ccoutant@google.com>
2308
2309         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
2310         type of enclosing symbol.
2311         (Relocate_info::location): Check symbol type when describing symbol.
2312         * object.h (Symbol_location_info): Remove unused line_number;
2313         add enclosing_symbol_type.
2314         * testsuite/debug_msg.sh: Adjust expected output.
2315
2316 2013-05-13  Cary Coutant  <ccoutant@google.com>
2317
2318         * configure.ac: Export DEFAULT_TARGET.
2319         * configure: Regenerate.
2320         * Makefile.in: Regenerate.
2321         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
2322         * testsuite/Makefile.in: Regenerate.
2323         * testsuite/debug_msg.sh: Delete duplicate tests.
2324         Don't check undef_int error message match for powerpc where the
2325         source file and line number aren't available.
2326
2327 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2328
2329         * options.h (General_options): Add --rosegment-gap option.
2330         * options.cc (finalize): --rosegment-gap implies --rosegment.
2331         * layout.cc (set_segment_offsets): Let user option override
2332         target->rosegment_gap().
2333
2334 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2335
2336         * options.h (General_options): Remove leading space from help
2337         messages for -nostdlib and --rosegment.
2338
2339 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
2340
2341         PR ld/15365
2342         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
2343
2344 2013-05-03  Alan Modra  <amodra@gmail.com>
2345
2346         * merge.cc (Output_merge_string::do_add_input_section): Correct
2347         scan for number of strings.  Rename vars to avoid shadowing.
2348         Include missing terminator in input_size_.
2349
2350 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
2351
2352         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
2353         Restore empty string handling.
2354
2355 2013-05-01  Cary Coutant  <ccoutant@google.com>
2356
2357         * stringpool.cc (Stringpool_template::new_key_offset): Fix
2358         uninitialized warning.
2359
2360 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2361
2362         * output.cc (Output_section::add_merge_input_section): Allow
2363         to merge sections if the alignment is more than character size.
2364         * merge.h (Output_merge_string::Output_merge_string): Remove
2365         assert.
2366         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
2367         only not-null strings. Check the alignment of strings.
2368         * stringpool.h
2369         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
2370         alignment as the argument.
2371         (Stringpool_template<Stringpool_char>::addralign_): New class member.
2372         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
2373         Align non-zero length strings according to the addralign_.
2374         (Stringpool_template<Stringpool_char>::set_string_offsets):
2375         Updating offsets according to the given alignment.
2376         * testsuite/Makefile.am (text_section_grouping): Test if string
2377         literals are getting merged.
2378         * testsuite/Makefile.in: Regenerate.
2379         * testsuite/merge_string_literals_1.c: New file.
2380         * testsuite/merge_string_literals_2.c: Ditto.
2381         * testsuite/merge_string_literals.sh: Ditto.
2382
2383 2013-04-26  Ian Lance Taylor  <iant@google.com>
2384
2385         * target-reloc.h (relocate_section): If the reloc offset is out of
2386         range, pass VIEW as NULL to relocate.relocate.
2387         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
2388         * i386.cc (Target_i386::Relocate::relocate): Likewise.
2389         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
2390         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
2391         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
2392         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2393
2394 2013-04-26  Geoff Pike  <gpike@chromium.org>
2395
2396         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
2397         * layout.cc (Hash_task): New class.
2398         (Layout::queue_build_id_tasks): New function.
2399         (Layout::write_build_id): Handle single-thread portion of build ID
2400         computation.  (In some cases, all of it is single-threaded.)  Replace
2401         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
2402         functionality in fewer lines of code.
2403         * layout.h (Layout::queue_build_id_tasks): New function declaration.
2404         * options.h (General_options): make "--build-id" default to tree
2405         rather than sha1.  Add two new options related to --build-id=tree:
2406         --build-id-chunk-size-for-treehash and
2407         --build-id-min-file-size-for-treehash.
2408         * Makefile.am: add testing of --build-id=tree and related new options
2409         (these tests will be invoked by "make check").
2410         * Makefile.in: Regenerate.
2411
2412 2013-04-25  Alan Modra  <amodra@gmail.com>
2413
2414         * configure.tgt: Add powerpcle and powerpc64le.
2415
2416 2013-04-22  Alan Modra  <amodra@gmail.com>
2417
2418         PR gold/15355
2419         * layout.cc (Layout::segment_precedes): Allow more than one
2420         segment with the same type and flags.
2421
2422 2013-04-15  Cary Coutant  <ccoutant@google.com>
2423
2424         * layout.cc (Layout::set_relocatable_section_offsets): Don't
2425         allocate space in file for BSS sections.
2426
2427 2013-04-15  Cary Coutant  <ccoutant@google.com>
2428
2429         * script-sections.cc (Orphan_output_section): Reset address
2430         to zero after each orphaned section for relocatable links.
2431
2432 2013-04-15  Cary Coutant  <ccoutant@google.com>
2433
2434         * symtab.cc (Symbol_table::sized_write_globals): Subtract
2435         section starting address for relocatable link.
2436         * testsuite/Makefile.am (script_test_11): New test.
2437         * testsuite/Makefile.in: Regenerate.
2438         * testsuite/script_test_11.c: New source file.
2439         * testsuite/script_test_11.t: New linker script.
2440
2441 2013-04-13  Alan Modra  <amodra@gmail.com>
2442
2443         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
2444         owner when sections are not adjacent and exceed group size.
2445         (Target_powerpc::group_sections): Handle corner case.
2446         (Target_powerpc::Branch_info::make_stub): Handle case where
2447         stub table doesn't exist due to branches in non-exec sections.
2448         (Target_powerpc::Relocate::relocate): Likewise.
2449
2450 2013-04-11  Alan Modra  <amodra@gmail.com>
2451
2452         PR gold/15354
2453         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
2454         .branch_lt to match bfd ld.  Adjust comments throughout file.
2455
2456 2013-04-04  Ian Lance Taylor  <iant@google.com>
2457
2458         GCC PR c++/56840
2459         * object.cc (do_layout_deferred_sections): Handle .eh_frame
2460         sections before checking whether they are included in the link.
2461
2462 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
2463
2464         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
2465         object before calling the plugin claim_file handler.  Pass the elf
2466         object of the archive to the plugin. Delete the elf object if the
2467         plugin claims the file.
2468
2469 2013-03-21  Alan Modra  <amodra@gmail.com>
2470
2471         * layout.cc (Layout::set_segment_offsets): Accept writable .text
2472         segment when omagic.
2473
2474 2013-03-21  Alan Modra  <amodra@gmail.com>
2475
2476         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
2477         comparison warning.
2478         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
2479         uninitialized" warning.
2480
2481 2013-03-20  Alan Modra  <amodra@gmail.com>
2482
2483         * symtab.h (Symbol::clear_version): New function.
2484         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
2485         is_needed by weak references.  Clear version for symbols defined
2486         in as-needed objects that are not needed.
2487
2488 2013-03-15  Alan Modra  <amodra@gmail.com>
2489
2490         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
2491         static and public.  Add report_err param.  Return false for data refs.
2492         (Target_powerpc::rela_dyn_section): New overloaded function.
2493         (Target_powerpc::plt_, iplt_): Elucidate.
2494         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
2495         (Output_data_plt_powerpc::do_write): Don't write .iplt.
2496         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
2497         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
2498         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
2499         push_branch and make_plt_entry for ifunc syms when
2500         reloc_needs_plt_for_ifunc.
2501         (Target_powerpc::Relocate::relocate): Don't use plt entry value
2502         for ifunc unless reloc_needs_plt_for_ifunc.
2503
2504 2013-03-15  Alan Modra  <amodra@gmail.com>
2505
2506         * gc.h (gc_process_relocs): Don't look through function descriptors.
2507         * icf.cc (get_section_contents): Do so here instead.
2508
2509 2013-03-13  Alan Modra  <amodra@gmail.com>
2510
2511         * powerpc.cc (is_branch_reloc): Forward declare.
2512         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
2513         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
2514         false for 64-bit, true for 32-bit non-branch relocs.
2515         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
2516         * testsuite/Makefile.am (icf_test): Use linker map file instead of
2517         nm output.
2518         (icf_safe_test): Generate linker map file as well as nm output.
2519         (icf_safe_so_test): Likewise.
2520         * testsuite/Makefile.in: Regenerate.
2521         * testsuite/icf_test.sh: Parse linker map file to determine
2522         section folding.
2523         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
2524         * testsuite/icf_safe_so_test.sh: Likewise.
2525         (X86_32_or_ARM_specific_safe_fold): Merge into..
2526         (arch_specific_safe_fold): ..this.
2527         (X86_64_specific_safe_fold): Delete unused function.
2528
2529 2013-03-12  Alan Modra  <amodra@gmail.com>
2530
2531         * gc.h (gc_process_relocs): Look through function descriptors
2532         to determine shndx, symvalue and addend used by ICF.  Tidy
2533         variable duplication.
2534
2535 2013-03-11  Alan Modra  <amodra@gmail.com>
2536
2537         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
2538         * layout.cc (Layout_task_runner::run): ..to here.
2539         * symtab.h (struct Symbol_location): Extract from..
2540         (class Symbol_table): ..here.
2541         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
2542         * target.h (class Target): Add function_location and
2543         do_function_location functions.
2544         (class Sized_target): Add do_function_location.
2545         * object.h (class Sized_relobj_file): Move find_shdr..
2546         (class Object): ..to here.
2547         * object.cc: Likewise.  Update to suit.  Instantiate.
2548         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
2549         * powerpc.cc (class Powerpc_dynobj): New.
2550         (Target_powerpc::do_function_location): New function.
2551         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
2552         (Powerpc_dynobj::do_read_symbols): New function.
2553         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
2554
2555 2013-03-08  Ian Lance Taylor  <iant@google.com>
2556
2557         * options.cc (General_options::string_to_object_format): Accept
2558         "default".
2559
2560 2013-03-08  Alan Modra  <amodra@gmail.com>
2561
2562         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
2563         pointer to Post_fde.
2564         (struct Post_fde): Move definition to here..
2565         * ehframe.cc (struct Post_fde): ..from here.
2566         (Cie::write): Don't alloc Post_fde.
2567         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
2568
2569 2013-03-07  Alan Modra  <amodra@gmail.com>
2570
2571         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
2572         relocation referencing .LC0.
2573         * testsuite/discard_locals_test.sh: Remove FIXMEs.
2574
2575 2013-03-07  Alan Modra  <amodra@gmail.com>
2576
2577         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
2578         always_inline.  Add assembly for powerpc to avoid GOT.
2579
2580 2013-03-07  Alan Modra  <amodra@gmail.com>
2581
2582         * testsuite/script_test_10.sh: Don't test .bss section
2583         header number.
2584
2585 2013-03-06  Alan Modra  <amodra@gmail.com>
2586
2587         * powerpc.cc (class Powerpc_relobj): Move some member functions.
2588         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
2589         all callers.  Handle folded sections.
2590         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
2591         to Powerpc_relobj.
2592         (Global_symbol_visitor_opd::operator()): Likewise.
2593
2594 2013-03-04  Alan Modra  <amodra@gmail.com>
2595
2596         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
2597         * testsuite/Makefile.in: Regenerate.
2598
2599 2013-03-01  Cary Coutant  <ccoutant@google.com>
2600
2601         Add dwp support for v2 DWARF package file format.
2602         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2603         tu_length parameter.  Adjust all callers.
2604         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2605         * dwp.cc: Include dwarf.h.
2606         (Section_bounds): New struct type.
2607         (Unit_set): New struct type.
2608         (Dwo_file::Dwo_file): Initialize new data member.
2609         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2610         Combine and rename to...
2611         (Dwo_file::read_unit_index): ...this.
2612         (Dwo_file::sized_read_compunit_index)
2613         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2614         (Dwo_file::sized_read_unit_index): ...this.
2615         (Dwo_file::copy_section): Remove section_name, is_str_offsets
2616         parameters; add section_id parameter.
2617         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2618         (Dwo_file::add_unit_set): ...this.
2619         (Dwo_file::shndx_map_): Remove.
2620         (Dwo_file::sect_offsets_): New data member.
2621         (Dwp_output_file::Dwp_output_file): Initialize new data members.
2622         (Dwp_output_file::add_section): Rename to...
2623         (Dwp_output_file::add_contribution): ...this.
2624         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2625         (Dwp_output_file::add_tu_set): Likewise.
2626         (Dwp_output_file::Contribution): New type.
2627         (Dwp_output_file::Section::contributions): New data member.
2628         (Dwp_output_file::Cu_or_tu_set): Remove.
2629         (Dwp_output_file::Section::Section): New ctor.
2630         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2631         (Dwp_output_file::Dwp_index::Section_table): New type.
2632         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2633         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2634         parameter.
2635         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2636         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2637         (Dwp_output_file::Dwp_index::section_table): New member function.
2638         (Dwp_output_file::Dwp_index::section_table_end): New member function.
2639         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2640         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2641         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2642         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2643         (Dwp_output_file::Dwp_index::section_table_): New data member.
2644         (Dwp_output_file::Dwp_index::section_mask_): New data member.
2645         (Dwp_output_file::add_output_section): New member function.
2646         (Dwp_output_file::write_new_section): New member function.
2647         (Dwp_output_file::write_contributions): New member function.
2648         (Dwp_output_file::section_id_map_): New data member.
2649         (class Dwo_id_info_reader): Remove.
2650         (class Unit_reader): New class.
2651         (get_dwarf_section_name): New function.
2652         (Dwo_file::read_executable): Adjust initializations of class data.
2653         (Dwo_file::read): Add support for v2 package file format.
2654         (Dwo_file::read_unit_index): Likewise.
2655         (Dwo_file::sized_read_unit_index): Likewise.
2656         (Dwo_file::copy_section): Likewise.
2657         (Dwo_file::add_unit_set): Likewise.
2658         (Dwp_output_file::add_output_section): Likewise.
2659         (Dwp_output_file::add_contribution): Likewise.
2660         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2661         for empty slot.
2662         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2663         file format.
2664         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2665         slot.
2666         (Dwp_output_file::initialize): Remove unused function.
2667         (Dwp_output_file::finalize): Add support for v2 package file format.
2668         (Dwp_output_file::write_index): Likewise.
2669         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2670         function prototype.
2671
2672 2013-03-01  Cary Coutant  <ccoutant@google.com>
2673
2674         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
2675         function into class definition in header file.
2676         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
2677         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
2678         New function.
2679         (Dwarf_info_reader::check_buffer): Move here from .cc file.
2680
2681 2013-02-28  Alan Modra  <amodra@gmail.com>
2682
2683         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
2684         * target.cc (Target::do_plt_fde_location): New function.
2685         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
2686         accessor function, and constructor param.
2687         (struct Post_fde, Post_fdes): Declare.
2688         (Cie::write): Add post_fdes param.
2689         * ehframe.cc (Fde::write): Use plt_fde_location.
2690         (struct Post_fde): Define.
2691         (Cie::write): Stash FDEs added post merge mapping.
2692         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
2693         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
2694         (Eh_frame::do_sized_write): Arrange to write post map FDES after
2695         other FDEs.
2696         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
2697         (Target_powerpc::has_glink): New function.
2698         (Target_powerpc::do_relax): Add eh_frame info for stubs.
2699         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
2700         glink_eh_frame_fde_32, default_fde): New data.
2701         (Stub_table::eh_frame_added_): New var.
2702         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
2703         Make const.
2704         (Stub_table::add_eh_frame): New function.
2705         (Output_data_glink::add_eh_frame): New function.
2706         (Target_powerpc::make_glink_section): Call add_eh_frame.
2707
2708 2013-02-15  Ian Lance Taylor  <iant@google.com>
2709
2710         * options.h (DEFINE_uint64_alias): Define.
2711         (class General_options): Add -Ttext-segment as an alias for
2712         -Ttext.
2713
2714 2013-02-15  Alan Modra  <amodra@gmail.com>
2715
2716         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
2717         (Stub_table::do_write): ..here, two places.
2718         (Stub_table::plt_call_size): Use it here too.
2719
2720 2013-02-11  Ian Lance Taylor  <iant@google.com>
2721
2722         * descriptors.cc (Descriptors::close_all): New function.
2723         * descriptors.h (class Descriptors): Declare close_all.
2724         (close_all_descriptors): New inline function.
2725         * plugin.cc: Include "descriptors.h".
2726         (Plugin_manager::cleanup): Call close_all_descriptors.
2727
2728 2013-02-06  Alan Modra  <amodra@gmail.com>
2729
2730         * README: Update coding style link.
2731
2732 2013-01-28  Cary Coutant  <ccoutant@google.com>
2733
2734         * dwp.cc (File_list): New typedef.
2735         (Dwo_name_info_reader): New class.
2736         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
2737         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
2738         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
2739         (Dwo_file::read_executable): New function.
2740         (Dwo_file::read): Move common setup code to ...
2741         (Dwo_file::make_object): ... here.
2742         (dwp_options): Add --exec/-e.
2743         (usage): Likewise.
2744         (main): Likewise.
2745
2746 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
2747
2748         * layout.cc (Layout::layout): Check for option text_reorder.
2749         (Layout::make_output_section): Ditto.
2750         * options.h (text_reorder): New option.
2751         * output.cc (Input_section_sort_compare): Remove special ordering
2752         of section names.
2753         (Output_section::
2754          Input_section_sort_section_name_special_ordering_compare::
2755          operator()): New function.
2756         (Output_section::sort_attached_input_sections): Use new sort function
2757         for .text.
2758         * output.h (Input_section_sort_section_name_special_ordering_compare):
2759         New struct.
2760         * testsuite/Makefile.am (text_section_grouping): Test option
2761         --no-text-reorder
2762         * testsuite/Makefile.in: Regenerate.
2763         * testsuite/text_section_grouping.sh: Check order of functions without
2764         default text reordering.
2765
2766 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
2767
2768         * options.h (General_options): Change default to true for new_dtags.
2769
2770 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
2771
2772         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
2773         when enable_new_dtags is false.  Only add DT_RUNPATH when
2774         enable_new_dtags is true.
2775
2776 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
2777
2778         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
2779         used in declaration and definition consistent.
2780         (Target_powerpc::symval_for_branch): Ditto.
2781
2782 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
2783
2784         * testsuite/plugin_final_layout.cc: Fix comment.
2785
2786 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
2787
2788         * layout.cc (Layout::layout): Do not do default sorting for
2789         text sections when section ordering is specified.
2790         (make_output_section): Ditto.
2791         * testsuite/plugin_final_layout.cc: Name the function sections
2792         to catch reordering issues.
2793
2794 2013-01-15  Alan Modra  <amodra@gmail.com>
2795
2796         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
2797         plt-thread-safe.
2798
2799 2013-01-15  Alan Modra  <amodra@gmail.com>
2800
2801         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
2802         * testsuite/Makefile.in: Regenerate.
2803
2804 2013-01-14  Alan Modra  <amodra@gmail.com>
2805
2806         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
2807         * testsuite/Makefile.in: Regenerate.
2808
2809 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
2810
2811         PR bfd/14430
2812         Fix mingw gold build with plugins enabled
2813         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
2814         * configure.ac: Export DLOPEN_LIBS and add headers check.
2815         * plugin.cc: Handle non-dlfcn case.
2816         * Makefile.in: Regenerate.
2817         * config.in: Regenerate.
2818         * configure: Regenerate.
2819         * testsuite/Makefile.in: Regenerate.
2820
2821 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
2822
2823         * output.h (sort_attached_input_sections): Change to be public.
2824         * script-sections.cc
2825         (Output_section_definition::set_section_addresses): Sort
2826         attached input sections according to section order before linker
2827         script assigns section addresses.
2828         (Orphan_output_section::set_section_addresses): Sort
2829         attached input sections according to section order before linker
2830         script assigns section addresses.
2831         * Makefile.am (final_layout.sh): Use a simple linker script to
2832         check if section ordering still works.
2833         * Makefile.in: Regenerate.
2834
2835 2013-01-09  Ben Cheng  <bccheng@google.com>
2836
2837         * arm.cc (Target_arm::attributes_accept_div): New function.
2838         (Target_arm::attributes_forbid_div): New function.
2839         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
2840         attribute using the same new functions as what bfd/elf32_arm.c
2841         does.
2842
2843 2013-01-07  Cary Coutant  <ccoutant@google.com>
2844
2845         PR gold/14993
2846         * output.cc (Output_section::add_input_section): For incremental
2847         updates, don't track input sections that are allocated from patch
2848         space.
2849
2850 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
2851             Ian Lance Taylor  <iant@google.com>
2852
2853         PR gold/14897
2854         * configure.ac (--enable-ld): Removed.
2855         (install_as_default): Set to yes only for --enable-gold=default
2856         or --disable-ld.
2857         * configure: Regenerated.
2858
2859 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
2860
2861         * options.h (General_options): Add -fuse-ld= for GCC linker
2862         option compatibility.
2863
2864 2013-01-04  Cary Coutant  <ccoutant@google.com>
2865
2866         * configure.ac: Fix typo restoring CXXFLAGS.
2867         * configure: Regenerate.
2868
2869 2013-01-04  Cary Coutant  <ccoutant@google.com>
2870
2871         * testsuite/Makefile.am (CXXLINK_S): New macro.
2872         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
2873         * testsuite/Makefile.in: Regenerate.
2874
2875 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
2876
2877         * version.cc (print_version): Update copyright year to 2013.
2878
2879 2012-12-20  Ian Lance Taylor  <iant@google.com>
2880
2881         * layout.cc (Layout::special_ordering_of_input_section): New
2882         function.
2883         (Layout::layout): If input section requires special ordering, must
2884         sort input sections.
2885         (Layout::make_output_section): May sort .text input sections.
2886         (Layout::is_section_name_prefix_grouped): Remove.
2887         * layout.h (class Layout): Declare
2888         special_ordering_of_input_section.  Don't declare
2889         is_section_name_prefix_grouped.
2890         * output.cc (Output_section::add_input_section): Revert last
2891         change.
2892         (Output_section::Input_section_sort::match_file_name): Don't crash
2893         if called on output section data.
2894         (Output_section::Input_section_sort_compare): Sort based on
2895         special ordering.
2896         (Output_section::Input_section_sort_section_order_index_compare):
2897         Revert last patch.
2898         (Output_section::sort_attached_input_sections): Likewise.
2899
2900 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
2901
2902         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
2903         * layout.h (Layout::is_section_name_prefix_grouped): New function.
2904         * output.cc (Output_section::add_input_section): Check if section
2905         name contains special prefix.  Keep input sections to sort such
2906         sections.
2907         (Output_section::Input_section_sort_section_order_index_compare
2908          ::operator()): Group sections according to prefixes.
2909         (Output_section::sort_attached_input_sections): Add condition to
2910         Input_section_entry constructor call.
2911         * testsuite/Makefile.am (text_section_grouping): New test.
2912         * testsuite/Makefile.in: Regenerate.
2913         * testsuite/text_section_grouping.cc: New file.
2914         * testsuite/text_section_grouping.sh: New file.
2915
2916 2012-12-17  Nick Clifton  <nickc@redhat.com>
2917
2918         * Makefile.am: Add copyright notice.
2919         * NEWS: Likewise.
2920         * README: Likewise.
2921         * configure.ac: Likewise.
2922         * ftruncate.c: Likewise.
2923         * Makefile.in: Regenerate.
2924
2925 2012-12-14  Cary Coutant  <ccoutant@google.com>
2926
2927         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
2928         --no-as-needed flag.
2929         (exception_separate_shared_12_test): Likewise.
2930         (incremental_copy_test): Likewise.
2931         * testsuite/Makefile.in: Regenerate.
2932
2933 2012-12-14  Cary Coutant  <ccoutant@google.com>
2934
2935         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
2936         (Dwp_output_file::Dwp_index::enter_set): Add assert.
2937
2938 2012-12-12  Alan Modra  <amodra@gmail.com>
2939
2940         * powerpc.cc (class Track_tls): New.
2941         (class Relocate, class Scan): Inherit Track_tls.
2942         (Target_powerpc::Scan::local, global): Track tls optimization
2943         and avoid creating plt entry for __tls_get_addr if all uses
2944         are optimized away.
2945         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
2946
2947 2012-12-12  Alan Modra  <amodra@gmail.com>
2948
2949         * options.h (General_options): Add --toc-sort/--no-toc-sort.
2950         Replace no_toc_optimize with toc_optimize.
2951         * output.h (Output_section::input_sections): Provide non-const variant.
2952         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
2953         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
2954         accessors.
2955         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
2956         (class Sort_toc_sections): New.
2957         (Target_powerpc::do_finalize_sections): Sort toc sections.
2958         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
2959
2960 2012-12-10  Roland McGrath  <mcgrathr@google.com>
2961
2962         * testsuite/binary_unittest.cc (read_all): New function.
2963         (Sized_binary_test): Use it instead of ::read.
2964         * fileread.cc (do_read): Don't assume pread always reads the whole
2965         amount in a single call.
2966
2967 2012-12-10  Alan Modra  <amodra@gmail.com>
2968
2969         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
2970         Set EM_PPC64 or EM_PPC here.
2971         (Target_selector_powerpc::do_recognize): Delete.
2972
2973 2012-12-10  Alan Modra  <amodra@gmail.com>
2974
2975         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
2976         stub_table_.
2977         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
2978
2979 2012-12-07  Roland McGrath  <mcgrathr@google.com>
2980
2981         * testsuite/binary_unittest.cc (Sized_binary_test):
2982         Use open_descriptor rather than ::open.
2983
2984 2012-12-07  Alan Modra  <amodra@gmail.com>
2985
2986         * powerpc.cc (Stub_table::do_write): Delete redundant Address
2987         typedef and invalid_address constant.
2988         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2989         instantiate constants.
2990
2991 2012-12-06  Roland McGrath  <mcgrathr@google.com>
2992
2993         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2994         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2995         * aclocal.m4: Regenerate.
2996         * configure: Regenerate.
2997         * Makefile.in: Regenerate.
2998         * testsuite/Makefile.in: Regenerate.
2999
3000 2012-12-07  Alan Modra  <amodra@gmail.com>
3001
3002         * options.h (General_options): Add no_toc_optimize.
3003         * powerpc.cc (ok_lo_toc_insn): New function.
3004         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
3005
3006 2012-12-06  Alan Modra  <amodra@gmail.com>
3007
3008         * options.h (General_options): Add plt_align, plt_static_chain,
3009         plt_thread_safe.  Update stub_group_size help text.
3010         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
3011         for new plt_thread_safe_ var.
3012         (use_plt_offset): Correct comments.
3013         (Target_powerpc::do_relax): Look for thread creation symbols to
3014         determine default plt_thread_safe value.  Clear plt call stubs
3015         as well as branch stubs each iteration.
3016         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
3017         insn constants.
3018         (l, hi, ha, write_insn): Move earlier.
3019         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
3020         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
3021         plt stubs too.
3022         (Stub_table::update_size): Adjust.
3023         (Stub_table::prev_size, set_prev_size): Delete.
3024         (Stub_table::stub_align): Let --plt-align affect result.
3025         (Stub_table::plt_call_size): Calculate sizes for various stubs.
3026         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
3027         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
3028         (Stub_table::do_write): Support more stub variants.
3029
3030 2012-12-04  Alan Modra  <amodra@gmail.com>
3031
3032         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
3033         (Target_powerpc::do_define_standard_symbols): New function.
3034
3035 2012-12-03  Alan Modra  <amodra@gmail.com>
3036
3037         * output.h: Formatting, whitespace.
3038
3039 2012-12-03  Alan Modra  <amodra@gmail.com>
3040
3041         * layout.h (Layout::get_executable_sections): Declare.
3042         * layout.cc (Layout::get_executable_sections): New function.
3043         * arm.cc (Target_arm::group_sections): Use it.
3044         (Arm_output_section::group_sections): Delete now redundant test.
3045         * output.cc (Output_reloc::Output_reloc): Add is_relative.
3046         param to handle relative relocs.
3047         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
3048         (Output_data_reloc::add_absolute): Adjust.
3049         (Output_data_reloc::add_relative): New function.
3050         (Output_data::reset_data_size): New function.
3051         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
3052         (Output_section::set_addralign): New function.
3053         (Output_section::checkpoint_set_addralign): New function.
3054         (Output_section::clear_section_offsets_need_adjustment): New function.
3055         (Output_section::input_sections): Make public.
3056         * powerpc.cc (class Output_data_brlt_powerpc): New.
3057         (class Stub_table, class Stub_control): New.
3058         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
3059         stub_table_, set_stub_table, stub_table): New vectors and accessor
3060         functions.
3061         (Target_powerpc::do_may_relax, do_relax, push_branch,
3062         new_stub_table, stub_tables, brlt_section, group_sections,
3063         add_branch_lookup_table, find_branch_lookup_table,
3064         write_branch_lookup_table, make_brlt_section): New functions.
3065         (Target_powerpc::struct Sort_sections, class Branch_info): New.
3066         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
3067         branch_info_): New vars.
3068         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
3069         make call stubs here.
3070         (Output_data_glink): Remove all call stub handling from this class.
3071         (Target_powerpc::Scan::local, global): Save interesting branch
3072         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
3073         (Target_powerpc::do_finalize_sections): Only make reg save/restore
3074         functions on final link.
3075         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
3076         Handle long branch destinations too.
3077         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
3078         do_plt_address_for_local): Adjust lookup of plt call stubs.
3079
3080 2012-11-30  Alan Modra  <amodra@gmail.com>
3081
3082         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
3083         relocs against protected symbols when building 32-bit shared libs.
3084
3085 2012-11-30  Alan Modra  <amodra@gmail.com>
3086
3087         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
3088         param.  Call got_section() to make .got.  Update all callers
3089         and their callers and so on.
3090
3091 2012-11-30  Alan Modra  <amodra@gmail.com>
3092
3093         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
3094         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
3095         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
3096         value if it already exists.
3097
3098 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
3099
3100         PR gold/14858
3101         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
3102
3103 2012-11-14  Roland McGrath  <mcgrathr@google.com>
3104
3105         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
3106         than bfc instruction for data sandboxing.
3107
3108 2012-11-08  Alan Modra  <amodra@gmail.com>
3109
3110         * po/POTFILES.in: Regenerate.
3111
3112 2012-11-05  Alan Modra  <amodra@gmail.com>
3113
3114         * configure.ac: Apply 2012-09-10 change to config.in here.
3115         * configure: Regenerate.
3116
3117 2012-11-05  Alan Modra  <amodra@gmail.com>
3118
3119         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
3120         (struct Opd_ent): Use "Address" rather than "Offset".
3121         (Output_data_got_powerpc::got_base_offset): Return Valtype.
3122         (Target_powerpc::got_section): Make public.
3123         (Target_powerpc::scan_relocs): Move code setting symbols..
3124         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
3125         Create _SDA_BASE_ only when referenced.
3126
3127 2012-11-02  Roland McGrath  <mcgrathr@google.com>
3128
3129         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
3130         from last change.
3131
3132 2012-11-01  Roland McGrath  <mcgrathr@google.com>
3133
3134         * target.h (Sized_target::relocate_relocs): Use Elf_Off
3135         for offset_in_output_section parameter.
3136         (Sized_target::relocate_special_relocatable): Likewise.
3137         * arm.cc (Target_arm::relocate_relocs): Likewise.
3138         (Target_arm::relocate_special_relocatable): Likewise.
3139         * i386.cc (Target_i386::relocate_relocs): Likewise.
3140         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
3141         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
3142         * target-reloc.h (relocate_relocs): Likewise.
3143         * testsuite/testfile.cc (Target_test): Likewise.
3144         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
3145         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
3146
3147         * system.h: Move inclusion of <clocale> to after <libintl.h> in
3148         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
3149
3150         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
3151         parameter, which is unused in the [!F_SETFD] case.
3152
3153         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
3154         SYMNDX to off_t before comparing it to this->data_size().
3155         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
3156         * incremental.cc (Output_section_incremental_inputs::do_write):
3157         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
3158
3159         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
3160
3161 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
3162
3163         * gold.cc (Target_arm::do_adjust_elf_header): Add the
3164         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
3165         in EABI_VER5.
3166
3167 2012-10-29  Cary Coutant  <ccoutant@google.com>
3168
3169         * dwp.cc (usage): Add file and exit status parameters;
3170         add --help and --version options.
3171         (print_version): New function.
3172         (main): Add --help and --version options.
3173
3174 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3175
3176         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
3177         final_layout_sequence.txt.
3178         * testsuite/Makefile.in: Regenerated.
3179
3180 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3181
3182         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
3183         COMPILE generated by automake.
3184         (LINK1): Likewise.
3185         (CXXCOMPILE1): Likewise.
3186         (CXXLINK1): Likewise.
3187         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
3188         (LINK): Likewise.
3189         (CXXCOMPILE): Likewise.
3190         (CXXLINK): Likewise.
3191         * testsuite/Makefile.in: Regenerated.
3192
3193 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3194
3195         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
3196         on bad fwrite return.
3197
3198 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3199
3200         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
3201         on val.
3202
3203 2012-10-23  Cary Coutant  <ccoutant@google.com>
3204
3205         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
3206         * testsuite/Makefile.in: Regenerate.
3207         * testsuite/dwp_test.h: New source file.
3208         * testsuite/dwp_test_1.cc: New source file.
3209         * testsuite/dwp_test_1.s: New source file.
3210         * testsuite/dwp_test_1.sh: New source file.
3211         * testsuite/dwp_test_1b.cc: New source file.
3212         * testsuite/dwp_test_1b.s: New source file.
3213         * testsuite/dwp_test_2.cc: New source file.
3214         * testsuite/dwp_test_2.s: New source file.
3215         * testsuite/dwp_test_2.sh: New source file.
3216         * testsuite/dwp_test_main.cc: New source file.
3217         * testsuite/dwp_test_main.s: New source file.
3218
3219 2012-10-23  Cary Coutant  <ccoutant@google.com>
3220
3221         * dwp.h: New header file.
3222         * dwp.cc: New source file.
3223         * gold.h: Move shared declarations to system.h.
3224         * system.h: New header file.
3225         * Makefile.am: Add dwp.
3226         * Makefile.in: Regenerate.
3227
3228 2012-10-23  Cary Coutant  <ccoutant@google.com>
3229
3230         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
3231         Dwarf_info_reader::read_from_pointer.
3232         (Dwarf_pubnames_table::read_header): Likewise.
3233         (Dwarf_pubnames_table::next_name): Likewise.
3234         (Dwarf_die::read_attributes): Likewise.
3235         (Dwarf_die::skip_attributes): Likewise.
3236         (Dwarf_info_reader::read_from_pointer): New function template.
3237         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
3238         (Dwarf_pubnames_table): Likewise.
3239         (Dwarf_info_reader::read_from_pointer): New function template.
3240         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
3241         Dwarf_pubnames_table ctor.
3242
3243 2012-10-23  Cary Coutant  <ccoutant@google.com>
3244
3245         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
3246         abbrev_shndx.
3247         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
3248         abbrev_shndx_.
3249         (Dwarf_info_reader::set_abbrev_shndx): New method.
3250         (Dwarf_info_reader::abbrev_shndx_): New data member.
3251
3252 2012-10-23  Cary Coutant  <ccoutant@google.com>
3253
3254         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
3255         from object, not parameters.
3256         (Dwarf_info_reader::parse): Likewise.
3257         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
3258         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
3259         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
3260         methods.
3261
3262 2012-10-23  Cary Coutant  <ccoutant@google.com>
3263
3264         * fileread.cc (Input_file::Input_file): New constructor.
3265         * fileread.h (class Input_file): Add new constructor.
3266
3267 2012-10-18  Alan Modra  <amodra@gmail.com>
3268
3269         PR gold/14727
3270         * object.cc (Relobj::is_section_name_included): Also match
3271         .sdata personality section.
3272
3273 2012-10-18  Alan Modra  <amodra@gmail.com>
3274
3275         * target-reloc.h (class Default_comdat_behavior): New, package up..
3276         (get_comdat_behaviour): ..this.
3277         (relocate_section): Add Relocate_comdat_behavior template arg,
3278         adjust code to suit.
3279         * arm.cc (Target_arm::relocate_section): Adjust to suit.
3280         (Target_arm::scan_reloc_section): Likewise.
3281         * i386.cc (Target_i386::relocate_section): Likewise.
3282         * sparc.cc (Target_sparc::relocate_section): Likewise.
3283         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
3284         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
3285         * powerpc.cc (class Relocate_comdat_behavior): New.
3286         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
3287         gold::relocate_section with new template arg.
3288
3289 2012-10-18  Alan Modra  <amodra@gmail.com>
3290
3291         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
3292         dynamic relocs for GOT_TPREL got entries, without symbol if
3293         resolving locally.
3294         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
3295         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
3296         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
3297
3298 2012-10-17  Alan Modra  <amodra@gmail.com>
3299
3300         PR gold/14726
3301         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
3302
3303 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
3304
3305         * layout.cc (Layout::include_section): Keep sections marked
3306         SHF_EXCLUDE when doing relocatable links.
3307
3308 2012-10-16  Alan Modra  <amodra@gmail.com>
3309
3310         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
3311         (Target_powerpc::do_finalize_sections): Call it.
3312         (Output_data_save_res): New class and supporting functions.
3313         (Target_powerpc::symval_for_branch): Only look up .opd entry for
3314         normal symbols defined in object files.
3315
3316 2012-10-12  Alan Modra  <amodra@gmail.com>
3317
3318         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
3319         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
3320         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
3321         section if scan_opd_relocs not yet called.
3322         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
3323
3324 2012-10-12  Alan Modra  <amodra@gmail.com>
3325
3326         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3327         add_local_ifunc_entry): Revert last change.
3328         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
3329
3330 2012-10-05  Alan Modra  <amodra@gmail.com>
3331
3332         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
3333         do_plt_address_for_global): New functions.
3334         (Output_data_got_powerpc::do_write): Don't segfault when linking
3335         statically.
3336         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3337         add_local_ifunc_entry): Return true on adding entry..
3338         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
3339         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
3340         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
3341         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
3342         set up symbols here.
3343         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
3344         syms here.  Do so even when no .iplt.  Don't segfault when linking
3345         statically.
3346         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
3347         new variants without reloc param.
3348         (Glink_sym_ent::Glink_sym_ent): Likewise.
3349         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
3350         reloc when refs will resolve to plt call stub.
3351         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
3352         R_PPC_PLTREL24 to resolve locally.
3353         (Target_powerpc::Scan::global): Correct ifunc handling.
3354         (Target_powerpc::Relocate::relocate): Correct local sym glink
3355         lookup.  Don't destroy "value" when we have a plt call stub,
3356         and when checking plt call validity.
3357         (Target_powerpc::do_dynsym_value): Simplify.
3358
3359 2012-10-05  Alan Modra  <amodra@gmail.com>
3360
3361         * i386.cc (Output_data_plt_i386::address_for_global,
3362         address_for_local): Add plt offset to returned value.  Adjust uses.
3363         * sparc.cc (Output_data_plt_sparc::address_for_global,
3364         address_for_local): Likewise.
3365         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
3366         address_for_local): Likewise.
3367         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
3368         address_for_local): Likewise.
3369         * target.h (Target::plt_address_for_global, plt_address_for_local):
3370         Update comment.
3371         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
3372         (Output_data_got::Got_entry::write): Nor here.
3373         * output.h: Comment fix.
3374
3375 2012-10-02  Jiong Wang  <jiwang@tilera.com>
3376
3377         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
3378         global_offset_table_ value for larget got.
3379         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
3380
3381 2012-09-29  Alan Modra  <amodra@gmail.com>
3382
3383         * powerpc.cc (Target_powerpc::iplt_): New output section.
3384         (Target_powerpc::iplt_section, make_iplt_section,
3385         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
3386         (Target_powerpc::make_plt_entry): Handle ifunc syms.
3387         Target_powerpc::plt_entry_count): Count iplt entries too.
3388         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
3389         reloc section in constructor.  New params.
3390         (Target_powerpc::make_plt_section): Create reloc section here instead.
3391         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
3392         functions.
3393         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
3394         (Output_data_glink::add_entry, find_entry): New functions to
3395         deal with local syms.
3396         (Glink_sym_ent): Add support for local syms.
3397         (Output_data_glink::do_write): Handle ifunc plt entries.
3398         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3399         (Target_powerpc::Scan::local, global): Handle ifunc syms.
3400         (Target_powerpc::Relocate::relocate): Likewise.
3401         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
3402
3403 2012-09-25  Alan Modra  <amodra@gmail.com>
3404
3405         * object.h (Sized_relobj_file::adjust_local_symbol,
3406         do_adjust_local_symbol): New functions.
3407         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
3408         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
3409         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
3410         and irregular opd entry spacing.
3411         (Powerpc_relobj::do_read_relocs): Add opd size checks.
3412         (Global_symbol_visitor_opd): New functor.
3413         (Target_powerpc::do_finalize_sections): Omit global symbols defined
3414         on deleted opd entries.
3415
3416 2012-09-15  Jiong Wang  <jiwang@tilera.com>
3417
3418         * tilegx.cc: New file.
3419         * Makefile.am (TARGETSOURCES): Add tilegx.cc
3420         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
3421         * configure.tgt: Add entries for tilegx*.
3422         * configure.ac: Likewise.
3423         * Makefile.in: Rebuild.
3424         * configure: Likewise.
3425         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
3426         tilegx.
3427
3428 2012-09-13  Alan Modra  <amodra@gmail.com>
3429
3430         * target-reloc.h (scan_relocs): Call scan.local for relocs
3431         against symbols in discarded sections.  Pass is_discarded
3432         param.
3433         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
3434         Add is_discarded param.
3435         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
3436         is_discarded to flag opd entry as discarded.  Don't emit dyn
3437         relocs on such entries.
3438         (Target_powerpc::Scan::global): Similarly detect and handle
3439         such opd entries.
3440         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
3441         opd_ent_.  Update all uses.
3442         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
3443         (Target_powerpc::relocate_section): Zero out discarded opd
3444         entry relocs.
3445
3446 2012-09-12  Ian Lance Taylor  <iant@google.com>
3447
3448         PR gold/14570
3449         * output.cc: Rename Output_data_got template parameter from size
3450         to got_size for all functions.  Compile all variants of
3451         Output_data_got.
3452         (Output_data_got::Got_entry::write): Correct use of size for
3453         symbol value.  Use local_is_tls rather than casting to
3454         Sized_relobj_file.
3455         * object.h (class Object): Add local_is_tls and do_local_is_tls.
3456         (class Sized_relobj_file): Add do_local_is_tls.
3457         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
3458
3459 2012-09-11  Alan Modra  <amodra@gmail.com>
3460
3461         PR gold/14566
3462         * layout.cc (Layout::set_segment_offsets): When using
3463         common-page-size alignment, ensure we are on a new max-page-size
3464         page.
3465         * output.cc (Output_segment::set_section_addresses): Use
3466         abi_pagesize, not common_pagesize for relro boundary.
3467         (Output_segment::set_offset): Likewise.
3468
3469 2012-09-11  Alan Modra  <amodra@gmail.com>
3470
3471         * output.h (Output_data_got::add_global_tls, add_local_tls,
3472         add_local_tls_pair): New functions.
3473         (Output_data_got::add_local_pair_with_rel): Remove second
3474         reloc param.  Expand comment.
3475         (Output_data_got::Got_entry): Rename use_plt_offset_ to
3476         use_plt_or_tls_offset_, similarly for constructor param.
3477         (Output_data_got::Got_entry::write): Add got_index param.
3478         * output.cc (Output_data_got::add_global_tls, add_local_tls,
3479         add_local_tls_pair): New functions.
3480         (Output_data_got::Got_entry::write): Handle tls symbols
3481         with use_plt_or_tls_offset_ set specially.
3482         (Output_data_got::add_local_pair_with_rel): Only one reloc.
3483         (Output_data_got::do_write): Replace iterator with index, pass
3484         index to entry write function.
3485         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
3486         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
3487         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
3488         call.
3489         * i386.cc (Target_i386::Scan::local): Likewise.
3490         * sparc.cc (Target_sparc::Scan::local): Likewise.
3491         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
3492         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
3493         do_tls_offset_for_global): New functions.
3494         (Target_powerpc::Scan::local): Correct TLS relocations and got
3495         entry values.
3496         (Target_powerpc::Scan::global): Don't emit unnecessary
3497         dynamic relocations on TLS GOT entries.
3498
3499 2012-09-10  Matthias Klose  <doko@ubuntu.com>
3500
3501         * config.in: Disable sanity check for kfreebsd.
3502
3503 2012-09-10  Sterling Augustine  <saugustine@google.com>
3504
3505         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
3506         (Gdb_index::pubtypes_read): New parameter.
3507         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
3508         to calls.
3509         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
3510         pubtypes_object_.
3511
3512 2012-09-09  Alan Modra  <amodra@gmail.com>
3513
3514         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
3515         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
3516         * gc.h (gc_process_relocs): Call target gc_add_reference.
3517         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
3518         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
3519         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
3520         unnecessary cast.
3521         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
3522         to cater for when we don't need code offset.  Update use.
3523         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
3524         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
3525         set_opd_valid): New functions.
3526         (Target_powerpc::do_gc_add_reference): New function.
3527         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
3528         stashed refs.
3529         (Target_powerpc::do_gc_mark_symbol): New function.
3530
3531 2012-09-06  Cary Coutant  <ccoutant@google.com>
3532
3533         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
3534         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
3535         (Dwarf_die::skip_attributes): Likewise.
3536         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
3537         * testsuite/gdb_index_test.cc (inline_func_1): New function.
3538         (main): Call it.
3539         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
3540
3541 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
3542
3543         * testsuite/script_test_3.t: Add .got.plt output section
3544         statement.
3545         * testsuite/script_test_4.t: Likewise.
3546
3547 2012-09-05  Alan Modra  <amodra@gmail.com>
3548
3549         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
3550         update all uses and lose "enum" when using type.
3551
3552 2012-09-05  Alan Modra  <amodra@gmail.com>
3553
3554         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
3555         * configure: Regenerate.
3556         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
3557         (plugin_final_layout.stdout): Likewise.
3558         (memory_test): Set page sizes to 0x1000.
3559         * testsuite/Makefile.in: Regenerate.
3560         * testsuite/discard_locals_test.sh: Add FIXME comment.
3561         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
3562         * testsuite/pr14265.t: Add .got output section statement.
3563         * testsuite/script_test_2.t: Likewise.
3564         * testsuite/script_test_3.t: Likewise.
3565         * testsuite/script_test_4.t: Likewise.
3566         * testsuite/script_test_5.t: Likewise.
3567         * testsuite/script_test_6.t: Likewise.
3568         * testsuite/script_test_7.t: Likewise.
3569         * testsuite/script_test_9.t: Likewise.
3570
3571 2012-09-05  Alan Modra  <amodra@gmail.com>
3572
3573         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
3574         (Powerpc_relocate_functions::Status): New typedef.
3575         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3576         (Target_powerpc::Scan::local): Handle REL64.
3577         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
3578         for REL32 and REL64.
3579         (Target_powerpc::symval_for_branch): New function, extracted from..
3580         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
3581         checks.  Report overflow errors.
3582
3583 2012-09-05  Alan Modra  <amodra@gmail.com>
3584
3585         * object.h (Sized_relobj_file::emit_relocs): Delete.
3586         (Sized_relobj_file::emit_relocs_reltype): Delete.
3587         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
3588         relocate_relocs for --emit-relocs.
3589         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
3590         * output.h: Update comment.
3591         (Output_segment::first_section): New function.
3592         (Output_segment::first_section_load_address): Use first_section.
3593         * output.cc (Output_segment::first_section): New function extracted..
3594         (Output_segment::first_section_load_address): ..from here.  Delete.
3595         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
3596         * target.h (Sized_target::relocate_for_relocatable): Likewise.
3597         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
3598         adjust call to target.h function.
3599         * i386.cc (Target_i386): Likewise.
3600         * sparc.cc (Target_sparc): Likewise.
3601         * x86_64.cc (Target_x86_64): Likewise.
3602         * powerpc.cc (Target_powerpc): Likewise.
3603         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
3604         first tls section has section symbol for optimised local dynamic
3605         output relocs.
3606         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
3607         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
3608         optimised tls code.
3609         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
3610         Rename to relocate_relocs.  Update error message.
3611
3612 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
3613
3614         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
3615         --just-symbols.
3616
3617 2012-08-31  Alan Modra  <amodra@gmail.com>
3618
3619         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
3620         (Powerpc_relobj::toc_base_offset): New stub function.
3621         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
3622         got_mod_index_offset to tlsld_got_offset.  Update all refs.
3623         (Target_powerpc::Relocate::enum skip_tls): New.
3624         (Target_powerpc::call_tls_get_addr_): New var.
3625         (Target_powerpc::is_branch_reloc): Move to file scope.
3626         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
3627         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
3628         New functions.
3629         (Target_powerpc::enum Got_type): Delete old values, add new ones.
3630         (powerpc_info): Correct common_pagesize for ppc64.
3631         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
3632         (Powerpc_relocate_functions): Add overflow check enums and functions.
3633         Add non-shift version of rela, rela_ua.  Delete all rel public
3634         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
3635         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
3636         addr16_ha3, addr14 functions.
3637         (Output_data_got_powerpc::add_constant_pair): New function.
3638         (Output_data_got_powerpc::got_base_offset): Likewise.
3639         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
3640         (instruction constants): Sort, add some more.
3641         (Output_data_glink::do_write): Add and use Address typedef.  Use
3642         object->toc_base_offset() stub for 64-bit.
3643         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
3644         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3645         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
3646         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
3647         Always treat .opd relocs as against locally defined symbol.
3648         Correct condition for RELATIVE relocs.
3649         (Target_powerpc::do_finalize_sections): Test for NULL sections.
3650         (Target_powerpc::Relocate::relocate): Use plt call stub as value
3651         for 32-bit syms with a plt entry.  Correct ppc64 toc base
3652         calculations.  Handle TLS relocs, and more.  Add overflow
3653         checking and adjust for Powerpc_relocate_functions changes.
3654         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
3655         Reinstate --emit-relocs code with FIXME.
3656
3657 2012-08-30  Alan Modra  <amodra@gmail.com>
3658
3659         * layout.cc (Layout::set_segment_offsets): Set p_align to
3660         abi_pagesize, not common_pagesize.
3661         (Layout::relaxation_loop_body): Similarly use abi_pagesize
3662         to determine whether file header can go in segment.
3663
3664 2012-08-30  Alan Modra  <amodra@gmail.com>
3665
3666         * output.h (Output_reloc::Output_reloc <output section>): Add
3667         is_relative param.  Adjust calls.
3668         (Output_reloc::add_output_section_relative): New functions.
3669         * output.cc (Output_reloc::Output_reloc <output section>): Handle
3670         is_relative.
3671         (Output_reloc::symbol_value): Handle SECTION_CODE.
3672
3673 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
3674
3675         * gold.cc (queue_middle_tasks): Call layout again when unique
3676         segments for sections is desired.
3677         * layout.cc (Layout::Layout): Initialize new members.
3678         (Layout::get_output_section_flags): New function.
3679         (Layout::choose_output_section): Call get_output_section_flags.
3680         (Layout::layout): Make output section for mapping to a unique segment.
3681         (Layout::insert_section_segment_map): New function.
3682         (Layout::attach_allocated_section_to_segment): Make unique segment for
3683         output sections marked so.
3684         (Layout::segment_precedes): Check for unique segments when sorting.
3685         * layout.h (Layout::Unique_segment_info): New struct.
3686         (Layout::Section_segment_map): New typedef.
3687         (Layout::insert_section_segment_map): New function.
3688         (Layout::get_output_section_flags): New function.
3689         (Layout::is_unique_segment_for_sections_specified): New function.
3690         (Layout::set_unique_segment_for_sections_specified): New function.
3691         (Layout::unique_segment_for_sections_specified_): New member.
3692         (Layout::section_segment_map_): New member.
3693         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
3694         Rename is_gc_pass_one to is_pass_one.
3695         Rename is_gc_pass_two to is_pass_two.
3696         Rename is_gc_or_icf to is_two_pass.
3697         Check for which pass based on whether symbols data is present.
3698         Make it two pass when unique segments for sections is desired.
3699         * output.cc (Output_section::Output_section): Initialize new
3700         members.
3701         * output.h (Output_section::is_unique_segment): New function.
3702         (Output_section::set_is_unique_segment): New function.
3703         (Output_section::is_unique_segment_): New member.
3704         (Output_section::extra_segment_flags): New function.
3705         (Output_section::set_extra_segment_flags): New function.
3706         (Output_section::extra_segment_flags_): New member.
3707         (Output_section::segment_alignment): New function.
3708         (Output_section::set_segment_alignment): New function.
3709         (Output_section::segment_alignment_): New member.
3710         (Output_segment::Output_segment): Initialize is_unique_segment_.
3711         (Output_segment::is_unique_segment): New function.
3712         (Output_segment::set_is_unique_segment): New function.
3713         (Output_segment::is_unique_segment_): New member.
3714         * plugin.cc (allow_unique_segment_for_sections): New function.
3715         (unique_segment_for_sections): New function.
3716         (Plugin::load): Add new functions to transfer vector.
3717         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
3718         * Makefile.in: Regenerate.
3719         * testsuite/plugin_final_layout.sh: Check if unique segment
3720         functionality works.
3721         * testsuite/plugin_section_order.c (onload): Check if new interfaces
3722         are available.
3723         (allow_unique_segment_for_sections): New global.
3724         (unique_segment_for_sections): New global.
3725         (claim_file_hook): Call allow_unique_segment_for_sections.
3726         (all_symbols_read_hook): Call unique_segment_for_sections.
3727
3728 2012-08-22  Cary Coutant  <ccoutant@google.com>
3729
3730         * layout.cc (Layout::include_section): Don't assert on GROUP
3731         sections with --emit-relocs.
3732
3733 2012-08-21  Cary Coutant  <ccoutant@google.com>
3734
3735         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
3736         if --export-dynamic-symbol names an undef symbol.
3737
3738 2012-08-18  Alan Modra  <amodra@gmail.com>
3739
3740         * powerpc.cc: Formatting and white space.
3741         (Powerpc_relobj): Rename got2_section_ to special_.
3742         Add opd_ent_shndx_ and opd_ent_off_ vectors.
3743         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
3744         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
3745         (Target_powerpc): Add Address typedef and invalid_address.  Use
3746         throughout.
3747         (Target_powerpc::is_branch_reloc): New function.
3748         (Powerpc_relocate_functions): Add Address typedef, use throughout.
3749         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
3750         for dst_mask, value and addend.
3751         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
3752         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
3753         (Output_data_glink::do_write): Correct toc base.  Don't try to use
3754         uint16_t for 24-bit offset.  Use get_output_section_offset and
3755         check return.
3756         (Target_powerpc::Scan::local): Handle more relocs.
3757         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
3758         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
3759         Plug in toc restoring insn after plt calls.  Translate branches
3760         to function descriptor symbols to corresponding entry point.
3761         (Target_powerpc::relocate_for_relocatable): Check return from
3762         get_output_section_offset.
3763         * symtab.h: Comment typo.
3764
3765 2012-08-14  Ian Lance Taylor  <iant@google.com>
3766
3767         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
3768         unsupported_relocal_local to call unsupported_reloc_global.
3769
3770 2012-08-14  Nick Clifton  <nickc@redhat.com>
3771
3772         PR ld/14265
3773         * script-sections.cc (Sections_element::output_section_name): Add
3774         keep return parameter.
3775         (Output_section_element::match_name): Add keep return parameter.
3776         Return the value of the keep_ member.
3777         * script-sections.h (class Output_section): Update
3778         output_section_name prototype.
3779         * layout.cc (Layout::keep_input_section): New public member
3780         function.
3781         (Layout::choose_output_section): Pass keep parameter to
3782         output_section_name.
3783         * layout.h (class Layout): Add keep_input_section.
3784         * object.cc (Sized_relobj_file::do_layout): Check for kept input
3785         sections.
3786         * testsuite/Makefile.am: Add a test.
3787         * testsuite/Makefile.in: Regenerate.
3788         * testsuite/pr14265.c: Source file for the test.
3789         * testsuite/pr14265.t: Linker script for the test.
3790         * testsuite/pr14265.sh: Shell script for the test.
3791
3792 2012-08-14  Alan Modra  <amodra@gmail.com>
3793
3794         * target.h (Target::output_section_name): New function.
3795         (Target::do_output_section_name): New function.
3796         * layout.cc (Layout::choose_output_section): Call the above.
3797         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
3798
3799 2012-08-14  Alan Modra  <amodra@gmail.com>
3800
3801         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
3802         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
3803         for replace_constant call.
3804         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
3805         (Output_data_glink::do_print_to_mapfile): New function.
3806         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
3807         (Target_powerpc::Relocate::relocate): Likewise.
3808
3809 2012-08-14  Alan Modra  <amodra@gmail.com>
3810
3811         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
3812         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
3813         (Output_data_glink::add_entry,find_entry): Remove shndx param.
3814         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
3815         all references to shndx_.  Handle special case for R_PPC_PLTREL24
3816         here.
3817         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
3818         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
3819         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
3820         here.
3821         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
3822         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
3823
3824 2012-08-12  Alan Modra  <amodra@gmail.com>
3825
3826         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
3827         (glink insn constants): Use uint32_t.
3828         (Output_data_glink::add_entry): Use insert, not [] operator.
3829
3830 2012-08-11  Alan Modra  <amodra@gmail.com>
3831
3832         * object.h (Sized_relobj_file::find_shdr): New function.
3833         (Sized_relobj_file::find_special_sections): New function.
3834         * object.cc (Sized_relobj_file::find_shdr): New function.
3835         (Sized_relobj_file::find_eh_frame): Use find_shdr.
3836         (Sized_relobj_file::find_special_sections): New function, split out..
3837         (Sized_relobj_file::do_read_symbols): ..from here.
3838         * output.h (Output_data_got::replace_constant): New function.
3839         (Output_data_got::num_entries): New function.
3840         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
3841         (Output_data_got::got_offset): Protected rather than private.
3842         (Output_data_got::replace_got_entry): New function.
3843         * output.cc (Output_data_got::replace_got_entry): New function.
3844         * powerpc.cc (class Powerpc_relobj): New.
3845         (class Powerpc_relocate_functions): Delete all psymval variants or
3846         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
3847         Implement _ha functions using corresponding _hi function.
3848         (Powerpc_relobj::find_special_sections): New function.
3849         (Target_powerpc::do_make_elf_object): New function.
3850         (class Output_data_got_powerpc): New.
3851         (class Output_data_glink): New.
3852         (class Powerpc_scan_relocatable_reloc): New.
3853         Many more changes througout file.
3854
3855 2012-08-09  Nick Clifton  <nickc@redhat.com>
3856
3857         * po/vi.po: Updated Vietnamese translation.
3858
3859 2012-08-07  Ian Lance Taylor  <iant@google.com>
3860
3861         * layout.cc (Layout::add_target_dynamic_tags): If
3862         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
3863         plt_rel.
3864
3865 2012-07-30  Nick Clifton  <nickc@redhat.com>
3866
3867         * po/gold.pot: Updated template.
3868         * po/es.po: Updated Spanish translation.
3869
3870 2012-07-18  Cary Coutant  <ccoutant@google.com>
3871
3872         PR gold/14344
3873         * configure.ac: Add check for -gpubnames support.
3874         * configure: Regenerate.
3875         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
3876         support; force -gno-pubnames.
3877         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
3878         support.
3879         (gdb_index_test_4): New test.
3880         * testsuite/Makefile.in: Regenerate.
3881         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
3882         * testsuite/gdb_index_test_2.sh: Likewise.
3883         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
3884         * testsuite/gdb_index_test_4.sh: New script.
3885         * testsuite/gdb_index_test_comm.sh: New script with common code;
3886         don't look for space after colon.
3887
3888 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
3889
3890         * gold.cc (queue_middle_tasks): Update function order only after
3891         deferred objects due to plugins are processed.
3892
3893 2012-07-11  Ian Lance Taylor  <iant@google.com>
3894
3895         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
3896         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
3897         (Target_arm::scan_reloc_for_stub): Likewise.
3898         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
3899         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
3900         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
3901         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
3902         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
3903
3904 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
3905             Ian Lance Taylor  <iant@google.com>
3906
3907         PR gold/14309
3908         * configure.ac: Test whether std::tr1::hash<off_t> works.
3909         * gold.h: Add a specialization for std::tr1::hash<off_t> if
3910         needed.
3911         * output.h (class Output_fill): Add virtual destructor.
3912         * configure, config.in: Rebuild.
3913
3914 2012-06-22  Roland McGrath  <mcgrathr@google.com>
3915
3916         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
3917
3918 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
3919
3920         * plugin.cc (Plugin::load): Handle position independent executables.
3921
3922 2012-06-06  Cary Coutant  <ccoutant@google.com>
3923
3924         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
3925         add .debug_macro.
3926         (lines_only_debug_sections): Likewise.
3927         (gdb_fast_lookup_sections): New static array.
3928         (is_gdb_debug_section): Rename formal parameter.
3929         (is_lines_only_debug_section): Likewise.
3930         (is_gdb_fast_lookup_section): New function.
3931         (Layout::include_section): Check for ".zdebug_" prefix; pass
3932         section name suffix to is_gdb_debug_section, et al.; check for
3933         fast-lookup sections when building .gdb_index.
3934         * options.h (--strip-debug-gdb): Update GDB version number.
3935
3936 2012-06-06  Cary Coutant  <ccoutant@google.com>
3937
3938         * configure.ac: Add check for fallocate.
3939         * configure: Regenerate.
3940         * config.in: Regenerate.
3941
3942         * options.h (class General_options): Add --mmap-output-file and
3943         --posix-fallocate options.
3944         * output.cc: (posix_fallocate): Remove; replace with...
3945         (gold_fallocate): New function.
3946         (Output_file::map_no_anonymous): Call gold_fallocate.
3947         (Output_file::map): Check --mmap-output-file option.
3948
3949 2012-06-05  Jing Yu  <jingyu@google.com>
3950
3951         * gold.h (textdomain): Add do {} to empty while(0).
3952         (bindtextdomain): Likewise.
3953
3954 2012-06-04  Cary Coutant  <ccoutant@google.com>
3955
3956         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
3957         has_dynsym_index.
3958
3959 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
3960
3961         * symtab.cc (Symbol_table::define_special_symbol):
3962         Initialize *poldsym to prevent uninitialized variable errors.
3963
3964 2012-05-23  Cary Coutant  <ccoutant@google.com>
3965
3966         * layout.cc (Layout::section_name_mapping): Add rules to handle
3967         exact match on .data.rel.ro.local or .data.rel.ro.
3968         (Layout::output_section_name): Check for exact matches.
3969
3970 2012-05-23  Cary Coutant  <ccoutant@google.com>
3971
3972         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
3973         more carefully.
3974
3975 2012-05-22  Cary Coutant  <ccoutant@google.com>
3976
3977         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
3978         object before exporting symbol.
3979
3980 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
3981
3982         * testsuite/tls_test.cc: Include "config.h" first.
3983         * testsuite/tls_test_c.c: Likewise.
3984
3985 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
3986             Nick Clifton  <nickc@redhat.com>
3987
3988         PR 14072
3989         * configure.in: Add check that sysdep.h has been included before
3990         any system header files.
3991         * configure: Regenerate.
3992         * config.in: Regenerate.
3993
3994 2012-05-14  Cary Coutant  <ccoutant@google.com>
3995
3996         * layout.cc (Layout::make_output_section): Mark .tdata section
3997         as RELRO.
3998         * testsuite/relro_test.cc: Add a TLS variable.
3999
4000 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
4001
4002         PR gold/14091
4003         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
4004         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
4005         R_X86_64_64.
4006
4007 2012-05-08  Cary Coutant  <ccoutant@google.com>
4008
4009         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
4010         (lines_only_debug_sections): Likewise.
4011
4012 2012-05-02  Roland McGrath  <mcgrathr@google.com>
4013
4014         * nacl.cc: New file.
4015         * nacl.h: New file.
4016         * Makefile.am (CCFILES, HFILES): Add them.
4017         * Makefile.in: Regenerate.
4018         * i386.cc (Output_data_plt_i386_nacl): New class.
4019         (Output_data_plt_i386_nacl_exec): New class.
4020         (Output_data_plt_i386_nacl_dyn): New class.
4021         (Target_i386_nacl): New class.
4022         (Target_selector_i386_nacl): New class.
4023         (target_selector_i386): Use it instead of Target_selector_i386.
4024         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
4025         (Target_x86_64_nacl): New class.
4026         (Target_selector_x86_64_nacl): New class.
4027         (target_selector_x86_64, target_selector_x32): Use it instead of
4028         Target_selector_x86_64.
4029         * arm.cc (Output_data_plt_arm_nacl): New class.
4030         (Target_arm_nacl): New class.
4031         (Target_selector_arm_nacl): New class.
4032         (target_selector_arm, target_selector_armbe): Use it instead of
4033         Target_selector_arm.
4034
4035         * target-select.cc (select_target): Take new Input_file* and off_t
4036         arguments, pass them on to recognize method of selector.
4037         * object.cc (make_elf_sized_object): Update caller.
4038         * parameters.cc (parameters_force_valid_target): Likewise.
4039         * incremental.cc (make_sized_incremental_binary): Likewise.
4040         * target-select.h: Update decl.
4041         (Target_selector::recognize): Take new Input_file* argument,
4042         pass it on to do_recognize.
4043         (Target_selector::do_recognize): Take new Input_file* argument.
4044         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
4045         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
4046         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
4047         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
4048
4049         * target.h (Target::Target_info): New members isolate_execinstr
4050         and rosegment_gap.
4051         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
4052         * arm.cc (Target_arm::arm_info): Update initializer.
4053         * i386.cc (Target_i386::i386_info): Likewise.
4054         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
4055         * sparc.cc (Target_sparc::sparc_info): Likewise.
4056         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4057         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
4058         * layout.cc (Layout::attach_allocated_section_to_segment):
4059         Take new const Target* argument.  If target->isolate_execinstr(), act
4060         like --rosegment.
4061         (Layout::find_first_load_seg): Take new const Target* argument;
4062         if target->isolate_execinstr(), reject PF_X segments.
4063         (Layout::relaxation_loop_body): Update caller.
4064         (Layout::set_segment_offsets): If target->isolate_execinstr(),
4065         reset file offset to zero when we hit LOAD_SEG, and then do a second
4066         loop over the segments before LOAD_SEG to reassign offsets after
4067         addresses have been determined.  Handle target->rosegment_gap().
4068         (Layout::attach_section_to_segment): Take new const Target* argument;
4069         pass it to attach_allocated_section_to_segment.
4070         (Layout::make_output_section): Update caller.
4071         (Layout::attach_sections_to_segments): Take new const Target* argument;
4072         pass it to attach_section_to_segment.
4073         * gold.cc (queue_middle_tasks): Update caller.
4074         * layout.h (Layout): Update method decls with new arguments.
4075
4076         * arm.cc (Target_arm::Target_arm): Take optional argument for the
4077         Target_info pointer to use.
4078         (Target_arm::do_make_data_plt): New virtual method.
4079         (Target_arm::make_data_plt): New method that calls it.
4080         (Target_arm::make_plt_entry): Use it.
4081         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
4082         for the section alignment.
4083         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
4084         method.
4085         (Output_data_plt_arm::first_plt_entry_offset): Call it.
4086         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
4087         method.
4088         (Output_data_plt_arm::get_plt_entry_size): Call it.
4089         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
4090         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
4091         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
4092         method.
4093         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
4094         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
4095         method instead of sizeof(plt_entry).
4096         (Output_data_plt_arm::add_entry): Likewise.
4097         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
4098         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
4099         than static method.
4100         (Target_arm::plt_entry_size): Likewise.
4101         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
4102         Move to ...
4103         (Output_data_plt_arm_standard): ... here, new class.
4104         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
4105         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
4106         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
4107
4108         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4109         Take additional argument for the PLT entry size.
4110         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
4111         Use get_plt_entry_size method rather than plt_entry_size variable.
4112         (Output_data_plt_x86_64::reserve_slot): Likewise.
4113         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
4114         (Output_data_plt_x86_64::add_entry): Likewise.
4115         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
4116         (Output_data_plt_x86_64::address_for_global): Likewise.
4117         (Output_data_plt_x86_64::address_for_local): Likewise.
4118         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4119         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
4120         Make method non-static.
4121         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
4122         method.
4123         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
4124         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
4125         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
4126         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
4127         virtual method.
4128         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
4129         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
4130         virtual method.
4131         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
4132         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
4133         virtual method.
4134         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
4135         (Output_data_plt_x86_64::plt_entry_size)
4136         (Output_data_plt_x86_64::first_plt_entry)
4137         (Output_data_plt_x86_64::plt_entry)
4138         (Output_data_plt_x86_64::tlsdesc_plt_entry)
4139         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
4140         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
4141         (Output_data_plt_x86_64_standard): ... here, new class.
4142         (Target_x86_64::Target_x86_64): Take optional argument for the
4143         Target_info pointer to use.
4144         (Target_x86_64::do_make_data_plt): New virtual method.
4145         (Target_x86_64::make_data_plt): New method to call it.
4146         (Target_x86_64::init_got_plt_for_update): Use that.
4147         Call this->plt_->add_eh_frame method here.
4148         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
4149         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
4150         rather than static method.
4151         (Target_x86_64::plt_entry_size): Likewise.
4152         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
4153         rather than plt_entry_size variable.  Move guts of PLT filling to...
4154         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
4155         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
4156         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
4157
4158         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
4159         additional argument for the section alignment.
4160         Don't do add_eh_frame_for_plt here.
4161         (Output_data_plt_i386::first_plt_entry_offset): Make the method
4162         non-static.  Use get_plt_entry_size method rather than plt_entry_size
4163         variable.
4164         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
4165         method.
4166         (Output_data_plt_i386::get_plt_entry_size): Call it.
4167         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
4168         (Output_data_plt_i386::add_eh_frame): New method to call it.
4169         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
4170         method.
4171         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
4172         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
4173         method.
4174         (Output_data_plt_i386::fill_plt_entry): New method to call it.
4175         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
4176         method instead of plt_entry_size.
4177         (Output_data_plt_i386::plt_entry_size)
4178         (Output_data_plt_i386::plt_eh_frame_fde_size)
4179         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
4180         (Output_data_plt_i386_standard): ... here, new class.
4181         (Output_data_plt_i386_exec): New class.
4182         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
4183         (Output_data_plt_i386_exec::first_plt_entry): ... here.
4184         (Output_data_plt_i386::exec_plt_entry): Move to ...
4185         (Output_data_plt_i386_exec::plt_entry): ... here.
4186         (Output_data_plt_i386_dyn): New class.
4187         (Output_data_plt_i386::first_plt_entry): Move to ...
4188         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
4189         (Output_data_plt_i386::dyn_plt_entry): Move to ...
4190         (Output_data_plt_i386_dyn::plt_entry): ... here.
4191         (Target_i386::Target_i386): Take optional argument for the Target_info
4192         pointer to use.
4193         (Target_i386::do_make_data_plt): New virtual method.
4194         (Target_i386::make_data_plt): New method to call it.
4195         (Target_i386::make_plt_section): Use that.
4196         Call this->plt_->add_eh_frame method here.
4197         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
4198         rather than plt_entry_size variable.
4199         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
4200         (Output_data_plt_i386::address_for_local): Likewise.
4201         (Output_data_plt_i386::do_write): Likewise.
4202         Move guts of PLT filling to...
4203         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
4204         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
4205         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
4206         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
4207
4208 2012-05-01  Cary Coutant  <ccoutant@google.com>
4209
4210         * dwarf_reader.cc (Dwarf_die::read_attributes)
4211         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
4212         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
4213         * reduced_debug_output.cc
4214         (Output_reduced_debug_info_section::get_die_end): Remove
4215         DW_FORM_GNU_ref_index.  Add default case.
4216
4217 2012-04-26  Mark Wielaard  <mjw@redhat.com>
4218
4219         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
4220         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
4221         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
4222         DW_AT_high_pc as offset from DW_AT_low_pc.
4223
4224         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
4225         * testsuite/Makefile.in: Regenerate.
4226         * testsuite/gdb_index_test_3.c: New test source file.
4227         * testsuite/gdb_index_test_3.sh: New test source file.
4228
4229 2012-04-25  Ian Lance Taylor  <iant@google.com>
4230
4231         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
4232         pointer.
4233         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
4234         as a class, not a struct.
4235         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
4236         (Target_arm::apply_cortex_a8_workaround): Likewise.
4237         * gc.h: Declare Reloc_types as a struct, not a class.
4238         * object.h: Declare Symbols_data as a struct.
4239         * reloc.h: Declare Read_relocs_data as a struct.
4240         * target.h: Declare Relocate_info as a struct.
4241
4242 2012-04-24  David S. Miller  <davem@davemloft.net>
4243
4244         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
4245         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
4246         and R_SPARC_WPLT30.
4247
4248 2012-04-24  Cary Coutant  <ccoutant@google.com>
4249
4250         * incremental-dump.cc (find_input_containing_global): Replace
4251         magic number with symbolic constant.
4252         (dump_incremental_inputs): Update version number.
4253         * incremental.cc (Output_section_incremental_inputs): Update version
4254         number; import symbolic constants from Incremental_inputs_reader.
4255         (Incremental_inputs::create_data_sections): Align relocations
4256         section correctly for 64-bit targets.
4257         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
4258         constants; add padding.
4259         (Output_section_incremental_inputs::write_header): Add assert for
4260         header_size.
4261         (Output_section_incremental_inputs::write_input_files): Add assert
4262         for input_entry_size.
4263         (Output_section_incremental_inputs::write_info_blocks): Add padding;
4264         add assert for object_info_size, input_section_entry_size,
4265         global_sym_entry_size.
4266         * incremental.h (Incremental_inputs_reader): Add symbolic constants
4267         for data structure sizes; use them.
4268         (Incremental_input_entry_reader): Import symbolic constants from
4269         Incremental_inputs_reader; use them.
4270
4271 2012-04-23  David S. Miller  <davem@davemloft.net>
4272
4273         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
4274         and elf_flags_set_.
4275         (Target_sparc::Target_sparc): Initialize new fields.
4276         (Target_sparc::do_make_elf_object): New function.
4277         (Target_sparc::do_adjust_elf_header): New function.
4278
4279 2012-04-23  Cary Coutant  <ccoutant@google.com>
4280
4281         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
4282         CU range table of gdb index.
4283
4284 2012-04-20  David S. Miller  <davem@davemloft.net>
4285
4286         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
4287         instead of false.
4288
4289 2012-04-16  David S. Miller  <davem@davemloft.net>
4290
4291         * sparc.cc (Target_sparc::got_address): New function.
4292         (Sparc_relocate_functions::gdop_hix22): New function.
4293         (Sparc_relocate_functions::gdop_lox10): New function.
4294         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
4295         relocs.
4296         (Target_sparc::Scan::local): Likewise if the global symbol is not
4297         preemptible and is not IFUNC.
4298         (Target_sparc::Relocate::relocate): Perform GOTDATA code
4299         transformations for local and non-preemptible non-IFUNC global
4300         symbols.
4301
4302         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
4303         writing out 64-bit part of ranges.
4304
4305         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
4306         -fpic and -fpie respectively.
4307         * Makefile.in: Regenerate.
4308
4309         * sparc.cc (class Target_sparc): Add rela_ifunc_.
4310         (Target_sparc::Target_sparc): Initialize new field.
4311         (Target_sparc::do_plt_section_for_global): New function.
4312         (Target_sparc::do_plt_section_for_local): New function.
4313         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
4314         (Target_sparc::make_plt_section): New function, broken out of
4315         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
4316         (Target_sparc::make_plt_entry): Call make_plt_section.
4317         (Target_sparc::make_local_ifunc_plt_entry): New function.
4318         (Target_sparc::rela_ifunc_section): New function.
4319         (Target_sparc::plt_section): Remove const.
4320         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
4321         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
4322         and ifunc_count_ fields.
4323         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
4324         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
4325         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
4326         (Output_data_plt_sparc::rela_ifunc): New function.
4327         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
4328         (Output_data_plt_sparc::has_ifunc_section): New function.
4329         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
4330         (Output_data_plt_sparc::address_for_global): New function.
4331         (Output_data_plt_sparc::address_for_local): New function.
4332         (Output_data_plt_sparc::plt_index_to_offset): New function.
4333         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
4334         and entry_count.
4335         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
4336         entry_count.
4337         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
4338         R_SPARC_JMP_IREL to switch.
4339         (Target_sparc::Scan::check_non_pic): Likewise.
4340         (Target_sparc::Scan::local): Handle IFUNC symbols.
4341         (Target_sparc::Scan::local): Likewise.
4342         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
4343         and plt_address_for_local.
4344         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
4345         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
4346
4347         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
4348         (class Output_data_reloc): Adjust calls to Output_reloc_type.
4349         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
4350         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
4351         global relocs too.
4352         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
4353         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
4354         calls.
4355         * sparc.cc (Target_sparc::Scan::global): Likewise.
4356         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4357
4358 2012-04-16  Cary Coutant  <ccoutant@google.com>
4359
4360         * archive.cc (Library_base::should_include_member): Check for
4361         --export-dynamic-symbol.
4362         * options.h (class General_options): Add --export-dynamic-symbol.
4363         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
4364         --export-dynamic-symbol.
4365         (Symbol_table::gc_mark_undef_symbols): Likewise.
4366         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
4367
4368 2012-04-12  David S. Miller  <davem@davemloft.net>
4369
4370         * sparc.cc (Reloc::wdisp10): New relocation method.
4371         (Reloc::h34): Likewise.
4372         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
4373         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
4374         R_SPARC_WDISP10.
4375         (Target_sparc::Scan::local): Likewise.
4376         (Target_sparc::Scan::global): Likewise.
4377         (Target_sparc::Relocate::relocate): Likewise.
4378
4379 2012-04-09  Cary Coutant  <ccoutant@google.com>
4380
4381         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
4382         low_pc == 0.
4383
4384 2012-04-06  Ian Lance Taylor  <iant@google.com>
4385
4386         * timer.cc: #include <unistd.h>.
4387
4388 2012-04-06  Roland McGrath  <mcgrathr@google.com>
4389
4390         * configure.in (AC_CHECK_HEADERS): Add locale.h.
4391         * config.in: Regenerate.
4392         * configure: Regenerate.
4393
4394 2012-04-05  Nick Clifton  <nickc@redhat.com>
4395
4396         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
4397         (AM_LC_MESSAGES): Add.
4398         * aclocal.m4: Regenerate.
4399         * config.in: Regenerate.
4400         * configure: Regenerate.
4401
4402 2012-03-21  Cary Coutant  <ccoutant@google.com>
4403
4404         * Makefile.am: Add gdb-index.cc, gdb-index.h.
4405         * Makefile.in: Regenerate.
4406         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
4407         (Sized_elf_reloc_mapper::symbol_section): New function.
4408         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
4409         (make_elf_reloc_mapper): New function.
4410         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
4411         (Dwarf_abbrev_table::do_read_abbrevs): New function.
4412         (Dwarf_abbrev_table::do_get_abbrev): New function.
4413         (Dwarf_ranges_table::read_ranges_table): New function.
4414         (Dwarf_ranges_table::read_range_list): New function.
4415         (Dwarf_pubnames_table::read_section): New function.
4416         (Dwarf_pubnames_table::read_header): New function.
4417         (Dwarf_pubnames_table::next_name): New function.
4418         (Dwarf_die::Dwarf_die): New function.
4419         (Dwarf_die::read_attributes): New function.
4420         (Dwarf_die::skip_attributes): New function.
4421         (Dwarf_die::set_name): New function.
4422         (Dwarf_die::set_linkage_name): New function.
4423         (Dwarf_die::attribute): New function.
4424         (Dwarf_die::string_attribute): New function.
4425         (Dwarf_die::int_attribute): New function.
4426         (Dwarf_die::uint_attribute): New function.
4427         (Dwarf_die::ref_attribute): New function.
4428         (Dwarf_die::child_offset): New function.
4429         (Dwarf_die::sibling_offset): New function.
4430         (Dwarf_info_reader::check_buffer): New function.
4431         (Dwarf_info_reader::parse): New function.
4432         (Dwarf_info_reader::do_parse): New function.
4433         (Dwarf_info_reader::do_read_string_table): New function.
4434         (Dwarf_info_reader::lookup_reloc): New function.
4435         (Dwarf_info_reader::get_string): New function.
4436         (Dwarf_info_reader::visit_compilation_unit): New function.
4437         (Dwarf_info_reader::visit_type_unit): New function.
4438         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
4439         Sized_elf_reloc_mapper.
4440         (Sized_dwarf_line_info::symbol_section): Remove function.
4441         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
4442         (Sized_dwarf_line_info::read_line_mappings): Remove object
4443         parameter, adjust callers.
4444         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
4445         * dwarf_reader.h: Include <sys/types.h>.
4446         (class Track_relocs): Remove forward declaration.
4447         (class Elf_reloc_mapper): New class.
4448         (class Sized_elf_reloc_mapper): New class.
4449         (class Dwarf_abbrev_table): New class.
4450         (class Dwarf_range_list): New class.
4451         (class Dwarf_ranges_table): New class.
4452         (class Dwarf_pubnames_table): New class.
4453         (class Dwarf_die): New class.
4454         (class Dwarf_info_reader): New class.
4455         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
4456         (Sized_dwarf_line_info::symbol_section): Remove member function.
4457         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
4458         base class.
4459         * gdb-index.cc: New source file.
4460         * gdb-index.h: New source file.
4461         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
4462         and .debug_types sections, call Layout::add_to_gdb_index.
4463         (Sized_relobj_incr::do_section_name): Implement.
4464         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
4465         return type; Implement.
4466         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
4467         return type.
4468         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
4469         parameter list and return type.
4470         (Sized_incr_dynobj::do_section_contents): Likewise.
4471         * layout.cc: Include gdb-index.h.
4472         (Layout::Layout): Initialize gdb_index_data_.
4473         (Layout::init_fixed_output_section): Check for .gdb_index section.
4474         (Layout::add_to_gdb_index): New function. Instantiate.
4475         * layout.h: Add forward declaration for class Gdb_index.
4476         (Layout::add_to_gdb_index): New member function.
4477         (Layout::gdb_index_data_): New data member.
4478         * main.cc: Include gdb-index.h.
4479         (main): Print statistics for gdb index.
4480         * object.cc (Object::section_contents): Move code into
4481         do_section_contents.
4482         (need_decompressed_section): Check for sections needed when building
4483         gdb index.
4484         (build_compressed_section_map): Likewise.
4485         (Sized_relobj_file::do_read_symbols): Need local symbols when building
4486         gdb index.
4487         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
4488         sections; call Layout::add_to_gdb_index.
4489         (Sized_relobj_file::do_decompressed_section_contents): Call
4490         do_section_contents directly.
4491         * object.h (Object::do_section_contents): Adjust parameter list and
4492         return type.
4493         (Object::do_decompressed_section_contents): Call do_section_contents
4494         directly.
4495         (Sized_relobj_file::do_section_contents): Adjust parameter list and
4496         return type.
4497         * options.h (class General_options): Add --gdb-index option.
4498         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
4499         list and return type.
4500         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
4501         * reloc.h (Track_relocs::checkpoint): New function.
4502         (Track_relocs::reset): New function.
4503
4504         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
4505         New test cases.
4506         * testsuite/Makefile.in: Regenerate.
4507         * testsuite/gdb_index_test.cc: New test source file.
4508         * testsuite/gdb_index_test_1.sh: New test source file.
4509         * testsuite/gdb_index_test_2.sh: New test source file.
4510
4511 2012-03-19  Doug Kwan  <dougkwan@google.com>
4512
4513         * arm.cc (Target_arm::do_define_standard_symbols): New method.
4514         (Target_arm::do_finalize_sections): Remove code which defines
4515         __exidx_start and __exidx_end.  Make symbol table parameter
4516         anonymous as it is not used.
4517         * gold.cc (queue_middle_tasks): Call target hook to define any
4518         target-specific symbols.
4519         * target.h (Target::define_standard_symbols): New method.
4520         (Target::do_define_standard_symbols): Same.
4521         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
4522         * testsuite/Makefile.in: Regenerate.
4523         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
4524         and __exidx_end.
4525         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
4526         relocations are generated for __exidx_start and __exidx_end.
4527
4528 2012-03-16  Doug Kwan  <dougkwan@google.com>
4529
4530         * testsuite/Makefile.am: Disable test initpri3b.
4531         * testsuite/Makefile.in: Regenerate.
4532
4533 2012-03-15  Doug Kwan  <dougkwan@google.com>
4534
4535         * arm.cc (Target_arm::got_section): Make .got section read-only
4536         if -z now is given.
4537
4538 2012-03-15  Ian Lance Taylor  <iant@google.com>
4539
4540         PR gold/13850
4541         * layout.cc (Layout::make_output_section): Correctly mark
4542         SHT_INIT_ARRAY, et. al., as relro.
4543
4544 2012-03-14  Doug Kwan  <dougkwan@google.com>
4545
4546         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
4547         dynamic relocations for protected symbols in shared objects.
4548
4549 2012-03-13  Ian Lance Taylor  <iant@google.com>
4550
4551         * resolve.cc (Symbol_table::resolve): When merging common symbols,
4552         keep the larger alignment.
4553
4554 2012-03-12  Cary Coutant  <ccoutant@google.com>
4555
4556         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
4557         handling of DW_LNE_define_file.
4558
4559 2012-03-12  Cary Coutant  <ccoutant@google.com>
4560
4561         * reduced_debug_output.cc
4562         (Output_reduced_debug_info_section::get_die_end): Add new FORM
4563         codes to switch.
4564
4565 2012-02-29  Cary Coutant  <ccoutant@google.com>
4566
4567         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
4568
4569 2012-02-29  Cary Coutant  <ccoutant@google.com>
4570
4571         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4572         Call Object::decompressed_section_contents.
4573         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
4574         New dtor.
4575         (Sized_dwarf_line_info::buffer_start_): New data member.
4576         * merge.cc (Output_merge_data::do_add_input_section): Call
4577         Object::decompressed_section_contents.
4578         (Output_merge_string::do_add_input_section): Likewise.
4579         * object.cc (need_decompressed_section): New function.
4580         (build_compressed_section_map): Decompress sections needed later.
4581         (Sized_relobj_file::do_decompressed_section_contents): New function.
4582         (Sized_relobj_file::do_discard_decompressed_sections): New function.
4583         * object.h (Object::decompressed_section_contents): New function.
4584         (Object::discard_decompressed_sections): New function.
4585         (Object::do_decompressed_section_contents): New function.
4586         (Object::do_discard_decompressed_sections): New function.
4587         (Compressed_section_info): New type.
4588         (Compressed_section_map): Include decompressed section contents.
4589         (Sized_relobj_file::do_decompressed_section_contents): New function.
4590         (Sized_relobj_file::do_discard_decompressed_sections): New function.
4591
4592 2012-02-16  Cary Coutant  <ccoutant@google.com>
4593
4594         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
4595         * testsuite/Makefile.in: Regenerate.
4596
4597 2012-02-14  Cary Coutant  <ccoutant@google.com>
4598
4599         * options.cc (General_options::finalize): Disallow -pie and -static.
4600
4601 2012-02-03  Doug Kwan  <dougkwan@google.com>
4602
4603         * arm.cc (Arm_relocate_functions::abs8,
4604         Arm_relocate_functions::abs16): Use
4605         Bits::has_signed_unsigned_overflow32.
4606         (Arm_relocate_functions::thm_abs8): Correct range of
4607         overflow check.
4608         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
4609         in assertions.
4610
4611 2012-02-02  Doug Kwan  <dougkwan@google.com>
4612
4613         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
4614         position independent outputs, not just shared objects.
4615
4616 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
4617
4618         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
4619         * configure: Regenerated.
4620
4621 2012-01-27  Ian Lance Taylor  <iant@google.com>
4622
4623         * reloc.h (Bits): New class with static functions, copied from
4624         namespace utils in arm.cc.
4625         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
4626         instead.
4627
4628 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4629
4630         * incremental.cc (write_info_blocks): Correct relocation offset.
4631
4632 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4633
4634         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
4635         (Relocate::tls_gd_to_le): Likewise.
4636
4637 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4638
4639         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
4640
4641 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4642
4643         * configure.ac: Check if -mcmodel=medium works.
4644         * configure: Regenerated.
4645
4646 2012-01-24  Cary Coutant  <ccoutant@google.com>
4647
4648         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
4649         definition and ...
4650         (read_unsigned_LEB_128_x): ... this new function.
4651         (read_signed_LEB_128): Replaced with inline definition and ...
4652         (read_signed_LEB_128_x): ... this new function.
4653         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
4654         (read_unsigned_LEB_128): Add inline definition.
4655         (read_signed_LEB_128_x): New function.
4656         (read_signed_LEB_128): Add inline definition.
4657         * testsuite/Makefile.am (leb128_unittest): New unit test.
4658         * testsuite/Makefile.in: Regenerate.
4659         * testsuite/leb128_unittest.cc: New unit test.
4660
4661 2012-01-23  Ian Lance Taylor  <iant@google.com>
4662
4663         PR gold/13617
4664         * i386.cc (Target_i386::do_code_fill): When using a jmp
4665         instruction, pad with nop instructions.
4666         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4667
4668 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
4669
4670         * x86_64.cc (gc_process_relocs): Add typename on types used in
4671         template.
4672         (scan_relocs): Likewise.
4673         (relocate_section): Likewise.
4674         (apply_relocation): Likewise.
4675
4676 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
4677
4678         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
4679         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
4680         under x32.
4681
4682 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
4683
4684         * x86_64.cc: Initial support for x32.
4685
4686 2012-01-03  Cary Coutant  <ccoutant@google.com>
4687
4688         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
4689         Use abstract base class for GOT.
4690         * gold/output.h (class Output_data_got_base): New abstract base class.
4691         (class Output_data_got): Derive from new base class, adjust ctors.
4692         (Output_data_got::reserve_slot): Make virtual; rename to
4693         do_reserve_slot; Adjust callers.
4694         * gold/target.h (Sized_target::init_got_plt_for_update): Return
4695         pointer to abstract base class.
4696         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
4697
4698 2011-12-18  Ian Lance Taylor  <iant@google.com>
4699
4700         * object.h (Relobj::local_symbol_value): New function.
4701         (Relobj::local_plt_offset): New function.
4702         (Relobj::local_has_got_offset): New function.
4703         (Relobj::local_got_offset): New function.
4704         (Relobj::set_local_got_offset): New function.
4705         (Relobj::do_local_symbol_value): New pure virtual function.
4706         (Relobj::do_local_plt_offset): Likewise.
4707         (Relobj::do_local_has_got_offset): Likewise.
4708         (Relobj::do_local_got_offset): Likewise.
4709         (Relobj::do_set_local_got_offset): Likewise.
4710         (Sized_relobj::do_local_has_got_offset): Rename from
4711         local_has_got_offset.
4712         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
4713         (Sized_relobj::do_set_local_got_offset): Rename from
4714         set_local_got_offset.
4715         (Sized_relobj_file::do_local_plt_offset): Rename from
4716         local_plt_offset.
4717         (Sized_relobj_file::do_local_symbol_value): New function.
4718         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
4719         local_plt_offset.
4720         * output.cc (Output_data_got::Got_entry::write): Change object to
4721         Relobj.  Use local_symbol_value.
4722         (Output_data_got::add_global_with_rel): Change rel_dyn to
4723         Output_data_reloc_generic*.  Use add_global_generic.
4724         (Output_data_got::add_global_with_rela): Remove.  Change all
4725         callers to use add_global_with_rel.
4726         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
4727         Output_data_reloc_generic*.  Use add_global_generic.
4728         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
4729         callers to use add_global_pair_with_rel.
4730         (Output_data_got::add_local): Change object to Relobj*.
4731         (Output_data_got::add_local_plt): Likewise.
4732         (Output_data_got::add_local_with_rel): Change object to Relobj*,
4733         change rel_dyn to Output_data_reloc_generic*.  Use
4734         add_local_generic.
4735         (Output_data_got::add_local_with_rela): Remove.  Change all
4736         callers to use all_local_with_rel.
4737         (Output_data_got::add_local_pair_with_rel): Change object to
4738         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
4739         add_output_section_generic.
4740         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
4741         callers to use add_local_pair_with_rel.
4742         (Output_data_got::reserve_local): Change object to Relobj*.
4743         * output.h: (class Output_data_reloc_generic): Add pure virtual
4744         declarations for add_global_generic, add_local_generic,
4745         add_output_section_generic.
4746         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
4747         functions for Output_data_reloc_generic.  Update declarations for
4748         changes listed in output.cc.
4749         (class Output_data_got): Change template parameter to got_size.
4750         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
4751         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
4752         function.
4753         (Sized_relobj_incr::do_local_plt_offset): New function.
4754         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
4755         add_global_generic.
4756
4757 2011-12-17  Cary Coutant  <ccoutant@google.com>
4758
4759         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
4760         * resolve.cc (Symbol_table::resolve): Likewise.
4761         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
4762         arrays.
4763         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4764
4765 2011-12-16  Ian Lance Taylor  <iant@google.com>
4766
4767         * output.h (Output_data_reloc_generic::add): Only call
4768         add_dynamic_reloc if this is a dynamic reloc section.
4769
4770 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
4771
4772         PR gold/13505
4773         * target-reloc.h (apply_relocation): Replace <64, false> with
4774         <size, big_endian>.
4775
4776 2011-11-25  Nick Clifton  <nickc@redhat.com>
4777
4778         * po/it.po: New Italian translation.
4779
4780 2011-11-17  Sterling Augustine  <saugustine@google.com>
4781
4782         * script.cc (script_include_directive): Implement.
4783         (read_script_file): New local variables name and search_path. Update
4784         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
4785         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
4786         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
4787
4788 2011-11-11  Sterling Augustine  <saugustine@google.com>
4789
4790         * yyscript.y (section_cmd): Add support for INCLUDE directive.
4791         (file_or_sections_cmd): Likewise.
4792
4793 2011-11-11  Doug Kwan  <dougkwan@google.com>
4794
4795         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
4796         if --just-symbols is given.
4797
4798 2011-11-10  Doug Kwan  <dougkwan@google.com>
4799
4800         PR gold/13362
4801         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
4802         when processing data relocs.
4803         * reloc.h (Relocate_functions::rel_unaligned): New method.
4804         (Relocate_functions::pcrel_unaligned): Ditto.
4805         (Relocate_functions::rel32_unaligned): Ditto.
4806         (Relocate_functions::pcrel32_unaligned): Ditto.
4807
4808 2011-11-09  Doug Kwan  <dougkwan@google.com>
4809
4810         PR gold/13362
4811         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
4812         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
4813         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
4814         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4815         (Relocate_functions::rel_unaligned): New.
4816         (Relocate_functions::rel32_unaligned): New.
4817         * target-reloc.h (relocate_for_relocatable): Add code to handle
4818         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4819         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
4820         arm_unaligned_reloc_r): New targets.
4821         * testsuite/Makefile.in: Regenerate.
4822         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
4823         linking.
4824
4825 2011-11-02  Ian Lance Taylor  <iant@google.com>
4826
4827         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
4828         NATIVE_LINKER.
4829         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
4830         * options.cc (General_options::finalize): Use library search path
4831         from configure script if specified.  If not native and no sysroot,
4832         only search TOOLLIBDIR.
4833         * options.h (Search_directory::Search_directory): Change name to
4834         const std::string&.
4835         (General_options::add_to_library_path_with_sysroot): Change arg to
4836         const std::string&.
4837         * configure, Makefile.in, config.in: Rebuild.
4838
4839 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
4840
4841         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
4842         we are working around the ARM1176 Erratum.
4843         * options.h (General_options::fix_arm1176): Add option.
4844         * testsuite/Makefile.am: Add testcases, and keep current ones
4845         working.
4846         * testsuite/Makefile.in: Regenerate.
4847         * testsuite/arm_fix_1176.s: New file.
4848         * testsuite/arm_fix_1176.sh: Likewise.
4849
4850 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
4851
4852         * arm.cc (Target_arm::Target_arm): Remove initialisation of
4853         may_use_blx_.
4854         (Target_arm::may_use_blx): Remove method.
4855         (Target_arm::set_may_use_blx): Likewise.
4856         (Target_arm::may_use_v4t_interworking): New method.
4857         (Target_arm::may_use_v5t_interworking): Likewise.
4858         (Target_arm::may_use_blx_): Remove member variable.
4859         (Arm_relocate_functions::arm_branch_common): Check for v5T
4860         interworking.
4861         (Arm_relocate_functions::thumb_branch_common): Likewise.
4862         (Reloc_stub::stub_type_for_reloc): Likewise.
4863         (Target_arm::do_finalize_sections): Correct interworking checks.
4864         * testsuite/Makefile.am: Add new tests.
4865         * testsuite/Makefile.in: Regenerate.
4866         * testsuite/arm_farcall_arm_arm.s: New test.
4867         * testsuite/arm_farcall_arm_arm.sh: Likewise.
4868         * testsuite/arm_farcall_arm_thumb.s: Likewise.
4869         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
4870         * testsuite/arm_farcall_thumb_arm.s: Likewise.
4871         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
4872         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
4873         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
4874
4875 2011-10-31  Cary Coutant  <ccoutant@google.com>
4876
4877         PR gold/13023
4878         * expression.cc (Expression::eval_with_dot): Add
4879         is_section_dot_assignment parameter.
4880         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
4881         absolute and assigning to dot within a section.
4882         * script-sections.cc
4883         (Output_section_element_assignment::set_section_addresses): Pass
4884         dot_section to set_if_absolute.
4885         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
4886         as is_section_dot_assignment flag to eval_with_dot.
4887         (Output_section_element_dot_assignment::set_section_addresses):
4888         Likewise.
4889         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
4890         parameter.  Also set value if relative to dot_section; set the
4891         symbol's output_section.
4892         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
4893         parameter.  Adjust all callers.
4894         (Expression::eval_maybe_dot): Likewise.
4895         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
4896         Adjust all callers.
4897         * testsuite/script_test_2.t: Test assignment of an absolute value
4898         to dot within an output section element.
4899
4900 2011-10-31  Cary Coutant  <ccoutant@google.com>
4901
4902         * options.h (class General_options): Add --[no-]gnu-unique options.
4903         * symtab.cc (Symbol_table::sized_write_globals): Convert
4904         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
4905
4906 2011-10-31  Cary Coutant  <ccoutant@google.com>
4907
4908         PR gold/13359
4909         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
4910         unnecessary assertion.
4911         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
4912
4913 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
4914
4915         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4916         gc_mark_symbol.
4917         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4918         gc_mark_symbol.
4919         Change to just keep the section associated with symbol.
4920         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
4921         they are externally visible and --export-dynamic is turned on.
4922         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
4923
4924 2011-10-19  Ian Lance Taylor  <iant@google.com>
4925
4926         PR gold/13163
4927         * script-sections.cc
4928         (Output_section_element_dot_assignment::needs_output_section): New
4929         function.
4930
4931 2011-10-19  Ian Lance Taylor  <iant@google.com>
4932
4933         PR gold/13204
4934         * layout.cc (Layout::segment_precedes): Don't assert failure if a
4935         --section-start option was seen.
4936         * options.h (General_options::any_section_start): New function.
4937
4938 2011-10-18  David S. Miller  <davem@davemloft.net>
4939
4940         PR binutils/13301
4941         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
4942         member to track relocation locations that have moved during TLS
4943         reloc optimizations.
4944         (Target_sparc::Relocate::Relocate): Initialize to NULL.
4945         (Target_sparc::Relocate::relocate): Adjust view down by 4
4946         bytes if it matches reloc_adjust_addr_.
4947         (Target_sparc::Relocate::relocate_tls): Always move the
4948         __tls_get_addr call delay slot instruction forward 4 bytes when
4949         performing relaxation.
4950
4951 2011-10-18  Cary Coutant  <ccoutant@google.com>
4952
4953         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
4954         (Output_file::map_no_anonymous): Check for non-zero
4955         return code from posix_fallocate.
4956
4957 2011-10-17  Cary Coutant  <ccoutant@google.com>
4958
4959         PR gold/13245
4960         * plugin.cc (is_visible_from_outside): Check for symbols
4961         referenced from dynamic objects.
4962         * resolve.cc (Symbol_table::resolve): Don't count references
4963         from dynamic objects as references from real ELF files.
4964         * testsuite/plugin_test_2.sh: Adjust expected result.
4965
4966 2011-10-17  Cary Coutant  <ccoutant@google.com>
4967
4968         * gold.cc: Include timer.h.
4969         (queue_middle_tasks): Stamp time.
4970         (queue_final_tasks): Likewise.
4971         * main.cc (main): Store timer in parameters.  Print timers
4972         for each pass.
4973         * parameters.cc (Parameters::Parameters): Initialize timer_.
4974         (Parameters::set_timer): New function.
4975         (set_parameters_timer): New function.
4976         * parameters.h (Parameters::set_timer): New function.
4977         (Parameters::timer): New function.
4978         (Parameters::timer_): New data member.
4979         (set_parameters_timer): New function.
4980         * timer.cc (Timer::stamp): New function.
4981         (Timer::get_pass_time): New function.
4982         * timer.h (Timer::stamp): New function.
4983         (Timer::get_pass_time): New function.
4984         (Timer::pass_times_): New data member.
4985
4986 2011-10-17  Cary Coutant  <ccoutant@google.com>
4987
4988         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4989         task for members of lib groups.
4990
4991 2011-10-17  Cary Coutant  <ccoutant@google.com>
4992
4993         PR gold/13288
4994         * fileread.cc (File_read::find_view): Add assert.
4995         (File_read::make_view): Move bounds check (replace with assert)...
4996         (File_read::find_or_make_view): ... to here.
4997
4998 2011-10-12  Cary Coutant  <ccoutant@google.com>
4999
5000         * output.cc (Output_file::open_base_file): Handle case where
5001         ::read returns less than requested size.
5002
5003 2011-10-10  Cary Coutant  <ccoutant@google.com>
5004
5005         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
5006         Initialize defined_count_.
5007         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
5008         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
5009         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
5010         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
5011         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
5012         * incremental.h (Sized_relobj_incr::defined_count_): New data
5013         member.
5014         (Sized_incr_dynobj::defined_count_): New data member.
5015         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
5016         Return zeroes instead of internal error.
5017
5018 2011-10-10  Cary Coutant  <ccoutant@google.com>
5019
5020         PR gold/13249
5021         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
5022         (Output_reloc::symbol_value): Return PLT offset if flag is set.
5023         * output.h (class Output_reloc): Add use_plt_offset flag.
5024         (Output_reloc::type_): Adjust size of bit field.
5025         (Output_reloc::use_plt_offset_): New bit field.
5026         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
5027         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
5028         flag.  Adjust all callers.
5029         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
5030         creating RELATIVE relocations.
5031
5032 2011-10-10  Nick Clifton  <nickc@redhat.com>
5033
5034         * po/es.po: Updated Spanish translation.
5035         * po/fi.po: Updated Finnish translation.
5036
5037 2011-10-03   Diego Novillo  <dnovillo@google.com>
5038
5039         * options.cc (parse_uint): Fix dereference of RETVAL.
5040
5041 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
5042
5043         * layout.h (section_order_map_): New member.
5044         (get_section_order_map): New member function.
5045         * output.cc (Output_section::add_input_section): Check for patterns
5046         only when --section-ordering-file is specified.
5047         * gold.cc (queue_middle_tasks): Delay updating order of sections till
5048         output_sections have been formed.
5049         * layout.cc (Layout_Layout): Initialize section_order_map_.
5050         * plugin.cc (update_section_order): Store order in order_map. Do not
5051         update the order.
5052         * testsuite/Makefile.am: Add test case for plugin_final_layout.
5053         * testsuite/Makefile.in: Regenerate.
5054         * testsuite/plugin_section_order.c: New file.
5055         * testsuite/plugin_final_layout.cc: New file.
5056         * testsuite/plugin_final_layout.sh: New file.
5057
5058 2011-09-29  Cary Coutant  <ccoutant@google.com>
5059
5060         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5061         Check for NULL.
5062         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
5063         symbols during incremental update.
5064         (Symbol_table::add_from_dynobj): Likewise.
5065
5066 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5067             Ian Lance Taylor  <iant@google.com>
5068
5069         * symtab.cc (Symbol_table::define_special_symbol): Always
5070         canonicalize version string.
5071
5072 2011-09-26  Cary Coutant  <ccoutant@google.com>
5073
5074         * gold.cc (queue_initial_tasks): Move option checks ...
5075         * options.cc (General_options::finalize): ... to here. Disable
5076         some options; make others fatal.
5077
5078 2011-09-26  Cary Coutant  <ccoutant@google.com>
5079
5080         gcc PR lto/47247
5081         * plugin.cc (get_symbols_v2): New function.
5082         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
5083         (is_referenced_from_outside): New function.
5084         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
5085         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
5086         (get_symbols): Pass version parameter.
5087         (get_symbols_v2): New function.
5088         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
5089         parameter.
5090         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
5091         (onload): Add LDPT_GET_SYMBOLS_V2.
5092         (all_symbols_read_hook): Use get_symbols_v2; check for
5093         LDPR_PREVAILING_DEF_IRONLY_EXP.
5094         * testsuite/plugin_test_3.sh: Update expected results.
5095
5096 2011-09-23  Simon Baldwin  <simonb@google.com>
5097
5098         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
5099         configuration options.
5100         * configure: Regenerate.
5101         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
5102         * Makefile.in: Regenerate.
5103         * testsuite/Makefile.in: Regenerate.
5104
5105 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
5106
5107         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
5108
5109 2011-09-19  Cary Coutant  <ccoutant@google.com>
5110
5111         * incremental.cc (can_incremental_update): Fix typo in comment.
5112         * incremental.h (can_incremental_update): Likewise.
5113
5114 2011-09-18  Cary Coutant  <ccoutant@google.com>
5115
5116         * incremental.cc (can_incremental_update): New function.
5117         * incremental.h (can_incremental_update): New function.
5118         * layout.cc (Layout::init_fixed_output_section): Call it.
5119         (Layout::make_output_section): Don't allow patch space in .eh_frame.
5120         * object.cc (Sized_relobj_file::do_layout): Call
5121         can_incremental_update.
5122
5123 2011-09-13  Cary Coutant  <ccoutant@google.com>
5124
5125         * configure.ac: Check for glibc support for gnu_indirect_function
5126         support with static linking, setting automake conditional
5127         IFUNC_STATIC.
5128         * Makefile.in: Regenerate.
5129         * configure: Regenerate.
5130
5131         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
5132         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
5133         for IFUNC_STATIC.
5134         * testsuite/Makefile.in: Regenerate.
5135
5136 2011-09-13  Cary Coutant  <ccoutant@google.com>
5137
5138         * incremental.cc (Sized_relobj_incr::do_layout): Call
5139         report_comdat_group for kept comdat sections.
5140         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
5141         * testsuite/Makefile.in: Regenerate.
5142         * testsuite/incr_comdat_test_1.cc: New source file.
5143         * testsuite/incr_comdat_test_2_v1.cc: New source file.
5144         * testsuite/incr_comdat_test_2_v2.cc: New source file.
5145         * testsuite/incr_comdat_test_2_v3.cc: New source file.
5146
5147 2011-09-13  Ian Lance Taylor  <iant@google.com>
5148
5149         * object.cc (Sized_relobj_file::do_layout): Remove unused local
5150         variable external_symbols_offset.
5151
5152 2011-09-12  Ian Lance Taylor  <iant@google.com>
5153
5154         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
5155         triggered if object has no symbols.
5156
5157 2011-09-09  David S. Miller  <davem@davemloft.net>
5158
5159         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
5160         (Output_fill_debug_line::do_write): Likewise.
5161
5162 2011-08-29  Cary Coutant  <ccoutant@google.com>
5163
5164         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
5165         casts to match formatting specs.
5166         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
5167
5168 2011-08-26  Cary Coutant  <ccoutant@google.com>
5169
5170         * layout.cc (Free_list::allocate): Provide guarantee of minimum
5171         remaining hole size when allocating.
5172         (Layout::make_output_section): Set fill methods for debug sections.
5173         * layout.h (Free_list::Free_list_node): Move from private to
5174         public.
5175         (Free_list::set_min_hole_size): New function.
5176         (Free_list::begin, Free_list::end): New functions.
5177         (Free_list::min_hole_): New data member.
5178         * output.cc: Include dwarf.h.
5179         (Output_fill_debug_info::do_minimum_hole_size): New function.
5180         (Output_fill_debug_info::do_write): New function.
5181         (Output_fill_debug_line::do_minimum_hole_size): New function.
5182         (Output_fill_debug_line::do_write): New function.
5183         (Output_section::Output_section): Initialize new data member.
5184         (Output_section::set_final_data_size): Ensure patch space is larger
5185         than minimum hole size.
5186         (Output_section::do_write): Fill holes in debug sections.
5187         * output.h (Output_fill): New class.
5188         (Output_fill_debug_info): New class.
5189         (Output_fill_debug_line): New class.
5190         (Output_section::set_free_space_fill): New function.
5191         (Output_section::free_space_fill_): New data member.
5192         * testsuite/Makefile.am (incremental_test_3): Add
5193         --incremental-patch option.
5194         (incremental_test_4): Likewise.
5195         (incremental_test_5): Likewise.
5196         (incremental_test_6): Likewise.
5197         (incremental_copy_test): Likewise.
5198         (incremental_common_test_1): Likewise.
5199         * testsuite/Makefile.in: Regenerate.
5200
5201 2011-08-26  Nick Clifton  <nickc@redhat.com>
5202
5203         * po/es.po: Updated Spanish translation.
5204
5205 2011-08-01  Cary Coutant  <ccoutant@google.com>
5206
5207         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
5208         * gold/testsuite/Makefile.in: Regenerate.
5209         * gold/testsuite/justsyms_exec.c: New source file.
5210         * gold/testsuite/justsyms_lib.c: New source file.
5211
5212 2011-08-01  Cary Coutant  <ccoutant@google.com>
5213
5214         * layout.cc (Layout::set_segment_offsets): Don't realign text
5215         segment if -Ttext was specified.
5216         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
5217         file type.
5218         * object.h (Sized_relobj_file::e_type): New function.
5219         (Sized_relobj_file::e_type_): New data member.
5220         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
5221         base address for ET_EXEC files.
5222         * target.cc (Target::do_make_elf_object_implementation): Allow
5223         ET_EXEC files with --just-symbols option.
5224
5225 2011-07-28  Cary Coutant  <ccoutant@google.com>
5226
5227         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
5228         Add thread_number parameter.
5229         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
5230         * workqueue-threads.cc
5231         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
5232         current thread if its thread number is greater than desired thread
5233         count.
5234         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
5235         Add thread_number parameter.
5236         (Workqueue::should_cancel_thread): Likewise.
5237         (Workqueue::find_runnable_or_wait): Pass thread_number to
5238         should_cancel_thread.
5239         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
5240         parameter.
5241
5242 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
5243
5244         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
5245         only after checking if it cannot be forced local.
5246         * symtab.h (is_externally_visible): Check if the symbol is not forced
5247         local.
5248
5249 2011-07-15  Ian Lance Taylor  <iant@google.com>
5250
5251         * options.h (class General_options): Add --print-output-format.
5252         Move -EL next to -EB, for  better --help output.
5253         * target-select.cc: Include <cstdio>, "options.h", and
5254         "parameters.h".
5255         (Target_selector::do_target_bfd_name): New function.
5256         (print_output_format): New function.
5257         * target-select.h (class Target_selector): Update declarations.
5258         (Target_selector::target_bfd_name): New function.
5259         (print_output_format): Declare.
5260         * main.cc: Include "target-select.h".
5261         (main): Handle --print-output-format.
5262         * gold.cc: Include "target-select.h".
5263         (queue_initial_tasks): Handle --print-output-format when there are
5264         no input files.
5265         * parameters.cc (parameters_force_valid_target): Give a better
5266         error message if -EB/-EL does not match target.
5267         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
5268         function.
5269
5270 2011-07-15  Ian Lance Taylor  <iant@google.com>
5271
5272         * i386.cc (class Output_data_plt_i386): Add layout_ field.
5273         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
5274         (Output_data_plt_i386::do_write): Write address of .dynamic
5275         section to first entry in .got.plt section.
5276         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
5277         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5278         Initialize layout_.
5279         (Output_data_plt_x86_64::do_write): Write address of .dynamic
5280         section to first entry in .got.plt section.
5281         * layout.h (Layout::dynamic_section): New function.
5282
5283 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
5284
5285         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
5286         to claim_file call.
5287         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
5288         input_section_position_, and input_section_glob_.
5289         (read_layout_from_file): Call function section_ordering_specified.
5290         * layout.h (is_section_ordering_specified): New function.
5291         (section_ordering_specified): New function.
5292         (section_ordering_specified_): New boolean member.
5293         * main.cc(main): Call load_plugins after layout object is defined.
5294         * output.cc (Output_section::add_input_section): Use
5295         function section_ordering_specified to check if section ordering is
5296         needed.
5297         * output.cc (Output_section::add_relaxed_input_section): Use
5298         function section_ordering_specified to check if section ordering is
5299         needed.
5300         (Output_section::update_section_layout): New function.
5301         (Output_section::sort_attached_input_sections): Check if input section
5302         must be reordered.
5303         * output.h (Output_section::update_section_layout): New function.
5304         * plugin.cc (get_section_count): New function.
5305         (get_section_type): New function.
5306         (get_section_name): New function.
5307         (get_section_contents): New function.
5308         (update_section_order): New function.
5309         (allow_section_ordering): New function.
5310         (Plugin::load): Add the new interfaces to the transfer vector.
5311         (Plugin_manager::load_plugins): New parameter.
5312         (Plugin_manager::all_symbols_read): New parameter.
5313         (Plugin_manager::claim_file): New parameter. Save the elf object for
5314         unclaimed objects.
5315         (Plugin_manager::get_elf_object): New function.
5316         (Plugin_manager::get_view): Change to directly use the bool to check
5317         if get_view is called from claim_file_hook.
5318         * plugin.h (input_objects): New function
5319         (Plugin__manager::load_plugins): New parameter.
5320         (Plugin_manager::claim_file): New parameter.
5321         (Plugin_manager::get_elf_object): New function.
5322         (Plugin_manager::in_claim_file_handler): New function.
5323         (Plugin_manager::in_claim_file_handler_): New member.
5324         (layout): New function.
5325         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
5326         handler with an extra parameter. Make the elf object before calling
5327         claim_file handler.
5328         * testsuite/plugin_test.c (get_section_count): New function pointer.
5329         (get_section_type): New function pointer.
5330         (get_section_name): New function pointer.
5331         (get_section_contents): New function pointer.
5332         (update_section_order): New function pointer.
5333         (allow_section_ordering): New function pointer.
5334         (onload): Check if the new interfaces exist.
5335
5336 2011-07-13  Ian Lance Taylor  <iant@google.com>
5337
5338         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
5339         relro section.
5340         * x86_64.cc (Target_x86_64::got_section): Likewise.
5341         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
5342         (relro_now_test_SOURCES): New variable.
5343         (relro_now_test_DEPENDENCIES): New variable.
5344         (relro_now_test_LDFLAGS): New variable.
5345         (relro_now_test_LDADD): New variable.
5346         (relro_now_test.so): New target.
5347         * testsuite/Makefile.in: Rebuild.
5348
5349 2011-07-12  Ian Lance Taylor  <iant@google.com>
5350
5351         PR gold/12980
5352         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
5353         GLOB_DAT relocation rather than a RELATIVE relocation for a
5354         protected symbol when creating a shared library.
5355         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5356         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
5357         * testsuite/protected_main_1.cc (main): Test that protected
5358         function has same address.
5359
5360 2011-07-11  Ian Lance Taylor  <iant@google.com>
5361
5362         PR gold/12979
5363         * options.h (class General_options): Add -Bgroup.
5364         * options.cc (General_options::finalize): If -Bgroup is set,
5365         default to --unresolved-symbols=report-all.
5366         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
5367         * target-reloc.h (issue_undefined_symbol_error): Handle
5368         --unresolved-symbols=report-all.
5369
5370 2011-07-08  Ian Lance Taylor  <iant@google.com>
5371
5372         PR gold/11985
5373         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
5374         if linker script discards key sections.
5375         (Layout::create_dynamic_symtab): Likewise.
5376         (Layout::assign_local_dynsym_offsets): Likewise.
5377         (Layout::sized_create_version_sections): Likewise.
5378         (Layout::create_interp): Likewise.
5379         (Layout::finish_dynamic_section): Likewise.
5380         (Layout::set_dynamic_symbol_size): Likewise.
5381
5382 2011-07-08  Ian Lance Taylor  <iant@google.com>
5383
5384         PR gold/12386
5385         * options.h (class General_options): Add --unresolved-symbols.
5386         * target-reloc.h (issue_undefined_symbol_error): Check
5387         --unresolved-symbols.  Add comments.
5388
5389 2011-07-08  Ian Lance Taylor  <iant@google.com>
5390
5391         * testsuite/odr_violation2.cc (Ordering::operator()): Make
5392         expression more complex.
5393
5394 2011-07-08  Ian Lance Taylor  <iant@google.com>
5395
5396         PR gold/11317
5397         * target-reloc.h (issue_undefined_symbol_error): New inline
5398         function, broken out of relocate_section.
5399         (relocate_section): Call issue_undefined_symbol_error.
5400         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5401         there is no TLS segment if we are about to issue an undefined
5402         symbol error.
5403         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5404
5405 2011-07-08  Ian Lance Taylor  <iant@google.com>
5406
5407         PR gold/12279
5408         * resolve.cc (Symbol_table::should_override): Add fromtype
5409         parameter.  Change all callers.  Give error when linking together
5410         TLS and non-TLS symbol.
5411         (Symbol_table::should_override_with_special): Add fromtype
5412         parameter.  Change all callers.
5413         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5414         there is no TLS segment if we have reported some errors.
5415         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5416
5417 2011-07-08  Ian Lance Taylor  <iant@google.com>
5418
5419         PR gold/12372
5420         * target.h (Target::plt_address_for_global): New function.
5421         (Target::plt_address_for_local): New function.
5422         (Target::plt_section_for_global): Remove.
5423         (Target::plt_section_for_local): Remove.
5424         (Target::do_plt_address_for_global): New virtual function.
5425         (Target::do_plt_address_for_local): New virtual function.
5426         (Target::do_plt_section_for_global): Remove.
5427         (Target::do_plt_section_for_local): Remove.
5428         (Target::register_global_plt_entry): Add Symbol_table and Layout
5429         parameters.
5430         * output.cc (Output_data_got::Got_entry::write): Use
5431         plt_address_for_global and plt_address_for_local.
5432         * layout.cc (Layout::add_target_dynamic_tags): Use size and
5433         address of output section.
5434         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
5435         got_irelative_, and irelative_count_ fields.  Update
5436         declarations.
5437         (Output_data_plt_i386::has_irelative_section): New function.
5438         (Output_data_plt_i386::entry_count): Add irelative_count_.
5439         (Output_data_plt_i386::set_final_data_size): Likewise.
5440         (class Target_i386): Add got_irelative_ and rel_irelative_
5441         fields.  Update declarations.
5442         (Target_i386::Target_i386): Initialize new fields.
5443         (Target_i386::do_plt_address_for_global): New function replacing
5444         do_plt_section_for_global.
5445         (Target_i386::do_plt_address_for_local): New function replacing
5446         do_plt_section_for_local.
5447         (Target_i386::got_section): Create got_irelative_.
5448         (Target_i386::rel_irelative_section): New function.
5449         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
5450         fields.  Don't define __rel_iplt_{start,end}.
5451         (Output_data_plt_i386::add_entry): Add symtab and layout
5452         parameters.  Change all callers.  Use different PLT and GOT for
5453         IFUNC symbols.
5454         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
5455         layout parameters.  Change all callers.  Use different PLT and
5456         GOT.
5457         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
5458         (Output_data_plt_i386::rel_irelative): New function.
5459         (Output_data_plt_i386::address_for_global): New function.
5460         (Output_data_plt_i386::address_for_local): New function.
5461         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
5462         IRELATIVE GOT when changing IFUNC GOT entries.
5463         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
5464         reloc.
5465         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
5466         if we didn't create an IRELATIVE GOT.
5467         (Target_i386::Relocate::relocate): Use plt_address_for_global and
5468         plt_address_for_local.
5469         (Target_i386::do_dynsym_value): Use plt_address_for_global.
5470         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
5471         got_irelative_, and irelative_count_ fields.  Update
5472         declarations.
5473         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5474         Initialize new fields.  Remove symtab parameter.  Change all
5475         callers.
5476         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
5477         irelative_count_.
5478         (Output_data_plt_x86_64::has_irelative_section): New function.
5479         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
5480         (class Target_x86_64): Add got_irelative_ and rel_irelative_
5481         fields.  Update declarations.
5482         (Target_x86_64::Target_x86_64): Initialize new fields.
5483         (Target_x86_64::do_plt_address_for_global): New function replacing
5484         do_plt_section_for_global.
5485         (Target_x86_64::do_plt_address_for_local): New function replacing
5486         do_plt_section_for_local.
5487         (Target_x86_64::got_section): Create got_irelative_.
5488         (Target_x86_64::rela_irelative_section): New function.
5489         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
5490         all callers.  Don't create __rel_iplt_{start,end}.
5491         (Output_data_plt_x86_64::add_entry): Add symtab and layout
5492         parameters.  Change all callers.  Use different PLT and GOT for
5493         IFUNC symbols.
5494         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
5495         layout parameters.  Change all callers.  Use different PLT and
5496         GOT.
5497         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
5498         parameters.  Change all callers.  Use different PLT and GOT for
5499         IFUNC symbols.
5500         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
5501         (Output_data_plt_x86_64::rela_irelative): New function.
5502         (Output_data_plt_x86_64::address_for_global): New function.
5503         (Output_data_plt_x86_64::address_for_local): New function.
5504         (Output_data_plt_x86_64::set_final_data_size): Likewise.
5505         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
5506         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
5507         (Target_x86_64::register_global_plt_entry): Add symtab and layout
5508         parameters.
5509         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
5510         reloc.
5511         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
5512         symbols if we didn't create an IRELATIVE GOT.
5513         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
5514         plt_address_for_local.
5515         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
5516         * testsuite/ifuncvar1.c: New test file.
5517         * testsuite/ifuncvar2.c: New test file.
5518         * testsuite/ifuncvar3.c: New test file.
5519         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
5520         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
5521         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
5522         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
5523         * testsuite/Makefile.in: Rebuild.
5524
5525 2011-07-07  Cary Coutant  <ccoutant@google.com>
5526
5527         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
5528         (two_file_test_1_ndebug.o): Likewise.
5529         (two_file_test_1b_ndebug.o): Likewise.
5530         (two_file_test_2_ndebug.o): Likewise.
5531         (two_file_test_main_ndebug.o): Likewise.
5532         (incremental_test_2): Link with no-debug versions.
5533
5534 2011-07-06  Cary Coutant  <ccoutant@google.com>
5535
5536         * gold/incremental.cc
5537         (Output_section_incremental_inputs::write_info_blocks): Check for
5538         hidden and internal symbols.
5539
5540 2011-07-06  Cary Coutant  <ccoutant@google.com>
5541
5542         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
5543         Check disposition for startup file.
5544         (Incremental_inputs::report_command_line): Ignore
5545         --incremental-startup-unchanged option.
5546         * options.cc (General_options::parse_incremental_startup_unchanged):
5547         New function.
5548         (General_options::General_options): Initialize new data member.
5549         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
5550         (General_options): Add --incremental-startup-unchanged option.
5551         (General_options::incremental_startup_disposition): New function.
5552         (General_options::incremental_startup_disposition_): New data member.
5553
5554 2011-07-06  Cary Coutant  <ccoutant@google.com>
5555
5556         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
5557         input file index to Script_info ctor.
5558         (Sized_incremental_binary::do_file_has_changed): Find the
5559         command-line argument for files named in scripts.
5560         * incremental.h (Script_info::Script_info): New ctor
5561         with input file index.
5562         (Script_info::input_file_index): New function.
5563         (Script_info::input_file_index_): New data member.
5564         (Incremental_binary::get_library): Add const.
5565         (Incremental_binary::get_script_info): Add const.
5566         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
5567         * testsuite/Makefile.am (incremental_test_5): New test case.
5568         (incremental_test_6): New test case.
5569         * testsuite/Makefile.in: Regenerate.
5570
5571 2011-07-06  Cary Coutant  <ccoutant@google.com>
5572
5573         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
5574         debug output when command lines differ.
5575
5576 2011-07-06  Cary Coutant  <ccoutant@google.com>
5577
5578         * incremental.cc (Incremental_inputs::report_command_line): Ignore
5579         --incremental-patch option.
5580         * layout.cc (Free_list::allocate): Extend allocation beyond original
5581         end if enabled.
5582         (Layout::make_output_section): Mark sections that should get
5583         patch space.
5584         * options.cc (parse_percent): New function.
5585         * options.h (parse_percent): New function.
5586         (DEFINE_percent): New macro.
5587         (General_options): Add --incremental-patch option.
5588         * output.cc (Output_section::Output_section): Initialize new data
5589         members.
5590         (Output_section::add_input_section): Print section name when out
5591         of patch space.
5592         (Output_section::add_output_section_data): Likewise.
5593         (Output_section::set_final_data_size): Add patch space when
5594         doing --incremental-full.
5595         (Output_section::do_reset_address_and_file_offset): Remove patch
5596         space.
5597         (Output_segment::set_section_list_addresses): Print debug output
5598         only if --incremental-update.
5599         * output.h (Output_section::set_is_patch_space_allowed): New function.
5600         (Output_section::is_patch_space_allowed_): New data member.
5601         (Output_section::patch_space_): New data member.
5602         * parameters.cc (Parameters::incremental_full): New function.
5603         * parameters.h (Parameters::incremental_full): New function
5604         * testsuite/Makefile.am (incremental_test_2): Add test for
5605         --incremental-patch option.
5606         * testsuite/Makefile.in: Regenerate.
5607         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
5608         (t18): Remove function body.
5609
5610 2011-07-05  Doug Kwan  <dougkwan@google.com>
5611
5612         PR gold/12771
5613         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
5614         Arm_Address type for relocation result.
5615         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
5616         overflow check.
5617         (Arm_relocate_functions::abs32): Use unaligned access.
5618         (Arm_relocate_functions::rel32): Ditto.
5619         (Arm_relocate_functions::prel31): Ditto.
5620         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
5621         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
5622         static data relocations.
5623         * testsuite/Makefile.in: Regnerate.
5624         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
5625
5626 2011-07-05  Ian Lance Taylor  <iant@google.com>
5627
5628         PR gold/12392
5629         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
5630         symbols if necessary.
5631         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5632
5633 2011-07-05  Ian Lance Taylor  <iant@google.com>
5634
5635         PR gold/12952
5636         * resolve.cc (Symbol::override_base_with_special): Simply override
5637         version with special symbol version, ignoring previous version.
5638
5639 2011-07-05  Ian Lance Taylor  <iant@google.com>
5640
5641         * object.cc (Sized_relobj_file::include_section_group): Add
5642         information to comment about signature location.
5643
5644 2011-07-02  Ian Lance Taylor  <iant@google.com>
5645
5646         PR gold/12957
5647         * options.h (class General_options): Add -f and -F.
5648         * options.cc (General_options::finalize): Fatal error if -f/-F
5649         are used without -shared.
5650         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
5651
5652 2011-07-02  Ian Lance Taylor  <iant@google.com>
5653
5654         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
5655
5656 2011-07-01  Ian Lance Taylor  <iant@google.com>
5657
5658         PR gold/12525
5659         PR gold/12952
5660         * resolve.cc (Symbol::override_base_with_special): Don't override
5661         the version if the overriding symbol has a different name.
5662         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
5663         all callers.  If we give an error about an undefined version,
5664         define the base version if necessary.
5665         * dynobj.h (class Versions): Update declaration.
5666         * testsuite/weak_alias_test_5.cc: New file.
5667         * testsuite/weak_alias_test.script: New file.
5668         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
5669         and versioned_alias have the right value, and call t2.
5670         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
5671         weak_alias_test_5.so.
5672         (weak_alias_test_LDADD): Likewise.
5673         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
5674         * testsuite/Makefile.in: Rebuild.
5675
5676 2011-07-01  Ian Lance Taylor  <iant@google.com>
5677
5678         PR gold/12525
5679         * options.h (class General_options): Support -z notext.
5680         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
5681         -Wl,-z,notext.
5682         (two_file_shared_nonpic.so): Likewise.
5683         (two_file_shared_mixed.so): Likewise.
5684         (two_file_shared_mixed_1.so): Likewise.
5685         (weak_undef_lib_nonpic.so): Likewise.
5686         (alt/weak_undef_lib_nonpic.so): Likewise.
5687         (tls_test_shared_nonpic.so): Likewise.
5688         * testsuite/Makefile.in: Rebuild.
5689
5690 2011-07-01  Ian Lance Taylor  <iant@google.com>
5691
5692         PR gold/12525
5693         * configure.ac: Test whether static linking works, setting
5694         the automake conditional HAVE_STATIC.
5695         * testsuite/Makefile.am: Disable tests using -static if
5696         HAVE_STATIC is not true.
5697         * configure, testsuite/Makefile.in: Rebuild.
5698
5699 2011-07-01  Ian Lance Taylor  <iant@google.com>
5700
5701         PR gold/12525
5702         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
5703         Assert if we see DW_EH_PE_indirect.
5704         * target.h (Target::ehframe_datarel_base): New function.
5705         (Target::do_ehframe_datarel_base): New target function.
5706         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
5707         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
5708         function.
5709
5710 2011-07-01  Ian Lance Taylor  <iant@google.com>
5711
5712         PR gold/12571
5713         * options.h (class General_options): Add
5714         --ld-generated-unwind-info.
5715         * ehframe.cc (Fde::write): Add address parameter.  Change all
5716         callers.  If associated with PLT, fill in address and size.
5717         (Cie::set_output_offset): Only add merge mapping if there is an
5718         object.
5719         (Cie::write): Add address parameter.  Change all callers.
5720         (Eh_frame::add_ehframe_for_plt): New function.
5721         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
5722         input_offset_ fields into union u_, with new plt field.
5723         (Fde::Fde): Adjust for new union field.
5724         (Fde::Fde) [Output_data version]: New constructor.
5725         (Fde::add_mapping): Only add merge mapping if there is an object.
5726         (class Cie): Update declarations.
5727         (class Eh_frame): Declare add_ehframe_for_plt.
5728         * layout.cc (Layout::layout_eh_frame): Break out code into
5729         make_eh_frame_section, and call it.
5730         (Layout::make_eh_frame_section): New function.
5731         (Layout::add_eh_frame_for_plt): New function.
5732         * layout.h (class Layout): Update declarations.
5733         * merge.cc (Merge_map::add_mapping): Add assertion.
5734         * i386.cc: Include "dwarf.h".
5735         (class Output_data_plt_i386): Make first_plt_entry,
5736         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
5737         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5738         and plt_eh_frame_fde.
5739         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
5740         boundary.  Call add_eh_frame_for_plt if appropriate.
5741         * x86_64.cc: Include "dwarf.h".
5742         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
5743         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
5744         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5745         and plt_eh_frame_fde.
5746         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
5747         appropriate.
5748
5749 2011-06-29  Ian Lance Taylor  <iant@google.com>
5750
5751         PR gold/12629
5752         * object.cc (Sized_relobj_file::layout_section): Change shdr
5753         parameter to be const.
5754         (Sized_relobj_file::layout_eh_frame_section): New function, broken
5755         out of do_layout.
5756         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
5757         appropriate.  Call layout_eh_frame_section.
5758         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
5759         sections.
5760         * object.h (class Sized_relobj_file): Update declarations.
5761
5762 2011-06-29  Ian Lance Taylor  <iant@google.com>
5763
5764         PR gold/12652
5765         * script.cc (Token::integer_value): Accept trailing M/m/K/k
5766         modifier.
5767         (Lex::gather_token): Accept trailing M/m/K/k for integers.
5768
5769 2011-06-29  Ian Lance Taylor  <iant@google.com>
5770
5771         PR gold/12675
5772         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
5773         SHT_X86_64_UNWIND.
5774         * layout.cc (Layout::layout_eh_frame): Likewise.
5775
5776 2011-06-29  Ian Lance Taylor  <iant@google.com>
5777
5778         PR gold/12695
5779         * layout.cc (Layout::symtab_section_shndx): New function.
5780         * layout.h (class Layout): Declare symtab_section_shndx.
5781         * output.cc (Output_section::write_header): Call it.
5782
5783 2011-06-29  Ian Lance Taylor  <iant@google.com>
5784
5785         PR gold/12818
5786         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
5787         symbols which are not used in a relocation.
5788
5789 2011-06-28  Ian Lance Taylor  <iant@google.com>
5790
5791         PR gold/12898
5792         * layout.cc (Layout::segment_precedes): Don't crash if a linker
5793         script create indistinguishable segments.
5794         (Layout::set_segment_offsets): Use stable_sort when sorting
5795         segments.  Pass this to Compare_segments constructor.
5796         * layout.h (class Layout): Make segment_precedes non-static.
5797         (class Compare_segments): Change from struct to class.  Add
5798         layout_ field.  Add constructor.
5799         * script-sections.cc
5800         (Script_sections::attach_sections_using_phdrs_clause): Rename
5801         local orphan to is_orphan.  Don't report failure to put empty
5802         section in segment.  On attachment failure, report name of
5803         section, and attach to first PT_LOAD segment.
5804
5805 2011-06-28  Ian Lance Taylor  <iant@google.com>
5806
5807         PR gold/12934
5808         * target-select.cc (Target_selector::Target_selector): Add
5809         emulation parameter.  Change all callers.
5810         (select_target_by_bfd_name): Rename from select_target_by_name.
5811         Change all callers.
5812         (select_target_by_emulation): New function.
5813         (supported_emulation_names): New function.
5814         * target-select.h (class Target_selector): Add emulation_ field.
5815         Update declarations.
5816         (Target_selector::recognize_by_bfd_name): Rename from
5817         recognize_by_name.  Change all callers.
5818         (Target_selector::supported_bfd_names): Rename from
5819         supported_names.  Change all callers.
5820         (Target_selector::recognize_by_emulation): New function.
5821         (Target_selector::supported_emulations): New function.
5822         (Target_selector::emulation): New function.
5823         (Target_selector::do_recognize_by_bfd_name): Rename from
5824         do_recognize_by_name.  Change all callers.
5825         (Target_selector::do_supported_bfd_names): Rename from
5826         do_supported_names.  Change all callers.
5827         (Target_selector::do_recognize_by_emulation): New function.
5828         (Target_selector::do_supported_emulations): New function.
5829         (select_target_by_bfd_name): Change name in declaration.
5830         (select_target_by_emulation): Declare.
5831         (supported_emulation_names): Declare.
5832         * parameters.cc (parameters_force_valid_target): Try to find
5833         target based on emulation from -m option.
5834         * options.h (class General_options): Change doc string for -m.
5835         * options.cc (help): Print emulations.
5836         (General_options::parse_V): Likewise.
5837         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
5838         Add emulation parameter.  Change all callers.
5839
5840 2011-06-28  Ian Lance Taylor  <iant@google.com>
5841
5842         * target.h (class Target): Add osabi_ field.
5843         (Target::osabi): New function.
5844         (Target::set_osabi): New function.
5845         (Target::Target): Initialize osabi_.
5846         (Target::do_adjust_elf_header): Make pure virtual.
5847         (Sized_target::do_adjust_elf_header): Declare.
5848         * target.cc (Sized_target::do_adjust_elf_header): New function.
5849         (class Sized_target): Instantiate all versions.
5850         * freebsd.h (class Target_freebsd): Remove.
5851         (Target_selector_freebsd::do_recognize): Call set_osabi on
5852         Target.
5853         (Target_selector_freebsd::do_recognize_by_name): Likewise.
5854         (Target_selector_freebsd::set_osabi): Remove.
5855         * i386.cc (class Target_i386): Inherit from Sized_target rather
5856         than Target_freebsd.
5857         * x86_64.cc (class Target_x86_64): Likewise.
5858
5859 2011-06-28  Ian Lance Taylor  <iant@google.com>
5860
5861         * target.h (Target::can_check_for_function_pointers): Rewrite.
5862         Make non-virtual.
5863         (Target::can_icf_inline_merge_sections): Likewise.
5864         (Target::section_may_have_icf_unsafe_poineters): Likewise.
5865         (Target::Target_info): Add can_icf_inline_merge_sections field.
5866         (Target::do_can_check_for_function_pointers): New virtual
5867         function.
5868         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
5869         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
5870         from can_check_for_function_pointers, move in file.
5871         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
5872         section_may_have_icf_unsafe_poineters, move in file.
5873         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
5874         * i386.cc (Target_i386::do_can_check_for_function_pointers):
5875         Rename from can_check_for_function_pointers, move in file.
5876         (Target_i386::can_icf_inline_merge_sections): Remove.
5877         (Target_i386::i386_info): Initialize
5878         can_icf_inline_merge_sections.
5879         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
5880         Initialize can_icf_inline_merge_sections.
5881         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
5882         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
5883         Rename from can_check_for_function_pointers, move in file.
5884         (Target_x86_64::can_icf_inline_merge_sections): Remove.
5885         (Target_x86_64::x86_64_info): Initialize
5886         can_icf_inline_merge_sections.
5887         * testsuite/testfile.cc (Target_test::test_target_info):
5888         Likewise.
5889         * icf.cc (get_section_contents): Correct formatting.
5890
5891 2011-06-27  Ian Lance Taylor  <iant@google.com>
5892
5893         * symtab.cc (Symbol::versioned_name): New function.
5894         (Symbol_table::add_to_final_symtab): Use versioned_name when
5895         appropriate.
5896         (Symbol_table::sized_write_symbol): Likewise.
5897         * symtab.h (class Symbol): Declare versioned_name.
5898         * stringpool.h (class Stringpool_template): Add variant of add
5899         which takes a std::basic_string.
5900         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
5901         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
5902         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
5903         (ver_test_12.o): New target.
5904         * testsuite/Makefile.in: Rebuild.
5905
5906 2011-06-27  Doug Kwan  <dougkwan@google.com>
5907
5908         * arm.cc (Arm_relocate_functions::thm_jump8,
5909         Arm_relocate_functions::thm_jump11): Use a wider signed
5910         type to compute offset.
5911         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
5912         arm_thm_jump8.
5913         * testsuite/Makefile.in: Regenerate.
5914         * testsuite/arm_branch_in_range.sh: Check test results of
5915         arm_thm_jump11 and arm_thm_jump8.
5916         * testsuite/arm_thm_jump11.s: New test source file.
5917         * testsuite/arm_thm_jump11.t: New linker script.
5918         * testsuite/arm_thm_jump8.s: New test source file.
5919         * testsuite/arm_thm_jump8.t: New linker script.
5920
5921 2011-06-24  Ian Lance Taylor  <iant@google.com>
5922
5923         * layout.cc: Include "object.h".
5924         (ctors_sections_in_init_array): New static variable.
5925         (Layout::is_ctors_in_init_array): New function.
5926         (Layout::layout): Add entry to ctors_sections_in_init_array if
5927         appropriate.
5928         * layout.h (class Layout): Declare is_ctors_in_init_array.
5929         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
5930         is_ctors_reverse_view is set.
5931         (Sized_relobj_file::write_sections): Add layout parameter.  Change
5932         all callers.  Set is_ctors_reverse_view field of View_size.
5933         (Sized_relobj_file::reverse_words): New function.
5934         * object.h (Sized_relobj_file::View_size): Add
5935         is_ctors_reverse_view field.
5936         (class Sized_relobj_file): Update declarations.
5937         * testsuite/initpri3.c: New test.
5938         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
5939         initpri3b.
5940         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
5941         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
5942         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
5943         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
5944         * testsuite/Makefile.in: Rebuild.
5945
5946 2011-06-24  Cary Coutant  <ccoutant@google.com>
5947
5948         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
5949         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
5950         (debug_msg_cdebug.err): New targets.
5951         * testsuite/Makefile.in: Regenerate.
5952         * testsuite/debug_msg.sh: Check output of link with compressed debug.
5953         Fix checks for link with shared library.
5954
5955 2011-06-24  Doug Kwan  <dougkwan@google.com>
5956
5957         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
5958         skip empty text sections.
5959         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
5960
5961 2011-06-22  Ian Lance Taylor  <iant@google.com>
5962
5963         PR gold/12910
5964         * options.h (class General_options): Add --ctors-in-init-array.
5965         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
5966         friends as SHT_PROGBITS for merging sections.
5967         (Layout::layout): Remove special handling of .init_array and
5968         friends.  Don't sort if doing relocatable link.  Sort for .ctors
5969         and .dtors if ctors_in_init_array.
5970         (Layout::make_output_section): Force correct section types for
5971         .init_array and friends.  Don't sort if doing relocatable link,
5972         Don't sort .ctors and .dtors if ctors_in_init_array.
5973         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
5974         (Layout::output_section_name): Add relobj parameter.  Change all
5975         callers.  Handle .ctors. and .dtors. in code rather than table.
5976         Handle .ctors and .dtors if ctors_in_init_array.
5977         (Layout::match_file_name): New function, moved from output.cc.
5978         * layout.h (class Layout): Update declarations.
5979         * output.cc: Include "layout.h".
5980         (Input_section_sort_entry::get_priority): New function.
5981         (Input_section_sort_entry::match_file_name): Just call
5982         Layout::match_file_name.
5983         (Output_section::Input_section_sort_init_fini_compare::operator()):
5984         Handle .ctors and .dtors.  Sort by explicit priority rather than
5985         by name.
5986         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
5987         * testsuite/initpri2.c: New test.
5988         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5989         (check_PROGRAMS): Add initpri2.
5990         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5991         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5992         * configure, testsuite/Makefile.in: Rebuild.
5993
5994 2011-06-19  Ian Lance Taylor  <iant@google.com>
5995
5996         PR gold/12880
5997         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5998         .interp section to a PT_INTERP segment even if we have seen a
5999         --dynamic-linker option.  Don't do it if we have seen a PHDRS
6000         clause in a linker script.
6001         (Layout::finalize): Don't create a .interp section if we've
6002         already create a PT_INTERP segment.
6003         (Layout::create_interp): Always call choose_output_section (revert
6004         patch of 2011-06-17).  Don't create PT_INTERP segment.
6005         * script-sections.cc
6006         (Script_sections::create_note_and_tls_segments): Add a .interp
6007         section to a PT_INTERP segment even if we have seen a
6008         --dynamic-linker option.
6009
6010 2011-06-18  Ian Lance Taylor  <iant@google.com>
6011
6012         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
6013         merely because a non-PT_LOAD segment has a dynamic reloc.
6014
6015 2011-06-18  Ian Lance Taylor  <iant@google.com>
6016
6017         * layout.cc (Layout::finish_dynamic_section): Don't create
6018         DT_FLAGS entry if not needed.
6019
6020 2011-06-18  Ian Lance Taylor  <iant@google.com>
6021
6022         PR gold/12745
6023         * layout.cc (Layout::layout_eh_frame): Correct handling of
6024         writable .eh_frame section.
6025
6026 2011-06-17  Ian Lance Taylor  <iant@google.com>
6027
6028         PR gold/12893
6029         * resolve.cc (Symbol_table::resolve): Don't give an error if a
6030         symbol is redefined with the exact same object and value.
6031
6032 2011-06-17  Ian Lance Taylor  <iant@google.com>
6033
6034         PR gold/12880
6035         * layout.h (class Layout): Add interp_segment_ field.
6036         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
6037         (Layout::attach_allocated_section_to_segment): If making shared
6038         library, put .interp section in PT_INTERP segment.
6039         (Layout::finalize): Also call create_interp if -dynamic-linker
6040         option was used.
6041         (Layout::create_interp): Assert that there is no PT_INTERP
6042         segment.  If not using a SECTIONS clause, use make_output_section.
6043         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
6044         * script-sections.cc
6045         (Script_sections::create_note_and_tls_segments): If making shared
6046         library, put .interp section in PT_INTERP segment.
6047
6048 2011-06-17  Ian Lance Taylor  <iant@google.com>
6049
6050         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
6051         when making a shared library.
6052
6053 2011-06-17  Ian Lance Taylor  <iant@google.com>
6054
6055         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
6056         parameter.  Change all callers.  Don't issue warning about PC32
6057         against locally defined symbol.
6058
6059 2011-06-16  Ian Lance Taylor  <iant@google.com>
6060
6061         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
6062         occurs in same object.
6063
6064 2011-06-14  Alan Modra  <amodra@gmail.com>
6065
6066         * po/POTFILES.in: Regenerate.
6067
6068 2011-06-09  Ian Lance Taylor  <iant@google.com>
6069
6070         * script-sections.cc
6071         (Orphan_output_section::set_section_addresses): For a relocatable
6072         link set address to 0.
6073
6074 2011-06-09  Cary Coutant  <ccoutant@google.com>
6075
6076         PR gold/12804
6077         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
6078         used with --compress-debug-sections.
6079         * gold/object.cc (Sized_relobj_file::do_layout): Report
6080         uncompressed size of compressed input sections.
6081
6082 2011-06-08  Cary Coutant  <ccoutant@google.com>
6083
6084         PR gold/12804
6085         * testsuite/two_file_test_2_v1.cc: Change initialization of
6086         v2 to keep it in .data.
6087
6088 2011-06-07  Cary Coutant  <ccoutant@google.com>
6089
6090         * common.cc (Symbol_table::do_allocate_commons_list): Call
6091         gold_fallback.
6092         * errors.cc (Errors::fatal): Adjust call to gold_exit.
6093         (Errors::fallback): New function.
6094         (gold_fallback): New function.
6095         * errors.h (Errors::fallback): New function.
6096         * gold.cc (gold_exit): Change status parameter to enum; adjust
6097         all callers.
6098         (queue_initial_tasks): Call gold_fallback.
6099         * gold.h: Include cstdlib.
6100         (Exit_status): New enum type.
6101         (gold_exit): Change status parameter to enum.
6102         (gold_fallback): New function.
6103         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
6104         (Layout::create_symtab_sections): Likewise.
6105         (Layout::create_shdrs): Likewise.
6106         * main.cc (main): Adjust call to gold_exit.
6107         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
6108         (Output_data_got::add_got_entry_pair): Likewise.
6109         (Output_section::add_input_section): Likewise.
6110         (Output_section::add_output_section_data): Likewise.
6111         (Output_segment::set_section_list_addresses): Likewise.
6112         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
6113
6114 2011-06-07  Cary Coutant  <ccoutant@google.com>
6115
6116         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
6117         for incremental links.
6118         * output.cc (Output_segment::set_section_list_addresses): Remove
6119         FIXME and test for TLS or BSS.
6120
6121 2011-06-07  Cary Coutant  <ccoutant@google.com>
6122
6123         * testsuite/Makefile.am: Add incremental_copy_test,
6124         incremental_common_test_1.
6125         * testsuite/Makefile.in: Regenerate.
6126         * testsuite/common_test_1_v1.c: New source file.
6127         * testsuite/common_test_1_v2.c: New source file.
6128         * testsuite/copy_test_v1.cc: New source file.
6129
6130 2011-06-07  Cary Coutant  <ccoutant@google.com>
6131
6132         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
6133         update, allocate common from bss section's free list.
6134         * incremental-dump.cc (dump_incremental_inputs): Print flag for
6135         linker-defined symbols.
6136         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
6137         Skip GOT and PLT entries that are no longer referenced.
6138         (Output_section_incremental_inputs::write_info_blocks): Mark
6139         linker-defined symbols.
6140         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
6141         * output.cc (Output_section::allocate): New function.
6142         * output.h (Output_section::allocate): New function.
6143         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
6144         linker-defined symbols.
6145         (Symbol::override_base_with_special): Copy is_predefined_ flag.
6146         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
6147         (Symbol::init_base_output_data): Likewise.
6148         (Symbol::init_base_output_segment): Likewise.
6149         (Symbol::init_base_constant): Likewise.
6150         (Sized_symbol::init_output_data): Likewise.
6151         (Sized_symbol::init_output_segment): Likewise.
6152         (Sized_symbol::init_constant): Likewise.
6153         (Symbol_table::do_define_in_output_data): Likewise.
6154         (Symbol_table::do_define_in_output_segment): Likewise.
6155         (Symbol_table::do_define_as_constant): Likewise.
6156         * symtab.h (Symbol::is_predefined): New function.
6157         (Symbol::init_base_output_data): Add is_predefined parameter.
6158         (Symbol::init_base_output_segment): Likewise.
6159         (Symbol::init_base_constant): Likewise.
6160         (Symbol::is_predefined_): New data member.
6161         (Sized_symbol::init_output_data): Add is_predefined parameter.
6162         (Sized_symbol::init_output_segment): Likewise.
6163         (Sized_symbol::init_constant): Likewise.
6164         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
6165
6166 2011-06-07  Cary Coutant  <ccoutant@google.com>
6167
6168         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
6169         instead of emit_copy_reloc.
6170         (Copy_relocs::emit_copy_reloc): Refactor.
6171         (Copy_relocs::make_copy_reloc): New function.
6172         (Copy_relocs::add_copy_reloc): Remove.
6173         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
6174         section.
6175         (Copy_relocs::make_copy_reloc): New function.
6176         (Copy_relocs::add_copy_reloc): Remove.
6177         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
6178         unchanged input files.
6179         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
6180         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
6181         Reserve BSS space for COPY relocations.
6182         (Sized_incremental_binary::do_emit_copy_relocs): New function.
6183         (Output_section_incremental_inputs::write_info_blocks): Record
6184         whether a symbol is copied from a shared object.
6185         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
6186         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
6187         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
6188         (Incremental_input_entry_reader::get_output_symbol_index): Add
6189         is_copy parameter.
6190         (Incremental_binary::emit_copy_relocs): New function.
6191         (Incremental_binary::do_emit_copy_relocs): New function.
6192         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6193         new data member.
6194         (Sized_incremental_binary::add_copy_reloc): New function.
6195         (Sized_incremental_binary::do_emit_copy_relocs): New function.
6196         (Sized_incremental_binary::Copy_reloc): New struct.
6197         (Sized_incremental_binary::Copy_relocs): New typedef.
6198         (Sized_incremental_binary::copy_relocs_): New data member.
6199         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
6200         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
6201         * target.h (Sized_target::emit_copy_reloc): New function.
6202         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
6203
6204 2011-06-02  Cary Coutant  <ccoutant@google.com>
6205
6206         PR gold/12163
6207         * gold/archive.cc (Archive::Archive): Initialize new data member.
6208         (Archive::include_all_members): Return if archive has already been
6209         included.
6210         * gold/archive.h (Archive::include_all_members_): New data member.
6211
6212 2011-06-02  Nick Clifton  <nickc@redhat.com>
6213
6214         * dynobj.h: Fix spelling mistake in comment.
6215         * output.cc: Likewise.
6216
6217 2011-05-31  Doug Kwan  <dougkwan@google.com>
6218             Asier Llano
6219
6220         PR gold/12826
6221         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
6222         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
6223         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
6224         redundant arm_exidx_test.so.
6225         * testsuite/Makefile.in: Regenerate.
6226         (check_SCRIPTS): Add pr12826.sh
6227         (check_DATA): Add pr12826.stdout
6228         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
6229         * testsuite/pr12826.sh: New file.
6230         * testsuite/pr12826_1.s: Ditto.
6231         * testsuite/pr12826_1.s: Ditto.
6232
6233 2011-05-30  Ian Lance Taylor  <iant@google.com>
6234
6235         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
6236         sections.
6237
6238 2011-05-29  Ian Lance Taylor  <iant@google.com>
6239
6240         PR gold/12804
6241         * testsuite/Makefile.am: Use different file name for two_file_test
6242         temporary file for each incremental test.
6243         * testsuite/Makefile.in: Rebuild.
6244
6245 2011-05-29  Ian Lance Taylor  <iant@google.com>
6246
6247         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
6248         binary input file is empty.
6249
6250 2011-05-27  Ian Lance Taylor  <iant@google.com>
6251
6252         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
6253         (ver_test_9.so): Likewise.
6254         * testsuite/Makefile.in: Rebuild.
6255
6256 2011-05-26 Cary Coutant  <ccoutant@google.com>
6257
6258         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
6259         * incremental.cc (Incremental_inputs::report_input_section): Fix
6260         comment, indentation.
6261         (Incremental_inputs::report_comdat_group): New function.
6262         (Output_section_incremental_inputs::set_final_data_size): Adjust size
6263         of data for incremental input file entry.
6264         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
6265         group count, COMDAT group signatures.
6266         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
6267         an unchanged input file.
6268         * incremental.h (Incremental_object_entry::Incremental_object_entry):
6269         Initialize new data member.
6270         (Incremental_object_entry::add_comdat_group): New function.
6271         (Incremental_object_entry::get_comdat_group_count): New function.
6272         (Incremental_object_entry::get_comdat_signature_key): New function.
6273         (Incremental_object_entry::groups_): New data member.
6274         (Incremental_inputs::report_comdat_group): New function.
6275         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
6276         data for incremental input file entry.
6277         (Incremental_input_entry_reader::get_comdat_group_count): New function.
6278         (Incremental_input_entry_reader::get_input_section): Adjust size of
6279         data for incremental input file entry.
6280         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
6281         (Incremental_input_entry_reader::get_comdat_group_signature): New
6282         function.
6283         * object.cc (Sized_relobj::include_section_group): Report kept
6284         COMDAT groups for incremental links.
6285
6286 2011-05-24  David Meyer  <pdox@google.com>
6287
6288         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
6289         with name parameter.  Add found_name parameter.
6290         * fileread.cc (Input_file::find_file): Adjust code accordingly.
6291         * dirsearch.h (class Dirsearch): Update declaration.
6292
6293 2011-05-24  Ian Lance Taylor  <iant@google.com>
6294
6295         * archive.cc (Library_base::should_include_member): Pull in object
6296         from archive if it defines the entry symbol.
6297         * parameters.cc (Parameters::entry): New function.
6298         * parameters.h (class Parameters): Declare entry.
6299         * output.h (class Output_file_header): Remove entry_ field.
6300         * output.cc (Output_file_header::Output_file_header): Remove entry
6301         parameter.  Change all callers.
6302         (Output_file_header::entry): Use parameters->entry.
6303         * gold.cc (queue_middle_tasks): Likewise.
6304         * plugin.cc (Plugin_hook::run): Likewise.
6305
6306 2011-05-24 Cary Coutant  <ccoutant@google.com>
6307
6308         * gold.cc (queue_initial_tasks): Pass incremental base filename
6309         to Output_file::open_base_file; don't print error message.
6310         * incremental-dump.cc (main): Adjust call to
6311         Output_file::open_for_modification.
6312         * incremental-dump.cc (main): Likewise.
6313         * incremental.cc (Incremental_inputs::report_command_line):
6314         Ignore --incremental-base option when comparing command lines.
6315         Ignore parameter when given as separate argument.
6316         * options.h (class General_options): Add --incremental-base.
6317         * output.cc (Output_file::Output_file):
6318         (Output_file::open_base_file): Add base_name and writable parameters;
6319         read base file into new file; print error message here.
6320         (Output_file::map_no_anonymous): Add writable parameter; adjust all
6321         callers.
6322         * output.h (Output_file::open_for_modification): Rename to...
6323         (Output_file::open_base_file): ...this; add base_name and
6324         writable parameters; adjust all callers.
6325         (Output_file::map_no_anonymous): Add writable parameter; adjust all
6326         callers.
6327         * testsuite/Makefile.am (incremental_test_4): Test
6328         --incremental-base.
6329         * testsuite/Makefile.in: Regenerate.
6330
6331 2011-05-24 Cary Coutant  <ccoutant@google.com>
6332
6333         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
6334         incremental_test_4.
6335         * testsuite/Makefile.in: Regenerate.
6336         * testsuite/two_file_test_1_v1.cc: New test source file.
6337         * testsuite/two_file_test_1b_v1.cc: New test source file.
6338         * testsuite/two_file_test_2_v1.cc: New test source file.
6339
6340 2011-05-24 Cary Coutant  <ccoutant@google.com>
6341
6342         * dynobj.h (Dynobj::do_dynobj): New function.
6343         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
6344         flag and soname for shared objects.
6345         * incremental.cc (Incremental_inputs::report_object): Make
6346         either Incremental_object_entry or Incremental_dynobj_entry; add
6347         soname to string table.
6348         (Incremental_inputs::report_input_section): Add assertion.
6349         (Output_section_incremental_inputs::set_final_data_size): Adjust
6350         type of input file entry for shared libraries; adjust size of
6351         shared library info entry.
6352         (Output_section_incremental_inputs::write_input_files): Write
6353         as_needed flag for shared libraries.
6354         (Output_section_incremental_inputs::write_info_blocks): Adjust type
6355         of input file entry for shared libraries; write soname.
6356         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
6357         soname from incremental info.
6358         * incremental.h (enum Incremental_input_flags): Add
6359         INCREMENTAL_INPUT_AS_NEEDED.
6360         (Incremental_input_entry::Incremental_input_entry): Initialize new
6361         data member.
6362         (Incremental_input_entry::set_as_needed): New function.
6363         (Incremental_input_entry::as_needed): New function.
6364         (Incremental_input_entry::do_dynobj_entry): New function.
6365         (Incremental_input_entry::as_needed_): New data member.
6366         (Incremental_object_entry::Incremental_object_entry): Don't check
6367         for shared library.
6368         (Incremental_object_entry::do_type): Likewise.
6369         (class Incremental_dynobj_entry): New class.
6370         (Incremental_input_entry_reader::as_needed): New function.
6371         (Incremental_input_entry_reader::get_soname): New function.
6372         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
6373         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
6374         size of shared library info entry.
6375         * layout.cc (Layout::finish_dynamic_section): Don't test for
6376         incremental link when adding DT_NEEDED entries.
6377         * object.h (Object::Object): Initialize new data member.
6378         (Object::dynobj): New function.
6379         (Object::set_as_needed): New function.
6380         (Object::as_needed): New function.
6381         (Object::do_dynobj): New function.
6382         (Object::as_needed_): New data member.
6383
6384 2011-05-24 Cary Coutant  <ccoutant@google.com>
6385
6386         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
6387         info; adjust display of GOT entries.
6388         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6389         vector of input objects; remove file_status_.
6390         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
6391         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
6392         got_plt reader; call target hooks to reserve GOT entries.
6393         (Output_section_incremental_inputs::set_final_data_size): Adjust size
6394         of input file info header and GOT info entry.
6395         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
6396         relocation info.
6397         (Got_plt_view_info::got_descriptor): Remove.
6398         (Got_plt_view_info::sym_index): New data member.
6399         (Got_plt_view_info::input_index): New data member.
6400         (Local_got_offset_visitor::visit): Write input file index.
6401         (Global_got_offset_visitor::visit): Write 0 for input file index.
6402         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
6403         with sym_index and input_index.
6404         (Output_section_incremental_inputs::write_got_plt): Adjust size of
6405         incremental info GOT entry; replace got_descriptor with input_index.
6406         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
6407         map from input file index to object.
6408         (Sized_relobj_incr::do_layout): Replace direct data member reference
6409         with accessor function.
6410         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
6411         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
6412         Adjust size of input file info header.
6413         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
6414         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
6415         (Incremental_input_entry_reader::get_input_section): Adjust size of
6416         input file info header.
6417         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
6418         of incremental info GOT entry.
6419         (Incremental_got_plt_reader::get_got_desc): Remove.
6420         (Incremental_got_plt_reader::get_got_symndx): New function.
6421         (Incremental_got_plt_reader::get_got_input_index): New function.
6422         (Sized_incremental_binary::Sized_incremental_binary): Remove
6423         file_status_; add input_objects_.
6424         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
6425         (Sized_incremental_binary::set_file_is_unchanged): Remove.
6426         (Sized_incremental_binary::file_is_unchanged): Remove.
6427         (Sized_incremental_binary::set_input_object): New function.
6428         (Sized_incremental_binary::input_object): New function.
6429         (Sized_incremental_binary::file_status_): Remove.
6430         (Sized_incremental_binary::input_objects_): New data member.
6431         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
6432         references.
6433         (Sized_relobj_incr::invalid_address): Move to base class.
6434         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
6435         class.
6436         (Sized_relobj_incr::do_output_section_offset): Likewise.
6437         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
6438         (Sized_relobj_incr::section_offsets_): Likewise.
6439         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
6440         function.
6441         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
6442         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
6443         with accessor function.
6444         (Sized_relobj_file::do_layout): Likewise.
6445         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
6446         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
6447         (Sized_relobj_file::compute_final_local_value): Replace refs to
6448         section_offsets_ with accessor function.
6449         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
6450         * object.h (Relobj::Relobj): Initialize new data members.
6451         (Relobj::add_dyn_reloc): New function.
6452         (Relobj::first_dyn_reloc): New function.
6453         (Relobj::dyn_reloc_count): New function.
6454         (Relobj::first_dyn_reloc_): New data member.
6455         (Relobj::dyn_reloc_count_): New data member.
6456         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
6457         references.
6458         (Sized_relobj::Address): New typedef.
6459         (Sized_relobj::invalid_address): Move here from child class.
6460         (Sized_relobj::Sized_relobj): Initialize new data members.
6461         (Sized_relobj::sized_relobj): New function.
6462         (Sized_relobj::is_output_section_offset_invalid): Move here from
6463         child class.
6464         (Sized_relobj::get_output_section_offset): Likewise.
6465         (Sized_relobj::local_has_got_offset): Likewise.
6466         (Sized_relobj::local_got_offset): Likewise.
6467         (Sized_relobj::set_local_got_offset): Likewise.
6468         (Sized_relobj::do_for_all_local_got_entries): Likewise.
6469         (Sized_relobj::clear_got_offsets): New function.
6470         (Sized_relobj::section_offsets): Move here from child class.
6471         (Sized_relobj::do_output_section_offset): Likewise.
6472         (Sized_relobj::do_set_section_offset): Likewise.
6473         (Sized_relobj::Local_got_offsets): Likewise.
6474         (Sized_relobj::local_got_offsets_): Likewise.
6475         (Sized_relobj::section_offsets_): Likewise.
6476         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
6477         references.
6478         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
6479         class.
6480         (Sized_relobj_file::sized_relobj): New function
6481         (Sized_relobj_file::local_has_got_offset): Move to base class.
6482         (Sized_relobj_file::local_got_offset): Likewise.
6483         (Sized_relobj_file::set_local_got_offset): Likewise.
6484         (Sized_relobj_file::get_output_section_offset): Likewise.
6485         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
6486         (Sized_relobj_file::do_output_section_offset): Likewise.
6487         (Sized_relobj_file::do_set_section_offset): Likewise.
6488         (Sized_relobj_file::Local_got_offsets): Likewise.
6489         (Sized_relobj_file::local_got_offsets_): Likewise.
6490         (Sized_relobj_file::section_offsets_): Likewise.
6491         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
6492         (all constructors).
6493         (set_needs_dynsym_index): Convert relobj to derived class pointer.
6494         (Output_reloc::get_symbol_index): Likewise.
6495         (Output_reloc::local_section_offset): Likewise.
6496         (Output_reloc::get_address): Likewise.
6497         (Output_reloc::symbol_value): Likewise.
6498         (Output_data_got::reserve_slot): Move to class definition.
6499         (Output_data_got::reserve_local): New function.
6500         (Output_data_got::reserve_slot_for_global): Remove.
6501         (Output_data_got::reserve_global): New function.
6502         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
6503         (all constructors, two instantiations).
6504         (Output_reloc::get_relobj): New function (two instantiations).
6505         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
6506         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
6507         (Output_data_reloc::add_global): Adjust type of relobj.
6508         (Output_data_reloc::add_global_relative): Likewise.
6509         (Output_data_reloc::add_symbolless_global_addend): Likewise.
6510         (Output_data_reloc::add_local): Likewise.
6511         (Output_data_reloc::add_local_relative): Likewise.
6512         (Output_data_reloc::add_symbolless_local_addend): Likewise.
6513         (Output_data_reloc::add_local_section): Likewise.
6514         (Output_data_reloc::add_output_section): Likewise.
6515         (Output_data_reloc::add_absolute): Likewise.
6516         (Output_data_reloc::add_target_specific): Likewise.
6517         (Output_data_got::reserve_slot): Move definition here.
6518         (Output_data_got::reserve_local): New function.
6519         (Output_data_got::reserve_global): New function.
6520         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
6521         section_offsets_ with accessor function.
6522         (Sized_relobj_file::write_sections): Likewise.
6523         (Sized_relobj_file::do_relocate_sections): Likewise.
6524         * target.h (Sized_target::reserve_local_got_entry): New function.
6525         (Sized_target::reserve_global_got_entry): New function.
6526         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
6527         (Target_x86_64::reserve_global_got_entry): New function.
6528         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
6529
6530 2011-05-23 Cary Coutant  <ccoutant@google.com>
6531
6532         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
6533         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
6534         bit when checking got_type.
6535         * incremental.cc (Sized_incremental_binary::setup_readers):
6536         Store symbol table and string table locations; initialize bit vector
6537         of file status flags.
6538         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
6539         unchanged files.
6540         (Sized_incremental_binary::do_process_got_plt): New function.
6541         (Sized_incremental_binary::get_symtab_view): Use stored locations.
6542         (Output_section_incremental_inputs::set_final_data_size): Record
6543         file index for each input file.
6544         (Output_section_incremental_inputs::write_got_plt): Store file index
6545         instead of input entry offset for each GOT entry.
6546         * incremental.h
6547         (Incremental_input_entry::Incremental_input_entry): Initialize new
6548         data member.
6549         (Incremental_input_entry::set_offset): Store file index.
6550         (Incremental_input_entry::get_file_index): New function.
6551         (Incremental_input_entry::file_index_): New data member.
6552         (Incremental_binary::process_got_plt): New function.
6553         (Incremental_binary::do_process_got_plt): New function.
6554         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6555         data members.
6556         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
6557         (Sized_incremental_binary::set_file_is_unchanged): New function.
6558         (Sized_incremental_binary::file_is_unchanged): New function.
6559         (Sized_incremental_binary::do_process_got_plt): New function.
6560         (Sized_incremental_binary::file_status_): New data member.
6561         (Sized_incremental_binary::main_symtab_loc_): New data member.
6562         (Sized_incremental_binary::main_strtab_loc_): New data member.
6563         * output.cc (Output_data_got::Got_entry::write): Add case
6564         RESERVED_CODE.
6565         (Output_data_got::add_global): Call add_got_entry.
6566         (Output_data_got::add_global_plt): Likewise.
6567         (Output_data_got::add_global_with_rel): Likewise.
6568         (Output_data_got::add_global_with_rela): Likewise.
6569         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
6570         (Output_data_got::add_global_pair_with_rela): Likewise.
6571         (Output_data_got::add_local): Call add_got_entry.
6572         (Output_data_got::add_local_plt): Likewise.
6573         (Output_data_got::add_local_with_rel): Likewise.
6574         (Output_data_got::add_local_with_rela): Likewise.
6575         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
6576         (Output_data_got::add_local_pair_with_rela): Likewise.
6577         (Output_data_got::reserve_slot): New function.
6578         (Output_data_got::reserve_slot_for_global): New function.
6579         (Output_data_got::add_got_entry): New function.
6580         (Output_data_got::add_got_entry_pair): New function.
6581         (Output_section::add_output_section_data): Edit FIXME.
6582         * output.h
6583         (Output_section_data_build::Output_section_data_build): New
6584         constructor with size parameter.
6585         (Output_data_space::Output_data_space): Likewise.
6586         (Output_data_got::Output_data_got): Initialize new data member; new
6587         constructor with size parameter.
6588         (Output_data_got::add_constant): Call add_got_entry.
6589         (Output_data_got::reserve_slot): New function.
6590         (Output_data_got::reserve_slot_for_global): New function.
6591         (class Output_data_got::Got_entry): Add RESERVED_CODE.
6592         (Output_data_got::add_got_entry): New function.
6593         (Output_data_got::add_got_entry_pair): New function.
6594         (Output_data_got::free_list_): New data member.
6595         * target.h (Sized_target::init_got_plt_for_update): New function.
6596         (Sized_target::register_global_plt_entry): New function.
6597         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
6598         Initialize new data member; call init; add constructor with PLT count.
6599         (Output_data_plt_x86_64::init): New function.
6600         (Output_data_plt_x86_64::add_relocation): New function.
6601         (Output_data_plt_x86_64::reserve_slot): New function.
6602         (Output_data_plt_x86_64::free_list_): New data member.
6603         (Target_x86_64::init_got_plt_for_update): New function.
6604         (Target_x86_64::register_global_plt_entry): New function.
6605         (Output_data_plt_x86_64::add_entry): Allocate from free list for
6606         incremental updates.
6607         (Output_data_plt_x86_64::add_relocation): New function.
6608         * testsuite/object_unittest.cc (Object_test): Set default options.
6609
6610 2011-05-16  Ian Lance Taylor  <iant@google.com>
6611
6612         * options.h (class General_options): Make -i a synonym for -r.
6613
6614 2011-05-16  Ian Lance Taylor  <iant@google.com>
6615
6616         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
6617
6618 2011-05-10 Cary Coutant  <ccoutant@google.com>
6619
6620         * object.cc (Sized_relobj::do_count_local_symbols): Check for
6621         strip_all (-s).
6622
6623 2011-05-06  Ian Lance Taylor  <iant@google.com>
6624
6625         * layout.cc (Layout::layout): If the output section flags change,
6626         update the ordering.
6627
6628 2011-04-25 Cary Coutant  <ccoutant@google.com>
6629
6630         * incremental-dump.cc (dump_incremental_inputs): Print local
6631         symbol info for each input file.
6632         * incremental.cc
6633         (Output_section_incremental_inputs::set_final_data_size): Add local
6634         symbol info to input file entries in incremental info.
6635         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6636         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
6637         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
6638         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
6639         implementation.
6640         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
6641         (Sized_incr_relobj::do_relocate): Write the local symbols.
6642         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
6643         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
6644         Adjust size of input file header.
6645         (Incremental_inputs_reader::get_local_symbol_offset): New function.
6646         (Incremental_inputs_reader::get_local_symbol_count): New function.
6647         (Incremental_inputs_reader::get_input_section): Adjust size of input
6648         file header.
6649         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
6650         (Sized_incr_relobj::This): New typedef.
6651         (Sized_incr_relobj::sym_size): New const data member.
6652         (Sized_incr_relobj::Local_symbol): New struct.
6653         (Sized_incr_relobj::do_output_local_symbol_count): New function.
6654         (Sized_incr_relobj::do_local_symbol_offset): New function.
6655         (Sized_incr_relobj::local_symbol_count_): New data member.
6656         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
6657         (Sized_incr_relobj::local_symbol_index_): New data member.
6658         (Sized_incr_relobj::local_symbol_offset_): New data member.
6659         (Sized_incr_relobj::local_dynsym_offset_): New data member.
6660         (Sized_incr_relobj::local_symbols_): New data member.
6661         * object.h (Relobj::output_local_symbol_count): New function.
6662         (Relobj::local_symbol_offset): New function.
6663         (Relobj::do_output_local_symbol_count): New function.
6664         (Relobj::do_local_symbol_offset): New function.
6665         (Sized_relobj::do_output_local_symbol_count): New function.
6666         (Sized_relobj::do_local_symbol_offset): New function.
6667
6668 2011-04-22  Vladimir Simonov  <sv@sw.ru>
6669
6670         * descriptors.cc (set_close_on_exec): New function.
6671         (Descriptors::open): Use set_close_on_exec.
6672         * output.cc (S_ISLNK): Define if not defined.
6673
6674 2011-04-22 Cary Coutant  <ccoutant@google.com>
6675
6676         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6677         global symbol map.
6678         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6679         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
6680         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
6681         relocations.
6682         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
6683         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
6684         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
6685         * incremental.h
6686         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
6687         function.
6688         (Incremental_binary::apply_incremental_relocs): New function.
6689         (Incremental_binary::do_apply_incremental_relocs): New function.
6690         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6691         data member.
6692         (Sized_incremental_binary::add_global_symbol): New function.
6693         (Sized_incremental_binary::global_symbol): New function.
6694         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6695         (Sized_incremental_binary::symbol_map_): New data member.
6696         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
6697         * target.h (Sized_target::apply_relocation): New function.
6698         * target-reloc.h (apply_relocation): New function.
6699         * x86_64.cc (Target_x86_64::apply_relocation): New function.
6700
6701 2011-04-22  Doug Kwan  <dougkwan@google.com>
6702
6703         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
6704         flag of a SHT_ARM_EXIDX section.
6705         * testsuite/Makefile.am (arm_exidx_test): New test rules.
6706         * testsuite/Makefile.in: Regenerate.
6707         * testsuite/arm_exidx_test.s: New file.
6708         * testsuite/arm_exidx_test.sh: Same.
6709
6710 2011-04-20 Cary Coutant  <ccoutant@google.com>
6711
6712         PR gold/12689
6713         * archive.h (Incremental_archive_entry::Archive_member):
6714         Initialize arg_serial_ (second constructor).
6715
6716 2011-04-17  Ian Lance Taylor  <iant@google.com>
6717
6718         * object.cc (Relocate_info::location): Simplify location string.
6719         * errors.cc (Errors::error_at_location): Don't print program
6720         name.
6721         (Errors::warning_at_location): Likewise.
6722         (Errors::undefined_symbol): Likewise.
6723         * testsuite/debug_msg.sh: Update accordingly.
6724
6725 2011-04-14 Cary Coutant  <ccoutant@google.com>
6726
6727         * gold/layout.cc (Layout::symtab_section_offset): New function.
6728         * gold/layout.h (Layout::symtab_section_offset): New function.
6729         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
6730
6731 2011-04-12  Ian Lance Taylor  <iant@google.com>
6732
6733         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
6734         with MREMAP_MAYMOVE.
6735         * output.h (class Output_file): Add map_is_allocated_ field.
6736         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
6737         not available, provide stubs.  If mremap is not available, #define
6738         it to gold_mremap.
6739         (MREMAP_MAYMOVE): Define if not defined.
6740         (Output_file::Output_file): Initialize map_is_allocated_.
6741         (Output_file::resize): Check map_is_allocated_.
6742         (Output_file::map_anonymous): If mmap fails, use malloc.
6743         (Output_file::unmap): Don't do anything for an anonymous map.
6744         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
6745         is not available, provide stubs.
6746         (File_read::View::~View): Use free rather than delete[].
6747         (File_read::make_view): Use malloc rather than new[].  If mmap
6748         fails, use malloc.
6749         (File_read::find_or_make_view): Use malloc rather than new[].
6750         * gold.h: Remove HAVE_REMAP code.
6751         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
6752         exists.  Rename mremap to gold_mremap.  If mmap is not available
6753         don't do anything.
6754         * configure, config.in: Rebuild.
6755
6756 2011-04-11  Ian Lance Taylor  <iant@google.com>
6757
6758         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
6759         initialize local variable v.
6760
6761 2011-04-11  Cary Coutant  <ccoutant@google.com>
6762
6763         * archive.cc (Archive::include_member): Adjust call to
6764         report_object.
6765         (Add_archive_symbols::run): Track argument serial numbers.
6766         (Lib_group::include_member): Likewise.
6767         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
6768         * archive.h (Incremental_archive_entry::Archive_member):
6769         Initialize arg_serial_.
6770         (Archive_member::arg_serial_): New data member.
6771         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
6772         (Sized_dynobj::do_add_symbols): Track symbols when doing an
6773         incremental link.
6774         (Sized_dynobj::do_for_all_local_got_entries): New function.
6775         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
6776         function.
6777         * fileread.cc (get_mtime): New function.
6778         * fileread.h (get_mtime): New function.
6779         * gold.cc (queue_initial_tasks): Check for incremental update.
6780         (process_incremental_input): New function.
6781         (queue_middle_tasks): Don't force valid target for incremental
6782         update.
6783         * incremental-dump.cc (find_input_containing_global): Adjust
6784         size of symbol info entry.
6785         (dump_incremental_inputs): Dump argument serial number and
6786         in_system_directory flag; bias shndx by 1; print symbol names
6787         when dumping per-file symbol lists; use new symbol info readers.
6788         * incremental.cc
6789         (Output_section_incremental_inputs:update_data_size): New function.
6790         (Sized_incremental_binary::setup_readers): Setup input readers
6791         for each input file; build maps for files added from libraries
6792         and scripts.
6793         (Sized_incremental_binary::check_input_args): New function.
6794         (Sized_incremental_binary::do_check_inputs): Build map of argument
6795         serial numbers to input arguments.
6796         (Sized_incremental_binary::do_file_has_changed): Rename
6797         do_file_is_unchanged to this; compare file modification times.
6798         (Sized_incremental_binary::do_init_layout): New function.
6799         (Sized_incremental_binary::do_reserve_layout): New function.
6800         (Sized_incremental_binary::do_get_input_reader): Remove.
6801         (Sized_incremental_binary::get_symtab_view): New function.
6802         (Incremental_checker::can_incrementally_link_output_file): Remove.
6803         (Incremental_inputs::report_command_line): Exclude --debug options.
6804         (Incremental_inputs::report_archive_begin): Add parameter; track
6805         argument serial numbers; don't put input file entry for archive
6806         before archive members.
6807         (Incremental_inputs::report_archive_end): Put input file entry
6808         for archive after archive members.
6809         (Incremental_inputs::report_object): Add parameter; track argument
6810         serial numbers and in_system_directory flag.
6811         (Incremental_inputs::report_script): Add parameter; track argument
6812         serial numbers.
6813         (Output_section_incremental_inputs::set_final_data_size): Adjust
6814         size of symbol info entry; check for forwarding symbols.
6815         (Output_section_incremental_inputs::write_input_files): Write
6816         in_system_directory flag and argument serial number.
6817         (Output_section_incremental_inputs::write_info_blocks): Map section
6818         indices between incremental info and original input file; store
6819         input section index for each symbol.
6820         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
6821         change operator() to visit().
6822         (class Global_got_offset_visitor): Likewise.
6823         (class Global_symbol_visitor_got_plt):
6824         (Output_section_incremental_inputs::write_got_plt): Use new visitor
6825         classes.
6826         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
6827         (Sized_incr_relobj::do_read_symbols): New function.
6828         (Sized_incr_relobj::do_layout): New function.
6829         (Sized_incr_relobj::do_layout_deferred_sections): New function.
6830         (Sized_incr_relobj::do_add_symbols): New function.
6831         (Sized_incr_relobj::do_should_include_member): New function.
6832         (Sized_incr_relobj::do_for_all_global_symbols): New function.
6833         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
6834         (Sized_incr_relobj::do_section_size): New function.
6835         (Sized_incr_relobj::do_section_name): New function.
6836         (Sized_incr_relobj::do_section_contents): New function.
6837         (Sized_incr_relobj::do_section_flags): New function.
6838         (Sized_incr_relobj::do_section_entsize): New function.
6839         (Sized_incr_relobj::do_section_address): New function.
6840         (Sized_incr_relobj::do_section_type): New function.
6841         (Sized_incr_relobj::do_section_link): New function.
6842         (Sized_incr_relobj::do_section_info): New function.
6843         (Sized_incr_relobj::do_section_addralign): New function.
6844         (Sized_incr_relobj::do_initialize_xindex): New function.
6845         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
6846         (Sized_incr_relobj::do_read_relocs): New function.
6847         (Sized_incr_relobj::do_gc_process_relocs): New function.
6848         (Sized_incr_relobj::do_scan_relocs): New function.
6849         (Sized_incr_relobj::do_count_local_symbols): New function.
6850         (Sized_incr_relobj::do_finalize_local_symbols): New function.
6851         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
6852         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
6853         (Sized_incr_relobj::do_relocate): New function.
6854         (Sized_incr_relobj::do_set_section_offset): New function.
6855         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
6856         (Sized_incr_dynobj::do_read_symbols): New function.
6857         (Sized_incr_dynobj::do_layout): New function.
6858         (Sized_incr_dynobj::do_add_symbols): New function.
6859         (Sized_incr_dynobj::do_should_include_member): New function.
6860         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
6861         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
6862         (Sized_incr_dynobj::do_section_size): New function.
6863         (Sized_incr_dynobj::do_section_name): New function.
6864         (Sized_incr_dynobj::do_section_contents): New function.
6865         (Sized_incr_dynobj::do_section_flags): New function.
6866         (Sized_incr_dynobj::do_section_entsize): New function.
6867         (Sized_incr_dynobj::do_section_address): New function.
6868         (Sized_incr_dynobj::do_section_type): New function.
6869         (Sized_incr_dynobj::do_section_link): New function.
6870         (Sized_incr_dynobj::do_section_info): New function.
6871         (Sized_incr_dynobj::do_section_addralign): New function.
6872         (Sized_incr_dynobj::do_initialize_xindex): New function.
6873         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
6874         (make_sized_incremental_object): New function.
6875         (Incremental_library::copy_unused_symbols): New function.
6876         (Incremental_library::do_for_all_unused_symbols): New function.
6877         * incremental.h (enum Incremental_input_flags): New type.
6878         (class Incremental_checker): Remove.
6879         (Incremental_input_entry::Incremental_input_entry): Add argument
6880         serial number.
6881         (Incremental_input_entry::arg_serial): New function.
6882         (Incremental_input_entry::set_is_in_system_directory): New function.
6883         (Incremental_input_entry::is_in_system_directory): New function.
6884         (Incremental_input_entry::arg_serial_): New data member.
6885         (Incremental_input_entry::is_in_system_directory_): New data member.
6886         (class Script_info): Move here from script.h.
6887         (Script_info::Script_info): Add filename parameter.
6888         (Script_info::filename): New function.
6889         (Script_info::filename_): New data member.
6890         (Incremental_script_entry::Incremental_script_entry): Add argument
6891         serial number.
6892         (Incremental_object_entry::Incremental_object_entry): Likewise.
6893         (Incremental_object_entry::add_input_section): Build list of input
6894         sections with map to original shndx.
6895         (Incremental_object_entry::get_input_section_index): New function.
6896         (Incremental_object_entry::shndx_): New data member.
6897         (Incremental_object_entry::name_key_): Rename; adjust all refs.
6898         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
6899         (Incremental_archive_entry::Incremental_archive_entry): Add argument
6900         serial number.
6901         (Incremental_inputs::report_archive_begin): Likewise.
6902         (Incremental_inputs::report_object): Likewise.
6903         (Incremental_inputs::report_script): Likewise.
6904         (class Incremental_global_symbol_reader): New class.
6905         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
6906         and store flags and input file type.
6907         (Incremental_input_entry_reader::arg_serial): New function.
6908         (Incremental_input_entry_reader::type): Extract type from flags.
6909         (Incremental_input_entry_reader::is_in_system_directory): New function.
6910         (Incremental_input_entry_reader::get_input_section_count): Call
6911         accessor function for type.
6912         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
6913         function for type; adjust size of global symbol entry.
6914         (Incremental_input_entry_reader::get_global_symbol_count): Call
6915         accessor function for type.
6916         (Incremental_input_entry_reader::get_object_count): Likewise.
6917         (Incremental_input_entry_reader::get_object_offset): Likewise.
6918         (Incremental_input_entry_reader::get_member_count): Likewise.
6919         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
6920         (Incremental_input_entry_reader::get_member_offset): Likewise.
6921         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
6922         (Incremental_input_entry_reader::Global_symbol_info): Remove.
6923         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
6924         (Incremental_input_entry_reader::get_global_symbol_reader): New
6925         function.
6926         (Incremental_input_entry_reader::get_output_symbol_index): New
6927         function.
6928         (Incremental_input_entry_reader::type_): Remove.
6929         (Incremental_input_entry_reader::flags_): New data member.
6930         (Incremental_inputs_reader::input_file_offset): New function.
6931         (Incremental_inputs_reader::input_file_index): New function.
6932         (Incremental_inputs_reader::input_file): Call input_file_offset.
6933         (Incremental_inputs_reader::input_file_at_offset): New function.
6934         (Incremental_relocs_reader::get_r_type): Reformat.
6935         (Incremental_relocs_reader::get_r_shndx): Reformat.
6936         (Incremental_relocs_reader::get_r_offset): Reformat.
6937         (Incremental_relocs_reader::data): New function.
6938         (Incremental_binary::Incremental_binary): Initialize new data members.
6939         (Incremental_binary::check_inputs): Add cmdline parameter.
6940         (Incremental_binary::file_is_unchanged): Remove.
6941         (Input_reader::arg_serial): New function.
6942         (Input_reader::get_unused_symbol_count): New function.
6943         (Input_reader::get_unused_symbol): New function.
6944         (Input_reader::do_arg_serial): New function.
6945         (Input_reader::do_get_unused_symbol_count): New function.
6946         (Input_reader::do_get_unused_symbol): New function.
6947         (Incremental_binary::input_file_count): New function.
6948         (Incremental_binary::get_input_reader): Change signature to use
6949         index instead of filename.
6950         (Incremental_binary::file_has_changed): New function.
6951         (Incremental_binary::get_input_argument): New function.
6952         (Incremental_binary::get_library): New function.
6953         (Incremental_binary::get_script_info): New function.
6954         (Incremental_binary::init_layout): New function.
6955         (Incremental_binary::reserve_layout): New function.
6956         (Incremental_binary::output_file): New function.
6957         (Incremental_binary::do_check_inputs): New function.
6958         (Incremental_binary::do_file_is_unchanged): Remove.
6959         (Incremental_binary::do_file_has_changed): New function.
6960         (Incremental_binary::do_init_layout): New function.
6961         (Incremental_binary::do_reserve_layout): New function.
6962         (Incremental_binary::do_input_file_count): New function.
6963         (Incremental_binary::do_get_input_reader): Change signature.
6964         (Incremental_binary::input_args_map_): New data member.
6965         (Incremental_binary::library_map_): New data member.
6966         (Incremental_binary::script_map_): New data member.
6967         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6968         new data members.
6969         (Sized_incremental_binary::output_section): New function.
6970         (Sized_incremental_binary::inputs_reader): Add const.
6971         (Sized_incremental_binary::symtab_reader): Add const.
6972         (Sized_incremental_binary::relocs_reader): Add const.
6973         (Sized_incremental_binary::got_plt_reader): Add const.
6974         (Sized_incremental_binary::get_symtab_view): New function.
6975         (Sized_incremental_binary::Inputs_reader): New typedef.
6976         (Sized_incremental_binary::Input_entry_reader): New typedef.
6977         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
6978         (Sized_incremental_binary::do_file_is_unchanged): Remove.
6979         (Sized_incremental_binary::do_file_has_changed): New function.
6980         (Sized_incremental_binary::do_init_layout): New function.
6981         (Sized_incremental_binary::do_reserve_layout): New function.
6982         (Sized_input_reader::Inputs_reader): Remove.
6983         (Sized_input_reader::Input_entry_reader): Remove.
6984         (Sized_input_reader::do_arg_serial): New function.
6985         (Sized_input_reader::do_get_unused_symbol_count): New function.
6986         (Sized_input_reader::do_get_unused_symbol): New function.
6987         (Sized_incremental_binary::do_input_file_count): New function.
6988         (Sized_incremental_binary::do_get_input_reader): Change signature;
6989         use index instead of filename.
6990         (Sized_incremental_binary::section_map_): New data member.
6991         (Sized_incremental_binary::input_entry_readers_): New data member.
6992         (class Sized_incr_relobj): New class.
6993         (class Sized_incr_dynobj): New class.
6994         (make_sized_incremental_object): New function.
6995         (class Incremental_library): New class.
6996         * layout.cc (Free_list::num_lists): New static data member.
6997         (Free_list::num_nodes): New static data member.
6998         (Free_list::num_removes): New static data member.
6999         (Free_list::num_remove_visits): New static data member.
7000         (Free_list::num_allocates): New static data member.
7001         (Free_list::num_allocate_visits): New static data member.
7002         (Free_list::init): New function.
7003         (Free_list::remove): New function.
7004         (Free_list::allocate): New function.
7005         (Free_list::dump): New function.
7006         (Free_list::print_stats): New function.
7007         (Layout_task_runner::run): Resize output file for incremental updates.
7008         (Layout::Layout): Initialize new data members.
7009         (Layout::set_incremental_base): New function.
7010         (Layout::init_fixed_output_section): New function.
7011         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
7012         incremental updates.
7013         (Layout::create_gold_note): Do not create gold note section for
7014         incremental updates.
7015         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
7016         for incremental updates.
7017         (Layout::set_section_offsets): For incremental updates, allocate space
7018         from free list.
7019         (Layout::create_symtab_sections): Layout with offsets relative to
7020         start of section; for incremental updates, allocate space from free
7021         list.
7022         (Layout::create_shdrs): For incremental updates, allocate space from
7023         free list.
7024         (Layout::finish_dynamic_section): For incremental updates, do not
7025         check --as-needed (fixed in subsequent patch).
7026         * layout.h (class Free_list): New class.
7027         (Layout::set_incremental_base): New function.
7028         (Layout::incremental_base): New function.
7029         (Layout::init_fixed_output_section): New function.
7030         (Layout::allocate): New function.
7031         (Layout::incremental_base_): New data member.
7032         (Layout::free_list_): New data member.
7033         * main.cc (main): Print Free_list statistics.
7034         * object.cc (Relobj::finalize_incremental_relocs): Add
7035         clear_counts parameter; clear counts only when clear_counts is set.
7036         (Sized_relobj::Sized_relobj): Initialize new base class.
7037         (Sized_relobj::do_layout): Don't report special sections.
7038         (Sized_relobj::do_for_all_local_got_entries): New function.
7039         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
7040         symtab_off to all symbol table offsets.
7041         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
7042         * object.h (class Got_offset_list): Move to top of file.
7043         (Object::Object): Allow case where input_file == NULL.
7044         (Object::~Object): Likewise.
7045         (Object::input_file): Assert that input_file != NULL.
7046         (Object::lock): Allow case where input_file == NULL.
7047         (Object::unlock): Likewise.
7048         (Object::is_locked): Likewise.
7049         (Object::token): Likewise.
7050         (Object::release): Likewise.
7051         (Object::is_incremental): New function.
7052         (Object::get_mtime): New function.
7053         (Object::for_all_local_got_entries): New function.
7054         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
7055         (Object::set_is_in_system_directory): New function.
7056         (Object::is_in_system_directory): New function.
7057         (Object::do_is_incremental): New function.
7058         (Object::do_get_mtime): New function.
7059         (Object::do_for_all_local_got_entries): New function.
7060         (Object::is_in_system_directory_): New data member.
7061         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
7062         (class Sized_relobj_base): New class.
7063         (class Sized_relobj): Derive from Sized_relobj_base.
7064         (class Sized_relobj::Symbols): Redeclare from base class.
7065         (class Sized_relobj::local_got_offset_list): Remove.
7066         (class Sized_relobj::Output_sections): Redeclare from base class.
7067         (class Sized_relobj::do_for_all_local_got_entries): New function.
7068         (class Sized_relobj::write_local_symbols): Add offset parameter.
7069         (class Sized_relobj::local_symbol_offset_): Update comment.
7070         (class Sized_relobj::local_dynsym_offset_): Update comment.
7071         * options.cc (Input_arguments::add_file): Remove const.
7072         * options.h (Input_file_argument::Input_file_argument):
7073         Initialize arg_serial_ (all constructors).
7074         (Input_file_argument::set_arg_serial): New function.
7075         (Input_file_argument::arg_serial): New function.
7076         (Input_file_argument::arg_serial_): New data member.
7077         (Input_arguments::Input_arguments): Initialize file_count_.
7078         (Input_arguments::add_file): Remove const.
7079         (Input_arguments::number_of_input_files): New function.
7080         (Input_arguments::file_count_): New data member.
7081         (Command_line::number_of_input_files): Call
7082         Input_arguments::number_of_input_files.
7083         * output.cc (Output_segment_headers::Output_segment_headers):
7084         Set current size.
7085         (Output_section::Input_section::current_data_size): New function.
7086         (Output_section::Output_section): Initialize new data members.
7087         (Output_section::add_input_section): Don't do merge sections for
7088         an incremental link; allocate space from free list for an
7089         incremental update.
7090         (Output_section::add_output_section_data): Allocate space from
7091         free list for an incremental update.
7092         (Output_section::update_data_size): New function.
7093         (Output_section::set_fixed_layout): New function.
7094         (Output_section::reserve): New function.
7095         (Output_segment::set_section_addresses): Remove const.
7096         (Output_segment::set_section_list_addresses): Remove const; allocate
7097         space from free list for an incremental update.
7098         (Output_segment::set_offset): Adjust size of RELRO segment for an
7099         incremental update.
7100         * output.h (Output_data::current_data_size): Move here from
7101         child classes.
7102         (Output_data::pre_finalize_data_size): New function.
7103         (Output_data::update_data_size): New function.
7104         (Output_section_headers::update_data_size): new function.
7105         (Output_section_data_build::current_data_size): Move to Output_data.
7106         (Output_data_strtab::update_data_size): New function.
7107         (Output_section::current_data_size): Move to Output_data.
7108         (Output_section::set_fixed_layout): New function.
7109         (Output_section::has_fixed_layout): New function.
7110         (Output_section::reserve): New function.
7111         (Output_section::update_data_size): New function.
7112         (Output_section::has_fixed_layout_): New data member.
7113         (Output_section::free_list_): New data member.
7114         (Output_segment::set_section_addresses): Remove const.
7115         (Output_segment::set_section_list_addresses): Remove const.
7116         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
7117         New function.
7118         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
7119         New function.
7120         * readsyms.cc (Read_symbols::do_read_symbols): Add library
7121         parameter when calling Add_symbols constructor; store argument
7122         serial number for members of a lib group.
7123         (Add_symbols::locks): Allow case where token == NULL.
7124         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
7125         (Read_member::~Read_member): New function.
7126         (Read_member::is_runnable): New function.
7127         (Read_member::locks): New function.
7128         (Read_member::run): New function.
7129         (Check_script::~Check_script): New function.
7130         (Check_script::is_runnable): New function.
7131         (Check_script::locks): New function.
7132         (Check_script::run): New function.
7133         (Check_library::~Check_library): New function.
7134         (Check_library::is_runnable): New function.
7135         (Check_library::locks): New function.
7136         (Check_library::run): New function.
7137         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
7138         (Add_symbols::library_): New data member.
7139         (class Read_member): New class.
7140         (class Check_script): New class.
7141         (class Check_library): New class.
7142         * reloc.cc (Read_relocs::is_runnable): Allow case where
7143         token == NULL.
7144         (Read_relocs::locks): Likewise.
7145         (Scan_relocs::locks): Likewise.
7146         (Relocate_task::locks): Likewise.
7147         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
7148         to clear counters.
7149         (Sized_relobj::incremental_relocs_scan): Fix comment.
7150         (Sized_relobj::do_relocate): Pass output file offset to
7151         write_local_symbols.
7152         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
7153         from class declaration.
7154         * script.cc (read_input_script): Allocate Script_info; pass
7155         argument serial number to report_script.
7156         * script.h (class Script_info): Move to incremental.h.
7157         * symtab.cc (Symbol_table::add_from_incrobj): New function.
7158         * symtab.h (Symbol_table::add_from_incrobj): New function.
7159         (Symbol_table::set_file_offset): New function.
7160
7161 2011-04-05  Cary Coutant  <ccoutant@google.com>
7162
7163         * incremental-dump.cc (dump_incremental_inputs): Change signature
7164         to take a Sized_incremental_binary; change caller.  Use readers
7165         in Sized_incremental_binary.
7166         * incremental.cc
7167         (Sized_incremental_binary::find_incremental_inputs_sections):
7168         Rename do_find_incremental_inputs_sections to this.
7169         (Sized_incremental_binary::setup_readers): New function.
7170         (Sized_incremental_binary::do_check_inputs): Check
7171         has_incremental_info_ flag; move setup code to setup_readers;
7172         use input readers.
7173         (Sized_incremental_binary::do_file_is_unchanged): New function.
7174         (Sized_incremental_binary::do_get_input_reader): New function.
7175         * incremental.h (class Incremental_binary): Move to end of file.
7176         (Incremental_binary::file_is_unchanged): New function.
7177         (Incremental_binary::do_file_is_unchanged): New function.
7178         (Incremental_binary::Input_reader): New class.
7179         (Incremental_binary::get_input_reader): New function.
7180         (class Sized_incremental_binary): Move to end of file.
7181         (Sized_incremental_binary::Sized_incremental_binary): Setup the
7182         input section reader classes.
7183         (Sized_incremental_binary::has_incremental_info): New function.
7184         (Sized_incremental_binary::inputs_reader): New function.
7185         (Sized_incremental_binary::symtab_reader): New function.
7186         (Sized_incremental_binary::relocs_reader): New function.
7187         (Sized_incremental_binary::got_plt_reader): New function.
7188         (Sized_incremental_binary::do_file_is_unchanged): New function.
7189         (Sized_incremental_binary::Sized_input_reader): New class.
7190         (Sized_incremental_binary::get_input_reader): New function.
7191         (Sized_incremental_binary::find_incremental_inputs_sections):
7192         Rename do_find_incremental_inputs_sections to this.
7193         (Sized_incremental_binary::setup_readers): New function.
7194         (Sized_incremental_binary::has_incremental_info_): New data member.
7195         (Sized_incremental_binary::inputs_reader_): New data member.
7196         (Sized_incremental_binary::symtab_reader_): New data member.
7197         (Sized_incremental_binary::relocs_reader_): New data member.
7198         (Sized_incremental_binary::got_plt_reader_): New data member.
7199         (Sized_incremental_binary::current_input_file_): New data member.
7200
7201 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
7202
7203         PR gold/12640
7204         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
7205         violation.
7206
7207 2011-03-30  Cary Coutant  <ccoutant@google.com>
7208
7209         * archive.cc (Archive::include_member): Adjust call to report_object.
7210         (Add_archive_symbols::run): Add script_info to call to
7211         report_archive_begin.
7212         (Lib_group::include_member): Adjust call to report_object.
7213         (Add_lib_group_symbols::run): Adjust call to report_object.
7214         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
7215         blocks.  Add object count for script input files.
7216         * incremental.cc (Incremental_inputs::report_archive_begin): Add
7217         script_info parameter; change all callers.
7218         (Incremental_inputs::report_object): Add script_info parameter;
7219         change all callers.
7220         (Incremental_inputs::report_script): Store backpointer to
7221         incremental info entry.
7222         (Output_section_incremental_inputs::set_final_data_size): Record
7223         additional information for scripts.
7224         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7225         * incremental.h (Incremental_script_entry::add_object): New function.
7226         (Incremental_script_entry::get_object_count): New function.
7227         (Incremental_script_entry::get_object): New function.
7228         (Incremental_script_entry::objects_): New data member; adjust
7229         constructor.
7230         (Incremental_inputs::report_archive_begin): Add script_info parameter.
7231         (Incremental_inputs::report_object): Add script_info parameter.
7232         (Incremental_inputs_reader::get_object_count): New function.
7233         (Incremental_inputs_reader::get_object_offset): New function.
7234         * options.cc (Input_arguments::add_file): Return reference to
7235         new input argument.
7236         * options.h (Input_argument::set_script_info): New function.
7237         (Input_argument::script_info): New function.
7238         (Input_argument::script_info_): New data member; adjust all
7239         constructors.
7240         (Input_file_group::add_file): Return reference to new input argument.
7241         (Input_file_lib::add_file): Likewise.
7242         (Input_arguments::add_file): Likewise.
7243         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
7244         * script.cc (Parser_closure::Parser_closure): Add script_info
7245         parameter; adjust all callers.
7246         (Parser_closure::script_info): New function.
7247         (Parser_closure::script_info_): New data member.
7248         (read_input_script): Report scripts earlier to incremental info.
7249         (script_add_file): Set script_info in Input_argument.
7250         (script_add_library): Likewise.
7251         * script.h (Script_options::Script_info): Rewrite class.
7252
7253 2011-03-29  Cary Coutant  <ccoutant@google.com>
7254
7255         * archive.cc (Library_base::should_include_member): Move
7256         method here from class Archive.
7257         (Archive::Archive): Initialize base class.
7258         (Archive::should_include_member): Move to base class.
7259         (Archive::do_for_all_unused_symbols): New function.
7260         (Add_archive_symbols::run): Remove redundant access to
7261         incremental_inputs.
7262         (Lib_group::Lib_group): Initialize base class.
7263         (Lib_group::do_filename): New function.
7264         (Lib_group::include_member): Pass pointer to Lib_group to
7265         report_object.
7266         (Lib_group::do_for_all_unused_symbols): New function.
7267         (Add_lib_group_symbols::run): Report archive information for
7268         incremental links.
7269         * archive.h (class Library_base): New base class.
7270         (class Archive): Derive from Library_base.
7271         (Archive::filename): Move to base class.
7272         (Archive::set_incremental_info): Likewise.
7273         (Archive::incremental_info): Likewise.
7274         (Archive::Should_include): Likewise.
7275         (Archive::should_include_member): Likewise.
7276         (Archive::Armap_entry): Remove.
7277         (Archive::Unused_symbol_iterator): Remove.
7278         (Archive::unused_symbols_begin): Remove.
7279         (Archive::unused_symbols_end): Remove.
7280         (Archive::do_filename): New function.
7281         (Archive::do_get_mtime): New function.
7282         (Archive::do_for_all_unused_symbols): New function.
7283         (Archive::task_): Move to base class.
7284         (Archive::incremental_info_): Likewise.
7285         (class Lib_group): Derive from Library_base.
7286         (Lib_group::do_filename): New function.
7287         (Lib_group::do_get_mtime): New function.
7288         (Lib_group::do_for_all_unused_symbols): New function.
7289         (Lib_group::task_): Move to base class.
7290         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
7291         function.
7292         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
7293         function.
7294         * incremental.cc (Incremental_inputs::report_archive_begin):
7295         Use Library_base; call library's get_mtime; add incremental inputs
7296         entry before members.
7297         (class Unused_symbol_visitor): New class.
7298         (Incremental_inputs::report_archive_end): Use Library_base; use
7299         visitor class to record unused symbols; don't add incremental inputs
7300         entry after members.
7301         (Incremental_inputs::report_object): Use Library_base.
7302         * incremental.h
7303         (Incremental_archive_entry::Incremental_archive_entry): Remove
7304         unused Archive parameter.
7305         (Incremental_inputs::report_archive_begin): Use Library_base.
7306         (Incremental_inputs::report_archive_end): Likewise.
7307         (Incremental_inputs::report_object): Likewise.
7308         * object.cc (Sized_relobj::do_for_all_global_symbols): New
7309         function.
7310         * object.h (Object::for_all_global_symbols): New function.
7311         (Object::do_for_all_global_symbols): New function.
7312         (Sized_relobj::do_for_all_global_symbols): New function.
7313         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
7314         function.
7315         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
7316         function.
7317
7318 2011-03-27  Ian Lance Taylor  <iant@google.com>
7319
7320         * archive.cc (Archive::interpret_header): Return -1 if something
7321         goes wrong.  Change callers accordingly.
7322
7323 2011-03-25  Cary Coutant  <ccoutant@google.com>
7324
7325         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
7326         * testsuite/Makefile.in: Regenerate.
7327
7328 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
7329
7330         * plugin.cc (get_view): New.
7331         (Plugin::load): Pass get_view to the plugin.
7332         (Plugin_manager::get_view): New.
7333
7334 2011-03-21  Ian Lance Taylor  <iant@google.com>
7335
7336         * testsuite/final_layout.sh: Rewrite to not use dc.
7337         * testsuite/relro_test.sh: Fail if dc is not present.
7338
7339 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
7340
7341         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
7342         Change == to -eq.
7343         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
7344         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
7345         Change == to -eq.
7346         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
7347         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
7348
7349 2011-03-14  Ian Lance Taylor  <iant@google.com>
7350
7351         * script-sections.cc (Sort_output_sections::script_compare):
7352         Rename from is_before, change return type.
7353         (Sort_output_sections::operator()): Adjust accordingly.
7354
7355 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
7356
7357         PR gold/12572
7358         * testsuite/odr_violation2.cc: Add comment to make all error line
7359         numbers double digits.
7360         * testsuite/debug_msg.sh: Adjust expected errors.
7361
7362 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
7363
7364         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
7365         but mark earlier ones as non-canonical
7366         (offset_to_iterator): Update search target and example
7367         (do_addr2line): Return extra lines in a vector*
7368         (format_file_lineno): Extract from do_addr2line
7369         (one_addr2line): Add vector* out-param
7370         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
7371         when a lineno entry appeared last for its instruction
7372         (Dwarf_line_info): Add vector* out-param
7373         * object.cc (Relocate_info): Pass NULL for the vector* out-param
7374         * symtab.cc (Odr_violation_compare): Include the lineno in the
7375         comparison again.
7376         (linenos_from_loc): New. Combine the canonical line for an
7377         address with its other lines.
7378         (True_if_intersect): New. Helper functor to make
7379         std::set_intersection a query.
7380         (detect_odr_violations): Compare sets of lines instead of just
7381         one line for each function. This became less deterministic, but
7382         has fewer false positives.
7383         * symtab.h: Declarations.
7384         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
7385         mix an optimized and non-optimized object in the same binary
7386         (odr_violation2.so): Same.
7387         * testsuite/Makefile.in: Regenerate from Makefile.am.
7388         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
7389         * testsuite/debug_msg.sh: Update line numbers and add
7390         assertions.
7391         * testsuite/odr_violation1.cc: Use OdrDerived, in a
7392         non-optimized context.
7393         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
7394         isn't inlined, and use OdrDerived in an optimized context.
7395         * testsuite/odr_header1.h: Defines OdrDerived, where
7396         optimization will change the
7397         first-instruction-in-the-destructor's file and line number.
7398         * testsuite/odr_header2.h: Defines OdrBase.
7399
7400 2011-03-09  Ian Lance Taylor  <iant@google.com>
7401
7402         * fileread.cc (File_read::clear_views): Don't delete the whole
7403         file view.
7404
7405 2011-03-08  Ian Lance Taylor  <iant@google.com>
7406
7407         PR gold/12525
7408         * fileread.cc: #include <climits>.
7409         (GOLD_IOV_MAX): Define.
7410         (File_read::read_multiple): Limit number of entries by iov_max.
7411         * fileread.h (class File_read): Always set max_readv_entries to
7412         128.
7413
7414 2011-03-07  Ian Lance Taylor  <iant@google.com>
7415
7416         PR gold/12525
7417         * options.h (class General_options): Add -dy and -dn.
7418
7419 2011-03-02  Cary Coutant  <ccoutant@google.com>
7420
7421         * testsuite/script_test_9.t: Add TLS segment.
7422
7423 2011-03-02  Simon Baldwin  <simonb@google.com>
7424
7425         * configure.ac: Add check for gnu_indirect_function support in
7426         the toolchain building binutils.
7427         * configure: Rebuild.
7428
7429 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
7430
7431         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
7432         plugin only symbols.
7433         (Symbol_table::sized_finalize_symbol) Mark symbol only present
7434         in plugin files as not needed in the symbol table.
7435
7436 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
7437
7438         * output.cc (Output_section::add_input_section): Delay fill
7439         generation for section ordering.
7440
7441 2011-02-09  Ian Lance Taylor  <iant@google.com>
7442
7443         PR gold/12316
7444         * object.h (class Sized_relobj): Remove clear_local_symbols.
7445         * reloc.cc (Sized_relobj::do_relocate): Don't call
7446         clear_local_symbols.
7447
7448 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
7449
7450         * plugin.cc (is_visible_from_outside): Return true for symbols
7451         in the -u option.
7452
7453 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
7454
7455         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
7456         filename.
7457
7458 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
7459
7460         * icf.h (is_section_foldable_candidate): Change type of parameter
7461         to std::string.
7462         * icf.cc (Icf::find_identical_sections): Change type of local variable
7463         section_name to be std::string.
7464         (is_function_ctor_or_dtor): Change type of parameter to std::string.
7465
7466 2011-01-25  Ian Lance Taylor  <iant@google.com>
7467
7468         * script.cc (script_add_extern): Rewrite to use
7469         add_symbol_reference.
7470
7471 2011-01-25  Doug Kwan  <dougkwan@google.com>
7472
7473         * icf.cc (get_section_contents): Always lock section's object.
7474
7475 2011-01-24  Ian Lance Taylor  <iant@google.com>
7476
7477         * options.h (class General_options): Accept
7478         --no-detect-odr-violations.
7479
7480 2011-01-24  Ian Lance Taylor  <iant@google.com>
7481
7482         * version.cc (version_string): Bump to 1.11.
7483
7484 2011-01-24  Ian Lance Taylor  <iant@google.com>
7485
7486         * plugin.cc (class Plugin_rescan): Define new class.
7487         (Plugin_manager::claim_file): Set any_claimed_.
7488         (Plugin_manager::save_archive): New function.
7489         (Plugin_manager::save_input_group): New function.
7490         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
7491         necessary.
7492         (Plugin_manager::new_undefined_symbol): New function.
7493         (Plugin_manager::rescan): New function.
7494         (Plugin_manager::rescannable_defines): New function.
7495         (Plugin_manager::add_input_file): Set any_added_.
7496         * plugin.h (class Plugin_manager): define new fields rescannable_,
7497         undefined_symbols_, any_claimed_, and any_added_.  Declare
7498         Plugin_rescan as friend.  Declare new functions.
7499         (Plugin_manager::Rescannable): Define type.
7500         (Plugin_manager::Rescannable_list): Define type.
7501         (Plugin_manager::Undefined_symbol_list): Define type.
7502         (Plugin_manager::Plugin_manager): Initialize new fields.
7503         * archive.cc (Archive::defines_symbol): New function.
7504         (Add_archive_symbols::run): Pass archive to plugins if any.
7505         * archive.h (class Archive): Declare defines_symbol.
7506         * readsyms.cc (Input_group::~Input_group): New function.
7507         (Finish_group::run): Pass input_group to plugins if any.
7508         * readsyms.h (class Input_group): Declare destructor.
7509         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
7510         any.
7511
7512 2011-01-10  Ian Lance Taylor  <iant@google.com>
7513
7514         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
7515         section as relro.
7516         (Layout::set_segment_offsets): Reset increase_relro before calling
7517         set_section_addresses a second time.
7518
7519 2011-01-04  Cary Coutant  <ccoutant@google.com>
7520
7521         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
7522         sections before NOBITS sections.
7523
7524 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
7525
7526         * version.cc (print_version): Update copyright to 2011.
7527
7528 2010-12-23  Cary Coutant  <ccoutant@google.com>
7529
7530         * output.h (Output_data_reloc::add_output_section): Pass OD instead
7531         of OS to this->add.  Add OD parameter to second form of the function.
7532
7533 2010-12-20  Ian Lance Taylor  <iant@google.com>
7534
7535         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
7536         second of two consecutive entries with same offset.
7537
7538 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7539
7540         * testsuite/Makefile.am (ifuncmain2static_LDADD)
7541         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
7542         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
7543         to avoid unneeded links against $(LDADD).
7544         * testsuite/Makefile.in: Regenerate.
7545
7546 2010-12-15  Ian Lance Taylor  <iant@google.com>
7547
7548         PR gold/12324
7549         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
7550         for R_X86_64_32 and R_X86_64_PC32.
7551         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
7552         ver_matching_def_pic.o.
7553         (ver_matching_def_pic.o): New target.
7554
7555 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7556
7557         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
7558         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
7559         Move definition before File_read::View member definitions.
7560         (File_read::View::~View): Initialize and hold lock before
7561         updating current_mapped_bytes.
7562
7563 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7564
7565         * dwarf_reader.cc: Remove outdated comment.
7566         * gold-threads.cc: Fix typo in error message.
7567         * archive.cc: Fix typos in comments.
7568         * archive.h: Likewise.
7569         * arm-reloc-property.cc: Likewise.
7570         * arm-reloc-property.h: Likewise.
7571         * arm-reloc.def: Likewise.
7572         * arm.cc: Likewise.
7573         * attributes.h: Likewise.
7574         * cref.cc: Likewise.
7575         * ehframe.cc: Likewise.
7576         * fileread.h: Likewise.
7577         * gold.h: Likewise.
7578         * i386.cc: Likewise.
7579         * icf.cc: Likewise.
7580         * incremental.h: Likewise.
7581         * int_encoding.cc: Likewise.
7582         * layout.h: Likewise.
7583         * main.cc: Likewise.
7584         * merge.h: Likewise.
7585         * object.cc: Likewise.
7586         * object.h: Likewise.
7587         * options.cc: Likewise.
7588         * readsyms.cc: Likewise.
7589         * reduced_debug_output.cc: Likewise.
7590         * reloc.cc: Likewise.
7591         * script-sections.cc: Likewise.
7592         * sparc.cc: Likewise.
7593         * symtab.h: Likewise.
7594         * target-reloc.h: Likewise.
7595         * target.cc: Likewise.
7596         * target.h: Likewise.
7597         * timer.cc: Likewise.
7598         * timer.h: Likewise.
7599         * x86_64.cc: Likewise.
7600
7601 2010-12-09  Cary Coutant  <ccoutant@google.com>
7602
7603         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
7604         stack.
7605         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
7606         parameter; change all callers.
7607         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
7608         * options.h (warn_execstack): New option.
7609
7610 2010-12-07  Doug Kwan  <dougkwan@google.com>
7611
7612         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
7613         like function call relocations.
7614
7615 2010-12-07  Ian Lance Taylor  <iant@google.com>
7616
7617         * archive.cc (Archive::get_elf_object_for_member): Permit
7618         punconfigured to be NULL.
7619         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
7620         (Archive::include_member): Pass NULL to get_elf_object_for_member
7621         if we searched for the archive and this is the first included
7622         object.
7623
7624 2010-12-01  Ian Lance Taylor  <iant@google.com>
7625
7626         * dwarf_reader.h (class Sized_dwarf_line_info): Add
7627         track_relocs_type_ field.
7628         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7629         Set track_relocs_type_.
7630         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
7631         contents when using RELA relocs.
7632         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
7633         reloc_map_.
7634         * reloc.cc (Track_relocs::next_addend): New function.
7635         * reloc.h (class Track_relocs): Declare next_addend.
7636
7637 2010-12-01  Ian Lance Taylor  <iant@google.com>
7638
7639         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
7640         virtual destructor.
7641
7642 2010-12-01  Ian Lance Taylor  <iant@google.com>
7643
7644         * README: Update compilers known to work and fail.
7645
7646 2010-11-23  Matthias Klose  <doko@ubuntu.com>
7647
7648         * configure.in: For --enable-gold, handle value `default' instead of
7649         `both*'.  Always install ld as ld.bfd, install as ld if gold is
7650         not the default.
7651         * configure: Regenerate.
7652
7653 2010-11-18  Doug Kwan  <dougkwan@google.com>
7654
7655         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
7656         and right_alignment to be zero.  Store result alignment only if it is
7657         greater than existing alignment.
7658
7659 2010-11-16  Cary Coutant  <ccoutant@google.com>
7660
7661         PR gold/12220
7662         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7663         Check for ".zdebug_line".
7664
7665 2010-11-16  Doug Kwan  <dougkwan@google.com>
7666             Cary Coutant  <ccoutant@google.com>
7667
7668         * output.h (Output_segment::set_section_addresses): Pass increase_relro
7669         by reference; adjust all callers.
7670         * output.cc (Output_segment::set_section_addresses): Adjust references
7671         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
7672         list is empty.
7673         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
7674         end at page boundary.
7675
7676 2010-11-16  Cary Coutant  <ccoutant@google.com>
7677
7678         PR gold/12220
7679         * layout.cc (Layout::choose_output_section): Transform names of
7680         compressed sections even when using a script with a SECTIONS clause.
7681         (Layout::output_section_name): Remove code to transform
7682         compressed debug section names.
7683         * output.cc (Output_section::add_input_section): Use uncompressed
7684         section size when tracking input sections.
7685
7686 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
7687
7688         * symtab.h (Symbol::NON_PIC_REF): Remove.
7689         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
7690         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
7691         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
7692         (Symbol::use_plt_offset): Take a flags argument and pass it
7693         directly to needs_dynamic_reloc.  Restrict check for undefined
7694         weak symbols to function calls.
7695         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
7696         (Target_arm::Scan::global): Use it.
7697         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
7698         (Target_arm::Relocate::relocate): Likewise.
7699         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
7700         parameter with an r_type parameter.  Use get_reference_flags
7701         to get the flags.
7702         (Target_arm::Relocate::relocate): Update accordingly.
7703         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
7704         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
7705         (Target_i386::Scan::global): Likewise.
7706         (Target_i386::Relocate::relocate): Likewise.
7707         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
7708         parameter with an r_type parameter.  Use get_reference_flags
7709         to get the flags.
7710         (Target_i386::Relocate::relocate): Update accordingly.
7711         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
7712         (Target_powerpc::Scan::global): Use it.
7713         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
7714         (Target_powerpc::Relocate::relocate): Likewise.
7715         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
7716         (Target_sparc::Scan::global): Use it.
7717         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
7718         (Target_sparc::Relocate::relocate): Likewise.
7719         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
7720         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
7721         (Target_x86_64::Scan::global): Likewise.
7722         (Target_x86_64::Relocate::relocate): Likewise.
7723
7724 2010-11-08  Doug Kwan  <dougkwan@google.com>
7725             Cary Coutant  <ccoutant@google.com>
7726
7727         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
7728         (Arm_exidx_merge_section::section_contents_): New data member.
7729         (Arm_input_section::Arm_input_section): Initialize original_contents_.
7730         (Arm_input_section::~Arm_input_section): De-allocate memory.
7731         (Arm_input_section::original_contents_): New data member.
7732         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
7733         in parameters instead of calling Object::section_contents without
7734         locking.
7735         (Arm_output_section::group_section): New parameter TASK.  Pass it
7736         to callees that need locking objects.
7737         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
7738         to lock EXIDX input sections.  Fix a formatting issue.  Call
7739         Arm_exidx_merged_section::build_contents to create merged section
7740         contents.
7741         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
7742         to lock object of stub table owner.
7743         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
7744         TEXT_SIZE to initialize data member TEXT_SIZE_.
7745         (Arm_exidx_input_section::addralign): Fix typo in comment.
7746         (Arm_exidx_input_section::text_size): New method.
7747         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
7748         that require locking objects.  Lock objects before scanning for stubs
7749         and updating local symbols.
7750         (Arm_input_section<big_endian>::init): Copy contents of original
7751         input section.
7752         (Arm_input_section<big_endian>::do_write): Use saved contents of
7753         original input section instead of calling Object::section_contents
7754         without locking.
7755         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
7756         size without calling Object::section_size().
7757         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
7758         for size.  Allocate a buffer for merged EXIDX entries.
7759         (Arm_exidx_merged_section::build_contents): New method.
7760         (Arm_exidx_merged_section::do_write): Move merge section contents
7761         building code to Arm_exidx_merged_section::build_contetns.  Write
7762         out contetns in buffer instead of building it on the fly.
7763         (Arm_relobj::make_exidx_input_section): Also pass text section size
7764         to Arm_exidx_input_section constructor.
7765         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
7766         (Arm_dynobj::do_read_symbols): Fix memory leak.
7767         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
7768         * target.h: (class Task): Add forward declaration.
7769         (Target::relax): Add new parameter TASK and pass it to
7770         Target::do_relax().
7771         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
7772
7773 2010-11-05  Cary Coutant  <ccoutant@google.com>
7774
7775         PR gold/10708
7776         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
7777         object when reading from the file.
7778         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
7779         second layout pass.
7780         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
7781         when reading section contents.
7782         (get_section_contents): Likewise.
7783         (icf::find_identical_sections): Likewise.
7784         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
7785         object when reading from the file.
7786         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
7787         the object when doing deferred section layout.
7788
7789 2010-11-03  Nick Clifton  <nickc@redhat.com>
7790
7791         PR gold/12001
7792         * script.h (class Symbol_assignment: name): New member.  Returns
7793         the name of the symbol.
7794         * scrfipt.cc (Script_options::is_pending_assignment): New member.
7795         Returns true if the given symbol name is on the list of
7796         assignments wating to be processed.
7797         * archive.cc (should_incldue_member): If the symbol is undefined,
7798         check to see if it is on the list of symbols pending assignment.
7799
7800 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
7801
7802         * script-sections.cc (Script_sections::find_memory_region): Check
7803         for a NULL output section pointer.
7804
7805 2010-10-29  Doug Kwan  <dougkwan@google.com>
7806
7807         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
7808         Output_section::add_relaxed_input_section.
7809         * output.cc (Output_section::add_relaxed_input_section): Add new
7810         arguments LAYOUT and NAME.  Set section order index.
7811         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7812         Copy section order index.
7813         * output.h (Output_section::add_relaxed_input_section): Add new
7814         arguments LAYOUT and NAME.
7815
7816 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7817
7818         * testsuite/Makefile.am: Move gcctestdir/ld rule to
7819         NATIVE_OR_CROSS_LINKER.
7820         * testsuite/Makefile.in: Regenerate.
7821
7822 2010-10-20  Doug Kwan  <dougkwan@google.com>
7823
7824         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
7825         without SHF_LINK_ORDER flags.
7826         * layout.cc (Layout::choose_output_section): Do not filter
7827         SHF_LINK_ORDER flag in a relocatable link.
7828
7829 2010-10-17  Cary Coutant  <ccoutant@google.com>
7830
7831         * output.h (Output_segment::set_section_addresses): Change function
7832         signature.  Update all callers.
7833         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
7834         sections.
7835         (Output_segment::set_section_addresses): Align after last TLS
7836         section.  Add padding before last relro section instead of after.
7837
7838 2010-10-17  Doug Kwan  <dougkwan@google.com>
7839
7840         * gold/arm.cc (Target_arm::got_section): Use correct order and set
7841         GOT output section to be writable.
7842
7843 2010-10-14  Cary Coutant  <ccoutant@google.com>
7844
7845         * debug.h (DEBUG_INCREMENTAL): New flag.
7846         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
7847         * gold.cc (queue_initial_tasks): Check parameters for incremental link
7848         mode.
7849         * incremental.cc (report_command_line): Ignore all forms of
7850         --incremental.
7851         * layout.cc (Layout::Layout): Check parameters for incremental link
7852         mode.
7853         * options.cc (General_options::parse_incremental): New function.
7854         (General_options::parse_no_incremental): New function.
7855         (General_options::parse_incremental_full): New function.
7856         (General_options::parse_incremental_update): New function.
7857         (General_options::incremental_mode_): New data member.
7858         (General_options::finalize): Check incremental_mode_.
7859         * options.h (General_options): Update help text for --incremental.
7860         Add --no-incremental, --incremental-full, --incremental-update.
7861         (General_options::Incremental_mode): New enum type.
7862         (General_options::incremental_mode): New function.
7863         (General_options::incremental_mode_): New data member.
7864         * parameters.cc (Parameters::incremental_mode_): New data member.
7865         (Parameters::set_options): Set incremental_mode_.
7866         (Parameters::set_incremental_full): New function.
7867         (Parameters::incremental): New function.
7868         (Parameters::incremental_update): New function.
7869         (set_parameters_incremental_full): New function.
7870         * parameters.h (Parameters::set_incremental_full): New function.
7871         (Parameters::incremental): New function.
7872         (Parameters::incremental_update): New function.
7873         (Parameters::incremental_mode_): New data member.
7874         (set_parameters_incremental_full): New function.
7875         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
7876         incremental link mode.
7877         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
7878         (Sized_relobj::do_relocate_sections): Likewise.
7879         * testsuite/Makefile.am (incremental_test): Use --incremental-full
7880         option.
7881         * testsuite/Makefile.in: Regenerate.
7882         * testsuite/incremental_test.sh: Filter all forms of --incremental.
7883
7884 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7885
7886         * script-sections.h (class Script_sections): Make
7887         Sections_elements typedef public.
7888         * script-sections.cc (class Sort_output_sections): Add elements_
7889         field.  Add constructor which sets it; change all callers.
7890         (Sort_output_sections::is_before): New function.
7891         (Sort_output_sections::operator()): Call is_before.
7892         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
7893         conditional.
7894         * testsuite/script_test_10.sh: New test. Test script section
7895         order.
7896         * testsuite/script_test_10.t: Likewise.
7897         * testsuite/script_test_10.s: Likewise.
7898         * testsuite/Makefile.am: Wrap the cross linker tests and the
7899         common tests into NATIVE_OR_CROSS_LINKER.
7900         (check_SCRIPTS): Add script_test_10.sh.
7901         (check_DATA): Add script_test_10.stdout.
7902         (script_test_10.o, script_test_10): New targets.
7903         (script_test_10.stdout): New target.
7904         * configure, testsuite/Makefile.in: Regenerate.
7905
7906 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7907
7908         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
7909         error for the deprecated relocations.
7910         (Target_arm::Scan::global): Likewise.
7911         (Target_arm::Relocate::relocate): Likewise.
7912
7913 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
7914
7915         * fileread.cc (Input_file::find_file): Initialize *found_name
7916         and *namep when using the fallback search for case 4.
7917
7918 2010-10-11  Cary Coutant  <ccoutant@google.com>
7919
7920         * options.h (class General_options): Redefine -z lazy as an alias for
7921         the negation of -z now.
7922
7923 2010-10-11  Ian Lance Taylor  <iant@google.com>
7924
7925         * resolve.cc (symbol_to_bits): Report the value of the unsupported
7926         binding.
7927
7928 2010-10-06  Nick Clifton  <nickc@redhat.com>
7929
7930         * script-sections.cc(class Memory_region): Remove
7931         current_lma_offset_ field.  Rename current_vma_offset_ to
7932         current_offset_.  Add last_section_ field.
7933         (Memory_region::get_current_vma_address): Rename to
7934         get_current_address.
7935         (Memory_region::get_current_lma_address): Delete.
7936         (Memory_region::increment_vma_offset): Rename to
7937         increment_offset.
7938         (Memory_region::increment_lma_offset): Delete.
7939         (Memory_region::attributes_compatible): New method.  Returns
7940         true if the provided section is compatible with the region.
7941         (Memory_region::get_last_section): New method.  Returns the last
7942         section to use the region.
7943         (Memory_region::set_last_section): New method.  Stores the last
7944         section to use the region.
7945         (Script_sections::block_in_region): New method.  Returns true if
7946         a block of memory is contained within a region.
7947         (Script_sections::find_memory_region): New method.  Locates a
7948         memory region to be used to set a VMA or LMA address.
7949         (Output_section_definition::set_section_addresses): Add code to
7950         check for addresses set by memory regions.
7951         (Output_segment::set_section_addresses): Remove memory region
7952         walking code.
7953         (Script_sections::create_segment): Add a warning if a header
7954         segment is created outside of any region.
7955         * script-sections.h (class Script_sections): Add prototypes for
7956         find_memory_region and block_in_region methods.
7957         * testsuite/memory_test.s: Use .long instead of .word.
7958         * testsuite/memory_test.t: Add some more output sections.
7959         * testsuite/memory_test.sh: Update expected output.
7960
7961 2010-10-02  Doug Kwan  <dougkwan@google.com>
7962
7963         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
7964         defintion to symtab.h
7965         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
7966         declaration to defintion.
7967
7968 2010-10-01  Nick Clifton  <nickc@redhat.com>
7969
7970         * expression.cc (eval): Replace dummy argument with NULL.
7971         (eval_maybe_dot): Check for a NULL result section pointer.
7972         (Symbol_expression::value): Likewise.
7973         (Dot_expression::value): Likewise.
7974         (BINARY_EXPRESSION): Likewise.
7975         (Max_expression::value): Likewise.
7976         (Min_expression::value): Likewise.
7977         (Absolute_expression::value): Likewise.
7978         (Addr_expression::value_from_output_section): Likewise.
7979         (Loaddddr_expression::value_from_output_section): Likewise.
7980         (Segment_start_expression::value): Likewise.
7981         * script-sections.cc
7982         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
7983         argument with NULL.
7984         (Sections_elememt_dot_assignment::set_section_addresses):
7985         Likewise.
7986         (Output_data_expression::do_write_to_buffer): Likewise.
7987         (Output_section_definition::finalize_symbols): Likewise.
7988         (Output_section_definition::set_section_addresses): Likewise.
7989
7990 2010-09-30  Doug Kwan  <dougkwan@google.com>
7991
7992         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
7993
7994 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
7995
7996         * target.h (Target::can_icf_inline_merge_sections): New virtual
7997         function.
7998         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7999         virtual function.
8000         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
8001         virtual function.
8002         * icf.cc (get_section_contents): Inline merge sections only when
8003         target allows it.
8004
8005 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8006
8007         * configure: Regenerate.
8008
8009 2010-09-17  Ian Lance Taylor  <iant@google.com>
8010
8011         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
8012         * testsuite/Makefile.am (memory_test.o): New target.
8013         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
8014         memory_test.t.
8015         * testsuite/Makefile.in: Rebuild.
8016
8017 2010-09-17  Doug Kwan  <dougkwan@google.com>
8018
8019         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
8020         defintion if relocation uses GOT entries of the symbol.
8021         * testsuite/icf_safe_test.sh: Fix test.
8022         * testsuite/icf_safe_so_test.sh: Fix test.
8023
8024 2010-09-16  Cary Coutant  <ccoutant@google.com>
8025
8026         * script_sections.cc (class Memory_region): Remove "NULL" from
8027         vector initializations.
8028
8029 2010-09-15  Cary Coutant  <ccoutant@google.com>
8030
8031         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
8032         Resolve forwarding symbols.
8033
8034 2010-09-15  Doug Kwan  <dougkwan@google.com>
8035
8036         * gold/testsuite/script_test_3.t: Add ARM special sections.
8037         * gold/testsuite/script_test_4.t: Same.
8038         * gold/testsuite/script_test_5.t: Same.
8039         * gold/testsuite/script_test_6.t: Same.
8040         * gold/testsuite/script_test_7.t: Same.
8041         * gold/testsuite/script_test_7.t: Same.
8042         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
8043
8044 2010-09-14  Cary Coutant  <ccoutant@google.com>
8045
8046         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
8047         (Target_x86_64::Relocate::relocate_tls): Replace check for
8048         saw_tls_block_reloc_ with test for executable section.
8049
8050 2010-09-12  Cary Coutant  <ccoutant@google.com>
8051
8052         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
8053         position-independent executables to shared libraries need dynamic
8054         relocations.
8055         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
8056         position-independent executables.
8057         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
8058         * testsuite/Makefile.in: Regenerate.
8059
8060 2010-09-10  Nick Clifton  <nickc@redhat.com>
8061
8062         PR gold/11997
8063         * testsuite/memory_test.t: Discard any sections that are not
8064         needed.
8065
8066 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
8067
8068         PR gold/11996
8069         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
8070         "This::" to work around a bug in gcc 4.2.
8071
8072         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
8073
8074 2010-09-09  Rafael Espindola  <espindola@google.com>
8075
8076         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
8077         sections with different PF_X flags in the same segment.
8078         (Layout::find_first_load_seg): Search all segments to find the first
8079         one.
8080         * options.h (rosegment): New.
8081
8082 2010-09-08  Rafael Espindola  <espindola@google.com>
8083
8084         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
8085
8086 2010-09-08  Doug Kwan  <dougkwan@google.com>
8087
8088         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
8089         (Arm_relobj::do_relocate_sections): Add new parameter for output
8090         file to match the parent.
8091         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
8092         of local symbols instead of input values.  Update code to track
8093         changes in gold::relocate_section.
8094         * object.cc (Sized_relobj::compute_final_local_value): New methods.
8095         (Sized_relobj::compute_final_local_value_internal): New methods.
8096         (Sized_relobj::do_finalize_local_symbols): Move code from loop
8097         body into private version of Sized_relobj::compute_final_local_value.
8098         Call the inline method.
8099         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
8100         merged symbol value if there is one.
8101         (Symbol_value::has_output_value): New method defintiion.
8102         (Sized_relobj::Compute_final_local_value_status): New enum type.
8103         (Sized_relobj::compute_final_local_value): New methods.
8104         (Sized_relobj::compute_final_local_value_internal): New methods.
8105         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
8106         and arm_cortex_a8.sh.
8107         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
8108         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
8109         New tests.
8110         * Makefile.in: Regenerate.
8111         * testsuite/arm_bl_out_of_range.s: Update test.
8112         * testsuite/thumb_bl_out_of_range.s: Ditto.
8113         * testsuite/thumb_blx_out_of_range.s: Ditto.
8114         * testsuite/arm_branch_out_of_range.sh: New file.
8115         * testsuite/arm_cortex_a8.sh: Ditto.
8116         * testsuite/arm_cortex_a8_b.s: Ditto.
8117         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
8118         * testsuite/arm_cortex_a8_b_local.s: Ditto.
8119         * testsuite/arm_cortex_a8_bl.s: Ditto.
8120         * testsuite/arm_cortex_a8_blx.s: Ditto.
8121         * testsuite/arm_cortex_a8_local.s: Ditto.
8122         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
8123         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
8124
8125 2010-09-08  Rafael Espindola  <espindola@google.com>
8126
8127         * Makefile.am (memory_test.stdout): Run readelf with -W.
8128         * Makefile.in: Regenerate.
8129         * testsuite/memory_test.sh: Make the regexps accept both 32 and
8130         64 bit output.
8131
8132 2010-09-08  Rafael Espindola  <espindola@google.com>
8133
8134         * script-sections.cc (Script_sections::add_memory_region): Convert
8135         field precision to int.
8136         * script.cc (script_set_section_region, script_set_section_region):
8137         Convert field precision to int.
8138
8139 2010-09-08  Rafael Espindola  <espindola@google.com>
8140
8141         * arm.cc (do_finalize_sections): Create the __exidx_start and
8142         __exdix_end symbols even when the section is missing.
8143
8144 2010-09-08  Nick Clifton  <nickc@redhat.com>
8145
8146         * README: Remove claim that MEMORY is not supported.
8147         * expression.cc (script_exp_function_origin)
8148         (script_exp_function_length): Move from here to ...
8149         * script.cc: ... here.
8150         (script_set_section_region, script_add_memory)
8151         (script_parse_memory_attr, script_include_directive): New
8152         functions.
8153         * script-sections.cc
8154         (class Memory_region): New class.
8155         (class Output_section_definition): Add set_memory_region,
8156         set_section_vma, set_section_lma and get_section_name methods.
8157         (class Script_Sections): Add add_memory_region,
8158         find_memory_region, find_memory_region_origin,
8159         find_memory_region_length and set_memory_region methods.
8160         Have set_section_addresses method walk the list of set memory
8161         regions.
8162         Extend the print methos to display memory regions.
8163         * script-sections.h: Add prototypes for new methods.
8164         Add enum for MEMORY region attributes.
8165         * yyscript.y: Add support for parsing MEMORY regions.
8166         * script-c.h: Add prototypes for new functions.
8167         * testsuite/Makefile.am: Add test of MEMORY region functionality.
8168         * testsuite/Makefile.in: Regenerate.
8169         * testsuite/memory_test.sh: New script.
8170         * testsuite/memory_test.s: New assembler source file.
8171         * testsuite/memory_test.t: New linker script.
8172
8173 2010-08-27  Doug Kwan  <dougkwan@google.com>
8174
8175         * gold/resolve.cc (Symbol_table::should_override): Let a weak
8176         reference override an existing dynamic weak reference.
8177         * testsuite/Makefile.am: Add new test dyn_weak_ref.
8178         * testsuite/Makefile.in: Regenerate.
8179         * testsuite/dyn_weak_ref.sh: New file.
8180         * testsuite/dyn_weak_ref_1.c: Ditto.
8181         * testsuite/dyn_weak_ref_2.c: Ditto.
8182
8183 2010-08-27  Ian Lance Taylor  <iant@google.com>
8184
8185         * incremental.h (class Incremental_input_entry): Add virtual
8186         destructor.
8187
8188 2010-08-27  Ian Lance Taylor  <iant@google.com>
8189
8190         * testsuite/start_lib_test_3.c: Mark t3 as used.
8191
8192 2010-08-27  Nick Clifton  <nickc@redhat.com>
8193
8194         * options.cc (version_script): Fix small typo in previous
8195         whitespace tidyup.
8196
8197 2010-08-25  Nick Clifton  <nickc@redhat.com>
8198
8199         * archive.cc: Formatting fixes: Remove whitespace between
8200         typename and following asterisk.  Remove whitespace between
8201         function name and opening parenthesis.
8202         * archive.h: Likewise.
8203         * arm.cc: Likewise.
8204         * attributes.cc: Likewise.
8205         * attributes.h: Likewise.
8206         * common.cc: Likewise.
8207         * copy-relocs.cc: Likewise.
8208         * dirsearch.h: Likewise.
8209         * dynobj.cc: Likewise.
8210         * ehframe.cc: Likewise.
8211         * ehframe.h: Likewise.
8212         * expression.cc: Likewise.
8213         * fileread.cc: Likewise.
8214         * fileread.h: Likewise.
8215         * gc.h: Likewise.
8216         * gold-threads.cc: Likewise.
8217         * gold.cc: Likewise.
8218         * i386.cc: Likewise.
8219         * icf.h: Likewise.
8220         * incremental-dump.cc: Likewise.
8221         * incremental.cc: Likewise.
8222         * layout.cc: Likewise.
8223         * layout.h: Likewise.
8224         * main.cc: Likewise.
8225         * merge.cc: Likewise.
8226         * merge.h: Likewise.
8227         * object.cc: Likewise.
8228         * object.h: Likewise.
8229         * options.cc: Likewise.
8230         * options.h: Likewise.
8231         * output.cc: Likewise.
8232         * output.h: Likewise.
8233         * plugin.cc: Likewise.
8234         * plugin.h: Likewise.
8235         * powerpc.cc: Likewise.
8236         * reloc.cc: Likewise.
8237         * script-c.h: Likewise.
8238         * script-sections.cc: Likewise.
8239         * script.cc: Likewise.
8240         * stringpool.cc: Likewise.
8241         * symtab.cc: Likewise.
8242         * symtab.h: Likewise.
8243         * target.cc: Likewise.
8244         * timer.cc: Likewise.
8245         * timer.h: Likewise.
8246         * version.cc: Likewise.
8247         * x86_64.cc: Likewise.
8248
8249 2010-08-24  Nick Clifton  <nickc@redhat.com>
8250
8251         PR 11899
8252         * layout.cc (segment_precedes): Sort segments by their physical
8253         addresses, if they have been set.
8254
8255 2010-08-23  Cary Coutant  <ccoutant@google.com>
8256
8257         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
8258         symbols data.
8259         (Lib_group::include_member): Unlock object after deleting its
8260         symbols data.
8261         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
8262         the bug fixed here.
8263
8264 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
8265             Cary Coutant  <ccoutant@google.com>
8266
8267         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
8268         constructor, and set_blocker.
8269         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
8270         readsyms_blocker_.
8271         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
8272         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
8273         * testsuite/Makefile.am (start_lib_test): New test case.
8274         * testsuite/Makefile.in: Regenerate.
8275         * testsuite/start_lib_test_main.c: New file.
8276         * testsuite/start_lib_test_1.c: New file.
8277         * testsuite/start_lib_test_2.c: New file.
8278         * testsuite/start_lib_test_3.c: New file.
8279
8280 2010-08-19  Ian Lance Taylor  <iant@google.com>
8281
8282         * Makefile.in: Rebuild with automake 1.11.1.
8283         * aclocal.m4: Likewise.
8284         * testsuite/Makefile.in: Likewise.
8285
8286 2010-08-19  Ian Lance Taylor  <iant@google.com>
8287
8288         PR 10893
8289         * i386.cc (class Output_data_plt_i386): Update declarations.
8290         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
8291         local_ifuncs_ fields.
8292         (Target_i386::do_plt_section_for_global): New function.
8293         (Target_i386::do_plt_section_for_local): New function.
8294         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
8295         parameter; change all callers.  Initialize global_ifuncs_ and
8296         local_ifuncs_.  If doing a static link define __rel_iplt_start and
8297         __rel_iplt_end.
8298         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
8299         (Output_data_plt_i386::add_local_ifunc_entry): New function.
8300         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
8301         symbols.
8302         (Target_i386::make_plt_section): New function, broken out of
8303         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
8304         (Target_i386::make_plt_entry): Call make_plt_section.
8305         (Target_i386::make_local_ifunc_plt_entry): New function.
8306         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
8307         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
8308         R_386_IRELATIVE to switch.
8309         (Target_i386::Scan::global): Likewise.
8310         (Target_i386::Relocate::relocate): Likewise.
8311         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
8312         switch.
8313         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
8314         (Target_x86_64::do_plt_section_for_global): New function.
8315         (Target_x86_64::do_plt_section_for_local): New function.
8316         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
8317         parameter; change all callers.  If doing a static link define
8318         __rela_iplt_start and __rela_iplt_end.
8319         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
8320         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
8321         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
8322         to point to .plt.
8323         (Target_x86_64::make_local_ifunc_plt_entry): New function.
8324         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
8325         switch.
8326         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
8327         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
8328         R_X86_64_IRELATIVE to switch.
8329         (Target_x86_64::Scan::global): Likewise.
8330         (Target_x86_64::Relocate::relocate): Likewise.
8331         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
8332         switch.
8333         * target.h (class Target): Add plt_section_for_global and
8334         plt_section_for_local functions.  Add do_plt_section_for_global
8335         and do_plt_section_for_local virtual functions.
8336         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
8337         clarifying comments.
8338         (Symbol::use_plt_offset): Handle IFUNC symbol.
8339         * object.cc (Sized_relobj::Sized_relobj): Initialize
8340         local_plt_offsets_.
8341         (Sized_relobj::local_has_plt_offset): New function.
8342         (Sized_relobj::local_plt_offset): New function.
8343         (Sized_relobj::set_local_plt_offset): New function.
8344         (Sized_relobj::do_count): Handle IFUNC symbol.
8345         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
8346         a bit away from input_shndx_ field.  Add set_is_func_symbol and
8347         is_ifunc_symbol functions.
8348         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
8349         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
8350         local_plt_offsets_ field.
8351         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
8352         * output.h (class Output_section_data): Add non-const
8353         output_section function.
8354         (class Output_data_got): Update declarations.
8355         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
8356         Add use_plt_offset parameter to global and local constructors.
8357         Change all callers.  Change local_sym_index_ field to 31 bits.
8358         Change GSYM_CODE and CONSTANT_CODE accordingly.
8359         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
8360         doing a static link don't set sh_link field.
8361         (Output_data_got::Got_entry::write): Use PLT offset if
8362         appropriate.
8363         (Output_data_got::add_global_plt): New function.
8364         (Output_data_got::add_local_plt): New function.
8365         * target-reloc.h (relocate_section): Handle IFUNC symbol.
8366         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
8367         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
8368         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
8369         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
8370         IFUNC conditional.
8371         * testsuite/ifunc-sel.h: New file.
8372         * testsuite/ifuncmain1.c: New file.
8373         * testsuite/ifuncmain1vis.c: New file.
8374         * testsuite/ifuncmod1.c: New file.
8375         * testsuite/ifuncdep2.c: New file.
8376         * testsuite/ifuncmain2.c: New file.
8377         * testsuite/ifuncmain3.c: New file.
8378         * testsuite/ifuncmod3.c: New file.
8379         * testsuite/ifuncmain4.c: New file.
8380         * testsuite/ifuncmain5.c: New file.
8381         * testsuite/ifuncmod5.c: New file.
8382         * testsuite/ifuncmain6pie.c: New file.
8383         * testsuite/ifuncmod6.c: New file.
8384         * testsuite/ifuncmain7.c: New file.
8385         * configure, testsuite/Makefile.in: Rebuild.
8386
8387 2010-08-18  Ian Lance Taylor  <iant@google.com>
8388
8389         * incremental.cc
8390         (Output_section_incremental_inputs::write_input_files): Add cast
8391         to avoid signed/unsigned comparison warning.
8392         (Output_section_incremental_inputs::write_info_blocks): Likewise.
8393
8394 2010-08-12  Cary Coutant  <ccoutant@google.com>
8395
8396         * common.cc (Sort_commons::operator()): Remove unnecessary code.
8397
8398 2010-08-13  Ian Lance Taylor  <iant@google.com>
8399
8400         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
8401
8402 2010-08-12  Cary Coutant  <ccoutant@google.com>
8403             Doug Kwan  <dougkwan@google.com>
8404
8405         * resolve.cc (Symbol_table::should_override): When a weak dynamic
8406         defintion overrides non-weak undef, remember that the original undef
8407         is not weak.
8408         * symtab.cc (Symbol_table::sized_write_global): For undef without
8409         an original weak binding, set binding to global in output.
8410         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
8411         * testsuite/Makefile.in: Regenerate.
8412         * testsuite/strong_ref_weak_def.sh: New file.
8413         * testsuite/strong_ref_weak_def_1.c: Ditto.
8414         * testsuite/strong_ref_weak_def_2.c: Ditto.
8415
8416 2010-08-12  Cary Coutant  <ccoutant@google.com>
8417
8418         * testsuite/incremental_test.sh: Rewrite.
8419         * testsuite/incremental_test_1.c: Rewrite.
8420         * testsuite/incremental_test_2.c: Rewrite.
8421
8422 2010-08-12  Cary Coutant  <ccoutant@google.com>
8423
8424         * arm.cc (Target_arm::got_size): Add const.
8425         (Target_arm::got_entry_count): New function.
8426         (Target_arm::plt_entry_count): New function.
8427         (Target_arm::first_plt_entry_offset): New function.
8428         (Target_arm::plt_entry_size): New function.
8429         (Output_data_plt_arm::entry_count): New function.
8430         (Output_data_plt_arm::first_plt_entry_offset): New function.
8431         (Output_data_plt_arm::get_plt_entry_size): New function.
8432         * i386.cc (Target_i386::got_size): Add const.
8433         (Target_i386::got_entry_count): New function.
8434         (Target_i386::plt_entry_count): New function.
8435         (Target_i386::first_plt_entry_offset): New function.
8436         (Target_i386::plt_entry_size): New function.
8437         (Output_data_plt_i386::entry_count): New function.
8438         (Output_data_plt_i386::first_plt_entry_offset): New function.
8439         (Output_data_plt_i386::get_plt_entry_size): New function.
8440         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
8441         find_incremental_inputs_sections.  Dump incremental_got_plt section.
8442         * incremental.cc: Include target.h.
8443         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
8444         parameter.  Adjust all callers.  Find incremental_got_plt section.
8445         (Incremental_inputs::create_data_sections): Create incremental_got_plt
8446         section.
8447         (Output_section_incremental_inputs::set_final_data_size): Calculate
8448         size of incremental_got_plt section.
8449         (Output_section_incremental_inputs::do_write): Write the
8450         incremental_got_plt section.
8451         (Got_plt_view_info): New struct.
8452         (Local_got_offset_visitor): New class.
8453         (Global_got_offset_visitor): New class.
8454         (Global_symbol_visitor_got_plt): New class.
8455         (Output_section_incremental_inputs::write_got_plt): New function.
8456         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
8457         Add parameter.  Adjust all callers.
8458         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8459         (Incremental_inputs::got_plt_section): New function.
8460         (Incremental_inputs::got_plt_section_): New data member.
8461         (Incremental_got_plt_reader): New class.
8462         * layout.cc (Layout::create_incremental_info_sections): Add the
8463         incremental_got_plt section.
8464         * object.h (Got_offset_list::get_list): New function.
8465         (Got offset_list::for_all_got_offsets): New function.
8466         (Sized_relobj::local_got_offset_list): New function.
8467         * powerpc.cc (Target_powerpc::got_size): Add const.
8468         (Target_powerpc::got_entry_count): New function.
8469         (Target_powerpc::plt_entry_count): New function.
8470         (Target_powerpc::first_plt_entry_offset): New function.
8471         (Target_powerpc::plt_entry_size): New function.
8472         (Output_data_plt_powerpc::entry_count): New function.
8473         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
8474         (Output_data_plt_powerpc::get_plt_entry_size): New function.
8475         * sparc.cc (Target_sparc::got_size): Add const.
8476         (Target_sparc::got_entry_count): New function.
8477         (Target_sparc::plt_entry_count): New function.
8478         (Target_sparc::first_plt_entry_offset): New function.
8479         (Target_sparc::plt_entry_size): New function.
8480         (Output_data_plt_sparc::entry_count): New function.
8481         (Output_data_plt_sparc::first_plt_entry_offset): New function.
8482         (Output_data_plt_sparc::get_plt_entry_size): New function.
8483         * symtab.h (Symbol::got_offset_list): New function.
8484         (Symbol_table::for_all_symbols): New function.
8485         * target.h (Sized_target::got_entry_count): New function.
8486         (Sized_target::plt_entry_count): New function.
8487         (Sized_target::plt_entry_size): New function.
8488         * x86_64.cc (Target_x86_64::got_size): Add const.
8489         (Target_x86_64::got_entry_count): New function.
8490         (Target_x86_64::plt_entry_count): New function.
8491         (Target_x86_64::first_plt_entry_offset): New function.
8492         (Target_x86_64::plt_entry_size): New function.
8493         (Output_data_plt_x86_64::entry_count): New function.
8494         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
8495         (Output_data_plt_x86_64::get_plt_entry_size): New function.
8496
8497 2010-08-12  Cary Coutant  <ccoutant@google.com>
8498
8499         * archive.cc: Include incremental.h.
8500         (Archive::Archive): Initialize incremental_info_.
8501         (Archive::include_member): Record archive members in incremental info.
8502         (Add_archive_symbols::run): Record begin and end of an archive in
8503         incremental info.
8504         (Lib_group::include_member): Record objects in incremental info.
8505         * archive.h (Incremental_archive_entry): Forward declaration.
8506         (Archive::set_incremental_info): New member function.
8507         (Archive::incremental_info): New member function.
8508         (Archive::Unused_symbol_iterator): New class.
8509         (Archive::unused_symbols_begin): New member function.
8510         (Archive::unused_symbols_end): New member function.
8511         (Archive::incremental_info_): New data member.
8512         * incremental-dump.cc (find_input_containing_global): New function.
8513         (dump_incremental_inputs): Dump new incremental info sections.
8514         * incremental.cc: Include symtab.h.
8515         (Output_section_incremental_inputs): New class.
8516         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
8517         new incremental info sections.
8518         (Sized_incremental_binary::do_check_inputs): Likewise.
8519         (Incremental_inputs::report_archive): Remove.
8520         (Incremental_inputs::report_archive_begin): New function.
8521         (Incremental_inputs::report_archive_end): New function.
8522         (Incremental_inputs::report_object): New function.
8523         (Incremental_inputs::finalize_inputs): Remove.
8524         (Incremental_inputs::report_input_section): New function.
8525         (Incremental_inputs::report_script): Rewrite.
8526         (Incremental_inputs::finalize): Do nothing but finalize string table.
8527         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8528         (Incremental_inputs::sized_create_inputs_section_data): Remove.
8529         (Incremental_inputs::create_data_sections): New function.
8530         (Incremental_inputs::relocs_entsize): New function.
8531         (Output_section_incremental_inputs::set_final_data_size): New function.
8532         (Output_section_incremental_inputs::do_write): New function.
8533         (Output_section_incremental_inputs::write_header): New function.
8534         (Output_section_incremental_inputs::write_input_files): New function.
8535         (Output_section_incremental_inputs::write_info_blocks): New function.
8536         (Output_section_incremental_inputs::write_symtab): New function.
8537         * incremental.h (Incremental_script_entry): Forward declaration.
8538         (Incremental_object_entry): Forward declaration.
8539         (Incremental_archive_entry): Forward declaration.
8540         (Incremental_inputs): Forward declaration.
8541         (Incremental_inputs_header_data): Remove.
8542         (Incremental_inputs_header): Remove.
8543         (Incremental_inputs_header_write): Remove.
8544         (Incremental_inputs_entry_data): Remove.
8545         (Incremental_inputs_entry): Remove.
8546         (Incremental_inputs_entry_write): Remove.
8547         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
8548         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
8549         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8550         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
8551         Likewise.
8552         (Incremental_input_entry): New class.
8553         (Incremental_script_entry): New class.
8554         (Incremental_object_entry): New class.
8555         (Incremental_archive_entry): New class.
8556         (Incremental_inputs::Incremental_inputs): Initialize new data members.
8557         (Incremental_inputs::report_inputs): Remove.
8558         (Incremental_inputs::report_archive): Remove.
8559         (Incremental_inputs::report_archive_begin): New function.
8560         (Incremental_inputs::report_archive_end): New function.
8561         (Incremental_inputs::report_object): Change prototype.
8562         (Incremental_inputs::report_input_section): New function.
8563         (Incremental_inputs::report_script): Change prototype.
8564         (Incremental_inputs::get_reloc_count): New function.
8565         (Incremental_inputs::set_reloc_count): New function.
8566         (Incremental_inputs::create_data_sections): New function.
8567         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8568         (Incremental_inputs::inputs_section): New function.
8569         (Incremental_inputs::symtab_section): New function.
8570         (Incremental_inputs::relocs_section): New function.
8571         (Incremental_inputs::get_stringpool): Add const.
8572         (Incremental_inputs::command_line): Add const.
8573         (Incremental_inputs::inputs): Remove.
8574         (Incremental_inputs::command_line_key): New function.
8575         (Incremental_inputs::input_file_count): New function.
8576         (Incremental_inputs::input_files): New function.
8577         (Incremental_inputs::relocs_entsize): New function.
8578         (Incremental_inputs::sized_create_inputs_section_data): Remove.
8579         (Incremental_inputs::finalize_inputs): Remove.
8580         (Incremental_inputs::Input_info): Remove.
8581         (Incremental_inputs::lock_): Remove.
8582         (Incremental_inputs::inputs_): Change type.
8583         (Incremental_inputs::inputs_map_): Remove.
8584         (Incremental_inputs::current_object_entry_): New data member.
8585         (Incremental_inputs::inputs_section_): New data member.
8586         (Incremental_inputs::symtab_section_): New data member.
8587         (Incremental_inputs::relocs_section_): New data member.
8588         (Incremental_inputs::reloc_count_): New data member.
8589         (Incremental_inputs_reader): New class.
8590         (Incremental_symtab_reader): New class.
8591         (Incremental_relocs_reader): New class.
8592         * layout.cc (Layout::finalize): Move finalization of incremental info
8593         and creation of incremental info sections to follow finalization of
8594         symbol table.  Set offsets for postprocessing sections.
8595         (Layout::create_incremental_info_sections): Call
8596         Incremental_inputs::create_data_sections.  Add incremental symtab
8597         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
8598         sections to layout after input sections.
8599         * layout.h (struct Timespec): Forward declaration.
8600         (Layout::incremental_inputs): Add const.
8601         (Layout::create_incremental_info_sections): Add parameter.
8602         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
8603         * object.cc: Include incremental.h.
8604         (Relobj::finalize_incremental_relocs): New function.
8605         (Sized_relobj::do_layout): Record input sections in incremental info.
8606         * object.h (Object::output_section): New function.
8607         (Object::output_section_offset): Moved from Relobj.
8608         (Object::get_incremental_reloc_base): New function.
8609         (Object::get_incremental_reloc_count): New function.
8610         (Object::do_output_section): New function.
8611         (Object::do_output_section_offset): Moved from Relobj.
8612         (Object::do_get_incremental_reloc_base): New function.
8613         (Object::do_get_incremental_reloc_count): New function.
8614         (Object::Object): Initialize new data members.
8615         (Relobj::output_section): Renamed do_output_section and moved to
8616         protected.
8617         (Relobj::output_section_offset): Moved to Object.
8618         (Relobj::do_get_incremental_reloc_base): New function.
8619         (Relobj::do_get_incremental_reloc_count): New function.
8620         (Relobj::allocate_incremental_reloc_counts): New function.
8621         (Relobj::count_incremental_reloc): New function.
8622         (Relobj::finalize_incremental_relocs): New function.
8623         (Relobj::next_incremental_reloc_index): New function.
8624         (Relobj::reloc_counts_): New data member.
8625         (Relobj::reloc_bases_): New data member.
8626         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
8627         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
8628         (Sized_relobj::incremental_relocs_scan): New function.
8629         (Sized_relobj::incremental_relocs_scan_reltype): New function.
8630         (Sized_relobj::incremental_relocs_write): New function.
8631         (Sized_relobj::incremental_relocs_write_reltype): New function.
8632         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
8633         incremental link.
8634         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
8635         archives and object files elsewhere.
8636         (Add_symbols::run): Report object files here.
8637         (Finish_group::run): Report end of archive at end of group.
8638         * reloc.cc: Include layout.h, incremental.h.
8639         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
8640         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
8641         (Sized_relobj::incremental_relocs_scan): New function.
8642         (Sized_relobj::incremental_relocs_scan_reltype): New function.
8643         (Sized_relobj::do_relocate_sections): Write incremental relocations.
8644         (Sized_relobj::incremental_relocs_write): New function.
8645         (Sized_relobj::incremental_relocs_write_reltype): New function.
8646         * script.cc (read_input_script): Rewrite test for incremental link.
8647         Change call to Incremental_inputs::report_script.
8648         * symtab.h (Symbol_table::first_global_index): New function.
8649         (Symbol_table::output_count): New function.
8650
8651 2010-08-12  Doug Kwan  <dougkwan@google.com>
8652
8653         * arm.cc (Target_arm::merge_object_attributes): Check command line
8654         options --no-wchar-size-warning and --no-enum-size-warning.
8655         * options.h (General_options): Add ld-compatible options
8656         --no-enum-size-warning and --no-wchar-size-warning.
8657
8658 2010-08-04  Ian Lance Taylor  <iant@google.com>
8659
8660         * x86_64.cc (Target_x86_64::Scan::local): Use
8661         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
8662         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
8663         (Target_x86_64::Scan::global): Likewise.
8664         (Target_x86_64::Relocate::relocate): Likewise.
8665         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
8666         Likewise.
8667
8668 2010-08-03  Cary Coutant  <ccoutant@google.com>
8669
8670         * merge.cc (Output_merge_string::do_add_input_section): Count strings
8671         to reserve space in merged_strings vector. Keep total input size
8672         for stats.
8673         (Output_merge_string::do_print_merge_stats): Print total input size.
8674         * merge.h (Output_merge_string): Add input_size_ field.
8675         * stringpool.cc (Stringpool_template::string_length): Move
8676         implementations out of Stringpool_template class and place in
8677         stringpool.h.
8678         * stringpool.h (string_length): Move out of Stringpool_template.
8679
8680 2010-08-03  Ian Lance Taylor  <iant@google.com>
8681
8682         PR 11712
8683         * layout.cc (relaxation_loop_body): If address of load segment is
8684         set, adjust address to include headers if possible.
8685
8686 2010-08-03  Ian Lance Taylor  <iant@google.com>
8687
8688         * version.cc (version_string): Bump to 1.10.
8689
8690 2010-08-03  Ian Lance Taylor  <iant@google.com>
8691
8692         PR 11805
8693         * layout.h (enum Output_section_order): Define.
8694         (class Layout): Update declarations.
8695         * layout.cc (Layout::get_output_section): Add order parameter.
8696         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
8697         is_first_non_relro parameters.  Change all callers.
8698         (Layout::choose_output_section): Likewise.
8699         (Layout::add_output_section_data): Likewise.
8700         (Layout::make_output_section): Likewise.  Set order.
8701         (Layout::default_section_order): New function.
8702         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
8703         * output.cc (Output_section::Output_section): Initialize order_.
8704         Don't initialize deleted fields.
8705         (Output_segment::Output_segment): Don't initialize deleted
8706         fields.
8707         (Output_segment::add_output_section_to_load): New function
8708         replacing add_output_section.  Change all callers to call this or
8709         add_output_section_to_nonload.
8710         (Output_segment::add_output_section_to_nonload): New function.
8711         (Output_segment::remove_output_section): Rewrite.
8712         (Output_segment::add_initial_output_data): Likewise.
8713         (Output_segment::has_any_data_sections): Likewise.
8714         (Output_segment::is_first_section_relro): Likewise.
8715         (Output_segment::maximum_alignment): Likewise.
8716         (Output_segment::has_dynamic_reloc): New function replacing
8717         dynamic_reloc_count.  Change all callers.
8718         (Output_segment::has_dynamic_reloc_list): New function replacing
8719         dynamic_reloc_count_list.  Change all callers.
8720         (Output_segment::set_section_addresses): Rewrite.
8721         (Output_segment::set_offset): Rewrite.
8722         (Output_segment::find_first_and_last_list): Remove.
8723         (Output_segment::set_tls_offsets): Rewrite.
8724         (Output_segment::first_section_load_address): Likewise.
8725         (Output_segment::output_section_count): Likewise.
8726         (Output_segment::section_with_lowest_load_address): Likewise.
8727         (Output_segment::write_section_headers): Likewise.
8728         (Output_segment::print_sections_to_map): Likewise.
8729         * output.h (class Output_data): Remove dynamic_reloc_count_
8730         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
8731         (Output_data::add_dynamic_reloc): Rewrite.
8732         (Output_data::has_dynamic_reloc): New function.
8733         (Output_data::dynamic_reloc_count): Remove.
8734         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
8735         is_last_relro_, is_first_non_relro_, is_interp_,
8736         is_dynamic_linker_section_ fields.  Add order and set_order
8737         functions.  Remove is_relro_local, set_is_relro_local,
8738         is_last_relro, set_is_last_relro, is_first_non_relro,
8739         set_is_first_non_relro functions, is_interp, set_is_interp,
8740         is_dynamic_linker_section, and set_is_dynamic_linker_section
8741         functions.
8742         (class Output_segment): Change Output_data_list from std::list to
8743         std:;vector.  Add output_lists_ field.  Remove output_data_ and
8744         output_bss_ fields.  Update declarations.
8745
8746 2010-08-02  Ian Lance Taylor  <iant@google.com>
8747
8748         * arm.cc (Target_arm::gc_process_relocs): Use typename.
8749         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
8750         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
8751
8752 2010-08-02  Ian Lance Taylor  <iant@google.com>
8753
8754         PR 11855
8755         * script.cc (Script_options::Script_options): Initialize
8756         symbol_definitions_ and symbol_references_.
8757         (Script_options::add_symbol_assignment): Update
8758         symbol_definitions_ and symbol_references_.
8759         (Script_options::add_symbol_reference): New function.
8760         (script_symbol): New function.
8761         * script.h (class Script_options): Add symbol_definitions_ and
8762         symbol_references_ fields.
8763         (Script_options::referenced_const_iterator): New type.
8764         (Script_options::referenced_begin): New function.
8765         (Script_options::referenced_end): New function.
8766         (Script_options::is_referenced): New function.
8767         (Script_options::any_unreferenced): New function.
8768         * script-c.h (script_symbol): Declare.
8769         * yyscript.y (exp): Call script_symbol.
8770         * symtab.cc: Include "script.h".
8771         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
8772         Change all callers.  Check symbols referenced by scripts.
8773         (Symbol_table::add_undefined_symbols_from_command_line): Add
8774         layout parameter.  Change all callers.
8775         (Symbol_table::do_add_undefined_symbols_from_command_line):
8776         Likewise.  Break out loop body.  Check symbols referenced by
8777         scripts.
8778         (Symbol_table::add_undefined_symbol_from_command_line): New
8779         function broken out of
8780         do_add_undefined_symbols_from_command_line.
8781         * symtab.h (class Symbol_table): Update declarations.
8782         * archive.cc: Include "layout.h".
8783         (Archive::should_include_member): Add layout parameter.  Change
8784         all callers.  Check for symbol mentioned in expression.
8785         * archive.h (class Archive): Update declaration.
8786         * object.cc (Sized_relobj::do_should_include_member): Add layout
8787         parameter.
8788         * object.h (Object::should_include_member): Add layout parameter.
8789         Change all callers.
8790         (Object::do_should_include_member): Add layout parameter.
8791         (class Sized_relobj): Update declaration.
8792         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
8793         parameter.
8794         * dynobj.h (class Sized_dynobj): Update declaration.
8795         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
8796         layout parameter.
8797         * plugin.h (class Sized_pluginobj): Update declaration.
8798
8799 2010-08-02  Ian Lance Taylor  <iant@google.com>
8800
8801         PR 11866
8802         * output.cc (Output_segment::set_offset): Search for the first and
8803         last sections rather than assuming that the list is in order.
8804         (Output_segment::find_first_and_last_list): New function.
8805         * output.h (class Output_segment): Update declarations.
8806         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
8807         (relro_strip_test_SOURCES): New variable.
8808         (relro_strip_test_DEPENDENCIES): New variable.
8809         (relro_strip_test_LDFLAGS): New variable.
8810         (relro_strip_test_LDADD): New variable.
8811         (relro_strip_test.so): New target.
8812
8813 2010-08-02  Ian Lance Taylor  <iant@google.com>
8814
8815         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
8816         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
8817         (Target_i386::got_tlsdesc_section): New function.
8818         (Target_i386::got_section): Create space for GOT entries for
8819         TLSDESC relocations.
8820         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
8821         R_386_TLS_GOTDESC.
8822         (Target_i386::Scan::global): Likewise.
8823         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
8824         using TLSDESC GOT.
8825         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
8826         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
8827         (Target_x86_64::got_tlsdesc_section): New function.
8828         (Target_x86_64::got_section): Create space for GOT entries for
8829         TLSDESC relocations.
8830         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
8831         R_386_TLS_GOTDESC.
8832         (Target_x86_64::Scan::global): Likewise.
8833         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
8834         using TLSDESC GOT.
8835
8836 2010-08-02  Ian Lance Taylor  <iant@google.com>
8837
8838         * testsuite/final_layout.sh: Use dc to convert from hex to
8839         decimal.
8840
8841 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
8842
8843         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
8844         paramter to the call to gold::gc_process_relocs.
8845         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
8846         paramter to the call to gold::gc_process_relocs.
8847         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
8848         parameter to the call to gold::gc_process_relocs.
8849         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
8850         template parameter to the call to gold::gc_process_relocs.
8851         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
8852         paramter to the call to gold::gc_process_relocs.
8853         * gc.h (get_embedded_addend_size): New function.
8854         (gc_process_relocs): Save the size of the reloc for use by ICF.
8855         * icf.cc (get_section_contents): Get the addend from the text section
8856         for SHT_REL relocation sections.
8857         * icf.h (Icf::Reloc_addend_size_info): New typedef.
8858         (Icf::Reloc_info): Add new member reloc_addend_size_info.
8859         * int_encoding.h (read_from_pointer): New overloaded function.
8860         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
8861         * testsuite/icf_sht_rel_addend_test.sh: New file.
8862         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
8863         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
8864
8865 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8866
8867         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
8868         * Makefile.in: Regenerate.
8869         * testsuite/Makefile.in: Regenerate.
8870
8871 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
8872
8873         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
8874         * gold/testsuite/debug_msg.cc: Likewise.
8875         * gold/testsuite/odr_violation1.cc
8876         * gold/testsuite/odr_violation2.cc
8877
8878 2010-07-21  Cary Coutant  <ccoutant@google.com>
8879
8880         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
8881         string, and length fields.
8882         (Output_merge_string::Merged_strings_list): New type.
8883         (Output_merge_string::Merged_strings_lists): New typedef.
8884         (Output_merge_string): Replace merged_strings_ with
8885         merged_strings_lists_.
8886         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
8887         Merged_strings_list per input object and section.  Don't store pointer
8888         to the string.  Don't store length with each merged string entry.
8889         (Output_merge_string::finalize_merged_data): Loop over list of merged
8890         strings lists.  Recompute length of each merged string.
8891
8892 2010-07-15  Cary Coutant  <ccoutant@google.com>
8893
8894         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
8895         here.
8896
8897 2010-07-14  Ian Lance Taylor  <iant@google.com>
8898
8899         * descriptors.cc (Descriptors::open): Report correct name in error
8900         message.
8901
8902 2010-07-13  Doug Kwan  <dougkwan@google.com>
8903
8904         * arm.cc (Arm_input_section::Arm_input_section): For a
8905         SHT_ARM_EXIDX section, always keeps the input sections.
8906         (Arm_input_section::set_exidx_section_link): New method.
8907         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
8908         has_errors_ to false.
8909         (Arm_exidx_input_section::has_errors,
8910         Arm_exidx_input_section::set_has_errors): New methods.
8911         (Arm_exidx_input_section::has_errors_): New data member.
8912         (Arm_relobj::get_exidx_shndx_list): New method.
8913         (Arm_output_section::append_text_sections_to_list): Do not skip
8914         section without SHF_EXECINSTR.
8915         (Arm_output_section::fix_exidx_coverage): Skip input sections with
8916         errors.
8917         (Arm_relobj::make_exidx_input_section): Add new parameter for text
8918         section header.  Make error messages more verbose.  Check for
8919         a non-executable section linked to an EXIDX section.
8920         (Arm_relobj::do_read_symbols): Remove error checking, which has been
8921         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
8922         check that there is no deferred EXIDX section if we exit early.
8923         Instead of not making an EXIDX section in case of an error, make one
8924         and set the has_errors flag of it.
8925         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
8926         in a relocatable link.
8927         (Target_arm::do_relax): Look for the EXIDX output section instead of
8928         assuming that it is called .ARM.exidx.
8929         (Target_arm::fix_exidx_coverage): Add a new parameter for input
8930         section list.  Do not check for SHF_EXECINSTR section flags but
8931         skip any input section with errors.
8932         * output.cc (Output_section::Output_section): Initialize
8933         always_keeps_input_sections_ to false.
8934         (Output_section::add_input_section): Check for
8935         always_keeps_input_sections_.
8936         *  output.h (Output_section::always_keeps_input_sections,
8937         Output_section::set_always_keeps_input_sections): New methods.
8938         (Output_section::always_keeps_input_sections): New data member.
8939
8940 2010-07-13  Rafael Espindola  <espindola@google.com>
8941
8942         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
8943         * fileread.h (Input_file): Add try_extra_search_path and find_file.
8944
8945 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
8946             Ian Lance Taylor  <iant@google.com>
8947
8948         * output.h (Output_section_lookup_maps::add_merge_section):
8949         Correct check of whether value was inserted.
8950         (Output_section_lookup_maps::add_merge_input_section): Likewise.
8951         (Output_section_lookup_maps::add_relaxed_input_section):
8952         Likewise.
8953         * arm.cc (Target_arm::got_section): Remove used local os.
8954         * i386.cc (Target_i386::got_section): Likewise.
8955         * x86_64.cc (Target_x86_64::got_section): Likewise.
8956         * sparc.cc (Target_sparc::got_section): Likewise.
8957         (Target_sparc::relocate): Remove unused local have_got_offset.
8958         * powerpc.cc (Target_powerpc::relocate): Likewise.
8959
8960 2010-07-13  Ian Lance Taylor  <iant@google.com>
8961
8962         * compressed_output.cc (zlib_decompress): Fix signature in
8963         !HAVE_ZLIB_H case.
8964
8965         * archive.cc (Archive::include_member): Unlock an external member
8966         of a thin archive.  Don't bother to delete an object we know is
8967         NULL.
8968
8969 2010-07-12  Cary Coutant  <ccoutant@google.com>
8970
8971         * compressed_output.cc (zlib_decompress): New function.
8972         (get_uncompressed_size): New function.
8973         (decompress_input_section): New function.
8974         * compressed_output.h (get_uncompressed_size): New function.
8975         (decompress_input_section): New function.
8976         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
8977         Handle compressed debug sections.
8978         * layout.cc (is_compressed_debug_section): New function.
8979         (Layout::output_section_name): Map compressed section names to
8980         canonical names.
8981         * layout.h (is_compressed_debug_section): New function.
8982         (is_debug_info_section): Recognize compressed debug sections.
8983         * merge.cc: Include compressed_output.h.
8984         (Output_merge_data::do_add_input_section): Handle compressed
8985         debug sections.
8986         (Output_merge_string::do_add_input_section): Handle compressed
8987         debug sections.
8988         * object.cc: Include compressed_output.h.
8989         (Sized_relobj::Sized_relobj): Initialize new data members.
8990         (build_compressed_section_map): New function.
8991         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8992         * object.h (Object::section_is_compressed): New method.
8993         (Object::do_section_is_compressed): New method.
8994         (Sized_relobj::Compressed_section_map): New type.
8995         (Sized_relobj::do_section_is_compressed): New method.
8996         (Sized_relobj::compressed_sections_): New data member.
8997         * output.cc (Output_section::add_input_section): Handle compressed
8998         debug sections.
8999         * reloc.cc: Include compressed_output.h.
9000         (Sized_relobj::write_sections): Handle compressed debug sections.
9001
9002 2010-07-08  Cary Coutant  <ccoutant@google.com>
9003
9004         * resolve.cc (Symbol_table::resolve): Remember whether undef was
9005         weak when resolving to a dynamic def.
9006         (Symbol_table::should_override): Add adjust_dyndef flag; set it
9007         for weak undef/dynamic def cases. Adjust callers.
9008         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
9009         undef_binding_weak_.
9010         (Symbol_table::sized_write_globals): Adjust symbol binding.
9011         (Symbol_table::sized_write_symbol): Add binding parameter.
9012         * symtab.h (Symbol::set_undef_binding): New method.
9013         (Symbol::is_undef_binding_weak): New method.
9014         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
9015         (Symbol_table::should_override): Add new parameter.
9016         (Symbol_table::sized_write_symbol): Add new parameter.
9017
9018         * testsuite/weak_undef_file1.cc: Add new test case.
9019         * testsuite/weak_undef_file2.cc: Fix header comment.
9020         * testsuite/weak_undef_test.cc: Add new test case.
9021
9022 2010-06-29  Doug Kwan  <dougkwan@google.com>
9023
9024         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
9025         Initialize USE_SYMBOL_.
9026         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
9027         definition.
9028         (Arm_reloc_property::uses_symbol_): New data member declaration.
9029         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
9030         uses symbol value and symbol is undefined but not weakly undefined.
9031
9032 2010-06-28  Rafael Espindola  <espindola@google.com>
9033
9034         * plugin.cc (Plugin::load): Use dlerror.
9035
9036 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
9037
9038         * symtab.cc (detect_odr_violations): When reporting an ODR
9039         violation, report an object where the symbol is defined.
9040
9041 2010-06-25  Doug Kwan  <dougkwan@google.com>
9042
9043         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
9044         (Target_arm::section_may_have_icf_unsafe_pointers): New method
9045         definition.
9046         (Target_arm::Scan::local_reloc_may_be_function_pointer,
9047         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
9048         target hook to detect function points.
9049         (Target_arm::Scan::possible_function_pointer_reloc): New method.
9050         * icf.h (Icf::check_section_for_function_pointers): Change type of
9051         parameter SECTION_NAME to const reference to std::string.  Use
9052         target hook to determine if section may have unsafe pointers.
9053         * target.h (Target::section_may_have_icf_unsafe_pointers): New
9054         method definition.
9055
9056 2010-06-21  Rafael Espindola  <espindola@google.com>
9057
9058         * fileread.cc (Input_file::find_fie): New
9059         (Input_file::open): Use Input_file::find_fie.
9060         * fileread.h (Input_file::find_fie): New
9061         * plugin.cc (set_extra_library_path): New.
9062         (Plugin::load): Add set_extra_library_path to the transfer vector.
9063         (Plugin_manager::set_extra_library_path): New.
9064         (Plugin_manager::add_input_file): Use the extra search path if set.
9065         (set_extra_library_path(): New.
9066         * plugin.h (Plugin_manager): Add set_extra_library_path and
9067         extra_search_path_.
9068
9069 2010-06-19  Cary Coutant  <ccoutant@google.com>
9070
9071         * layout.cc (gdb_sections): Add .debug_types.
9072         (lines_only_debug_sections): Likewise.
9073
9074 2010-06-18  Rafael Espindola  <espindola@google.com>
9075
9076         * plugin.cc (add_input_file,add_input_library)
9077         (Plugin_manager::add_input_file): Make filename arguments const.
9078         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
9079         const.
9080
9081 2010-06-16  Doug Kwan  <dougkwan@google.com>
9082
9083         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
9084         .ARM.attributes section if we have not merged any input
9085         attributes sections.
9086
9087 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9088
9089         * arm.cc: Allow combining objects with no EABI version
9090         information.
9091
9092 2010-06-15  Rafael Espindola  <espindola@google.com>
9093
9094         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
9095
9096 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9097
9098         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
9099         (struct iovec): Correct !HAVE_READV definition.
9100
9101 2010-06-10  Cary Coutant  <ccoutant@google.com>
9102
9103         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
9104         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
9105         reloc sections.
9106         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
9107
9108         PR 11683
9109         * symtab.h (Symbol::is_placeholder): New member function.
9110         * target-reloc.h (relocate_section): Check for placeholder symbols.
9111
9112         * testsuite/Makefile.am (plugin_test_8): New test.
9113         (plugin_test_9): New test.
9114         * testsuite/Makefile.in: Regenerate.
9115
9116 2010-06-09  Nick Clifton  <nickc@redhat.com>
9117
9118         * yyscript.y (input_list_element): Allow strings prefixed with
9119         the '-' character.  Treat these as libraries.
9120         * script.cc (script_add_library): New function.  Adds a library
9121         specified by "-l<name>" found in an input script.
9122         * script-c.h: Add prototype for script_add_library.
9123
9124 2010-06-07  Doug Kwan  <dougkwan@google.com>
9125
9126         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
9127         Restrict stub-group size to be within long conditional branch
9128         range when working around cortex-A8 erratum.
9129
9130 2010-06-07  Damien Diederen  <dd@crosstwine.com>
9131
9132         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
9133         #ifdef typo.
9134
9135 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
9136
9137         PR gold/11658
9138         * output.cc
9139         (Output_section::Input_section_sort_entry::compare_section_ordering):
9140         Change to return non-zero correctly.
9141         (Output_section::Input_section_sort_section_order_index_compare
9142         ::operator()): Change to fix ambiguity in comparisons.
9143
9144 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
9145
9146         * gold.h (is_wildcard_string): New function.
9147         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
9148         (Layout::layout_eh_frame): Ditto.
9149         (Layout::find_section_order_index): New method.
9150         (Layout::read_layout_from_file): New method.
9151         * layout.h (Layout::find_section_order_index): New method.
9152         (Layout::read_layout_from_file): New method.
9153         (Layout::input_section_position_): New private member.
9154         (Layout::input_section_glob_): New private member.
9155         * main.cc (main): Call read_layout_from_file here.
9156         * options.h (--section-ordering-file): New option.
9157         * output.cc (Output_section::input_section_order_specified_): New
9158         member.
9159         (Output_section::Output_section): Initialize new member.
9160         (Output_section::add_input_section): Add new parameter.
9161         Keep input sections when --section-ordering-file is used.
9162         (Output_section::set_final_data_size): Sort input sections when
9163         section ordering file is specified.
9164         (Output_section::Input_section_sort_entry): Add new parameter.
9165         Check sorting type.
9166         (Output_section::Input_section_sort_entry::compare_section_ordering):
9167         New method.
9168         (Output_section::Input_section_sort_compare::operator()): Change to
9169         consider section_order_index.
9170         (Output_section::Input_section_sort_init_fini_compare::operator()):
9171         Change to consider section_order_index.
9172         (Output_section::Input_section_sort_section_order_index_compare
9173         ::operator()): New method.
9174         (Output_section::sort_attached_input_sections): Change to sort
9175         according to section order when specified.
9176         (Output_section::add_input_section<32, true>): Add new parameter.
9177         (Output_section::add_input_section<64, true>): Add new parameter.
9178         (Output_section::add_input_section<32, false>): Add new parameter.
9179         (Output_section::add_input_section<64, false>): Add new parameter.
9180         * output.h (Output_section::add_input_section): Add new parameter.
9181         (Output_section::input_section_order_specified): New
9182         method.
9183         (Output_section::set_input_section_order_specified): New method.
9184         (Input_section::Input_section): Initialize section_order_index_.
9185         (Input_section::section_order_index): New method.
9186         (Input_section::set_section_order_index): New method.
9187         (Input_section::section_order_index_): New member.
9188         (Input_section::Input_section_sort_section_order_index_compare): New
9189         struct.
9190         (Output_section::input_section_order_specified_): New member.
9191         * script-sections.cc (is_wildcard_string): Delete and move modified
9192         method to gold.h.
9193         (Output_section_element_input::Output_section_element_input): Modify
9194         call to is_wildcard_string.
9195         (Output_section_element_input::Input_section_pattern
9196         ::Input_section_pattern): Ditto.
9197         (Output_section_element_input::Output_section_element_input): Ditto.
9198         * testsuite/Makefile.am (final_layout): New test case.
9199         * testsuite/Makefile.in: Regenerate.
9200         * testsuite/final_layout.cc: New file.
9201         * testsuite/final_layout.sh: New file.
9202
9203 2010-06-01  Rafael Espindola  <espindola@google.com>
9204
9205         * plugin.cc (Plugin::load): Pass the output name to the plugin.
9206
9207 2010-06-01  Rafael Espindola  <espindola@google.com>
9208
9209         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
9210         visibility of symbols.
9211
9212 2010-05-27  Doug Kwan  <dougkwan@google.com>
9213
9214         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
9215         from start of output section instead of address for a local symbol
9216         in a merged or relaxed section when doing a relocatable link.
9217
9218 2010-05-26  Rafael Espindola  <espindola@google.com>
9219
9220         PR 11604
9221         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
9222         adding sections the garbage collector removed.
9223         * gold/testsuite/Makefile.am: Add test.
9224         * gold/testsuite/Makefile.in: Regenerate.
9225         * gold/testsuite/plugin_test_7.sh: New.
9226         * gold/testsuite/plugin_test_7_1.c: New.
9227         * gold/testsuite/plugin_test_7_2.c: New.
9228
9229 2010-05-26  Rafael Espindola  <espindola@google.com>
9230
9231         * script-sections.cc (Output_section_definition::set_section_addresses):
9232         Check for --section-start.
9233
9234 2010-05-26  Doug Kwan  <dougkwan@google.com>
9235
9236         * arm.cc (Arm_scan_relocatable_relocs): New class.
9237         (Target_arm::relocate_special_relocatable): New method.
9238         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
9239         (Arm_relocate_functions::thumb_branch_common): Same.
9240         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
9241         instead of Default_scan_relocatable_relocs.
9242         * target-reloc.h (relocate_for_relocatable): Let target handle
9243         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
9244         * target.h (Sized_target::relocate_special_relocatable): New method.
9245
9246 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9247
9248         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
9249
9250 2010-05-23  Doug Kwan  <dougkwan@google.com>
9251
9252         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
9253         instead of a cast.
9254         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
9255         with a direct branch, not a conditional branch, to a stub.
9256         * merge.cc (Output_merge_base::record_input_section): New method
9257         defintion.
9258         (Output_merge_data::do_add_input_section): Record input section if
9259         keeps-input-sections flag is set.
9260         (Output_merge_string::do_add_input_section): Ditto.
9261         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
9262         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
9263         INPUT_SECTIONS_.
9264         (Output_merge_base::keeps_input_sections,
9265         Output_merge_base::set_keeps_input_sections,
9266         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
9267         method definitions.
9268         (Output_merge_base::Input_sections): New type declaration.
9269         (Output_merge_base::input_sections_begin,
9270         Output_merge_base::input_sections_end,
9271         Output_merge_base::do_set_keeps_input_sections): New method definitions.
9272         (Output_merge_base::bool keeps_input_sections_,
9273         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
9274         Output_merge_base::input_sections_): New data members.
9275         (Output_merge_data::do_set_keeps_input_sections): New method
9276         defintion.
9277         (Output_merge_string::do_set_keeps_input_sections): Ditto.
9278         * output.cc (Output_section::Input_section::relobj): Move method
9279         defintion from class declaration to here and handle merge sections.
9280         (Output_section::Input_section::shndx): Ditto.
9281         (Output_section::Output_section): Remove initializations of removed
9282         data members and initialize new data member LOOKUP_MAPS_.
9283         (Output_section::add_input_section): Set keeps-input-sections flag
9284         for a newly created merge output section as appropriate.  Adjust code
9285         to use Output_section_lookup_maps class.
9286         (Output_section::add_relaxed_input_section): Adjst code for lookup
9287         maps code refactoring.
9288         (Output_section::add_merge_input_section): Add a new parameter
9289         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
9290         class.  If adding input section to a newly created merge output
9291         section fails, remove the new merge section.
9292         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
9293         Adjust code for use of the Output_section_lookup_maps class.
9294         (Output_section::find_merge_section): Ditto.
9295         (Output_section::build_lookup_maps): New method defintion.
9296         (Output_section::find_relaxed_input_section): Adjust code to use
9297         Output_section_lookup_maps class.
9298         (Output_section::get_input_sections): Export merge sections.  Adjust
9299         code to use Output_section_lookup_maps class.
9300         (Output_section:::add_script_input_section): Adjust code to use
9301         Output_section_lookup_maps class.  Update lookup maps for merge
9302         sections also.
9303         (Output_section::discard_states): Use Output_section_lookup_maps.
9304         (Output_section::restore_states): Same.
9305         * output.h (Merge_section_properties): Move class defintion out of
9306         Output_section.
9307         (Output_section_lookup_maps): New class.
9308         (Output_section::Input_section::is_merge_section): New method
9309         defintion.
9310         (Output_section::Input_section::relobj): Move defintion out of class
9311         defintion.  Declare method only.
9312         (Output_section::Input_section::shndx): Ditto.
9313         (Output_section::Input_section::output_merge_base): New method defintion.
9314         (Output_section::Input_section::u2_.pomb): New union field.
9315         (Output_section::Merge_section_by_properties_map,
9316         Output_section::Output_section_data_by_input_section_map,
9317         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
9318         Remove types.
9319         (Output_section::add_merge_input_section): Add new parameter
9320         KEEPS_INPUT_SECTIONS.
9321         (Output_section::build_lookup_maps): New method declaration.
9322         (Output_section::merge_section_map_,
9323         Output_section::merge_section_by_properties_map_,
9324         Output_section::relaxed_input_section_map_,
9325         Output_section::is_relaxed_input_section_map_valid_): Remove data
9326         members.
9327         (Output_section::lookup_maps_): New data member.
9328
9329 2010-05-21  Doug Kwan  <dougkwan@google.com>
9330
9331         PR gold/11619
9332         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
9333         avoid a compilation error.
9334
9335 2010-05-19  Rafael Espindola  <espindola@google.com>
9336
9337         * script-sections.cc (Output_section_definition::allocate_to_segment):
9338         Update the phdrs_list even when the output section is NULL.
9339         * testsuite/Makefile.am: Add test.
9340         * testsuite/Makefile.in: Regenerate.
9341         * testsuite/script_test_9.cc: New.
9342         * testsuite/script_test_9.sh: New.
9343         * testsuite/script_test_9.t: New.
9344
9345 2010-05-19  Doug Kwan  <dougkwan@google.com>
9346
9347         * arm.cc (Arm_input_section::original_size): New method.
9348         (Arm_input_section::do_addralign): Add a cast.
9349         (Arm_input_section::do_output_offset): Remove static cast.
9350         (Arm_input_section::original_addralign,
9351          Arm_input_section::original_size_): Change type to uint32_t.
9352         (Arm_input_section::init): Add safe casts for section alignment
9353         and size.
9354         (Arm_input_section::set_final_data_size): Do not set address and
9355         offset of stub table.
9356         (Arm_output_section::fix_exidx_coverage): Change use of of
9357         Output_section::Simple_input_section to that of
9358         Output_section::Input_section.
9359         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
9360         except for the first pass.
9361         * output.cc (Output_section::get_input_sections): Change type of
9362         input_sections to std::list<Input_section>.
9363         (Output_section::add_script_input_section): Rename from
9364         Output_section::add_simple_input_section.  Change type of SIS
9365         parameter from Simple_input_section to Input_section.
9366         * output.h (Output_section::Simple_input_section): Remove class.
9367         (Output_section::Input_section): Change class visibility to public.
9368         (Output_section::Input_section::addralign): Use stored alignments
9369         for special input sections if set.
9370         (Output_section::Input_section::set_addralign): New method.
9371         (Output_section::get_input_sections): Change parameter type from
9372         list of Simple_input_section to list of Input_section.
9373         (Output_section::add_script_input_section): Rename from
9374         Output_section::add_simple_input_section. Change first parameter's
9375         type from Simple_input_section to Input_section and remove the
9376         second and third parameters.
9377         * script-sections.cc (Input_section::Input_section_list): Change
9378         type to list of Output_section::Input_section/
9379         (Input_section_info::Input_section_info): Change parameter type of
9380         INPUT_SECTION to Output_section::Input_section.
9381         (Input_section_info::input_section): Change return type.
9382         (Input_section_info::input_section_): Change type to
9383         Output_section::Input_section.
9384         (Output_section_element_input::set_section_addresses): Adjust code
9385         to use Output_section::Input_section instead of
9386         Output_section::Simple_input_section.  Adjust code for renaming
9387         of Output_section::add_simple_input_section.
9388         (Orphan_output_section::set_section_addresses): Ditto.
9389
9390 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9391
9392         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
9393         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
9394
9395 2010-05-18  Rafael Espindola  <espindola@google.com>
9396
9397         * options.cc (General_options::finalize): Handle -nostdlib.
9398         * options.h (nostdlib): New option.
9399         * script.cc (script_add_search_dir): Handle -nostdlib.
9400
9401 2010-05-12  Doug Kwan  <dougkwan@google.com>
9402
9403         * arm.cc (Target_arm::do_finalize_sections): Create an empty
9404         attributes section only if there no attributes section after merging.
9405         (Target_arm::merge_object_attributes): Move value of
9406         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
9407         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
9408         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
9409         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
9410         and arm_attr_merge_7.stdout.
9411         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
9412         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
9413         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
9414         arm_attr_merge_7b.o): New rules.
9415         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
9416         arm_attr_merge_7
9417         * testsuite/Makefile.in: Regenerate.
9418         * testsuite/arm_attr_merge.sh: New file.
9419         * testsuite/arm_attr_merge_[67][ab].s: Same.
9420
9421 2010-05-05  Nick Clifton  <nickc@redhat.com>
9422
9423         * po/es.po: Updated Spanish translation.
9424
9425 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
9426
9427         * Makefile.am (install-exec-local): Properly install gold as
9428         default cross linker.
9429         * Makefile.in: Regenerated.
9430
9431 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
9432             Nick Clifton  <nickc@redhat.com>
9433
9434         * configure.ac (install_as_default): Define and set to false
9435         unless --enable-gold or --enable-gold=both/gold has been
9436         specified.
9437         * configure: Regenerate.
9438
9439         * Makefile.am (install-exec-local): Install the executable as
9440         'ld.gold'.  If install_as_default is true then also install it as
9441         'ld'.
9442         * Makefile.in: Regenerated.
9443
9444 2010-04-24  Ian Lance Taylor  <iant@google.com>
9445
9446         * layout.cc (Layout::layout_reloc): In relocatable link don't
9447         combine reloc sections for grouped sections.
9448
9449 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
9450
9451         * gc.h (gc_process_relocs): Pass information on relocs pointing to
9452         sections that are not ordinary to icf.
9453         * icf.cc (get_section_contents): Handle relocation pointing to section
9454         with no object or shndx information.
9455         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
9456         * testsuite/Makefile.in: Regenerate.
9457         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
9458         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
9459
9460 2010-04-22  Ian Lance Taylor  <iant@google.com>
9461
9462         * expression.cc (Expression::Expression_eval_info): Add
9463         result_alignment_pointer field.
9464         (Expression::eval_with_dot): Add result_alignment_pointer
9465         parameter.  Change all callers.
9466         (Expression::eval_maybe_dot): Likewise.
9467         (class Binary_expression): Add alignment_pointer parameter to
9468         left_value and right_value.  Change all callers.
9469         (BINARY_EXPRESSION): Set result alignment.
9470         (class Trinary_expression): Add alignment_pointer parameter to
9471         arg2_value and arg3_value.  Change all callers.
9472         (Trinary_cond::value): Set result alignment.
9473         (Max_expression::value, Min_expression::value): Likewise.
9474         (Align_expression::value): Likewise.
9475         * script-sections.cc (class Sections_element): Add dot_alignment
9476         parameter to set_section_addresses virtual function.  Update
9477         instantiations.
9478         (class Output_section_element): Likewise.
9479         (Script_sections::create_segments): Add dot_alignment parameter.
9480         Change all callers.
9481         (Script_sections::create_segments_from_phdrs_clause): Likewise.
9482         (Script_sections::set_phdrs_clause_addresses): Likewise.
9483         * script-sections.h: Update declarations.
9484         * script.h: Update declarations.
9485         * output.h (Output_segment::set_minimum_p_align): Don't decrease
9486         min_p_align.
9487         * testsuite/script_test_3.t: Set large alignment.
9488         * testsuite/script_test_3.sh: Make sure that at least one LOAD
9489         segment has expected alignment.
9490
9491 2010-04-22  Nick Clifton  <nickc@redhat.com>
9492
9493         * po/gold.pot: Updated by the Translation project.
9494         * po/vi.po: Updated Vietnamese translation.
9495
9496 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
9497
9498         * testsuite/Makefile.am (check_PROGRAMS): Add
9499         icf_virtual_function_folding_test.
9500         * testsuite/Makefile.in: Regenerated.
9501
9502 2010-04-15  Andrew Haley  <aph@redhat.com>
9503
9504         * options.h (merge_exidx_entries): New option.
9505         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
9506         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
9507         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
9508         (Target_arm::merge_exidx_entries): New function.
9509         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
9510         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
9511         to Arm_exidx_fixup constructor.
9512         Add new arg, merge_exidx_entries.
9513         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
9514         Arm_output_section::fix_exidx_coverage.
9515
9516 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
9517
9518         * icf.cc (get_section_contents): Check for preemptible functions.
9519         Ignore addend when appropriate.
9520         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
9521         section folded.
9522         (add_from_relobj): Check for section folded.
9523         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
9524         * symtab.h (should_add_dynsym_entry): Add new parameter.
9525         * target-reloc.h (scan_relocs): Check for section folded.
9526         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
9527         Check reloc types for function pointers in shared objects.
9528         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
9529         case.
9530         (icf_preemptible_functions_test): New test case.
9531         (icf_string_merge_test): New test case.
9532         * testsuite.Makefile.in: Regenerate.
9533         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
9534         bar_glob.  Refactor code.
9535         * testsuite/icf_preemptible_functions_test.cc: New file.
9536         * testsuite/icf_preemptible_functions_test.sh: New file.
9537         * testsuite/icf_string_merge_test.cc: New file.
9538         * testsuite/icf_string_merge_test.sh: New file.
9539         * testsuite/icf_virtual_function_folding_test.cc: New file.
9540         * testsuite/icf_virtual_function_folding_test.sh: New file.
9541
9542 2010-04-14  Doug Kwan  <dougkwan@google.com>
9543
9544         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
9545         for local symbol recounting if we remove a section due to ICF.
9546         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
9547         there are no regular objects in input.
9548
9549 2010-04-13  Doug Kwan  <dougkwan@google.com>
9550
9551         * arm.cc (Arm_input_section::set_final_data_size): Compute
9552         accurate final data size instead of using current data size.
9553
9554 2010-04-09  Doug Kwan  <dougkwan@google.com>
9555
9556         * layout.cc (Layout::choose_output_section): Handle script section
9557         types.
9558         (Layout::make_output_section_for_script): Add section type parameter.
9559         Handle script section types.
9560         * layout.h (Layout::make_output_section_for_script): Add section
9561         type parameter.
9562         * output.cc (Output_section::Output_section): Initialize data member
9563         is_noload_.
9564         (Output_section::do_reset_address_and_file_offset): Do not set address
9565         to 0 if section is a NOLOAD section.
9566         * output.h (Output_section::is_noload): New method.
9567         (Output_section::set_is_noload): Ditto.
9568         (Output_section::is_noload_): New data member.
9569         * script-c.h (Script_section_type): New enum type.
9570         (struct Parser_output_section_header): Add new file section_type.
9571         * script-sections.cc (Sections_element::output_section_name): Add
9572         parameter for returning script section type.
9573         (Output_section_definition::output_section_name): Ditto.
9574         (Output_section_definition::section_type)P; New method.
9575         (Output_section_definiton::script_section_type_name): Ditto.
9576         (Output_section_definition::script_section_type_): New data member.
9577         (Output_section_definition::Output_section_definition): Initialize
9578         data member Output_section_definition::script_section_type_.
9579         (Output_section_definition::create_sections): Pass script section type
9580         to Layout::make_output_section_for_script.
9581         (Output_section_definition::output_section_name): Return script
9582         section type to caller.
9583         (Output_section_definition::set_section_address): Do not advance
9584         dot value and load address if section type is NOLOAD.  Set address
9585         of NOLOAD sections regardless of section flags.
9586         (Output_section_definition::print): Print section type if it is
9587         not SCRIPT_SECTION_TYPE_NONE.
9588         (Output_section_definition::section_type): New method.
9589         (Output_section_definition::script_section_type_name): Ditto.
9590         (Script_sections::output_section_name): Add new parameter
9591         PSECTION_TYPE for returning script section type.  Pass it to
9592         section elements.  Handle discard sections.
9593         (Sort_output_sections::operator()): Handle NOLOAD sections.
9594         * script-sections.h (Script_sections::Section_type): New enum type.
9595         (Script_sections::output_section_name): Add a new parameter for
9596         returning script section type.
9597         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
9598         INFO and NOLOAD.
9599         * yyscript.y (union): Add new field SECTION_TYPE.
9600         (COPY, DSECT, INFO, NOLOAD): New tokens.
9601         (opt_address_and_section_type): Change type to output_section_header.
9602         (section_type): New non-terminal
9603         (section_header): Handle section type.
9604         (opt_address_and_section_type): Return section type value.
9605
9606 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
9607
9608         * testsuite/plugin_common_test_1.c (foo): Add prototype.
9609         * testsuite/plugin_common_test_2.c (foo): Likewise.
9610
9611 2010-04-08  Doug Kwan  <dougkwan@google.com>
9612
9613         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
9614         Output_merge_data.
9615         * output.cc (Output_section::add_merge_input_section): Simplify
9616         code and return status of Output_merge_base::add_input_section.
9617         Update merge section map only if Output_merge_base::add_input_section
9618         returns true.
9619
9620 2010-04-07  Doug Kwan  <dougkwan@google.com>
9621
9622         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
9623         if section is marked as containing instructions but has no mapping
9624         symbols.
9625         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
9626         correct section index.
9627         (Arm_relobj::find_linked_text_section): Ditto.
9628
9629 2010-04-07  Cary Coutant  <ccoutant@google.com>
9630
9631         * archive.cc (include_member): Destroy Read_symbols_data object before
9632         releasing file.
9633         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
9634         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
9635         (Read_symbols_data::~Read_symbols_data) New destructor.
9636         (Section_relocs::Section_relocs) New constructor.
9637         (Section_relocs::~Section_relocs) New destructor.
9638         (Read_relocs_data::Read_relocs_data) New constructor.
9639         (Read_relocs_data::~Read_relocs_data) New destructor.
9640         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
9641         pointers to NULL after deleting.
9642
9643 2010-04-07  Doug Kwan  <dougkwan@google.com>
9644
9645         * arm.cc: Replace "endianity" with "endianness" in comments.
9646         (Arm_exidx_cantunwind): Ditto.
9647         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
9648         (Arm_relobj::merge_flags_and_attributes): New method.
9649         (Arm_relobj::merge_flags_and_attributes_): New data member.
9650         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
9651         (Arm_relobj::scan_sections_for_stubs): Ditto.
9652         (Arm_relobj::do_read_symbols): Check to see if we really want to
9653         merge processor-specific flags and attributes.  Exit early if
9654         an object is empty except for section names and the undefined symbol.
9655         (Target_arm::do_finalize_sections): Move check for ELF format to
9656         Arm_relobj::do_read_symbols.  Merge processor specific flags and
9657         attributes from a regular object only when we have determined that
9658         it is aapropriate.  Do not create an .ARM.attributes section in
9659         output if there is no regular input object.
9660         (Target_arm::merge_processor_specific_flags): Check
9661         --warn-mismatch before printing any error.
9662         (Target_arm::merge_object_attributes): Ditto.
9663         * gold.cc (queue_middle_tasks): Handle the case in which there is
9664         no regular object in input.
9665         * options.cc (General_options::parse_EB): New method.
9666         (General_options::parse_EL): Same.
9667         (General_options::General_options): Initialize endianness_.
9668         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
9669         New options.
9670         (General_options::Endianness): New enum.
9671         (General_options::endianness): New method.
9672         (General_options::endianness_): New data member.
9673         * parameters.cc (Parameters::set_options): Check target endianness.
9674         (Parameters::set_target_once): Ditto.
9675         (Parameters::check_target_endianness): New method.
9676         (parameters_force_valid_target): If either -EL or -EB is specified,
9677         use it to define endianness of default target.
9678         * parameters.h (Parameters::check_target_endianness): New method
9679         declaration.
9680         * target.h (class Target): Change "endianity" to "endianness"
9681         in comments.
9682
9683 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9684
9685         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
9686         * configure: Regenerate.
9687         * Makefile.in: Regenerate.
9688         * testsuite/Makefile.in: Regenerate.
9689
9690 2010-04-06  Cary Coutant  <ccoutant@google.com>
9691
9692         gcc PR lto/42757
9693         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
9694         prevailing definitions of common symbols.
9695         * testsuite/plugin_test_6.sh: New test case.
9696         * testsuite/plugin_common_test_1.c: New test case.
9697         * testsuite/plugin_common_test_2.c: New test case.
9698         * testsuite/Makefile.am (plugin_test_6): New test case.
9699         * testsuite/Makefile.in: Regenerate.
9700
9701 2010-04-06  Nick Clifton  <nickc@redhat.com>
9702
9703         * po/vi.po: New Vietnamese translation.
9704
9705 2010-03-30  Doug Kwan  <dougkwan@google.com>
9706
9707         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
9708
9709 2010-03-25  Doug Kwan  <dougkwan@google.com>
9710
9711         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
9712         to avoid a conversion warning on a 32-bit host.
9713
9714 2010-03-24  Ian Lance Taylor  <iant@google.com>
9715
9716         * testsuite/script_test_3.t: Add a TLS segment.
9717         * testsuite/Makefile.am (check_PROGRAMS): Add
9718         tls_phdrs_script_test.
9719         (tls_phdrs_script_test_SOURCES): Define.
9720         (tls_phdrs_script_test_DEPENDENCIES): Define.
9721         (tls_phdrs_script_test_LDFLAGS): Define.
9722         (tls_phdrs_script_test_LDADD): Define.
9723         * testsuite/Makefile.in: Rebuild.
9724
9725 2010-03-23  Cary Coutant  <ccoutant@google.com>
9726
9727         * fileread.cc (find_or_make_view): Fix comment.
9728
9729 2010-03-23  Ian Lance Taylor  <iant@google.com>
9730
9731         * script-sections.cc (class Orphan_section_placement): Define
9732         PLACE_TLS and PLACE_TLS_BSS.
9733         (Orphan_section_placement::Orphan_section_placement): Initialize
9734         new places.
9735         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
9736         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
9737         (tls_script_test_SOURCES): Define.
9738         (tls_script_test_DEPENDENCIES): Define.
9739         (tls_script_test_LDFLAGS): Define.
9740         (tls_script_test_LDADD): Define.
9741         * testsuite/Makefile.in: Rebuild.
9742
9743 2010-03-22  Doug Kwan  <dougkwan@google.com>
9744
9745         * arm.cc (Arm_relocate_functions::abs8,
9746         Arm_relocate_functions::abs16): Use correct check for overflow
9747         specified in the ARM ELF specs.
9748         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
9749         target of a BLX instruction specially.
9750         (Reloc_stub::stub_type_for_reloc): Ditto.
9751         (Relocate::relocate): Use symbolic names instead of numeric relocation
9752         codes to report error.
9753         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
9754         workaround.
9755         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
9756         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
9757         thumb2_blx_out_of_range.stdout
9758         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
9759         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
9760         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
9761         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
9762         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
9763         thumb2_blx_in_range, thumb2_blx_in_range.o,
9764         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
9765         thumb2_blx_out_of_range.o): New rules.
9766         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
9767         thumb2_blx_in_range and thumb2_blx_out_of_range.
9768         * testsuite/Makefile.in: Regenerate.
9769         * arm_branch_in_range.sh: Add tests for THUMB BLX.
9770         * testsuite/thumb_blx_in_range.s: New file.
9771         * testsuite/thumb_blx_out_of_range.s: New file.
9772
9773 2010-03-22  Rafael Espindola  <espindola@google.com>
9774
9775         * archive.cc (Should_include): Move to archive.h.
9776         (should_include_member): Make it a member of Archive.
9777         (Lib_group): New.
9778         (Add_lib_group_symbols): New.
9779         * archive.h: Include options.h.
9780         (Archive_member): Moved from Archive.
9781         (Should_include): Moved from archive.cc.
9782         (Lib_group): New.
9783         (Add_lib_group_symbols): New.
9784         * dynobj.cc (do_should_include_member): New.
9785         * dynobj.h (do_should_include_member): New.
9786         * gold.cc (queue_initial_tasks): Update call to queue.
9787         * main.cc (main): Print lib group stats.
9788         * object.cc (do_should_include_member): New.
9789         * object.h: Include archive.h.
9790         (Object::should_include_member): New.
9791         (Object::do_should_include_member): New.
9792         (Sized_relobj::do_should_include_member): New.
9793         * options.cc (General_options::parse_start_lib): New.
9794         (General_options::parse_end_lib): New.
9795         (Input_arguments::add_file): Handle lib groups.
9796         (Input_arguments::start_group): Check we are not in a lib.
9797         (Input_arguments::start_lib): New.
9798         (Input_arguments::end_lib): New.
9799         * options.h (General_options): Add start_lib and end_lib.
9800         (Input_argument::lib_): New.
9801         (Input_argument::lib): New.
9802         (Input_argument::is_lib): New.
9803         (Input_file_lib): New.
9804         (Input_arguments::in_lib_): New.
9805         (Input_arguments::in_lib): New.
9806         (Input_arguments::start_lib): New.
9807         (Input_arguments::end_lib_): New.
9808         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
9809         in unused members as preempted.
9810         (Sized_pluginobj::do_should_include_member): New.
9811         * plugin.h (Sized_pluginobj::do_should_include_member): New.
9812         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
9813         return the blocker.
9814         (Read_symbols::do_whole_lib_group): New.
9815         (Read_symbols::do_lib_group): New.
9816         (Read_symbols::do_read_symbols): Handle lib groups.
9817         (Read_symbols::get_name): Handle lib groups.
9818         * readsyms.h (Read_symbols): Add an archive member pointer.
9819         (Read_symbols::do_whole_lib_group): New.
9820         (Read_symbols::do_lib_group): New.
9821         (Read_symbols::member_): New.
9822         * script.cc (read_input_script): Update call to queue_soon.
9823
9824 2010-03-19  Doug Kwan  <dougkwan@google.com>
9825
9826         * arm.cc (Stub_table::Stub_table): Initialize new data members
9827         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9828         (Stub_table::add_reloc_stub): Assign stub offset and update
9829         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9830         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
9831         New data members.
9832         (Stub_table::update_data_size_and_addralign): Use
9833         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
9834         instead of going over all reloc stubs.
9835         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
9836         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9837         Stringpool_template::offset_ to size of Stringpool_char.
9838         (Stringpool_template::new_key_offset): Remove code to initialize
9839         Stringpool_template::offset_.
9840         * stringpool.h (Stringpool_template::set_no_zero_null): Set
9841         Stringpool_template::offset_ to zero.
9842
9843 2010-03-15  Doug Kwan  <dougkwan@google.com>
9844
9845         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9846         offset_.
9847         (Stringpool_template::new_key_offset): New method.
9848         (Stringpool_template::add_string): Assign offsets when adding new
9849         strings.
9850         (Stringpool_template::set_string_offsets): Do not set string offsets
9851         when not optimizing.
9852         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
9853         member size_.
9854         (Chunked_vector::clear): Clear size_.
9855         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
9856         (Chunked_vector::size): Return size_.
9857         (Chunked_vector::push_back): Use size_ to find insert position.
9858         (Chunked_vector::size_): New data member.
9859         (Stringpool_template::set_no_zero_null): Assert string set is empty.
9860         (Stringpool_template::new_key_offset): New method declaration.
9861         (Stringpool_template::offset_): New data member.
9862
9863 2010-03-15   Rafael Espindola  <espindola@google.com>
9864
9865         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
9866         Add_symbols' constructor.
9867         * readsyms.h (Add_symbols): Remove the input_group member.
9868
9869 2010-03-10  Ian Lance Taylor  <iant@google.com>
9870
9871         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
9872         target to ask whether a reference to a symbol requires a stack
9873         split.
9874         * target.h (Target::is_call_to_non_split): New function.
9875         (Target::do_is_call_to_non_split): Declare virtual function.
9876         * target.cc: Include "symtab.h".
9877         (Target::do_is_call_to_non_split): New function.
9878         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
9879
9880 2010-03-10  Cary Coutant  <ccoutant@google.com>
9881
9882         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
9883         (File_read::open[1]): Remove initial mapping of whole_file_view_.
9884         (File_read::open[2]): Add whole_file_view_ to list of views.
9885         (File_read::make_view): Remove test of whole_file_view_.
9886         (File_read::find_or_make_view): Create whole_file_view_ if
9887         necessary.
9888         (File_read::clear_views): Replace bool parameter with enum;
9889         adjust all callers.  Don't delete views with permanent data;
9890         do delete cached views and views from archives if
9891         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
9892         if clearing the corresponding view.
9893         * fileread.h (File_read::Clear_views_mode): New enum.
9894         (File_read::View::is_permanent_view): New method.
9895         (File_read::clear_views): Replace bool parameter
9896         with enum; adjust all callers.
9897         * options.h (General_options): Change keep_files_mapped option;
9898         add map_whole_files.
9899         * readsyms.cc (Add_symbols::run): Delete sd_ object before
9900         releasing the file.
9901         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
9902         the file.
9903
9904 2010-03-10  David S. Miller  <davem@davemloft.net>
9905
9906         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
9907
9908 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
9909
9910         * icf.cc (get_section_contents): Add '@' marker after processing the
9911         merge reloc.
9912
9913 2010-03-08  Doug Kwan  <dougkwan@google.com>
9914
9915         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
9916         due to a conversion warning.
9917         (Arm_relobj::update_output_local_symbol_count): Check for local
9918         symbol with unset output index.
9919
9920 2010-03-05  Ian Lance Taylor  <iant@google.com>
9921
9922         * options.h (class General_options): Add --spare-dynamic-tags.
9923         * output.cc (Output_data_dynamic::set_final_data_size): Implement
9924         --spare-dynamic-tags.
9925
9926 2010-03-05  Ian Lance Taylor  <iant@google.com>
9927
9928         * incremental.cc: Include "libiberty.h".
9929
9930 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
9931
9932         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
9933         function, is_info_ member.
9934         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
9935         (Versions::Versions): Update caller.
9936         (Versions::define_base_version): Likewise.
9937         (Versions::add_def): Likewise.
9938
9939 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
9940
9941         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
9942         (Scan::possible_function_pointer_reloc): New function.
9943         (Scan::local_reloc_may_be_function_pointer): Change to call
9944         possible_function_pointer_reloc.
9945         (Scan::global_reloc_may_be_function_pointer): Ditto.
9946         * icf.h (Icf::check_section_for_function_pointers): Change to reject
9947         relocations in ".data.rel.ro._ZTV" section.
9948         * testsuite/icf_safe_so_test.sh: Change to pass i386.
9949         * testsuite/icf_safe_so_test.cc: Ditto.
9950         * testsuite/icf_safe_test.cc: Ditto.
9951         * testsuite/icf_safe_test.sh: Ditto.
9952
9953 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9954             Ian Lance Taylor  <iant@google.com>
9955
9956         * target-reloc.h (relocate_section): Check the symbol table index
9957         for -1U before setting the local symbol index.
9958         (scan_relocatable_relocs): If copying the relocation, record that
9959         the local symbol is required.
9960         * object.h (Symbol_value::is_output_symtab_index_set): New
9961         function.
9962         (Symbol_value::may_be_discarded_from_output_symtab): New
9963         function.
9964         (Symbol_value::has_output_symtab_entry): New function.
9965         (Symbol_value::needs_output_symtab_entry): Remove.
9966         (Symbol_value::output_symtab_index): Make sure the symbol index is
9967         set.
9968         (Symbol_value::set_output_symtab_index): Make sure the symbol
9969         index is not set.  Make sure the new index is valid.
9970         (Symbol_value::set_must_have_output_symtab_entry): New function.
9971         (Symbol_value::has_output_dynsym_entry): New function.
9972         (Symbol_value::set_output_dynsym_index): Make sure the new index
9973         is valid.
9974         (Sized_relobj::set_must_have_output_symtab_entry): New function.
9975         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
9976         local symbol if permitted.
9977         (Sized_relobj::do_finalize_local_symbols): Call
9978         is_output_symtab_index_set rather than needs_output_symtab_entry.
9979         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
9980         rather than needs_output_symtab_entry.  Call
9981         has_output_dynsym_entry rather than needs_output_dynsym_entry.
9982         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
9983         is_output_symtab_index_set rather than needs_output_symtab_entry.
9984         * testsuite/discard_locals_relocatable_test.c: New file.
9985         * testsuite/discard_locals_test.sh: Test -r.
9986         * testsuite/Makefile.am (check_DATA): Add
9987         discard_locals_relocatable_test1.syms,
9988         discard_local_relocatable_test2.syms.
9989         (MOSTLYCLEANFILES): Likewise.  Also add
9990         discard_locals_relocatable_test1.lout and
9991         discard_locals_relocatable_test2.out.
9992         (discard_locals_relocatable_test1.syms): New target.
9993         (discard_locals_relocatable_test.o): New target.
9994         (discard_locals_relocatable_test1.out): New target.
9995         (discard_locals_relocatable_test2.syms): New target.
9996         (discard_locals_relocatable_test2.out): New target.
9997         (various): Add missing ../ld-new dependencies.
9998         * testsuite/Makefile.in: Rebuild.
9999
10000 2010-03-03  Nick Clifton  <nickc@redhat.com>
10001
10002         * po/fi.po: New Finnish translation.
10003
10004 2010-03-01  Doug Kwan  <dougkwan@google.com>
10005
10006         * layout.cc (Layout::Layout): Force section types of .init_array*,
10007         .preinit_array* and .fini_array* sections.
10008         * output.cc (Output_section::Input_section_sort_entry::has_priority):
10009         Fix check of return value of std::string::find.().
10010         (Output_section::Input_section_sort_compare::operator()): Remove
10011         comment about .init_array.
10012         (Output_section::Input_section_sort_init_fini_compare::operator()):
10013         New method.
10014         (Output_section::sort_attached_input_sections): Handle .init_array
10015         and .fini_array specially.
10016         * output.h (Output_section::Inut_section_sort_compare): Update
10017         comment.
10018         (Output_section::Input_section_sort_init_fini_compare): New struct.
10019
10020 2010-02-26  Doug Kwan  <dougkwan@google.com>
10021
10022         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
10023         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
10024         * testsuite/debug_msg.sh: Avoid matching source line number for
10025         use of global variable undef_int.
10026
10027 2010-02-26  Doug Kwan  <dougkwan@google.com>
10028
10029         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
10030         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
10031         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
10032         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
10033         * options.cc (General_options::General_options): Initialize member
10034         fix_v4bx_.
10035         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
10036         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
10037         and rm_no_fix_v4bx.stdout
10038         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
10039         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
10040         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
10041         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
10042         and arm_no_fix_v4bx.
10043         * Makefile.in: Regenerate.
10044         * testsuite/arm_fix_v4bx.s: New file.
10045         * testsuite/arm_fix_v4bx.sh: Ditto.
10046
10047 2010-02-24  Doug Kwan  <dougkwan@google.com>
10048
10049         * arm.cc (Target_arm::got_section): Make the .got section the first
10050         non RELRO section in the data segment.
10051         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
10052         suffixes of section names.
10053
10054 2010-02-24  Doug Kwan  <dougkwan@google.com>
10055
10056         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
10057         flags and attributes merging if an input file is a binary file.
10058         * fileread.cc (Input_file::open): Record format of original file.
10059         * fileread.h (Input_file::Format): New enum type.
10060         (Input_file::Input_file): Initialize data member format_.
10061         (Input_file::format): New method definition.
10062         (Input_file::format_):: New data member.
10063
10064 2010-02-24  Doug Kwan  <dougkwan@google.com>
10065
10066         * arm.cc (Arm_output_data_got): New class.
10067         (ARM_TCB_SIZE): New constant
10068         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
10069         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
10070         If user uses a script with a SECTIONS clause, issue only a warning
10071         for a misplaced EXIDX input section.  Otherwise, issue an error.
10072         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
10073         garbage collection.
10074         (Target_arm::got_mode_index_entry): Handle static linking.
10075         (Target_arm::Scan::local): Ditto.
10076         (Target_arm::Scan::global): Ditto.
10077         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
10078         all incorrectly implemented relocations.
10079         (Target_arm::fix_exidx_coverage): Pass layout to
10080         Arm_output_section::fix_exidx_coverage.
10081         * layout.cc (Layout::section_name_mapping): Remove trailing dots
10082         from ".ARM.exidx." and ".ARM.extab.".
10083
10084 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10085
10086         * arm.cc (Target_arm::do_finalize_sections): Create attribute
10087         section if it does not already exist.
10088         * attributes.cc (Attributes_section_data::Attributes_section_data):
10089         Don't crash if size is zero.
10090
10091 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10092             Ian Lance Taylor  <iant@google.com>
10093
10094         * gold.cc (queue_middle_tasks): If no input files were opened,
10095         exit.
10096         * workqueue.h (Task_function::Task_function): Assert that there is
10097         a blocker.
10098
10099 2010-02-22  Doug Kwan  <dougkwan@google.com>
10100
10101         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
10102         * icf.cc (get_section_contents): Cast snprintf arguments to long long
10103         types to avoid warnings due to different uint64_t implementations
10104         on different hosts.
10105
10106 2010-02-21  Doug Kwan  <dougkwan@google.com>
10107
10108         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
10109         handling of the maximum backward branch offset.
10110         (Arm_relocate_functions::thumb_branch_common): Ditto.
10111         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
10112         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
10113         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
10114         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
10115         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
10116         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
10117         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
10118         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
10119         thumb_bl_out_of_range thumb_bl_out_of_range.o,
10120         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
10121         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
10122         thumb2_bl_out_of_range.o): New rules.
10123         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
10124         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
10125         thumb2_bl_out_of_range
10126         * testsuite/Makefile.in: Regenerate.
10127         * testsuite/arm_bl_in_range.s: New file.
10128         * testsuite/arm_bl_out_of_range.s: Ditto.
10129         * testsuite/arm_branch_in_range.sh: Ditto.
10130         * testsuite/arm_branch_range.t: Ditto.
10131         * testsuite/thumb2_branch_range.t: Ditto.
10132         * testsuite/thumb_bl_in_range.s: Ditto.
10133         * testsuite/thumb_bl_out_of_range.s: Ditto.
10134         * testsuite/thumb_branch_range.t: Ditto.
10135
10136 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
10137
10138         * gc.h (gc_process_relocs): Change vectors to point to the new list.
10139         Add reloc offset information.
10140         * icf.cc (get_section_contents): Change iterators to point to the new
10141         vectors. Add reloc offset information to the contents.
10142         * icf.h (Icf::Sections_reachable_info): New typedef.
10143         (Icf::Sections_reachable_list): New typedef.
10144         (Icf::Offset_info): New typedef.
10145         (Icf::Reloc_info): New struct typedef.
10146         (Icf::Reloc_info_list): New typedef.
10147         (Icf::symbol_reloc_list): Delete method.
10148         (Icf::addend_reloc_list): Delete method.
10149         (Icf::section_reloc_list): Delete method.
10150         (Icf::reloc_info_list): New method.
10151         (Icf::reloc_info_list_): New member.
10152
10153 2010-02-19  Doug Kwan  <dougkwan@google.com>
10154
10155         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
10156         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
10157         * arm.cc (Arm_relocation_functions): New forward declaration.
10158         (Target_arm::Target_arm): Initialize new data members
10159         got_mod_index_offset_ and tls_base_symbol_defined_.
10160         (Target_arm::Relocate::relocate_tls): New method.
10161         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
10162          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
10163         New methods.
10164         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
10165         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
10166         (Target_arm::got_mod_index_offset_,
10167         Target_arm::tls_base_symbol_defined_): New data members.
10168         (Target_arm::Scan::local, Target::Scan::global,
10169         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
10170         relocations.
10171
10172 2010-02-18  Doug Kwan  <dougkwan@google.com>
10173
10174         * arm.cc (Arm_relobj::find_linked_text_section): New method.
10175         (Arm_relobj::make_exidx_input_section): Pass section index of linked
10176         text section as a parameter becuase some broken tools may not set
10177         the link in section header.
10178         (Target_arm::has_got_section): New method.
10179         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
10180         without any mapping symbol as data only.  Remove warning.
10181         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
10182         link in its section header, try to discover the link by inspecting the
10183         REL31 relocation at the beginning of the section.
10184         (Target_arm::Scan::check_non_pic): Report name of offending relocation
10185         in error message.
10186         (Target_arm::Scan::global): Treat any reference to the symbol
10187         _GLOBAL_OFFSET_TABLE_ as a GOT access.
10188
10189 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
10190
10191         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
10192         (Scan::global_reloc_may_be_function_pointer): New function.
10193         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10194         (Scan::global_reloc_may_be_function_pointer): New function.
10195         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10196         (Scan::global_reloc_may_be_function_pointer): New function.
10197         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
10198         (Scan::global_reloc_may_be_function_pointer): New function.
10199         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
10200         (Scan::global_reloc_may_be_function_pointer): New function.
10201         (Scan::possible_function_pointer_reloc): New function.
10202         (Target_x86_64::can_check_for_function_pointers): New function.
10203         * gc.h (gc_process_relocs): Scan relocation types to determine if
10204         function pointers were taken for targets that support it.
10205         * icf.cc (Icf::find_identical_sections): Include functions for
10206         folding in safe ICF whose pointer is not taken.
10207         * icf.h (Secn_fptr_taken_set): New typedef.
10208         (fptr_section_id_): New member.
10209         (section_has_function_pointers): New function.
10210         (set_section_has_function_pointers): New function.
10211         (check_section_for_function_pointers): New function.
10212         * options.h: Fix comment for safe ICF option.
10213         * target.h (can_check_for_function_pointers): New function.
10214         * testsuite/Makefile.am: Add icf_safe_so_test test case.
10215         Modify icf_safe_test for X86-64.
10216         * testsuite/Makefile.in: Regenerate.
10217         * testsuite/icf_safe_so_test.cc: New file.
10218         * testsuite/icf_safe_so_test.sh: New file.
10219         * testsuite/icf_safe_test.cc (kept_func_3): New function.
10220         (main): Change to take pointer to function kept_func_3.
10221         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
10222         folding is done correctly for X86-64.
10223
10224 2010-02-12  David S. Miller  <davem@davemloft.net>
10225
10226         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
10227         is_symbolless parameter.
10228         (Output_reloc<SHT_REL>::is_symbolless): New.
10229         (Output_reloc<SHT_REL>::is_symbolless_): New.
10230         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
10231         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
10232         (Output_reloc<SHT_RELA>::is_symbolless): New.
10233         (Output_data_reloc::add_global): Handle is_symbolless.
10234         (Output_data_reloc::add_global_relative): Likewise.
10235         (Output_data_reloc::add_local): Likewise.
10236         (Output_data_reloc::add_local_relative): Likewise.
10237         (Output_data_reloc::add_symbolless_global_addend): New.
10238         (Output_data_reloc::add_symbolless_local_addend): New.
10239         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
10240         is_symbolless.
10241         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
10242         instead of ->is_relative_
10243         (Output_reloc::write): Likewise.
10244         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
10245         (Output_reloc::write_rel): Simplify.
10246
10247         * sparc.cc (Target_sparc::Scan::local): Use
10248         ->add_symbolless_local_addend as needed.
10249         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
10250         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
10251         based upon relocation offset.
10252
10253 2010-02-11  Doug Kwan  <dougkwan@google.com>
10254
10255         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
10256         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
10257         beginning of function.
10258         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
10259         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
10260         parameter is_32bit in calls to should_apply_static_reloc.
10261         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
10262         (check_DATA): Add arm_abs_global.stdout.
10263         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
10264         arm_abs_global.stdout): New rules.
10265         (MOSTLLYCLEANFILES): Add arm_abs_global
10266         * Makefile.in: Regenerate.
10267         * testsuite/arm_abs_global.s: New file.
10268         * testsuite/arm_abs_global.sh: Ditto.
10269         * testsuite/arm_abs_lib.s: Ditto.
10270
10271 2010-02-11  Ian Lance Taylor  <iant@google.com>
10272
10273         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
10274         Read_relocs task.
10275         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
10276         Allocate_commons_task first.
10277         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
10278         task, rather than symtab_lock_.
10279         (Gc_process_relocs::~Gc_process_relocs): New function.
10280         (Gc_process_relocs::is_runnable): Check this_blocker_.
10281         (Gc_process_relocs::locks): Use next_blocker_ rather than
10282         blocker_.
10283         (Scan_relocs::~Scan_relocs): New function.
10284         (Scan_relocs::is_runnable): Check this_blocker_ rather than
10285         symtab_lock_.
10286         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
10287         next_blocker_.
10288         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
10289         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
10290         constructor accordingly.
10291         (class Gc_process_relocs): Likewise.
10292         (class Scan_relocs): Likewise.
10293         * common.h (class Allocate_commons_task): Remove symtab_lock_
10294         field, and corresponding constructor parameter.
10295         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
10296         symtab_lock_.
10297         (Allocate_commons_task::locks): Likewise.
10298
10299 2010-02-11  Ian Lance Taylor  <iant@google.com>
10300
10301         * gold-threads.h (class Once): Define.
10302         (class Initialize_lock): Rewrite as child of Once.
10303         * gold-threads.cc (class Once_initialize): Define.
10304         (once_pointer_control): New static variable.
10305         (once_pointer, once_arg): New static variables.
10306         (c_run_once): New static function.
10307         (Once::Once, Once::run_once, Once::internal_run): New functions.
10308         (class Initialize_lock_once): Remove.
10309         (initialize_lock_control): Remove.
10310         (initialize_lock_pointer): Remove.
10311         (initialize_lock_once): Remove.
10312         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
10313         (Initialize_lock::initialize): Rewrite.
10314         (Initialize_lock::do_run_once): New function.
10315         * archive.cc (Archive::interpret_header): Only clear name if it is
10316         not already empty.
10317         * fileread.cc: Include "gold-threads.h"
10318         (file_counts_lock): New static variable.
10319         (file_counts_initialize_lock): Likewise.
10320         (File_read::release): Only increment counts when using --stats.
10321         Use a lock around the increment.
10322         * parameters.cc (class Set_parameters_target_once): Define.
10323         (set_parameters_target_once): New static variable.
10324         (Parameters::Parameters): Move here from parameters.h.
10325         (Parameters::set_target): Rewrite.
10326         (Parameters::set_target_once): New function.
10327         (Parameters::clear_target): Move here and rewrite.
10328         * parameters.h (class Parameters): Update declarations.  Add
10329         set_parameters_target_once_ field.
10330         (Parameters::Parameters): Move to parameters.cc.
10331         (Parameters::clear_target): Likewise.
10332         * readsyms.cc (Read_symbols::do_group): Create a Start_group
10333         task.
10334         (Start_group::~Start_group): New function.
10335         (Start_group::is_runnable): New function.
10336         (Start_group::locks, Start_group::run): New functions.
10337         (Finish_group::run): Change saw_undefined to size_t.
10338         * readsyms.h (class Start_group): Define.
10339         (class Finish_group): Change saw_undefined_ field to size_t.
10340         (Finish_group::Finish_group): Remove saw_undefined and
10341         this_blocker parameters.  Change all callers.
10342         (Finish_group::set_saw_undefined): New function.
10343         (Finish_group::set_blocker): New function.
10344         * symtab.h (class Symbol_table): Change saw_undefined to return
10345         size_t.  Change saw_undefined_ field to size_t.
10346         * target-select.cc (Set_target_once::do_run_once): New function.
10347         (Target_selector::Target_selector): Initialize set_target_once_
10348         field.  Don't initialize lock_ and initialize_lock_ fields.
10349         (Target_selector::instantiate_target): Rewrite.
10350         (Target_selector::set_target): New function.
10351         * target-select.h (class Set_target_once): Define.
10352         (class Target_selector): Update declarations.  Make
10353         Set_target_once a friend.  Remove lock_ and initialize_lock_
10354         fields.  Add set_target_once_ field.
10355
10356 2010-02-10  Ian Lance Taylor  <iant@google.com>
10357
10358         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
10359         queueing any tasks.
10360         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
10361         (queue_middle_tasks): Add all blockers before queueing any tasks.
10362         (queue_final_tasks): Likewise.
10363         * token.h (Task_token::add_blockers): New function.
10364         * object.h (Input_objects::number_of_relobjs): New function.
10365
10366 2010-02-10  Ian Lance Taylor  <iant@google.com>
10367
10368         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
10369         shared, not if not position independent.
10370         * x86_64.cc (Relocate::relocate_tls): Likewise.
10371         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
10372         (tls_pie_pic_test): New target.
10373         * testsuite/Makefile.in: Rebuild.
10374
10375         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
10376         (tls_test_main_pie.o, tls_test_pie.o): New targets.
10377         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
10378         * testsuite/Makefile.in: Rebuild.
10379
10380 2010-02-09  David S. Miller  <davem@davemloft.net>
10381
10382         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
10383         R_SPARC_RELATIVE using ->add_local_relative().
10384         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
10385
10386         * output.h (Output_data_dynamic::add_section_size): New method
10387         that takes two Output_data objects.
10388         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
10389         entry param.  Handle it in initializers.
10390         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
10391         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
10392         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
10393         arg.
10394         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
10395         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
10396         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
10397         for dynrel_includes_plt.
10398         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10399         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10400         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
10401         before .rela.plt
10402         (Target_sparc::do_finalize_sections): Update to pass true for
10403         dynrel_includes_plt.
10404         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
10405         output before .rela.plt
10406         (Target_powerpc::do_finalize_sections): Update to pass true for
10407         dynrel_includes_plt when 32-bit.
10408
10409 2010-02-08  Doug Kwan  <dougkwan@google.com>
10410
10411         * arm.cc (Arm_relobj::simple_input_section_output_address): New
10412         method.
10413         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
10414         Arm_relobj::scan_section_for_cortex_a8_stubs,
10415         Arm_relobj::do_relocation_section): Instead of calling
10416         Output_section::output_address, use faster
10417         Arm_relobj::simple_input_section_output_address.
10418
10419 2010-02-08  David S. Miller  <davem@davemloft.net>
10420
10421         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
10422         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
10423         relocation helper function.
10424
10425         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
10426         just like R_SPARC_GOT{10,13,22}.
10427         (Target_sparc::Scan::local): Likewise.
10428         (Target_sparc::Relocate:relocate): Likewise.
10429
10430 2010-02-06  Ian Lance Taylor  <iant@google.com>
10431
10432         * configure.ac: Rewrite targetobjs duplicate removal code to use
10433         only shell constructs.
10434         * configure: Rebuild.
10435
10436 2010-02-05  Doug Kwan  <dougkwan@google.com>
10437
10438         PR 11247
10439         * arm.cc (Arm_relobj::section_is_scannable): New method.
10440         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
10441         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
10442
10443 2010-02-04  Doug Kwan  <dougkwan@google.com>
10444
10445         PR 11247
10446         * arm-reloc-property.cc (cstdio): Include.
10447         * configure.ac (targetobjs): Remove duplicates.
10448         * configure: Regenerate.
10449         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
10450         big and little endian version for a given address size.
10451
10452 2010-02-03  Doug Kwan  <dougkwan@google.com>
10453
10454         * arm-reloc-property.cc
10455         (Arm_reloc_property_table::reloc_name_in_error_message): New method
10456         definition.
10457         * arm-reloc-property.h
10458         (Arm_reloc_property_table::get_implemented_static_reloc_property):
10459         New method definition.
10460         (Arm_reloc_property_table::reloc_name_in_error_message): New method
10461         declaration.
10462         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
10463         overflow to N.
10464         (GOT_PREL): Change implemented to Y.
10465         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
10466         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
10467         (Arm_relocate_functions::movw_abs_nc): Remove method.
10468         (Arm_relocate_functions::movt_abs): Ditto.
10469         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
10470         (Arm_relocate_functions::thm_movt_abs): Ditto.
10471         (Arm_relocate_functions::movw_rel_nc): Ditto.
10472         (Arm_relocate_functions::movw_rel): Ditto.
10473         (Arm_relocate_functions::movt_rel): Ditto.
10474         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
10475         (Arm_relocate_functions:thm_movw_rel): Ditto.
10476         (Arm_relocate_functions:thm_movt_rel): Ditto.
10477         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
10478         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
10479         New method definitions.
10480         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
10481         (Arm_relocation_functions::arm_grp_ldr): Ditto.
10482         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
10483         (Arm_relocation_functions::arm_grp_ldc): Ditto.
10484         (Target_arm::Relocate::relocate): Check for non-static or
10485         unimplemented relocation code and exit early.  Change calls to
10486         Target_arm::reloc_uses_thumb_bit and
10487         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
10488         instead.  Refactor code to handle similar relocations to increase
10489         code sharing.  Remove check for unsupported relocation code in switch
10490         statement.
10491         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
10492         relocation property table to find out size.  Change error message to
10493         print out the name of a relocation code instead of the numeric value.
10494         (Target_arm::scan_reloc_for_stub): Use relocation property table
10495         instead of calling Target_arm::reloc_uses_thumb_bit().
10496
10497 2010-02-02  Doug Kwan  <dougkwan@google.com>
10498
10499         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
10500         types of relaxed input section.
10501
10502 2010-02-02  Doug Kwan  <dougkwan@google.com>
10503
10504         * Makefile.am (HFILES): Add arm-reloc-property.h.
10505         (DEFFILES): New.
10506         (TARGETSOURCES): Add arm-reloc-property.cc
10507         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
10508         (libgold_a_SOURCES): $(DEFFILES)
10509         * Makefile.in: Regenerate.
10510         * arm-reloc-property.cc: New file.
10511         * arm-reloc-property.h: New file.
10512         * arm-reloc.def: New file.
10513         * arm.cc: Update comments.
10514         (arm-reloc-property.h): New included header.
10515         (arm_reloc_property_table): New global variable.
10516         (Target_arm::do_select_as_default_target): New method definition.
10517         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
10518         arm-reloc-property to targ_extra_obj.
10519         * parameters.cc (set_parameters_target): Call
10520         Target::select_as_default_target().
10521         * target.h (Target::select_as_default_target): New method definition.
10522         (Target::do_select_as_default_target): Same.
10523
10524 2010-02-01  Doug Kwan  <dougkwan@google.com>
10525
10526         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
10527         first_output_text_section_.
10528         (Arm_exidx_fixup::first_output_text_section): New method definition.
10529         (Arm_exidx_fixup::first_output_text_section_): New data member.
10530         (Arm_exidx_fixup::process_exidx_section): Record the first text
10531         output section seen.
10532         (Arm_output_section::fix_exidx_coverage): Set correct linked section
10533         and entsize in output section header.
10534
10535 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10536
10537         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
10538         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
10539         (Arm_relocate_functions::thm_alu11): New Method.
10540         (Arm_relocate_functions::thm_pc8): New Method.
10541         (Arm_relocate_functions::thm_pc12): New Method.
10542         (Target_arm::Scan::local): Handle the relocations.
10543         (Target_arm::Scan::global): Likewise.
10544         (Target_arm::Relocate::relocate): Likewise.
10545         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10546
10547 2010-01-29  Doug Kwan  <dougkwan@google.com>
10548
10549         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
10550         of relocation types as ld.
10551
10552 2010-01-29  Doug Kwan  <dougkwan@google.com>
10553
10554         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
10555         to public.
10556         (Arm_relocate_functions::thumb_branch_common): Ditto.
10557         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
10558         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
10559         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
10560         Arm_relocate_functions::jump24): Remove.
10561         (Target_arm::Relocate::relocate): Adjust code to call
10562         Arm_relocation_functions::arm_branch_common and
10563         Arm_relocation_functions::thumb_branch_common instead of their removed
10564         wrappers.  Merge switch-cases together to reduce source code size.
10565
10566 2010-01-29  Doug Kwan  <dougkwan@google.com>
10567
10568         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
10569         output_local_symbol_count_needs_update_.
10570         (Arm_relobj::output_local_symbol_count_needs_update,
10571          Arm_relobj::set_output_local_symbol_count_needs_update,
10572          Arm_relobj::update_output_local_symbol_count): New methods.
10573         (Arm_relobj::output_local_symbol_count_needs_update_): New data
10574         member.
10575         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
10576         of pointed function as in a R_ARM_PREL31 relocation.
10577         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
10578         for output local symbol count updating.
10579         (Target_arm::do_relax): Update output local symbol counts in objects
10580         if necessary.
10581         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
10582
10583 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10584
10585         * arm.cc: Added support for the ARM relocations:
10586         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
10587         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
10588         (Arm_relocate_functions::movw_rel_nc): Renamed (was
10589         movw_prel_nc).
10590         (Arm_relocate_functions::movw_rel): New method.
10591         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
10592         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
10593         thm_movw_prel_nc).
10594         (Arm_relocate_functions::thm_movw_rel): New method.
10595         (Arm_relocate_functions::thm_movt_rel): Renamed (was
10596         thm_movt_prel).
10597         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
10598         relocations.
10599         (Target_arm::Scan::global): Likewise.
10600         (Target_arm::Relocate::relocate): Likewise.
10601         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10602         Likewise.
10603
10604 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10605
10606         * arm.cc: Added support for ARM group relocations.
10607         (Target_arm::reloc_needs_sym_origin): New method.
10608         (Arm_relocate_functions::calc_grp_kn): New method.
10609         (Arm_relocate_functions::calc_grp_residual): New method.
10610         (Arm_relocate_functions::calc_grp_gn): New method.
10611         (Arm_relocate_functions::arm_grp_alu): New Method.
10612         (Arm_relocate_functions::arm_grp_ldr): New Method.
10613         (Arm_relocate_functions::arm_grp_ldrs): New Method.
10614         (Arm_relocate_functions::arm_grp_ldc): New Method.
10615         (Target_arm::Scan::local): Handle the ARM group relocations.
10616         (Target_arm::Scan::global): Likewise.
10617         (Target_arm::Relocate::relocate): Likewise.
10618         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10619         Likewise.
10620
10621 2010-01-26  Doug Kwan  <dougkwan@google.com>
10622
10623         * arm.cc (set): Include.
10624         (class Arm_exidx_fixup): Change type of last_input_section_ to const
10625         pointer type.
10626         (Arm_output_section::Text_section_list): New type.
10627         (Arm_output_section::append_text_sections_to_list): New method.
10628         (Arm_output_section::fix_exidx_coverage): Ditto.
10629         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
10630         (Arm_relobj::convert_input_section_to_relaxed_section): Use
10631         Relobj::set_section_offset() instead of
10632         Sized_relobj::invalidate_section_offset().
10633         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
10634         parameter for section headers. Ignore relocation sections for
10635         unallocated sections and EXIDX sections.
10636         (Target_arm::fix_exidx_coverage): New method.
10637         (Target_arm::output_section_address_less_than): New type.
10638         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
10639         linked text section instead of the EXIDX section.
10640         (Arm_output_section::create_stub_group): Add an assertion to check
10641         that this is not an EXIDX output section.
10642         (Arm_output_section::append_text_sections_to_list): New method.
10643         (Arm_output_section::fix_exidx_coverage): Ditto.
10644         (Arm_relobj::scan_sections_for_stubs): Adjust call to
10645         Arm_relobj::section_needs_reloc_stub_scanning.
10646         (Target_arm::do_relax): Fix EXIDX output section coverage in the
10647         first pass.
10648         (Target_arm::fix_exidx_coverage): New method.
10649         * object.h (Relobj::set_output_section): New method.
10650         (Sized_relobj::invalidate_section_offset): Remove method.
10651         (Sized_relobj::do_invalidate_section_offset): Remove method.
10652         (Sized_relobj::do_set_section_offset): Handle offset value -1.
10653
10654 2010-01-25  Doug Kwan  <dougkwan@google.com>
10655
10656         * arm.cc (Arm_exidx_merged_section::do_output_offset):
10657         Fix warning due to signed and unsigned comparison on a 32-bit host.
10658
10659 2010-01-22  Doug Kwan  <dougkwan@google.com>
10660
10661         * arm.cc (Target_arm::do_relax): Record an output section for section
10662         offset adjustment it contains any stub table that has changed.
10663         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
10664         offsets in an output section if necessary.
10665         * output.cc (Output_section::Output_section): Initialize
10666         section_offsets_need_adjustments_.
10667         (Output_section::add_input_section_for_script): Renamed to
10668         Output_section::add_simple_input_section.
10669         (Output_section::save_states): Add a comment.
10670         (Output_section::discard_states): New method defintion.
10671         (Output_section::adjust_section_offsets): Same.
10672         * output.h (Output_section::add_input_section_for_script): Renamed to
10673         Output_section::add_simple_input_section.
10674         (Output_section::discard_states): New method declaration.
10675         (Output_section::adjust_section_offsets): Same.
10676         (Output_section::section_offsets_need_adjustment,
10677         Output_section::set_section_offsets_need_adjustment): New method
10678         definitions.
10679         (Output_section::section_offsets_need_adjustment_): New data member.
10680         * script-sections.cc
10681         (Output_section_element_input::set_section_address): Adjust code for
10682         renaming of Output_section::add_input_section_for_script.
10683         (Orphan_output_section::set_section_address): Same.
10684
10685 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10686
10687         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
10688         Fix_v4bx enum values .
10689         * gold/options.h (General_options): New option definitions.
10690         (General_options::fix_v4bx): New method.
10691         (General_options::Fix_v4bx): New enum.
10692         * gold/options.cc (General_options::parse_fix_v4bx): New method.
10693         (General_options::parse_fix_v4bx_interworking): New method.
10694
10695 2010-01-22  Doug Kwan  <dougkwan@google.com>
10696
10697         * arm.cc (Arm_exidx_fixup): New class.
10698
10699 2010-01-21  Doug Kwan  <dougkwan@google.com>
10700
10701         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
10702         classes.
10703         (Arm_exidx_section_offset_map): New type.
10704
10705 2010-01-21  Doug Kwan  <dougkwan@google.com>
10706
10707         * arm.cc (Arm_exidx_input_section): New class.
10708         (Arm_relobj::exidx_input_section_by_link,
10709         Arm_relobj::exidx_input_section_by_shndx,
10710         Arm_relobj::make_exidx_input_section): New methods.
10711         (read_arm_attributes_section): Remove.
10712         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
10713         information about them.
10714         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
10715         to here.
10716
10717 2010-01-20  Doug Kwan  <dougkwan@google.com>
10718
10719         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
10720         Input_section_specifier to Section_id.
10721         (Target_arm::new_arm_input_section: Adjust code for change of key
10722         type.
10723         (Target_arm::find_arm_input_section): Ditto.
10724         * gc.h (object.h): Include for Section_id nand Section_id_hash.
10725         (Section_id): Remove.
10726         (Garbage_collection::Section_id_hash): Remove.
10727         * icf.h (object.h): Include for Section_id nand Section_id_hash.
10728         (Section_id): Remove.
10729         (Icf::Section_id_hash): Remove.
10730         * object.h (Section_id, Const_section_id, Section_id_hash,
10731         Const_section_id_hash): New type definitions.
10732         * output.cc (Output_section::add_relaxed_input_section): Change to
10733         use Const_section_id instead of Input_section_specifier as key type.
10734         (Output_section::add_merge_input_section): Ditto.
10735         (Output_section::build_relaxation_map): Change to use Section_id
10736         instead of Input_section_specifier as key type.
10737         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10738         Ditto.
10739         (Output_section::convert_input_sections_to_relaxed_sections): Change
10740         to use Const_section_id instead of Input_section_specifier as key type.
10741         (Output_section::find_merge_section): Ditto.
10742         (Output_section::find_relaxed_input_section): Ditto.
10743         * output.h (Input_section_specifier): Remove class.
10744         (Output_section::Output_section_data_by_input_section_map): Change
10745         key type to Const_section_id.
10746         (Output_section::Output_relaxed_input_section_by_input_section_map):
10747         Ditto.
10748         (Output_section::Relaxation_map): Change key type to Section_id.
10749
10750 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10751
10752         * gold/arm.cc: Added support for R_ARM_V4BX relocation
10753         (class Arm_v4bx_stub): New class.
10754         (DEF_STUBS): Updated definition to support v4_veneer_bx.
10755         (Stub_factory::make_arm_v4bx_stub): New method.
10756         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
10757         (Stub_table::empty): Handle v4bx stubs.
10758         (Stub_table::add_arm_v4bx_stub): New method.
10759         (Stub_table::find_arm_v4bx_stub): New method.
10760         (Arm_relocate_functions::v4bx): New method.
10761         (Target_arm::fix_v4bx): New method.
10762         (Target_arm::Target_arm): Handle R_ARM_V4BX.
10763         (Stub_table::relocate_stubs): Likewise.
10764         (Stub_table::do_write): Likewise.
10765         (Stub_table::update_data_size_and_addralign): Likewise.
10766         (Stub_table::finalize_stubs):  Likewise.
10767         (Target_arm::Scan::local): Likewise.
10768         (Target_arm::Scan::global): Likewise.
10769         (Target_arm::do_finalize_sections): Likewise.
10770         (Target_arm::Relocate::relocate): Likewise.
10771         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10772         Likewise.
10773         (Target_arm::scan_reloc_for_stub): Likewise.
10774         (Target_arm::scan_reloc_section_for_stubs): Likewise.
10775
10776 2010-01-19  Ian Lance Taylor  <iant@google.com>
10777
10778         * output.cc (Output_section_headers::do_sized_write): Write large
10779         segment count to sh_info field.
10780         (Output_file_header::do_sized_write): For large segment count,
10781         write PN_XNUM to e_phnum field.
10782
10783 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10784
10785         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
10786         (Arm_relocate_functions::thm_jump8): New function.
10787         (Arm_relocate_functions::thm_jump11): New function.
10788         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
10789         R_ARM_THM_JUMP11.
10790         (Target_arm::Scan::global): Likewise.
10791         (Target_arm::Relocate::relocate): Likewise.
10792         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10793         Likewise.
10794
10795 2010-01-14  Doug Kwan  <dougkwan@google.com>
10796
10797         * arm.cc (map, utility): Include headers.
10798         (Target_arm::apply_cortex_a8_workaround): New method.
10799         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
10800         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
10801         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
10802         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
10803         the --[no-]fix-cortex-a8 command line options.
10804         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
10805         (Target_arm::relocate_stub): Use addend in instruction template.
10806         * options.h (DEFINE_bool): Set the user-set flag.
10807         (General_options): Add --[no-]-fix-cortex options.
10808         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
10809         : Update fast look-up map after conversion.
10810
10811 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
10812
10813         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
10814         in the first pass of do_layout.
10815
10816 2010-01-13  Doug Kwan  <dougkwan@google.com>
10817
10818         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10819         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
10820         apparent compiler problem of not folding static constant integral
10821         data members of elfcpp::Elf_sizes<32>.
10822
10823 2010-01-13  Doug Kwan  <dougkwan@google.com>
10824
10825         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10826         Arm_relobj::section_needs_cortex_a8_stub_scanning,
10827         Arm_relobj::scan_section_for_cortex_a8_erratum,
10828         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
10829         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
10830         sections to scan for relocation stubs into a new method
10831         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
10832         relocation and Cortex-A8 stub scanning.
10833         (Target_arm::do_relax): Force stubs to be after stubbed sections
10834         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
10835         the beginning of a new relaxation pass.  Update a comment.
10836         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
10837
10838 2010-01-12  Ian Lance Taylor  <iant@google.com>
10839
10840         * target-reloc.h (visibility_error): New inline function.
10841         (relocate_section): Call visibility_error.
10842         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
10843         (MOSTLYCLEANFILES): Likewise.
10844         (protected_4_pic.o, protected_3.err): New targets.
10845         * testsuite/protected_4.cc: New file.
10846
10847 2010-01-12  Doug Kwan  <dougkwan@google.com>
10848
10849         * arm.cc (Cortex_a8_reloc): New class.
10850         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
10851         and cortex_a8_relocs_info_.
10852         (Target_arm::fix_cortex_a8): New method definition.
10853         (Target_arm::Cortex_a8_relocs_info): New type.
10854         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
10855         New data member declarations.
10856         (Target_arm::scan_reloc_for_stub): Record information about
10857         relocations for THUMB branches that might be exempted from the
10858         Cortex-A8 workaround.
10859         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
10860         at the beginning of a relaxation pass.
10861
10862 2010-01-12  Doug Kwan  <dougkwan@google.com>
10863
10864         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
10865         (Arm_relobj::Mapping_symbol_position,
10866          Arm_reloj::Mapping_symbol_position_less,
10867          Arm_relobj::Mapping_symbols_info): New types.
10868         (Target_arm::is_mapping_symbol_name): New method definition.
10869         (Arm_relobj::do_count_local_symbols): Save information about mapping
10870         symbols.
10871
10872 2010-01-11  Doug Kwan  <dougkwan@google.com>
10873
10874         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
10875         Arm_relocate_functions::thumb32_branch_upper,
10876         Arm_relocate_functions::thumb32_branch_lower,
10877         Arm_relocate_functions::thumb32_cond_branch_offset,
10878         Arm_relocate_functions::thumb32_cond_branch_upper,
10879         Arm_relocate_functions::thumb32_cond_branch_lower,
10880         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
10881         branch offset encoding.
10882         (Arm_relocate_functions::thumb_branch_common): Use new branch
10883         offset encoding methods to avoid code duplication.
10884         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
10885         (Stub_addend_reader::operator()): Use new branch encoding method
10886         to avoid code duplication.
10887
10888 2010-01-11  Doug Kwan  <dougkwan@google.com>
10889
10890         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
10891         (Target_arm::do_finalize_sections): Define special EXIDX section
10892         symbols only if referenced.
10893         * gc.h (Garbage_collection::add_reference): New method.
10894         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
10895         code duplication.
10896
10897 2010-01-11  Ian Lance Taylor  <iant@google.com>
10898
10899         * script.cc (Version_script_info::build_expression_list_lookup):
10900         Change complaing about duplicate wildcard match from error to
10901         warning.
10902
10903         * script.cc (class Lazy_demangler): Recreate--revert part of patch
10904         of 2009-12-30.
10905         (Version_script_info::Version_script_info): Initialize globs_,
10906         default_version_, default_is_global_, and exact_.  Don't
10907         initialize globals_ or locals_.
10908         (Version_script_info::build_lookup_tables): Build local symbols
10909         first.
10910         (Version_script_info::unquote): New function.
10911         (Version_script_info::add_exact_match): New function.
10912         (Version_script_info::build_expression_list_lookup): Remove lookup
10913         parameter.  Add is_global parameter.  Change all callers.  Handle
10914         wildcard pattern specially.  Unquote pattern.  Call
10915         add_exact_match.
10916         (Version_script_info::get_name_to_match): New function.
10917         (Version_script_info::get_symbol_version): New function.
10918         (Version_script_info::get_symbol_version_helper): Remove.
10919         (Version_script_info::check_unmatched_names): Call unquote.
10920         * script.h (class Version_script_info): Change get_symbol_version
10921         to be non-inline and add is_global parameter; change all callers.
10922         Rewrite symbol_is_local.  Update declarations.  Define struct
10923         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
10924         Remove globals_ and locals_ members.  Add exact_, globs_,
10925         default_version_, is_global_.
10926         (Version_script_info::Glob): Remove pattern, add expression and
10927         is_global.  Update constructor.  Change all callers.
10928         * dynobj.cc (Versions::finalize): Mark the version symbol as the
10929         default version.
10930         (Versions::symbol_section_contents): If a symbol is undefined, or
10931         defined in a dynamic object, set the version index to
10932         VER_NDX_LOCAL.
10933         * symtab.cc (Symbol_table::add_from_relobj): Don't call
10934         symbol_is_local.
10935         (Symbol_table::add_from_pluginobj): Likewise.
10936         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
10937
10938 2010-01-11  Doug Kwan  <dougkwan@google.com>
10939
10940         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
10941         (incremental_dump_LDADD): Add linking option for libintl.
10942         * Makefile.in: Regenerate.
10943
10944 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
10945
10946         PR gold/11144
10947         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
10948         instead of -Ds.
10949         * testsuite/Makefile.in: Regenerated.
10950
10951 2010-01-10  Doug Kwan  <dougkwan@google.com>
10952
10953         * options.h (DEFINE_var): Use parentheses around argument varname__
10954         in macro body to avoid any unintended subsequent substitutions.
10955
10956 2010-01-10  Ian Lance Taylor  <iant@google.com>
10957
10958         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
10959         candidates before doing symbol resolution.
10960
10961         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
10962         ODR candidates if only one is weak.
10963
10964 2010-01-08  Ian Lance Taylor  <iant@google.com>
10965
10966         * script.cc (Version_script_info::build_expression_list_lookup):
10967         Don't warn about ambiguous version, just record the ambiguity.
10968         (Version_script_info::get_symbol_version_helper): Give error if
10969         version is ambiguous.
10970
10971 2010-01-08  Doug Kwan  <dougkwan@google.com>
10972
10973         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
10974         prev_data_size_ and prev_addralign_.  Remove initializer for
10975         deleted data member has_been_changed_.
10976         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
10977         to determine if the table is empty.
10978         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
10979         Remove.
10980         (Stub_table::add_reloc_stub): Define method in class definition
10981         instead of just declaring it there.
10982         (Stub_table::add_cortex_a8_stub): New method definition.
10983         (Stub_table::update_data_size_and_addralign): Ditto.
10984         (Stub_table::finalize_stubs): Ditto.
10985         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
10986         (Stub_table::do_addralign_): Return address alignment in the
10987         (Stub_table::do_reset_address_and_file_offset): Define method in
10988         class definition instead of declaring it there.  Set current data
10989         size to be the data size of the previous pass.
10990         (Stub_table::set_final_data_size): Use current data size as the
10991         final data size.
10992         (Stub_table::relocate_stub): Change parameter type of stub from
10993         Reloc_stub pointer to Stub pointer.
10994         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10995         (Stub_table::Cortex_a8_stub_list): New typedef.
10996         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10997          Stub_table::prev_addralign_): New data member.
10998         (Arm_relobj::Arm_relobj): Initialize data member
10999         section_has_cortex_a8_workaround_.
11000         (Arm_relobj::section_has_cortex_a8_workaround,
11001          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
11002          definitions.
11003         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
11004         declarations.
11005         (Target_arm::relocate_stub): Change parameter type of stub from
11006         Reloc_stub pointer to Stub pointer.
11007         (Insn_template::size, Insn_template::alignment): Handle
11008         THUMB16_SPECIAL_TYPE.
11009         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
11010          Stub_table::update_data_size_and_addralign,
11011          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
11012         definitions.
11013         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
11014         (Stub_table::do_write): Ditto.
11015         (Target_arm::do_relax): Adjust code for changes in Stub_table.
11016
11017 2010-01-08  Ian Lance Taylor  <iant@google.com>
11018
11019         PR 11108
11020         * symtab.h (class Symbol): Remove fields is_target_special_ and
11021         has_plt_offset_.  Add field is_defined_in_discarded_section_.
11022         (Symbol::is_defined_in_discarded_section): New function.
11023         (Symbol::set_is_defined_in_discarded_section): New function.
11024         (Symbol::has_plt_offset): Rewrite.
11025         (Symbol::set_plt_offset): Verify that new offset is not -1U.
11026         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
11027         Don't initialize is_target_special_ or has_plt_offset_.
11028         Initialize is_defined_in_discarded_section_.
11029         (Symbol_table::add_from_relobj): If appropriate, set
11030         is_defined_in_discarded_section.
11031         * resolve.cc (Symbol::override_base_with_special): Don't test
11032         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
11033         * target-reloc.h (relocate_section): Do special handling for
11034         symbols defined in discarded sections for global symbols as well
11035         as local symbols.
11036
11037 2010-01-08  Ian Lance Taylor  <iant@google.com>
11038
11039         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
11040         the SHT_SYMTAB case.
11041
11042 2010-01-08  Ian Lance Taylor  <iant@google.com>
11043
11044         * object.cc (Sized_relobj::do_layout): Don't get confused if
11045         layout_eh_frame returns NULL.
11046
11047 2010-01-08  Ian Lance Taylor  <iant@google.com>
11048
11049         PR 11084
11050         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
11051         dynamic symbol table, use the normal symbol table.
11052         (Sized_dynobj::do_read_symbols): Remove assertion about type of
11053         symbol table.
11054
11055 2010-01-08  Ian Lance Taylor  <iant@google.com>
11056
11057         PR 11072
11058         * layout.cc (Layout::include_section): Remove .gnu_debuglink
11059         sections.
11060
11061 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
11062
11063         * version.cc (print_version): Change to "Copyright 2010".
11064
11065 2010-01-08  Ian Lance Taylor  <iant@google.com>
11066
11067         PR 10287
11068         PR 11063
11069         * i386.cc (class Target_i386): Change return type of plt_section
11070         to be non-const.
11071         (class Output_data_plt_i386): Add tls_desc_rel_ field.
11072         (Output_data_plt_i386::Output_data_plt_i386): Initialize
11073         tls_desc_rel_ field.
11074         (Output_data_plt_i386::rel_tls_desc): New function.
11075         (Target_i386::rel_tls_desc_section): New function.
11076         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
11077         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
11078         R_386_TLS_DESC reloc in rel_tls_desc_section.
11079         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
11080         Define struct Tlsdesc_info.
11081         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
11082         (Target_x86_64::do_reloc_symbol_index): New function.
11083         (Target_x86_64::add_tlsdesc_info): New function.
11084         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
11085         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
11086         tlsdesc_rel_ field.
11087         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
11088         all callers.
11089         (Output_data_plt_x86_64::rela_tlsdesc): New function.
11090         (Target_x86_64::rela_tlsdesc_section): New function.
11091         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
11092         handling.
11093         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
11094         (Target_x86_64::do_reloc_addend): New function.
11095         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
11096         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
11097         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
11098         (Output_reloc::type): New function.
11099         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
11100         (Output_reloc::is_target_specific): New function.
11101         (Output_reloc::target_arg): New function.
11102         (class Output_reloc) [SHT_RELA]: Add four new constructors for
11103         absolute relocs and target specific relocs.
11104         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
11105         add_target_specific.
11106         (class Output_data_reloc) [SHT_RELA]: Likewise.
11107         * output.cc (Output_reloc::Output_reloc): Add four new versions
11108         for absolute relocs and target specific relocs.
11109         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
11110         (Output_reloc::get_symbol_index): Likewise.
11111         (Output_reloc::local_section_offset): Check that local_sym_index_
11112         is not TARGET_CODE or 0.
11113         (Output_reloc::symbol_value): Likewise.
11114         (Output_reloc::write) [SHT_RELA]: Call target for target specific
11115         reloc.
11116         * target.h (class Target): Add reloc_symbol_index and reloc_addend
11117         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
11118         functions.
11119         * layout.cc (add_target_dynamic_tags): Use output section for
11120         DT_PLTRELSZ and DT_JMPREL.
11121
11122 2010-01-07  Ian Lance Taylor  <iant@google.com>
11123
11124         PR 11061
11125         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
11126         function.
11127         (class Output_data_reloc_generic): Define.
11128         (class Output_data_reloc_base): Change base class to
11129         Output_data_reloc_generic.  Change add() method to call
11130         bump_relative_reloc_count for a relative reloc.  Remove
11131         sort_relocs_ field.
11132         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
11133         to sort_relocs().
11134         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
11135         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
11136         appropriate.
11137         * layout.h (class Layout): Update declaration.
11138
11139 2010-01-07  Ian Lance Taylor  <iant@google.com>
11140
11141         * output.h (class Output_data): Add const version of
11142         output_section and do_output_section.
11143         (class Output_section_data): Add const version of
11144         do_output_section.
11145         (class Output_section): Likewise.
11146         * layout.cc (Layout::add_target_dynamic_tags): New function.
11147         * layout.h (class Layout): Update declarations.
11148         * arm.cc (Target_arm::do_finalize_sections): Use
11149         add_target_dynamic_tags.
11150         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11151         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11152         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11153         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11154
11155 2010-01-07  Ian Lance Taylor  <iant@google.com>
11156
11157         PR 11042
11158         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
11159         object as needed.
11160
11161 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
11162             Ian Lance Taylor  <iant@google.com>
11163
11164         PR 11019
11165         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
11166         Xindex::read_symtab_xindex.
11167
11168 2010-01-07  Doug Kwan  <dougkwan@google.com>
11169
11170         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
11171         (Insn_template::thumb16_bcond_insn): New method declaration.
11172         (Insn_template): Fix spelling.
11173         (Stub::thumb16_special): New method declaration.
11174         (Stub::do_write): Define virtual method which was previously pure
11175         virtual.
11176         (Stub::do_thumb16_special): New method declaration.
11177         (Stub::do_fixed_endian_write): New template member.
11178         (Reloc_stub::do_write): Remove.
11179         (Reloc_stub::do_fixed_endian_write): Remove.
11180         (Cortex_a8_stub): New class definition.
11181         (Stub_factory::make_cortex_a8_stub): New method definition.
11182         (Stub_factory::Stub_factory): Add missing static storage class
11183         qualifier for elf32_arm_stub_a8_veneer_blx.
11184
11185 2010-01-07  Ian Lance Taylor  <iant@google.com>
11186
11187         PR 10980
11188         * options.h (class General_options): Add --warn-unresolved-symbols
11189         and --error-unresolved-symbols.
11190         * errors.cc (Errors::undefined_symbol): Implement
11191         --warn-unresolved-symbols.
11192
11193         * options.h (class General_options): Add -z text and -z textoff.
11194         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
11195
11196 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
11197
11198         * gc.h (Garbage_collection::Cident_section_map): New typedef.
11199         (Garbage_collection::cident_sections): New function.
11200         (Garbage_collection::add_cident_section): New function.
11201         (Garbage_collection::cident_sections_): New member.
11202         (gc_process_relocs): Add references to sections whose names are C
11203         identifiers.
11204         * gold.h (cident_section_start_prefix): New constant.
11205         (cident_section_stop_prefix): New constant.
11206         (is_cident): New function.
11207         * layout.cc (Layout::define_section_symbols): Replace string constants
11208         with the newly defined constants.
11209         * object.cc (Sized_relobj::do_layout): Track sections whose names are
11210         C identifiers.
11211         * testsuite/Makefile.am: Add gc_orphan_section_test.
11212         * testsuite/Makefile.in: Regenerate.
11213         * testsuite/gc_orphan_section_test.cc: New file.
11214         * testsuite/gc_orphan_section_test.sh: New file.
11215
11216 2010-01-06  Ian Lance Taylor  <iant@google.com>
11217
11218         PR 10980
11219         * options.h (class General_options): Add --warn-shared-textrel.
11220         * layout.cc (Layout::finish_dynamic_section): Implement
11221         --warn-shared-textrel.
11222
11223         PR 10980
11224         * options.h (class General_options): Add --warn-multiple-gp.
11225
11226 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11227
11228         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
11229         $(THREADSLIB) and $(LIBDL).
11230         * Makefile.in: Rebuild.
11231
11232 2010-01-06  Ian Lance Taylor  <iant@google.com>
11233
11234         PR 10980
11235         * options.cc (General_options::parse_section_start): New function.
11236         (General_options::section_start): New function.
11237         (General_options::General_options): Initialize all members.
11238         * options.h: Include <map>
11239         (class General_options): Add --section-start.  Add section_starts_
11240         member.
11241         * layout.cc (Layout::attach_allocated_section_to_segment): If
11242         --section-start was used, set the address of the segment.  Remove
11243         local sort_sections.
11244         (Layout::relaxation_loop_body): If the address of the load segment
11245         has been set by --section-start, don't use it.
11246         * output.h (Output_segment::update_flags_for_output_section): New
11247         function.
11248         * output.cc (Output_segment::add_output_section): Call
11249         update_flags_for_output_section.
11250
11251 2010-01-05  Ian Lance Taylor  <iant@google.com>
11252
11253         PR 10980
11254         * options.h (class General_options): Add --undefined-version.
11255         * script.cc (struct Version_expression): Add was_matched_by_symbol
11256         field.
11257         (Version_script_info::matched_symbol): New function.
11258         (Version_script_info::get_symbol_version_helper): Call
11259         matched_symbol.
11260         (Version_script_info::check_unmatched_names): New function.
11261         * script.h (class Version_script_info): Update declarations.
11262         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
11263
11264         * options.h (class General_options): Use DEFINE_bool_alias for
11265         allow_multiple_definition.
11266         * resolve.cc (Symbol_table::should_override): Don't test
11267         allow_multiple_definition.
11268
11269         PR 10980
11270         * options.h (class General_options): Add --cref.
11271         * main.cc (main): Print cref table if --cref.  Don't close mapfile
11272         until after printing cref table.
11273         * cref.cc: Include "symtab.h".
11274         (class Cref_inputs): Define Cref_table_compare and Cref_table.
11275         (Cref_table_compare::operator()): New function.
11276         (Cref_inputs::gather_cref): New function.
11277         (filecol): New static const.
11278         (Cref_inputs::print_cref): New function.
11279         (Cref::print_cref): New function.
11280         * cref.h: Include <cstdio>.
11281         (class Cref): Update declarations.
11282         * mapfile.h (Mapfile::file): New function.
11283         * object.h (class Object): Define Symbols.  Declare virtual
11284         do_get_global_symbols.
11285         (Object::get_global_symbols): New function.
11286         * object.cc (Input_objects::add_object): Pass object to cref_ if
11287         --cref.
11288         (Input_objects::archive_start): Likewise.
11289         (Input_objects::archive_stop): Likewise.
11290         (Input_objects::print_cref): New function.
11291         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
11292         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
11293         --cref.
11294         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
11295         function.
11296         * plugin.h (class Sized_pluginobj): Update declarations.
11297
11298 2010-01-05  Ian Lance Taylor  <iant@google.com>
11299
11300         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
11301         to is_default_version.  Rename insdef to insdefault.
11302         (Symbol_table::add_from_relobj): Rename def to is_default_version
11303         and local to is_forced_local.
11304         (Symbol_table::add_from_pluginobj): Likewise.
11305         (Symbol_table::add_from_dynobj): Likewise.
11306         (Symbol_table::define_special_symbol): Rename insdef to
11307         insdefault.
11308
11309 2010-01-04  Ian Lance Taylor  <iant@google.com>
11310
11311         PR 10980
11312         * options.h (class General_options): Add
11313         --allow-multiple-definition and -z muldefs.
11314         * resolve.cc (Symbol_table::should_override): Don't warn about a
11315         multiple symbol definition if --allow-multiple-definition or -z
11316         muldefs.
11317
11318         PR 10980
11319         * options.h (class General_options): Add --add-needed and
11320         --copy-dt-needed-entries.  Tweak --as-needed help entry.
11321         * object.cc (Input_objects::check_dynamic_dependencies): Give an
11322         error if --copy-dt-needed-entries aka --add-needed is used and
11323         would cause a change in behaviour.
11324
11325         PR 10980
11326         * options.h (class General_options): Add -G as a short version of
11327         --shared.  Add no-op options -assert, -g, and -i.
11328
11329 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
11330
11331         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
11332         check for .text or .gnu.linkonce.t sections.
11333         * icf.cc (Icf::find_identical_sections): Ditto.
11334         Change the detection for mangled function name within the section
11335         name.
11336         * icf.h (is_section_foldable_candidate): New function.
11337
11338 2009-12-30  Ian Lance Taylor  <iant@google.com>
11339
11340         PR 10980
11341         * options.h (class General_options): Permit two dashes with
11342         --retain-symbols-file.
11343
11344 2009-12-30  Ian Lance Taylor  <iant@google.com>
11345
11346         PR 10979
11347         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
11348         don't put the file header and segment headers in the text
11349         segment.
11350
11351         PR 10979
11352         * common.cc (Sort_commons::operator()): Stabilize sort when both
11353         entries are NULL.
11354         (Symbol_table::do_allocate_commons_list): When allocating common
11355         symbols, skip a symbol which is no longer common.
11356         * symtab.h (Symbol::is_common): Test whether the symbol comes from
11357         an object before checking its type.
11358         * testsuite/common_test_2.c: New file.
11359         * testsuite/common_test_3.c: New file.
11360         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
11361         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
11362         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
11363         (common_test_2_pic.o, common_test_2.so): New targets.
11364         (common_test_3_pic.o, common_test_3.so): New targets.
11365         * testsuite/Makefile.in: Rebuild.
11366
11367         PR 10979
11368         * script.cc (read_input_script): If we see a new SECTIONS clause,
11369         and we have added an input section, give an error.
11370         * layout.h (class Layout): Add have_added_input_section function.
11371         Add have_added_input_section_ field.
11372         * layout.cc (Layout::Layout): Initialize
11373         have_added_input_section_.
11374         (Layout::layout): Set have_added_input_section_.
11375         (Layout::layout_eh_frame): Likewise.
11376
11377 2009-12-30  Ian Lance Taylor  <iant@google.com>
11378
11379         PR 10931
11380         * options.h (class General_options): Add --sort-common option.
11381         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
11382         * common.cc (Sort_common): Add sort_order parameter to
11383         constructor.  Add sort_order_ field.
11384         (Sort_commons::operator): Check sort_order_.
11385         (Symbol_table::allocate_commons): Determine the sort order.
11386         (Symbol_table::do_allocate_commons): Add sort_order parameter.
11387         Change all callers.
11388         (Symbol_table::do_allocate_commons_list): Likewise.
11389
11390 2009-12-30  Ian Lance Taylor  <iant@google.com>
11391
11392         PR 10916
11393         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
11394         symbols from this object, don't change the visibility of an
11395         undefined symbol.
11396         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
11397
11398 2009-12-30  Ian Lance Taylor  <iant@google.com>
11399
11400         PR 10861
11401         * script.h (class Version_script_info): Define Language enum.
11402         Update declarations.  Define Glob, Exact, and Lookup types.  Add
11403         new fields globals_, locals_, and is_finalized_.
11404         * script.cc: Various formatting fixes.
11405         (class Parser_closure): Change language_stack_ from a vector of
11406         std::string to one of Version_script_info::Language.  Adjust all
11407         uses accordingly.
11408         (class Lazy_demangler): Remove.
11409         (struct Version_expression): Change language from std::string to
11410         Version_script_info::Language.
11411         (Version_script_info::Version_script_info): New function.
11412         (Version_script_info::~Version_script_info): Don't call clear.
11413         (Version_script_info::finalize): New function.
11414         (Version_script_info::build_lookup_tables): New function.
11415         (Version_script_info::build_expression_list_lookup): New
11416         function.
11417         (Version_script_info::get_symbol_version_helper): Rewrite to use
11418         lookup tables.
11419         (Version_script_info::print_expression_list): Adjust to use
11420         Version_script_info::Language.
11421         (script_push_lex_into_version_mode): Check that the version script
11422         has not been finalized.
11423         (version_script_push_lang): Change language string to
11424         Version_script_info::Language.
11425         * options.cc (Command_line::version_script): New function.
11426         * options.h (class General_options): Add finalize_dynamic_list
11427         function.  Change version_script from declaration to definition.
11428         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
11429         * testsuite/version_script.map: Remove duplicate def of foo.
11430         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
11431         version_script.map.
11432         * testsuite/Makefile.in: Rebuild.
11433
11434 2009-12-30  Ian Lance Taylor  <iant@google.com>
11435
11436         PR 10843
11437         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
11438         if the input symbol index is 0, make the output symbol index 0.
11439
11440 2009-12-30  Ian Lance Taylor  <iant@google.com>
11441
11442         PR 10670
11443         * options.h (class General_options): Add -x/--discard-all.
11444         * object.cc (Sized_relobj::do_count_local_symbols): Handle
11445         --discard-all.  If the local symbol needs a dynamic entry, check
11446         that before handling --discard-locals.
11447
11448 2009-12-30  Ian Lance Taylor  <iant@google.com>
11449
11450         PR 10450
11451         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
11452         flags to PF_R.
11453         (Output_segment::add_output_section): Don't change the flags if
11454         the type is PT_TLS.
11455
11456         PR 10450
11457         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
11458         GNU hash table if they need a dynamic value.  Otherwise, don't add
11459         them if they are defined in a dynamic object or are forced local.
11460
11461 2009-12-29  Ian Lance Taylor  <iant@google.com>
11462
11463         PR 10450
11464         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
11465         .gnu.hash table for a 32-bit target.
11466
11467         PR 10450
11468         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
11469         regular and a dynamic object only needs a dynamic symbol table
11470         entry if it is externally visible.
11471
11472         PR 10450
11473         * i386.cc (class Target_i386): Initialize global_offset_table_ in
11474         constructor.  Add global_offset_table_ field.
11475         (Target_i386::got_section): Set global_offset_table_.
11476         (Target_i386::do_finalize_sections): Set global_offset_table_
11477         size.
11478         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
11479         in constructor.  Add global_offset_table_ field.
11480         (Target_x86_64::got_section): Set global_offset_table_.
11481         (Target_x86_64::do_finalize_sections): Set global_offset_table_
11482         size.
11483
11484         * layout.cc (Layout::Layout): Initialize increase_relro_.
11485         (Layout::get_output_section): Add is_relro, is_last_relro, and
11486         is_first_non_relro parameters.  Change all callers.
11487         (Layout::choose_output_section): Likewise.
11488         (Layout::add_output_section_data): Likewise.
11489         (Layout::make_output_section): Likewise.
11490         (Layout::set_segment_offsets): Clear increase_relro when using a
11491         linker script.
11492         * layout.h (class Layout): Add increase_relro method.  Add
11493         increase_relro_ field.  Update declarations.
11494         * output.cc (Output_section::Output_section): Initialize
11495         is_last_relro_ and is_first_non_relro_.
11496         (Output_segment::add_output_section): Group relro sections is
11497         do_sort is true.  Handle is_last_relro and is_first_non_relro.
11498         (Output_segment::maximum_alignment): Remove relro handling.
11499         (Output_segment::set_section_addresses): Add increase_relro
11500         parameter.  Change all callers.  Add initial alignment to align
11501         relro sections on separate page.  Remove old relro handling.
11502         (Output_segment::set_section_list_addresses): Remove in_relro
11503         parameter.  Change all callers.
11504         (Output_segment::set_offset): Add increase parameter.  Change all
11505         callers.  Remove old relro handling.
11506         * output.h (class Output_section): Add new methods: is_last_relro,
11507         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
11508         Add is_last_relro_ and is_first_non_relro_ fields.
11509         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
11510         Create separate .got.plt section.  Call increase_relro.
11511         * x86_64.cc (Target_x86_64::got_section): Likewise.
11512         * testsuite/relro_script_test.t: Add .got.plt.
11513
11514         PR 10450
11515         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
11516         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
11517         (Layout::finalize): Call set_dynamic_symbol_size.
11518         (Layout::set_dynamic_symbol_size): New function.
11519         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
11520         set_dynamic_symbol_size.
11521
11522         PR 10450
11523         * output.h (class Output_section): Add is_entsize_zero_ field.
11524         * output.cc (Output_section::Output_section): Initialize
11525         is_entsize_zero_.
11526         (Output_section::set_entsize): If two different entsizes are
11527         requested, force it to zero.
11528         (Output_section::add_input_section): Set flags for .debug_str
11529         before updating section flags.  Set entsize.
11530         (Output_section::update_flags_for_input_section): Set SHF_MERGE
11531         and SHF_STRING if all input sections have those flags.
11532
11533 2009-12-29   Rafael Espindola  <espindola@google.com>
11534
11535         * main.cc (main): Fix the sys time reporting.
11536         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
11537         reporting.
11538
11539 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
11540
11541         * options.cc (General_options::parse_version): Allow -v to exit
11542         without an error if there is nothing to link.
11543
11544 2009-12-29  Ian Lance Taylor  <iant@google.com>
11545
11546         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
11547         using a version of gcc before 4.1.
11548         * configure: Rebuild.
11549
11550 2009-12-28  Chris Demetriou  <cgd@google.com>
11551
11552         * attributes.cc (Output_attributes_section_data::do_write): Use
11553         std::vector::front rather than std::vector::data.
11554
11555 2009-12-28  Ian Lance Taylor  <iant@google.com>
11556
11557         * symtab.h (class Symbol_table): Add enum Defined.
11558         * resolve.cc (Symbol_table::should_override): Add defined
11559         parameter.  Change all callers.  Test whether object is NULL
11560         before calling a method on it.
11561         (Symbol_table::report_resolve_problem): Add defined parameter.
11562         Change all callers.
11563         (Symbol_table::should_override_with_special): Likewise.
11564         * symtab.cc (Symbol_table::define_in_output_data): Add defined
11565         parameter.  Change all callers.
11566         (Symbol_table::do_define_in_output_data): Likewise.
11567         (Symbol_table::define_in_output_segment): Likewise.
11568         (Symbol_table::do_define_in_output_segment): Likewise.
11569         (Symbol_table::define_as_constant): Likewise.
11570         (Symbol_table::do_define_as_constant): Likewise.
11571         * script.h (class Symbol_assignment): Add is_defsym parameter to
11572         constructor; change all callers.
11573         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
11574         parameter.  Change all callers.  Add is_defsym_ field.
11575         (class Parser_closure): Add parsing_defsym parameter to
11576         constructor; change all callers.  Add parsing_defsym accessor
11577         function.  Add parsing_defsym_ field.
11578
11579 2009-12-28  Ian Lance Taylor  <iant@google.com>
11580
11581         * gold.cc (queue_middle_tasks): Fix formatting.
11582         * object.cc (Relobj::is_section_name_included): Likewise.
11583
11584 2009-12-23  Ian Lance Taylor  <iant@google.com>
11585
11586         * i386.cc (Target_i386::do_calls_non_split): Recognize
11587         -fsplit-stack prologue for a function with a static chain.
11588         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
11589         -fsplit-stack prologue when using %r11.
11590
11591 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
11592
11593         * options.cc (General_options::parse_version): Make -v continue and do
11594         the link like GNU ld does.
11595
11596 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
11597
11598         * Makefile.am (CCFILES): Add timer.cc.
11599         (HFILES): Add timer.h.
11600         * configure.ac: Check for sysconf and times.
11601         * main.cc: include timer.h.
11602         (main): Use Timer instead of get_run_time.
11603         * timer.cc: New.
11604         * timer.h: New.
11605         * workqueue.cc: include timer.h.
11606         (Workqueue::find_and_run_task):
11607         Report user, sys and wall time.
11608         * Makefile.in: Regenerate.
11609         * config.in: Regenerate.
11610         * configure: Regenerate.
11611
11612 2009-12-16  Doug Kwan  <dougkwan@google.com>
11613
11614         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
11615         sections.
11616         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
11617         relaxed input sections.
11618         * output.cc (Output_section::find_relaxed_input_section): Change
11619         return type to Output_relaxed_input_section pointer.  Adjust code
11620         for new type of relaxed_input_section_map_.
11621         * output.h (Output_section::find_relaxed_input_section): Change
11622         return type to Output_relaxed_input_section pointer.
11623         (Output_section::Output_relaxed_input_section_by_input_section_map):
11624         New type.
11625         (Output_section::relaxed_input_section_map_): Change type to
11626         Output_section::Output_relaxed_input_section_by_input_section_map.
11627         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
11628         input section.
11629
11630 2009-12-15  Ian Lance Taylor  <iant@google.com>
11631
11632         * layout.cc (Layout::create_shstrtab): Only write out after input
11633         sections if we are compressing debug sections.
11634
11635 2009-12-15  Ian Lance Taylor  <iant@google.com>
11636
11637         * archive.cc (Archive::add_symbols): Only look up a symbol without
11638         a version if there is, in fact, a version.
11639
11640 2009-12-14  Ian Lance Taylor  <iant@google.com>
11641
11642         Revert -Wshadow changes, all changes from:
11643         2009-12-11  Doug Kwan  <dougkwan@google.com>
11644         2009-12-11  Nick Clifton  <nickc@redhat.com>
11645         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
11646
11647 2009-12-11  Doug Kwan  <dougkwan@google.com>
11648
11649         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
11650         due to -Wshadow.
11651         * attributes.cc (Object_attribute::size): Ditto.
11652         (Attributes_section_data::size): Ditto.
11653         (Attributes_section_data::Attributes_section_data): Ditto.
11654         (Output_attributes_section_data::do_write): Ditto.
11655         * attributes.h (Object_attribute::set_type): Ditto.
11656         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
11657
11658 2009-12-11  Nick Clifton  <nickc@redhat.com>
11659
11660         * archive.cc: Fix shadowed variable warnings.
11661         * arm.cc: Likewise.
11662         * compressed_output.cc: Likewise.
11663         * compressed_output.h: Likewise.
11664         * configure: Likewise.
11665         * dwarf_reader.cc: Likewise.
11666         * dynobj.cc: Likewise.
11667         * dynobj.h: Likewise.
11668         * ehframe.cc: Likewise.
11669         * ehframe.h: Likewise.
11670         * errors.cc: Likewise.
11671         * expression.cc: Likewise.
11672         * fileread.cc: Likewise.
11673         * fileread.h: Likewise.
11674         * freebsd.h: Likewise.
11675         * i386.cc: Likewise.
11676         * icf.cc: Likewise.
11677         * incremental.h: Likewise.
11678         * layout.cc: Likewise.
11679         * layout.h: Likewise.
11680         * mapfile.cc: Likewise.
11681         * merge.cc: Likewise.
11682         * merge.h: Likewise.
11683         * object.cc: Likewise.
11684         * object.h: Likewise.
11685         * options.h: Likewise.
11686         * output.cc: Likewise.
11687         * output.h: Likewise.
11688         * parameters.cc: Likewise.
11689         * plugin.cc: Likewise.
11690         * powerpc.cc: Likewise.
11691         * reduced_debug_output.cc: Likewise.
11692         * reduced_debug_output.h: Likewise.
11693         * reloc.cc: Likewise.
11694         * reloc.h: Likewise.
11695         * resolve.cc: Likewise.
11696         * script-sections.cc: Likewise.
11697         * script.cc: Likewise.
11698         * script.h: Likewise.
11699         * sparc.cc: Likewise.
11700         * symtab.cc: Likewise.
11701         * symtab.h: Likewise.
11702         * target-select.cc: Likewise.
11703         * target-select.h: Likewise.
11704         * token.h: Likewise.
11705         * workqueue.cc: Likewise.
11706         * workqueue.h: Likewise.
11707         * x86_64.cc: Likewise.
11708
11709 2009-12-10  Doug Kwan  <dougkwan@google.com>
11710
11711         * arm.cc (attributes.h): New include.
11712         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
11713         (Arm_relobj::~Arm_relobj): Delete object pointed by
11714         attributes_section_data_.
11715         (Arm_relobj::attributes_section_data): New method definition.
11716         (Arm_relobj::attributes_section_data_): New data member declaration.
11717         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
11718         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
11719         attributes_section_data_.
11720         (Arm_dynobj::attributes_section_data): New method definition.
11721         (Arm_dynobj::attributes_section_data_): New data member declaration.
11722         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
11723         initialization value of may_use_blx_ to false.
11724         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
11725         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
11726         object attributes to compute results instead of hard-coding.
11727         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
11728         Target_arm::get_secondary_compatible_arch,
11729         Target_arm::set_secondary_compatible_arch
11730         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11731         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
11732         New method declarations.
11733         (Target_arm::get_aeabi_object_attribute): New method definition.
11734         (Target_arm::attributes_section_data_): New data member declaration.
11735         (read_arm_attributes_section): New template definition.
11736         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
11737         (Arm_dynobj::do_read_symbols): Ditto.
11738         (Target_arm::do_finalize_sections): Merge attributes sections from
11739         input.  Check for BLX use after attributes section merging.
11740         Fix __exidx_start and __exidx_end visibility.  Create an
11741         .ARM.attributes section if necessary.
11742         (Target_arm::get_secondary_compatible_arch,
11743         Target_arm::set_secondary_compatible_arch,
11744         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11745         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
11746         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
11747         New method definitions.
11748
11749 2009-12-09  Ian Lance Taylor  <iant@google.com>
11750
11751         * plugin.cc (Plugin::load): Don't cast from void* to a function
11752         pointer.
11753
11754 2009-12-09  Ian Lance Taylor  <iant@google.com>
11755
11756         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
11757         information fields.
11758
11759 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
11760
11761         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
11762         Replace two_file_shared_1.so with two_file_shared_2.so.
11763         * testsuite/Makefile.in: Regenerated.
11764
11765 2009-12-08  Doug Kwan  <dougkwan@google.com>
11766
11767         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
11768         (HFILES): Add attributes.h and int_encoding.h.
11769         * Makefile.in: Regenerate.
11770         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
11771         function definitions to int_encoding.cc
11772         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
11773         prototypes to int_encoding.h
11774         * reduced_debug_output.cc (int_encoding.h): New include.
11775         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
11776         function definitions to int_encoding.cc
11777         (insert_into_vector, read_from_pointer): Move template definitions to
11778         int_encoding.h
11779         * attributes.cc: New file.
11780         * attributes.h: New file.
11781         * int_encoding.cc: New file.
11782         * int_encoding.h: New file.
11783
11784 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
11785
11786         PR gold/11055
11787         * incremental-dump.cc (dump_incremental_inputs): New.
11788         (main): Use dump_incremental_inputs.
11789
11790 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
11791
11792         PR gold/10893
11793         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
11794         checking elfcpp::STT_FUNC.
11795         (Target_i386::Relocate::relocate): Likewise.
11796         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
11797
11798         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
11799         symbols from shared libraries into normal FUNC symbols.
11800
11801         * symtab.h (Symbol): Add is_func and use it.
11802
11803 2009-12-05  Doug Kwan  <dougkwan@google.com>
11804
11805         * arm.cc (Target_arm::arm_info): Initialize new fields
11806         attributes_section and attributes_vendor.
11807         * i386.cc (Target_i386::i386_info): Same.
11808         * object.cc (Sized_relobj::do_layout): Skip attribute section.
11809         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
11810         fields attributes_section and attributes_vendor.
11811         * sparc.cc (Target_sparc::sparc_info): Same.
11812         * target.h (Target::attributes_section, Target::attributes_vendor,
11813         Target::is_attributes_section, Target::attribute_arg_type,
11814         Target::attributes_order): New method definitions.
11815         (Target::Target_info::attributes_section,
11816         Target::Target_info::attributes_vendor): New fields.
11817         (Target::do_attribute_arg_type, Target::do_attributes_order): New
11818         virtual method definitions.
11819         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
11820         attributes_section and attributes_vendor.
11821         * testsuite/testfile.cc (Target_test::test_target_info): Same.
11822
11823 2009-12-05  Doug Kwan  <dougkwan@google.com>
11824
11825         * arm.cc: Update comments about interworking and stub generation.
11826         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
11827         considered as non-PIC.
11828         (Arm_relocate_functions::base_abs): Fix formatting.
11829         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
11830         of function to use GOT entry address instead of offset.
11831         (Target_arm::Scan::global): Issue an error if a symbol would need a
11832         PLT does not get one because it is untyped.  Remove code to create
11833         dynamic symbols for relative branches.
11834         (Target_arm::Relocate::relocate: Use 0 instead of false since function
11835         takes unsigned integer instead of boolean.
11836
11837 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
11838
11839         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
11840         (two_file_test_LDADD): Likewise.
11841         (common_test_1_LDADD): Likewise.
11842         (exception_test_LDADD) Likewise.
11843         (weak_test_LDADD): Likewise.
11844         (many_sections_test_LDADD): Likewise.
11845         (initpri1_LDADD): Likewise.
11846         (script_test_1_LDADD): Likewise.
11847         (script_test_2_LDADD): Likewise.
11848         (justsyms_LDADD): Likewise.
11849         (binary_test_LDADD): Likewise.
11850         (large_LDADD): Likewise.
11851         * testsuite/Makefile.in: Regenerated.
11852
11853 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
11854
11855         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
11856         (Symbol_table::override_with_special): Likewise.
11857         (Symbol_table::add_from_object): Likewise.
11858
11859 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
11860
11861         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11862         Don't set the data_offset twice.
11863
11864 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
11865
11866         * testsuite/Makefile.in: Regenerate.
11867
11868 2009-12-03  Doug Kwan  <dougkwan@google.com>
11869
11870         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
11871         (Target_arm::do_finalize_sections): Add parameter for symbol table
11872         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
11873         * i386.cc (Target_i386::do_finalize_sections): Add an additional
11874         parameter for symbol table pointer.
11875         * layout.cc (Layout::finalize): Call Target::finalize_sections with
11876         an additional parameter for a pointer to symbol table.
11877         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
11878         parameter for a symbol table pointer.
11879         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
11880         * target.h (Target::finalize_sections, Target::do_finalize_sections):
11881         Ditto.
11882         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
11883         parameter for a symbol table pointer.
11884
11885 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
11886
11887         * incremental.cc (Incremental_inputs_header)
11888         (Incremental_inputs_header_write, Incremental_inputs_entry)
11889         (Incremental_inputs_entry_write): Move ...
11890         * incremental.h (Incremental_inputs_header)
11891         (Incremental_inputs_header_write, Incremental_inputs_entry)
11892         (Incremental_inputs_entry_write): here.
11893
11894 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11895
11896         * incremental.cc (make_sized_incremental_binary): Set the target.
11897         Error if it is incompatible.
11898         * output.h (Output_file): Add filename method.
11899
11900 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11901
11902         * incremental.cc (Incremental_inputs_entry): Remove unused argument
11903         from the get_* methods.
11904
11905 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11906
11907         * incremental-dump.cc (main): Check that the offeset of a script is 0.
11908         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11909         Write 0 for the data_offset of scripts.
11910
11911 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11912
11913         * testsuite/Makefile.am: Add the incremental_test.sh test.
11914         * testsuite/incremental_test.sh: New.
11915         * testsuite/incremental_test_1.c: New.
11916         * testsuite/incremental_test_2.c: New.
11917
11918 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
11919
11920         * incremental-dump.cc (main): Fix typos.
11921
11922 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
11923
11924         PR gold/11025
11925         * incremental-dump.cc (main): Use llu to print 64 bit values.
11926
11927 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
11928             H.J. Lu  <hongjiu.lu@intel.com>
11929
11930         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
11931         $(LIBDL).
11932         (incremental_dump_LDADD): Likewise.
11933         * Makefile.in: Regenerated.
11934
11935 2009-11-25  Doug Kwan  <dougkwan@google.com>
11936
11937         Revert:
11938
11939         2009-11-25  Doug Kwan  <dougkwan@google.com>
11940
11941                 * arm.cc (Target_arm::Target_arm): Move method definition
11942                 outside of class definition.  Add code to handle
11943                 --target1-rel, --target1-abs and --target2= options.
11944                 (Target_arm::get_reloc_reloc_type): Change method to be
11945                 non-static and const.
11946                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
11947                 New data member declaration.
11948                 (Target_arm::Scan::local, Target_arm::Scan::global,
11949                 Target_arm::Relocate::relocate,
11950                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11951                 Adjust call to Target_arm::get_real_reloc_type.
11952                 (Target_arm::get_real_reloc_type): Use command line options
11953                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11954                 * options.h (--target1-rel, --target1-abs, --target2): New
11955                 ARM-only options.
11956
11957 2009-11-25  Doug Kwan  <dougkwan@google.com>
11958
11959         * arm.cc (Target_arm::Target_arm): Move method definition outside of
11960         class definition.  Add code to handle --target1-rel, --target1-abs
11961         and --target2= options.
11962         (Target_arm::get_reloc_reloc_type): Change method to be non-static
11963         and const.
11964         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
11965         member declaration.
11966         (Target_arm::Scan::local, Target_arm::Scan::global,
11967         Target_arm::Relocate::relocate,
11968         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
11969         call to Target_arm::get_real_reloc_type.
11970         (Target_arm::get_real_reloc_type): Use command line options to
11971         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11972         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
11973         options.
11974
11975 2009-11-25  Doug Kwan  <dougkwan@google.com>
11976
11977         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
11978         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
11979         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
11980         formatting.
11981         (Arm_relocate_functions::thm_call): Replace body with a call to
11982         Arm_relocate_functions::thumb_branch_common.
11983         (Arm_relocate_functions::thm_jump24,
11984         Arm_relocate_functions::thm_xpc22): New method definitions.
11985         (Arm_relocate_functions::thumb_branch_common): New method definition.
11986         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
11987         operator.
11988         (Target_arm::Relocate::relocate): Adjust call to thm_call.
11989         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
11990
11991 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11992
11993         * Makefile.am: Build incremental-dump
11994         * Makefile.in: Regenerate.
11995         * incremental-dump.cc: New.
11996         * incremental.cc (Incremental_inputs_header_data,
11997         Incremental_inputs_entry_data): Move to incremental.h
11998         * incremental.h: (Incremental_inputs_header_data,
11999         Incremental_inputs_entry_data): Move from incremental.cc
12000
12001 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12002
12003         * incremental.cc (Incremental_inputs_header,
12004         Incremental_inputs_header_write, Incremental_inputs_entry,
12005         Incremental_inputs_entry_write): Add a typedef with the data type.
12006
12007 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12008
12009         * incremental.cc (Incremental_inputs_header,
12010         Incremental_inputs_header_write, Incremental_inputs_entry,
12011         Incremental_inputs_entry_write): Update comment about which
12012         type has the filed descriptions.
12013
12014 2009-11-15  Doug Kwan  <dougkwan@google.com>
12015
12016         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
12017         (Arm_relocate_functions::arm_branch_common): Change method defintion
12018         in class definition to a method declaration and update list of formal
12019         parameters.
12020         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
12021         Arm_relocation_functions::jump24): Adjust call to
12022         Arm_relocate_functions::arm_branch_common.  Update list of formal
12023         parameters.
12024         (Arm_relocate_functions::xpc25): New method definition.
12025         (Arm_relocate_functions::arm_branch_common): Move method defintion
12026         out from class definition.  Use stubs for mode-switching and extending
12027         branch ranges.
12028         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
12029         specially.  Change code to enable use of stubs in ARM branches.
12030
12031 2009-11-10  Doug Kwan  <dougkwan@google.com>
12032
12033         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
12034         in method declaration.
12035         (Target_arm::relocate_stub): New method declaration.
12036         (Target_arm::default_target): Change to return a pointer instead of
12037         a const reference.
12038         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
12039         Target_arm::default_target.
12040         (Arm_Relobj::do_relocate_sections): Remove options paramater in
12041         method definition.
12042         (Target_arm::relocate_section): Adjust view.
12043         (Target_arm::relocate_stub): New method definition.
12044
12045 2009-11-10  Doug Kwan  <dougkwan@google.com>
12046
12047         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
12048         a format warning.
12049         * incremental.cc (open_incremental_binary): Initialized local
12050         variables to avoid warnings.
12051         * object.cc (make_elf_object): Ditto.
12052         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
12053         a format warning.
12054
12055 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
12056
12057         PR gold/10930
12058         * testsuite/plugin_test.c: Include "config.h".
12059
12060 2009-11-09  Doug Kwan  <dougkwan@google.com>
12061
12062         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
12063         (arm_symbol_value): Remove.
12064         (Arm_relocate_functions::arm_branch_common,
12065         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
12066         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
12067         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
12068         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
12069         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
12070         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
12071         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
12072         Arm_relocate_functions::thm_mobw_abs_nc,
12073         Arm_relocate_functions::thm_mov_abs,
12074         Arm_relocate_functions::movw_prel_nc,
12075         Arm_relocate_functions::thm_movt_abs,
12076         Arm_relocate_functions::movt_prel,
12077         Arm_relocate_functions::thm_movw_prel_nc,
12078         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
12079         (Target_arm::Relocate::relocate): Only decompose address into two
12080         parts if relocation type uses the thumb-bit and pass the actual
12081         bit instead of a flag indicating that the thumb-bit is used.  Adjust
12082         calls to methods in Arm_relocate_functions for this change.
12083
12084 2009-11-08  Ian Lance Taylor  <iant@google.com>
12085
12086         PR 10925
12087         * reloc.cc: Instantiate
12088         Sized_relobj::initialize_input_to_output_maps and
12089         Sized_relobj:free_input_to_output_maps.
12090
12091 2009-11-06  Ian Lance Taylor  <iant@google.com>
12092
12093         PR 10876
12094         * defstd.cc (in_segment): Set only_if_ref true for "end".
12095
12096 2009-11-06  Doug Kwan  <dougkwan@google.com>
12097
12098         * arm.cc (class Reloc_stub): Correct a comment.
12099         (Target_arm::Target_arm): Initialize arm_input_section_map_.
12100         (Target_arm::scan_section_for_stubs): New method declaration.
12101         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
12102         Change methods from private to protected.
12103         (Target_arm::do_may_relax): New method definition.
12104         (Target_arm::do_relax, Target_arm::group_sections,
12105         Target_arm::scan_reloc_for_stub,
12106         Target_arm::scan_reloc_section_for_stubs): New method declarations.
12107         (Target_arm::arm_input_section_map_): New data member declaration.
12108         (Target_arm::scan_reloc_for_stub,
12109         Target_arm::scan_reloc_section_for_stubs,
12110         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
12111         Target_arm::do_relax): New method definitions.
12112
12113 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
12114
12115         * configure.ac: Check for (struct stat)::st_mtim
12116         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
12117         * config.in: Regenerate.
12118         * configure: Regenerate.
12119
12120 2009-11-05  Ian Lance Taylor  <iant@google.com>
12121
12122         PR 10910
12123         * output.cc (Output_segment::add_output_section): Add missing
12124         return statement.
12125
12126 2009-11-04  Ian Lance Taylor  <iant@google.com>
12127
12128         PR 10880
12129         * object.h (class Object): Add is_needed and set_is_needed
12130         methods.  Add is_needed_ field.  Make bool fields into bitfields.
12131         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
12132         defined in a dynamic object and referenced by a regular object,
12133         set is_needed for the dynamic object.
12134         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
12135         if the file is marked with as_needed and it is not needed.
12136
12137 2009-11-04  Ian Lance Taylor  <iant@google.com>
12138
12139         PR 10887
12140         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
12141         tags if data is discarded by linker script.
12142         * i386.cc (Target_i386::do_finalize_sections): Likewise.
12143         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
12144         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
12145         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
12146
12147 2009-11-04  Ian Lance Taylor  <iant@google.com>
12148
12149         * layout.cc (Layout::get_output_section): Add is_interp and
12150         is_dynamic_linker_section parameters.  Change all callers.
12151         (Layout::choose_output_section): Likewise.
12152         (Layout::make_output_section): Likewise.
12153         (Layout::add_output_section_data): Add is_dynamic_linker_section
12154         parameter.  Change all callers.
12155         * layout.h (class Layout): Update declarations.
12156         * output.h (class Output_section): Add is_interp, set_is_interp,
12157         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
12158         Add is_interp_, is_dynamic_linker_section_ fields.  Change
12159         generate_code_fills_at_write_ to a bitfield.
12160         * output.cc (Output_section::Output_sections): Initialize new
12161         fields.
12162         (Output_segment::add_output_section): Add do_sort parameter.
12163         Change all callers.
12164
12165 2009-11-03  Ian Lance Taylor  <iant@google.com>
12166
12167         PR 10860
12168         * options.h (class General_options): Add --warn-common.
12169         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
12170         merging two common symbols.
12171         (Symbol_table::should_override): Handle --warn-common when merging
12172         a common symbol with a defined symbol.  Use report_resolve_problem
12173         for multiple definitions.
12174         (Symbol_table::report_resolve_problem): New function.
12175         * symtab.h (class Symbol_table): Declare report_resolve_problem.
12176
12177 2009-11-03  Doug Kwan  <dougkwan@google.com>
12178
12179         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
12180         stub_factory_.
12181         (Target_arm::stub_factory): New method definition.
12182         (Target_arm::new_arm_input_section,
12183         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
12184         Target_arm::reloc_uses_thumb_bit): New method declarations.
12185         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
12186         New type definitions.
12187         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
12188         member declarations.
12189         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
12190         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
12191         New method definitions.
12192
12193 2009-11-03  Ian Lance Taylor  <iant@google.com>
12194
12195         * options.h (class General_options): Add --warn_constructors.
12196
12197 2009-11-03  Ian Lance Taylor  <iant@google.com>
12198
12199         PR 10893
12200         * defstd.cc (in_section): Add entries for __rel_iplt_start,
12201         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
12202
12203 2009-11-03  Ian Lance Taylor  <iant@google.com>
12204
12205         PR 10895
12206         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
12207         --msgid-bugs-address.
12208         (install-pdf): New target.
12209         (install-data_yes): Look up one directory to find mkinstalldirs.
12210
12211 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
12212
12213         * po/Make-in (.po.gmo): Don't generate .gmo files in source
12214         tree.
12215
12216 2009-10-30  Doug Kwan  <dougkwan@google.com>
12217
12218         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
12219
12220 2009-10-30  Doug Kwan  <dougkwan@google.com>
12221
12222         * arm.cc (Stub_addend_reader): New struct template definition
12223         and partial specializations.
12224         (Stub_addend_reader::operator()): New method definition for a
12225         partially specialized template.
12226
12227 2009-10-30  Doug Kwan  <dougkwan@google.com>
12228
12229         * arm.cc (Arm_relobj::processor_specific_flags): New method
12230         definition.
12231         (Arm_relobj::do_read_symbols): New method declaration.
12232         (Arm_relobj::processor_specific_flags_): New data member declaration.
12233         (Arm_dynobj): New class definition.
12234         (Target_arm::do_finalize_sections): Add input_objects parameter.
12235         (Target_arm::do_adjust_elf_header): New method declaration.
12236         (Target_arm::are_eabi_versions_compatible,
12237         (Target_arm::merge_processor_specific_flags): New method declaration.
12238         (Target_arm::do_make_elf_object): New overloaded method definitions
12239         and declaration.
12240         (Arm_relobj::do_read_symbols): New method definition.
12241         (Arm_dynobj::do_read_symbols): Ditto.
12242         (Target_arm::do_finalize_sections): Add input_objects parameters.
12243         Merge processor-specific flags from all input objects.
12244         (Target_arm::are_eabi_versions_compatible,
12245         Target_arm::merge_processor_specific_flags,
12246         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
12247         New method definitions.
12248         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
12249         Input_objects pointer type parameter.
12250         * layout.cc (Layout::finalize): Pass input objects to target's.
12251         finalize_sections function.
12252         * output.cc (Output_file_header::do_sized_write): Set ELF file
12253         header's processor-specific flags.
12254         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
12255         Input_objects pointer type parameter.
12256         * sparc.cc (Target_sparc::do_finalize_sections): Same.
12257         * target.h (Input_objects): New forward class declaration.
12258         (Target::processor_specific_flags,
12259         Target::are_processor_specific_flags_sect): New method definitions.
12260         (Target::finalize_sections): Add input_objects parameter.
12261         (Target::Target): Initialize processor_specific_flags_ and
12262         are_processor_specific_flags_set_.
12263         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
12264         parameter.
12265         (Target::set_processor_specific_flags): New method definition.
12266         (Target::processor_specific_flags_,
12267         Target::are_processor_specific_flags_set_): New data member
12268         declarations.
12269         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
12270         Input_objects pointer type parameter.
12271
12272 2009-10-30  Doug Kwan  <dougkwan@google.com>
12273
12274         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
12275
12276 2009-10-28  Ian Lance Taylor  <iant@google.com>
12277
12278         * object.h (class Relobj): Drop options parameter from
12279         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
12280         do_scan_relocs, do_relocate.  Change all callers.
12281         (class Sized_relobj): Drop options parameters from
12282         do_gc_process_relocs, do_scan_relocs, do_relocate,
12283         do_relocate_sections, relocate_sections, emit_relocs_scan,
12284         emit_relocs_scan_reltype.  Change all callers.
12285         (struct Relocate_info): Remove options field and all references to
12286         it.
12287         * reloc.h (class Read_relocs): Remove options constructor
12288         parameter and options_ field.  Change all callers.
12289         (class Gc_process_relocs, class Scan_relocs): Likewise.
12290         (class Relocate_task): Likewise.
12291         * target-reloc.h (scan_relocs): Remove options parameter.  Change
12292         all callers.
12293         (scan_relocatable_relocs): Likewise.
12294         * target.h (class Sized_target): Remove options parameter from
12295         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
12296         all callers.
12297         * gc.h (gc_process_relocs): Remove options parameter.  Change all
12298         callers.
12299         * arm.cc: Update functions to remove options parameters.
12300         * i386.cc: Likewise.
12301         * powerpc.cc: Likewise.
12302         * sparc.cc: Likewise.
12303         * x86_64.cc: Likewise.
12304         * testsuite/testfile.cc: Likewise.
12305
12306 2009-10-28  Doug Kwan  <dougkwan@google.com>
12307
12308         * arm.cc (Arm_relobj): New class definition.
12309         (Arm_relobj::scan_sections_for_stubs,
12310         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
12311         New method definitions.
12312
12313 2009-10-28  Cary Coutant  <ccoutant@google.com>
12314
12315         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
12316         (Plugin::cleanup_done_): New member.
12317         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
12318         (Plugin_manager::cleanup_done_): Remove.
12319         (Plugin_manager::add_input_file): Edit error message.
12320         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
12321         (Plugin_manager::cleanup): Remove use of cleanup_done_.
12322
12323 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
12324
12325         * fileread.cc: (File_read::View::~View): Use the new
12326         data_ownership_ filed.
12327         (File_read::~File_read): Dispose the new whole_file_view_.
12328         (File_read::open): Mmap the whole file if needed.
12329         (File_read::open): Use whole_file_view_ instead of contents_.
12330         (File_read::find_view): Use whole_file_view_ if applicable.
12331         (File_read::do_read): Use whole_file_view_ instead of contents_.
12332         (File_read::make_view): Use whole_file_view_ instead of contents_,
12333         update File_read::View::View call.
12334         (File_read::find_or_make_view): Update File_read::View::View
12335         call.
12336         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
12337         remove contents_
12338         (File_read::View::Data_ownership): New enum.
12339         (File_read::View::View): Replace bool mapped_ with Data_ownership
12340         argument.
12341         (File_read::View::mapped_): Remove (replaced by data_ownership_).
12342         (File_read::View::data_ownership_): New field.
12343         (File_read::contents_): Remove (replaced by whole_file_view_).
12344         (File_read::whole_file_view_): New field.
12345         * options.h (class General_options): Add --keep-files-mapped.
12346
12347 2009-10-27  Cary Coutant  <ccoutant@google.com>
12348
12349         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
12350         * testsuite/Makefile.am (plugin_test_5): New test case.
12351         * testsuite/Makefile.in: Regenerate.
12352
12353 2009-10-25  Doug Kwan  <dougkwan@google.com>
12354
12355         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
12356         from private to protected to allow access by child class.
12357         (Sized_relobj::do_relocate_sections): New method declaration.
12358         (Sized_relobj::relocate_sections): Virtualize.
12359         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
12360         Sized_relobj::relocate_sections.  Instantiate template explicitly
12361         for different target sizes and endianity.
12362
12363 2009-10-24  Doug Kwan  <dougkwan@google.com>
12364
12365         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
12366         (Arm_input_section::as_arm_input_section): New method.
12367         (Arm_output_section): New class definition.
12368         (Arm_output_section::create_stub_group,
12369         Arm_output_section::group_sections): New method definitions.
12370
12371 2009-10-22  Doug Kwan  <dougkwan@google.com>
12372
12373         * arm.cc (Arm_input_section): New class definition.
12374         (Arm_input_section::init, Arm_input_section:do_write,
12375         Arm_input_section::set_final_data_size,
12376         Arm_input_section::do_reset_address_and_file_offset): New method
12377         definitions.
12378
12379 2009-10-21  Doug Kwan  <dougkwan@google.com>
12380
12381         * arm.cc (Stub_table, Arm_input_section): New forward class
12382         declarations.
12383         (Stub_table): New class defintion.
12384         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
12385         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
12386         New method definition.
12387
12388 2009-10-21  Doug Kwan  <dougkwan@google.com>
12389
12390         * arm.cc: Update copyright comments.
12391         (Target_arm): New forward class template declaration.
12392         (Arm_address): New type.
12393         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
12394         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
12395         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
12396         constants.
12397         (Insn_template): Same.
12398         (DEF_STUBS): New macro.
12399         (Stub_type): New enum type.
12400         (Stub_template): New class definition.
12401         (Stub): Same.
12402         (Reloc_stub): Same.
12403         (Stub_factory): Same.
12404         (Target_arm::Target_arm): Initialize may_use_blx_ and
12405         should_force_pic_veneer_.
12406         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
12407         Target_arm::should_force_pic_veneer,
12408         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
12409         Target_arm::using_thumb_only, Target_arm:;default_target): New
12410         method defintions.
12411         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
12412         New data member declarations.
12413         (Insn_template::size, Insn_template::alignment): New method defintions.
12414         (Stub_template::Stub_template): New method definition.
12415         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
12416         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
12417         (Stub_factory::Stub_factory): New method definition.
12418         * gold.h (string_hash): New template.
12419         * output.h (Input_section_specifier::hash_value): Use
12420         gold::string_hash.
12421         (Input_section_specifier::string_hash): Remove.
12422         * stringpool.cc (Stringpool_template::string_hash): Use
12423         gold::string_hash.
12424
12425 2009-10-20  Doug Kwan  <dougkwan@google.com>
12426
12427         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
12428         symbols of relaxed input sections.
12429         * output.h (Output_section::find_relaxed_input_section): Make
12430         method public.
12431
12432 2009-10-16  Doug Kwan  <dougkwan@google.com>
12433
12434         * dynobj.cc (Versions::Versions): Initialize version_script_.
12435         Only insert base version symbol definition for a shared object
12436         if version script defines any version versions.
12437         (Versions::define_base_version): New method definition.
12438         (Versions::add_def): Check that base version is not needed.
12439         (Versions::add_need): Define base version lazily.
12440         * dynobj.h (Versions::define_base_version): New method declaration.
12441         (Versions::needs_base_version_): New data member declaration.
12442         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
12443         (check_DATA): Add no_version_test.stdout.
12444         (libno_version_test.so, no_version_test.o no_version_test.stdout):
12445         New make rules.
12446         * testsuite/Makefile.in: Regenerate.
12447         * testsuite/no_version_test.c: New file.
12448         * testsuite/no_version_test.sh: Ditto.
12449
12450 2009-10-16  Doug Kwan  <dougkwan@google.com>
12451
12452         * expression.cc (class Segment_start_expression): New class definition.
12453         (Segment_start_expression::value): New method definition.
12454         (script_exp_function_segment_start): Return a new
12455         Segment_start_expression.
12456         * gold/script-c.h (script_saw_segment_start_expression): New function
12457         prototype.
12458         * script-sections.cc (Script_sections::Script_sections): Initialize
12459         SAW_SEGMENT_START_EXPRESSION_ to false.
12460         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
12461         and -Tbbs options to specify section addresses if given in
12462         command line and no SEGMENT_START expression is seen in a script.
12463         * script-sections.h (Script_sections::saw_segment_start_expression,
12464         Script_sections::set_saw_segment_start_expression): New method
12465         definition.
12466         (Script_sections::saw_segment_start_expression_): New data member
12467         declaration.
12468         * script.cc (script_saw_segment_start_expression): New function.
12469         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
12470         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
12471         script_test_7.sh and script_test_8.sh.
12472         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
12473         script_test_8.stdout.
12474         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
12475         (script_test_6, script_test_6.stdout, script_test_7,
12476         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
12477         * Makefile.in: Regenerate.
12478         * testsuite/script_test_6.sh: New file.
12479         * testsuite/script_test_6.t: Same.
12480         * testsuite/script_test_7.sh: Same.
12481         * testsuite/script_test_7.t: Same.
12482         * testsuite/script_test_8.sh: Same.
12483
12484 2009-10-16  Doug Kwan  <dougkwan@google.com>
12485
12486         * output.cc (Output_segment::set_section_list_address): Cast
12487         expressions to unsigned long long type to avoid format warnings.
12488
12489 2009-10-15  Ian Lance Taylor  <iant@google.com>
12490
12491         * script.cc (Script_options::add_symbol_assignment): Always add a
12492         dot assignment to script_sections_.
12493         * script-sections.cc (Script_sections::add_dot_assignment):
12494         Initialize if necessary.
12495
12496         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
12497         program headers with no load segment if there is a linker script.
12498
12499         * layout.cc (Layout::set_segment_offsets): Align the file offset
12500         to the segment aligment for -N or -n with no load segment.
12501         * output.cc (Output_segment::add_output_section): Don't crash if
12502         the first section is a TLS section.
12503         (Output_segment::set_section_list_addresses): Print an error
12504         message if the address moves backward in a linker script.
12505         * script-sections.cc
12506         (Output_section_element_input::set_section_addresses): Don't
12507         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
12508         (Orphan_output_section::set_section_addresses): Likewise.
12509
12510 2009-10-15  Doug Kwan  <dougkwan@google.com>
12511
12512         * layout.cc (Layout::finish_dynamic_section): Generate tags
12513         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
12514         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
12515         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
12516
12517 2009-10-14  Ian Lance Taylor  <iant@google.com>
12518
12519         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
12520         fields.
12521         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
12522         data_shdr fields of relinfo.
12523         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
12524         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
12525         R_386_TLS_LDO_32, adjust based on section flags.
12526         (Target_i386::Relocate::fix_up_ldo): Remove.
12527
12528 2009-10-13  Ian Lance Taylor  <iant@google.com>
12529
12530         Add support for -pie.
12531         * options.h (class General_options): Add -pie and
12532         --pic-executable.
12533         (General_options::output_is_position_independent): Test -pie.
12534         (General_options::output_is_executable): Return true if not shared
12535         and not relocatable.
12536         (General_options::output_is_pie): Remove.
12537         * options.cc (General_options::finalize): Reject incompatible uses
12538         of -pie.
12539         * gold.cc (queue_middle_tasks): A -pie link is not static.
12540         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
12541         * symtab.cc (Symbol::final_value_is_known): Return false if
12542         output_is_position_independent.
12543         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
12544         output_is_position_independent.
12545         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
12546         output_is_position_independent.
12547         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
12548         output_is_position_independent.
12549         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
12550         two_file_pie_test.
12551         (basic_pie_test.o, basic_pie_test): New targets.
12552         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
12553         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
12554         (two_file_pie_test): New target.
12555         * testsuite/Makefile.in: Rebuild.
12556         * README: Remove note saying that -pie is not supported.
12557
12558 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
12559
12560         * options.h (class General_options): Add -init and -fini.
12561         * layout.cc (Layout::finish_dynamic_section): Emit
12562         given init and fini functions.
12563
12564 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
12565
12566         * gc.h (gc_process_relocs): Check if icf is enabled using new
12567         function.
12568         * gold.cc (queue_initial_tasks): Likewise.
12569         (queue_middle_tasks): Likewise.
12570         * object.cc (do_layout): Likewise.
12571         * symtab.cc (is_section_folded): Likewise.
12572         * main.cc (main): Likewise.
12573         * reloc.cc (Read_relocs::run): Likewise.
12574         (Sized_relobj::do_scan_relocs): Likewise.
12575         * icf.cc (is_function_ctor_or_dtor): New function.
12576         (Icf::find_identical_sections): Check if function is ctor or dtor when
12577         safe icf is chosen.
12578         * options.h (General_options::icf): Change option to be an enum.
12579         (Icf_status): New enum.
12580         (icf_enabled): New method.
12581         (icf_safe_folding): New method.
12582         (set_icf_status): New method.
12583         (icf_status_): New variable.
12584         * (options.cc) (General_options::finalize): Set icf_status_.
12585         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
12586         icf_test and icf_keep_unique_test to use the --icf enum flag.
12587         * testsuite/icf_safe_test.sh: New file.
12588         * testsuite/icf_safe_test.cc: New file.
12589
12590 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
12591
12592         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
12593         includes to gc.h and icf.h.
12594         * arm.cc: Include gc.h.
12595         * gold.cc: Likewise.
12596         * i386.cc: Likewise.
12597         * powerpc.cc: Likewise.
12598         * sparc.cc: Likewise.
12599         * x86_64.cc: Likewise.
12600         * gc.h: Include icf.h.
12601
12602 2009-10-11  Ian Lance Taylor  <iant@google.com>
12603
12604         * plugin.cc: Include "gold.h" before other header files.
12605
12606 2009-10-10  Chris Demetriou  <cgd@google.com>
12607
12608         * options.h (Input_file_argument::Input_file_type): New enum.
12609         (Input_file_argument::is_lib_): Replace with...
12610         (Input_file_argument::type_): New member.
12611         (Input_file_argument::Input_file_argument): Take Input_file_type
12612         'type' rather than boolean 'is_lib' as second argument.
12613         (Input_file_argument::is_lib): Use type_.
12614         (Input_file_argument::is_searched_file): New function.
12615         (Input_file_argument::may_need_search): Handle is_searched_file.
12616         * options.cc (General_options::parse_library): Support -l:filename.
12617         (General_options::parse_just_symbols): Update for Input_file_argument
12618         changes.
12619         (Command_line::process): Likewise.
12620         * archive.cc (Archive::get_file_and_offset): Likewise.
12621         * plugin.cc (Plugin_manager::release_input_file): Likewise.
12622         * script.cc (read_script_file, script_add_file): Likewise.
12623         * fileread.cc (Input_file::Input_file): Likewise.
12624         (Input_file::will_search_for): Handle is_searched_file.
12625         (Input_file::open): Likewise.
12626         * readsyms.cc (Read_symbols::get_name): Likewise.
12627         * testsuite/Makefile.am (searched_file_test): New test.
12628         * testsuite/Makefile.in: Regenerate.
12629         * testsuite/searched_file_test.cc: New file.
12630         * testsuite/searched_file_test_lib.cc: New file.
12631
12632 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12633             Ian Lance Taylor  <iant@google.com>
12634
12635         * descriptor.cc: Include <cstdio> and "binary-io.h".
12636         (Descriptors::open): Open the files in binary mode always.
12637         * script.cc (Lex::get_token): Treat \r as whitespace.
12638
12639 2009-10-09  Ian Lance Taylor  <iant@google.com>
12640
12641         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
12642
12643 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12644             Ian Lance Taylor  <iant@google.com>
12645
12646         * configure.ac: Check for readv function also.
12647         * fileread.cc (readv): Define if not HAVE_READV.
12648         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
12649         does not exist.
12650         * config.in: Regenerate.
12651         * configure: Regenerate.
12652
12653 2009-10-09  Doug Kwan  <dougkwan@google.com>
12654
12655         * layout.cc (Layout::make_output_section): Call target hook to make
12656         ordinary output section.
12657         (Layout::finalize): Adjust parameter list of call the
12658         Target::may_relax().
12659         * layout.h (class Layout::section_list): New method.
12660         * merge.h (Output_merge_base::entsize): Change visibility to public.
12661         (Output_merge_base::is_string, Output_merge_base::do_is_string):
12662         New methods.
12663         (Output_merge_string::do_is_string): New method.
12664         * object.cc (Sized_relobj::do_setup): renamed from
12665         Sized_relobj::set_up.
12666         * object.h (Sized_relobj::adjust_shndx,
12667         Sized_relobj::initializ_input_to_output_maps,
12668         Sized_relobj::free_input_to_output_maps): Change visibilities to
12669         protected.
12670         (Sized_relobj::setup): Virtualize.
12671         (Sized_relobj::do_setup): New method declaration.
12672         (Sized_relobj::invalidate_section_offset,
12673         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
12674         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
12675         * options.cc (parse_int): New function.
12676         * options.h (parse_int): New declaration.
12677         (DEFINE_int): New macro.
12678         (stub_group_size): New option.
12679         * output.cc (Output_section::Output_section): Initialize memebers
12680         merge_section_map_, merge_section_by_properties_map_,
12681         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
12682         (Output_section::add_input_section): Handled deferred code-fill
12683         generation and remove an old comment.
12684         (Output_section::add_relaxed_input_section): New method definition.
12685         (Output_section::add_merge_input_section): Use merge section by
12686         properties map to speed to search.  Update merge section maps
12687         as appropriate.
12688         (Output_section::build_relaxation_map): New method definition.
12689         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
12690         Same.
12691         (Output_section::relax_input_section): Renamed to
12692         Output_section::convert_input_sections_to_relaxed_sections and change
12693         interface to take a vector of pointers to relaxed sections.
12694         (Output_section::find_merge_section,
12695         Output_section::find_relaxed_input_section): New method definitions.
12696         (Output_section::is_input_address_mapped,
12697         Output_section::output_offset, Output_section::output_address):
12698         Use output section data maps to speed up searching.
12699         (Output_section::find_starting_output_address): Add comments.
12700         (Output_section::do_write,
12701         Output_section::write_to_postprocessing_buffer): Do code-fill
12702         generation as appropriate.
12703         (Output_section::get_input_sections): Invalidate relaxed input section
12704         map.
12705         (Output_section::restore_states): Adjust type of checkpoint .
12706         Invalidate relaxed input section map.
12707         * output.h (Output_merge_base): New class declaration.
12708         (Input_section_specifier): New class defintion.
12709         (class Output_relaxed_input_section) Change base class to
12710         Output_section_data_build.
12711         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
12712         base class initializer.
12713         (Output_section::add_relaxed_input_section): New method declaration.
12714         (Output_section::Input_section): Change visibility to protected.
12715         (Output_section::Input_section::relobj,
12716         Output_section::Input_section::shndx): Handle relaxed input sections.
12717         Output_section::input_sections) Change visibility to protected.  Also
12718         define overload to return a non-const pointer.
12719         (Output_section::Merge_section_properties): New class defintion.
12720         (Output_section::Merge_section_by_properties_map,
12721         Output_section::Output_section_data_by_input_section_map,
12722         Output_section::Relaxation_map): New types.
12723         (Output_section::relax_input_section): Rename method to
12724         Output_section::convert_input_sections_to_relaxed_sections and change
12725         interface to take a vector of relaxed section pointers.
12726         (Output_section::find_merge_section,
12727         Output_section::find_relaxed_input_section,
12728         Output_section::build_relaxation_map,
12729         Output_section::convert_input_sections_in_list_to_relaxed_sections):
12730         New method declarations.
12731         (Output_section::merge_section_map_
12732         Output_section::merge_section_by_properties_map_,
12733         Output_section::relaxed_input_section_map_,
12734         Output_section::is_relaxed_input_section_map_valid_,
12735         Output_section::generate_code_fills_at_write_): New data members.
12736         * script-sections.cc
12737         (Output_section_element_input::set_section_addresses): Call
12738         current_data_size and addralign methods of relaxed input sections.
12739         (Orphan_output_section::set_section_addresses): Call current_data_size
12740         and addralign methods of relaxed input sections.
12741         * symtab.cc (Symbol_table::compute_final_value): Extract template
12742         from the body of Symbol_table::sized_finalize_symbol.
12743         (Symbol_table::sized_finalized_symbol): Call
12744         Symbol_table::compute_final_value.
12745         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
12746         (Symbol_table::compute_final_value): New templated method declaration.
12747         * target.cc (Target::do_make_output_section): New method defintion.
12748         * target.h (Target::make_output_section): New method declaration.
12749         (Target::relax): Add more parameters for input objects, symbol table
12750         and layout.  Adjust call to do_relax.
12751         (Target::do_make_output_section): New method declaration.
12752         (Target::do_relax): Add parameters for input objects, symbol table
12753         and layout.
12754
12755 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12756
12757         * pread.c: Include stdio.h.
12758
12759 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12760
12761         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
12762         defined.
12763
12764 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12765
12766         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
12767         Change read_shndx type to unsigned int.
12768         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12769         int.
12770         (Sized_dwarf_line_info::read_line_mappings): Likewise.
12771         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
12772         Change read_shndx type to unsigned int.
12773         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12774         int.
12775         (Sized_dwarf_line_info::read_line_mappings): Likewise.
12776         * layout.cc (Layout::create_symtab_sections): Cast the result of
12777         local_symcount * symsize to off_t in the gold_assert.
12778
12779 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12780
12781         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
12782         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
12783         R_ARM_BASE_ABS.
12784         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
12785         (Arm_relocate_functions::thm_abs5): New function.
12786         (Arm_relocate_functions::abs12): New function.
12787         (Arm_relocate_functions::abs16): New function.
12788         (Arm_relocate_functions::base_abs): New function.
12789         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
12790         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
12791         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
12792         R_ARM_BASE_ABS.
12793         (Scan::global): Likewise.
12794         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
12795         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
12796         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
12797         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
12798         R_ARM_BASE_ABS.
12799
12800 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12801
12802         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
12803         (Arm_relocate_functions::movt_prel): New function.
12804         (Arm_relocate_functions::thm_movw_prel_nc): New function.
12805         (Arm_relocate_functions::thm_movt_prel): New function.
12806         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
12807         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
12808         (Scan::global, Relocate::relocate): Likewise.
12809         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12810
12811 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
12812
12813         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
12814         Incremental_checker.
12815         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
12816         unsigned int.
12817         (class Incremental_inputs_header): New class.
12818         (Incremental_inputs_header_writer): Edit comment.
12819         (Incremental_inputs_entry): New class.
12820         (Incremental_inputs_entry_writer): Edit comment.
12821         (Sized_incremental_binary::do_find_incremental_inputs_section):
12822         Add *strtab_shndx parameter, fill it.
12823         (Sized_incremental_binary::do_check_inputs): New method.
12824         (Incremental_checker::can_incrementally_link_output_file): Use
12825         Sized_incremental_binary::check_inputs.
12826         (Incremental_inputs::report_command_line): Save command line in
12827         command_line_.
12828         * incremental.h:
12829         (Incremental_binary::find_incremental_inputs_section): New
12830         method.
12831         (Incremental_binary::do_find_incremental_inputs_section): Add
12832         strtab_shndx parameter.
12833         (Incremental_binary::do_check_inputs): New pure virtual method.
12834         (Sized_incremental_binary::do_check_inputs): Declare.
12835         (Incremental_checker::Incremental_checker): Add incremental_inputs
12836         parameter, use it to initialize incremental_inputs_.
12837         (Incremental_checker::incremental_inputs_): New field.
12838         (Incremental_checker::command_line): New method.
12839         (Incremental_checker::inputs): New method.
12840         (Incremental_checker::command_line_): New field.
12841
12842 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
12843
12844         * incremental.cc: Include <cstdarg> and "target-select.h".
12845         (vexplain_no_incremental): New function.
12846         (explain_no_incremental): New function.
12847         (Incremental_binary::error): New method.
12848         (Sized_incremental_binary::do_find_incremental_inputs_section): New
12849         method.
12850         (make_sized_incremental_binary): New function.
12851         (open_incremental_binary): New function.
12852         (can_incrementally_link_file): Add checks if output is ELF and has
12853         inputs section.
12854         * incremental.h: Include "elfcpp_file.h" and "output.h".
12855         (Incremental_binary): New class.
12856         (Sized_incremental_binary): New class.
12857         (open_incremental_binary): Declare.
12858         * object.cc (is_elf_object): Use
12859         elfcpp::Elf_recognizer::is_elf_file.
12860         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
12861         * output.h (Output_file::filesize): New method.
12862
12863 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12864
12865         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
12866         New function.
12867         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
12868         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
12869         function.
12870         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
12871         function.
12872         (Arm_relocate_functions::movw_abs_nc): New function.
12873         (Arm_relocate_functions::movt_abs): New function.
12874         (Arm_relocate_functions::thm_movw_abs_nc): New function.
12875         (Arm_relocate_functions::thm_movt_abs): New function.
12876         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
12877         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
12878         (Scan::global): Likewise.
12879         (Relocate::relocate): Likewise.
12880         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12881
12882 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12883
12884         * arm.cc (Arm_relocate_functions::got_prel) New function.
12885         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
12886         (Relocate::relocate): Likewise.
12887         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12888
12889 2009-10-06  Ian Lance Taylor  <iant@google.com>
12890
12891         * options.h (class General_options): Define
12892         split_stack_adjust_size parameter.
12893         * object.h (class Object): Add uses_split_stack_ and
12894         has_no_split_stack_ fields.  Add uses_split_stack and
12895         has_no_split_stack accessor functions.  Declare
12896         handle_split_stack_section.
12897         (class Reloc_symbol_changes): Define.
12898         (class Sized_relobj): Define Function_offsets.  Declare
12899         split_stack_adjust, split_stack_adjust_reltype, and
12900         find_functions.
12901         * object.cc (Object::handle_split_stack_section): New function.
12902         (Sized_relobj::do_layout): Call handle_split_stack_section.
12903         * dynobj.cc (Sized_dynobj::do_layout): Call
12904         handle_split_stack_section.
12905         * reloc.cc (Sized_relobj::relocate_sections): Call
12906         split_stack_adjust for executable sections in split_stack
12907         objects.  Pass reloc_map to relocate_section.
12908         (Sized_relobj::split_stack_adjust): New function.
12909         (Sized_relobj::split_stack_adjust_reltype): New function.
12910         (Sized_relobj::find_functions): New function.
12911         * target-reloc.h: Include "object.h".
12912         (relocate_section): Add reloc_symbol_changes parameter.  Change
12913         all callers.
12914         * target.h (class Target): Add calls_non_split method.  Declare
12915         do_calls_non_split virtual method.  Declare match_view and
12916         set_view_to_nop.
12917         * target.cc: Include "elfcpp.h".
12918         (Target::do_calls_non_split): New function.
12919         (Target::match_view): New function.
12920         (Target::set_view_to_nop): New function.
12921         * gold.cc (queue_middle_tasks): Give an error if mixing
12922         split-stack and non-split-stack objects with -r.
12923         * i386.cc (Target_i386::relocate_section): Add
12924         reloc_symbol_changes parameter.
12925         (Target_i386::do_calls_non_split): New function.
12926         * x86_64.cc (Target_x86_64::relocate_section): Add
12927         reloc_symbol_changes parameter.
12928         (Target_x86_64::do_calls_non_split): New function.
12929         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
12930         parameter.
12931         * powerpc.cc (Target_powerpc::relocate_section): Add
12932         reloc_symbol_changes parameter.
12933         * sparc.cc (Target_sparc::relocate_section): Add
12934         reloc_symbol_changes parameter.
12935         * configure.ac: Call AM_CONDITIONAL for the default target.
12936         * configure: Rebuild.
12937         * testsuite/Makefile.am (TEST_AS): New variable.
12938         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
12939         (check_DATA): Add split_i386 and split_x86_64 files.
12940         (SPLIT_DEFSYMS): Define.
12941         (split_i386_[1234n].o): New targets.
12942         (split_i386_[124]): New targets.
12943         (split_i386_[1234r].stdout): New targets.
12944         (split_x86_64_[1234n].o): New targets.
12945         (split_x86_64_[124]): New targets.
12946         (split_x86_64_[1234r].stdout): New targets.
12947         (MOSTLYCLEANFILES): Add new executables.
12948         * testsuite/split_i386.sh: New file.
12949         * testsuite/split_x86_64.sh: New file.
12950         * testsuite/split_i386_1.s: New file.
12951         * testsuite/split_i386_2.s: New file.
12952         * testsuite/split_i386_3.s: New file.
12953         * testsuite/split_i386_4.s: New file.
12954         * testsuite/split_i386_n.s: New file.
12955         * testsuite/split_x86_64_1.s: New file.
12956         * testsuite/split_x86_64_2.s: New file.
12957         * testsuite/split_x86_64_3.s: New file.
12958         * testsuite/split_x86_64_4.s: New file.
12959         * testsuite/split_x86_64_n.s: New file.
12960         * testsuite/testfile.cc (Target_test): Update relocation_section
12961         function.
12962         * testsuite/Makefile.in: Rebuild.
12963
12964 2009-10-06  Ian Lance Taylor  <iant@google.com>
12965
12966         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
12967         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
12968         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
12969         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
12970         the address on ldo_addrs_.
12971         (Target_i386::Relocate::fix_up_ldo): New function.
12972
12973 2009-10-06   Rafael Espindola  <espindola@google.com>
12974
12975         * plugin.cc (add_input_library): New.
12976         (Plugin::load): Add add_input_library to tv.
12977         (Plugin_manager::add_input_file): Add the is_lib argument.
12978         (add_input_file): Update call to Plugin_manager::add_input_file.
12979         (add_input_library): New.
12980         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
12981
12982 2009-09-30  Doug Kwan  <dougkwan@google.com>
12983
12984         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
12985         symbol and call Symbol::may_need_copy_reloc to determine if
12986         a copy reloc is needed.
12987         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12988         nocopyreloc is given in command line.
12989         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12990         given in command line.
12991         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12992         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
12993         of the removed Target_i386::may_need_copy_reloc.
12994         * options.h (copyreloc): New option with default value false.
12995         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12996         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12997         instead of the removed Target_powerpc::may_need_copy_reloc.
12998         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12999         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
13000         instead of the removed Target_sparc::may_need_copy_reloc.
13001         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
13002         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
13003         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
13004         instead of the removed Target_x86_64::may_need_copy_reloc.
13005
13006 2009-09-30  Ian Lance Taylor  <iant@google.com>
13007
13008         * object.h (class Object): Remove target_ field, and target,
13009         sized_target, and set_target methods.
13010         (Object::sized_target): Remove.
13011         (class Sized_relobj): Update declarations.  Remove sized_target.
13012         * object.cc (Sized_relobj::setup): Remove target parameter.
13013         Change all callers.
13014         (Input_objects::add_object): Don't do anything with the target.
13015         (make_elf_sized_object): Add punconfigured parameter.  Change all
13016         callers.  Set or test parameter target.
13017         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
13018         Change all callers.
13019         * parameters.cc (Parameters::set_target): Change parameter type to
13020         be non-const.
13021         (Parameters::default_target): Remove.
13022         (set_parameters_target): Change parameter type to be non-const.
13023         (parameters_force_valid_target): New function.
13024         (parameters_clear_target): New function.
13025         * parameters.h (class Parameters): Update declarations.  Remove
13026         default_target method.  Add sized_target and clear_target
13027         methods.  Change target_ to be non-const.
13028         (set_parameters_target): Update declaration.
13029         (parameters_force_valid_target): Declare.
13030         (parameters_clear_target): Declare.
13031         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
13032         as NULL if we aren't searching.
13033         (Add_symbols::run): Don't check for compatible target.
13034         * fileread.cc (Input_file::open_binary): Call
13035         parameters_force_valid_target.
13036         * gold.cc (queue_middle_tasks): Likewise.
13037         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
13038         set_target on object.
13039         * dynobj.h (class Sized_dynobj): Update declarations.
13040         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
13041         make_elf_object returns NULL.
13042         (Archive::include_member): Don't check whether object target is
13043         compatible.
13044         * output.cc (Output_section::add_input_section): Get target from
13045         parameters.
13046         (Output_section::relax_input_section): Likewise.
13047         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
13048         parameters.
13049         (Sized_relobj::do_scan_relocs): Likewise.
13050         (Sized_relobj::relocate_sections): Likewise.
13051         * resolve.cc (Symbol_table::resolve): Likewise.
13052         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
13053         parameter.  Change all callers.
13054         (Symbol_table::add_from_object): Get target from parameters.
13055         (Symbol_table::add_from_relobj): Don't check object target.
13056         (Symbol_table::add_from_dynobj): Likewise.
13057         (Symbol_table::define_special_symbol): Get target from
13058         parameters.
13059         * symtab.h (class Symbol_table): Update declaration.
13060         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
13061         parameter.  Change all callers.  Clear parameter target.
13062         (Binary_test): Test target here.
13063         * testsuite/object_unittest.cc (gold_testsuite): Remove
13064         target_test_pointer parameter.  Change all callers.
13065         (Object_test): Test target here.
13066
13067 2009-09-26  Ian Lance Taylor  <iant@google.com>
13068
13069         * testsuite/initpri1.c: Don't try to use constructor priorities if
13070         compiling with gcc before 4.3.
13071
13072 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
13073
13074         * testsuite/retain_symbols_file_test.sh (check_present): Change
13075         output file name to retain_symbols_file_test.stdout.
13076         (check_absent): Likewise.
13077
13078 2009-09-18  Craig Silverstein  <csilvers@google.com>
13079
13080         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
13081         * options.cc: Include <cerrno> and <fstream>.
13082         (General_options::finalize): Parse -retain-symbols-file tag.
13083         * options.h: New flag.
13084         (General_options): New method should_retain_symbol, new
13085         variable symbols_to_retain.
13086         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
13087         should_retain_symbol map.
13088         * testsuite/Makefile.am (retain_symbols_file_test): New test.
13089         * testsuite/Makefile.in: Regenerate.
13090         * testsuite/retain_symbols_file_test.sh: New file.
13091
13092 2009-09-18  Nick Clifton  <nickc@redhat.com>
13093
13094         * po/es.po: Updated Spanish translation.
13095
13096 2009-09-17  Doug Kwan  <dougkwan@google.com>
13097
13098         * debug.h (DEBUG_RELAXATION): New constant.
13099         (DEBUG_ALL): Add DEBUG_RELAXATION.
13100         (debug_string_to_enum): Add relaxation debug option.
13101         * layout.cc
13102         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
13103         Layout::Relaxation_debug_check::read_sections,
13104         Layout::Relaxation_debug_check::read_sections): New method definitions.
13105         (Layout::Layout): Initialize data members
13106         record_output_section_data_from_scrips_,
13107         script_output_section_data_list_ and relaxation_debug_check_.
13108         (Layout::save_segments, Layout::restore_segments,
13109         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13110         Layout::relaxation_loop_body): New method definitions.
13111         (Layout::finalize): Support relaxation.  Move section layout code to
13112         Layout::relaxation_loop_body.
13113         (Layout::set_asection_address_from_script): Move code for orphan
13114         section placement out.
13115         (Layout::place_orphan_sections_in_script): New method definition.
13116         * layout.h (Output_segment_headers, Output_file_header):
13117         New forward class declarations.
13118         (Layout::~Layout): Define.
13119         (Layout::new_output_section_data_from_script): New method definition.
13120         (Layout::place_orphan_sections_in_script): New method declaration.
13121         (Layout::Segment_states): New type declaration.
13122         (Layout::save_segments, Layout::restore_segments,
13123         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13124         Layout::relaxation_loop_body): New method declarations.
13125         (Layout::Output_section_data_list): New type declaration.
13126         (Layout::Relaxation_debug_check): New class definition.
13127         (Layout::record_output_section_data_from_script_,
13128         Layout::script_output_section_data_list_, Layout::segment_states_,
13129         Layout::relaxation_debug_check_): New data members.
13130         * output.cc: (Output_section_headers::do_size): New method definition.
13131         (Output_section_headers::Output_section_headers): Move size
13132         computation to Output_section_headers::do_size.
13133         (Output_segment_headers::do_size): New method definition.
13134         (Output_file_header::Output_file_header): Move size computation to
13135         Output_file_header::do_size and call it.
13136         (Output_file_header::do_size): New method definition.
13137         (Output_data_group::Output_data_group): Adjust call to
13138         Output_section_data.
13139         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
13140         (Output_symtab_xindex::do_write): Add array bound check.
13141         (Output_section::Input_section::print_to_mapfile): Handle
13142         RELAXED_INPUT_SECTION_CODE.
13143         (Output_section::Output_section): Initialize data member checkpoint_.
13144         (Output_section::~Output_section): Delete checkpoint object pointed
13145         by checkpoint_.
13146         (Output_section::add_input_section): Always add an Input_section if
13147         relaxing.
13148         (Output_section::add_merge_input_section): Add assert.
13149         (Output_section::relax_input_section): New method definition.
13150         (Output_section::set_final_data_size): Set load address to zero for
13151         an unallocated section.
13152         (Output_section::do_address_and_file_offset_have_reset_values):
13153         New method definition.
13154         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
13155         Handle relaxed input section.
13156         (Output_section::sort_attached_input_sections): Checkpoint input
13157         section list lazily.
13158         (Output_section::get_input_sections): Change type of input_sections to
13159         list of Simple_input_section pointers.  Checkpoint input section list
13160         lazily.  Also handle relaxed input sections.
13161         (Output_section::add_input_section_for_script): Take a reference to
13162         a Simple_input_section object instead of Relobj pointer and section
13163         index as parameter.  Handle relaxed input sections.
13164         (Output_section::save_states, Output_section::restore_states): New
13165         method definitions.
13166         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
13167         (Output_data::is_data_size_fixed): New method definition.
13168         (Output_data::reset_addresss_and_file_offset): Do not reset data size
13169         if it is fixed.
13170         (Output_data::address_and_file_offset_have_reset_values): New method
13171         definition.
13172         (Output_data::do_address_and_file_offset_have_reset_values): New method
13173         definition.
13174         (Output_data::set_data_size): Check that data size is not fixed.
13175         (Output_data::fix_data_size): New method definition.
13176         (Output_data::is_data_size_fixed_): New data member.
13177         (Output_section_headers::set_final_data_size): New method definition.
13178         (Output_section_headers::do_size): New method declaration.
13179         (Output_segment_headers::set_final_data_size): New method definition.
13180         (Output_segment_headers::do_size): New method declaration.
13181         (Output_file_header::set_final_data_size)::New method definition.
13182         (Output_file_header::do_size)::New method declaration.
13183         (Output_section_data::Output_section_data): Add new parameter
13184         is_data_size_fixed and use it to fix data size.
13185         (Output_data_const::Output_data_const): Adjust call to base class
13186         constructor and fix data size.
13187         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
13188         base class constructor and fix data size.
13189         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
13190         base class constructor and fix data size.
13191         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
13192         class constructor and fix data size.
13193         (Output_data_group::set_final_data_size): New method definition.
13194         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
13195         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
13196         class constructor and fix data size.
13197         (Output_relaxed_input_section): New class definition.
13198         (Output_section::Simple_input_section): New class definition.
13199         (Output_section::get_input_sections): Adjust parameter list.
13200         (Output_section::add_input_section_for_script): Same.
13201         (Output_section::save_states, Output_section::restore_states,
13202         Output_section::do_address_and_file_offset_have_reset_values,
13203         (Output_section::Input_section::Input_section): Handle
13204         RELAXED_INPUT_SECTION_CODE.  Add new overload for
13205         Output_relaxed_input_section.
13206         (Output_section::Input_section::is_input_section,
13207         Output_section::Input_section::set_output_section): Handle relaxed
13208         input section.
13209         (Output_section::Input_section::is_relaxed_input_section,
13210         Output_section::Input_section::output_section_data,
13211         Output_section::Input_section::relaxed_input_section): New method
13212         definitions.
13213         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
13214         value.
13215         (Output_section::Input_section::u1_): Update comments.
13216         (Output_section::Input_section::u2_): Add new union member poris.
13217         (Output_section::Checkpoint_output_section): New classs definition.
13218         (Output_section::relax_input_section): New method declaration.
13219         (Output_section::checkpoint_): New data member.
13220         (Output_segment): Update comments.
13221         (Output_segment::Output_segment): Un-privatize copy constructor.
13222         (Output_segment::operator=): Un-privatize.
13223         * script-sections.cc (Output_section_element::Input_section_list):
13224         Change element type to Output_section::Simple_input_section.
13225         (Output_section_element_dot_assignment::set_section_addresses):
13226         Register output section data for relaxation clean up.
13227         (Output_data_exression::Output_data_expression): Adjust call to base
13228         constructor to fix data size.
13229         (Output_section_element_data::set_section_addresses): Register
13230         Output_data_expression object for relaxation clean up.
13231         (struct Input_section_info): Replace Relobj pointer and section index
13232         pair with Output_section::Simple_input_section and Convert struct to a
13233         class.
13234         (Input_section_sorter::operator()): Adjust access to
13235         Input_section_info data member to use accessors.
13236         (Output_section_element_input::set_section_addresses): Use layout
13237         parameter.  Adjust code to use Output_section::Simple_input_section
13238         and Input_secction_info classes.  Register filler for relaxation
13239         clean up.
13240         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
13241         and section index pair with Output_section::Simple_input_section
13242         class.  Adjust code accordingly.
13243         (Phdrs_element::release_segment): New method definition.
13244         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
13245         segment list.
13246         (Script_sections::release_segments): New method definition.
13247         * gold/script-sections.h (Script_sections::release_segments): New
13248         method declaration.
13249         * gold/target.h (Target::may_relax, Target::relax,
13250         Target::do_may_relax, Target::do_relax): New method definitions.
13251
13252 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13253
13254         * arm.cc (has_signed_unsigned_overflow): New function.
13255         (Arm_relocate_functions::abs8): New function.
13256         (Target_arm::Scan::local): Handle R_ARM_ABS8.
13257         (Target_arm::Scan::global): Likewise.
13258         (Target_arm::relocate::relocate): Likewise.
13259         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
13260         Likewise.
13261
13262 2009-09-16  Cary Coutant  <ccoutant@google.com>
13263
13264         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
13265         * testsuite/Makefile.in: Regenerate.
13266
13267 2009-09-11  Nick Clifton  <nickc@redhat.com>
13268
13269         * po/gold.pot: Updated by the Translation project.
13270
13271 2009-09-08  Cary Coutant  <ccoutant@google.com>
13272
13273         * output.cc (Output_file::open): Add execute permission to empty file.
13274         * testsuite/Makefile.am (permission_test): New test.
13275         * testsuite/Makefile.in: Regenerate.
13276
13277 2009-09-02  Ian Lance Taylor  <iant@google.com>
13278
13279         * output.cc (Output_file::resize): Call map_no_anonymous rather
13280         than map.
13281
13282 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
13283
13284         * gold.cc: Include "incremental.h".
13285         (queue_initial_tasks): Call Incremental_checker methods.
13286         * incremental.cc: Include "output.h".
13287         (Incremental_checker::can_incrementally_link_output_file): New
13288         method.
13289         * incremental.h (Incremental_checker): New class.
13290
13291         * output.cc (Output_file::open_for_modification): New method.
13292         (Output_file::map_anonymous): Changed return type to bool.  Record
13293         map in base_ field.
13294         (Output_file::map_no_anonymous): New method, broken out of map.
13295         (Output_file::map): Use map_no_anonymous and map_anonymous.
13296         * output.h (class Output_file): Update declarations.
13297
13298 2009-08-24  Cary Coutant  <ccoutant@google.com>
13299
13300         * options.h (Command_line::Pre_options): New class.
13301         (Command_line::pre_options): New member.
13302         * options.cc (gold::options::ready_to_register): New variable.
13303         (One_option::register_option): Do nothing if not registering options.
13304         Assert if same short option registered twice.
13305         (General_options::General_options): Turn off option registration when
13306         done constructing.
13307         (Command_line::Pre_options::Pre_options): New constructor.
13308
13309 2009-08-24  Cary Coutant  <ccoutant@google.com>
13310
13311         * options.h (General_options::no_keep_memory): Remove incorrect
13312         short option.
13313
13314 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
13315
13316         * Makefile.am (am__skiplex, am__skipyacc): New.
13317         * Makefile.in: Regenerate.
13318
13319 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
13320
13321         * Makefile.am (AM_CPPFLAGS): Renamed from ...
13322         (INCLUDES): ... this.
13323         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
13324         (AM_CPPFLAGS): Renamed from ...
13325         (INCLUDE): ... this.
13326         * Makefile.in, testsuite/Makefile.in: Regenerate.
13327
13328         * Makefile.in: Regenerate.
13329         * aclocal.m4: Likewise.
13330         * config.in: Likewise.
13331         * configure: Likewise.
13332         * testsuite/Makefile.in: Likewise.
13333
13334         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13335         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13336         * Makefile.in: Regenerate.
13337         * testsuite/Makefile.in: Regenerate.
13338
13339 2009-08-19  Cary Coutant  <ccoutant@google.com>
13340
13341         * resolve.cc (Symbol_table::resolve): Don't complain about defined
13342         symbols in shared libraries overridden by hidden or internal symbols
13343         in the main program.
13344
13345 2009-08-19  Chris Demetriou  <cgd@google.com>
13346
13347         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
13348         checking source file names in error messages.
13349
13350 2009-08-18  Doug Kwan  <dougkwan@google.com>
13351
13352         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
13353         an elcpp::Ehdr as parameter.  Adjust call to set_target.
13354         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
13355         an elfcpp::Ehdr as parameter.
13356         * object.cc (Object::set_target): Remove the version that looks up
13357         a target and sets it.
13358         (Sized_relobj::setup): Take a Target object instead of
13359         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
13360         (make_elf_sized_object): Find target and ask target to
13361         make an ELF object.
13362         * object.h: (Object::set_target): Remove the version that looks up
13363         a target and sets it.
13364         (Sized_relobj::setup): Take a Target object instead of
13365         an elfcpp:Ehdr as parameter.
13366         * target.cc: Include dynobj.h.
13367         (Target::do_make_elf_object_implementation): New.
13368         (Target::do_make_elf_object): New.
13369         * target.h (Target::make_elf_object): New template declaration.
13370         (Target::do_make_elf_object): New method declarations.
13371         (Target::do_make_elf_object_implementation): New template declaration.
13372
13373 2009-08-14  Ian Lance Taylor  <iant@google.com>
13374
13375         * gold.h (FUNCTION_NAME): Define.
13376         (gold_unreachable): Use FUNCTION_NAME.
13377
13378 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
13379
13380         * icf.cc (Icf::find_identical_sections): Issue a warning when a
13381         symbol in the --keep-unique list is not found.
13382
13383 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
13384
13385         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
13386         been maked as --keep-unique.
13387         (Icf::unfold_section): New function.
13388         * icf.h (Icf::unfold_section): New function.
13389         * options.h (General_options::keep_unique): New option.
13390         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
13391         * testsuite/Makefile.in: Regenerate.
13392         * testsuite/icf_keep_unique_test.sh: New file.
13393         * testsuite/icf_keep_unique_test.cc: New file.
13394
13395 2009-08-12  Cary Coutant  <ccoutant@google.com>
13396
13397         PR 10471
13398         * resolve.cc (Symbol_table::resolve): Check for references from
13399         dynamic objects to hidden and internal symbols.
13400         * testsuite/Makefile.am (hidden_test.sh): New test.
13401         * testsuite/Makefile.in: Regenerate.
13402         * testsuite/hidden_test.sh: New script.
13403         * testsuite/hidden_test_1.c: New test source.
13404         * testsuite/hidden_test_main.c: New test source.
13405
13406 2009-08-11  Doug Kwan  <dougkwan@google.com>
13407
13408         * arm.cc: Update comments.
13409         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
13410         segment to locate the .ARM.exidx section if present.
13411
13412 2009-08-09  Doug Kwan  <dougkwan@google.com>
13413
13414         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
13415         patch.
13416
13417 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
13418         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
13419         compiler warnings.
13420
13421 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
13422
13423         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
13424         valid tls_segment only for non-debug-section relocations.
13425         * testsuite/Makefile.am: Add gc_tls_test.
13426         * testsuite/Makefile.in: Regenerate.
13427         * testsuite/gc_tls_test.cc: New file.
13428         * testsuite/gc_tls_test.sh: New file.
13429
13430 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
13431
13432         * icf.cc: New file.
13433         * icf.h: New file.
13434         * Makefile.am (CCFILES): Add icf.cc.
13435         (HFILES): Add icf.h
13436         * Makefile.in: Regenerate.
13437         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
13438         * gc.h (gc_process_relocs): Populate lists used by icf to contain
13439         section, symbol and addend information for the relocs.
13440         * gold.cc (queue_middle_tasks): Call identical code folding.
13441         * gold.h: Add defines for multimap.
13442         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
13443         to the call of finalize_local_symbols.
13444         * main.cc (main): Create object of class Icf.
13445         * object.cc (Sized_relobj::do_layout): Allow this function to be
13446         called twice during icf.
13447         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
13448         to sections marked as identical by icf.
13449         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
13450         when available.
13451         (Sized_relobj::do_section_entsize): New function.
13452         * object.h (Object::section_entsize): New function.
13453         (Object::do_section_entsize): New pure virtual function.
13454         (Relobj::finalize_local_symbols): Add new parameter.
13455         (Relobj::do_section_entsize): New function.
13456         * options.h (General_options::icf): New option.
13457         (General_options::icf_iterations): New option.
13458         (General_options::print_icf_sections): New option.
13459         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
13460         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
13461         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
13462         icf.
13463         * symtab.cc (Symbol_table::is_section_folded): New function.
13464         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
13465         to sections marked as identical by icf.
13466         * symtab.h (Symbol_table::set_icf): New function.
13467         (Symbol_table::icf): New function.
13468         (Symbol_table::is_section_folded): New function.
13469         (Symbol_table::icf_): New data member.
13470         * target-reloc.h (relocate_section): Ignore sections folded by icf.
13471         * testsuite/Makefile.am: Add commands to build icf_test.
13472         * testsuite/Makefile.in: Regenerate.
13473         * testsuite/icf_test.sh: New file.
13474         * testsuite/icf_test.cc: New file.
13475
13476 2009-07-24  Chris Demetriou  <cgd@google.com>
13477
13478         * layout.cc (is_compressible_debug_section): Fix incorrect
13479         comment about compressed section names.
13480
13481 2009-07-20  Ian Lance Taylor  <ian@airs.com>
13482
13483         PR 10419
13484         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
13485
13486 2009-07-16  Ian Lance Taylor  <iant@google.com>
13487
13488         PR 10400
13489         * layout.h: #include <map>.
13490         (class Kept_section): Change from struct to class.  Add accessors
13491         and setters.  Add section size to Comdat_group mapping.  Change
13492         Comdat_group to std::map.  Add is_comdat_ field.  Add
13493         linkonce_size field in union.
13494         (class Layout): Update declaration of find_or_add_kept_section.
13495         Don't declare find_kept_object.
13496         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
13497         parameter.  Add object, shndx, is_comdat, and is_group_name
13498         parameters.  Change all callers.  Adjust for new Kept_section.
13499         (Layout::find_kept_object): Remove.
13500         * object.cc (Sized_relobj::include_section_group): Update use of
13501         Kept_section.  Rename secnum to shndx.  Only record
13502         Kept_comdat_section if sections are the same size.
13503         (Sized_relobj::include_linkonce_section): Update use of
13504         Kept_section.  Only record Kept_comdat_section if sections are the
13505         same size.  Set size of linkonce section.
13506         (Sized_relobj::map_to_kept_section): Update call to
13507         get_kept_comdat_section.
13508         * object.h (class Sized_relobj): Rename fields in
13509         Kept_comdat_section to drop trailing underscores; change object
13510         field to Relobj*.  Change Kept_comdat_section_table to store
13511         struct rather than pointer.
13512         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
13513         Add kept_object and kept_shndx parameters.  Change all callers.
13514         (Sized_relobj::get_kept_comdat_section): Change return type to
13515         bool.  Add kept_object and kept_shndx parameters.  Change all
13516         callers.
13517         * plugin.cc (Pluginobj::include_comdat_group): Update call to
13518         Layout::find_or_add_kept_section.
13519
13520 2009-07-09  Ian Lance Taylor  <iant@google.com>
13521
13522         * merge.cc (Object_merge_map::initialize_input_to_output_map):
13523         Reserve space in the hash table.
13524
13525 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
13526
13527         * fileread.cc (File_read::get_mtime): New method.
13528         * fileread.h (Timespec): New structure.
13529         (File_read::get_mtime): New method.
13530         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
13531         Renamed from timestamp_nsec.
13532         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
13533         Elf_Xword.
13534         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
13535         timestamp_nsec.
13536         (Incremental_inputs::report_archive): Save mtime; style fix.
13537         (Incremental_inputs::report_obejct): Save mtime; style fix.
13538         (Incremental_inputs::report_script): Save mtime; style fix.
13539         (Incremental_inputs::finalize_inputs): Style fix.
13540         (Incremental_inputs::finalize): Style fix.
13541         (Incremental_inputs::create_input_section_data): Store inputs
13542         mtime.
13543         * incremental.h (Incremental_inputs::report_script): Add mtime
13544         argument.
13545         (Incremental_inputs::Input_info::Input_info): Intialize only one
13546         union member.
13547         (Incremental_inputs::Input_info::archive): Move to nameless
13548         union.
13549         (Incremental_inputs::Input_info::obejct): Move to nameless union.
13550         (Incremental_inputs::Input_info::script): Move to nameless union.
13551         (Incremental_inputs::mtime): New field.
13552         * script.cc (read_input_script): Pass file mtime to
13553         Incremental_input.
13554         * script.h (Script_info::inputs): Style fix.
13555
13556 2009-07-01  Ian Lance Taylor  <ian@airs.com>
13557
13558         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
13559         instead of 32.
13560
13561 2009-06-24  Ian Lance Taylor  <iant@google.com>
13562
13563         PR 10156
13564         * layout.cc (Layout::choose_output_section): If we find an
13565         existing section, update the flags.
13566         (Layout::create_notes): New function, broken out of
13567         Layout::finalize.
13568         (Layout::finalize): Don't create note sections.
13569         (Layout::create_note): Don't crash if linker script discards
13570         section.
13571         (Layout::create_gold_note): Likewise.
13572         (Layout::create_build_id): Likewise.  Don't set
13573         after_input_sections on the section.
13574         (Layout::create_executable_stack_info): Remove target parameter.
13575         Change caller.
13576         * layout.h (class Layout): Declare create_notes.  Update
13577         declaration of create_executable_stack_info.
13578         * gold.cc (queue_middle_tasks): Call create_notes.
13579         * output.cc (Output_section::update_flags_for_input_section): Move
13580         here from output.h.  If SHF_ALLOC flag is newly set, mark address
13581         invalid.
13582         * output.h (Output_data::mark_address_invalid): New function.
13583         (class Output_section): Only declare, not define,
13584         update_flags_for_input_section.  Remove set_flags.
13585
13586 2009-06-24  Ian Lance Taylor  <iant@google.com>
13587
13588         * script-sections.cc (Output_section_definition::
13589         set_section_addresses): Rename shadowing local load_address to
13590         laddr.
13591
13592 2009-06-24  Ian Lance Taylor  <iant@google.com>
13593
13594         PR 10244
13595         * reloc.cc (relocate_sections): Skip empty relocation sections.
13596
13597 2009-06-23  Ian Lance Taylor  <iant@google.com>
13598
13599         PR 10156
13600         * layout.cc (Layout::create_note): Use choose_output_section
13601         rather than make_output_section.
13602
13603 2009-06-23  Ian Lance Taylor  <iant@google.com>
13604
13605         PR 10237
13606         * options.cc (General_options::parse_V): Set printed_version_.
13607         (General_options::General_options): Initialize printed_version_.
13608         * options.h (class General_options): Add printed_version_ field.
13609         * gold.cc (queue_initial_tasks): If there are no input files,
13610         don't give a fatal error if we printed the version information.
13611         (queue_middle_tasks): If using -r with a shared object, give a
13612         fatal error rather than an ordinary error.
13613
13614 2009-06-23  Ian Lance Taylor  <iant@google.com>
13615
13616         PR 10219
13617         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
13618         (Layout::make_output_section): Set have_stabstr_section_ if we see
13619         a .stab*str section.
13620         (Layout::finalize): Call link_stabs_sections.
13621         (Layout::link_stabs_sections): New file.
13622         * layout.h (class Layout): Add have_stabstr_section_ field.
13623         Declare link_stabs_sections.
13624
13625 2009-06-23  Doug Kwan  <dougkwan@google.com>
13626
13627         * Makefile.am (libgold_a_LIBADD): New.
13628         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
13629         * Makefile.in: Regenerate.
13630         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
13631         * configure: Regenerate.
13632         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
13633         * fileread.cc: Include sys/state.h
13634         * gold.h: Declare memmem and strndup if found missing.
13635         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
13636
13637 2009-06-23  Ian Lance Taylor  <iant@google.com>
13638
13639         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
13640         * configure: Rebuild.
13641
13642 2009-06-23  Ian Lance Taylor  <iant@google.com>
13643
13644         PR 10147
13645         * object.cc (Object::section_contents): Don't try to get a view if
13646         the section has length zero.
13647         (Object::handle_gnu_warning_section): If the section is empty, use
13648         the name of the section as the warning.
13649
13650 2009-06-23  Ian Lance Taylor  <iant@google.com>
13651
13652         PR 10133
13653         * stringpool.h (class Stringpool_template): Add optimize_ field.
13654         (Stringpool_template::set_optimize): New function.
13655         * stringpool.cc (Stringpool_template::Stringpool_template):
13656         Initialize optimize_ field.
13657         (Stringpool_template::set_string_offsets): Test local optimize
13658         fild rather than parameter.
13659         * layout.cc (Layout::Layout): Call set_optimize on the section
13660         name stringpool.
13661
13662 2009-06-22  Ian Lance Taylor  <iant@google.com>
13663
13664         PR 10030
13665         * yyscript.y: Parse TARGET.
13666         * script.cc (script_set_target): New function.
13667         * script-c.h (script_set_target): Declare.
13668         * options.cc (General_options::string_to_object_format): Rename
13669         from string_to_object_format in anonymous namespace.  Change
13670         callers.
13671         * options.h (class General_options): Declare
13672         string_to_object_format.
13673
13674 2009-06-22  Ian Lance Taylor  <iant@google.com>
13675
13676         * script-sections.cc (Script_sections::create_segments): Don't put
13677         program headers in a PT_LOAD segment if -n or -N.
13678
13679 2009-06-22  Ian Lance Taylor  <iant@google.com>
13680
13681         PR 10141
13682         * options.h (class General_options): Add -z lazy and -z now.  Sort
13683         -z options into alphabetical order.
13684         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
13685
13686 2009-06-21  Ian Lance Taylor  <iant@google.com>
13687
13688         * layout.cc (Layout::make_output_section): Call
13689         Target::new_output_section.
13690         (Layout::attach_allocated_section_to_segment): Put large section
13691         sections in a separate load segment with the large segment flag
13692         set.
13693         (Layout::segment_precedes): Sort large data segments after other
13694         load segments.
13695         (align_file_offset): New static function.
13696         (Layout::set_segment_offsets): Use align_file_offset.
13697         * output.h (class Output_section): Add is_small_section_ and
13698         is_large_section_ fields.
13699         (Output_section::is_small_section): New function.
13700         (Output_section::set_is_small_section):  New function.
13701         (Output_section::is_large_section): New function.
13702         (Output_section::set_is_large_section): New function.
13703         (Output_section::is_large_data_section): New function.
13704         (class Output_segment): Add is_large_data_segment_ field.
13705         (Output_segment::is_large_data_segment): New function.
13706         (Output_segment::set_is_large_data_segment): New function.
13707         * output.cc (Output_section::Output_section): Initialize new
13708         fields.
13709         (Output_segment::Output_segment): Likewise.
13710         (Output_segment::add_output_section): Add assertion that large
13711         data sections always go in large data segments.  Force small data
13712         sections to the end of the list of data sections.  Force small BSS
13713         sections to the start of the list of BSS sections.  For large BSS
13714         sections to the end of the list of BSS sections.
13715         * symtab.h (class Symbol): Declare is_common_shndx.
13716         (Symbol::is_defined): Check Symbol::is_common_shndx.
13717         (Symbol::is_common): Likewise.
13718         (class Symbol_table): Define enum Commons_section_type.  Update
13719         declarations.  Add small_commons_ and large_commons_ fields.
13720         * symtab.cc (Symbol::is_common_shndx): New function.
13721         (Symbol_table::Symbol_table): Initialize new fields.
13722         (Symbol_table::add_from_object): Put small and large common
13723         symbols in the right list.
13724         (Symbol_table::sized_finalized_symbol): Check
13725         Symbol::is_common_shndx.
13726         (Symbol_table::sized_write_globals): Likewise.
13727         * common.cc (Symbol_table::do_allocate_commons): Allocate new
13728         common symbol lists.  Don't call do_allocate_commons_list if the
13729         list is empty.
13730         (Symbol_table::do_allocate_commons_list): Remove is_tls
13731         parameter.  Add comons_section_type parameter.  Change all
13732         callers.  Handle small and large common symbols.
13733         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
13734         Symbol::is_common_shndx.
13735         * resolve.cc (symbol_to_bits): Likewise.
13736         * target.h (Target::small_common_shndx): New function.
13737         (Target::small_common_section_flags): New function.
13738         (Target::large_common_shndx): New function.
13739         (Target::large_common_section_flags): New function.
13740         (Target::new_output_section): New function.
13741         (Target::Target_info): Add small_common_shndx, large_common_shndx,
13742         small_common_section_flags, and large_common_section_flags
13743         fields.
13744         (Target::do_new_output_section): New virtual function.
13745         * arm.cc (Target_arm::arm_info): Initialize new fields.
13746         * i386.cc (Target_i386::i386_info): Likewise.
13747         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
13748         Likewise.
13749         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
13750         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13751         (Target_x86_64::do_new_output_section): New function.
13752         * configure.ac: Define conditional MCMODEL_MEDIUM.
13753         * testsuite/Makefile.am (check_PROGRAMS): Add large.
13754         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
13755         (large_LDFLAGS): Define.
13756         * testsuite/large.c: New file.
13757         * testsuite/testfile.cc (Target_test::test_target_info):
13758         Initialize new fields.
13759         * configure, testsuite/Makefile.in: Rebuild.
13760
13761 2009-06-05  Doug Kwan  <dougkwan@google.com>
13762
13763         * Makefile.am (CCFILES): Add target.cc.
13764         * Makefile.in: Regenerate.
13765         * i386.cc (class Target_i386): Define new virtual method to
13766         override do_is_local_label_name in parent.
13767         * object.cc (Sized_relobj::do_count_local_symbols): Discard
13768         local symbols if --discard-locals or -X is given.
13769         * options.h (class General_options): Declare new options
13770         '--discard-locals' and '-X' for discarding locals.
13771         * target.h (class Target): Define new methods is_local_label_name.
13772         Declare new virtual method do_is_local_label_name.
13773         * target.cc: New file.
13774         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
13775         (check_SCRIPTS): Add discard_locals_test.sh.
13776         (check_DATA): Add discard_local_tests.syms.
13777         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
13778         (discard_local_tests.syms, discard_locals_test.o): New make rules.
13779         * testsuite/Makefile.in: Regenerate.
13780         * testsuite/discard_locals_test.c: New file.
13781         * testsuite/discard_locals_test.sh: Same.
13782
13783 2009-06-05  Doug Kwan  <dougkwan@google.com>
13784
13785         * object.cc (Sized_relobj::Sized_relobj): Initialize
13786         discarded_eh_frame_shndx_ to -1U.
13787         (Sized_relobj::do_layout): Record index of a discard .eh_frame
13788         section.
13789         (Sized_relobj::do_count_local_symbols): Skip local symbols in
13790         a discarded .eh_frame section.
13791         (Sized_relobj::do_finalize_local_symbols): Ditto.
13792         * object.h (class Sized_relobj): Declare new member
13793         discarded_eh_frame_shndx_.
13794         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
13795         (local_labels_test.o, local_labels_test): New rules.
13796         * testsuite/Makefile.in: Regenerate.
13797
13798 2009-06-04  Doug Kwan  <dougkwan@google.com>
13799
13800         * layout.cc (Layout::section_name_mapping): Add mapping for
13801         special ARM sections.
13802
13803 2009-06-03  Doug Kwan  <dougkwan@google.com>
13804
13805         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
13806         (utils::has_overflow): Same.
13807
13808 2009-06-03  Ian Lance Taylor  <iant@google.com>
13809
13810         * layout.cc (Layout::section_name_mapping): New array, replacing
13811         Layout::linkonce_mapping.
13812         (Layout::section_name_mapping_count): New variable, replacing
13813         Layout::linkonce_mapping_count.
13814         (Layout::linkonce_output_name): Remove.
13815         (Layout::output_section_name): Rewrite.
13816         * layout.h (class Layout): Rename Linkonce_mapping to
13817         Section_name_mapping, linkonce_mapping to section_name_mapping,
13818         linkonce_mapping_count to section_name_mapping_count.  Don't
13819         declare linkonce_output_name.
13820
13821 2009-06-03  Doug Kwan  <dougkwan@google.com>
13822
13823         * gold/arm.cc (namespace utils): New.
13824         (Target_arm::reloc_is_non_pic): Define new method.
13825         (class Arm_relocate_functions): New.
13826         (Target_arm::Relocate::relocate): Handle relocation types used by
13827         Android.
13828
13829 2009-06-03  Ian Lance Taylor  <iant@google.com>
13830
13831         * arm.cc (Target_arm::scan::global): Use || instead of |.
13832
13833 2009-06-02  Doug Kwan  <dougkwan@google.com>
13834
13835         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
13836         issued_non_pic_error_.
13837         (class Target_arm::Scan): Declare new method check_non_pic.
13838         Define new method symbol_needs_plt_entry.
13839         Declare new data member issued_non_pic_error_.
13840         (class Target_arm::Relocate): Declare new method
13841         should_apply_static_reloc.
13842         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
13843         (Target_arm::Scan::check_non_pic): Define new method.
13844         (Target_arm::Scan::local): Handle a small subset of reloc types used
13845         by Android.
13846         (Target_arm::Scan::local): Same.
13847         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
13848
13849 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
13850
13851         * incremental.cc (Incremental_inputs::report_command_line): Filter
13852         out --incremental-* options.
13853
13854 2009-05-29  Doug Kwan  <dougkwan@google.com>
13855
13856         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
13857         template class.
13858         (class Target_arm): Update comment.
13859         (Target_arm::Target_arm): Initialize new data members GOT_,
13860         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
13861         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
13862         and Target_arm::rel_dyn_section.
13863         Declare new_enum Target_arm::Got_type.
13864         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
13865         and DYNBSS_.
13866         Update commments for member do_dynsym_value.
13867         (Target_arm::got_size, Target_arm::plt_section,
13868         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
13869         new methods inside class defintion.
13870         (Target_arm::got_section): Define new method.
13871         (Target_arm::rel_dyn_section): Same.
13872         (Output_data_plt_arm): New template class.
13873         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
13874         (Output_data_plt_arm:do_adjust_output_section): Define new method.
13875         (Output_data_plt_arm::add_entry): Same.
13876         (Output_data_plt_arm::first_plt_entry): Define new
13877         static data member for PLT instruction template.
13878         (Output_data_plt_arm::plt_entry): Same.
13879         (Output_data_plt_arm::do_write): Define new method.
13880         (Target_arm::make_plt_entry): Same.
13881         (Target_arm::do_finalize_sections): Same.
13882         (Target_arm::do_dynsym_value): Same.
13883
13884 2009-05-28  Doug Kwan  <dougkwan@google.com>
13885
13886         * Makefile.am (TARGETSOURCES): Add arm.cc.
13887         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
13888         * Makefile.in: Regenerate.
13889         * arm.cc: New file.
13890         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
13891
13892 2009-05-26  Doug Kwan  <dougkwan@google.com>
13893
13894         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
13895         (General_options::check_excluded_libs): Strip off directories in
13896         archive name before matching like GNU ld does.
13897         * testsuite/Makefile.am (MOSTLYCLEANFILES,
13898         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
13899         (exclude_libs_test_LDFLAGS): Add linker option
13900         -Wl,--exclude-libs,libexclude_libs_test_3
13901         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
13902         an explicit archive without using -l.
13903         (alt/libexclude_libs_test_3.a): New make rule.
13904         * testsuite/Makefile.in: Regenerate.
13905         * testsuite/exclude_libs_test.c : Declare lib3_default().
13906         (main): Call it.
13907         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
13908         * exclude_libs_test_3.c: New file.
13909
13910 2009-05-26  Nick Clifton  <nickc@redhat.com>
13911
13912         * po/id.po: New Indonesian translation.
13913         * po/gold.pot: Updated template file.
13914
13915 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
13916
13917         * testsuite/Makefile.am: Add -ffunction-sections to compile
13918         gc_comdat_test files.  Add -Wl,--gc-sections to build
13919         gc_comdat_test.
13920         * testsuite/Makefile.in: Regenerate.
13921         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
13922
13923 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
13924
13925         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
13926         kept comdat section was garbage collected.
13927         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
13928         * testsuite/Makefile.in: Regenerate.
13929         * testsuite/gc_comdat_test.sh: New file.
13930         * testsuite/gc_comdat_test_1.cc: New file.
13931         * testsuite/gc_comdat_test_2.cc: New file.
13932
13933 2009-05-19  Doug Kwan  <dougkwan@google.com>
13934
13935         * archive.cc (Archive::Archive): Move constructor from archive.h
13936         to here.  Initialize no_export_.
13937         (Archive::get_elf_object_for_member): Set no_export flag of object.
13938         * archive.h (Archive::Archive): Move constructor body to
13939         archive.cc.
13940         (Archive::no_export): New method.
13941         (Archive::no_export_): New field.
13942         * object.h (Object::Object): Initialize no_export_ to false.
13943         (Object::no_export, Object::set_no_export): New methods.
13944         (Object::no_export_): New field.
13945         * options.cc (General_options::parse_exclude_libs): New method.
13946         (General_options::check_excluded_libs) Same.
13947         * options.h (exclude_libs): New option.
13948         (General_options::check_excluded_libs): New method declaration.
13949         (General_options::excluded_libs_): New field.
13950         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
13951         default or protected visibility if an object has no-export flag set.
13952         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
13953         (check_SCRIPTS): Add exclude_libs_test.sh.
13954         (check_DATA): Add exclude_libs_test.syms.
13955         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
13956         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
13957         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
13958         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
13959         (exclude_libs_test.syms, libexclude_libs_test_1.a,
13960         libexclude_libs_test_2.a): New rules.
13961         * testsuite/Makefile.in: Regenerate.
13962         * testsuite/exclude_libs_test.c: New file.
13963         * testsuite/exclude_libs_test.sh: Ditto.
13964         * testsuite/exclude_libs_test_1.c: Ditto.
13965         * testsuite/exclude_libs_test_2.c: Ditto.
13966
13967 2009-05-15  Ian Lance Taylor  <iant@google.com>
13968
13969         * configure.ac: Check for declarations for cases where libiberty.h
13970         checks HAVE_DECL_xxx.
13971         * configure, config.in: Rebuild.
13972
13973 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
13974
13975         * gold.h (Incremental_argument_list): Remove (invalid) forward
13976         declaration.
13977         * incremental.cc (Incremental_inputs::report_achive): New method.
13978         (Incremental_inputs::report_object): New method.
13979         (Incremental_inputs::report_script): New method.
13980         (Incremental_inputs::finalize_inputs): New method.
13981         (Incremental_inputs::finalize): Call finalize_inputs().
13982         (Incremental_inputs::sized_create_incremental_inputs_section_data):
13983         Create inputs entries.
13984         * incremental.h (Incremental_input_type): New enum.
13985         (Incremental_inputs::Incremental_input): Initialize new fields.
13986         (Incremental_inputs::report_inputs): New method.
13987         (Incremental_inputs::report_achive): New method.
13988         (Incremental_inputs::report_object): New method.
13989         (Incremental_inputs::report_script): New method.
13990         (Incremental_inputs::finalize_inputs): New method.
13991         (Incremental_inputs::Input_info): New struct.
13992         (Incremental_inputs::Input_info_map): New typedef.
13993         (Incremental_inputs::lock_): New field.
13994         (Incremental_inputs::Inputs_): New field.
13995         (Incremental_inputs::Inputs_map): New field.
13996         * main.cc (main): Call Incremental_input::report_inputs.
13997         * options.h (Input_argument_list): Typedef moved from
13998         Input_arguments.
13999         (Input_file_group::Files): Remove, use ::Input_argument_list.
14000         (Input_file_group::Input_argument_list): Remove, use
14001         ::Input_argument_list.
14002         * plugin.cc (Plugin_manager::add_input_file): Add error in
14003         incremental build.
14004         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
14005         functions.
14006         * script.cc (read_input_script): Call
14007         Incremental_input::report_script.
14008         * script.h (Script_info): New class.
14009
14010 2009-04-27  Ian Lance Taylor  <iant@google.com>
14011
14012         * x86_64.cc (do_adjust_output_section): Set entsize to
14013         plt_entry_size.
14014
14015 2009-04-23  Elliott Hughes  <enh@google.com>
14016
14017         * output.cc (Output_file::close): After short writes, continue
14018         writing from the correct offset in the buffer being written.
14019
14020 2009-04-23  Chris Demetriou  <cgd@google.com>
14021
14022         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
14023         * configure: Regenerate.
14024         * config.in: Regenerate.
14025         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
14026         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
14027
14028 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
14029
14030         * incremental.cc (Incremental_inputs_header_data): Renamed from
14031         Incremental_input_header_data.
14032         (Incremental_inputs_header_data::data_size): New field.
14033         (Incremental_inputs_header_data::put_input_file_count): Renamed
14034         from input_file_count.
14035         (Incremental_inputs_header_data::put_command_line_offset): Renamed
14036         from command_line_offset.
14037         (Incremental_inputs_header_data::put_reserved): Renamed from
14038         put_reserved.
14039         (Incremental_inputs_entry_data): Renamed from
14040         Incremental_input_entry_data.
14041         (Incremental_inputs_entry_data::data_size): New field.
14042         (Incremental_inputs::report_command_line): New method.
14043         (Incremental_inputs::finalize): New method.
14044         (Incremental_inputs::create_incremental_inputs_data): New method.
14045         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
14046         * incremental.h: New file.
14047         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
14048         (Layout::finalize): Create incremental inputs section in
14049         incremental builds.
14050         (Layout::create_incremental_info_sections): New method.
14051         * layout.h (Layout::incremental_inputs): New method.
14052         (Layout::create_incremental_info_sections): New method.
14053         (Layout::incremental_inputs_): New field.
14054         * main.cc (main): Notify Incremental_input of the command line.
14055
14056 2009-04-01  Ian Lance Taylor  <iant@google.com>
14057             Mikolaj Zalewski  <mikolajz@google.com>
14058
14059         * gold.h (reserve_unordered_map): Define, three versions, one for
14060         each version of Unordered_map.
14061         * layout.cc (Layout::Layout): Remove options parameter.  Add
14062         number_of_input_files parameter.  Don't initialize options_.
14063         Initialize number_of_input_files_ and resized_signatures_.  Move
14064         sections_are_attached_.
14065         (Layout::layout_group): Reserve space for group_signatures_.
14066         (Layout::find_or_add_kept_section): Change name parameter to be a
14067         reference.  Resize signatures_ map when it gets large enough.
14068         (Layout::layout_eh_frame): Use parameters->options() instead of
14069         this->options_.
14070         (Layout::make_output_section): Likewise.
14071         (Layout::attach_allocated_section_to_segment): Likewise.
14072         (Layout::finalize, Layout::create_executable_stack): Likewise.
14073         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
14074         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
14075         * layout.h (class Layout): Update declarations.  Remove options_
14076         field.  Add number_of_input_files_ and resized_signatures_
14077         fields.  Move sections_are_attached_ field.
14078         * main.cc (main): Pass number of input files to Layout
14079         constructor.  Don't pass options.
14080
14081 2009-03-30  Ian Lance Taylor  <iant@google.com>
14082
14083         * ffsll.c (ffsll): Correct implementation.
14084
14085 2009-03-27  Ian Lance Taylor  <iant@google.com>
14086
14087         * ffsll.c: New file.
14088         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
14089         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
14090         * ftruncate.c (ftruncate): Declare before definition.
14091         * mremap.c (mremap): Likewise.
14092         * pread.c (pread): Likewise.
14093         * configure, Makefile.in, config.in: Rebuild.
14094
14095         * mremap.c: New file.
14096         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
14097         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
14098         (mremap): Declare if HAVE_MREMAP is not defined.
14099         * configure, Makefile.in, config.in: Rebuild.
14100
14101 2009-03-27  Cary Coutant  <ccoutant@google.com>
14102
14103         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
14104         position independent.
14105         * sparc.cc (Target_sparc::check_non_pic): Likewise.
14106         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
14107
14108 2009-03-24  Cary Coutant  <ccoutant@google.com>
14109
14110         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
14111         an executable.
14112         (needs_dynamic_reloc): Likewise.
14113
14114 2009-03-24  Ian Lance Taylor  <iant@google.com>
14115
14116         * yyscript.y (file_cmd): Recognize EXTERN.
14117         (extern_name_list, extern_name_list_body): New nonterminals.
14118         * script.cc (script_add_extern): Define.
14119         * script-c.h (script_add_extern): Declare.
14120
14121 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
14122
14123         * object.cc (is_elf_object): Define.
14124         * object.h (is_elf_object): Declare.
14125         * archive.cc (Archive::get_elf_object_for_member): Call
14126         is_elf_object.
14127         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
14128
14129 2009-03-24  Elliott Hughes  <enh@google.com>
14130
14131         * output.cc (Output_file::map_anonymous): Define.
14132         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
14133         try an anonymous one.  Report the size if the mmap fails.
14134         * output.h (class Output_file): Declare map_anonymous.
14135
14136 2009-03-24  Ian Lance Taylor  <iant@google.com>
14137
14138         * target-select.cc (instantiate_target): Don't acquire the lock if
14139         the instantiated_target_ field has already been set.
14140
14141 2009-03-23  Ian Lance Taylor  <iant@google.com>
14142
14143         * gold-threads.h (class Initialize_lock): Define.
14144         * gold-threads.cc (class Initialize_lock_once): Define.
14145         (initialize_lock_control): New static variable.
14146         (initialize_lock_pointer): New static variable.
14147         (initialize_lock_once): New static function.
14148         (Initialize_lock::Initialize_lock): Define.
14149         (Initialize_lock::initialize): Define.
14150         * target-select.h: Include "gold-threads.h".
14151         (class Target_selector): Add lock_ and initialize_lock_ fields.
14152         Don't define instantiate_target, just declare it.
14153         * target-select.cc (Target_selector::Target_selector): Initialize
14154         new fields.
14155         (Target_selector::instantiate_target): Define.
14156         * descriptors.h: Include "gold-threads.h".
14157         (class Descriptors): Add initialize_lock_ field.
14158         * descriptors.cc (Descriptors::Descriptors): Initialize new
14159         field.
14160         (Descriptors::open): Use initialize_lock_ field
14161         * errors.h (class Errors): Add initialize_lock_ field.
14162         * errors.cc (Errors::Errors): Initialize new field.
14163         (Errors::initialize_lock): Use initialize_lock_ field.
14164         * powerpc.cc (class Target_selector_powerpc): Remove
14165         instantiated_target_ field.  In do_recognize call
14166         instantiate_target rather than do_instantiate_target.  In
14167         do_instantiate_target just allocate a new target.
14168         * sparc.cc (class Target_selector_sparc): Likewise.
14169
14170         * freebsd.h: New file.
14171         * i386.cc: Include "freebsd.h".
14172         (Target_i386): Derive from Target_freebsd rather than
14173         Sized_target.
14174         (Target_selector_i386): Derive from Target_selector_freebsd rather
14175         than Target_selector.
14176         * x86_64.cc: Include "freebsd.h".
14177         (Target_x86_64): Derive from Target_freebsd rather than
14178         Sized_target.
14179         (Target_selector_x86_64): Derive from Target_selector_freebsd
14180         rather than Target_selector.
14181         * target.h (class Target): Add adjust_elf_header and
14182         do_adjust_elf_header.
14183         * output.cc (Output_file_header:: do_sized_write): Call target
14184         adjust_elf_header routine.
14185         * configure.tgt: Set targ_osabi.
14186         * configure.ac: Define GOLD_DEFAULT_OSABI.
14187         * parameters.cc (Parameters::default_target): Pass
14188         GOLD_DEFAULT_OSABI to select_target.
14189         * target-select.h (class Target_selector): Make instantiate_target
14190         protected rather than private.
14191         * Makefile.am (HFILES): Add freebsd.h.
14192         * configure, Makefile.in, config.in: Rebuild.
14193
14194         * merge.cc (do_add_input_section): Correct pend value.  Change
14195         message about last entry not being null terminated from error to
14196         warning.
14197
14198 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
14199
14200         * incremental.cc: New file.
14201         * Makefile.am (CCFILES): Add incremental.cc.
14202         * Makefile.in: Rebuild.
14203
14204 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
14205
14206         * layout.cc (Layout::output_section_name): Preserve names
14207         of '.note.' sections.
14208
14209 2009-03-19  Ian Lance Taylor  <iant@google.com>
14210
14211         * descriptors.cc (Descriptors::open): Check that the options are
14212         valid before using them.
14213
14214 2009-03-18  Ian Lance Taylor  <iant@google.com>
14215
14216         * script-sections.h: Include <list>.
14217         (class Script_sections): Change Sections_elements from std::vector
14218         to std::list.  Typedef public Elements_iterator.  Add
14219         orphan_section_placement_, data_segment_align_start_, and
14220         saw_data_segment_align_ fields.  Remove data_segment_align_index_
14221         field.
14222         * script-sections.cc (class Orphan_section_placement): New class.
14223         (class Sections_element): Add virtual functions is_relro and
14224         orphan_section_init.  Remove virtual function place_orphan_here.
14225         (class Output_section_definition): Add is_relro and
14226         orphan_section_init.  Remove place_orphan_here.
14227         (class Orphan_output_section): Likewise.
14228         (Script_sections::Script_sections): Update for field changes.
14229         (Script_sections::data_segment_align): Set saw_data_segment_align_
14230         and data_segment_align_start_, not data_segment_align_index.
14231         (Script_sections::data_segment_relro_end): Check
14232         saw_data_segment_align_.  Use data_segment_align_start_ rather
14233         than data_segment_align_index_.
14234         (Script_sections::place_orphan): Rewrite to use
14235         Orphan_section_placement.
14236
14237 2009-03-17  Ian Lance Taylor  <iant@google.com>
14238
14239         * archive.cc (Archive::add_symbols): Check for a version attached
14240         to the symbol name in the archive map.
14241         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
14242         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
14243         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
14244         (ver_test_11.a): New target.
14245         * testsuite/Makefile.in: Rebuild.
14246
14247         * configure.ac: Check for chsize and posix_fallocate.  Replace
14248         ftruncate.
14249         * ftruncate.c: New file, from gnulib.
14250         * output.cc (posix_fallocate): Define dummy version if not
14251         HAVE_POSIX_FALLOCATE.
14252         (Output_file::map): Call posix_fallocate rather than lseek and
14253         write.
14254         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
14255         * configure, Makefile.in, config.in: Rebuild.
14256
14257 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
14258
14259         * layout.h (Layout::create_note): Add section_name parameter.
14260         * layout.cc (Layout::create_note): Likewise.
14261         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
14262
14263 2009-03-17  Ian Lance Taylor  <iant@google.com>
14264
14265         * descriptors.cc: Include "options.h".
14266         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
14267         (Descriptors::open): Always use O_CLOEXEC when opening a new
14268         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
14269         then set FD_CLOEXEC.
14270
14271         * sparc.cc (class Target_sparc): Add has_got_section.
14272         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
14273         make sure we have a GOT section.
14274
14275         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
14276         (Target_sparc::Scan::local): Likewise.
14277         (Target_sparc::Scan::global): Likewise.
14278         (Target_sparc::Relocate::relocate): Likewise.
14279         (Target_sparc::Relocate::relocate_tls): Likewise.
14280
14281         * symtab.cc (Symbol_table::define_default_version): New function,
14282         broken out of add_from_object.
14283         (Symbol_table::add_from_object): Call define_default_version.
14284         (Symbol_table::define_special_symbol): Add resolve_oldsym
14285         parameter.  Change all callers.  If the version for a symbol comes
14286         from a version script, resolve it with the symbol with the same
14287         name with no version.  Also add the symbol without a version if
14288         appropriate.
14289         (do_define_in_output_data): If resolving with oldsym, don't delete
14290         sym.
14291         (do_define_in_output_segment): Likewise.
14292         (do_define_as_constant): Likewise.
14293         * symtab.h (class Symbol_table): Update declarations.
14294
14295 2009-03-13  Ian Lance Taylor  <iant@google.com>
14296
14297         * readsyms.cc (Read_symbols::incompatible_warning): New function.
14298         (Read_symbols::requeue): New function.
14299         (Read_symbols::do_read_symbols): If make_elf_object fails because
14300         the target type is not configured, and the file was searched for,
14301         issue a warning and retry with the next directory.
14302         (Add_symbols::run): If the file has an incompatible format, and
14303         it was searched for, requeue the Read_symbols task.  On error,
14304         release the object.
14305         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
14306         dirindex parameter to constructor.  Change all callers.  Declare
14307         incompatible_warning and requeue.
14308         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
14309         input_argument_ and input_group_ fields.  Add them to
14310         constructor.  Change all callers.
14311         (class Read_script): Add dirindex_ field.  Add it to constructor.
14312         Change all callers.
14313         * archive.cc (Archive::setup): Remove input_objects parameter.
14314         Change all callers.
14315         (Archive::get_file_and_offset): Likewise.
14316         (Archive::read_all_symbols): Likewise.
14317         (Archive::read_symbols): Likewise.
14318         (Archive::get_elf_object_for_member): Remove input_objects
14319         parameter.  Add punconfigured parameter.  Change all callers.
14320         (Archive::add_symbols): Change return type to bool.  Check return
14321         value of include_member.
14322         (Archive::include_all_members): Likewise.
14323         (Archive::include_member): Change return type to bool.  Return
14324         false if first included object has incompatible target.  Set
14325         included_member_ field.
14326         (Add_archive_symbols::run): If add_symbols returns false, requeue
14327         Read_symbols task.
14328         * archive.h (class Archive): Add included_member_ field.
14329         Initialize it in constructor.  Add input_file and searched_for
14330         methods.  Update declarations.
14331         (class Add_archive_symbols): Add dirpath_, dirindex_, and
14332         input_argument_ fields.  Add them to constructor.  Change all
14333         callers.
14334         * script.cc: Include "target-select.h".
14335         (class Parser_closure): Add skip_on_incompatible_target_ and
14336         found_incompatible_target_ fields.  Add
14337         skip_on_incompatible_target parameter to constructor.  Change all
14338         callers.  Add methods skip_on_incompatible_target,
14339         clear_skip_on_incompatible_target, found_incompatible_target, and
14340         set_found_incompatible_target.
14341         (read_input_script): Add dirindex parameter.  Change all callers.
14342         If parser finds an incompatible target, requeue Read_symbols
14343         task.
14344         (script_set_symbol): Clear skip_on_incompatible_target in
14345         closure.
14346         (script_add_assertion, script_parse_option): Likewise.
14347         (script_start_sections, script_add_phdr): Likewise.
14348         (script_check_output_format): New function.
14349         * script.h (read_input_script): Update declaration.
14350         * script-c.h (script_check_output_format): Declare.
14351         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
14352         (ignore_cmd): Remove OUTPUT_FORMAT.
14353         * fileread.cc (Input_file::Input_file): Add explicit this.
14354         (Input_file::will_search_for): New function.
14355         (Input_file::open): Add pindex parameter.  Change all callers.
14356         * fileread.h (class Input_file): Add input_file_argument method.
14357         Declare will_search_for.  Update declarations.
14358         * object.cc (make_elf_object): Add punconfigured parameter.
14359         Change all callers.
14360         * object.h (class Object): Make input_file public.  Add
14361         searched_for method.
14362         (make_elf_object): Update declaration.
14363         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
14364         restart search.
14365         * dirsearch.h (class Dirsearch): Update declaration.
14366         * options.h (class General_options): Add --warn-search-mismatch.
14367         * parameters.cc (Parameters::is_compatible_target): New function.
14368         * parameters.h (class Parameters): Declare is_compatible_target.
14369         * workqueue.cc (Workqueue::add_blocker): New function.
14370         * workqueue.h (class Workqueue): Declare add_blocker.
14371
14372         * fileread.cc (Input_file::open): Remove options parameter.
14373         Change all callers.
14374         (Input_file::open_binary): Likewise.
14375         * script.cc (read_input_script): Likewise.
14376         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
14377         options parameter from constructor.  Change all callers.
14378         (class Read_script): Likewise.
14379         * fileread.h (class Input_file): Update declarations.
14380         * script.h (read_input_script): Update declaration.
14381
14382 2009-03-10  Nick Clifton  <nickc@redhat.com>
14383
14384         * po/es.po: New Spanish translation.
14385
14386 2009-03-06  Cary Coutant  <ccoutant@google.com>
14387
14388         * options.cc (parse_short_option): Keep dash_z from registering itself.
14389
14390 2009-03-03  Ian Lance Taylor  <iant@google.com>
14391
14392         PR 9918
14393         * target-reloc.h (relocate_section): Pass output_section to
14394         relocate.
14395         * i386.cc (Target_i386::should_apply_static_reloc): Add
14396         output_section parameter.  Change all callers.
14397         (Target_i386::Relocate::relocate): Add output_section parameter.
14398         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14399         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
14400         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
14401         * testsuite/two_file_shared.sh: New script.
14402         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
14403         (check_DATA): Add two_file_shared.dbg.
14404         (two_file_shared.dbg): New target.
14405         * testsuite/Makefile.in: Rebuild.
14406
14407 2009-03-01  Ian Lance Taylor  <iant@google.com>
14408
14409         * configure.ac: Check for byteswap.h.
14410         * configure: Rebuild.
14411         * config.in: Rebuild.
14412
14413 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
14414
14415         * layout.cc (Layout::find_or_add_kept_section): New function.
14416         (Layout::add_comdat): Removed.
14417         * layout.h (struct Kept_section): Move out of class Layout.
14418         Remove trailing underscores from field names.  Add group_sections
14419         field.  Rename group_ field to is_group.  Change all uses.
14420         (class Layout): Declare find_or_add_kept_section, not add_comdat.
14421         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
14422         comdat_groups_ field.
14423         (Sized_relobj::include_section_group): Use
14424         find_or_add_kept_section and Kept_section::group_sections.
14425         (Sized_relobj::include_linkonce_section): Likewise.
14426         * object.cc (class Sized_relobj): Don't define Comdat_group or
14427         Comdat_group_table.  Remove find_comdat_group and
14428         add_comdat_group.  Remove comdat_groups_ field.
14429         * plugin.cc (include_comdat_group): Use
14430         Layout::find_or_add_kept_section.
14431
14432 2009-02-28  Ian Lance Taylor  <iant@google.com>
14433
14434         * README: --gc-sections and map files are now supported.  Document
14435         some build requirements.
14436
14437         PR 6992
14438         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
14439         relocatable link set the value of the section symbol to zero.
14440         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
14441         relocatable link don't include the section address in the local
14442         symbol value.
14443
14444 2009-02-27  Ian Lance Taylor  <iant@google.com>
14445
14446         PR 6811
14447         * options.h (class Search_directory): Add is_system_directory.
14448         (class General_options): Declare is_in_system_directory.
14449         * options.cc (get_relative_sysroot): Make static.
14450         (get_default_sysroot): Make static.
14451         (General_optoins::is_in_system_directory): New function.
14452         * fileread.cc (Input_file::is_in_system_directory): New function.
14453         * fileread.h (class Input_file): Declare is_in_system_directory.
14454         * object.h (class Object): Add is_in_system_directory.
14455         (class Input_objects): Remove system_library_directory_ field.
14456         * object.cc (Input_objects::add_object): Don't set
14457         system_library_directory_.
14458         (input_objects::found_in_system_library_directory): Remove.
14459         * symtab.cc (Symbol_table::write_globals): Remove input_objects
14460         parameter.  Change all callers.
14461         (Symbol_table::sized_write_globals): Likewise.
14462         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
14463         Call Object::is_in_system_directory.
14464         * symtab.h (class Symbol_table): Update declarations.
14465
14466         PR 5990
14467         * descriptors.h (Open_descriptor): Add is_on_stack field.
14468         * descriptors.cc (Descriptors::open): If the descriptor is on the
14469         top of the stack, remove it.  Initialize is_on_stack field.
14470         (Descriptors::release): Only add pod to stack if it is not on the
14471         stack already.
14472         (Descriptors::close_some_descriptor): Clear stack_next and
14473         is_on_stack fields.
14474
14475         PR 7091
14476         * output.cc (Output_section::find_starting_output_address): Rename
14477         from starting_output_address; add PADDR parameter; change return
14478         type.
14479         * output.h (class Output_section): Declare
14480         find_starting_output_address instead of starting_output_address.
14481         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
14482         section symbol for which we can't find a merge section.
14483
14484         PR 9836
14485         * symtab.cc (Symbol_table::add_from_object): If the visibility is
14486         hidden or internal, force the symbol to be local.
14487         * resolve.cc (Symbol::override_visibility): Define.
14488         (Symbol::override_base): Use override_visibility.
14489         (Symbol_table::resolve): Likewise.
14490         (Symbol::override_base_with_special): Likewise.
14491         (Symbol_table::override_with_special): If the visibility is hidden
14492         or internal, force the symbol to be local.
14493         * symtab.h (class Symbol): Add set_visibility and
14494         override_visibility.
14495         * testsuite/ver_test_1.sh: New file.
14496         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
14497         (check_DATA): Add ver_test_1.syms.
14498         (ver_test_1.syms): New target.
14499         * testsuite/Makefile.in: Rebuild.
14500
14501 2009-02-25  Cary Coutant  <ccoutant@google.com>
14502
14503         * layout.cc (Layout::choose_output_section): Don't rename sections
14504         when using a linker script that has a SECTIONS clause.
14505         * Makefile.in: Regenerate.
14506
14507         * testsuite/Makefile.am (script_test_5.sh): New test case.
14508         * testsuite/Makefile.in: Regenerate.
14509         * testsuite/script_test_5.cc: New file.
14510         * testsuite/script_test_5.sh: New file.
14511         * testsuite/script_test_5.t: New file.
14512
14513 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
14514
14515         * archive.cc (Archive::include_member): Update calls to add_symbols.
14516         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
14517         the Layout argument.
14518         * dynobj.h (do_add_symbols): Add the Layout argument.
14519         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
14520         Layout argument.
14521         * object.h (Object::add_symbols): Add the Layout argument.
14522         (Object::do_add_symbols): Add the Layout argument.
14523         (Sized_relobj::do_add_symbols): Add the Layout argument.
14524         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
14525         Unify the two versions.
14526         (Add_plugin_symbols): Remove.
14527         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
14528         (Sized_pluginobj::do_add_symbols): Unify the two versions.
14529         (Add_plugin_symbols): Remove.
14530         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
14531         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
14532         (Add_symbols::run): Make it work with Pulginobj.
14533
14534 2009-02-06  Ian Lance Taylor  <iant@google.com>
14535
14536         * object.cc (Sized_relobj::do_layout): Make info message start
14537         with lower case letter.
14538
14539 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
14540
14541         * binary.cc: Fix file comment.
14542
14543         * options.h (enum Incremental_disposition): Define.
14544         (class General_options): Add new options: --incremental,
14545         --incremental_changed, --incremental_unchanged,
14546         --incremental_unknown.  Add incremental_disposition_ and
14547         implicit_incremental_ fields.
14548         (General_options::incremental_disposition): New function.
14549         (class Position_dependent_options): Add incremental_disposition
14550         option.
14551         (Position_dependent_options::copy_from_options): Set incremental
14552         dispositions.
14553         * options.cc (General_options::parse_incremental_changed): New
14554         function.
14555         (General_options::parse_incremental_unchanged): New function.
14556         (General_options::parse_incremental_unknown): New function.
14557         (General_options::General_options): Initialize new fields
14558         incremental_disposition_ and implicit_incremental_.
14559         (General_options::finalize): Check for uasge of --incremental-*
14560         without --incremental.
14561
14562 2009-02-06  Chris Demetriou  <cgd@google.com>
14563
14564         * gold.h (gold_undefined_symbol): Change to take only a Symbol
14565         pointer and to report location as the file name associated with
14566         the symbol.
14567         (gold_undefined_symbol_at_location): New function to replace the
14568         old gold_undefined_symbol functionality.
14569         * target-reloc.h (relocate_section): Update to use
14570         gold_undefined_symbol_at_location.
14571         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14572         Call gold_undefined_symbol function rather than gold_error.
14573         * errors.h (Errors::undefined_symbol): Take location as a
14574         string, rather than calculating it from a relocation.
14575         * errors.cc (Errors::fatal): Print "fatal error:" before the
14576         formatted message.
14577         (Errors::error, Errors::error_at_location): Print "error: "
14578         before the formatted message.
14579         (Errors::undefined_symbol): Take location as a string, rather
14580         than calculating it from a relocation.
14581         (gold_undefined_symbol_at_location): New function akin to
14582         old gold_undefined_symbol, calculates location from relocation.
14583         (gold_undefined_symbol): Change to take only a Symbol pointer
14584         and to report location as the file name associated with the symbol.
14585         * testsuite/debug_msg.sh: Update for changed error messages.
14586         * testsuite/undef_symbol.sh: Likewise.
14587
14588 2009-02-04  Duncan Sands  <baldrick@free.fr>
14589
14590         PR 9812
14591         * reduced_debug_output.h
14592         (Output_reduced_debug_abbrev_section::failed): Use format for
14593         gold_warning.
14594         (Output_reduced_debug_info_section::faild): Likewise.
14595
14596 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
14597
14598         * script.cc (Lazy_demangler): New class.
14599         (Version_script_info::get_symbol_version_helper): Demangle a
14600         symbol only once.
14601
14602 2009-01-29  Cary Coutant  <ccoutant@google.com>
14603
14604         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
14605         to __tls_get_addr.
14606         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14607
14608 2009-01-28  Ian Lance Taylor  <iant@google.com>
14609
14610         * version.cc (version_string): Bump to 1.9.
14611
14612         * gold.h: Include <cstring> and <stdint.h>.
14613         * version.cc: Include <cstdio>.
14614         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
14615         warning.
14616         * reduced_debug_output.cc (insert_into_vector): Rename from
14617         Insert_into_vector; change all callers.  Use Swap_unaligned to
14618         avoid aliasing issue; remove union since it is unnecessary.
14619
14620 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
14621
14622         * Makefile.am (CCFILES): Add gc.cc.
14623         (HFILES): Add gc.h.
14624         * Makefile.in: Regenerate.
14625         * gold.cc (Gc_runner): New class.
14626         (queue_initial_tasks): Call garbage collection related tasks
14627         when corresponding options are invoked.
14628         (queue_middle_gc_tasks): New function.
14629         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
14630         processed early before laying out sections during garbage collection.
14631         * gold.h (queue_middle_gc_tasks): New function.
14632         (is_prefix_of): Move from "layout.cc".
14633         * i386.cc (Target_i386::gc_process_relocs): New function.
14634         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
14635         * main.cc (main): Create object of class "Garbage_collection".
14636         * object.cc (Relobj::copy_symbols_data): New function.
14637         (Relobj::is_section_name_included): New function.
14638         (Sized_relobj::do_layout): Allow this function to be called twice
14639         during garbage collection and defer layout of section during the
14640         first call.
14641         * object.h (Relobj::get_symbols_data): New function.
14642         (Relobj::is_section_name_included): New function.
14643         (Relobj::copy_symbols_data): New function.
14644         (Relobj::set_symbols_data): New function.
14645         (Relobj::get_relocs_data): New function.
14646         (Relobj::set_relocs_data): New function.
14647         (Relobj::is_output_section_offset_invalid): New pure virtual function.
14648         (Relobj::gc_process_relocs): New function.
14649         (Relobj::do_gc_process_relocs): New pure virtual function.
14650         (Relobj::sd_): New data member.
14651         (Sized_relobj::is_output_section_offset_invalid): New function.
14652         (Sized_relobj::do_gc_process_relocs): New function.
14653         * options.h (General_options::gc_sections): Modify to not be a no-op.
14654         (General_options::print_gc_sections): New option.
14655         * plugin.cc (Plugin_finish::run): Remove function call to
14656         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
14657         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
14658         * reloc.cc (Read_relocs::run): Add task to process relocs and
14659         determine unreferenced sections when doing garbage collection.
14660         (Gc_process_relocs): New class.
14661         (Sized_relobj::do_gc_process_relocs): New function.
14662         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
14663         sections that are garbage collected.
14664         * reloc.h (Gc_process_relocs): New class.
14665         * sparc.cc (Target_sparc::gc_process_relocs): New function.
14666         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
14667         symbols whose corresponding sections are garbage collected.
14668         (Symbol_table::Symbol_table): Add new parameter for the garbage
14669         collection object.
14670         (Symbol_table::gc_mark_undef_symbols): New function.
14671         (Symbol_table::gc_mark_symbol_for_shlib): New function.
14672         (Symbol_table::gc_mark_dyn_syms): New function.
14673         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
14674         as garbage.
14675         (Symbol_table::add_from_object): Likewise.
14676         (Symbol_table::add_from_relobj): When building shared objects, do not
14677         treat externally visible symbols as garbage.
14678         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
14679         table information for static and relocatable links.
14680         * symtab.h (Symbol_table::set_gc): New function.
14681         (Symbol_table::gc): New function.
14682         (Symbol_table::gc_mark_undef_symbols): New function.
14683         (Symbol_table::gc_mark_symbol_for_shlib): New function.
14684         (Symbol_table::gc_mark_dyn_syms): New function.
14685         (Symbol_table::gc_): New data member.
14686         * target.h (Sized_target::gc_process_relocs): New pure virtual
14687         function.
14688         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
14689         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
14690
14691 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
14692
14693         * options.h (General_options::gc_sections): Define as a no-op for now.
14694         (General_options::no_keep_memory): Ditto.
14695         (General_options::Bshareable): Define.
14696         * options.cc (General_options::finalize): Honor -Bshareable.
14697
14698 2009-01-20  Andreas Schwab  <schwab@suse.de>
14699
14700         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
14701         read the value in the contents, since we don't use it.  Use the
14702         template endianness when writing.
14703         (Relocate::relocate): Use it for R_PPC_REL16_HA.
14704
14705 2009-01-19  Andreas Schwab  <schwab@suse.de>
14706
14707         * configure.tgt (powerpc64-*): Fix targ_obj.
14708
14709 2009-01-15  Ian Lance Taylor  <iant@google.com>
14710
14711         * object.cc (Sized_relobj::write_local_symbols): Don't write out
14712         local symbols when stripping all symbols.
14713
14714 2009-01-14  Cary Coutant  <ccoutant@google.com>
14715
14716         * output.cc (Output_reloc): Add explicit instantiations.
14717
14718 2009-01-14  Cary Coutant  <ccoutant@google.com>
14719
14720         * archive.cc (Archive::get_elf_object_for_member): Remove call
14721         to File_read::claim_for_plugin.
14722         * descriptors.cc (Descriptors::open): Remove reference to
14723         is_claimed.
14724         (Descriptors::claim_for_plugin): Remove.
14725         * descriptors.h (Descriptors::claim_for_plugin): Remove.
14726         (Descriptors::is_claimed): Remove.
14727         (claim_descriptor_for_plugin): Remove.
14728         * fileread.cc (File_read::claim_for_plugin): Remove.
14729         * fileread.h (File_read::claim_for_plugin): Remove.
14730         (File_read::descriptor): Reopen descriptor if necessary.
14731         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
14732         (Plugin_manager::all_symbols_read): Add task parameter. Change
14733         all callers.
14734         (Plugin_manager::get_input_file): New function.
14735         (Plugin_manager::release_input_file): New function.
14736         (Pluginobj::Pluginobj): Add filesize parameter and initialize
14737         corresponding data member.
14738         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
14739         and pass to base constructor. Change all callers.
14740         (get_input_file, release_input_file): New functions.
14741         (make_sized_plugin_object): Add filesize parameter. Change all callers.
14742         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
14743         (Plugin_manager::all_symbols_read): Add task parameter.
14744         (Plugin_manager::get_input_file): New function.
14745         (Plugin_manager::release_input_file): New function.
14746         (Plugin_manager::task_): New data member.
14747         (Pluginobj::Pluginobj): Add filesize parameter.
14748         (Pluginobj::filename): New function.
14749         (Pluginobj::descriptor): New function.
14750         (Pluginobj::filesize): New function.
14751         (Pluginobj::filesize_): New data member.
14752         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
14753         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
14754         File_read::claim_for_plugin; use Object::unlock to unlock the file.
14755
14756         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
14757         with archive libraries.
14758         * testsuite/Makefile.in: Regenerate.
14759         * testsuite/plugin_test.c (struct sym_info): New type.
14760         (get_input_file, release_input_file): New static variables.
14761         (onload): Capture new transfer vector entries.
14762         (claim_file_hook): Stop reading at end of file according to filesize.
14763         Factor out parsing of readelf output into separate function.
14764         (all_symbols_read_hook): Exercise get_input_file and release_input_file
14765         APIs and get the source file name from the symbol table.  Convert
14766         source file name to corresponding object file name.  Print info
14767         message when adding new input files.
14768         (parse_readelf_line): New function.
14769         * testsuite/plugin_test_1.sh: Add checks for new info messages.
14770         * testsuite/plugin_test_2.sh: Likewise.
14771         * testsuite/plugin_test_3.sh: Likewise.
14772         * testsuite/plugin_test_4.sh: New test case.
14773
14774 2009-01-07  Ian Lance Taylor  <iant@google.com>
14775
14776         * version.cc (version_string): Bump to 1.8.
14777
14778 2008-12-23  Cary Coutant  <ccoutant@google.com>
14779
14780         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
14781         * plugin.cc (Plugin_manager::finish): Rename as
14782         layout_deferred_objects.  Move cleanup to separate function.
14783         (Plugin_manager::cleanup): New function.
14784         (Plugin_finish::run): Call layout_deferred_objects and cleanup
14785         separately.
14786         * plugin.h (Plugin_manager::finish): Rename as
14787         layout_deferred_objects.
14788         (Plugin_manager::cleanup): New function.
14789         (Plugin_manager::cleanup_done): New field.
14790
14791 2008-12-23  Cary Coutant  <ccoutant@google.com>
14792
14793         * plugin.cc (is_visible_from_outside): New function.
14794         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
14795         so we don't return "IR only" status for exported symbols or -r links.
14796
14797         * testsuite/Makefile.am (plugin_test_3): New test case.
14798         * testsuite/Makefile.in: Regenerate.
14799         * testsuite/plugin_test_3.sh: New file.
14800
14801 2008-12-22  Cary Coutant  <ccoutant@google.com>
14802
14803         * object.cc (Sized_relobj::layout_section): New function.
14804         (Sized_relobj::do_layout): Defer layout of input sections until after
14805         plugin has provided replacement files.
14806         (Sized_relobj::do_layout_deferred_sections): New function.
14807         * object.h (Relobj::set_section_offset): Remove virtual keyword.
14808         (Relobj::layout_deferred_sections): New function.
14809         (Relobj::do_layout_deferred_sections): New function.
14810         (Sized_relobj::do_layout_deferred_sections): New function.
14811         (Sized_relobj::layout_section): New function.
14812         (Sized_relobj::Deferred_layout): New structure.
14813         (Sized_relobj::deferred_layout_): New field.
14814         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
14815         Change all callers.  Layout deferred sections.
14816         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
14817         references.
14818         (Plugin_hook::run): Move code from do_plugin_hook inline.
14819         (Plugin_hook::do_plugin_hook): Remove.
14820         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
14821         (Plugin_manager::finish): Renamed, was cleanup.
14822         (Plugin_manager::should_defer_layout): New function.
14823         (Plugin_manager::add_deferred_layout_object): New function.
14824         (Plugin_manager::Deferred_layout_list): New type.
14825         (Plugin_manager::deferred_layout_objects_): New field.
14826         (Plugin_hook::do_plugin_hook): Remove.
14827
14828 2008-12-17  Ian Lance Taylor  <iant@google.com>
14829
14830         * options.h (class General_options): Add --no case for
14831         --export-dynamic.
14832
14833 2008-12-16  Cary Coutant  <ccoutant@google.com>
14834
14835         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
14836         vector.
14837         (Plugin_manager::claim_file): Create plugin object even if
14838         plugin did not call the add_symbols callback.
14839         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
14840         asking for more symbols than were added.
14841         * testsuite/Makefile.am (plugin_test_1): Add test case with
14842         no global symbols.
14843         (empty.syms): New target.
14844         * testsuite/Makefile.in: Regenerate.
14845         * testsuite/plugin_test.c (claim_file_hook): Add new debug
14846         message. Don't call add_symbols if no globals.
14847         (all_symbols_read_hook): Don't provide replacement for empty
14848         claimed file.
14849
14850 2008-12-12  Ian Lance Taylor  <iant@google.com>
14851
14852         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
14853         r_type == 0 for a local symbol with r_sym == 0.
14854         (scan_relocatable_relocs): Pass r_sym to
14855         local_non_section_strategy.
14856         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
14857         r_sym parameter.
14858
14859         * configure.ac: Update test for TLS descriptors: they are
14860         supported as of glibc 2.9.
14861         * configure: Rebuild.
14862
14863 2008-12-11  Ian Lance Taylor  <iant@google.com>
14864
14865         PR 7091
14866         * target-reloc.h (Default_scan_relocatable_relocs): For each
14867         function, map r_type == 0 to RELOC_DISCARD.
14868
14869 2008-12-10  Cary Coutant  <ccoutant@google.com>
14870
14871         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
14872         object to override a kept COMDAT group from a plugin object.
14873
14874 2008-12-09  Ian Lance Taylor  <iant@google.com>
14875
14876         PR 7088
14877         * yyscript.y (file_cmd): Handle INPUT.
14878
14879         * testsuite/initpri1.c: Change all declarations to be full
14880         prototypes by adding void, to avoid compiler warnings.
14881
14882 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
14883
14884         * options.cc (General_options::parse_plugin_opt): New.
14885         (General_options::add_plugin): The argument now is just the filename.
14886         (General_options::add_plugin_option): New.
14887         * options.h (plugin_opt): New.
14888         (add_plugin): Change argument name.
14889         (add_plugin_option): New.
14890         * plugin.cc (Plugin::load): Don't parse the plugin option.
14891         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
14892         (Plugin::add_option): New.
14893         (Plugin::args_): Change type.
14894         (Plugin::filename_): New.
14895         (Plugin_manager::add_plugin_option): New.
14896         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
14897         * testsuite/Makefile.in: Regenerate.
14898
14899 2008-12-05  Cary Coutant  <ccoutant@google.com>
14900
14901         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
14902         Handle --strip-lto-sections option.
14903         * options.h (strip_lto_sections): New option.
14904
14905 2008-12-01  Cary Coutant  <ccoutant@google.com>
14906
14907         * plugin.cc (ld_plugin_message): Change format parameter to const.
14908         Fix mismatch between new[] and delete.
14909
14910 2008-11-14  Cary Coutant  <ccoutant@google.com>
14911
14912         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
14913         instead of -1U.
14914
14915 2008-11-05  Craig Silverstein  <csilvers@google.com>
14916
14917         * options.cc (General_options::parse_dynamic_list): New function.
14918         * options.h (General_options): New flags dynamic_list,
14919         dynamic_list_data, dynamic_list_cpp_new, and
14920         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
14921         (General_options::in_dynamic_list): New function.
14922         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
14923         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
14924         (Lex::can_continue_name): Likewise.
14925         (yylex): Likewise.
14926         (read_script_file): New parameter script_options.
14927         (read_dynamic_list): New function.
14928         (Script_options::define_dynamic_list): New function.
14929         (dynamic_list_keyword_parsecodes): New variable.
14930         (dynamic_list_keywords): New variable.
14931         * script.h (Script_options::define_dynamic_list): New function
14932         prototype.
14933         (read_dynamic_list): New function prototype.
14934         * symtab.cc (strprefix): New macro.
14935         (Symbol::should_add_dynsym_entry): Support dynamic_list,
14936         dynamic_list_data, dynamic_list_cpp_new, and
14937         dynamic_list_cpp_typeinfo.
14938         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
14939         (dynamic_list_expr): New rule.
14940         (dynamic_list_nodes): Likewise.
14941         (dynamic_list_node): Likewise.
14942         * testsuite/Makefile.am (dynamic_list): New test.
14943         * testsuite/Makefile.in: Regenerated.
14944         * testsuite/dynamic_list.t: New file.
14945         * testsuite/dynamic_list.sh: New file.
14946
14947 2008-11-05  Craig Silverstein  <csilvers@google.com>
14948
14949         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
14950         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
14951         (t11_last): Likewise.
14952         * testsuite/ver_test_6.c (main): Likewise.
14953
14954 2008-10-07  Cary Coutant  <ccoutant@google.com>
14955
14956         * options.c (General_options::finalize): Add check for -static and
14957         -shared.
14958         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
14959         is not empty.
14960
14961 2008-10-02  Cary Coutant  <ccoutant@google.com>
14962
14963         * plugin.cc (make_sized_plugin_object): Fix conditional
14964         compilation to work when not all targets are enabled.
14965
14966 2008-09-29  Cary Coutant  <ccoutant@google.com>
14967
14968         * archive.cc (Archive::get_file_and_offset): Use filename instead
14969         of name to get library path.
14970         (Archive::include_member): Unlock external member of a thin archive.
14971
14972         * testsuite/Makefile.am (TEST_AR): New variable.
14973         (thin_archive_test_1): New test.
14974         (thin_archive_test_2): New test.
14975         * testsuite/Makefile.in: Regenerate.
14976         * testsuite/thin_archive_main.cc: New file.
14977         * testsuite/thin_archive_test_1.cc: New file.
14978         * testsuite/thin_archive_test_2.cc: New file.
14979         * testsuite/thin_archive_test_3.cc: New file.
14980         * testsuite/thin_archive_test_4.cc: New file.
14981
14982 2008-09-29  Cary Coutant  <ccoutant@google.com>
14983
14984         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
14985         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
14986         instead of -1U.
14987         (Sized_relobj::do_finalize_local_symbols): Likewise.
14988         (Sized_relobj::map_to_kept_section): Likewise.
14989         * object.h (Sized_relobj::invalid_address): New constant.
14990         (Sized_relobj::do_output_section_offset): Check for invalid_address
14991         and return -1ULL.
14992         * output.cc (Output_reloc::local_section_offset): Use constant
14993         invalid_address instead of -1U.
14994         (Output_reloc::get_address): Likewise.
14995         (Output_section::output_address): Change -1U to -1ULL.
14996         * output.h (Output_reloc::invalid_address): New constant.
14997         * reloc.cc (Sized_relobj::write_sections): Use constant
14998         invalid_address instead of -1U.
14999         (Sized_relobj::relocate_sections): Likewise.
15000         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
15001         values for merge sections.
15002         * target-reloc.h (relocate_for_relocatable): Use constant
15003         invalid_address instead of -1U.
15004
15005 2008-09-19  Cary Coutant  <ccoutant@google.com>
15006
15007         Add plugin functionality for link-time optimization (LTO).
15008         * configure.ac (plugins): Add --enable-plugins option.
15009         * configure: Regenerate.
15010         * config.in: Regenerate.
15011         * Makefile.am (LIBDL): New variable.
15012         (CCFILES): Add plugin.cc.
15013         (HFILES): Add plugin.h.
15014         (ldadd_var): Add LIBDL.
15015         * Makefile.in: Regenerate.
15016
15017         * archive.cc: Include "plugin.h".
15018         (Archive::setup): Don't preread archive symbols when using a plugin.
15019         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
15020         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
15021         files.
15022         (Archive::include_member): Add symbols from plugin objects.
15023         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
15024         * descriptors.cc (Descriptors::open): Check for file descriptors
15025         abandoned by plugins.
15026         (Descriptors::claim_for_plugin): New function.
15027         * descriptors.h (Descriptors::claim_for_plugin): New function.
15028         (Open_descriptor::is_claimed): New field.
15029         (claim_descriptor_for_plugin): New function.
15030         * fileread.cc (File_read::claim_for_plugin): New function.
15031         * fileread.h (File_read::claim_for_plugin): New function.
15032         (File_read::descriptor): New function.
15033         * gold.cc: Include "plugin.h".
15034         (queue_initial_tasks): Add task to call plugin hooks for generating
15035         new object files.
15036         * main.cc: Include "plugin.h".
15037         (main): Load plugin libraries.
15038         * object.h (Pluginobj): Declare.
15039         (Object::pluginobj): New function.
15040         (Object::do_pluginobj): New function.
15041         (Object::set_target): New function.
15042         * options.cc: Include "plugin.h".
15043         (General_options::parse_plugin): New function.
15044         (General_options::General_options): Initialize plugins_ field.
15045         (General_options::add_plugin): New function.
15046         * options.h (Plugin_manager): Declare.
15047         (General_options): Add --plugin option.
15048         (General_options::has_plugins): New function.
15049         (General_options::plugins): New function.
15050         (General_options::add_plugin): New function.
15051         (General_options::plugins_): New field.
15052         * plugin.cc: New file.
15053         * plugin.h: New file.
15054         * readsyms.cc: Include "plugin.h".
15055         (Read_symbols::do_read_symbols): Check for archive before checking
15056         for ELF file.  Call plugin hooks to claim files.
15057         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
15058         from a real object file; force override when processing replacement
15059         files.
15060         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
15061         (Symbol::init_base_object): Likewise.
15062         (Symbol::init_base_output_data): Likewise.
15063         (Symbol::init_base_output_segment): Likewise.
15064         (Symbol::init_base_constant): Likewise.
15065         (Symbol::init_base_undefined): Likewise.
15066         (Symbol::output_section): Assert that object is not a plugin.
15067         (Symbol_table::add_from_pluginobj): New function.
15068         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
15069         undefined.
15070         (Symbol_table::sized_write_globals): Likewise.
15071         (Symbol_table::add_from_pluginobj): Instantiate template.
15072         * symtab.h (Sized_pluginobj): Declare.
15073         (Symbol::in_real_elf): New function.
15074         (Symbol::set_in_real_elf): New function.
15075         (Symbol::in_real_elf_): New field.
15076         (Symbol_table::add_from_pluginobj): New function.
15077
15078         * testsuite/Makefile.am (AM_CFLAGS): New variable.
15079         (LIBDL): New variable.
15080         (LDADD): Add LIBDL.
15081         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
15082         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
15083         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
15084         (MOSTLYCLEANFILES): Likewise.
15085         * testsuite/Makefile.in: Regenerate.
15086         * testsuite/plugin_test.c: New file.
15087         * testsuite/plugin_test_1.sh: New file.
15088         * testsuite/plugin_test_2.sh: New file.
15089
15090 2008-09-16  Ian Lance Taylor  <iant@google.com>
15091
15092         * target-reloc.h (relocate_section): Check whether a symbol is
15093         defined by the ABI before reporting an undefined symbol error.
15094         * target.h (Target::is_defined_by_abi): Make parameter const.
15095         (Target::do_is_defined_by_abi): Likewise.
15096         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
15097         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
15098         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
15099         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
15100         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
15101         * testsuite/Makefile.in: Rebuild.
15102
15103         * fileread.cc (make_view): Add casts to avoid warning.
15104
15105 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15106
15107         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
15108         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15109
15110 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15111
15112         * options.h (General_options::output_is_executable): New.
15113         (General_options::output_is_pie): New.
15114         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
15115         for shared libraries.
15116         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15117
15118 2008-09-11  Chris Demetriou  <cgd@google.com>
15119
15120         * options.h (origin): New -z option.
15121         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
15122         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
15123         in DT_FLAGS_1.
15124
15125 2008-09-05  Cary Coutant  <ccoutant@google.com>
15126
15127         * fileread.cc (File_read::make_view): Add check for attempt to map
15128         beyond end of file.
15129
15130 2008-09-05  Cary Coutant  <ccoutant@google.com>
15131
15132         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
15133         explicit instantiations.
15134
15135 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
15136
15137         PR gold/6858
15138         * options.cc (General_options::finalize): Allow undefined symbols
15139         in shlibs if linking -shared.
15140
15141         PR gold/6859
15142         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
15143         symbols as not needing a dynsym entry.
15144
15145 2008-08-20  Craig Silverstein  <csilvers@google.com>
15146
15147         * fileread.cc (File_read::open): Do not lock the file unless it
15148         was successfully opened.
15149
15150 2008-08-14  Cary Coutant  <ccoutant@google.com>
15151
15152         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
15153         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
15154         * testsuite/tls_test.cc (struct int128): 128-bit struct
15155         for testing TLS relocs with non-zero addend.
15156         (v12): New TLS variable.
15157         (t12): New test.
15158         (t_last): Add check for v12.
15159         * testsuite/tls_test.h (t12): New function.
15160         * testsuite/tls_test_main.cc (thread_routine): Call new test.
15161
15162 2008-08-13  Ian Lance Taylor  <iant@google.com>
15163
15164         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
15165         set tls_segment_ or relro_segment_.
15166         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
15167         when appropriate.
15168         * output.h (Output_section::clear_is_relro): New function.
15169         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
15170         sections specially even when output_data_ is empty.
15171         (Output_segment::maximum_alignment): When first section is relro,
15172         only force alignment for PT_LOAD segments.
15173         * script.cc (script_data_segment_align): New function.
15174         (script_data_segment_relro_end): New function.
15175         * script-c.h (script_data_segment_align): Declare.
15176         (script_data_segment_relro_end): Declare.
15177         * script-sections.h (class Script_sections): Declare
15178         data_segment_align and data_segment_relro_end.  Add fields
15179         segment_align_index_ and saw_relro_end_.
15180         * script-sections.cc (class Sections_element): Add set_is_relro
15181         virtual function.  Add new bool* parameter to place_orphan_here.
15182         Add get_output_section virtual function.
15183         (class Output_section_definition): Add set_is_relro.  Add new
15184         bool* parameter to place_orphan_here.  Add get_output_section.
15185         Add is_relro_ field.
15186         (Output_section_definition::Output_section_definition): Initialize
15187         evaluated_address_, evaluated_load_address, evaluated_addralign_,
15188         and is_relro_ fields.
15189         (Output_section_definition::place_orphan_here): Add is_relro
15190         parameter.
15191         (Output_section_definition::set_section_addresses): Set relro for
15192         output section.
15193         (Output_section_definition::alternate_constraint): Likewise.
15194         (class Orphan_output_section): Add new bool* parameter to
15195         place_orphan_here.  Add get_output_section.
15196         (Orphan_output_section::place_orphan_here): Add is_relro
15197         parameter.
15198         (Script_sections::Script_sections): Initialize
15199         data_segment_align_index_ and saw_relro_end_.
15200         (Script_sections::data_segment_align): New function.
15201         (Script_sections::data_segment_relro_end): New function.
15202         (Script_sections::place_orphan): Set or clear is_relro.
15203         (Script_sections::set_section_addresses): Force alignment of first
15204         TLS section.
15205         * yyscript.y (exp): Call script_data_segment_align and
15206         script_data_segment_relro_end.
15207         * testsuite/relro_script_test.t: New file.
15208         * testsuite/relro_test.cc (using_script): Declare.
15209         (t1, t2): Test using_script.
15210         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
15211         (relro_script_test_SOURCES): Define.
15212         (relro_script_test_DEPENDENCIES): Define.
15213         (relro_script_test_LDFLAGS): Define.
15214         (relro_script_test_LDADD): Define.
15215         (relro_script_test.so): New target.
15216         * testsuite/Makefile.in: Rebuild.
15217
15218 2008-08-06  Cary Coutant <ccoutant@google.com>
15219
15220         * archive.cc (Archive::total_archives, Archive::total_members)
15221         (Archive::total_members_loaded): New variables.
15222         (Archive::setup): Add parameter.  Add option to preread
15223         archive symbols.
15224         (Archive::read_armap): Add counter.
15225         (Archive::get_file_and_offset): New function.
15226         (Archive::get_elf_object_for_member): New function.
15227         (Archive::read_all_symbols): New function.
15228         (Archive::read_symbols): New function.
15229         (Archive::add_symbols): Add counters.
15230         (Archive::include_all_members): Use armap to find members if it's
15231         already built.
15232         (Archive::include_member): Skip reading symbols if already read.
15233         Factored code into Archive::get_file_and_offset and
15234         Archive::get_elf_object_for_member.  Changed call to
15235         Mapfile::report_include_archive_member.
15236         (Archive::print_stats): New function.
15237         * archive.h: Declare Object and Read_symbols_data classes.
15238         (Archive::Archive): Add initializers for new members.
15239         (Archive::setup): Add parameter.
15240         (Archive::print_stats): New function.
15241         (Archive::total_archives, Archive::total_members)
15242         (Archive::total_members_loaded): New variables.
15243         (Archive::get_file_and_offset): New function.
15244         (Archive::get_elf_object_for_member): New function.
15245         (Archive::read_all_symbols): New function.
15246         (Archive::read_symbols): New function.
15247         (Archive::Archive_member): New class.
15248         (Archive::members_): New member.
15249         (Archive::num_members_): New member.
15250         * main.cc: Include archive.h.
15251         (main): Call Archive::print_stats.
15252         * mapfile.cc (Mapfile::report_include_archive_member): Delete
15253         archive parameter; member_name is now the fully-decorated name.
15254         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
15255         * options.h: (General_options): Add --preread-archive-symbols option.
15256         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
15257         Archive::setup.
15258
15259 2008-08-04  Ian Lance Taylor  <iant@google.com>
15260
15261         * symtab.h (Symbol::use_plt_offset): New function.
15262         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
15263         * powerpc.cc (Relocate::relocate): Likewise.
15264         * sparc.cc (Relocate::relocate): Likewise.
15265         * x86_64.cc (Relocate::relocate): Likewise.
15266         * testsuite/weak_plt.sh: New test.
15267         * testsuite/weak_plt_main.cc: New test.
15268         * testsuite/weak_plt_shared.cc: New test.
15269         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
15270         (check_PROGRAMS): Add weak_plt.
15271         (check_DATA): Add weak_plt_shared.so.
15272         (weak_plt_main_pic.o, weak_plt): New targets.
15273         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
15274         * testsuite/Makefile.in: Rebuild.
15275
15276         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
15277         gcctestdir/ld.
15278         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
15279         * testsuite/Makefile.in: Rebuild.
15280
15281 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
15282
15283         * Makefile.am (POTFILES.in): Set LC_ALL=C.
15284         * Makefile.in: Regenerate.
15285         * po/POTFILES.in: Regenerate.
15286
15287 2008-07-29  Ian Lance Taylor  <iant@google.com>
15288
15289         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
15290         symbols before other symbols.
15291         * testsuite/script_test_2.cc (test_addr): Declare.
15292         (test_addr_alias): Declare.
15293         (main): Check that test_addr and test_addr_alias have the right
15294         values.
15295         * testsuite/script_test_2.t: Define test_addr_alias and
15296         test_addr.
15297
15298 2008-07-24  Ian Lance Taylor  <iant@google.com>
15299
15300         PR 5990
15301         * descriptors.cc: New file.
15302         * descriptors.h: New file.
15303         * gold-threads.h (class Hold_optional_lock): New class.
15304         * fileread.cc: Include "descriptors.h".
15305         (File_read::~File_read): Release descriptor rather than closing
15306         it.
15307         (File_read::open) [file]: Call open_descriptor rather than open.
15308         Set is_descriptor_opened_.
15309         (File_read::open) [memory]: Assert that descriptor is not open.
15310         (File_read::reopen_descriptor): New function.
15311         (File_read::release): Release descriptor.
15312         (File_read::do_read): Make non-const.  Reopen descriptor.
15313         (File_read::read): Make non-const.
15314         (File_read::make_view): Reopen descriptor.
15315         (File_read::do_readv): Likewise.
15316         * fileread.h (class File_read): Add is_descriptor_opened_ field.
15317         Update declarations.
15318         * layout.cc: Include "descriptors.h".
15319         (Layout::create_build_id): Use open_descriptor rather than open.
15320         * output.cc: Include "descriptors.h".
15321         (Output_file::open): Use open_descriptor rather than open.
15322         * archive.cc (Archive::const_iterator): Change Archive to be
15323         non-const.
15324         (Archive::begin, Archive::end): Make non-const.
15325         (Archive::count_members): Likewise.
15326         * archive.h (class Archive): Update declarations.
15327         * object.h (Object::read): Make non-const.
15328         * Makefile.am (CCFILES): Add descriptors.cc.
15329         (HFILES): Add descriptors.h.
15330         * Makefile.in: Rebuild.
15331
15332         PR 6716
15333         * gold.h: Always include <clocale>.  Add Solaris workarounds
15334         following code in binutils/sysdep.h.
15335
15336         PR 6048
15337         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
15338         this->eh_frame_hdr_ is NULL before using it.
15339
15340         * dynobj.cc (Versions::Versions): Update comment.
15341
15342         * dynobj.cc (Versions::Versions): If there is an soname, use it as
15343         the base version name.
15344
15345         * stringpool.cc (Stringpool_template::add_with_length): Set key to
15346         array size plus one.
15347         (Stringpool_template::set_string_offsets): Subtract one from key
15348         before using it as an array index.
15349         (Stringpool_template::get_offset_with_length): Likewise.
15350         (Stringpool_template::write_to_buffer): Likewise.
15351         * stringpool.h (Stringpool_template::get_offset_from_key):
15352         Likewise.
15353
15354 2008-07-23  Ian Lance Taylor  <iant@google.com>
15355
15356         PR 6658
15357         * object.h (Merged_symbol_value::value): Do our best to handle a
15358         negative addend.
15359
15360         PR 6647
15361         * script.cc (Version_script_info::get_versions): Don't add empty
15362         version tag to return value.
15363         (Version_script_info::get_symbol_version_helper): Change return
15364         type to bool.  Add pversion parameter.  Change all callers.
15365         (script_register_vers_node): Don't require a non-NULL tag.
15366         * script.h (class Version_script_info): Update declarations.
15367         (Version_script_info::get_symbol_version): Change return type to
15368         bool.  Add version parameter.  Change all callers.
15369         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
15370         handling.  Handle an empty version from a version script.
15371         (Symbol_table::define_special_symbol): Likewise.
15372         * testsuite/ver_test_10.script: New file.
15373         * testsuite/ver_test_10.sh: New file.
15374         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
15375         (check_DATA): Add ver_test_10.syms.
15376         (ver_test_10.syms, ver_test_10.so): New target.
15377         * testsuite/Makefile.in: Rebuild.
15378
15379 2008-07-23  Simon Baldwin  <simonb@google.com>
15380
15381         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
15382         to zero for undefined symbols from dynamic libraries.
15383
15384 2008-07-23  Ian Lance Taylor  <iant@google.com>
15385
15386         * symtab.cc (Symbol_table::resolve): Remove version parameter.
15387         Change all callers.
15388         * symtab.h (class Symbol_table): Update declaration.
15389         * testsuite/ver_test_9.cc: New file.
15390         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
15391         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
15392         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
15393         (ver_test_9.so, ver_test_9.o): New targets.
15394         * testsuite/Makefile.in: Rebuild.
15395
15396 2008-07-22  Ian Lance Taylor  <iant@google.com>
15397
15398         * options.h (class General_options): Define --check-sections.
15399         * layout.cc (Layout::set_segment_offsets): Handle
15400         --check-sections.
15401
15402         * options.h (class General_options): Define -n/--nmagic and
15403         -N/--omagic.
15404         * options.cc (General_options::finalize): For -n/--nmagic or
15405         -N/--omagic, set -static.
15406         * layout.cc (Layout::attach_allocated_section_to_segment): If
15407         -N/--omagic, don't put read-only and read-write sections in
15408         different segments.
15409         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
15410         finding a read-only segment.
15411         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
15412         don't set the minimum segment alignment to the common page size,
15413         and don't set the file offset to the address modulo the page size.
15414         * script-sections.cc (Script_sections::create_segments): If
15415         -n/--omagic, don't put read-only and read-write sections in
15416         different segments.
15417
15418         * cref.cc: New file.
15419         * cref.h: New file.
15420         * options.h (class General_options): Add --print-symbol-counts.
15421         * main.cc (main): Issue defined symbol report if requested.
15422         * archive.cc (Archive::interpret_header): Make into a const member
15423         function.
15424         (Archive::add_symbols): Call Input_objects::archive_start and
15425         archive_stop.
15426         (Archive::const_iterator): Define new class.
15427         (Archive::begin, Archive::end): New functions.
15428         (Archive::include_all_members): Rewrite to use iterator.
15429         (Archive::count_members): New function.
15430         * archive.h (class Archive): Update declarations.
15431         (Archive::filename): New function.
15432         * object.cc: Include "cref.h".
15433         (Sized_relobj::Sized_relobj): Initialize defined_count_.
15434         (Sized_relobj::do_get_global_symbol_counts): New function.
15435         (Input_objects::add_object): Add object to cross-referencer.
15436         (Input_objects::archive_start): New function.
15437         (Input_objects::archive_stop): New function.
15438         (Input_objects::print_symbol_counts): New function.
15439         * object.h: Declare Cref and Archive.
15440         (Object::get_global_symbol_counts): New function.
15441         (Object::do_get_global_symbol_counts): New pure virtual function.
15442         (class Sized_relobj): Add defined_count_ field.  Update
15443         declarations.
15444         (class Input_objects): Add cref_ field.  Update constructor.
15445         Update declarations.
15446         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
15447         defined_count_.
15448         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
15449         symbol counts.
15450         (Sized_dynobj::do_get_global_symbol_counts): New function.
15451         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
15452         defined_count_.  Update declarations.  Define Symbols typedef.
15453         * symtab.cc (Symbol_table::add_from_relobj): Add defined
15454         parameter.  Change all callers.
15455         (Symbol_table::add_from_dynobj): Add sympointers and defined
15456         parameters.  Change all callers.
15457         * symtab.h (class Symbol_table): Update declarations.
15458         * Makefile.am (CCFILES): Add cref.cc.
15459         (HFILES): Add cref.h.
15460         * Makefile.in: Rebuild.
15461
15462 2008-07-22  Simon Baldwin  <simonb@google.com>
15463
15464         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
15465         to zero when writing undefined symbols.
15466
15467 2008-07-22  Ian Lance Taylor  <iant@google.com>
15468
15469         * output.cc (Output_section::add_input_section): Don't try to
15470         merge empty merge sections.
15471
15472 2008-07-21  Craig Silverstein  <csilvers@google.com>
15473
15474         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15475         Include symbol version in error message.
15476
15477 2008-07-20  Chris Demetriou  <cgd@google.com>
15478
15479         * configure.ac (gold_cv_c_random_seed): New configured variable.
15480         (RANDOM_SEED_CFLAGS): New substituted variable.
15481         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
15482         * configure: Rebuild.
15483         * Makefile.in: Likewise.
15484         * testsuite/Makefile.in: Likewise.
15485
15486 2008-07-18  Ian Lance Taylor  <iant@google.com>
15487
15488         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
15489         where we see NAME/NULL and NAME/VERSION  as separate symbols.
15490         * testsuite/ver_test_main.cc (main): Call t4.
15491         (t4, t4_2a): Define.
15492         * testsuite/ver_test_2.cc (t4_2): Define.
15493         * testsuite/ver_test_2.script: Put t4_2a in VER2.
15494         * testsuite/ver_test_4.cc (t4_2a): Define.
15495         * testsuite/ver_test_4.script: Put t4_2a in VER2.
15496         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
15497
15498 2008-07-17  Ian Lance Taylor  <iant@google.com>
15499
15500         * dynobj.cc (Versions::add_def): If we give an error about a
15501         missing version, go ahead and create the version anyhow.
15502
15503 2008-07-10  Ian Lance Taylor  <iant@google.com>
15504
15505         Handle output sections with more than 0x7fffffff bytes.
15506         * object.h (class Relobj): Change map_to_output_ to
15507         output_sections_, and just keep a section pointer.  Change all
15508         uses.  Move comdat group support to Sized_relobj.
15509         (Relobj::is_section_specially_mapped): Remove.
15510         (Relobj::output_section): Remove poff parameter.  Change all
15511         callers.
15512         (Relobj::output_section_offset): New function.
15513         (Relobj::set_section_offset): Rewrite.
15514         (Relobj::map_to_output): Remove.
15515         (Relobj::output_sections): New function.
15516         (Relobj::do_output_section_offset): New pure virtual function.
15517         (Relobj::do_set_section_offset): Likewise.
15518         (class Sized_relobj): Add section_offsets_ field.  Add comdat
15519         group support from Relobj.  Update declarations.
15520         (Sized_relobj::get_output_section_offset): New function.
15521         (Sized_relobj::do_output_section_offset): New function.
15522         (Sized_relobj::do_set_section_offset): New function.
15523         * object.cc (Relobj::output_section_address): Remove.
15524         (Sized_relobj::Sized_relobj): Initialize new fields.
15525         (Sized_relobj::include_section_group): Cast find_kept_object to
15526         Sized_relobj.
15527         (Sized_relobj::include_linkonce_section): Likewise.
15528         (Sized_relobj::do_layout): Use separate arrays for output section
15529         and output offset.
15530         (Sized_relobj::do_count_local_symbols): Change map_to_output to
15531         output_sections.
15532         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
15533         output_sections and section_offsets.
15534         (Sized_relobj::write_local_symbols): Likewise.
15535         (map_to_kept_section): Compute output address directly.
15536         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
15537         output_sections and section_offsets.
15538         (Sized_relobj::write_sections): Likewise.
15539         (Sized_relobj::relocate_sections): Likewise.
15540         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
15541         * output.h (class Output_reloc): Update declarations.  Change
15542         u2_.relobj to Sized_relobj*.
15543         (class Output_data_reloc): Change add functions to use
15544         Sized_relobj*.
15545         * output.cc (Output_reloc::Output_reloc): Change relobj to
15546         Sized_relobj*.
15547         (Output_reloc::local_section_offset): Change return type to
15548         Elf_Addr.  Use get_output_section_offset.
15549         (Output_reloc::get_address): Likewise.
15550         (Output_section::is_input_address_mapped): Don't call
15551         is_section_specially_mapped.
15552         (Output_section::output_offset): Likewise.
15553         (Output_section::output_address): Likewise.
15554         (Output_section::starting_output_address): Likewise.
15555         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
15556         parameter to Sized_relobj*.
15557         (Copy_relocs::need_copy_reloc): Likewise.
15558         (Copy_relocs::save): Likewise.
15559         * copy-relocs.h (class Copy_relocs): Update declarations.
15560         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
15561         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
15562         * target-reloc.h (relocate_for_relocatable): Change
15563         offset_in_output_section type to Elf_Addr.  Change code that uses
15564         it as well.
15565         * layout.cc (Layout::layout): Always set *off.
15566         * mapfile.cc (Mapfile::print_input_section): Use
15567         output_section_offset.
15568         * i386.cc (Target_i386::copy_reloc): Change object parameter to
15569         Sized_relobj*.
15570         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
15571         * sparc.cc (Target_sparc::copy_reloc): Likewise.
15572         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
15573
15574 2008-07-03  Ian Lance Taylor  <iant@google.com>
15575
15576         * layout.cc (Layout::include_section): Do not discard unrecognized
15577         SHT_STRTAB sections.
15578
15579 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
15580
15581         * script.cc (Lex::can_continue_name): Make '?' allowable in
15582         version-script names.
15583         * testsuite/version_script.map: Change glob pattern to use '?'
15584
15585 2008-06-30  Manish Singh  <yosh@gimp.org>
15586
15587         PR 6585
15588         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
15589         Correct typo.
15590
15591 2008-06-30  Ian Lance Taylor  <iant@google.com>
15592
15593         PR 6660
15594         PR 6682
15595         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
15596         versions]: Don't try to read the value in the contents, since we
15597         don't use it.  Use the template endianness when writing.
15598
15599 2008-06-25  Cary Coutant  <ccoutant@google.com>
15600
15601         * fileread.cc (File_read::make_view): Assert on zero-length view.
15602         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
15603         symbol table when there are no symbols to read.
15604
15605 2008-06-23  Craig Silverstein  <csilvers@google.com>
15606
15607         * version.cc (version_string): Bump to 1.7
15608
15609 2008-06-18  Craig Silverstein  <csilvers@google.com>
15610
15611         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
15612         constant 0xFFFF to type Valtype.
15613         (Powerpc_relocate_functions::rel16_ha): Likewise.
15614
15615 2008-06-17  Ian Lance Taylor  <iant@google.com>
15616
15617         * output.h (Output_section::Input_section): Initialize p2align_ to
15618         zero for Output_section_data constructors.
15619         (Output_section::Input_section::addralign): If not an input
15620         section, return the alignment of the Output_section_data.
15621         * testsuite/copy_test.cc: New file.
15622         * testsuite/copy_test_1.cc: New file.
15623         * testsuite/copy_test_2.cc: New file.
15624         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
15625         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
15626         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
15627         (copy_test_1_pic.o, copy_test_1.so): New targets.
15628         (copy_test_2_pic.o, copy_test_2.so): New targets.
15629         * testsuite/Makefile.in: Rebuild.
15630
15631         * script-sections.cc (Script_sections::place_orphan): Initialize
15632         local variable exact.
15633
15634 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
15635
15636         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
15637
15638 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
15639             David S. Miller  <davem@davemloft.net>
15640
15641         * powerpc.cc: New file.
15642         * Makefile.am (TARGETSOURCES): Add powerpc.cc
15643         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
15644         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
15645         * Makefile.in: Rebuild.
15646
15647 2008-06-09  Ian Lance Taylor  <iant@google.com>
15648
15649         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
15650         <exception>.
15651         (throwing, orig_terminate): New static variables.
15652         (terminate_handler): New static function.
15653         (t2): Set terminate handler.
15654
15655 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
15656
15657         PR 6584
15658         * binary.cc (Binary_to_elf::sized_convert): Fix .data
15659         alignment.
15660
15661 2008-05-30  Cary Coutant  <ccoutant@google.com>
15662
15663         * archive.cc (Archive::include_all_members) Correct to step
15664         over symbol table and extended name table in thin archives.
15665
15666 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
15667
15668         PR 6407
15669         * target-reloc.h (relocate_for_relocatable): Fix new_offset
15670         calculation.
15671
15672 2008-05-28  Caleb Howe  <cshowe@google.com>
15673
15674         * reduced_debug_output.cc: New file.
15675         * reduced_debug_output.h: New file.
15676         * options.h (class General_options): Add --strip-debug-non-line.
15677         * options.cc (General_options::finalize): Add strip_debug_non_line
15678         to the strip heirarchy.
15679         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
15680         fields.
15681         * layout.cc: Include "reduced_debug_output.h".
15682         (Layout::Layout): Initialize new fields.
15683         (line_only_debug_sections): New static array.
15684         (is_lines_only_debug_sections): New static inline function.
15685         (Layout::include_section): Handle --strip-debug-non-line.
15686         (Layout::make_output_section): If --strip-debug-non-line, build
15687         new output sections for .debug_abbrev and .debug_info.
15688         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
15689         gold.  Warn about possible overflow.
15690         (read_signed_LEB_128): Likewise.
15691         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
15692         (read_signed_LEB_128): Declare.
15693         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
15694         (HFILES): Add reduced_debug_output.h.
15695         * Makefile.in: Rebuild.
15696
15697 2008-05-21  Ian Lance Taylor  <iant@google.com>
15698
15699         * mapfile.cc: New file.
15700         * mapfile.h: New file.
15701         * options.h (class General_options): Add -M/--print-map and -Map.
15702         * options.cc (General_options::finalize): Make -M equivalent to
15703         -Map -.
15704         * main.cc: Include <cstdio> and "mapfile.h".
15705         (main): Open mapfile if requested.
15706         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
15707         constructor.  Change caller.
15708         (queue_initial_tasks): Add mapfile parameter.  Change caller.
15709         (queue_middle_tasks): Likewise.
15710         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
15711         declarations.
15712         * archive.cc: Include "mapfile.h".
15713         (Archive::add_symbols): Add mapfile parameter.  Change all
15714         callers.  Pass mapfile, symbol, and reason to include_member.
15715         (Archive::include_all_members): Add mapfile parameter.  Change all
15716         callers.
15717         (Archive::include_member): Add mapfile, sym, and why parameters.
15718         Change all callers.  Report inclusion to map file.
15719         * archive.h: Include "fileread.h".
15720         (class Archive): Update declarations.
15721         (Archive::file): New const method.
15722         (class Add_archive_symbols): Add mapfile_ field.  Update
15723         constructor.  Change all callers.
15724         * readsyms.h (class Read_symbols): Likewise.
15725         (class Finish_group): Likewise.
15726         (class Read_script): Likewise.
15727         * common.cc: Include "mapfile.h".
15728         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
15729         all callers.
15730         (Symbol_table::do_allocate_commons): Likewise.
15731         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
15732         symbol allocation to mapfile.
15733         * common.h (class Allocate_commons_task): Add mapfile_ field.
15734         Update constructor.  Change all callers.
15735         * symtab.h (class Symbol_table): Update declarations.
15736         * layout.cc: Include "mapfile.h".
15737         (Layout_task_runner::run): Print information to mapfile.
15738         (Layout::create_gold_note): Change Output_data_fixed_space to
15739         Output_data_zero_fill.
15740         (Layout::create_build_id): Likewise.
15741         (Layout::print_to_mapfile): New function.
15742         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
15743         constructor.  Change caller.
15744         (class Layout): Declare print_to_mapfile.
15745         * output.cc (Output_section::Input_section::print_to_mapfile): New
15746         function.
15747         (Output_section::add_input_section): If producing a map, always
15748         add to input_sections_ list.
15749         (Output_section::do_print_to_mapfile): New function.
15750         (Output_segment::print_sections_to_mapfile): New function.
15751         (Output_segment::print_section_list_to_mapfile): New function.
15752         * output.h: Include "mapfile.h".
15753         (Output_data::print_to_mapfile): New function.
15754         (Output_data::do_print_to_mapfile): New virtual function.
15755         (Output_segment_headers::do_print_to_mapfile): New function.
15756         (Output_file_header::do_print_to_mapfile): New function.
15757         (Output_data_const::do_print_to_mapfile): New function.
15758         (class Output_data_const_buffer): Add map_name_ field.  Update
15759         constructor.  Change all callers.  Add do_print_to_mapfile
15760         function.
15761         (class Output_data_fixed_space): Likewise.
15762         (class Output_data_space): Likewise.
15763         (class Output_data_zero_fill): New class.
15764         (Output_data_strtab::do_print_to_mapfile): New function.
15765         (Output_data_reloc_base::do_print_to_mapfile): New function.
15766         (Output_relocatable_relocs::do_print_to_mapfile): New function.
15767         (Output_data_group::do_print_to_mapfile): New function.
15768         (Output_data_got::do_print_to_mapfile): New function.
15769         (Output_data_dynamic::do_print_to_mapfile): New function.
15770         (Output_symtab_xindex::do_print_to_mapfile): New function.
15771         (class Output_section): Declare do_print_to_mapflie.  Declare
15772         print_to_mapfile in Input_section.
15773         (class Output_segment): Declare new functions.
15774         * object.h (Sized_relobj::symbol_count): New function.
15775         * script-sections.cc
15776         (Output_section_element_dot_assignment::set_section_addresses):
15777         Change Output_data_fixed_space to Output_data_zero_fill.
15778         (Output_data_expression::do_print_to_mapfile): New function.
15779         * script.cc (read_input_script): Add mapfile parameter.  Change
15780         all callers.
15781         * script.h (read_input_script): Update declaration.
15782         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
15783         (Eh_frame::do_print_to_mapfile): New function.
15784         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
15785         (Output_merge_string::do_print_to_mapfile): New function.
15786         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
15787         function.
15788         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
15789         function.
15790         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
15791         function.
15792         * Makefile.am (CCFILES): Add mapfile.cc.
15793         (HFILES): Add mapfile.h.
15794         * Makefile.in: Rebuild.
15795
15796 2008-05-19  Ian Lance Taylor  <iant@google.com>
15797
15798         * options.h (class General_options): Add -z relro.
15799         * layout.cc (Layout::Layout): Initialize relro_segment_.
15800         (Layout::add_output_section_data): Return the output section.
15801         (Layout::make_output_section): Rcognize relro sections and mark
15802         them appropriately.
15803         (Layout::attach_allocated_section_to_segment): Put relro sections
15804         in a PT_GNU_RELRO segment.
15805         (Layout::create_initial_dynamic_sections): Mark the .dynamic
15806         section as relro.
15807         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
15808         PT_TLS segments.
15809         (Layout::linkonce_mapping): Map d.rel.ro.local to
15810         .data.rel.ro.local.
15811         (Layout::output_section_name): Us .data.rel.ro.local for any
15812         section which begins with that.
15813         * layout.h (class Layout): Update add_output_section_data
15814         declaration.  Add relro_segment_ field.
15815         * output.cc (Output_section::Output_section): Initialize is_relro_
15816         and is_relro_local_ fields.
15817         (Output_segment::add_output_section): Group relro sections.
15818         (Output_segment::is_first_section_relro): New function.
15819         (Output_segment::maximum_alignment): If there is a relro section,
15820         align the segment to the common page size.
15821         (Output_segment::set_section_addresses): Track whether we are
15822         looking at relro sections.  If the last section is a relro
15823         section, align to the common page size.
15824         (Output_segment::set_section_list_addresses): Add in_relro
15825         parameter.  Change all callers.  Align to the page size when
15826         moving from relro to non-relro section.
15827         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
15828         segment.
15829         * output.h (class Output_section): Add is_relro_ and
15830         is_relro_local_ fields.
15831         (Output_section::is_relro): New function.
15832         (Output_section::set_is_relro): New function.
15833         (Output_section::is_relro_local): New function.
15834         (Output_section::set_is_relro_local): New function.
15835         (class Output_segment): Update declarations.
15836         * i386.cc (Target_i386::got_section): Mark .got section as relro.
15837         * sparc.cc (Target_sparc::got_section): Likewise.
15838         * x86_64.cc (Target_x86_64::got_section): Likewise.
15839         * testsuite/relro_test_main.cc: New file.
15840         * testsuite/relro_test.cc: New file.
15841         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
15842         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
15843         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
15844         (relro_test.so, relro_test_pic.o): New targets.
15845         * testsuite/Makefile.in: Rebuild.
15846
15847 2008-05-16  Ian Lance Taylor  <iant@google.com>
15848
15849         * output.cc (Output_segment::add_output_section): Remove front
15850         parameter.
15851         * output.h (class Output_segment): Remove
15852         add_initial_output_section and overloaded add_output_section.
15853         Update declaration of remaining add_output_section.
15854         * layout.cc (Layout::create_interp): Call add_output_section
15855         rather than add_initial_output_section.
15856         (Layout::finish_dynamic_section): Likewise.
15857
15858         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
15859         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
15860         know the dynamic type.
15861         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
15862         field.  Initialize it in constructor.
15863         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
15864         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
15865         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
15866         reloc.
15867
15868         * output.cc (Output_reloc::get_address): Change return type to
15869         Elf_Addr.
15870         * output.h (class Output_reloc): Update get_address declaration.
15871         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
15872         for section addresses.
15873
15874 2008-05-09  Ian Lance Taylor  <iant@google.com>
15875
15876         PR 6493
15877         * gold.cc (gold_nomem): Use return value of write.
15878
15879 2008-05-08  Ian Lance Taylor  <iant@google.com>
15880
15881         * symtab.c (Symbol::init_base_output_data): Add version
15882         parameter.  Change all callers.
15883         (Symbol::init_base_output_segment): Likewise.
15884         (Symbol::init_base_constant): Likewise.
15885         (Symbol::init_base_undefined): Likewise.
15886         (Sized_symbol::init_output_data): Likewise.
15887         (Sized_symbol::init_output_segment): Likewise.
15888         (Sized_symbol::init_constant): Likewise.
15889         (Sized_symbol::init_undefined): Likewise.
15890         (Symbol_table::do_define_in_output_data): If the new symbol has a
15891         version, mark it as the default.
15892         (Symbol_table::do_define_in_output_segment): Likewise.
15893         (Symbol_table::do_define_as_constant): Likewise.
15894         * symtab.h (class Symbol): Update declarations.
15895         (class Sized_symbol): Likewise.
15896         * resolve.cc (Symbol::override_version): New function.
15897         (Symbol::override_base): Call override_version.
15898         (Symbol::override_base_with_special): Likewise.
15899         * testsuite/ver_script_8.script: New file.
15900         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
15901         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
15902         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
15903         (ver_test_8_1.so, ver_test_8_2.so): New targets.
15904
15905 2008-05-06  Ian Lance Taylor  <iant@google.com>
15906
15907         PR 6049
15908         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
15909         functions.
15910         (class General_options): Remove existing --undefined, and add
15911         --no-undefined instead.  Add new --undefined as synonym for -u.
15912         * archive.cc (Archive::add_symbols): Check whether symbol was
15913         named with -u.
15914         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
15915         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
15916         all uses.  Add IS_UNDEFINED.  Update declarations to split
15917         different versions of init_base.  Declare init_base_undefined.
15918         (Symbol::is_defined): Handle IS_UNDEFINED.
15919         (Symbol::is_undefined): Likewise.
15920         (Symbol::is_weak_undefined): Call is_undefined.
15921         (Symbol::is_absolute): Handle IS_CONSTANT.
15922         (class Sized_symbol): Update declarations to split different
15923         versions of init.  Declare init_undefined.
15924         (class Symbol_table): Declare new functions.
15925         * symtab.cc (Symbol::init_base_object): Rename from init_base.
15926         Change all callers.
15927         (Symbol::init_base_output_data): Likewise.
15928         (Symbol::init_base_output_segment): Likewise.
15929         (Symbol::init_base_constant): Likewise.
15930         (Symbol::init_base_undefined): New function.
15931         (Sized_symbol::init_object): Rename from init.  Change all
15932         callers.
15933         (Sized_symbol::init_output_data): Likewise.
15934         (Sized_symbol::init_output_segment): Likewise.
15935         (Sized_symbol::init_constant): Likewise.
15936         (Sized_symbol::init_undefined): New function.
15937         (Symbol_table::add_undefined_symbols_from_command_line): New
15938         function.
15939         (Symbol_table::do_add_undefined_symbols_from_command_line): New
15940         function.
15941         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
15942         (Symbol::output_section): Likewise.
15943         (Symbol::set_output_section): Likewise.
15944         (Symbol_table::sized_finalize_symbol): Likewise.
15945         (Symbol_table::sized_write_globals): Likewise.
15946         * resolve.cc (Symbol_table::should_override): Likewise.
15947         (Symbol::override_base_with_special): Likewise.
15948
15949         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
15950         symbol, change it to have default visibility.
15951         * testsuite/protected_1.cc: New file.
15952         * testsuite/protected_2.cc: New file.
15953         * testsuite/protected_3.cc: New file.
15954         * testsuite/protected_main_1.cc: New file.
15955         * testsuite/protected_main_2.cc: New file.
15956         * testsuite/protected_main_3.cc: New file.
15957         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
15958         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
15959         (protected_1_LDFLAGS, protected_1_LDADD): Define.
15960         (protected_1.so): New target.
15961         (protected_1_pic.o, protected_2_pic.o): New targets.
15962         (protected_3_pic.o): New target.
15963         (check_PROGRAMS): Add protected_2.
15964         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
15965         (protected_2_LDFLAGS, protected_2_LDADD): Define.
15966         * testsuite/Makefile.in: Rebuild.
15967
15968         * options.h (DEFINE_var): Add set_user_set_##varname__.
15969         (DEFINE_bool_alias): New macro.
15970         (class General_options): Define -Bstatic using DEFINE_bool_alias
15971         rather than DEFINE_special.  Add --undefined as an alias for -z
15972         defs.
15973         * options.cc (General_options::parse_Bstatic): Remove.
15974
15975         * options.h (class General_options): Add --fatal-warnings.
15976         * main.cc (main): Implement --fatal-warnings.
15977         * errors.h (Errors::warning_count): New function.
15978
15979         * options.h (class General_options): Add -Bsymbolic-functions.
15980         * symtab.h (Symbol::is_preemptible): Check for
15981         -Bsymbolic-functions.
15982
15983 2008-05-05  Ian Lance Taylor  <iant@google.com>
15984
15985         * options.h (DEFINE_bool): For DASH_Z, create the negative option
15986         as noVARNAME rather than no-VARNAME.
15987         (class General_options): Add option -z combreloc.
15988         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15989         get_address.
15990         (Output_reloc::sort_before) [SHT_REL]: New function.
15991         (Output_reloc::sort_before) [SHT_RELA]: New function.
15992         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
15993         Sort_relocs_comparison.
15994         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15995         parameter.  Change all callers.
15996         (Output_data_reloc::Output_data_reloc) [both versions]: Add
15997         sort_relocs parameter.  Change all callers.
15998         * output.cc (Output_reloc::get_address): New function, broken out
15999         of write_rel.
16000         (Output_reloc::write_rel): Call it.
16001         (Output_reloc::compare): New function.
16002         (Output_data_reloc_base::do_write): Optionally sort relocs.
16003
16004         * configure.ac: If targ_extra_obj is set, link it in.
16005         * configure.tgt: Initialize all variables.
16006         (x86_64*): Set targ_extra_obj and targ_extra_size.
16007         * configure: Rebuild.
16008
16009         * object.cc (Sized_relobj::include_section_group): Adjust section
16010         indexes read from group data.  Build vector to pass to
16011         layout_group.
16012         * layout.cc (Layout::layout_group): Add flags and shndxes
16013         parameters.  Remove contents parameter.  Change caller.  Update
16014         explicit instantiations.
16015         * layout.h (class Layout): Update layout_group declaration.
16016         * output.cc (Output_data_group::Output_data_group): Add flags and
16017         input_shndxes parameters.  Remove contents parameter.  Change
16018         caller.
16019         (Output_data_group::do_write): Change input_sections_ to
16020         input_shndxes_.
16021         * output.h (class Output_data_group): Update constructor
16022         declaration.  Rename input_sections_ to input_shndxes_.
16023         * testsuite/many_sections_test.cc: Add template.
16024
16025 2008-04-30  Cary Coutant  <ccoutant@google.com>
16026
16027         * target-reloc.h (relocate_section): Fix dead-pointer bug.
16028
16029         * layout.cc (Layout::include_section): Refactored check for debug
16030         info section.
16031         (Layout::add_comdat): Add new parameters.  Change type
16032         of signature parameter.  Add object and shndx to signatures table.
16033         (Layout::find_kept_object): New function.
16034         * layout.h: Include <cstring>.
16035         (Layout::is_debug_info_section): New function.
16036         (Layout::add_comdat): Add new parameters.
16037         (Layout::find_kept_object): New function.
16038         (Layout::Kept_section): New struct.
16039         (Layout::Signatures): Change type of map range.
16040         * object.cc (Relobj::output_section_address): New function.
16041         (Sized_relobj::include_section_group): Add new parameters.  Change
16042         calls to Layout::add_comdat.  Change to build table of kept comdat
16043         groups and table mapping discarded sections to kept sections.
16044         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
16045         (Sized_relobj::do_layout): Change calls to include_section_group and
16046         include_linkonce_section.
16047         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
16048         value to zero when section is discarded.
16049         (Sized_relobj::map_to_kept_section): New function.
16050         * object.h (Relobj::output_section_address): New function.
16051         (Relobj::Comdat_group): New type.
16052         (Relobj::find_comdat_group): New function.
16053         (Relobj::Comdat_group_table): New type.
16054         (Relobj::Kept_comdat_section): New type.
16055         (Relobj::Kept_comdat_section_table): New type.
16056         (Relobj::add_comdat_group): New function.
16057         (Relobj::set_kept_comdat_section): New function.
16058         (Relobj::get_kept_comdat_section): New function.
16059         (Relobj::comdat_groups_): New field.
16060         (Relobj::kept_comdat_sections_): New field.
16061         (Symbol_value::input_value): Update comment.
16062         (Sized_relobj::map_to_kept_section) New function.
16063         (Sized_relobj::include_linkonce_section): Add new parameter.
16064         * target-reloc.h (Comdat_behavior): New type.
16065         (get_comdat_behavior): New function.
16066         (relocate_section): Add code to map a discarded section to the
16067         corresponding kept section when applying a relocation.
16068
16069 2008-04-30  Craig Silverstein  <csilvers@google.com>
16070
16071         * dwarf_reader.cc (next_generation_count): New static var.
16072         (Addr2line_cache_entry): New struct.
16073         (addr2line_cache): New static var.
16074         (Dwarf_line_info::one_addr2line): Added caching.
16075         (Dwarf_line_info::clear_addr2line_cache): New function.
16076         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
16077         cache-size parameter.
16078         (Dwarf_line_info::one_addr2line_cache): New function.
16079         * symtab.cc (Symbol_table::detect_odr_violations): Pass
16080         new cache-size argument to one_addr2line(), and clear cache.
16081
16082 2008-04-28  Cary Coutant  <ccoutant@google.com>
16083
16084         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
16085         R_386_PC8 relocations.
16086
16087 2008-04-23  Ian Lance Taylor  <iant@google.com>
16088
16089         * object.cc (Sized_relobj::include_section_group): Check for
16090         invalid section group.
16091
16092         * object.cc (make_elf_object): Correct test for 64-bit ELF file
16093         header size.
16094
16095         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
16096         than read for file header.
16097         * archive.cc (Archive::include_member): Likewise.
16098
16099 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
16100
16101         * aclocal.m4: Regenerate.
16102         * configure: Regenerate.
16103
16104 2008-04-19  Ian Lance Taylor  <iant@google.com>
16105
16106         * version.cc (version_string): Bump to 1.6.
16107
16108         * testsuite/Makefile.am (many_sections_r_test): New target.
16109         (many_sections_r_test_SOURCES): Remove.
16110         (many_sections_r_test_DEPENDENCIES): Remove.
16111         (many_sections_r_test_LDFLAGS): Remove.
16112         (many_sections_r_test_LDADD): Remove.
16113
16114         * object.cc (Sized_relobj::do_add_symbols): Always pass
16115         local_symbol_count_ to add_from_relobj.
16116
16117         * testsuite/Makefile.am (many_sections_check.h): Only check one in
16118         every thousand variables.
16119         * testsuite/Makefile.in: Rebuild.
16120
16121         * object.cc (Xindex::initialize_symtab_xindex): New function.
16122         (Xindex::read_symtab_xindex): New function.
16123         (Xindex::sym_xindex_to_shndx): New function.
16124         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
16125         available.
16126         (Sized_relobj::do_initialize_xindex): New function.
16127         (Sized_relobj::do_read_symbols): Adjust section links.
16128         (Sized_relobj::symbol_section_and_value): Add is_ordinary
16129         parameter.  Change all callers.
16130         (Sized_relobj::include_section_group): Adjust section links and
16131         symbol section indexes.
16132         (Sized_relobj::do_layout): Adjust section links.
16133         (Sized_relobj::do_count_local_symbols): Adjust section links and
16134         symbol section indexes.
16135         (Sized_relobj::do_finalize_local_symbols): Distinguish between
16136         ordinary and special symbols.
16137         (Sized_relobj::write_local_symbols): Add symtab_xindex and
16138         dynsym_xindex parameters.  Change all callers.  Adjust section
16139         links.  Use SHN_XINDEX when needed.
16140         (Sized_relobj::get_symbol_location_info): Adjust section links.
16141         Don't get fooled by special symbols.
16142         * object.h (class Xindex): Define.
16143         (class Object): Add xindex_ parameter.  Declare virtual functoin
16144         do_initialize_xindex.
16145         (Object::adjust_sym_shndx): New function.
16146         (Object::set_xindex): New protected function.
16147         (class Symbol_value): Add is_ordinary_shndx_ field.
16148         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
16149         (Symbol_value::value): Assert ordinary section.
16150         (Symbol_value::initialize_input_to_output_map): Likewise.
16151         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
16152         Change all callers.
16153         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
16154         all callers.
16155         (class Sized_relobj): Update declarations.
16156         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
16157         parameter.  Change all callers.
16158         (Sized_relobj::adjust_shndx): New function.
16159         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
16160         field.
16161         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
16162         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
16163         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
16164         (Sized_dynobj::read_dynsym_section): Adjust section links.
16165         (Sized_dynobj::read_dynamic): Likewise.
16166         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
16167         section links.
16168         (Sized_dynobj::do_initialize_xindex): New function.
16169         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
16170         do_initialize_xindex.
16171         (Sized_dynobj::adjust_shndx): New function.
16172         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
16173         dynsym_xindex_ fields.
16174         (Layout::finalize): Add a call to set_section_indexes before
16175         creating the symtab sections.
16176         (Layout::set_section_indexes): Don't do anything if the section
16177         already has a section index.
16178         (Layout::create_symtab_sections): Add shnum parameter.  Change
16179         caller.  Create .symtab_shndx section if needed.
16180         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
16181         caller.
16182         (Layout::allocated_output_section_count): New function.
16183         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
16184         needed.
16185         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
16186         fields.  Update declarations.
16187         (Layout::symtab_xindex): New function.
16188         (Layout::dynsym_xindex): New function.
16189         (class Write_symbols_task): Add layout_ field.
16190         (Write_symbols_task::Write_symbols_task): Add layout parameter.
16191         Change caller.
16192         * output.cc (Output_section_headers::Output_section_headers): Add
16193         shstrtab_section parameter.  Change all callers.
16194         (Output_section_headers::do_sized_write): Store overflow values
16195         for section count and section string table section index in
16196         section header zero.
16197         (Output_file_header::do_sized_write): Check for overflow of
16198         section count and section string table section index.
16199         (Output_symtab_xindex::do_write): New function.
16200         (Output_symtab_xindex::endian_do_write): New function.
16201         * output.h (class Output_section_headers): Add shstrtab_section_.
16202         Update declarations.
16203         (class Output_symtab_xindex): Define.
16204         (Output_section::has_out_shndx): New function.
16205         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
16206         field.
16207         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
16208         Change all callers.
16209         (Sized_symbol::init): Likewise.
16210         (Symbol::output_section): Check for ordinary symbol.
16211         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
16212         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
16213         callers.
16214         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
16215         Change all callers.  Simplify handling of symbols from sections
16216         not included in the link.
16217         (Symbol_table::add_from_dynobj): Handle ordinary symbol
16218         distinction.
16219         (Weak_alias_sorter::operator()): Assert that symbols are
16220         ordinary.
16221         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
16222         distinction.
16223         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
16224         parameters.  Change all callers.
16225         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
16226         symbol distinction.  Use SHN_XINDEX when needed.
16227         (Symbol_table::write_section_symbol): Add symtab_xindex
16228         parameter.  Change all callers.
16229         (Symbol_table::sized_write_section_symbol): Likewise.  Use
16230         SHN_XINDEX when needed.
16231         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
16232         declarations.
16233         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
16234         (Symbol::is_defined): Check is_ordinary.
16235         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
16236         (Symbol::is_absolute, Symbol::is_common): Likewise.
16237         (class Sized_symbol): Update declarations.
16238         (class Symbol_table): Update declarations.
16239         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
16240         parameters.  Change all callers.
16241         (Sized_symbol::override): Likewise.
16242         (Symbol_table::override): Likewise.
16243         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
16244         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
16245         is_ordinary, and orig_st_shndx parameters.  Change all callers.
16246         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
16247         to be in an ordinary section.
16248         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
16249         object and is_ordinary parameters.  Change all callers.
16250         (Sized_dwarf_line_info::read_relocs): Add object parameter.
16251         Change all callers.  Don't add undefined or non-ordinary symbols
16252         to reloc_map_.
16253         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
16254         Change all callers.
16255         * dwarf_reader.h (class Sized_dwarf_line_info): Update
16256         declarations.
16257         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
16258         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
16259         (Sized_relobj::relocate_sections): Likewise.
16260         * target-reloc.h (scan_relocs): Adjust section symbol index.
16261         (scan_relocatable_relocs): Likewise.
16262         * i386.cc (Scan::local): Check for ordinary symbols.
16263         * sparc.cc (Scan::local): Likewise.
16264         * x86_64.cc (Scan::local): Likewise.
16265         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
16266         to symbol_section_and_value.
16267         * testsuite/many_sections_test.cc: New file.
16268         * testsuite/Makefile.am (BUILT_SOURCES): Define.
16269         (check_PROGRAMS): Add many_sections_test.
16270         (many_sections_test_SOURCES): Define.
16271         (many_sections_test_DEPENDENCIES): Define.
16272         (many_sections_test_LDFLAGS): Define.
16273         (BUILT_SOURCES): Add many_sections_define.h.
16274         (many_sections_define.h): New target.
16275         (BUILT_SOURCES): Add many_sections_check.h.
16276         (many_sections_check.h): New target.
16277         (check_PROGRAMS): Add many_sections_r_test.
16278         (many_sections_r_test_SOURCES): Define.
16279         (many_sections_r_test_DEPENDENCIES): Define.
16280         (many_sections_r_test_LDFLAGS): Define.
16281         (many_sections_r_test_LDADD): Define.
16282         (many_sections_r_test.o): New target.
16283         * testsuite/Makefile.in: Rebuild.
16284
16285 2008-04-17  Cary Coutant  <ccoutant@google.com>
16286
16287         * errors.cc (Errors::info): New function.
16288         (gold_info): New function.
16289         * errors.h (Errors::info): New function.
16290         * gold.h (gold_info): New function.
16291         * object.cc (Input_objects::add_object): Print trace output.
16292         * options.cc (options::parse_set): New function.
16293         (General_options::parse_wrap): Deleted.
16294         (General_options::General_options): Deleted initializer.
16295         * options.h (options::String_set): New typedef.
16296         (options::parse_set): New function.
16297         (DEFINE_set): New macro.
16298         (General_options::wrap): Changed to use DEFINE_set. Changed
16299         callers of any_wrap_symbols and is_wrap_symbol.
16300         (General_options::trace, General_options::trace_symbol):
16301         New options.
16302         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
16303         (General_options::wrap_symbols_): Deleted.
16304         * symtab.cc (Symbol_table::add_from_object): Print trace output.
16305
16306 2008-04-17  David S. Miller  <davem@davemloft.net>
16307
16308         * options.cc (General_options::parse_V): New function.
16309         * options.h: Add entries for -V and -Qy.
16310
16311 2008-04-17  Ian Lance Taylor  <iant@google.com>
16312
16313         * common.cc (Symbol_table::allocate_commons): Remove options
16314         parameter.  Change caller.
16315         (Symbol_table::do_allocate_commons): Remove options parameter.
16316         Change caller.  Just call do_allocate_commons_list twice.
16317         (Symbol_table::do_allocate_commons_list): New function, broken out
16318         of do_allocate_commons.
16319         * common.h (class Allocate_commons_task): Remove options_ field.
16320         Update constructor.
16321         * symtab.cc (Symbol_table::Symbol_table): Initialize
16322         tls_commons_.
16323         (Symbol_table::add_from_object): Put TLS common symbols on
16324         tls_commons_ list.
16325         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
16326         which are IN_OUTPUT_DATA.
16327         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
16328         allocate_commons and do_allocate_commons declarations.  Declare
16329         do_allocate_commons_list.
16330         * gold.cc (queue_middle_tasks): Update creation of
16331         Allocate_commons_task to not pass options.
16332         * testsuite/Makefile.am (INCLUDES): Add -I.. .
16333         (TLS_TEST_C_FLAGS): New variable.
16334         (tls_test_c_pic.o): New target.
16335         (tls_test_shared.so): Link in tls_test_c_pic.o.
16336         (tls_test_c_pic_ie.o): New target.
16337         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
16338         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
16339         (tls_test_c.o): New target.
16340         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
16341         (tls_pic_test_LDADD): Likewise.
16342         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
16343         (tls_shared_gd_to_ie_test_LDADD): Likewise.
16344         (tls_test_c_gnu2.o): New target.
16345         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
16346         tls_test_c_gnu2.o.
16347         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
16348         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
16349         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
16350         * testsuite/tls_test.cc: Include "config.h".
16351         (t_last): Call t11_last.
16352         * testsuite/tls_test.h (t11, t11_last): Declare.
16353         * testsuite/tls_test_c.c: New file.
16354         * testsuite/tls_test_main.cc (thread_routine): Call t11.
16355         * configure.ac: Check for OpenMP support.
16356         * configure, config.in, Makefile.in: Rebuild.
16357         * testsuite/Makefile.in: Rebuild.
16358
16359 2008-04-16  Cary Coutant  <ccoutant@google.com>
16360
16361         * i386.cc (Target_i386::define_tls_base_symbol): New function.
16362         (Target_i386::tls_base_symbol_defined_): New field.
16363         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16364         (Target_i386::Scan::global): Likewise.
16365         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
16366         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
16367         (Target_x86_64::tls_base_symbol_defined_): New field.
16368         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16369         (Target_x86_64::Scan::global): Likewise.
16370
16371 2008-04-16  Cary Coutant  <ccoutant@google.com>
16372
16373         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
16374         (Symbol::needs_plt_entry): Allow weak undefined symbols.
16375         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
16376         building shared libraries.
16377         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
16378         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
16379         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
16380         * testsuite/Makefile.in: Rebuild.
16381         * testsuite/weak_undef.h: New file.
16382         * testsuite/weak_undef_file1.cc: Add extra test cases.
16383         * testsuite/weak_undef_file2.cc: Likewise.
16384         * testsuite/weak_undef_test.cc: Likewise.
16385
16386 2008-04-16  David S. Miller  <davem@davemloft.net>
16387
16388         * sparc.cc (Target_sparc::Scan): Change from struct to class.
16389         Add issued_non_pic_error_ field.  Declare check_non_pic.
16390         (Target_sparc::Scan::check_non_pic): New function.
16391         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
16392         (Target_sparc::Scan::global): Likewise.
16393
16394         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
16395         * configure: Rebuild.
16396
16397         * options.h (DEFINE_enable): New macro.
16398         (new_dtags): New enable option.
16399         (initfirst, interpose, loadfltr, nodefaultlib,
16400         nodelete, nodlopen, nodump): New -z options.
16401         * layout.cc (Layout:finish_dynamic_section): If new
16402         dtags enabled, emit DT_RUNPATH.  Also, emit a
16403         DT_FLAGS_1 containing any specified -z flags.
16404
16405 2008-04-16  Ian Lance Taylor  <iant@google.com>
16406
16407         * copy-relocs.cc: New file.
16408         * copy-relocs.h: New file.
16409         * reloc.cc: Remove Copy_relocs code.
16410         * reloc.h: Likewise.
16411         * reloc-types.h (struct Reloc_types) [both versions]: Add
16412         get_reloc_addend_noerror.
16413         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
16414         variants of add_global which take an addend which must be zero.
16415         * i386.cc: Include "copy-relocs.h".
16416         (class Target_i386): Change type of copy_relocs_ to variable,
16417         update initializer.
16418         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
16419         Change all callers.
16420         (Target_i386::do_finalize_sections): Change handling of
16421         copy_relocs_.
16422         * sparc.cc: Include "copy-relocs.h".
16423         (class Target_sparc): Change type of copy_relocs_ to variable,
16424         update initializer.
16425         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
16426         Change all callers.
16427         (Target_sparc::do_finalize_sections): Change handling of
16428         copy_relocs_.
16429         * x86_64.cc: Include "copy-relocs.h".
16430         (class Target_x86_64): Change type of copy_relocs_ to variable,
16431         update initializer.
16432         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
16433         class.  Change all callers.
16434         (Target_x86_64::do_finalize_sections): Change handling of
16435         copy_relocs_.
16436         * Makefile.am (CCFILES): Add copy-relocs.cc.
16437         (HFILES): Add copy-relocs.h.
16438
16439         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
16440
16441         * testsuite/script_test_4.sh: Permit leading zeroes.
16442
16443 2008-04-15  Ian Lance Taylor  <iant@google.com>
16444
16445         * script-sections.cc (Script_sections::create_segments): Use
16446         header_size_adjustment even when there is enough room for the
16447         headers.
16448         * testsuite/script_test_4.sh: New file.
16449         * testsuite/script_test_4.t: New file.
16450         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
16451         (check_DATA): Add script_test_4.stdout.
16452         (MOSTLYCLEANFILES): Likewise.
16453         (script_test_4): New target.
16454         (script_test_4.stdout): New target.
16455         * testsuite/Makefile.in: Rebuild.
16456
16457         * sparc.cc: Add definitions for Output_data_plt_sparc class
16458         constants.
16459
16460 2008-04-14  David S. Miller  <davem@davemloft.net>
16461
16462         * sparc.cc: New file.
16463         * Makefile.am (TARGETSOURCES): Add sparc.cc
16464         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
16465         * configure.tgt: Document targ_extra_size and
16466         targ_extra_big_endian.  Add entries for sparc-* and
16467         sparc64-*.
16468         * configure.ac: Handle targ_extra_size and
16469         targ_extra_big_endian.
16470         * Makefile.in: Rebuild.
16471         * configure: Likewise.
16472         * po/POTFILES.in: Likewise.
16473         * po/gold.pot: Likewise.
16474
16475 2008-04-14  Ian Lance Taylor  <iant@google.com>
16476
16477         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
16478         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
16479         in the name/type/flags to section mapping.  Don't call
16480         allocate_output_section.
16481         (Layout::choose_output_section): Change parameter from adjust_name
16482         to is_input_section.  Don't permit input sections after sections
16483         are attached to segments.  Don't call allocate_output_section.
16484         (Layout::layout_eh_frame): Call update_flags_for_input_section,
16485         not write_enable_output_section.
16486         (Layout::make_output_section): Don't push to
16487         unattached_section_list_ nor call attach_to_segment.  Call
16488         attach_section_to_segment if sections are attached.
16489         (Layout::attach_sections_to_segments): New function.
16490         (Layout::attach_section_to_segment): New function.
16491         (Layout::attach_allocated_section_to_segment): Rename from
16492         attach_to_segment.  Remove flags parameter.
16493         (Layout::allocate_output_section): Remove function.
16494         (Layout::write_enable_output_section): Remove function.
16495         * layout.h (class Layout): Update for above changes.  Add new
16496         field sections_are_attached_.
16497         * output.h (Output_section::update_flags_for_input_section): New
16498         function.
16499         * output.cc (Output_section::add_input_section): Call
16500         update_flags_for_input_section.
16501         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
16502
16503 2008-04-11  Cary Coutant  <ccoutant@google.com>
16504
16505         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
16506         thought unnecessary.
16507         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
16508
16509 2008-04-11  Ian Lance Taylor  <iant@google.com>
16510
16511         * output.h (class Output_section_data): Remove inline definition
16512         of set_addralign.
16513         * output.cc (Output_section_data::set_addralign): New function.
16514
16515 2008-04-11  Cary Coutant  <ccoutant@google.com>
16516
16517         Add support for TLS descriptors for i386 and x86_64.
16518         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
16519         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
16520         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
16521         GOT_TYPE_TLS_DESC.
16522         (Target_i386::got_mod_index_entry): Remove unnecessary code.
16523         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
16524         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
16525         relocations.
16526         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
16527         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
16528         Fix problem with initial-exec relocations.
16529         (Target_i386::Relocate::relocate_tls): Likewise.
16530         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
16531         relaxation.
16532         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
16533         support for section-plus-offset dynamic table entries.
16534         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
16535         (Output_data_dynamic::Dynamic_entry): Add support for
16536         section-plus-offset dynamic table entries.
16537         (Output_data_dynamic::Classification): Likewise.
16538         (Output_data_dynamic::classification_): Renamed offset_.
16539         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
16540         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
16541         (Target_x86_64::make_plt_section): New function.
16542         (Target_x86_64::reserve_tlsdesc_entries): New function.
16543         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
16544         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
16545         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
16546         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
16547         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
16548         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
16549         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
16550         add extra PLT entry for TLS descriptors.
16551         (Output_data_plt_x86_64::got_): New field.
16552         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
16553         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
16554         fields.
16555         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
16556         descriptors.
16557         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
16558         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
16559         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
16560         R_386_TLS_DESC_CALL relocations.
16561         (Target_x86_64::Scan::global): Likewise.
16562         (Target_x86_64::do_finalize_sections): Add dynamic table entries
16563         for TLS descriptors.
16564         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
16565         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
16566         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
16567         GD-to-IE relaxation.
16568         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
16569         and TLS_DESCRIPTORS.
16570         * Makefile.in: Rebuild.
16571         * configure: Rebuild.
16572         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
16573         (tls_test_shared2.so): New target.
16574         (tls_shared_gd_to_ie_test_SOURCES): New variable.
16575         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
16576         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
16577         (tls_shared_gd_to_ie_test_LDADD): New variable.
16578         (tls_shared_gnu2_gd_to_ie_test): New target.
16579         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
16580         New targets.
16581         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
16582         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
16583         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
16584         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
16585         (tls_shared_gnu2_test): New target.
16586         (tls_test_gnu2_shared.so): New target.
16587         (tls_shared_gnu2_test_SOURCES): New variable.
16588         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
16589         (tls_shared_gnu2_test_LDFLAGS): New variable.
16590         (tls_shared_gnu2_test_LDADD): New variable.
16591         * testsuite/Makefile.in: Rebuild.
16592         * testsuite/Makefile.
16593
16594 2008-04-11  Ian Lance Taylor  <iant@google.com>
16595
16596         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
16597         justsyms.t.
16598         * testsuite/Makefile.in: Rebuild.
16599
16600         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
16601         long.
16602         * testsuite/script_test_2.cc (main): Adjust test.
16603
16604 2008-04-11  David S. Miller  <davem@davemloft.net>
16605             Ian Lance Taylor  <iant@google.com>
16606
16607         * options.h (General_options): Add entries for '-Y' and
16608         '-relax'.
16609         * options.cc (General_options:finalize): If -Y was used, add those
16610         entries to the library path instead of the default "/lib" and
16611         "/usr/lib".
16612
16613 2008-04-11  David S. Miller  <davem@davemloft.net>
16614
16615         * testsuite/justsyms.t: Start at 0x100.
16616         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
16617         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
16618         long.
16619         * testsuite/script_test_2.cc: Adjust string and section length
16620         checks.
16621
16622 2008-04-09  Ian Lance Taylor  <iant@google.com>
16623
16624         PR gold/5996
16625         * script-sections.cc (Sections_element::allocate_to_segment): Add
16626         orphan parameter.
16627         (Output_section_definition::allocate_to_segment): Likewise.
16628         (Orphan_output_section::allocate_to_segment): Likewise.
16629         (Script_sections::attach_sections_using_phdrs_clause): Don't
16630         propagate non-PT_LOAD segments to orphan sections.
16631         * testsuite/Makefile.am (script_test_3.stdout): Generate using
16632         readelf rather than objdump.
16633         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
16634         .interp section and PT_INTERP segment are the same size.
16635         * testsuite/Makefile.in: Rebuild.
16636
16637         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
16638         aliases for symbols defined in the same object.
16639         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
16640         (weak_alias_test_SOURCES): New variable.
16641         (weak_alias_test_DEPENDENCIES): New variable.
16642         (weak_alias_test_LDFLAGS): New variable.
16643         (weak_alias_test_LDADD): New variable.
16644         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
16645         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
16646         (weak_alias_test_3.o): New target.
16647         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
16648         * testsuite/weak_alias_test_main.cc: New file.
16649         * testsuite/weak_alias_test_1.cc: New file.
16650         * testsuite/weak_alias_test_2.cc: New file.
16651         * testsuite/weak_alias_test_3.cc: New file.
16652
16653 2008-04-08  Ian Lance Taylor  <iant@google.com>
16654
16655         * options.h (class General_options): Add --noinhibit-exec option.
16656         * main.cc (main): Check --noinhibit-exec.
16657
16658         * options.h (class General_options): Define --wrap as a special
16659         option.  Add wrap_symbols_ field.
16660         (General_options::any_wrap_symbols): New function.
16661         (General_options::is_wrap_symbol): New function.
16662         * options.cc (General_options::parse_wrap): New function.
16663         (General_options::General_options): Initialize wrap_symbols_.
16664         * symtab.cc (Symbol_table::wrap_symbol): New function.
16665         (Symbol_table::add_from_object): Handle --wrap.
16666         * symtab.h (class Symbol_table): Declare wrap_symbol.
16667         * target.h (Target::wrap_char): New function.
16668         (Target::Target_info): Add wrap_char field.
16669         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
16670         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
16671         * testsuite/testfile.cc (Target_test::test_target_info):
16672         Likewise.
16673
16674         * errors.cc (Errors::undefined_symbol): Mention symbol version if
16675         there is one.
16676
16677         * layout.h (class Layout): Add added_eh_frame_data_ field.
16678         * layout.cc (Layout::Layout): Initialize new field.
16679         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
16680         output section until we find a section we merged successfully.
16681         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
16682         that the size be non-zero.
16683
16684         * merge.cc (Object_merge_map::get_output_offset): Remove inline
16685         qualifier.
16686
16687 2008-04-08  Craig Silverstein  <csilvers@google.com>
16688
16689         * configure.ac: Export new conditional variable HAVE_ZLIB.
16690         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
16691         on HAVE_ZLIB.
16692         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
16693         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16694
16695 2008-04-07  Ian Lance Taylor  <iant@google.com>
16696
16697         * version.cc (version_string): Set to "1.5".
16698
16699         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
16700         Add issued_non_pic_error_ field.  Declare check_non_pic.
16701         (Target_x86_64::Scan::check_non_pic): New function.
16702         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
16703         (Target_x86_64::Scan::global): Likewise.
16704
16705         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
16706         addend parameter.  Change caller.  Handle merge sections.
16707         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
16708         Address to Addend.  Don't add in the result of
16709         local_section_offset, pass down the addend and use the returned
16710         value.
16711         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
16712         Update declarations of local_section_offset and symbol_value.
16713         * testsuite/two_file_test_1.cc (t18): New function.
16714         * testsuite/two_file_test_2.cc (f18): New function.
16715         * testsuite/two_file_test_main.cc (main): Call t18.
16716         * testsuite/two_file_test.h (t18, f18): Declare.
16717
16718         * configure.ac: Don't test for objdump, c++filt, or readelf.
16719         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
16720         conditionals.
16721         (TEST_READELF): New variable.
16722         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
16723         (check_PROGRAMS): Add two_file_strip_test.
16724         (two_file_strip_test): New target.
16725         (check_PROGRAMS): Add two_file_same_shared_strip_test.
16726         (two_file_same_shared_strip_test_SOURCES): New variable.
16727         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
16728         (two_file_same_shared_strip_test_LDFLAGS): New variable.
16729         (two_file_same_shared_strip_test_LDADD): New variable.
16730         (two_file_shared_strip.so): New target.
16731         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
16732         (ver_test_5.syms, ver_test_7.syms): Likewise.
16733         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
16734         (strip_test_3.stdout): Use TEST_OBJDUMP.
16735         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16736
16737 2008-04-04  Cary Coutant  <ccoutant@google.com>
16738
16739         * symtab.h (Symbol::is_weak_undefined): New function.
16740         (Symbol::is_strong_undefined): New function.
16741         (Symbol::is_absolute): New function.
16742         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
16743         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
16744         absolute symbols.
16745         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
16746         (weak_undef_test): New target.
16747         * testsuite/Makefile.in: Rebuild.
16748         * testsuite/weak_undef_file1.cc: New file.
16749         * testsuite/weak_undef_file2.cc: New file.
16750         * testsuite/weak_undef_test.cc: New file.
16751
16752 2008-04-03  Craig Silverstein  <csilvers@google.com>
16753
16754         * compressed_output.h (class Output_compressed_section): Use
16755         unsigned buffer.
16756         * compressed_output.cc (zlib_compress): Use unsigned buffers,
16757         add zlib header.
16758         (zlib_compressed_suffix): Removed.
16759         (Output_compressed_section::set_final_data_size): Use unsigned
16760         buffers.
16761         * testsuite/Makefile.am (flagstest_compress_debug_sections):
16762         Fix linker invocation.
16763         (flagstest_o_specialfile_and_compress_debug_sections):
16764         Likewise.
16765         * testsuite/Makefile.in: Regenerated.
16766
16767 2008-04-02  David S. Miller  <davem@davemloft.net>
16768
16769         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
16770         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
16771
16772 2008-04-02  Craig Silverstein  <csilvers@google.com>
16773
16774         * TODO: New file.
16775
16776 2008-04-02  Ian Lance Taylor  <iant@google.com>
16777
16778         * fileread.cc (File_read::find_view): Add byteshift and vshifted
16779         parameters.  Update for new key type to views_.  Change all
16780         callers.
16781         (File_read::read): Adjust for byteshift in returned view.
16782         (File_read::add_view): New function, broken out of
16783         find_and_make_view.
16784         (File_read::make_view): New function, broken out of
16785         find_and_make_view.
16786         (File_read::find_or_make_view): Add offset and aligned
16787         parameters.  Rewrite accordingly.  Change all callers.
16788         (File_read::get_view): Add offset and aligned parameters.  Adjust
16789         for byteshift in return value.
16790         (File_read::get_lasting_view): Likewise.
16791         * fileread.h (class File_read): Update declarations.
16792         (class File_read::View): Add byteshift_ field.  Add byteshift to
16793         constructor.  Add byteshift method.
16794         * archive.h (Archive::clear_uncached_views): New function.
16795         (Archive::get_view): Add aligned parameter.  Change all callers.
16796         * object.h (Object::get_view): Add aligned parameter.  Change all
16797         callers.
16798         (Object::get_lasting_view): Likewise.
16799
16800         * fileread.cc (File_read::release): Don't call clear_views if
16801         there are multiple objects.
16802         * fileread.h (File_read::clear_uncached_views): New function.
16803         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
16804         on the archive.
16805
16806 2008-03-31  Cary Coutant  <ccoutant@google.com>
16807
16808         Add thin archive support.
16809         * archive.cc (Archive::armagt): New const.
16810         (Archive::setup): Remove task parameter and calls to unlock.
16811         (Archive::unlock_nested_archives): New function.
16812         (Archive::read_header): Add nested_off parameter. Change
16813         all callers.
16814         (Archive::interpret_header): Likewise.
16815         (Archive::include_all_members): Change to handle thin
16816         archives.
16817         (Archive::include_member): Likewise.
16818         * archive.h (Archive::Archive): Add new parameters and
16819         initializers.
16820         (Archive::armagt): New const.
16821         (Archive::setup): Remove task parameter.
16822         (Archive::unlock_nested_archives): New function.
16823         (Archive::read_header): Add nested_off parameter.
16824         (Archive::interpret_header): Likewise.
16825         (Archive::Nested_archive_table): New typedef.
16826         (Archive::is_thin_archive_): New field.
16827         (Archive::nested_archives_): New field.
16828         (Archive::options_): New field.
16829         (Archive::dirpath_): New field.
16830         (Archive::task_): New field.
16831         * readsyms.cc (Read_symbols::do_read_symbols): Add check
16832         for thin archives.  Pass additional parameters to
16833         Archive::Archive.  Unlock the archive file after calling
16834         Archive::setup.
16835
16836 2008-03-29  Ian Lance Taylor  <iant@google.com>
16837
16838         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
16839         version symbol to be local.
16840         * testsuite/ver_test_4.sh: New file.
16841         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
16842         (check_DATA): Add ver_test_4.syms.
16843         (ver_test_4.syms): New target.
16844         * testsuite/Makefile.in: Rebuild.
16845
16846         * output.cc
16847         (Output_section::Input_section_sort_entry::has_priority): New
16848         function.
16849         (Output_section::Input_section_sort_entry::match_file_name): New
16850         function.
16851         (Output_section::Input_section_sort_entry::match_section_name):
16852         Remove.
16853         (Output_section::Input_section_sort_entry::match_section_name_prefix):
16854         Remove.
16855         (Output_section::Input_section_sort_entry::match_section_file):
16856         Remove.
16857         (Output_section::Input_section_sort_compare::operator()): Rewrite
16858         using new Input_section_sort_entry functions.  Sort crtbegin and
16859         crtend first.  Sort sections with no priority before sections with
16860         a priority.
16861         * testsuite/initpri1.c (d3): Check j != 4.
16862         (cd5): New constructor/destructor function.
16863         (main): Check j != 2.
16864
16865         * symtab.cc (Symbol_table::add_from_object): If we don't use the
16866         new symbol when resolving, don't call set_is_default.
16867         * testsuite/ver_test_7.cc: New file.
16868         * testsuite/ver_test_7.sh: New file.
16869         * testsuite/Makefile.am (ver_test_7.so): New target.
16870         (ver_test_7.o): New target.
16871         (check_SCRIPTS): Add ver_test_7.sh.
16872         (check_DATA): Add ver_test_7.syms.
16873         (ver_test_7.syms): New target.
16874
16875 2008-03-28  Ian Lance Taylor  <iant@google.com>
16876
16877         * layout.cc (Layout::layout): If we see an input section with a
16878         name that needs sorting, set the must_sort flag for the output
16879         section.
16880         (Layout::make_output_section): If the name of the output section
16881         indicates that it might require sorting, set the may_sort flag.
16882         * output.h (Output_section::may_sort_attached_input_sections): New
16883         function.
16884         (Output_section::set_may_sort_attached_input_sections): New
16885         function.
16886         (Output_section::must_sort_attached_input_sections): New
16887         function.
16888         (Output_section::set_must_sort_attached_input_sections): New
16889         function.
16890         (class Output_section): Declare Input_section_sort_entry.  Define
16891         Input_section_sort_compare.  Declare
16892         sort_attached_input_sections.  Add new fields:
16893         may_sort_attached_input_sections_,
16894         must_sort_attached_input_sections_,
16895         attached_input_sections_are_sorted_.
16896         * output.cc (Output_section::Output_section): Initialize new
16897         fields.
16898         (Output_section::add_input_section): Add an entry to
16899         input_sections_ if may_sort or must_sort are true.
16900         (Output_section::set_final_data_size): Call
16901         sort_attached_input_sections if necessary.
16902         (Output_section::Input_section_sort_entry): Define new class.
16903         (Output_section::Input_section_sort_compare::operator()): New
16904         function.
16905         (Output_section::sort_attached_input_sections): New function.
16906         * configure.ac: Check whether the compiler supports constructor
16907         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
16908         * testsuite/initpri1.c: New file.
16909         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
16910         CONSTRUCTOR_PRIORITY.
16911         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
16912         (initpri1_LDFLAGS): New variable.
16913         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16914
16915 2008-03-27  Ian Lance Taylor  <iant@google.com>
16916
16917         * common.cc (Sort_commons::operator): Correct sorting algorithm.
16918         * testsuite/common_test_1.c: New file.
16919         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
16920         (common_test_1_SOURCES): New variable.
16921         (common_test_1_DEPENDENCIES): New variable.
16922         (common_test_1_LDFLAGS): New variable.
16923
16924         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
16925         and commons_ correctly when NAME/VERSION does not override
16926         NAME/NULL.
16927         * testsuite/ver_test_6.c: New file.
16928         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
16929         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
16930         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
16931
16932 2008-03-26  Ian Lance Taylor  <iant@google.com>
16933
16934         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
16935         of an undefined symbol from a version script.
16936         * testsuite/Makefile.am (ver_test_5.so): New target.
16937         (ver_test_5.o): New target.
16938         (check_SCRIPTS): Add ver_test_5.sh.
16939         (check_DATA): Add ver_test_5.syms.
16940         (ver_test_5.syms): New target.
16941         * testsuite/ver_test_5.cc: New file.
16942         * testsuite/ver_test_5.script: New file.
16943         * testsuite/ver_test_5.sh: New file.
16944         * Makefile.in, testsuite/Makefile.in: Rebuild.
16945
16946         PR gold/5986
16947         Fix problems building gold with gcc 4.3.0.
16948         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
16949         (gold_error_at_location, gold_warning_at_location): Use it.
16950         * configure.ac: Check whether we can compile and use a template
16951         function with a printf attribute.
16952         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
16953         when jumping over bytes.
16954         * object.cc: Instantiate Object::read_section_data.
16955         * debug.h: Include <cstring>
16956         * dwarf_reader.cc: Include <algorithm>
16957         * main.cc: Include <cstring>.
16958         * options.cc: Include <cstring>.
16959         * output.cc: Include <cstring>.
16960         * script.cc: Include <cstring>.
16961         * script.h: Include <string>.
16962         * symtab.cc: Include <cstring> and <algorithm>.
16963         * target-select.cc: Include <cstring>.
16964         * version.cc: Include <string>.
16965         * testsuite/testmain.cc: Include <cstdlib>.
16966         * configure, config.in: Rebuild.
16967
16968 2008-03-25  Ian Lance Taylor  <iant@google.com>
16969
16970         * options.cc: Include "../bfd/bfdver.h".
16971         (options::help): Print bug reporting address.
16972
16973         * version.cc (print_version): Adjust output for current value of
16974         BFD_VERSION_STRING.
16975
16976         * NEWS: New file.
16977
16978         * options.cc (options::help): Print list of supported targets.
16979         * target-select.h: Include <vector>.
16980         (class Target_selector): Make machine_, size_, and is_big_endian_
16981         fields const.  Add bfd_name_ and instantiated_target_ fields.
16982         (Target_selector::Target_selector): Add bfd_name parameter.
16983         (Target_selector::recognize): Make non-virtual, call
16984         do_recognize.
16985         (Target_selector::recognize_by_name): Make non-virtual, call
16986         do_recognize_by_name.
16987         (Target_selector::supported_names): New function.
16988         (Target_selector::bfd_name): New function.
16989         (Target_selector::do_instantiate_target): New pure virtual
16990         function.
16991         (Target_selector::do_recognize): New virtual function.
16992         (Target_selector::do_recognize_by_name): New virtual function.
16993         (Target_selector::instantiate_target): New private function.
16994         (supported_target_names): Declare.
16995         * target-select.cc (Target_selector::Target_selector): Update for
16996         new parameter and fields.
16997         (select_target_by_name): Check that the name matches before
16998         calling recognize_by_name.
16999         (supported_target_names): New function.
17000         * i386.cc (class Target_selector_i386): Update Target_selector
17001         constructor call.  Remove recognize and recognize_by_name.  Add
17002         do_instantiate_target.
17003         * x86_64.cc (class Target_selector_x86_64): Likewise.
17004         * testsuite/testfile.cc (class Target_selector_test): Update for
17005         changes to Target_selector.
17006
17007         * README: Rewrite, with some notes on unsupported features.
17008
17009 2008-03-24  Cary Coutant  <ccoutant@google.com>
17010
17011         * i386.cc (Target_i386::Got_type): New enum declaration.
17012         (Target_i386::Scan::local): Updated callers of Output_data_got
17013         member functions.
17014         (Target_i386::Scan::global): Likewise.
17015         (Target_i386::Relocate::relocate): Likewise.
17016         (Target_i386::Relocate::relocate_tls): Likewise.
17017         * object.h (Got_offset_list): New class.
17018         (Sized_relobj::local_has_got_offset): Added got_type parameter.
17019         (Sized_relobj::local_got_offset): Likewise.
17020         (Sized_relobj::set_local_got_offset): Likewise.
17021         (Sized_relobj::local_has_tls_got_offset): Removed.
17022         (Sized_relobj::local_tls_got_offset): Removed.
17023         (Sized_relobj::set_local_tls_got_offset): Removed.
17024         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
17025         * output.cc (Output_data_got::add_global): Added got_type parameter.
17026         (Output_data_got::add_global_with_rel): Likewise.
17027         (Output_data_got::add_global_with_rela): Likewise.
17028         (Output_data_got::add_global_pair_with_rel): New function.
17029         (Output_data_got::add_global_pair_with_rela): New function.
17030         (Output_data_got::add_local): Added got_type parameter.
17031         (Output_data_got::add_local_with_rel): Likewise.
17032         (Output_data_got::add_local_with_rela): Likewise.
17033         (Output_data_got::add_local_pair_with_rel): New function.
17034         (Output_data_got::add_local_pair_with_rela): New function.
17035         (Output_data_got::add_global_tls): Removed.
17036         (Output_data_got::add_global_tls_with_rel): Removed.
17037         (Output_data_got::add_global_tls_with_rela): Removed.
17038         (Output_data_got::add_local_tls): Removed.
17039         (Output_data_got::add_local_tls_with_rel): Removed.
17040         (Output_data_got::add_local_tls_with_rela): Removed.
17041         * output.h (Output_data_got::add_global): Added got_type parameter.
17042         (Output_data_got::add_global_with_rel): Likewise.
17043         (Output_data_got::add_global_with_rela): Likewise.
17044         (Output_data_got::add_global_pair_with_rel): New function.
17045         (Output_data_got::add_global_pair_with_rela): New function.
17046         (Output_data_got::add_local): Added got_type parameter.
17047         (Output_data_got::add_local_with_rel): Likewise.
17048         (Output_data_got::add_local_with_rela): Likewise.
17049         (Output_data_got::add_local_pair_with_rel): New function.
17050         (Output_data_got::add_local_pair_with_rela): New function.
17051         (Output_data_got::add_global_tls): Removed.
17052         (Output_data_got::add_global_tls_with_rel): Removed.
17053         (Output_data_got::add_global_tls_with_rela): Removed.
17054         (Output_data_got::add_local_tls): Removed.
17055         (Output_data_got::add_local_tls_with_rel): Removed.
17056         (Output_data_got::add_local_tls_with_rela): Removed.
17057         * resolve.cc (Symbol::override_base_with_special): Removed
17058         reference to has_got_offset_ field.
17059         * symtab.cc (Symbol::init_fields): Replaced initialization
17060         of got_offset_ with got_offsets_.  Removed initialization
17061         of has_got_offset_
17062         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
17063         (Symbol::got_offset): Likewise.
17064         (Symbol::set_got_offset): Likewise.
17065         (Symbol::has_tls_got_offset): Removed.
17066         (Symbol::tls_got_offset): Removed.
17067         (Symbol::set_tls_got_offset): Removed.
17068         (Symbol::got_offset_): Removed.
17069         (Symbol::tls_mod_got_offset_): Removed.
17070         (Symbol::tls_pair_got_offset_): Removed.
17071         (Symbol::got_offsets_): New field.
17072         (Symbol::has_got_offset): Removed.
17073         (Symbol::has_tls_mod_got_offset): Removed.
17074         (Symbol::has_tls_pair_got_offset): Removed.
17075         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
17076         (Target_x86_64::Scan::local): Updated callers of Output_data_got
17077         member functions.
17078         (Target_x86_64::Scan::global): Likewise.
17079         (Target_x86_64::Relocate::relocate): Likewise.
17080         (Target_x86_64::Relocate::relocate_tls): Likewise.
17081
17082 2008-03-25  Ben Elliston  <bje@au.ibm.com>
17083
17084         * yyscript.y: Fix spelling error in comment.
17085
17086 2008-03-24  Ian Lance Taylor  <iant@google.com>
17087
17088         * options.h (class General_options): Define build_id option.
17089         * layout.h (class Layout): Declare write_build_id, create_note,
17090         create_build_id.  Add build_id_note_ member.
17091         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
17092         "libiberty.h", "md5.h", "sha1.h".
17093         (Layout::Layout): Initialize eh_frame_data_,
17094         eh_frame_hdr_section_, and build_id_note_.
17095         (Layout::finalize): Call create_build_id.
17096         (Layout::create_note): New function, broken out of
17097         Layout::create_gold_note.
17098         (Layout::create_gold_note): Call create_note.
17099         (Layout::create_build_id): New function.
17100         (Layout::write_build_id): New function.
17101         (Close_task_runner::run): Call write_build_id.
17102
17103         * x86_64.cc: Correct license to GPLv3.
17104
17105 2008-03-23  Ian Lance Taylor  <iant@google.com>
17106
17107         * options.cc: Include "demangle.h".
17108         (parse_optional_string): New function.
17109         (parse_long_option): Handle takes_optional_argument.
17110         (parse_short_option): Update dash_z initializer.  Handle
17111         takes_optional_argument.
17112         (General_options::General_options): Initialize do_demangle_.
17113         (General_options::finalize): Set do_demangle_.  Handle demangling
17114         style.
17115         * options.h (parse_optional_string): Declare.
17116         (struct One_option): Add optional_arg field.  Update constructor.
17117         Update call constructor calls.  Add takes_optional_argument
17118         function.
17119         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
17120         (DEFINE_optional_string): Define.
17121         (General_options::demangle): Change from DEFINE_bool to
17122         DEFINE_optional_string.
17123         (General_options::no_demangle): New function.
17124         (General_options::do_demangle): New function.
17125         (General_options::set_do_demangle): New function.
17126         (General_options::execstack_status_): Move definition to end of
17127         class definition.
17128         (General_options::static_): Likewise.
17129         (General_options::do_demangle_): New field.
17130         * object.cc (big_endian>::get_symbol_location_info): Call
17131         Options::do_demangle, not Options::demangle.
17132         * symtab.cc (demangle): Likewise.
17133
17134 2008-03-22  Ian Lance Taylor  <iant@google.com>
17135
17136         * gold.h: Include <cstddef> and <sys/types.h>
17137         * options.h: Include <cstring>.
17138
17139 2008-03-21  Ian Lance Taylor  <iant@google.com>
17140
17141         * Added source code to GNU binutils.
17142 \f
17143 Copyright (C) 2008-2015 Free Software Foundation, Inc.
17144
17145 Copying and distribution of this file, with or without modification,
17146 are permitted in any medium without royalty provided the copyright
17147 notice and this notice are preserved.
17148
17149 Local Variables:
17150 mode: change-log
17151 left-margin: 8
17152 fill-column: 74
17153 version-control: never
17154 End: