Fix support for i386 TLS GD-to-IE optimization.
[external/binutils.git] / gold / ChangeLog
1 2015-03-22  Cary Coutant  <cary@google.com>
2
3         PR gold/18106
4         * i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
5         non-SIB form of lea, with nop after the call.
6
7 2015-03-21  Cary Coutant  <cary@google.com>
8
9         PR gold/14217
10         * output.cc (Output_segment::is_first_section_relro): Don't ignore
11         .tdata section.
12         (Output_segment::set_section_addresses): Don't align size of relro
13         segment for .tbss.
14
15 2015-03-21  Cary Coutant  <cary@google.com>
16
17         PR gold/18010
18         * stringpool.cc (Stringpool_template): Don't optimize if section
19         alignment is greater than sizeof(char).
20
21 2015-03-21  Cary Coutant  <cary@google.com>
22
23         PR gold/18048
24         * script-c.h (script_include_directive): Add first_token parameter.
25         * script.cc (script_include_directive): Add first_token parameter, and
26         pass it to read_script_file.
27         * yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
28         (PARSING_MEMORY_DEF): New tokens.
29         (top): Add new productions for INCLUDE files.
30         (file_cmd): Replace file_or_sections_cmd with copy of its productions.
31         Pass PARSING_LINKER_SCRIPT to script_include_directive.
32         (section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
33         (section_cmd): Pass PARSING_SECTION_CMDS.
34         (file_or_sections_cmd): Remove.
35         (memory_def): Pass PARSING_MEMORY_DEF.
36         * testsuite/Makefile.am (memory_test_2): New test.
37         * testsuite/Makefile.in: Regenerate.
38         * testsuite/memory_test_inc.t: New script file.
39         * testsuite/memory_test_inc_1.t.src: New script file.
40         * testsuite/memory_test_inc_2.t.src: New script file.
41         * testsuite/memory_test_inc_3.t.src: New script file.
42
43 2015-03-21  Cary Coutant  <cary@google.com>
44
45         * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
46         (Sized_relobj_dwo::setup): Build compressed section map.
47         (Sized_relobj_dwo::do_decompressed_section_contents): Delete.
48         * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
49         section map.
50         * object.cc (Sized_relobj_file::Sized_relobj_file): Remove
51         compressed_sections_ field.
52         (build_compressed_section_map): Take Object instead of
53         Sized_relobj_file parameter; add decompress_if_needed parameter.
54         (Sized_relobj_file::do_find_special_sections): Store compressed
55         section map in parent Object.
56         (Sized_relobj_file::do_decompressed_section_contents): Move
57         implementation to Object::decompressed_section_contents.
58         (Sized_relobj_file::do_discard_decompressed_sections): Move
59         implementation to Object::discard_decompressed_sections.
60         * object.h (build_compressed_section_map): Declare.
61         (Object::Object): Add compressed_sections_ field.
62         (Object::section_is_compressed): Move implementation here.
63         (Object::decompressed_section_contents): De-virtualize.
64         (Object::discard_decompressed_sections): De-virtualize.
65         (Object::do_section_is_compressed): Delete.
66         (Object::do_decompressed_section_contents): Delete.
67         (Object::set_compressed_sections): New method.
68         (Object::compressed_sections): New method.
69         (Object::compressed_sections_): New data member.
70         (Compressed_section_info, Compressed_section_map): Move to top of file.
71         (Sized_relobj_file::do_section_is_compressed): Delete.
72         (Sized_relobj_file::do_decompressed_section_contents): Delete.
73         (Sized_relobj_file::do_discard_decompressed_sections): Delete.
74         (Sized_relobj_file::compressed_sections_): Move to Object class.
75
76 2015-03-21  Cary Coutant  <ccoutant@google.com>
77
78         PR gold/18152
79         * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
80         deferred objects.
81
82 2015-03-11  Cary Coutant  <ccoutant@google.com>
83
84         * options.cc (General_options::finalize): Don't allow -z relro
85         with incremental linking.
86         * testsuite/Makefile.am (incremental_test): Add -z norelro.
87         (incremental_test_2): Likewise.
88         (incremental_test_3): Likewise.
89         (incremental_test_4): Likewise.
90         (incremental_test_5): Likewise.
91         (incremental_test_6): Likewise.
92         (incremental_copy_test): Likewise.
93         (incremental_common_test_1): Likewise.
94         (incremental_comdat_test_1): Likewise.
95         * testsuite/Makefile.in: Regenerate.
96
97 2015-03-09  Cary Coutant  <ccoutant@google.com>
98
99         PR gold/14675
100         * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
101         return enum indicating whether .eh_frame section is empty, optimizable,
102         unrecognized, or an end marker. Adjust explicit instantiations.
103         * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
104         (Eh_frame::add_ehframe_input_section): Change return type.
105         * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
106         * layout.cc (Layout::layout_eh_frame): Don't add optimized sections
107         to the .eh_frame output section until we see the end marker.
108         (Layout::finalize_eh_frame_section): New.
109         * layout.h: (Layout::finalize_eh_frame_section): New.
110
111 2015-03-05  H.J. Lu  <hongjiu.lu@intel.com>
112
113         * output.cc (Relobj::initialize_input_to_output_map<size>):
114         Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
115
116 2015-03-04  Cary Coutant  <ccoutant@google.com>
117
118         * parameters.cc (Parameters::set_target_once): Call
119         Target::select_as_default_target just once from here...
120         (set_parameters_target): ...instead of from here.
121
122 2015-03-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
123
124         * ehframe.cc (Cie::set_output_offset): Pass in and use a
125         Output_section_data instead of a Merge_map.
126         (Eh_frame::Eh_frame): Don't initialize merge_map_.
127         (Eh_frame::read_cie): Use add_merge_mapping instead of
128         Merge_map::add_mapping.
129         (Eh_frame::read_fde): Ditto.
130         (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
131         (Eh_frame::do_output_offset): Use merge_output_offset istead of
132         merge_map_->get_output_offset.
133         (Eh_frame::do_is_merge_section_for): Delete.
134         * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
135         instead of a Merge_map.
136         (Cie::set_output_offset): Pass in a Output_section_data instead of a
137         Merge_map.
138         (Eh_frame::do_is_merge_section_for): Delete.
139         (Eh_frame::merge_map_): Delete.
140         * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
141         and use a Output_section_data instead of a Merge_map.
142         (Object_merge_map::add_mapping): Ditto.
143         (Object_merge_map::get_output_offset): Remove the merge_map argument.
144         (Object_merge_map::is_merge_section_for): Pass in and use a
145         Output_section_data instead of a Merge_map.
146         (Merge_map): Delete.
147         (Output_merge_base::do_output_offset): Use merge_output_offset instead
148         of merge_map_.get_output_offset.
149         (Output_merge_base::do_is_merge_section_for): Delete.
150         (Output_merge_data::do_add_input_section): Use
151         object->add_merge_mapping instead of add_mapping.
152         (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
153         * merge.h (Merge_map): Delete forward declaration.
154         (Object_merge_map::add_mapping): Pass in and use a Output_section_data
155         instead of a Merge_map.
156         (Object_merge_map::get_output_offset): Remove the merge_map argument.
157         (Object_merge_map::is_merge_section_for): Pass in and use a
158         Output_section_data instead of a Merge_map.
159         (Input_merge_map::Object_merge_map::merge_map): Replace with
160         output_data.
161         (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
162         Output_section_data instead of a Merge_map.
163         (Merge_map): Delete.
164         (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
165         (Output_merge_base::do_is_merge_section_for): Delete.
166         (Output_merge_base::add_mapping): Delete.
167         (Output_merge_base::merge_map_): Delete.
168         * object.cc (Relobj::initialize_input_to_output_map): New.
169         (Relobj::initialize_input_to_output_map): New.
170         (Relobj::merge_output_offset): New.
171         (Relobj::is_merge_section_for): New.
172         (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
173         bits.
174         * object.h (Relobj::merge_map): Delete.
175         (initialize_input_to_output_map): New.
176         (set_merge_map): Delete.
177         (add_merge_mapping): New.
178         (merge_output_offset): New.
179         (is_merge_section_for): New.
180         * output.cc (Output_section::Input_section::is_merge_section_for):
181         Use object->is_merge_section_for.
182         * output.h (Output_section_data::is_merge_section_for): Delete.
183         (Output_section_data::do_is_merge_section_for): Delete.
184         * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
185         Use object->initialize_input_to_output_map.
186         (Merged_symbol_value<size>::value_from_output_section): Use
187         object->merge_output_offset.
188
189 2015-03-02  Peter Collingbourne  <pcc@google.com>
190             Cary Coutant  <ccoutant@google.com>
191
192         * output.cc (Output_section::add_merge_input_section): Do not
193         attempt to merge sections with an entsize of 0.
194
195 2015-03-02  Khem Raj  <raj.khem@gmail.com>
196
197         * attributes.h (class Output_attributes_section_data ): Add
198         do_print_to_mapfile function.
199
200 2015-02-24  Alan Modra  <amodra@gmail.com>
201
202         PR 18010
203         * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
204         complain if value is not a multiple of four.
205         (Target_powerpc::Relocate::relocate): Correct handling of
206         R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
207
208 2015-02-21  H.J. Lu  <hongjiu.lu@intel.com>
209
210         * configure.ac (default_size): Set to 32 for x32.
211         * configure: Regenerated.
212
213 2015-02-18  Alan Modra  <amodra@gmail.com>
214
215         PR 17954
216         * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
217         visibility.
218
219 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
220
221         * gc.h (Garbage_collection::add_reference): Don't use find.
222
223 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
224
225         * object.cc (write_local_symbols): avoid std::vector copy.
226
227 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
228
229         * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
230
231 2015-02-09  Mark Wielaard  <mjw@redhat.com>
232
233         * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
234         DW_LANG_Fortran03 and DW_LANG_Fortran08.
235
236 2015-02-16  Cary Coutant  <ccoutant@google.com>
237
238         PR gold/13577
239         PR gold/16992
240         * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
241         DF_SYMBOLIC if --dynamic-list option is used.
242         * options.cc (General_options::finalize): --dynamic-list is not
243         mutually exclusive with -Bsymbolic.
244         * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
245         listed in --dynamic-list.
246         * testsuite/Makefile.am (dynamic_list_lib2.so): Add
247         -Bsymbolic-functions.
248         * testsuite/Makefile.in: Regenerate.
249
250 2015-02-16  Cary Coutant  <ccoutant@google.com>
251
252         PR gold/17971
253         * incremental.cc: Remove redundant include of "output.h".
254
255 2015-02-12  Jing Yu  <jingyu@google.com>
256
257         * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
258         TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
259         New relocation.
260         * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
261         TLSLE_MOVW_* relocations.
262         (Target_aarch64::Scan::global): Likewise.
263         (Target_aarch64::Relocate::relocate): Likewise.
264         (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
265         for new TLSLE_MOVW_* relocations.
266
267 2015-02-11  Will Newton  <will.newton@linaro.org>
268
269         PR gold/13321
270         * arm.cc (Target_arm::make_plt_section): Create an ARM
271         state mapping symbol at the start of the PLT.
272
273 2015-02-09  H.J. Lu  <hongjiu.lu@intel.com>
274
275         * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
276         Replace two_file_shared_2.so with two_file_shared_1.so.
277         * testsuite/Makefile.in: Regenerated.
278
279 2015-02-09  Alan Modra  <amodra@gmail.com>
280
281         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
282         plugin_test_thin.a and defsym_test.
283         * testsuite/Makefile.in: Regenerate.
284
285 2015-02-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
286
287         * merge.cc (do_add_input_section): Combine loop epilogue into main loop
288         body.
289
290 2015-02-04  Peter Collingbourne  <pcc@google.com>
291
292         * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
293         forwarding symbols when computing symbol resolution info for plugins.
294         * plugin.h (Plugin_manager::symtab): New method.
295         (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
296
297 2015-02-03  Cary Coutant  <ccoutant@google.com>
298             Peter Collingbourne  <pcc@google.com>
299
300         PR gold/15660
301         * archive.cc (Thin_archive_object_unlocker): New class.
302         (Archive::include_member): Unlock external members of thin archives.
303         * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
304         (plugin_test_2): Likewise.
305         (plugin_test_3): Likewise.
306         (plugin_test_4): Likewise.
307         (plugin_test_5): Likewise.
308         (plugin_test_6): Likewise.
309         (plugin_test_7): Likewise.
310         (plugin_test_8): Likewise.
311         (plugin_test_9): Likewise.
312         (plugin_test_10): Likewise.
313         (plugin_test_11): New test case.
314         * testsuite/Makefile.in: Regenerate.
315         * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
316         file to decide whether to claim file.
317         (all_symbols_read_hook): Likewise.
318         * testsuite/plugin_test_1.sh: Adjust expected output.
319         * testsuite/plugin_test_2.sh: Likewise.
320         * testsuite/plugin_test_3.sh: Likewise.
321         * testsuite/plugin_test_6.sh: Likewise.
322         * testsuite/plugin_test_tls.sh: Likewise.
323         * testsuite/plugin_test_11.sh: New testcase.
324
325 2015-02-03  Cary Coutant  <ccoutant@google.com>
326
327         * descriptors.cc (Descriptors::open): Set artificially-low limit for
328         file descriptors when debugging enabled. Add debug output.
329         (Descriptors::release): Add debug output.
330         (Descriptors::close_some_descriptor): Likewise.
331         (Descriptors::close_all): Likewise.
332         * fileread.cc (File_read::lock): Likewise.
333         (File_read::unlock): Likewise.
334
335 2015-02-02  Cary Coutant  <ccoutant@google.com>
336
337         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
338         executable output file.
339
340 2015-01-22  Han Shen  <shenhan@google.com>
341
342         * arm.cc (Target_arm::Target_arm): Add initialization for new members.
343         (Target_arm::do_plt_address_for_global): New method.
344         (Target_arm::do_plt_address_for_local): New method.
345         (Target_arm::rel_irelative_section): New method.
346         (Target_arm::make_data_plt): Add more parameters for plt ctor.
347         (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
348         (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
349         (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
350         (Target_arm::Scan::check_non_pic): Add ifunc support.
351         (Target_arm::Scan::local): Add ifunc support.
352         (Target_arm::Scan::global): Add ifunc support.
353         (Target_arm::make_plt_section): New method.
354         (Target_arm::make_plt_entry): Change to call to make_plt_section.
355         (Target_arm::make_local_ifunc_plt_entry): New method.
356         (Target_arm::got_irelative_): New member.
357         (Target_arm::rel_irelative_): New member.
358         (Target_arm::got_section): Add creation for got_irelative_.
359         (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
360         (Target_arm::Relocate::relocate): Properly set local ifunc address.
361         (Target_arm::do_dynsym_value): Properly set global ifunc address.
362         (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
363         (Output_data_plt_arm::IRelative_data): New type.
364         (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
365         (Output_data_plt_arm::add_entry): Add more parameters.
366         (Output_data_plt_arm::add_relocation): New method.
367         (Output_data_plt_arm::add_local_ifunc_entry): New method.
368         (Output_data_plt_arm::rel_irelative): New method.
369         (Output_data_plt_arm::entry_count): Modified.
370         (Output_data_plt_arm::address_for_global): New method.
371         (Output_data_plt_arm::address_for_local): New method.
372 gold/
373         (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
374         (Output_data_plt_arm::insert_irelative_data): New method.
375         (Output_data_plt_arm::irelative_rel_): New member.
376         (Output_data_plt_arm::got_): New member.
377         (Output_data_plt_arm::got_irelative_): New member.
378         (Output_data_plt_arm::irelative_count_): New member.
379         (Output_data_plt_arm::IRelative_data_vec): New typedef.
380         (Output_data_plt_arm::irelative_data_vec_): New member.
381         (Output_data_plt_arm::do_write): Write out irelative entries.
382         (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
383         more parameters to ctor.
384         (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
385         more parameters to ctor.
386         * output.h (Output_data_reloc::add_local_relative): New method.
387         * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
388
389 2015-01-29  Alan Modra  <amodra@gmail.com>
390
391         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
392         and GOT_TLSGD to LE optimization.
393
394 2015-01-28  Cary Coutant  <ccoutant@google.com>
395
396         * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
397         for undef TLS symbols.
398         (Target_x86_64::Relocate::relocate_tls): Likewise.
399         (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
400
401 2015-01-25  Cary Coutant  <ccoutant@google.com>
402
403         * output.cc (Output_segment::set_section_addresses): Fix calculation
404         of size of relro segment.
405
406 2015-01-22  Alan Modra  <amodra@gmail.com>
407
408         * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
409         condition for need of ifunc plt entry.
410         (Target_powerpc::Scan::global <got relocs>): Likewise.
411
412 2015-01-14  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
413
414         * mips.cc (reloc_high): Add r_sym.
415         (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
416         reloc_high constructor.
417         (Mips_relocate_functions::relgot16_local): Likewise.
418         (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
419         r_type to decide whether LO16 matches HI16.
420         (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
421         rello16 and relgot16_local.
422
423 2015-01-09  Cary Coutant  <ccoutant@google.com>
424
425         * layout.cc (Layout::set_segment_offsets): Don't align start of segment
426         unless alignment is larger than page size.
427
428 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
429             Cary Coutant  <ccoutant@google.com>
430
431         PR gold/17729
432         * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
433         (DEFAULT_TARGET_X32): Set for x32.
434         * x86_64.cc (cmp_insn_32): New.
435         (lea_r10_insn_32): Likewise.
436         (lea_r11_insn_32): Likewise.
437         (cmp_insn_64): Likewise.
438         (lea_r10_insn_64): Likewise.
439         (lea_r11_insn_64): Likewise.
440         (Target_x86_64<size>::do_calls_non_split): Handle x32.
441         * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
442         (check_DATA): Add split_x32 files.
443         (split_x32_[1234n].o): New targets.
444         (split_x32_[124]): New targets.
445         (split_x32_[1234r].stdout): New targets.
446         * testsuite/split_x32.sh: New file.
447         * testsuite/split_x32_1.s: Likewise.
448         * testsuite/split_x32_2.s: Likewise.
449         * testsuite/split_x32_3.s: Likewise.
450         * testsuite/split_x32_4.s: Likewise.
451         * testsuite/split_x32_n.s: Likewise.
452         * configure: Regenerated.
453         * testsuite/Makefile.in: Likewise.
454
455 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
456
457         PR gold/17809
458         * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
459         x32.
460
461 2015-01-02  Alan Modra  <amodra@gmail.com>
462
463         * version.cc (print_version): Just print current year.
464         * dwp.cc (print_version): Likewise.
465
466 2015-01-01  Alan Modra  <amodra@gmail.com>
467
468         Update year range in copyright notice of all files.
469
470 2014-12-25  Alan Modra  <amodra@gmail.com>
471
472         * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
473         new enums.
474         (Target_arm::merge_object_attributes, ): Likewise.
475
476 2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
477
478         * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
479         as hard float only when Tag_ABI_VFP_args is 1, using new enum value
480         AEABI_VFP_args_vfp to check that.
481         (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
482         value and replace hardcoded values by enum values.
483
484 2014-12-22  Cary Coutant  <ccoutant@google.com>
485
486         * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
487
488 2014-12-20  H.J. Lu  <hongjiu.lu@intel.com>
489
490         PR gold/14608
491         * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
492         to "return i * i * 3;".
493
494 2014-12-16  Cary Coutant  <ccoutant@google.com>
495
496         * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
497         (Mapfile::print_output_data): Use current_data_size() to avoid
498         assert for sections requiring postprocessing; if address is not valid,
499         print 0.
500         (Mapfile::print_output_section): Use current_data_size(); print note
501         that addresses and sizes are before compression.
502
503 2014-12-14  H.J. Lu  <hongjiu.lu@intel.com>
504
505         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
506         Cast current_group_size to unsigned long when reporting error.
507
508 2014-12-10  Jing Yu  <jingyu@google.com>
509
510         * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
511         (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
512         Update error message.
513         (Target_aarch64::do_relax): Use absolute value of option
514         stub_group_size. Replace local variable with class member
515         stub_group_size_.
516
517 2014-12-04  Alan Modra  <amodra@gmail.com>
518
519         * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
520         addend of PLTREL24 reloc when not generating a plt stub.  Make
521         max_branch_offset an "Address".
522         (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
523         (Target_powerpc::Relocate::relocate): Likewise.
524
525 2014-12-04  Alan Modra  <amodra@gmail.com>
526
527         PR 17670
528         * symtab.cc (Symbol::set_undefined): Remove assertion.
529         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
530         on symbols defined in discarded sections, instead return false.
531         Rearrange params, update all callers.
532         (Target_powerpc::Branch_info::make_stub): Don't make stubs for
533         branches to syms in discarded sections.
534         (Global_symbol_visitor_opd::operator()): Set discarded opd syms
535         undefined and flag as discarded.
536         (Target_powerpc::Relocate::relocate): Localize variable.
537
538 2014-12-03  H.J. Lu  <hongjiu.lu@intel.com>
539
540         PR gold/17675
541         * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
542         * testsuite/Makefile.in: Regenerated.
543
544 2014-12-03  Alan Modra  <amodra@gmail.com>
545
546         PR 17566
547         * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
548         when adding dynamic relocations against section symbols.
549
550 2014-12-01  Dimitry Ivanov <dimitry@google.com>
551
552         * layout.cc (Layout::finish_dynamic_section): When '-z global'
553         is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
554         * options.h (General_options): New -z option (global).
555
556 2014-12-01  Cary Coutant  <ccoutant@google.com>
557
558         PR gold/17578
559         * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
560         is given.
561         (Layout::create_executable_stack_info): Warn when -z noexecstack is
562         given but some inputs require executable stack.
563
564 2014-11-26  Cary Coutant  <ccoutant@google.com>
565
566         * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
567         .debug_str_offsets; strip .debug_gnu_pubnames and
568         .debug_gnu_pubtypes.
569         (lines_only_debug_sections): Strip all four new sections.
570
571 2014-11-26  Jing Yu  <jingyu@google.com>
572
573         * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
574         register to be x0 when to relax TLSDESC_LD64_LO12.
575
576 2014-11-26  Alan Modra  <amodra@gmail.com>
577
578         * powerpc.cc (struct Stub_table_owner): New.
579         (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
580         unsigned int vector.  Update all references.
581         (powerpc_relobj::set_stub_table): Take an unsigned int param
582         rather than a Stub_table.  Update callers.
583         (Powerpc_relobj::clear_stub_table): New function.
584         (Target_powerpc): Add relax_failed_, relax_fail_count_ and
585         stub_group_size_ vars.
586         (Target_powerpc::new_stub_table): Delete.
587         (max_branch_delta): New function, extracted from..
588         (Target_powerpc::Relocate::relocate): ..here..
589         (Target_powerpc::Branch_info::make_stub): ..and here.  Return
590         status on whether stub created successfully.
591         (Stub_control::Stub_control): Add "no_size_errors" param.  Move
592         default sizing to..
593         (Target_powerpc::do_relax): ..here.  Init stub_group_size_ and
594         reduce on relax failure.
595         (Target_powerpc::group_sections): Add "no_size_errors" param.
596         Use stub_group_size_.  Set up group info in a temp vector,
597         before building Stub_table vector.  Account for input sections
598         possibly already converted to relaxed sections.
599         (Stub_table::init): Delete.  Merge into..
600         (Stub_table::Stub_table): ..here.
601         (Stub_table::can_reach_stub): New function.
602         (Stub_table::add_plt_call_entry): Add "from" parameter and
603         return true iff stub could be reached.
604         (Stub_table::add_long_branch_entry): Similarly.  Add "r_type"
605         param too.
606         (Stub_table::clear_stubs): Add "all" param.
607
608 2014-11-26  Alan Modra  <amodra@gmail.com>
609
610         * powerpc.cc (Stub_control::set_output_and_owner): New function.
611         (Target_powerpc::group_sections): Use it.
612
613 2014-11-25  Cary Coutant  <ccoutant@google.com>
614
615         * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
616         (Binary_to_elf::write_symbol): Add st_size parameter.
617         * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
618
619 2014-11-25  Cary Coutant  <ccoutant@google.com>
620
621         PR gold/17639
622         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
623         (Sized_relobj_file::do_layout): Handle deferred sections properly
624         during GC pass 1. Don't add reloc sections to deferred list twice.
625         * object.h (Sized_relobj_file::is_deferred_layout): New function.
626         (Sized_relobj_file::is_deferred_layout_): New data member.
627
628 2014-11-21  H.J. Lu  <hongjiu.lu@intel.com>
629
630         PR gold/17619
631         * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
632         Check PC-relative offset overflow in PLT entry.
633
634 2014-11-21  Alan Modra  <amodra@gmail.com>
635
636         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
637         for undefined weaks.
638
639 2014-11-20  Alan Modra  <amodra@gmail.com>
640
641         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
642         from --stub-group-size parameter divided by 1024.
643         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
644         template parameter.  Update all uses.
645         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
646         has_stub_value.  Set for long branches.  Don't report overflow for
647         branch to undefined weak symbols.  Print info message on
648         overflowing branch to stub.
649
650 2014-11-20  Alan Modra  <amodra@gmail.com>
651
652         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
653
654 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
655
656         * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
657         entry for R_X86_64_GOTPLT64.
658         (Target_x86_64<size>::Relocate::relocate): Update comments for
659         R_X86_64_GOTPLT64.
660
661 2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>
662
663         * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
664         * plugin.h: add lock definition
665
666 2014-10-29  Han Shen  <shenhan@google.com>
667             Jing Yu   <jingyu@google.com>
668
669         * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
670         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
671         TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
672         Symbol::TLS_REF.
673         * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
674         method.
675         (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
676         (Target_aarch64::tls_ld_to_le): New method.
677         (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
678         for 64bit targets.
679         (Output_data_plt_aarch64::irelative_rel_): New data member.
680         (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
681         (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
682         (Output_data_plt_aarch64::add_relocation): New method.
683         (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
684         offset. Add got_irelative size to got size.
685         (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
686         type string with the new typename.
687         (AArch64_relocate_functions::update_adr): Replace parameter x with
688         immed.
689         (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
690         (AArch64_relocate_functions::reloc_common): New method.
691         (AArch64_relocate_funcsions::rela_general): Extract common part out
692         into reloc_common method.
693         (AArch64_relocate_functions::rela_general): Likewise.
694         (AArch64_relocate_functions::pcrela_general): Likewise.
695         (AArch64_relocate_functions::adr): New method.
696         (AArch64_relocate_functions::adrp): Calculate immed before calling
697         update_adr.
698         (AArch64_relocate_functions::adrp): Likewise.
699         (AArch64_relocate_functions::movnz): Cast x to SignedW type when
700         comparing x to 0. Calculate immed from ~x when x < 0.
701         (Target_aarch64::optimize_tls_reloc): Add new cases for
702         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
703         TLSLD_MOVW_DTPREL_G0_NC.
704         (Target_aarch64::possible_function_pointer_reloc): Implement this
705         method.
706         (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
707         comment.
708         (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
709         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
710         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
711         (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
712         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
713         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
714         (Target_aarch64::make_plt_entry): Call add_entry with two more
715         parameters.
716         (Target_aarch64::make_local_ifunc_plt_entry): New method.
717         (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
718         ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
719         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
720         (Target_aarch64::Relocate::relocate_tls): Add cases for
721         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
722         TLSLD_MOVW_DTPREL_G0_NC.
723         * testsuite/icf_safe_so_test.cc: Correct test comment.
724         * testsuite/icf_safe_test.sh: Add AArch64 arch.
725
726 2014-10-22  Alan Modra  <amodra@gmail.com>
727
728         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
729         thread_starter.
730
731 2014-10-18  Andreas Schwab  <schwab@linux-m68k.org>
732
733         * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
734
735 2014-10-17  Cary Coutant  <ccoutant@google.com>
736
737         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
738         Add "typename" keyword.
739
740 2014-10-15  Han Shen  <shenhan@google.com>
741             Jing Yu   <jingyu@google.com>
742
743         Patch for gold aarch64 backend to support relaxation.
744         * aarch64-reloc.def: Change format.
745         * aarch64.cc (class Reloc_stub): New class.
746         (class Stub_table): New class.
747         (class AArch64_relobj): New class.
748         (class AArch64_input_section): New class.
749         (class AArch64_output_section): New class.
750         (Target_aarch64::new_stub_table): New method.
751         (Target_aarch64::new_aarch64_input_section): New method.
752         (Target_aarch64::find_aarch64_input_section): New method.
753         (Target_aarch64::scan_section_for_stubs): New method.
754         (Target_aarch64::scan_reloc_section_for_stubs): New method.
755         (Target_aarch64::relocate_stub): New method.
756         (Target_aarch64::current_target): New method.
757         (Target_aarch64::do_make_elf_object): New method.
758         (Target_aarch64::do_may_relax): New method.
759         (Target_aarch64::do_relax): New method.
760         (Target_aarch64::group_sections): New method.
761         (Target_aarch64::scan_reloc_for_stub): New method.
762         (Target_aarch64::do_make_output_section): New method.
763         (Target_aarch64::stub_tables_): New data member.
764         (Target_aarch64::aarch64_input_section_map_): New data member.
765         (AArch64_relocate_functions::maybe_apply_stub): New method.
766
767 2014-09-30  Cary Coutant  <ccoutant@google.com>
768
769         PR gold/17432
770         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
771
772 2014-09-30  Kito Cheng  <kito@0xlab.org>
773
774         PR gold/13597
775         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
776         hash table before sysv-style hash table.
777
778 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
779
780         * options.h (--pic-executable): Add negative to alias to -no-pie.
781
782 2014-09-26  Cary Coutant  <ccoutant@google.com>
783
784         PR gold/16773
785         * object.cc (Sized_relobj_file): Compute value of section symbols
786         for TLS sections the same as TLS symbols.
787
788 2014-09-25  Cary Coutant  <ccoutant@google.com>
789
790         PR gold/17432
791         * resolve.cc (Symbol_table::resolve): Override common placeholder
792         symbols, but adjust sizes.
793         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
794         symbols to common lists.
795
796 2014-09-24  Alan Modra  <amodra@gmail.com>
797
798         * po/POTFILES.in: Regenerate.
799
800 2014-09-23  Taiju Tsuiki  <tzik@google.com>
801             Cary Coutant  <ccoutant@google.com>
802
803         PR gold/14860
804         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
805         on input_sections_blocker.
806         * layout.cc (Write_sections_task::locks): Unblock
807         input_sections_blocker_.
808         * layout.h (Write_sections_task::Write_sections_task): Add
809         input_sections_blocker.
810         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
811         to DEPENDENCIES.
812         * testsuite/Makefile.in: Regenerate.
813
814 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
815
816         * testsuite/Makefile.am (plugin_test_10): New test.
817         * testsuite/Makefile.in: Regenerate
818         * testsuite/plugin_common_test_2.c (c1): Align to 8.
819         * testsuite/plugin_test_10.sh: New file.
820
821 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
822
823         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
824         * resolve.cc (Symbol_table::resolve): Don't override common symbols
825         during the replacement phase.
826
827 2014-09-17  Han Shen  <shenhan@google.com>
828             Jing Yu  <jingyu@google.com>
829
830         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
831         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
832         * aarch64.cc (Target_aarch64): Add data members
833         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
834         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
835         constructor.
836         (Target_aarch64::do_reloc_symbol_index): New method.
837         (Target_aarch64::do_reloc_addend): New method.
838         (Target_aarch64::add_tlsdesc_info): New method.
839         (Target_aarch64::do_dynsym_value): New method.
840         (Target_aarch64::do_make_data_plt): Add new parameters: got,
841         got_irelative. Pass them to Output_data_plt_aarch64_standard.
842         (Target_aarch64::make_data_plt): Add new parameters: got,
843         got_irelative. Pass them to do_make_data_plt.
844         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
845         (Target_aarch64::Relocate:tls_gd_to_le): New method.
846         (Target_aarch64::Relocate:tls_ie_to_le): New method.
847         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
848         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
849         (Target_aarch64::got_tlsdesc_section): New method.
850         (Target_aarch64::make_local_ifunc_plt_entry): New method.
851         (Target_aarch64::define_tls_base_symbol): New method.
852         (Target_aarch64::reserve_tlsdesc_entries): New method.
853         (Target_aarch64::got_mod_index_entry): New method.
854         (Target_aarch64::rela_tlsdesc_section): New method.
855         (Target_aarch64::rela_irelative_section): New method.
856         (Target_aarch64::Tlsdesc_info): New struct.
857         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
858         relocations and tlsdesc relocations.
859         (Target_aarch64::optimize_tls_reloc): Implement method.
860         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
861         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
862         in constructor.
863         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
864         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
865         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
866         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
867         (Output_data_plt_aarch64::rela_tlsdesc): New method.
868         (Output_data_plt_aarch64::rela_irelative): New method.
869         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
870         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
871         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
872         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
873         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
874         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
875         (Output_data_plt_aarch64_standard): New member variables:
876         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
877         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
878         New parameter: got, got_irelative.
879         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
880         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
881         (Output_data_plt_aarch64::do_write): Replace got_address with
882         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
883         (AArch64_relocate_functions::update_movnz): New method.
884         (AArch64_relocate_functions): Correct format.
885         (AArch64_relocate_functions::movnz): New method.
886         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
887         before the switch. Add new cases to switch.
888         Check ie_to_le relaxation on tlsie relocations. Add code handling
889         tlsgd tlsdesc cases.
890         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
891         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
892         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
893         Call reloc_name_in_error_message to print unsupported reloc.
894         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
895         make_data_plt.
896         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
897         relocs. Fill in some more dynamic tags.
898         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
899         Skip call tls_get_addr when tlsgd is relaxed.
900         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
901         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
902         tlsdesc->ie relaxation.
903
904 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
905
906         * mips.cc (Target_mips_nacl): New class.
907         (Target_selector_mips_nacl): New class.
908         (target_selector_mips32): Rename from target_selector_mips32be and use
909         Target_selector_mips_nacl instead of Target_selector_mips.
910         (target_selector_mips32el): Rename from target_selector_mips32 and use
911         Target_selector_mips_nacl instead of Target_selector_mips.
912         (target_selector_mips64): Rename from target_selector_mips64be and use
913         Target_selector_mips_nacl instead of Target_selector_mips.
914         (target_selector_mips64el): Rename from target_selector_mips64 and use
915         Target_selector_mips_nacl instead of Target_selector_mips.
916         (Target_mips::mips_info): Add const attribute.
917
918 2014-09-02  Cary Coutant  <ccoutant@google.com>
919
920         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
921         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
922         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
923         (Sized_incr_dynobj::do_section_name): Likewise.
924         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
925         (Sized_incr_dynobj::do_section_name): Likewise.
926         * object.h (Object::section_name): Likewise.
927         (Object::do_section_name): Likewise.
928         (Sized_relobj_file::do_section_name): Likewise.
929         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
930         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
931
932 2014-09-02  Cary Coutant  <ccoutant@google.com>
933
934         PR gold/17005
935         * ehframe.cc (Fde::write): Add output_offset parameter.
936         (Cie::write): Likewise.
937         (Eh_frame::set_final_data_size): Account for offset within output
938         section.
939         (Eh_frame::do_sized_write): Likewise.
940         * ehframe.h (Fde::write): Add output_offset parameter.
941         (Cie::write): Likewise.
942         * output.cc (Output_section::Input_section_sort_entry): Remove
943         section_has_name_; add output_section_name parameter. Use
944         output section name for non-input sections.
945         (Output_section::Input_section_sort_entry::section_has_name): Remove.
946         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
947         (Output_section::Input_section_sort_compare): Remove logic for
948         sections without names.
949         (Output_section::Input_section_sort_init_fini_compare): Likewise.
950         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
951         Likewise.
952         (Output_section::Input_section_sort_section_name_compare): Likewise.
953
954 2014-08-29 Han Shen <shenhan@google.com>
955            Jing Yu <jingyu@google.com>
956
957         * aarch64-reloc-property.cc
958         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
959         reference reloc property in the table.
960         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
961         3 other entries.
962         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
963         2 new overloaded methods.
964         (Output_data_got_aarch64::do_write): Add code to write out
965         static relocs.
966         (class Output_data_got_aarch64::Static_reloc): New class to wrap
967         static relocs.
968         (Output_data_got_aarch64::static_relocs): New vector to
969         hold static relocs.
970         (Target_aarch64::TCB_SIZE): New const static memeber.
971         (Target_aarch64::tcb_size): New method.
972         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
973         (Target_aarch64::Relocate::relocate_tls): New method.
974         (Target_aarch64::Scan::local): Add code handling new reloc types.
975         (Target_aarch64::Scan::global): Add code handling new reloc types.
976
977 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
978
979         * options.h (-no-pie): Add option.
980
981 2014-08-08  Jing Yu  <jingyu@google.com>
982             Han Shen  <shenhan@google.com>
983
984         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
985         (DEFFILES): add aarch64-reloc.def.
986         (TARGETSOURCES): Add aarch64-reloc-property.cc.
987         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
988         * Makefile.in: Regenerate.
989         * aarch64-reloc-property.cc: New file.
990         * aarch64-reloc-property.h: New file.
991         * aarch64-reloc.def: New file.
992         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
993         with tab to make the format consistent.
994         (Output_data_got_aarch64::symbol_table_): New method.
995         (Target_aarch64::do_plt_address_for_global): New method.
996         (Target_aarch64::do_plt_address_for_local): New method.
997         (Target_aarch64::do_select_as_default_target): New method.
998         (Target_aarch64::do_make_data_plt): New method.
999         (Target_aarch64::make_data_plt): New method.
1000         (Output_data_plt_aarch64::has_irelative_section): New method.
1001         (Output_data_plt_aarch64::address_for_global): New method.
1002         (Output_data_plt_aarch64::address_for_local): New method.
1003         (Output_data_plt_aarch64::irelative_rel_): New parameter.
1004         (Output_data_plt_aarch64::add_entry): Implement contents.
1005         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
1006         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
1007         the got_pov entry to plt0.
1008         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
1009         Implement contents.
1010         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
1011         (AArch64_howto): New struct.
1012         (aarch64_howto[]): New static const array.
1013         (AArch64_relocate_functions): New class.
1014         (Target_aarch64::Scan::get_reference_flags): Remove method.
1015         (Target_aarch64::Scan::local): Implement to support a few relocations.
1016         (Target_aarch64::Scan::global): Implement to support a few relocations.
1017         (Target_aarch64::make_plt_section): Implement contents.
1018         (Target_aarch64::make_plt_entry): Implement contents.
1019         (Target_aarch64::do_finalize_sections): Implement contents.
1020         (Target_aarch64::Relocate::relocate): Implement a few relocations.
1021         (Target_aarch64::relocate_section): Implement contents.
1022
1023 2014-08-06  Alan Modra  <amodra@gmail.com>
1024
1025         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
1026
1027 2014-08-06  Alan Modra  <amodra@gmail.com>
1028
1029         PR 13227
1030         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
1031
1032 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
1033
1034         * object.cc (Relobj::is_section_name_included): Add
1035         ".rodata.nptl_version" to not garbage collect this section.
1036
1037 2014-07-08  Cary Coutant  <ccoutant@google.com>
1038
1039         * expression.cc (struct Expression::Expression_eval_info): Add
1040         new fields type_pointer, vis_pointer, and nonvis_pointer.
1041         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
1042         nonvis_pointer parameters. Adjust all calls.
1043         (Symbol_expression::value): Update type, visibility, and nonvis bits
1044         in caller.
1045         * script.cc (Symbol_assignment::sized_finalize): Update type,
1046         visibility, and remaining st_other bits for new symbol.
1047         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
1048         vis_pointer, and nonvis_pointer parameters.
1049         * symtab.h (Symbol::set_type): New method.
1050
1051         * testsuite/Makefile.am (defsym_test): New test.
1052         * testsuite/Makefile.in: Regenerate.
1053         * testsuite/defsym_test.c: New file.
1054         * testsuite/defsym_test.sh: New file.
1055
1056 2014-07-08  Cary Coutant  <ccoutant@google.com>
1057
1058         PR gold/15639
1059         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
1060         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
1061         (Sized_dynobj::base_read_symbols): ...new method.
1062         * object.h (Sized_relobj_file::base_read_symbols): New method.
1063         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
1064         (Sized_relobj_file::base_read_symbols): ...new method.
1065         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
1066         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
1067         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
1068
1069 2014-07-04  Alan Modra  <amodra@gmail.com>
1070
1071         * po/POTFILES.in: Regenerate.
1072
1073 2014-07-02  Jing Yu  <jingyu@google.com>
1074
1075         * aarch64.cc: New file
1076         * Makefile.am (TARGETSOURCES): Add aarch64.cc
1077         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
1078         * Makefile.in: Regenerate.
1079         * configure.tgt: Add entries for aarch64*.
1080         * configure.ac:  Likewise.
1081         * configure: Likewise.
1082
1083 2014-06-27  Alan Modra  <amodra@gmail.com>
1084
1085         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
1086
1087 2014-06-24  Cary Coutant  <ccoutant@google.com>
1088
1089         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
1090         sections.
1091         (Dwo_file::sized_read_unit_index): Likewise.
1092
1093 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1094
1095         * mips.cc: New file.
1096         * Makefile.am (TARGETSOURCES): Add mips.cc
1097         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
1098         * configure.tgt: Add entries for mips*.
1099         * configure.ac: Likewise.
1100         * Makefile.in: Regenerate.
1101         * configure: Likewise.
1102
1103 2014-06-09  Cary Coutant  <ccoutant@google.com>
1104
1105         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
1106         unit_length is within section bounds.
1107
1108 2014-06-09  Cary Coutant  <ccoutant@google.com>
1109
1110         PR gold/16980
1111         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
1112         map.
1113
1114 2014-06-07  Alan Modra  <amodra@gmail.com>
1115
1116         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
1117
1118 2014-06-06  Cary Coutant  <ccoutant@google.com>
1119
1120         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
1121         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
1122         (Dwarf_pubnames_table::read_header): Likewise.
1123         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
1124         .debug_gnu_pubtypes.
1125
1126 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
1127
1128         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
1129         * Makefile.in, configure: Regenerate.
1130
1131 2014-06-03  Alan Modra  <amodra@gmail.com>
1132
1133         * powerpc.cc (addis_12_2): Define.
1134         (Stub_table::do_write): Support fusion on ELFv2 stubs.
1135
1136 2014-06-03  Alan Modra  <amodra@gmail.com>
1137
1138         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
1139         st_other output.
1140
1141 2014-06-02  Alan Modra  <amodra@gmail.com>
1142
1143         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
1144         Only ignore relocs on ELFv1.
1145         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
1146
1147 2014-05-30  Cary Coutant  <ccoutant@google.com>
1148
1149         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
1150         * testsuite/Makefile.in: Regenerate.
1151         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
1152
1153 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
1154
1155         PR gold/16945
1156         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
1157         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
1158
1159 2014-05-15  Alan Modra  <amodra@gmail.com>
1160
1161         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
1162         Compare FDE contents with DW_CFA_nop rather than 0.
1163
1164 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
1165
1166         * symtab.h (may_need_copy_reloc): Remove check for position independent
1167         code.
1168         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
1169         position independence before pc absolute may_need_copy_reloc call.
1170         Add check for executable output befor pc relative may_need_copy_reloc
1171         call.
1172         * i386.cc: Ditto.
1173         * arm.cc: Ditto.
1174         * sparc.cc: Ditto.
1175         * tilegx.cc: Ditto.
1176         * powerpc.cc: Add check for no position independence before
1177         may_need_copy_reloc calls.
1178         * testsuite/pie_copyrelocs_test.cc: New file.
1179         * testsuite/pie_copyrelocs_shared_test.cc: New file.
1180         * Makefile.am (pie_copyrelocs_test): New test.
1181         * Makefile.in: Regenerate.
1182
1183 2014-05-08  Martin Liška  <mliska@suse.cz>
1184
1185         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
1186
1187 2014-05-06  Cary Coutant  <ccoutant@google.com>
1188
1189         PR gold/16900
1190         * i386.cc (Output_data_got_plt_i386): New class.
1191         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
1192         parameter. Change all callers.
1193         (Output_data_plt_i386::layout_): Remove.
1194         (Output_data_plt_i386::got_plt_): Change type.
1195         (Target_i386::got_plt_): Change type. Change all references.
1196         (Target_i386::got_section): Create instance of new class.
1197         (Output_data_got_plt_i386::do_write): New function.
1198         * x86_64.cc (Output_data_got_plt_x86_64): New class.
1199         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
1200         parameter. Change all callers.
1201         (Output_data_plt_x86_64::layout_): Remove.
1202         (Output_data_plt_x86_64::got_plt_): Change type.
1203         (Target_x86_64::got_plt_): Change type. Change all references.
1204         (Target_x86_64::got_section): Create instance of new class.
1205         (Output_data_got_plt_x86_64::do_write): New function.
1206         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
1207         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
1208         class.
1209
1210 2014-05-05  Cary Coutant  <ccoutant@google.com>
1211
1212         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
1213         if we have pubnames/pubtypes.
1214
1215 2014-05-02  Cary Coutant  <ccoutant@google.com>
1216
1217         * defstd.cc (in_segment): Define __ehdr_start here...
1218         * layout.cc (Layout::finalize): ...Instead of here.  Set the
1219         output segment when known.
1220         * resolve.cc (Symbol::override_base_with_special): Remember
1221         the original binding.
1222         * symtab.cc (Symbol::set_output_segment): New function.
1223         (Symbol::set_undefined): New function.
1224         * symtab.h (Symbol::is_weak_undefined): Check original undef
1225         binding.
1226         (Symbol::is_strong_undefined): New function.
1227         (Symbol::set_output_segment): New function.
1228         (Symbol::set_undefined): New function.
1229         * target-reloc.h (is_strong_undefined): Remove.
1230         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
1231         Check for hidden undefs.
1232         (relocate_section): Call Symbol::is_strong_undefined.
1233
1234         * testsuite/Makefile.am (ehdr_start_test_1)
1235         (ehdr_start_test_2, ehdr_start_test_3)
1236         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
1237         * testsuite/Makefile.in: Regenerate.
1238         * testsuite/ehdr_start_def.cc: New source file.
1239         * testsuite/ehdr_start_test.cc: New source file.
1240         * testsuite/ehdr_start_test.t: New linker script.
1241         * testsuite/ehdr_start_test_4.sh: New shell script.
1242
1243 2014-04-23  Cary Coutant  <ccoutant@google.com>
1244
1245         PR gold/16870
1246         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
1247
1248 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1249
1250         * layout.cc (Layout::include_section): Allow a target to decide
1251         whether to include a section.
1252         * target.h (Target::should_include_section): New function.
1253         (Target::do_should_include_section): New function.
1254
1255 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1256
1257         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
1258         inline into ...
1259         (Copy_relocs::emit): ... here.
1260         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
1261         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
1262         (Copy_reloc_entry::entries_): Change from private to protected.
1263
1264 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
1265
1266         * icf.cc (get_section_contents): Replace copies of reloc
1267         vectors with const references.
1268
1269 2014-04-02  Cary Coutant  <ccoutant@google.com>
1270
1271         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
1272         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
1273         * configure: Regenerate.
1274         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
1275         -fno-use-linker-plugin.
1276         (LINK1, CXXLINK1): Add it to the link command.
1277         * testsuite/Makefile.in: Regenerate.
1278
1279 2014-03-12  Alan Modra  <amodra@gmail.com>
1280
1281         * Makefile.in: Regenerate.
1282
1283 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1284
1285         * symtab.h (Symbol::set_nonvis): New function.
1286
1287 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1288
1289         * symtab.cc (Sized_symbol<32>::init_output_data):
1290         Instantiate the template.
1291         (Sized_symbol<64>::init_output_data): Likewise.
1292
1293 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1294
1295         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
1296         adjust dynamic symbol value.
1297         * target.h (Target::adjust_dyn_symbol): New function.
1298         (Target::do_adjust_dyn_symbol): New function.
1299
1300 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1301
1302         * output.cc (Output_data_dynamic::Dynamic_entry::write):
1303         Get the value of DYNAMIC_CUSTOM dynamic entry.
1304         * output.h (Output_data_dynamic::add_custom): New function.
1305         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
1306         dynamic entry.
1307         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
1308         * target.h (Target::dynamic_tag_custom_value): New function.
1309         (Target::do_dynamic_tag_custom_value): New function.
1310
1311 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1312
1313         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
1314         dynsym indexes.
1315         * target.h (Target::has_custom_set_dynsym_indexes): New function.
1316         (Target::do_has_custom_set_dynsym_indexes): New function.
1317         (Target::set_dynsym_indexes): New function.
1318         (Target::do_set_dynsym_indexes): New function.
1319
1320 2014-03-07  Alan Modra  <amodra@gmail.com>
1321
1322         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
1323         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
1324         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
1325         (Powerpc_relocate_functions::has_overflow_bitfield,
1326         overflowed): Use the above.
1327         (Target_powerpc::Relocate::relocate): Correct overflow checking
1328         for a number of relocations.  Modify overflow test for 16-bit
1329         fields in instructions to signed/unsigned according to whether
1330         the field takes a signed or unsigned value.
1331
1332 2014-03-05  Alan Modra  <amodra@gmail.com>
1333
1334         Update copyright years.
1335
1336 2014-03-05  Alan Modra  <amodra@gmail.com>
1337
1338         * powerpc.cc (Target_powerpc::Scan::local, global): Support
1339         R_PPC64_ADDR64_LOCAL.
1340         (Target_powerpc::Relocate::relocate): Likewise.
1341
1342 2014-03-03  Alan Modra  <amodra@gmail.com>
1343
1344         * dwp.cc (print_version): Update copyright year to current.
1345
1346 2014-02-10  Alan Modra  <amodra@gmail.com>
1347
1348         * po/gold.pot: Regenerate.
1349
1350 2014-02-06  Cary Coutant  <ccoutant@google.com>
1351
1352         Fix problem where -u is ignored when a weak undef is seen.
1353
1354         * archive.cc (Library_base::should_include_member): Reorder
1355         code to check for -u option if a weak undef has already been seen.
1356         * testsuite/Makefile.am (weak_undef_test_2): New test case.
1357         * testsuite/Makefile.in: Regenerate.
1358         * testsuite/weak_undef_file3.cc: New file.
1359         * testsuite/weak_undef_file4.cc: New file.
1360         * testsuite/weak_undef_test_2.cc: New file.
1361
1362 2014-02-05  Cary Coutant  <ccoutant@google.com>
1363
1364         Fix issues with gold undefined symbol diagnostics.
1365
1366         PR binutils/15435
1367         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
1368         check to here.
1369         * target-reloc.h (is_strong_undefined): New function.
1370         (relocate_section): Move undef vtable symbol check from here.
1371         Check for is_strong_undefined.
1372
1373 2014-02-05  Cary Coutant  <ccoutant@google.com>
1374
1375         Fix problems with the --dynamic-list option.
1376
1377         PR gold/13577
1378         * options.cc (General_options::parse_dynamic_list):
1379         Set have_dynamic_list_.
1380         (General_options::General_options): Initialize have_dynamic_list_.
1381         (General_options::finalize): Turn off -Bsymbolic and
1382         -Bsymbolic-functions if --dynamic-list provided.
1383         * options.h (General_options::have_dynamic_list): New function.
1384         (General_options::have_dynamic_list_): New data member.
1385         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
1386         correctly.
1387
1388         PR gold/16530
1389         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
1390         in --dynamic-list, mark it.
1391
1392         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
1393         (dynamic_list_2): New test case.
1394         * testsuite/Makefile.in: Regenerate.
1395         * testsuite/dynamic_list_2.cc: New file.
1396         * testsuite/dynamic_list_2.t: New file.
1397         * testsuite/dynamic_list_lib1.cc: New file.
1398         * testsuite/dynamic_list_lib2.cc: New file.
1399         * testsuite/gc_dynamic_list_test.c: New file.
1400         * testsuite/gc_dynamic_list_test.sh: New file.
1401         * testsuite/gc_dynamic_list_test.t: New file.
1402
1403 2014-01-28  Cary Coutant  <ccoutant@google.com>
1404
1405         Add .gdb_index version 7 support.
1406
1407         * gold/dwarf_reader.cc: include <utility> (for make_pair).
1408         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
1409         debug sections.
1410         (Dwarf_ranges_table::read_ranges_table): Likewise.
1411         (Dwarf_pubnames_table::read_section): Check for GNU-style
1412         sections, and for compressed debug sections.
1413         (Dwarf_pubnames_table::read_header): Compute end address of table.
1414         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
1415         for end of list by offset, not by offset == 0.
1416         (Dwarf_info_reader::do_read_string_table): Check for compressed
1417         debug sections.
1418         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1419         Initialize new data members.
1420         (Dwarf_pubnames_table::next_name): return flag_byte.
1421         (Dwarf_pubnames_table::end_of_table_): New data member.
1422         (Dwarf_pubnames_table::is_gnu_style_): New data member.
1423         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
1424         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
1425         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
1426         read skeleton type unit DIEs.
1427         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
1428         (Gdb_index::do_write): Write flag_byte.
1429         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
1430         (Gdb_index::Cu_vector): Store flags along with cu indexes.
1431         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
1432         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
1433
1434 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
1435
1436         * version.cc (print_version): Update copyright year to 2014.
1437
1438 2013-12-19  Dimitry Andric  <dimitry@andric.com>
1439
1440         * stringpool.cc (Stringpool_template::reserve): Add
1441         HAVE_UNORDERED_MAP case.
1442         * stringpool.cc (Stringpool_template::print_stats): Likewise.
1443
1444 2013-12-18  Cary Coutant  <ccoutant@google.com>
1445
1446         * configure.ac: Check for <unordered_set> and <unordered_map>.
1447         * config.in: Regenerate.
1448         * configure: Regenerate.
1449         * system.h: Use <unordered_set> and <unordered_map> if available.
1450
1451 2013-12-10  Roland McGrath  <mcgrathr@google.com>
1452
1453         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
1454         with $(INSTALL_PROGRAM_ENV).
1455         * Makefile.in: Regenerate.
1456
1457 2013-11-22  Cary Coutant  <ccoutant@google.com>
1458
1459         * configure.ac: Add check for which library is needed for
1460         dlopen.
1461         * configure: Regenerate.
1462
1463 2013-11-22  Cary Coutant  <ccoutant@google.com>
1464
1465         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
1466         assembler.
1467         * testsuite/Makefile.in: Regenerate.
1468
1469 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
1470
1471         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
1472         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
1473         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
1474         (Target_x86_64<size>::Scan::local): Likewise.
1475         (Target_x86_64<size>::Scan::global): Likewise.
1476         (Target_x86_64<size>::Relocate::relocate): Likewise.
1477         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
1478         Likewise.
1479         (Target_x86_64<size>::Scan::check_non_pic(): Handle
1480         R_X86_64_PC32_BND.
1481
1482         * testsuite/Makefile.am (check_PROGRAMS): Add
1483         exception_x86_64_bnd_test.
1484         (exception_x86_64_bnd_test_SOURCES): New macro.
1485         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
1486         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
1487         (exception_x86_64_bnd_test_LDADD): Likewise.
1488         (exception_x86_64_bnd_1.o): New rule.
1489         (exception_x86_64_bnd_2.o): Likewise.
1490         * testsuite/Makefile.in: Regenerated.
1491
1492 2013-11-15  Alan Modra  <amodra@gmail.com>
1493
1494         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
1495         accessor.
1496         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
1497         Only call ppc64_local_entry_offset for 64-bit.  Restrict
1498         symval_for_branch lookup to ELFv1.
1499         (Stub_table::add_plt_call_entry): Use unsigned int off.
1500         (Output_data_glink::Address, invalid_address): New.
1501         (Output_data_glink::add_eh_frame): Move out of line.  Add
1502         support for ELFv2.
1503         (Output_data_glink::add_global_entry, find_global_entry,
1504         global_entry_address): New functions.
1505         (Output_data_glink::global_entry_stubs_, end_branch_table_,
1506         ge_size): New variables.
1507         (Output_data_glink::set_final_data_size): Add global entry
1508         stub sizing.
1509         (Output_data_glink::do_write): Write global entry stubs.
1510         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
1511         parameter.  Return true for ELFv2.  Adjust callers.
1512         (Target_powerpc::Scan::local, global): Restrict opd lookup to
1513         ELFv1.  Similarly for ifunc and dynamic relocation processing
1514         specific to ELFv1.  Recognize that symbols are defined on
1515         their plt entries for ELFv2.
1516         (Target_powerpc::symval_for_branch): Assert if called for
1517         ELFv2 or ppc32.
1518         (Target_powerpc::Relocate::relocate): Use global entry plt
1519         stub for symbol value if such exists on ELFv2.
1520         (Target_powerpc::Relocate::relocate): Don't call
1521         symval_for_branch when ELFv2.  Do adjust for local entry
1522         offset when ELFv2.
1523         (Target_powerpc::do_dynsym_value): Set symbols to global entry
1524         plt stub for ELFv2.
1525         (Target_powerpc::do_plt_address_for_global): Similarly.
1526
1527 2013-11-14  Cary Coutant  <ccoutant@google.com>
1528
1529         Revert patch -- this did not fix the problem, and there is
1530         no race there.
1531
1532         2013-11-14  Cary Coutant  <ccoutant@google.com>
1533
1534             PR gold/14860
1535             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1536             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1537             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1538             updating fde_offsets_.
1539             (Eh_frame_hdr::lock_): New data member.
1540
1541 2013-11-14  Cary Coutant  <ccoutant@google.com>
1542
1543         * dwp.cc (Dwo_file_entry): New type.
1544         (File_list): Use Dwo_file_entry.
1545         (Dwo_file::verify): New function.
1546         (Dwo_file::verify_dwo_list): New function.
1547         (Dwo_file::sized_verify_dwo_list): New function.
1548         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
1549         list.
1550         (Dwp_options): New enum type.
1551         (dwp_options): Add --verify-only.
1552         (usage): Likewise.
1553         (main): Likewise.
1554         * dwp.h (gold_info): Add declaration.
1555
1556 2013-11-14  Cary Coutant  <ccoutant@google.com>
1557
1558         PR gold/14860
1559         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1560         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1561         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1562         updating fde_offsets_.
1563         (Eh_frame_hdr::lock_): New data member.
1564
1565 2013-11-06  Cary Coutant  <ccoutant@google.com>
1566
1567         PR gold/15758
1568         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
1569         before reloc sections.
1570
1571 2013-11-04  Alan Modra  <amodra@gmail.com>
1572
1573         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
1574         (Symbol::needs_dynamic_reloc): Test new flag.
1575         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
1576         (Target_powerpc::Scan::get_reference_flags): Add target param.
1577         Return FUNC_DESC_ABI for 64-bit ELFv1.
1578         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
1579         call.
1580         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
1581         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
1582
1583 2013-10-31  Cary Coutant  <ccoutant@google.com>
1584
1585         Restore support for dwp v2 DWARF package file format.
1586
1587         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1588         tu_length parameter.  Adjust all callers.
1589         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1590         * dwp.cc: Include dwarf.h.
1591         (Section_bounds): New struct type.
1592         (Unit_set): New struct type.
1593         (Dwo_file::Dwo_file): Initialize new data member.
1594         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1595         Combine and rename to...
1596         (Dwo_file::read_unit_index): ...this.
1597         (Dwo_file::sized_read_compunit_index)
1598         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1599         (Dwo_file::sized_read_unit_index): ...this.
1600         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1601         parameters; add section_id parameter.
1602         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1603         (Dwo_file::add_unit_set): ...this.
1604         (Dwo_file::shndx_map_): Remove.
1605         (Dwo_file::sect_offsets_): New data member.
1606         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1607         (Dwp_output_file::add_section): Rename to...
1608         (Dwp_output_file::add_contribution): ...this.
1609         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1610         (Dwp_output_file::add_tu_set): Likewise.
1611         (Dwp_output_file::Contribution): New type.
1612         (Dwp_output_file::Section::contributions): New data member.
1613         (Dwp_output_file::Cu_or_tu_set): Remove.
1614         (Dwp_output_file::Section::Section): New ctor.
1615         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1616         (Dwp_output_file::Dwp_index::Section_table): New type.
1617         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1618         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1619         parameter.
1620         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1621         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1622         (Dwp_output_file::Dwp_index::section_table): New member function.
1623         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1624         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1625         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1626         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1627         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1628         (Dwp_output_file::Dwp_index::section_table_): New data member.
1629         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1630         (Dwp_output_file::add_output_section): New member function.
1631         (Dwp_output_file::write_new_section): New member function.
1632         (Dwp_output_file::write_contributions): New member function.
1633         (Dwp_output_file::section_id_map_): New data member.
1634         (class Dwo_id_info_reader): Remove.
1635         (class Unit_reader): New class.
1636         (get_dwarf_section_name): New function.
1637         (Dwo_file::read_executable): Adjust initializations of class data.
1638         (Dwo_file::read): Add support for v2 package file format.
1639         (Dwo_file::read_unit_index): Likewise.
1640         (Dwo_file::sized_read_unit_index): Likewise.
1641         (Dwo_file::copy_section): Likewise.
1642         (Dwo_file::add_unit_set): Likewise.
1643         (Dwp_output_file::add_output_section): Likewise.
1644         (Dwp_output_file::add_contribution): Likewise.
1645         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1646         for empty slot.
1647         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1648         file format.
1649         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1650         slot.
1651         (Dwp_output_file::initialize): Remove unused function.
1652         (Dwp_output_file::finalize): Add support for v2 package file format.
1653         (Dwp_output_file::write_index): Likewise.
1654         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1655         function prototype.
1656
1657 2013-10-31  Cary Coutant  <ccoutant@google.com>
1658
1659         * configure.ac: Fix check for -fmerge-constants.
1660         * configure.ac: Regenerate.
1661
1662 2013-10-30  Roland McGrath  <mcgrathr@google.com>
1663
1664         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
1665         Correct 9-byte nop sequence to match what the assembler generates.
1666
1667 2013-10-30  Alan Modra  <amodra@gmail.com>
1668
1669         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
1670         ppc64_local_entry_offset, ppc64_local_entry_offset,
1671         do_read_symbols): New functions.
1672         (Powerpc_relobj::e_flags_, st_other_): New vars.
1673         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
1674         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
1675         (Powerpc_relobj::e_flags_): New var.
1676         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
1677         and adjust for ELFv2.
1678         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
1679         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
1680         (Powerpc_dynobj::do_find_special_sections): Likewise.
1681         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
1682         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
1683         to ELFv2 local entry.
1684         (Target_powerpc::do_relax): No thread safe barriers needed for
1685         ELFv2.
1686         (Output_data_plt_powerpc::initial_plt_entry_size_,
1687         plt_entry_size): Delete.  Replace all uses with
1688         first_plt_entry_offset() and plt_entry_size().
1689         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
1690         reserved_size parm.  Update callers.
1691         (Output_data_plt_powerpc::entry_count): Update.
1692         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
1693         and use Target_powerpc::first_plt_entry_offset().
1694         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
1695         rename to plt_entry_size.
1696         (Output_data_plt_powerpc::add_ifunc_entry,
1697         add_local_ifunc_entry): Adjust reloc for ELFv2.
1698         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
1699         (glink_eh_frame_fde_64v2): New.
1700         (Stub_table::plt_call_size): Support ELFv2 sizing.
1701         (Output_data_glink::add_eh_frame): Use the new FDE.
1702         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
1703         (Stub_table::do_write): Write ELFv2 stubs and glink.
1704         (Target_powerpc::Relocate::relocate): Replaces nop after call
1705         with ld 2,24(1) and adjust local offset destination for ELFv2.
1706
1707 2013-10-30  Alan Modra  <amodra@gmail.com>
1708
1709         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
1710         (Target_powerpc::Scan::global, local): Likewise.
1711         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
1712         on all ppc64 @h and @ha relocs.
1713
1714 2013-10-14  Alan Modra  <amodra@gmail.com>
1715
1716         * output.h (Output_data_got::add_constant): Tidy.
1717         (Output_data_got::add_constant_pair): New function.
1718         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
1719         methods used so as to first call reserve_ent().
1720
1721 2013-10-11  Roland McGrath  <mcgrathr@google.com>
1722
1723         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
1724         add_got_entry and add_got_entry_pair.
1725
1726         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
1727         (HAVE_PUBNAMES): Likewise.
1728         * configure: Regenerate.
1729
1730         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
1731         * testsuite/Makefile.in: Regenerate.
1732
1733         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
1734         Remove const from declaration.
1735         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
1736         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
1737         * output.h (Output_file_header): Remove const from member target_
1738         and corresponding constructor argument.
1739         * output.cc (Output_file_header::Output_file_header): Update prototype.
1740         (Output_file_header::do_sized_write): Use this->target_ in place
1741         of parameters()->target().
1742
1743         * testsuite/undef_symbol.cc (Foo::get_a): New method.
1744
1745         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
1746         * configure: Regenerate.
1747         * Makefile.in: Regenerate.
1748         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
1749         * testsuite/merge_string_literals_2.c: Likewise.
1750         * testsuite/Makefile.am
1751         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
1752         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
1753         literal -fmerge-constants.
1754         * testsuite/Makefile.in: Regenerate.
1755
1756         * i386.cc (Target_i386): Remove unused member dynbss_.
1757         * arm.cc (Target_arm): Likewise.
1758         * powerpc.cc (Target_powerpc): Likewise.
1759         * sparc.cc (Target_sparc): Likewise.
1760         * tilegx.cc (Target_tilegx): Likewise.
1761         * x86_64.cc (Target_x86_64): Likewise.
1762         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
1763         type_signature_, type_offset_.
1764         * plugin.h (Plugin_hook): Remove unused member layout_.
1765         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
1766         mapfile_.
1767         (Read_member): Remove unused members input_objects_, symtab_,
1768         mapfile_, layout_.
1769         (Check_library): Remove unused member symtab_.
1770         * archive.h (Lib_group): Remove unused member lib_.
1771         * archive.cc (Lib_group::Lib_group): Update initializer.
1772         * incremental.h (Incremental_binary): Remove unused member target_.
1773         (Incremental_script_entry): Removed unused member script_.
1774         * layout.h (Write_symbols_task): Remove unused member input_objects_.
1775         * icf.h (Icf): Remove unused member num_tracked_relocs.
1776
1777         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1778         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1779         its only use.
1780         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1781
1782         * archive.h: Use struct rather than class for forward declaration
1783         of Read_symbols_data.
1784
1785 2013-10-07  Cary Coutant  <ccoutant@google.com>
1786
1787         PR gold/16010
1788         * testsuite/Makefile.am (icf_test): Fix dependencies.
1789         (icf_safe_test): Likewise.
1790         (icf_safe_so_test): Likewise.
1791         (large_symbol_alignment): Add empty _LDADD rule.
1792         * testsuite/Makefile.in: Regenerate.
1793
1794 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
1795
1796         PR gold/15927
1797         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1798         relocation for R_X86_64_32 on x32.
1799
1800 2013-08-27  Roland McGrath  <mcgrathr@google.com>
1801
1802         * output.cc (Output_segment::set_section_addresses): Take new
1803         Target* argument.  If target->isolate_execinstr() and the segment
1804         is executable and starts at a target->abi_pagesize() boundary,
1805         pad its end out to a target->abi_pagesize() boundary with code fill.
1806         * output.h (Output_segment::set_section_addresses): Update decl.
1807         * layout.h (Layout::check_output_data_for_reset_values): Take new
1808         argument RELAX_OUTPUTS.
1809         (Layout): New member relax_output_list_.
1810         (Layout::add_relax_output): New method.
1811         * layout.cc (Layout::Layout): Update constructor.
1812         (Layout::reset_relax_output): New method.
1813         (Layout::clean_up_after_relaxation): Call it.
1814         (Layout::prepare_for_relaxation): Update caller.
1815         (Layout::set_segment_offsets): Update callers of set_section_addresses.
1816         Call reset_relax_output before re-processing segments for
1817         isolate_execinstr case.
1818         (Layout::write_data): Handle relax_output_list_.
1819         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1820         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
1821
1822 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
1823
1824         PR binutils/15834
1825         * object.h: Fix typos.
1826
1827 2013-08-16  Roland McGrath  <mcgrathr@google.com>
1828
1829         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1830         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1831
1832 2013-08-07  Cary Coutant  <ccoutant@google.com>
1833
1834         Revert support for v2 DWP files:
1835
1836         2013-03-01  Cary Coutant  <ccoutant@google.com>
1837
1838             Add dwp support for v2 DWARF package file format.
1839             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1840             tu_length parameter.  Adjust all callers.
1841             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1842             * dwp.cc: Include dwarf.h.
1843             (Section_bounds): New struct type.
1844             (Unit_set): New struct type.
1845             (Dwo_file::Dwo_file): Initialize new data member.
1846             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1847             Combine and rename to...
1848             (Dwo_file::read_unit_index): ...this.
1849             (Dwo_file::sized_read_compunit_index)
1850             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1851             (Dwo_file::sized_read_unit_index): ...this.
1852             (Dwo_file::copy_section): Remove section_name, is_str_offsets
1853             parameters; add section_id parameter.
1854             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1855             (Dwo_file::add_unit_set): ...this.
1856             (Dwo_file::shndx_map_): Remove.
1857             (Dwo_file::sect_offsets_): New data member.
1858             (Dwp_output_file::Dwp_output_file): Initialize new data members.
1859             (Dwp_output_file::add_section): Rename to...
1860             (Dwp_output_file::add_contribution): ...this.
1861             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1862             (Dwp_output_file::add_tu_set): Likewise.
1863             (Dwp_output_file::Contribution): New type.
1864             (Dwp_output_file::Section::contributions): New data member.
1865             (Dwp_output_file::Cu_or_tu_set): Remove.
1866             (Dwp_output_file::Section::Section): New ctor.
1867             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1868             (Dwp_output_file::Dwp_index::Section_table): New type.
1869             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1870             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1871             parameter.
1872             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1873             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1874             (Dwp_output_file::Dwp_index::section_table): New member function.
1875             (Dwp_output_file::Dwp_index::section_table_end): New member function.
1876             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1877             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1878             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1879             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1880             (Dwp_output_file::Dwp_index::section_table_): New data member.
1881             (Dwp_output_file::Dwp_index::section_mask_): New data member.
1882             (Dwp_output_file::add_output_section): New member function.
1883             (Dwp_output_file::write_new_section): New member function.
1884             (Dwp_output_file::write_contributions): New member function.
1885             (Dwp_output_file::section_id_map_): New data member.
1886             (class Dwo_id_info_reader): Remove.
1887             (class Unit_reader): New class.
1888             (get_dwarf_section_name): New function.
1889             (Dwo_file::read_executable): Adjust initializations of class data.
1890             (Dwo_file::read): Add support for v2 package file format.
1891             (Dwo_file::read_unit_index): Likewise.
1892             (Dwo_file::sized_read_unit_index): Likewise.
1893             (Dwo_file::copy_section): Likewise.
1894             (Dwo_file::add_unit_set): Likewise.
1895             (Dwp_output_file::add_output_section): Likewise.
1896             (Dwp_output_file::add_contribution): Likewise.
1897             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1898             for empty slot.
1899             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1900             file format.
1901             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1902             slot.
1903             (Dwp_output_file::initialize): Remove unused function.
1904             (Dwp_output_file::finalize): Add support for v2 package file format.
1905             (Dwp_output_file::write_index): Likewise.
1906             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1907             function prototype.
1908
1909 2013-07-31  Cary Coutant  <ccoutant@google.com>
1910
1911         * object.cc (Sized_relobj::do_output_section_address): New function.
1912         (Sized_relobj): Instantiate explicitly.
1913         * object.h (Object::output_section_address): New function.
1914         (Object::do_output_section_address): New function.
1915         (Sized_relobj::do_output_section_address): New function.
1916         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1917
1918 2013-07-30  Cary Coutant  <ccoutant@google.com>
1919             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1920
1921         * parameters.cc (Parameters::entry): Return target-specific entry
1922         symbol name.
1923         * target.h (Target::entry_symbol_name): New function.
1924         (Target_info::entry_symbol_name): New data member.
1925
1926         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1927         * i386.cc (Target_i386::i386_info): Likewise.
1928         (Target_i386_nacl::i386_nacl_info): Likewise.
1929         * sparc.cc (Target_sparc::sparc_info): Likewise.
1930         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1931         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1932         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1933         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1934
1935 2013-07-22  Sterling Augustine  <saugustine@google.com>
1936
1937         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1938         Convert parameter shndx to local variable. Add parameters symtab
1939         and symtab_size.  Scan over section names.  Find relocation
1940         section corresponding to current section.  Create and initialize
1941         reloc_mapper_ and reloc_type_.
1942         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
1943         unit_length to off_t.  Initialize member unit_length_.  Fill in field
1944         cu_offset_.
1945         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1946         Initialize new fields unit_length_ and cu_offset_.
1947         (Dwarf_pubnames_table::read_section): Update prototype.
1948         (Dwarf_pubnames_table::cu_offset): New member function.
1949         (Dwarf_pubnames_table::subsection_size): Likewise.
1950         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
1951         New fields.
1952         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
1953         member functions public.
1954         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
1955         Update comment.  Rework logic.  Move repeated parts to...
1956         (Gdb_index_info_reader::read_pubtable): ...here. New function.
1957         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
1958         pubtypes_table_, and stmt_list_offset.
1959         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1960         Gdb_index::find_pubtype_offset,
1961         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
1962         (Gdb_index::pubnames_read): Update prototype and rework logic.
1963         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
1964         Forward declare.
1965         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1966         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
1967         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
1968         Gdb_index::map_pubtable_to_dies):
1969         Declare functions.
1970         (Gdb_index::pubnames_read): Update declaration.
1971         (Gdb_index::Pubname_offset_map): New type.
1972         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
1973         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
1974         Gdb_index::stmt_list_offset): Declare.
1975         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1976         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1977         Gdb_index::pubtypes_offset_): Remove.
1978
1979 2013-07-19  Roland McGrath  <mcgrathr@google.com>
1980
1981         * options.h (General_options): Add -Trodata-segment option.
1982         * parameters.cc (Parameters::check_rodata_segment): New function.
1983         (Parameters::set_target_once): Call it.
1984         * parameters.h (Parameters): Declare it (private member function).
1985         * layout.cc (load_seg_unusable_for_headers): New function, broken
1986         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
1987         then validate rodata segment rather than text segment.
1988         (relaxation_loop_body): Call that.
1989         (is_text_segment): New function.  Don't admit a non-executable
1990         segment if TARGET->isolate_execinstr().
1991         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
1992
1993 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
1994
1995         PR gold/15070
1996         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1997         * nacl.h (Sniff_file::View::View): Request aligned view.
1998
1999 2013-07-11  Cary Coutant  <ccoutant@google.com>
2000
2001         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
2002         correct BRLT entry size.
2003
2004 2013-07-03  Alan Modra  <amodra@gmail.com>
2005
2006         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
2007         comment.
2008
2009 2013-07-01  Cary Coutant  <ccoutant@google.com>
2010
2011         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
2012         reloc_type_.
2013         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
2014         (Dwarf_ranges_table::lookup_reloc): New function.
2015         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
2016         reloc_type_.
2017         (Dwarf_ranges_table::lookup_reloc): New function.
2018         (Dwarf_ranges_table::reloc_type_): New data member.
2019
2020 2013-06-27  Jing Yu  <jingyu@google.com>
2021
2022         PR gold/15662
2023         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
2024         function.
2025         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
2026         (Target_powerpc::do_relax): Call the above.
2027
2028 2013-06-27  Cary Coutant  <ccoutant@google.com>
2029
2030         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
2031         on garbage collected .opd section.
2032
2033 2013-06-27  Alan Modra  <amodra@gmail.com>
2034
2035         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
2036         is non-zero.
2037         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
2038         (Target_powerpc::do_function_location): Likewise for loc->shndx.
2039
2040 2013-06-14  Cary Coutant  <ccoutant@google.com>
2041
2042         * resolve.cc (Symbol::override_base): Don't override st_type
2043         from plugin placeholder symbols.
2044         (Symbol_table::resolve): Likewise.
2045         (Symbol_table::should_override): Don't complain about TLS mismatch
2046         if the TO symbol is a plugin placeholder.
2047         * testsuite/Makefile.am (plugin_test_tls): New test.
2048         * testsuite/Makefile.in: Regenerate.
2049         * testsuite/plugin_test_tls.sh: New test script.
2050         * testsuite/two_file_test_2_tls.cc: New test source.
2051         * testsuite/two_file_test_tls.cc: New test source.
2052
2053 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2054
2055         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
2056         the maximum segment alignment is larger than the page size.
2057         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
2058         correctly aligns the symbols with large alignemnt.
2059         * testsuite/Makefile.in: Regenerate.
2060         * testsuite/large_symbol_alignment.cc: New file.
2061
2062 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2063             Sriraman Tallam  <tmsriram@google.com>
2064
2065         * options.h (sort_section): New option.
2066         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
2067         Rename from Input_section_sort_section_name_special_ordering_compare.
2068         (Input_section_sort_section_name_compare): New struct.
2069         * output.cc (Output_section::Input_section_sort_section_name_compare::
2070         operator()): New function.
2071         (Output_section::sort_attached_input_sections): Use new sort function
2072         for .text if --sort-section=name is specified.
2073         * layout.cc (Layout::make_output_section):
2074         Add sorting by name when --sort-section=name is specified.
2075         * testsuite/Makefile.am (text_section_grouping): Test option
2076         --sort-section=name.
2077         * testsuite/Makefile.in: Regenerate.
2078         * testsuite/section_sorting_name.cc: New file.
2079         * testsuite/section_sorting_name.sh: New file.
2080
2081 2013-05-21  Cary Coutant  <ccoutant@google.com>
2082
2083         * symtab.h (Symbol::is_cxx_vtable): New function.
2084         * target-reloc.h (relocate_section): Check for vtable symbol.
2085         * testsuite/Makefile.am (missing_key_func.sh): New test case.
2086         * testsuite/Makefile.in: Regenerate.
2087         * testsuite/missing_key_func.cc: New test source.
2088         * testsuite/missing_key_func.sh: New test script.
2089
2090 2013-05-21  Cary Coutant  <ccoutant@google.com>
2091
2092         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
2093         type of enclosing symbol.
2094         (Relocate_info::location): Check symbol type when describing symbol.
2095         * object.h (Symbol_location_info): Remove unused line_number;
2096         add enclosing_symbol_type.
2097         * testsuite/debug_msg.sh: Adjust expected output.
2098
2099 2013-05-13  Cary Coutant  <ccoutant@google.com>
2100
2101         * configure.ac: Export DEFAULT_TARGET.
2102         * configure: Regenerate.
2103         * Makefile.in: Regenerate.
2104         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
2105         * testsuite/Makefile.in: Regenerate.
2106         * testsuite/debug_msg.sh: Delete duplicate tests.
2107         Don't check undef_int error message match for powerpc where the
2108         source file and line number aren't available.
2109
2110 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2111
2112         * options.h (General_options): Add --rosegment-gap option.
2113         * options.cc (finalize): --rosegment-gap implies --rosegment.
2114         * layout.cc (set_segment_offsets): Let user option override
2115         target->rosegment_gap().
2116
2117 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2118
2119         * options.h (General_options): Remove leading space from help
2120         messages for -nostdlib and --rosegment.
2121
2122 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
2123
2124         PR ld/15365
2125         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
2126
2127 2013-05-03  Alan Modra  <amodra@gmail.com>
2128
2129         * merge.cc (Output_merge_string::do_add_input_section): Correct
2130         scan for number of strings.  Rename vars to avoid shadowing.
2131         Include missing terminator in input_size_.
2132
2133 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
2134
2135         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
2136         Restore empty string handling.
2137
2138 2013-05-01  Cary Coutant  <ccoutant@google.com>
2139
2140         * stringpool.cc (Stringpool_template::new_key_offset): Fix
2141         uninitialized warning.
2142
2143 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2144
2145         * output.cc (Output_section::add_merge_input_section): Allow
2146         to merge sections if the alignment is more than character size.
2147         * merge.h (Output_merge_string::Output_merge_string): Remove
2148         assert.
2149         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
2150         only not-null strings. Check the alignment of strings.
2151         * stringpool.h
2152         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
2153         alignment as the argument.
2154         (Stringpool_template<Stringpool_char>::addralign_): New class member.
2155         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
2156         Align non-zero length strings according to the addralign_.
2157         (Stringpool_template<Stringpool_char>::set_string_offsets):
2158         Updating offsets according to the given alignment.
2159         * testsuite/Makefile.am (text_section_grouping): Test if string
2160         literals are getting merged.
2161         * testsuite/Makefile.in: Regenerate.
2162         * testsuite/merge_string_literals_1.c: New file.
2163         * testsuite/merge_string_literals_2.c: Ditto.
2164         * testsuite/merge_string_literals.sh: Ditto.
2165
2166 2013-04-26  Ian Lance Taylor  <iant@google.com>
2167
2168         * target-reloc.h (relocate_section): If the reloc offset is out of
2169         range, pass VIEW as NULL to relocate.relocate.
2170         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
2171         * i386.cc (Target_i386::Relocate::relocate): Likewise.
2172         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
2173         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
2174         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
2175         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2176
2177 2013-04-26  Geoff Pike  <gpike@chromium.org>
2178
2179         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
2180         * layout.cc (Hash_task): New class.
2181         (Layout::queue_build_id_tasks): New function.
2182         (Layout::write_build_id): Handle single-thread portion of build ID
2183         computation.  (In some cases, all of it is single-threaded.)  Replace
2184         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
2185         functionality in fewer lines of code.
2186         * layout.h (Layout::queue_build_id_tasks): New function declaration.
2187         * options.h (General_options): make "--build-id" default to tree
2188         rather than sha1.  Add two new options related to --build-id=tree:
2189         --build-id-chunk-size-for-treehash and
2190         --build-id-min-file-size-for-treehash.
2191         * Makefile.am: add testing of --build-id=tree and related new options
2192         (these tests will be invoked by "make check").
2193         * Makefile.in: Regenerate.
2194
2195 2013-04-25  Alan Modra  <amodra@gmail.com>
2196
2197         * configure.tgt: Add powerpcle and powerpc64le.
2198
2199 2013-04-22  Alan Modra  <amodra@gmail.com>
2200
2201         PR gold/15355
2202         * layout.cc (Layout::segment_precedes): Allow more than one
2203         segment with the same type and flags.
2204
2205 2013-04-15  Cary Coutant  <ccoutant@google.com>
2206
2207         * layout.cc (Layout::set_relocatable_section_offsets): Don't
2208         allocate space in file for BSS sections.
2209
2210 2013-04-15  Cary Coutant  <ccoutant@google.com>
2211
2212         * script-sections.cc (Orphan_output_section): Reset address
2213         to zero after each orphaned section for relocatable links.
2214
2215 2013-04-15  Cary Coutant  <ccoutant@google.com>
2216
2217         * symtab.cc (Symbol_table::sized_write_globals): Subtract
2218         section starting address for relocatable link.
2219         * testsuite/Makefile.am (script_test_11): New test.
2220         * testsuite/Makefile.in: Regenerate.
2221         * testsuite/script_test_11.c: New source file.
2222         * testsuite/script_test_11.t: New linker script.
2223
2224 2013-04-13  Alan Modra  <amodra@gmail.com>
2225
2226         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
2227         owner when sections are not adjacent and exceed group size.
2228         (Target_powerpc::group_sections): Handle corner case.
2229         (Target_powerpc::Branch_info::make_stub): Handle case where
2230         stub table doesn't exist due to branches in non-exec sections.
2231         (Target_powerpc::Relocate::relocate): Likewise.
2232
2233 2013-04-11  Alan Modra  <amodra@gmail.com>
2234
2235         PR gold/15354
2236         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
2237         .branch_lt to match bfd ld.  Adjust comments throughout file.
2238
2239 2013-04-04  Ian Lance Taylor  <iant@google.com>
2240
2241         GCC PR c++/56840
2242         * object.cc (do_layout_deferred_sections): Handle .eh_frame
2243         sections before checking whether they are included in the link.
2244
2245 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
2246
2247         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
2248         object before calling the plugin claim_file handler.  Pass the elf
2249         object of the archive to the plugin. Delete the elf object if the
2250         plugin claims the file.
2251
2252 2013-03-21  Alan Modra  <amodra@gmail.com>
2253
2254         * layout.cc (Layout::set_segment_offsets): Accept writable .text
2255         segment when omagic.
2256
2257 2013-03-21  Alan Modra  <amodra@gmail.com>
2258
2259         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
2260         comparison warning.
2261         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
2262         uninitialized" warning.
2263
2264 2013-03-20  Alan Modra  <amodra@gmail.com>
2265
2266         * symtab.h (Symbol::clear_version): New function.
2267         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
2268         is_needed by weak references.  Clear version for symbols defined
2269         in as-needed objects that are not needed.
2270
2271 2013-03-15  Alan Modra  <amodra@gmail.com>
2272
2273         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
2274         static and public.  Add report_err param.  Return false for data refs.
2275         (Target_powerpc::rela_dyn_section): New overloaded function.
2276         (Target_powerpc::plt_, iplt_): Elucidate.
2277         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
2278         (Output_data_plt_powerpc::do_write): Don't write .iplt.
2279         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
2280         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
2281         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
2282         push_branch and make_plt_entry for ifunc syms when
2283         reloc_needs_plt_for_ifunc.
2284         (Target_powerpc::Relocate::relocate): Don't use plt entry value
2285         for ifunc unless reloc_needs_plt_for_ifunc.
2286
2287 2013-03-15  Alan Modra  <amodra@gmail.com>
2288
2289         * gc.h (gc_process_relocs): Don't look through function descriptors.
2290         * icf.cc (get_section_contents): Do so here instead.
2291
2292 2013-03-13  Alan Modra  <amodra@gmail.com>
2293
2294         * powerpc.cc (is_branch_reloc): Forward declare.
2295         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
2296         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
2297         false for 64-bit, true for 32-bit non-branch relocs.
2298         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
2299         * testsuite/Makefile.am (icf_test): Use linker map file instead of
2300         nm output.
2301         (icf_safe_test): Generate linker map file as well as nm output.
2302         (icf_safe_so_test): Likewise.
2303         * testsuite/Makefile.in: Regenerate.
2304         * testsuite/icf_test.sh: Parse linker map file to determine
2305         section folding.
2306         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
2307         * testsuite/icf_safe_so_test.sh: Likewise.
2308         (X86_32_or_ARM_specific_safe_fold): Merge into..
2309         (arch_specific_safe_fold): ..this.
2310         (X86_64_specific_safe_fold): Delete unused function.
2311
2312 2013-03-12  Alan Modra  <amodra@gmail.com>
2313
2314         * gc.h (gc_process_relocs): Look through function descriptors
2315         to determine shndx, symvalue and addend used by ICF.  Tidy
2316         variable duplication.
2317
2318 2013-03-11  Alan Modra  <amodra@gmail.com>
2319
2320         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
2321         * layout.cc (Layout_task_runner::run): ..to here.
2322         * symtab.h (struct Symbol_location): Extract from..
2323         (class Symbol_table): ..here.
2324         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
2325         * target.h (class Target): Add function_location and
2326         do_function_location functions.
2327         (class Sized_target): Add do_function_location.
2328         * object.h (class Sized_relobj_file): Move find_shdr..
2329         (class Object): ..to here.
2330         * object.cc: Likewise.  Update to suit.  Instantiate.
2331         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
2332         * powerpc.cc (class Powerpc_dynobj): New.
2333         (Target_powerpc::do_function_location): New function.
2334         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
2335         (Powerpc_dynobj::do_read_symbols): New function.
2336         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
2337
2338 2013-03-08  Ian Lance Taylor  <iant@google.com>
2339
2340         * options.cc (General_options::string_to_object_format): Accept
2341         "default".
2342
2343 2013-03-08  Alan Modra  <amodra@gmail.com>
2344
2345         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
2346         pointer to Post_fde.
2347         (struct Post_fde): Move definition to here..
2348         * ehframe.cc (struct Post_fde): ..from here.
2349         (Cie::write): Don't alloc Post_fde.
2350         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
2351
2352 2013-03-07  Alan Modra  <amodra@gmail.com>
2353
2354         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
2355         relocation referencing .LC0.
2356         * testsuite/discard_locals_test.sh: Remove FIXMEs.
2357
2358 2013-03-07  Alan Modra  <amodra@gmail.com>
2359
2360         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
2361         always_inline.  Add assembly for powerpc to avoid GOT.
2362
2363 2013-03-07  Alan Modra  <amodra@gmail.com>
2364
2365         * testsuite/script_test_10.sh: Don't test .bss section
2366         header number.
2367
2368 2013-03-06  Alan Modra  <amodra@gmail.com>
2369
2370         * powerpc.cc (class Powerpc_relobj): Move some member functions.
2371         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
2372         all callers.  Handle folded sections.
2373         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
2374         to Powerpc_relobj.
2375         (Global_symbol_visitor_opd::operator()): Likewise.
2376
2377 2013-03-04  Alan Modra  <amodra@gmail.com>
2378
2379         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
2380         * testsuite/Makefile.in: Regenerate.
2381
2382 2013-03-01  Cary Coutant  <ccoutant@google.com>
2383
2384         Add dwp support for v2 DWARF package file format.
2385         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2386         tu_length parameter.  Adjust all callers.
2387         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2388         * dwp.cc: Include dwarf.h.
2389         (Section_bounds): New struct type.
2390         (Unit_set): New struct type.
2391         (Dwo_file::Dwo_file): Initialize new data member.
2392         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2393         Combine and rename to...
2394         (Dwo_file::read_unit_index): ...this.
2395         (Dwo_file::sized_read_compunit_index)
2396         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2397         (Dwo_file::sized_read_unit_index): ...this.
2398         (Dwo_file::copy_section): Remove section_name, is_str_offsets
2399         parameters; add section_id parameter.
2400         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2401         (Dwo_file::add_unit_set): ...this.
2402         (Dwo_file::shndx_map_): Remove.
2403         (Dwo_file::sect_offsets_): New data member.
2404         (Dwp_output_file::Dwp_output_file): Initialize new data members.
2405         (Dwp_output_file::add_section): Rename to...
2406         (Dwp_output_file::add_contribution): ...this.
2407         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2408         (Dwp_output_file::add_tu_set): Likewise.
2409         (Dwp_output_file::Contribution): New type.
2410         (Dwp_output_file::Section::contributions): New data member.
2411         (Dwp_output_file::Cu_or_tu_set): Remove.
2412         (Dwp_output_file::Section::Section): New ctor.
2413         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2414         (Dwp_output_file::Dwp_index::Section_table): New type.
2415         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2416         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2417         parameter.
2418         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2419         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2420         (Dwp_output_file::Dwp_index::section_table): New member function.
2421         (Dwp_output_file::Dwp_index::section_table_end): New member function.
2422         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2423         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2424         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2425         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2426         (Dwp_output_file::Dwp_index::section_table_): New data member.
2427         (Dwp_output_file::Dwp_index::section_mask_): New data member.
2428         (Dwp_output_file::add_output_section): New member function.
2429         (Dwp_output_file::write_new_section): New member function.
2430         (Dwp_output_file::write_contributions): New member function.
2431         (Dwp_output_file::section_id_map_): New data member.
2432         (class Dwo_id_info_reader): Remove.
2433         (class Unit_reader): New class.
2434         (get_dwarf_section_name): New function.
2435         (Dwo_file::read_executable): Adjust initializations of class data.
2436         (Dwo_file::read): Add support for v2 package file format.
2437         (Dwo_file::read_unit_index): Likewise.
2438         (Dwo_file::sized_read_unit_index): Likewise.
2439         (Dwo_file::copy_section): Likewise.
2440         (Dwo_file::add_unit_set): Likewise.
2441         (Dwp_output_file::add_output_section): Likewise.
2442         (Dwp_output_file::add_contribution): Likewise.
2443         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2444         for empty slot.
2445         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2446         file format.
2447         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2448         slot.
2449         (Dwp_output_file::initialize): Remove unused function.
2450         (Dwp_output_file::finalize): Add support for v2 package file format.
2451         (Dwp_output_file::write_index): Likewise.
2452         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2453         function prototype.
2454
2455 2013-03-01  Cary Coutant  <ccoutant@google.com>
2456
2457         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
2458         function into class definition in header file.
2459         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
2460         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
2461         New function.
2462         (Dwarf_info_reader::check_buffer): Move here from .cc file.
2463
2464 2013-02-28  Alan Modra  <amodra@gmail.com>
2465
2466         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
2467         * target.cc (Target::do_plt_fde_location): New function.
2468         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
2469         accessor function, and constructor param.
2470         (struct Post_fde, Post_fdes): Declare.
2471         (Cie::write): Add post_fdes param.
2472         * ehframe.cc (Fde::write): Use plt_fde_location.
2473         (struct Post_fde): Define.
2474         (Cie::write): Stash FDEs added post merge mapping.
2475         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
2476         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
2477         (Eh_frame::do_sized_write): Arrange to write post map FDES after
2478         other FDEs.
2479         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
2480         (Target_powerpc::has_glink): New function.
2481         (Target_powerpc::do_relax): Add eh_frame info for stubs.
2482         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
2483         glink_eh_frame_fde_32, default_fde): New data.
2484         (Stub_table::eh_frame_added_): New var.
2485         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
2486         Make const.
2487         (Stub_table::add_eh_frame): New function.
2488         (Output_data_glink::add_eh_frame): New function.
2489         (Target_powerpc::make_glink_section): Call add_eh_frame.
2490
2491 2013-02-15  Ian Lance Taylor  <iant@google.com>
2492
2493         * options.h (DEFINE_uint64_alias): Define.
2494         (class General_options): Add -Ttext-segment as an alias for
2495         -Ttext.
2496
2497 2013-02-15  Alan Modra  <amodra@gmail.com>
2498
2499         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
2500         (Stub_table::do_write): ..here, two places.
2501         (Stub_table::plt_call_size): Use it here too.
2502
2503 2013-02-11  Ian Lance Taylor  <iant@google.com>
2504
2505         * descriptors.cc (Descriptors::close_all): New function.
2506         * descriptors.h (class Descriptors): Declare close_all.
2507         (close_all_descriptors): New inline function.
2508         * plugin.cc: Include "descriptors.h".
2509         (Plugin_manager::cleanup): Call close_all_descriptors.
2510
2511 2013-02-06  Alan Modra  <amodra@gmail.com>
2512
2513         * README: Update coding style link.
2514
2515 2013-01-28  Cary Coutant  <ccoutant@google.com>
2516
2517         * dwp.cc (File_list): New typedef.
2518         (Dwo_name_info_reader): New class.
2519         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
2520         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
2521         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
2522         (Dwo_file::read_executable): New function.
2523         (Dwo_file::read): Move common setup code to ...
2524         (Dwo_file::make_object): ... here.
2525         (dwp_options): Add --exec/-e.
2526         (usage): Likewise.
2527         (main): Likewise.
2528
2529 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
2530
2531         * layout.cc (Layout::layout): Check for option text_reorder.
2532         (Layout::make_output_section): Ditto.
2533         * options.h (text_reorder): New option.
2534         * output.cc (Input_section_sort_compare): Remove special ordering
2535         of section names.
2536         (Output_section::
2537          Input_section_sort_section_name_special_ordering_compare::
2538          operator()): New function.
2539         (Output_section::sort_attached_input_sections): Use new sort function
2540         for .text.
2541         * output.h (Input_section_sort_section_name_special_ordering_compare):
2542         New struct.
2543         * testsuite/Makefile.am (text_section_grouping): Test option
2544         --no-text-reorder
2545         * testsuite/Makefile.in: Regenerate.
2546         * testsuite/text_section_grouping.sh: Check order of functions without
2547         default text reordering.
2548
2549 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
2550
2551         * options.h (General_options): Change default to true for new_dtags.
2552
2553 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
2554
2555         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
2556         when enable_new_dtags is false.  Only add DT_RUNPATH when
2557         enable_new_dtags is true.
2558
2559 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
2560
2561         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
2562         used in declaration and definition consistent.
2563         (Target_powerpc::symval_for_branch): Ditto.
2564
2565 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
2566
2567         * testsuite/plugin_final_layout.cc: Fix comment.
2568
2569 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
2570
2571         * layout.cc (Layout::layout): Do not do default sorting for
2572         text sections when section ordering is specified.
2573         (make_output_section): Ditto.
2574         * testsuite/plugin_final_layout.cc: Name the function sections
2575         to catch reordering issues.
2576
2577 2013-01-15  Alan Modra  <amodra@gmail.com>
2578
2579         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
2580         plt-thread-safe.
2581
2582 2013-01-15  Alan Modra  <amodra@gmail.com>
2583
2584         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
2585         * testsuite/Makefile.in: Regenerate.
2586
2587 2013-01-14  Alan Modra  <amodra@gmail.com>
2588
2589         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
2590         * testsuite/Makefile.in: Regenerate.
2591
2592 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
2593
2594         PR bfd/14430
2595         Fix mingw gold build with plugins enabled
2596         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
2597         * configure.ac: Export DLOPEN_LIBS and add headers check.
2598         * plugin.cc: Handle non-dlfcn case.
2599         * Makefile.in: Regenerate.
2600         * config.in: Regenerate.
2601         * configure: Regenerate.
2602         * testsuite/Makefile.in: Regenerate.
2603
2604 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
2605
2606         * output.h (sort_attached_input_sections): Change to be public.
2607         * script-sections.cc
2608         (Output_section_definition::set_section_addresses): Sort
2609         attached input sections according to section order before linker
2610         script assigns section addresses.
2611         (Orphan_output_section::set_section_addresses): Sort
2612         attached input sections according to section order before linker
2613         script assigns section addresses.
2614         * Makefile.am (final_layout.sh): Use a simple linker script to
2615         check if section ordering still works.
2616         * Makefile.in: Regenerate.
2617
2618 2013-01-09  Ben Cheng  <bccheng@google.com>
2619
2620         * arm.cc (Target_arm::attributes_accept_div): New function.
2621         (Target_arm::attributes_forbid_div): New function.
2622         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
2623         attribute using the same new functions as what bfd/elf32_arm.c
2624         does.
2625
2626 2013-01-07  Cary Coutant  <ccoutant@google.com>
2627
2628         PR gold/14993
2629         * output.cc (Output_section::add_input_section): For incremental
2630         updates, don't track input sections that are allocated from patch
2631         space.
2632
2633 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
2634             Ian Lance Taylor  <iant@google.com>
2635
2636         PR gold/14897
2637         * configure.ac (--enable-ld): Removed.
2638         (install_as_default): Set to yes only for --enable-gold=default
2639         or --disable-ld.
2640         * configure: Regenerated.
2641
2642 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
2643
2644         * options.h (General_options): Add -fuse-ld= for GCC linker
2645         option compatibility.
2646
2647 2013-01-04  Cary Coutant  <ccoutant@google.com>
2648
2649         * configure.ac: Fix typo restoring CXXFLAGS.
2650         * configure: Regenerate.
2651
2652 2013-01-04  Cary Coutant  <ccoutant@google.com>
2653
2654         * testsuite/Makefile.am (CXXLINK_S): New macro.
2655         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
2656         * testsuite/Makefile.in: Regenerate.
2657
2658 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
2659
2660         * version.cc (print_version): Update copyright year to 2013.
2661
2662 2012-12-20  Ian Lance Taylor  <iant@google.com>
2663
2664         * layout.cc (Layout::special_ordering_of_input_section): New
2665         function.
2666         (Layout::layout): If input section requires special ordering, must
2667         sort input sections.
2668         (Layout::make_output_section): May sort .text input sections.
2669         (Layout::is_section_name_prefix_grouped): Remove.
2670         * layout.h (class Layout): Declare
2671         special_ordering_of_input_section.  Don't declare
2672         is_section_name_prefix_grouped.
2673         * output.cc (Output_section::add_input_section): Revert last
2674         change.
2675         (Output_section::Input_section_sort::match_file_name): Don't crash
2676         if called on output section data.
2677         (Output_section::Input_section_sort_compare): Sort based on
2678         special ordering.
2679         (Output_section::Input_section_sort_section_order_index_compare):
2680         Revert last patch.
2681         (Output_section::sort_attached_input_sections): Likewise.
2682
2683 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
2684
2685         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
2686         * layout.h (Layout::is_section_name_prefix_grouped): New function.
2687         * output.cc (Output_section::add_input_section): Check if section
2688         name contains special prefix.  Keep input sections to sort such
2689         sections.
2690         (Output_section::Input_section_sort_section_order_index_compare
2691          ::operator()): Group sections according to prefixes.
2692         (Output_section::sort_attached_input_sections): Add condition to
2693         Input_section_entry constructor call.
2694         * testsuite/Makefile.am (text_section_grouping): New test.
2695         * testsuite/Makefile.in: Regenerate.
2696         * testsuite/text_section_grouping.cc: New file.
2697         * testsuite/text_section_grouping.sh: New file.
2698
2699 2012-12-17  Nick Clifton  <nickc@redhat.com>
2700
2701         * Makefile.am: Add copyright notice.
2702         * NEWS: Likewise.
2703         * README: Likewise.
2704         * configure.ac: Likewise.
2705         * ftruncate.c: Likewise.
2706         * Makefile.in: Regenerate.
2707
2708 2012-12-14  Cary Coutant  <ccoutant@google.com>
2709
2710         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
2711         --no-as-needed flag.
2712         (exception_separate_shared_12_test): Likewise.
2713         (incremental_copy_test): Likewise.
2714         * testsuite/Makefile.in: Regenerate.
2715
2716 2012-12-14  Cary Coutant  <ccoutant@google.com>
2717
2718         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
2719         (Dwp_output_file::Dwp_index::enter_set): Add assert.
2720
2721 2012-12-12  Alan Modra  <amodra@gmail.com>
2722
2723         * powerpc.cc (class Track_tls): New.
2724         (class Relocate, class Scan): Inherit Track_tls.
2725         (Target_powerpc::Scan::local, global): Track tls optimization
2726         and avoid creating plt entry for __tls_get_addr if all uses
2727         are optimized away.
2728         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
2729
2730 2012-12-12  Alan Modra  <amodra@gmail.com>
2731
2732         * options.h (General_options): Add --toc-sort/--no-toc-sort.
2733         Replace no_toc_optimize with toc_optimize.
2734         * output.h (Output_section::input_sections): Provide non-const variant.
2735         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
2736         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
2737         accessors.
2738         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
2739         (class Sort_toc_sections): New.
2740         (Target_powerpc::do_finalize_sections): Sort toc sections.
2741         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
2742
2743 2012-12-10  Roland McGrath  <mcgrathr@google.com>
2744
2745         * testsuite/binary_unittest.cc (read_all): New function.
2746         (Sized_binary_test): Use it instead of ::read.
2747         * fileread.cc (do_read): Don't assume pread always reads the whole
2748         amount in a single call.
2749
2750 2012-12-10  Alan Modra  <amodra@gmail.com>
2751
2752         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
2753         Set EM_PPC64 or EM_PPC here.
2754         (Target_selector_powerpc::do_recognize): Delete.
2755
2756 2012-12-10  Alan Modra  <amodra@gmail.com>
2757
2758         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
2759         stub_table_.
2760         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
2761
2762 2012-12-07  Roland McGrath  <mcgrathr@google.com>
2763
2764         * testsuite/binary_unittest.cc (Sized_binary_test):
2765         Use open_descriptor rather than ::open.
2766
2767 2012-12-07  Alan Modra  <amodra@gmail.com>
2768
2769         * powerpc.cc (Stub_table::do_write): Delete redundant Address
2770         typedef and invalid_address constant.
2771         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2772         instantiate constants.
2773
2774 2012-12-06  Roland McGrath  <mcgrathr@google.com>
2775
2776         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2777         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2778         * aclocal.m4: Regenerate.
2779         * configure: Regenerate.
2780         * Makefile.in: Regenerate.
2781         * testsuite/Makefile.in: Regenerate.
2782
2783 2012-12-07  Alan Modra  <amodra@gmail.com>
2784
2785         * options.h (General_options): Add no_toc_optimize.
2786         * powerpc.cc (ok_lo_toc_insn): New function.
2787         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2788
2789 2012-12-06  Alan Modra  <amodra@gmail.com>
2790
2791         * options.h (General_options): Add plt_align, plt_static_chain,
2792         plt_thread_safe.  Update stub_group_size help text.
2793         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2794         for new plt_thread_safe_ var.
2795         (use_plt_offset): Correct comments.
2796         (Target_powerpc::do_relax): Look for thread creation symbols to
2797         determine default plt_thread_safe value.  Clear plt call stubs
2798         as well as branch stubs each iteration.
2799         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2800         insn constants.
2801         (l, hi, ha, write_insn): Move earlier.
2802         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2803         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2804         plt stubs too.
2805         (Stub_table::update_size): Adjust.
2806         (Stub_table::prev_size, set_prev_size): Delete.
2807         (Stub_table::stub_align): Let --plt-align affect result.
2808         (Stub_table::plt_call_size): Calculate sizes for various stubs.
2809         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2810         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2811         (Stub_table::do_write): Support more stub variants.
2812
2813 2012-12-04  Alan Modra  <amodra@gmail.com>
2814
2815         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2816         (Target_powerpc::do_define_standard_symbols): New function.
2817
2818 2012-12-03  Alan Modra  <amodra@gmail.com>
2819
2820         * output.h: Formatting, whitespace.
2821
2822 2012-12-03  Alan Modra  <amodra@gmail.com>
2823
2824         * layout.h (Layout::get_executable_sections): Declare.
2825         * layout.cc (Layout::get_executable_sections): New function.
2826         * arm.cc (Target_arm::group_sections): Use it.
2827         (Arm_output_section::group_sections): Delete now redundant test.
2828         * output.cc (Output_reloc::Output_reloc): Add is_relative.
2829         param to handle relative relocs.
2830         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2831         (Output_data_reloc::add_absolute): Adjust.
2832         (Output_data_reloc::add_relative): New function.
2833         (Output_data::reset_data_size): New function.
2834         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2835         (Output_section::set_addralign): New function.
2836         (Output_section::checkpoint_set_addralign): New function.
2837         (Output_section::clear_section_offsets_need_adjustment): New function.
2838         (Output_section::input_sections): Make public.
2839         * powerpc.cc (class Output_data_brlt_powerpc): New.
2840         (class Stub_table, class Stub_control): New.
2841         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
2842         stub_table_, set_stub_table, stub_table): New vectors and accessor
2843         functions.
2844         (Target_powerpc::do_may_relax, do_relax, push_branch,
2845         new_stub_table, stub_tables, brlt_section, group_sections,
2846         add_branch_lookup_table, find_branch_lookup_table,
2847         write_branch_lookup_table, make_brlt_section): New functions.
2848         (Target_powerpc::struct Sort_sections, class Branch_info): New.
2849         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
2850         branch_info_): New vars.
2851         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
2852         make call stubs here.
2853         (Output_data_glink): Remove all call stub handling from this class.
2854         (Target_powerpc::Scan::local, global): Save interesting branch
2855         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
2856         (Target_powerpc::do_finalize_sections): Only make reg save/restore
2857         functions on final link.
2858         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
2859         Handle long branch destinations too.
2860         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
2861         do_plt_address_for_local): Adjust lookup of plt call stubs.
2862
2863 2012-11-30  Alan Modra  <amodra@gmail.com>
2864
2865         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
2866         relocs against protected symbols when building 32-bit shared libs.
2867
2868 2012-11-30  Alan Modra  <amodra@gmail.com>
2869
2870         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
2871         param.  Call got_section() to make .got.  Update all callers
2872         and their callers and so on.
2873
2874 2012-11-30  Alan Modra  <amodra@gmail.com>
2875
2876         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
2877         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
2878         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
2879         value if it already exists.
2880
2881 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
2882
2883         PR gold/14858
2884         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
2885
2886 2012-11-14  Roland McGrath  <mcgrathr@google.com>
2887
2888         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
2889         than bfc instruction for data sandboxing.
2890
2891 2012-11-08  Alan Modra  <amodra@gmail.com>
2892
2893         * po/POTFILES.in: Regenerate.
2894
2895 2012-11-05  Alan Modra  <amodra@gmail.com>
2896
2897         * configure.ac: Apply 2012-09-10 change to config.in here.
2898         * configure: Regenerate.
2899
2900 2012-11-05  Alan Modra  <amodra@gmail.com>
2901
2902         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
2903         (struct Opd_ent): Use "Address" rather than "Offset".
2904         (Output_data_got_powerpc::got_base_offset): Return Valtype.
2905         (Target_powerpc::got_section): Make public.
2906         (Target_powerpc::scan_relocs): Move code setting symbols..
2907         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
2908         Create _SDA_BASE_ only when referenced.
2909
2910 2012-11-02  Roland McGrath  <mcgrathr@google.com>
2911
2912         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
2913         from last change.
2914
2915 2012-11-01  Roland McGrath  <mcgrathr@google.com>
2916
2917         * target.h (Sized_target::relocate_relocs): Use Elf_Off
2918         for offset_in_output_section parameter.
2919         (Sized_target::relocate_special_relocatable): Likewise.
2920         * arm.cc (Target_arm::relocate_relocs): Likewise.
2921         (Target_arm::relocate_special_relocatable): Likewise.
2922         * i386.cc (Target_i386::relocate_relocs): Likewise.
2923         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2924         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2925         * target-reloc.h (relocate_relocs): Likewise.
2926         * testsuite/testfile.cc (Target_test): Likewise.
2927         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2928         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2929
2930         * system.h: Move inclusion of <clocale> to after <libintl.h> in
2931         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2932
2933         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2934         parameter, which is unused in the [!F_SETFD] case.
2935
2936         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2937         SYMNDX to off_t before comparing it to this->data_size().
2938         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2939         * incremental.cc (Output_section_incremental_inputs::do_write):
2940         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2941
2942         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2943
2944 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
2945
2946         * gold.cc (Target_arm::do_adjust_elf_header): Add the
2947         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2948         in EABI_VER5.
2949
2950 2012-10-29  Cary Coutant  <ccoutant@google.com>
2951
2952         * dwp.cc (usage): Add file and exit status parameters;
2953         add --help and --version options.
2954         (print_version): New function.
2955         (main): Add --help and --version options.
2956
2957 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2958
2959         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
2960         final_layout_sequence.txt.
2961         * testsuite/Makefile.in: Regenerated.
2962
2963 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2964
2965         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
2966         COMPILE generated by automake.
2967         (LINK1): Likewise.
2968         (CXXCOMPILE1): Likewise.
2969         (CXXLINK1): Likewise.
2970         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
2971         (LINK): Likewise.
2972         (CXXCOMPILE): Likewise.
2973         (CXXLINK): Likewise.
2974         * testsuite/Makefile.in: Regenerated.
2975
2976 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2977
2978         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2979         on bad fwrite return.
2980
2981 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2982
2983         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2984         on val.
2985
2986 2012-10-23  Cary Coutant  <ccoutant@google.com>
2987
2988         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2989         * testsuite/Makefile.in: Regenerate.
2990         * testsuite/dwp_test.h: New source file.
2991         * testsuite/dwp_test_1.cc: New source file.
2992         * testsuite/dwp_test_1.s: New source file.
2993         * testsuite/dwp_test_1.sh: New source file.
2994         * testsuite/dwp_test_1b.cc: New source file.
2995         * testsuite/dwp_test_1b.s: New source file.
2996         * testsuite/dwp_test_2.cc: New source file.
2997         * testsuite/dwp_test_2.s: New source file.
2998         * testsuite/dwp_test_2.sh: New source file.
2999         * testsuite/dwp_test_main.cc: New source file.
3000         * testsuite/dwp_test_main.s: New source file.
3001
3002 2012-10-23  Cary Coutant  <ccoutant@google.com>
3003
3004         * dwp.h: New header file.
3005         * dwp.cc: New source file.
3006         * gold.h: Move shared declarations to system.h.
3007         * system.h: New header file.
3008         * Makefile.am: Add dwp.
3009         * Makefile.in: Regenerate.
3010
3011 2012-10-23  Cary Coutant  <ccoutant@google.com>
3012
3013         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
3014         Dwarf_info_reader::read_from_pointer.
3015         (Dwarf_pubnames_table::read_header): Likewise.
3016         (Dwarf_pubnames_table::next_name): Likewise.
3017         (Dwarf_die::read_attributes): Likewise.
3018         (Dwarf_die::skip_attributes): Likewise.
3019         (Dwarf_info_reader::read_from_pointer): New function template.
3020         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
3021         (Dwarf_pubnames_table): Likewise.
3022         (Dwarf_info_reader::read_from_pointer): New function template.
3023         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
3024         Dwarf_pubnames_table ctor.
3025
3026 2012-10-23  Cary Coutant  <ccoutant@google.com>
3027
3028         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
3029         abbrev_shndx.
3030         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
3031         abbrev_shndx_.
3032         (Dwarf_info_reader::set_abbrev_shndx): New method.
3033         (Dwarf_info_reader::abbrev_shndx_): New data member.
3034
3035 2012-10-23  Cary Coutant  <ccoutant@google.com>
3036
3037         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
3038         from object, not parameters.
3039         (Dwarf_info_reader::parse): Likewise.
3040         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
3041         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
3042         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
3043         methods.
3044
3045 2012-10-23  Cary Coutant  <ccoutant@google.com>
3046
3047         * fileread.cc (Input_file::Input_file): New constructor.
3048         * fileread.h (class Input_file): Add new constructor.
3049
3050 2012-10-18  Alan Modra  <amodra@gmail.com>
3051
3052         PR gold/14727
3053         * object.cc (Relobj::is_section_name_included): Also match
3054         .sdata personality section.
3055
3056 2012-10-18  Alan Modra  <amodra@gmail.com>
3057
3058         * target-reloc.h (class Default_comdat_behavior): New, package up..
3059         (get_comdat_behaviour): ..this.
3060         (relocate_section): Add Relocate_comdat_behavior template arg,
3061         adjust code to suit.
3062         * arm.cc (Target_arm::relocate_section): Adjust to suit.
3063         (Target_arm::scan_reloc_section): Likewise.
3064         * i386.cc (Target_i386::relocate_section): Likewise.
3065         * sparc.cc (Target_sparc::relocate_section): Likewise.
3066         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
3067         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
3068         * powerpc.cc (class Relocate_comdat_behavior): New.
3069         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
3070         gold::relocate_section with new template arg.
3071
3072 2012-10-18  Alan Modra  <amodra@gmail.com>
3073
3074         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
3075         dynamic relocs for GOT_TPREL got entries, without symbol if
3076         resolving locally.
3077         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
3078         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
3079         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
3080
3081 2012-10-17  Alan Modra  <amodra@gmail.com>
3082
3083         PR gold/14726
3084         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
3085
3086 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
3087
3088         * layout.cc (Layout::include_section): Keep sections marked
3089         SHF_EXCLUDE when doing relocatable links.
3090
3091 2012-10-16  Alan Modra  <amodra@gmail.com>
3092
3093         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
3094         (Target_powerpc::do_finalize_sections): Call it.
3095         (Output_data_save_res): New class and supporting functions.
3096         (Target_powerpc::symval_for_branch): Only look up .opd entry for
3097         normal symbols defined in object files.
3098
3099 2012-10-12  Alan Modra  <amodra@gmail.com>
3100
3101         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
3102         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
3103         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
3104         section if scan_opd_relocs not yet called.
3105         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
3106
3107 2012-10-12  Alan Modra  <amodra@gmail.com>
3108
3109         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3110         add_local_ifunc_entry): Revert last change.
3111         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
3112
3113 2012-10-05  Alan Modra  <amodra@gmail.com>
3114
3115         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
3116         do_plt_address_for_global): New functions.
3117         (Output_data_got_powerpc::do_write): Don't segfault when linking
3118         statically.
3119         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3120         add_local_ifunc_entry): Return true on adding entry..
3121         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
3122         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
3123         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
3124         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
3125         set up symbols here.
3126         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
3127         syms here.  Do so even when no .iplt.  Don't segfault when linking
3128         statically.
3129         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
3130         new variants without reloc param.
3131         (Glink_sym_ent::Glink_sym_ent): Likewise.
3132         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
3133         reloc when refs will resolve to plt call stub.
3134         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
3135         R_PPC_PLTREL24 to resolve locally.
3136         (Target_powerpc::Scan::global): Correct ifunc handling.
3137         (Target_powerpc::Relocate::relocate): Correct local sym glink
3138         lookup.  Don't destroy "value" when we have a plt call stub,
3139         and when checking plt call validity.
3140         (Target_powerpc::do_dynsym_value): Simplify.
3141
3142 2012-10-05  Alan Modra  <amodra@gmail.com>
3143
3144         * i386.cc (Output_data_plt_i386::address_for_global,
3145         address_for_local): Add plt offset to returned value.  Adjust uses.
3146         * sparc.cc (Output_data_plt_sparc::address_for_global,
3147         address_for_local): Likewise.
3148         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
3149         address_for_local): Likewise.
3150         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
3151         address_for_local): Likewise.
3152         * target.h (Target::plt_address_for_global, plt_address_for_local):
3153         Update comment.
3154         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
3155         (Output_data_got::Got_entry::write): Nor here.
3156         * output.h: Comment fix.
3157
3158 2012-10-02  Jiong Wang  <jiwang@tilera.com>
3159
3160         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
3161         global_offset_table_ value for larget got.
3162         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
3163
3164 2012-09-29  Alan Modra  <amodra@gmail.com>
3165
3166         * powerpc.cc (Target_powerpc::iplt_): New output section.
3167         (Target_powerpc::iplt_section, make_iplt_section,
3168         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
3169         (Target_powerpc::make_plt_entry): Handle ifunc syms.
3170         Target_powerpc::plt_entry_count): Count iplt entries too.
3171         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
3172         reloc section in constructor.  New params.
3173         (Target_powerpc::make_plt_section): Create reloc section here instead.
3174         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
3175         functions.
3176         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
3177         (Output_data_glink::add_entry, find_entry): New functions to
3178         deal with local syms.
3179         (Glink_sym_ent): Add support for local syms.
3180         (Output_data_glink::do_write): Handle ifunc plt entries.
3181         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3182         (Target_powerpc::Scan::local, global): Handle ifunc syms.
3183         (Target_powerpc::Relocate::relocate): Likewise.
3184         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
3185
3186 2012-09-25  Alan Modra  <amodra@gmail.com>
3187
3188         * object.h (Sized_relobj_file::adjust_local_symbol,
3189         do_adjust_local_symbol): New functions.
3190         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
3191         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
3192         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
3193         and irregular opd entry spacing.
3194         (Powerpc_relobj::do_read_relocs): Add opd size checks.
3195         (Global_symbol_visitor_opd): New functor.
3196         (Target_powerpc::do_finalize_sections): Omit global symbols defined
3197         on deleted opd entries.
3198
3199 2012-09-15  Jiong Wang  <jiwang@tilera.com>
3200
3201         * tilegx.cc: New file.
3202         * Makefile.am (TARGETSOURCES): Add tilegx.cc
3203         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
3204         * configure.tgt: Add entries for tilegx*.
3205         * configure.ac: Likewise.
3206         * Makefile.in: Rebuild.
3207         * configure: Likewise.
3208         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
3209         tilegx.
3210
3211 2012-09-13  Alan Modra  <amodra@gmail.com>
3212
3213         * target-reloc.h (scan_relocs): Call scan.local for relocs
3214         against symbols in discarded sections.  Pass is_discarded
3215         param.
3216         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
3217         Add is_discarded param.
3218         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
3219         is_discarded to flag opd entry as discarded.  Don't emit dyn
3220         relocs on such entries.
3221         (Target_powerpc::Scan::global): Similarly detect and handle
3222         such opd entries.
3223         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
3224         opd_ent_.  Update all uses.
3225         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
3226         (Target_powerpc::relocate_section): Zero out discarded opd
3227         entry relocs.
3228
3229 2012-09-12  Ian Lance Taylor  <iant@google.com>
3230
3231         PR gold/14570
3232         * output.cc: Rename Output_data_got template parameter from size
3233         to got_size for all functions.  Compile all variants of
3234         Output_data_got.
3235         (Output_data_got::Got_entry::write): Correct use of size for
3236         symbol value.  Use local_is_tls rather than casting to
3237         Sized_relobj_file.
3238         * object.h (class Object): Add local_is_tls and do_local_is_tls.
3239         (class Sized_relobj_file): Add do_local_is_tls.
3240         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
3241
3242 2012-09-11  Alan Modra  <amodra@gmail.com>
3243
3244         PR gold/14566
3245         * layout.cc (Layout::set_segment_offsets): When using
3246         common-page-size alignment, ensure we are on a new max-page-size
3247         page.
3248         * output.cc (Output_segment::set_section_addresses): Use
3249         abi_pagesize, not common_pagesize for relro boundary.
3250         (Output_segment::set_offset): Likewise.
3251
3252 2012-09-11  Alan Modra  <amodra@gmail.com>
3253
3254         * output.h (Output_data_got::add_global_tls, add_local_tls,
3255         add_local_tls_pair): New functions.
3256         (Output_data_got::add_local_pair_with_rel): Remove second
3257         reloc param.  Expand comment.
3258         (Output_data_got::Got_entry): Rename use_plt_offset_ to
3259         use_plt_or_tls_offset_, similarly for constructor param.
3260         (Output_data_got::Got_entry::write): Add got_index param.
3261         * output.cc (Output_data_got::add_global_tls, add_local_tls,
3262         add_local_tls_pair): New functions.
3263         (Output_data_got::Got_entry::write): Handle tls symbols
3264         with use_plt_or_tls_offset_ set specially.
3265         (Output_data_got::add_local_pair_with_rel): Only one reloc.
3266         (Output_data_got::do_write): Replace iterator with index, pass
3267         index to entry write function.
3268         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
3269         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
3270         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
3271         call.
3272         * i386.cc (Target_i386::Scan::local): Likewise.
3273         * sparc.cc (Target_sparc::Scan::local): Likewise.
3274         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
3275         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
3276         do_tls_offset_for_global): New functions.
3277         (Target_powerpc::Scan::local): Correct TLS relocations and got
3278         entry values.
3279         (Target_powerpc::Scan::global): Don't emit unnecessary
3280         dynamic relocations on TLS GOT entries.
3281
3282 2012-09-10  Matthias Klose  <doko@ubuntu.com>
3283
3284         * config.in: Disable sanity check for kfreebsd.
3285
3286 2012-09-10  Sterling Augustine  <saugustine@google.com>
3287
3288         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
3289         (Gdb_index::pubtypes_read): New parameter.
3290         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
3291         to calls.
3292         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
3293         pubtypes_object_.
3294
3295 2012-09-09  Alan Modra  <amodra@gmail.com>
3296
3297         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
3298         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
3299         * gc.h (gc_process_relocs): Call target gc_add_reference.
3300         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
3301         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
3302         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
3303         unnecessary cast.
3304         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
3305         to cater for when we don't need code offset.  Update use.
3306         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
3307         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
3308         set_opd_valid): New functions.
3309         (Target_powerpc::do_gc_add_reference): New function.
3310         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
3311         stashed refs.
3312         (Target_powerpc::do_gc_mark_symbol): New function.
3313
3314 2012-09-06  Cary Coutant  <ccoutant@google.com>
3315
3316         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
3317         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
3318         (Dwarf_die::skip_attributes): Likewise.
3319         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
3320         * testsuite/gdb_index_test.cc (inline_func_1): New function.
3321         (main): Call it.
3322         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
3323
3324 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
3325
3326         * testsuite/script_test_3.t: Add .got.plt output section
3327         statement.
3328         * testsuite/script_test_4.t: Likewise.
3329
3330 2012-09-05  Alan Modra  <amodra@gmail.com>
3331
3332         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
3333         update all uses and lose "enum" when using type.
3334
3335 2012-09-05  Alan Modra  <amodra@gmail.com>
3336
3337         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
3338         * configure: Regenerate.
3339         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
3340         (plugin_final_layout.stdout): Likewise.
3341         (memory_test): Set page sizes to 0x1000.
3342         * testsuite/Makefile.in: Regenerate.
3343         * testsuite/discard_locals_test.sh: Add FIXME comment.
3344         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
3345         * testsuite/pr14265.t: Add .got output section statement.
3346         * testsuite/script_test_2.t: Likewise.
3347         * testsuite/script_test_3.t: Likewise.
3348         * testsuite/script_test_4.t: Likewise.
3349         * testsuite/script_test_5.t: Likewise.
3350         * testsuite/script_test_6.t: Likewise.
3351         * testsuite/script_test_7.t: Likewise.
3352         * testsuite/script_test_9.t: Likewise.
3353
3354 2012-09-05  Alan Modra  <amodra@gmail.com>
3355
3356         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
3357         (Powerpc_relocate_functions::Status): New typedef.
3358         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3359         (Target_powerpc::Scan::local): Handle REL64.
3360         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
3361         for REL32 and REL64.
3362         (Target_powerpc::symval_for_branch): New function, extracted from..
3363         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
3364         checks.  Report overflow errors.
3365
3366 2012-09-05  Alan Modra  <amodra@gmail.com>
3367
3368         * object.h (Sized_relobj_file::emit_relocs): Delete.
3369         (Sized_relobj_file::emit_relocs_reltype): Delete.
3370         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
3371         relocate_relocs for --emit-relocs.
3372         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
3373         * output.h: Update comment.
3374         (Output_segment::first_section): New function.
3375         (Output_segment::first_section_load_address): Use first_section.
3376         * output.cc (Output_segment::first_section): New function extracted..
3377         (Output_segment::first_section_load_address): ..from here.  Delete.
3378         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
3379         * target.h (Sized_target::relocate_for_relocatable): Likewise.
3380         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
3381         adjust call to target.h function.
3382         * i386.cc (Target_i386): Likewise.
3383         * sparc.cc (Target_sparc): Likewise.
3384         * x86_64.cc (Target_x86_64): Likewise.
3385         * powerpc.cc (Target_powerpc): Likewise.
3386         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
3387         first tls section has section symbol for optimised local dynamic
3388         output relocs.
3389         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
3390         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
3391         optimised tls code.
3392         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
3393         Rename to relocate_relocs.  Update error message.
3394
3395 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
3396
3397         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
3398         --just-symbols.
3399
3400 2012-08-31  Alan Modra  <amodra@gmail.com>
3401
3402         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
3403         (Powerpc_relobj::toc_base_offset): New stub function.
3404         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
3405         got_mod_index_offset to tlsld_got_offset.  Update all refs.
3406         (Target_powerpc::Relocate::enum skip_tls): New.
3407         (Target_powerpc::call_tls_get_addr_): New var.
3408         (Target_powerpc::is_branch_reloc): Move to file scope.
3409         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
3410         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
3411         New functions.
3412         (Target_powerpc::enum Got_type): Delete old values, add new ones.
3413         (powerpc_info): Correct common_pagesize for ppc64.
3414         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
3415         (Powerpc_relocate_functions): Add overflow check enums and functions.
3416         Add non-shift version of rela, rela_ua.  Delete all rel public
3417         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
3418         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
3419         addr16_ha3, addr14 functions.
3420         (Output_data_got_powerpc::add_constant_pair): New function.
3421         (Output_data_got_powerpc::got_base_offset): Likewise.
3422         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
3423         (instruction constants): Sort, add some more.
3424         (Output_data_glink::do_write): Add and use Address typedef.  Use
3425         object->toc_base_offset() stub for 64-bit.
3426         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
3427         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3428         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
3429         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
3430         Always treat .opd relocs as against locally defined symbol.
3431         Correct condition for RELATIVE relocs.
3432         (Target_powerpc::do_finalize_sections): Test for NULL sections.
3433         (Target_powerpc::Relocate::relocate): Use plt call stub as value
3434         for 32-bit syms with a plt entry.  Correct ppc64 toc base
3435         calculations.  Handle TLS relocs, and more.  Add overflow
3436         checking and adjust for Powerpc_relocate_functions changes.
3437         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
3438         Reinstate --emit-relocs code with FIXME.
3439
3440 2012-08-30  Alan Modra  <amodra@gmail.com>
3441
3442         * layout.cc (Layout::set_segment_offsets): Set p_align to
3443         abi_pagesize, not common_pagesize.
3444         (Layout::relaxation_loop_body): Similarly use abi_pagesize
3445         to determine whether file header can go in segment.
3446
3447 2012-08-30  Alan Modra  <amodra@gmail.com>
3448
3449         * output.h (Output_reloc::Output_reloc <output section>): Add
3450         is_relative param.  Adjust calls.
3451         (Output_reloc::add_output_section_relative): New functions.
3452         * output.cc (Output_reloc::Output_reloc <output section>): Handle
3453         is_relative.
3454         (Output_reloc::symbol_value): Handle SECTION_CODE.
3455
3456 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
3457
3458         * gold.cc (queue_middle_tasks): Call layout again when unique
3459         segments for sections is desired.
3460         * layout.cc (Layout::Layout): Initialize new members.
3461         (Layout::get_output_section_flags): New function.
3462         (Layout::choose_output_section): Call get_output_section_flags.
3463         (Layout::layout): Make output section for mapping to a unique segment.
3464         (Layout::insert_section_segment_map): New function.
3465         (Layout::attach_allocated_section_to_segment): Make unique segment for
3466         output sections marked so.
3467         (Layout::segment_precedes): Check for unique segments when sorting.
3468         * layout.h (Layout::Unique_segment_info): New struct.
3469         (Layout::Section_segment_map): New typedef.
3470         (Layout::insert_section_segment_map): New function.
3471         (Layout::get_output_section_flags): New function.
3472         (Layout::is_unique_segment_for_sections_specified): New function.
3473         (Layout::set_unique_segment_for_sections_specified): New function.
3474         (Layout::unique_segment_for_sections_specified_): New member.
3475         (Layout::section_segment_map_): New member.
3476         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
3477         Rename is_gc_pass_one to is_pass_one.
3478         Rename is_gc_pass_two to is_pass_two.
3479         Rename is_gc_or_icf to is_two_pass.
3480         Check for which pass based on whether symbols data is present.
3481         Make it two pass when unique segments for sections is desired.
3482         * output.cc (Output_section::Output_section): Initialize new
3483         members.
3484         * output.h (Output_section::is_unique_segment): New function.
3485         (Output_section::set_is_unique_segment): New function.
3486         (Output_section::is_unique_segment_): New member.
3487         (Output_section::extra_segment_flags): New function.
3488         (Output_section::set_extra_segment_flags): New function.
3489         (Output_section::extra_segment_flags_): New member.
3490         (Output_section::segment_alignment): New function.
3491         (Output_section::set_segment_alignment): New function.
3492         (Output_section::segment_alignment_): New member.
3493         (Output_segment::Output_segment): Initialize is_unique_segment_.
3494         (Output_segment::is_unique_segment): New function.
3495         (Output_segment::set_is_unique_segment): New function.
3496         (Output_segment::is_unique_segment_): New member.
3497         * plugin.cc (allow_unique_segment_for_sections): New function.
3498         (unique_segment_for_sections): New function.
3499         (Plugin::load): Add new functions to transfer vector.
3500         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
3501         * Makefile.in: Regenerate.
3502         * testsuite/plugin_final_layout.sh: Check if unique segment
3503         functionality works.
3504         * testsuite/plugin_section_order.c (onload): Check if new interfaces
3505         are available.
3506         (allow_unique_segment_for_sections): New global.
3507         (unique_segment_for_sections): New global.
3508         (claim_file_hook): Call allow_unique_segment_for_sections.
3509         (all_symbols_read_hook): Call unique_segment_for_sections.
3510
3511 2012-08-22  Cary Coutant  <ccoutant@google.com>
3512
3513         * layout.cc (Layout::include_section): Don't assert on GROUP
3514         sections with --emit-relocs.
3515
3516 2012-08-21  Cary Coutant  <ccoutant@google.com>
3517
3518         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
3519         if --export-dynamic-symbol names an undef symbol.
3520
3521 2012-08-18  Alan Modra  <amodra@gmail.com>
3522
3523         * powerpc.cc: Formatting and white space.
3524         (Powerpc_relobj): Rename got2_section_ to special_.
3525         Add opd_ent_shndx_ and opd_ent_off_ vectors.
3526         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
3527         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
3528         (Target_powerpc): Add Address typedef and invalid_address.  Use
3529         throughout.
3530         (Target_powerpc::is_branch_reloc): New function.
3531         (Powerpc_relocate_functions): Add Address typedef, use throughout.
3532         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
3533         for dst_mask, value and addend.
3534         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
3535         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
3536         (Output_data_glink::do_write): Correct toc base.  Don't try to use
3537         uint16_t for 24-bit offset.  Use get_output_section_offset and
3538         check return.
3539         (Target_powerpc::Scan::local): Handle more relocs.
3540         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
3541         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
3542         Plug in toc restoring insn after plt calls.  Translate branches
3543         to function descriptor symbols to corresponding entry point.
3544         (Target_powerpc::relocate_for_relocatable): Check return from
3545         get_output_section_offset.
3546         * symtab.h: Comment typo.
3547
3548 2012-08-14  Ian Lance Taylor  <iant@google.com>
3549
3550         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
3551         unsupported_relocal_local to call unsupported_reloc_global.
3552
3553 2012-08-14  Nick Clifton  <nickc@redhat.com>
3554
3555         PR ld/14265
3556         * script-sections.cc (Sections_element::output_section_name): Add
3557         keep return parameter.
3558         (Output_section_element::match_name): Add keep return parameter.
3559         Return the value of the keep_ member.
3560         * script-sections.h (class Output_section): Update
3561         output_section_name prototype.
3562         * layout.cc (Layout::keep_input_section): New public member
3563         function.
3564         (Layout::choose_output_section): Pass keep parameter to
3565         output_section_name.
3566         * layout.h (class Layout): Add keep_input_section.
3567         * object.cc (Sized_relobj_file::do_layout): Check for kept input
3568         sections.
3569         * testsuite/Makefile.am: Add a test.
3570         * testsuite/Makefile.in: Regenerate.
3571         * testsuite/pr14265.c: Source file for the test.
3572         * testsuite/pr14265.t: Linker script for the test.
3573         * testsuite/pr14265.sh: Shell script for the test.
3574
3575 2012-08-14  Alan Modra  <amodra@gmail.com>
3576
3577         * target.h (Target::output_section_name): New function.
3578         (Target::do_output_section_name): New function.
3579         * layout.cc (Layout::choose_output_section): Call the above.
3580         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
3581
3582 2012-08-14  Alan Modra  <amodra@gmail.com>
3583
3584         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
3585         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
3586         for replace_constant call.
3587         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
3588         (Output_data_glink::do_print_to_mapfile): New function.
3589         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
3590         (Target_powerpc::Relocate::relocate): Likewise.
3591
3592 2012-08-14  Alan Modra  <amodra@gmail.com>
3593
3594         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
3595         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
3596         (Output_data_glink::add_entry,find_entry): Remove shndx param.
3597         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
3598         all references to shndx_.  Handle special case for R_PPC_PLTREL24
3599         here.
3600         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
3601         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
3602         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
3603         here.
3604         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
3605         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
3606
3607 2012-08-12  Alan Modra  <amodra@gmail.com>
3608
3609         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
3610         (glink insn constants): Use uint32_t.
3611         (Output_data_glink::add_entry): Use insert, not [] operator.
3612
3613 2012-08-11  Alan Modra  <amodra@gmail.com>
3614
3615         * object.h (Sized_relobj_file::find_shdr): New function.
3616         (Sized_relobj_file::find_special_sections): New function.
3617         * object.cc (Sized_relobj_file::find_shdr): New function.
3618         (Sized_relobj_file::find_eh_frame): Use find_shdr.
3619         (Sized_relobj_file::find_special_sections): New function, split out..
3620         (Sized_relobj_file::do_read_symbols): ..from here.
3621         * output.h (Output_data_got::replace_constant): New function.
3622         (Output_data_got::num_entries): New function.
3623         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
3624         (Output_data_got::got_offset): Protected rather than private.
3625         (Output_data_got::replace_got_entry): New function.
3626         * output.cc (Output_data_got::replace_got_entry): New function.
3627         * powerpc.cc (class Powerpc_relobj): New.
3628         (class Powerpc_relocate_functions): Delete all psymval variants or
3629         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
3630         Implement _ha functions using corresponding _hi function.
3631         (Powerpc_relobj::find_special_sections): New function.
3632         (Target_powerpc::do_make_elf_object): New function.
3633         (class Output_data_got_powerpc): New.
3634         (class Output_data_glink): New.
3635         (class Powerpc_scan_relocatable_reloc): New.
3636         Many more changes througout file.
3637
3638 2012-08-09  Nick Clifton  <nickc@redhat.com>
3639
3640         * po/vi.po: Updated Vietnamese translation.
3641
3642 2012-08-07  Ian Lance Taylor  <iant@google.com>
3643
3644         * layout.cc (Layout::add_target_dynamic_tags): If
3645         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
3646         plt_rel.
3647
3648 2012-07-30  Nick Clifton  <nickc@redhat.com>
3649
3650         * po/gold.pot: Updated template.
3651         * po/es.po: Updated Spanish translation.
3652
3653 2012-07-18  Cary Coutant  <ccoutant@google.com>
3654
3655         PR gold/14344
3656         * configure.ac: Add check for -gpubnames support.
3657         * configure: Regenerate.
3658         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
3659         support; force -gno-pubnames.
3660         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
3661         support.
3662         (gdb_index_test_4): New test.
3663         * testsuite/Makefile.in: Regenerate.
3664         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
3665         * testsuite/gdb_index_test_2.sh: Likewise.
3666         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
3667         * testsuite/gdb_index_test_4.sh: New script.
3668         * testsuite/gdb_index_test_comm.sh: New script with common code;
3669         don't look for space after colon.
3670
3671 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
3672
3673         * gold.cc (queue_middle_tasks): Update function order only after
3674         deferred objects due to plugins are processed.
3675
3676 2012-07-11  Ian Lance Taylor  <iant@google.com>
3677
3678         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
3679         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
3680         (Target_arm::scan_reloc_for_stub): Likewise.
3681         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
3682         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
3683         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
3684         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
3685         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
3686
3687 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
3688             Ian Lance Taylor  <iant@google.com>
3689
3690         PR gold/14309
3691         * configure.ac: Test whether std::tr1::hash<off_t> works.
3692         * gold.h: Add a specialization for std::tr1::hash<off_t> if
3693         needed.
3694         * output.h (class Output_fill): Add virtual destructor.
3695         * configure, config.in: Rebuild.
3696
3697 2012-06-22  Roland McGrath  <mcgrathr@google.com>
3698
3699         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
3700
3701 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
3702
3703         * plugin.cc (Plugin::load): Handle position independent executables.
3704
3705 2012-06-06  Cary Coutant  <ccoutant@google.com>
3706
3707         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
3708         add .debug_macro.
3709         (lines_only_debug_sections): Likewise.
3710         (gdb_fast_lookup_sections): New static array.
3711         (is_gdb_debug_section): Rename formal parameter.
3712         (is_lines_only_debug_section): Likewise.
3713         (is_gdb_fast_lookup_section): New function.
3714         (Layout::include_section): Check for ".zdebug_" prefix; pass
3715         section name suffix to is_gdb_debug_section, et al.; check for
3716         fast-lookup sections when building .gdb_index.
3717         * options.h (--strip-debug-gdb): Update GDB version number.
3718
3719 2012-06-06  Cary Coutant  <ccoutant@google.com>
3720
3721         * configure.ac: Add check for fallocate.
3722         * configure: Regenerate.
3723         * config.in: Regenerate.
3724
3725         * options.h (class General_options): Add --mmap-output-file and
3726         --posix-fallocate options.
3727         * output.cc: (posix_fallocate): Remove; replace with...
3728         (gold_fallocate): New function.
3729         (Output_file::map_no_anonymous): Call gold_fallocate.
3730         (Output_file::map): Check --mmap-output-file option.
3731
3732 2012-06-05  Jing Yu  <jingyu@google.com>
3733
3734         * gold.h (textdomain): Add do {} to empty while(0).
3735         (bindtextdomain): Likewise.
3736
3737 2012-06-04  Cary Coutant  <ccoutant@google.com>
3738
3739         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
3740         has_dynsym_index.
3741
3742 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
3743
3744         * symtab.cc (Symbol_table::define_special_symbol):
3745         Initialize *poldsym to prevent uninitialized variable errors.
3746
3747 2012-05-23  Cary Coutant  <ccoutant@google.com>
3748
3749         * layout.cc (Layout::section_name_mapping): Add rules to handle
3750         exact match on .data.rel.ro.local or .data.rel.ro.
3751         (Layout::output_section_name): Check for exact matches.
3752
3753 2012-05-23  Cary Coutant  <ccoutant@google.com>
3754
3755         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
3756         more carefully.
3757
3758 2012-05-22  Cary Coutant  <ccoutant@google.com>
3759
3760         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
3761         object before exporting symbol.
3762
3763 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
3764
3765         * testsuite/tls_test.cc: Include "config.h" first.
3766         * testsuite/tls_test_c.c: Likewise.
3767
3768 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
3769             Nick Clifton  <nickc@redhat.com>
3770
3771         PR 14072
3772         * configure.in: Add check that sysdep.h has been included before
3773         any system header files.
3774         * configure: Regenerate.
3775         * config.in: Regenerate.
3776
3777 2012-05-14  Cary Coutant  <ccoutant@google.com>
3778
3779         * layout.cc (Layout::make_output_section): Mark .tdata section
3780         as RELRO.
3781         * testsuite/relro_test.cc: Add a TLS variable.
3782
3783 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
3784
3785         PR gold/14091
3786         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3787         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3788         R_X86_64_64.
3789
3790 2012-05-08  Cary Coutant  <ccoutant@google.com>
3791
3792         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3793         (lines_only_debug_sections): Likewise.
3794
3795 2012-05-02  Roland McGrath  <mcgrathr@google.com>
3796
3797         * nacl.cc: New file.
3798         * nacl.h: New file.
3799         * Makefile.am (CCFILES, HFILES): Add them.
3800         * Makefile.in: Regenerate.
3801         * i386.cc (Output_data_plt_i386_nacl): New class.
3802         (Output_data_plt_i386_nacl_exec): New class.
3803         (Output_data_plt_i386_nacl_dyn): New class.
3804         (Target_i386_nacl): New class.
3805         (Target_selector_i386_nacl): New class.
3806         (target_selector_i386): Use it instead of Target_selector_i386.
3807         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3808         (Target_x86_64_nacl): New class.
3809         (Target_selector_x86_64_nacl): New class.
3810         (target_selector_x86_64, target_selector_x32): Use it instead of
3811         Target_selector_x86_64.
3812         * arm.cc (Output_data_plt_arm_nacl): New class.
3813         (Target_arm_nacl): New class.
3814         (Target_selector_arm_nacl): New class.
3815         (target_selector_arm, target_selector_armbe): Use it instead of
3816         Target_selector_arm.
3817
3818         * target-select.cc (select_target): Take new Input_file* and off_t
3819         arguments, pass them on to recognize method of selector.
3820         * object.cc (make_elf_sized_object): Update caller.
3821         * parameters.cc (parameters_force_valid_target): Likewise.
3822         * incremental.cc (make_sized_incremental_binary): Likewise.
3823         * target-select.h: Update decl.
3824         (Target_selector::recognize): Take new Input_file* argument,
3825         pass it on to do_recognize.
3826         (Target_selector::do_recognize): Take new Input_file* argument.
3827         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3828         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3829         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3830         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3831
3832         * target.h (Target::Target_info): New members isolate_execinstr
3833         and rosegment_gap.
3834         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3835         * arm.cc (Target_arm::arm_info): Update initializer.
3836         * i386.cc (Target_i386::i386_info): Likewise.
3837         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3838         * sparc.cc (Target_sparc::sparc_info): Likewise.
3839         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3840         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3841         * layout.cc (Layout::attach_allocated_section_to_segment):
3842         Take new const Target* argument.  If target->isolate_execinstr(), act
3843         like --rosegment.
3844         (Layout::find_first_load_seg): Take new const Target* argument;
3845         if target->isolate_execinstr(), reject PF_X segments.
3846         (Layout::relaxation_loop_body): Update caller.
3847         (Layout::set_segment_offsets): If target->isolate_execinstr(),
3848         reset file offset to zero when we hit LOAD_SEG, and then do a second
3849         loop over the segments before LOAD_SEG to reassign offsets after
3850         addresses have been determined.  Handle target->rosegment_gap().
3851         (Layout::attach_section_to_segment): Take new const Target* argument;
3852         pass it to attach_allocated_section_to_segment.
3853         (Layout::make_output_section): Update caller.
3854         (Layout::attach_sections_to_segments): Take new const Target* argument;
3855         pass it to attach_section_to_segment.
3856         * gold.cc (queue_middle_tasks): Update caller.
3857         * layout.h (Layout): Update method decls with new arguments.
3858
3859         * arm.cc (Target_arm::Target_arm): Take optional argument for the
3860         Target_info pointer to use.
3861         (Target_arm::do_make_data_plt): New virtual method.
3862         (Target_arm::make_data_plt): New method that calls it.
3863         (Target_arm::make_plt_entry): Use it.
3864         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
3865         for the section alignment.
3866         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
3867         method.
3868         (Output_data_plt_arm::first_plt_entry_offset): Call it.
3869         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
3870         method.
3871         (Output_data_plt_arm::get_plt_entry_size): Call it.
3872         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
3873         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
3874         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
3875         method.
3876         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
3877         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
3878         method instead of sizeof(plt_entry).
3879         (Output_data_plt_arm::add_entry): Likewise.
3880         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
3881         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
3882         than static method.
3883         (Target_arm::plt_entry_size): Likewise.
3884         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
3885         Move to ...
3886         (Output_data_plt_arm_standard): ... here, new class.
3887         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
3888         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
3889         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
3890
3891         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3892         Take additional argument for the PLT entry size.
3893         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
3894         Use get_plt_entry_size method rather than plt_entry_size variable.
3895         (Output_data_plt_x86_64::reserve_slot): Likewise.
3896         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
3897         (Output_data_plt_x86_64::add_entry): Likewise.
3898         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
3899         (Output_data_plt_x86_64::address_for_global): Likewise.
3900         (Output_data_plt_x86_64::address_for_local): Likewise.
3901         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3902         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
3903         Make method non-static.
3904         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
3905         method.
3906         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
3907         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
3908         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
3909         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
3910         virtual method.
3911         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
3912         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
3913         virtual method.
3914         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
3915         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
3916         virtual method.
3917         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3918         (Output_data_plt_x86_64::plt_entry_size)
3919         (Output_data_plt_x86_64::first_plt_entry)
3920         (Output_data_plt_x86_64::plt_entry)
3921         (Output_data_plt_x86_64::tlsdesc_plt_entry)
3922         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3923         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3924         (Output_data_plt_x86_64_standard): ... here, new class.
3925         (Target_x86_64::Target_x86_64): Take optional argument for the
3926         Target_info pointer to use.
3927         (Target_x86_64::do_make_data_plt): New virtual method.
3928         (Target_x86_64::make_data_plt): New method to call it.
3929         (Target_x86_64::init_got_plt_for_update): Use that.
3930         Call this->plt_->add_eh_frame method here.
3931         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3932         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3933         rather than static method.
3934         (Target_x86_64::plt_entry_size): Likewise.
3935         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3936         rather than plt_entry_size variable.  Move guts of PLT filling to...
3937         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3938         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3939         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3940
3941         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3942         additional argument for the section alignment.
3943         Don't do add_eh_frame_for_plt here.
3944         (Output_data_plt_i386::first_plt_entry_offset): Make the method
3945         non-static.  Use get_plt_entry_size method rather than plt_entry_size
3946         variable.
3947         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3948         method.
3949         (Output_data_plt_i386::get_plt_entry_size): Call it.
3950         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
3951         (Output_data_plt_i386::add_eh_frame): New method to call it.
3952         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
3953         method.
3954         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
3955         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
3956         method.
3957         (Output_data_plt_i386::fill_plt_entry): New method to call it.
3958         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
3959         method instead of plt_entry_size.
3960         (Output_data_plt_i386::plt_entry_size)
3961         (Output_data_plt_i386::plt_eh_frame_fde_size)
3962         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
3963         (Output_data_plt_i386_standard): ... here, new class.
3964         (Output_data_plt_i386_exec): New class.
3965         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
3966         (Output_data_plt_i386_exec::first_plt_entry): ... here.
3967         (Output_data_plt_i386::exec_plt_entry): Move to ...
3968         (Output_data_plt_i386_exec::plt_entry): ... here.
3969         (Output_data_plt_i386_dyn): New class.
3970         (Output_data_plt_i386::first_plt_entry): Move to ...
3971         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
3972         (Output_data_plt_i386::dyn_plt_entry): Move to ...
3973         (Output_data_plt_i386_dyn::plt_entry): ... here.
3974         (Target_i386::Target_i386): Take optional argument for the Target_info
3975         pointer to use.
3976         (Target_i386::do_make_data_plt): New virtual method.
3977         (Target_i386::make_data_plt): New method to call it.
3978         (Target_i386::make_plt_section): Use that.
3979         Call this->plt_->add_eh_frame method here.
3980         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3981         rather than plt_entry_size variable.
3982         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3983         (Output_data_plt_i386::address_for_local): Likewise.
3984         (Output_data_plt_i386::do_write): Likewise.
3985         Move guts of PLT filling to...
3986         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3987         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3988         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3989         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3990
3991 2012-05-01  Cary Coutant  <ccoutant@google.com>
3992
3993         * dwarf_reader.cc (Dwarf_die::read_attributes)
3994         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3995         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3996         * reduced_debug_output.cc
3997         (Output_reduced_debug_info_section::get_die_end): Remove
3998         DW_FORM_GNU_ref_index.  Add default case.
3999
4000 2012-04-26  Mark Wielaard  <mjw@redhat.com>
4001
4002         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
4003         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
4004         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
4005         DW_AT_high_pc as offset from DW_AT_low_pc.
4006
4007         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
4008         * testsuite/Makefile.in: Regenerate.
4009         * testsuite/gdb_index_test_3.c: New test source file.
4010         * testsuite/gdb_index_test_3.sh: New test source file.
4011
4012 2012-04-25  Ian Lance Taylor  <iant@google.com>
4013
4014         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
4015         pointer.
4016         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
4017         as a class, not a struct.
4018         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
4019         (Target_arm::apply_cortex_a8_workaround): Likewise.
4020         * gc.h: Declare Reloc_types as a struct, not a class.
4021         * object.h: Declare Symbols_data as a struct.
4022         * reloc.h: Declare Read_relocs_data as a struct.
4023         * target.h: Declare Relocate_info as a struct.
4024
4025 2012-04-24  David S. Miller  <davem@davemloft.net>
4026
4027         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
4028         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
4029         and R_SPARC_WPLT30.
4030
4031 2012-04-24  Cary Coutant  <ccoutant@google.com>
4032
4033         * incremental-dump.cc (find_input_containing_global): Replace
4034         magic number with symbolic constant.
4035         (dump_incremental_inputs): Update version number.
4036         * incremental.cc (Output_section_incremental_inputs): Update version
4037         number; import symbolic constants from Incremental_inputs_reader.
4038         (Incremental_inputs::create_data_sections): Align relocations
4039         section correctly for 64-bit targets.
4040         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
4041         constants; add padding.
4042         (Output_section_incremental_inputs::write_header): Add assert for
4043         header_size.
4044         (Output_section_incremental_inputs::write_input_files): Add assert
4045         for input_entry_size.
4046         (Output_section_incremental_inputs::write_info_blocks): Add padding;
4047         add assert for object_info_size, input_section_entry_size,
4048         global_sym_entry_size.
4049         * incremental.h (Incremental_inputs_reader): Add symbolic constants
4050         for data structure sizes; use them.
4051         (Incremental_input_entry_reader): Import symbolic constants from
4052         Incremental_inputs_reader; use them.
4053
4054 2012-04-23  David S. Miller  <davem@davemloft.net>
4055
4056         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
4057         and elf_flags_set_.
4058         (Target_sparc::Target_sparc): Initialize new fields.
4059         (Target_sparc::do_make_elf_object): New function.
4060         (Target_sparc::do_adjust_elf_header): New function.
4061
4062 2012-04-23  Cary Coutant  <ccoutant@google.com>
4063
4064         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
4065         CU range table of gdb index.
4066
4067 2012-04-20  David S. Miller  <davem@davemloft.net>
4068
4069         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
4070         instead of false.
4071
4072 2012-04-16  David S. Miller  <davem@davemloft.net>
4073
4074         * sparc.cc (Target_sparc::got_address): New function.
4075         (Sparc_relocate_functions::gdop_hix22): New function.
4076         (Sparc_relocate_functions::gdop_lox10): New function.
4077         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
4078         relocs.
4079         (Target_sparc::Scan::local): Likewise if the global symbol is not
4080         preemptible and is not IFUNC.
4081         (Target_sparc::Relocate::relocate): Perform GOTDATA code
4082         transformations for local and non-preemptible non-IFUNC global
4083         symbols.
4084
4085         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
4086         writing out 64-bit part of ranges.
4087
4088         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
4089         -fpic and -fpie respectively.
4090         * Makefile.in: Regenerate.
4091
4092         * sparc.cc (class Target_sparc): Add rela_ifunc_.
4093         (Target_sparc::Target_sparc): Initialize new field.
4094         (Target_sparc::do_plt_section_for_global): New function.
4095         (Target_sparc::do_plt_section_for_local): New function.
4096         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
4097         (Target_sparc::make_plt_section): New function, broken out of
4098         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
4099         (Target_sparc::make_plt_entry): Call make_plt_section.
4100         (Target_sparc::make_local_ifunc_plt_entry): New function.
4101         (Target_sparc::rela_ifunc_section): New function.
4102         (Target_sparc::plt_section): Remove const.
4103         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
4104         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
4105         and ifunc_count_ fields.
4106         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
4107         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
4108         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
4109         (Output_data_plt_sparc::rela_ifunc): New function.
4110         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
4111         (Output_data_plt_sparc::has_ifunc_section): New function.
4112         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
4113         (Output_data_plt_sparc::address_for_global): New function.
4114         (Output_data_plt_sparc::address_for_local): New function.
4115         (Output_data_plt_sparc::plt_index_to_offset): New function.
4116         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
4117         and entry_count.
4118         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
4119         entry_count.
4120         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
4121         R_SPARC_JMP_IREL to switch.
4122         (Target_sparc::Scan::check_non_pic): Likewise.
4123         (Target_sparc::Scan::local): Handle IFUNC symbols.
4124         (Target_sparc::Scan::local): Likewise.
4125         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
4126         and plt_address_for_local.
4127         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
4128         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
4129
4130         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
4131         (class Output_data_reloc): Adjust calls to Output_reloc_type.
4132         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
4133         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
4134         global relocs too.
4135         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
4136         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
4137         calls.
4138         * sparc.cc (Target_sparc::Scan::global): Likewise.
4139         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4140
4141 2012-04-16  Cary Coutant  <ccoutant@google.com>
4142
4143         * archive.cc (Library_base::should_include_member): Check for
4144         --export-dynamic-symbol.
4145         * options.h (class General_options): Add --export-dynamic-symbol.
4146         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
4147         --export-dynamic-symbol.
4148         (Symbol_table::gc_mark_undef_symbols): Likewise.
4149         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
4150
4151 2012-04-12  David S. Miller  <davem@davemloft.net>
4152
4153         * sparc.cc (Reloc::wdisp10): New relocation method.
4154         (Reloc::h34): Likewise.
4155         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
4156         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
4157         R_SPARC_WDISP10.
4158         (Target_sparc::Scan::local): Likewise.
4159         (Target_sparc::Scan::global): Likewise.
4160         (Target_sparc::Relocate::relocate): Likewise.
4161
4162 2012-04-09  Cary Coutant  <ccoutant@google.com>
4163
4164         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
4165         low_pc == 0.
4166
4167 2012-04-06  Ian Lance Taylor  <iant@google.com>
4168
4169         * timer.cc: #include <unistd.h>.
4170
4171 2012-04-06  Roland McGrath  <mcgrathr@google.com>
4172
4173         * configure.in (AC_CHECK_HEADERS): Add locale.h.
4174         * config.in: Regenerate.
4175         * configure: Regenerate.
4176
4177 2012-04-05  Nick Clifton  <nickc@redhat.com>
4178
4179         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
4180         (AM_LC_MESSAGES): Add.
4181         * aclocal.m4: Regenerate.
4182         * config.in: Regenerate.
4183         * configure: Regenerate.
4184
4185 2012-03-21  Cary Coutant  <ccoutant@google.com>
4186
4187         * Makefile.am: Add gdb-index.cc, gdb-index.h.
4188         * Makefile.in: Regenerate.
4189         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
4190         (Sized_elf_reloc_mapper::symbol_section): New function.
4191         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
4192         (make_elf_reloc_mapper): New function.
4193         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
4194         (Dwarf_abbrev_table::do_read_abbrevs): New function.
4195         (Dwarf_abbrev_table::do_get_abbrev): New function.
4196         (Dwarf_ranges_table::read_ranges_table): New function.
4197         (Dwarf_ranges_table::read_range_list): New function.
4198         (Dwarf_pubnames_table::read_section): New function.
4199         (Dwarf_pubnames_table::read_header): New function.
4200         (Dwarf_pubnames_table::next_name): New function.
4201         (Dwarf_die::Dwarf_die): New function.
4202         (Dwarf_die::read_attributes): New function.
4203         (Dwarf_die::skip_attributes): New function.
4204         (Dwarf_die::set_name): New function.
4205         (Dwarf_die::set_linkage_name): New function.
4206         (Dwarf_die::attribute): New function.
4207         (Dwarf_die::string_attribute): New function.
4208         (Dwarf_die::int_attribute): New function.
4209         (Dwarf_die::uint_attribute): New function.
4210         (Dwarf_die::ref_attribute): New function.
4211         (Dwarf_die::child_offset): New function.
4212         (Dwarf_die::sibling_offset): New function.
4213         (Dwarf_info_reader::check_buffer): New function.
4214         (Dwarf_info_reader::parse): New function.
4215         (Dwarf_info_reader::do_parse): New function.
4216         (Dwarf_info_reader::do_read_string_table): New function.
4217         (Dwarf_info_reader::lookup_reloc): New function.
4218         (Dwarf_info_reader::get_string): New function.
4219         (Dwarf_info_reader::visit_compilation_unit): New function.
4220         (Dwarf_info_reader::visit_type_unit): New function.
4221         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
4222         Sized_elf_reloc_mapper.
4223         (Sized_dwarf_line_info::symbol_section): Remove function.
4224         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
4225         (Sized_dwarf_line_info::read_line_mappings): Remove object
4226         parameter, adjust callers.
4227         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
4228         * dwarf_reader.h: Include <sys/types.h>.
4229         (class Track_relocs): Remove forward declaration.
4230         (class Elf_reloc_mapper): New class.
4231         (class Sized_elf_reloc_mapper): New class.
4232         (class Dwarf_abbrev_table): New class.
4233         (class Dwarf_range_list): New class.
4234         (class Dwarf_ranges_table): New class.
4235         (class Dwarf_pubnames_table): New class.
4236         (class Dwarf_die): New class.
4237         (class Dwarf_info_reader): New class.
4238         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
4239         (Sized_dwarf_line_info::symbol_section): Remove member function.
4240         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
4241         base class.
4242         * gdb-index.cc: New source file.
4243         * gdb-index.h: New source file.
4244         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
4245         and .debug_types sections, call Layout::add_to_gdb_index.
4246         (Sized_relobj_incr::do_section_name): Implement.
4247         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
4248         return type; Implement.
4249         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
4250         return type.
4251         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
4252         parameter list and return type.
4253         (Sized_incr_dynobj::do_section_contents): Likewise.
4254         * layout.cc: Include gdb-index.h.
4255         (Layout::Layout): Initialize gdb_index_data_.
4256         (Layout::init_fixed_output_section): Check for .gdb_index section.
4257         (Layout::add_to_gdb_index): New function. Instantiate.
4258         * layout.h: Add forward declaration for class Gdb_index.
4259         (Layout::add_to_gdb_index): New member function.
4260         (Layout::gdb_index_data_): New data member.
4261         * main.cc: Include gdb-index.h.
4262         (main): Print statistics for gdb index.
4263         * object.cc (Object::section_contents): Move code into
4264         do_section_contents.
4265         (need_decompressed_section): Check for sections needed when building
4266         gdb index.
4267         (build_compressed_section_map): Likewise.
4268         (Sized_relobj_file::do_read_symbols): Need local symbols when building
4269         gdb index.
4270         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
4271         sections; call Layout::add_to_gdb_index.
4272         (Sized_relobj_file::do_decompressed_section_contents): Call
4273         do_section_contents directly.
4274         * object.h (Object::do_section_contents): Adjust parameter list and
4275         return type.
4276         (Object::do_decompressed_section_contents): Call do_section_contents
4277         directly.
4278         (Sized_relobj_file::do_section_contents): Adjust parameter list and
4279         return type.
4280         * options.h (class General_options): Add --gdb-index option.
4281         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
4282         list and return type.
4283         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
4284         * reloc.h (Track_relocs::checkpoint): New function.
4285         (Track_relocs::reset): New function.
4286
4287         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
4288         New test cases.
4289         * testsuite/Makefile.in: Regenerate.
4290         * testsuite/gdb_index_test.cc: New test source file.
4291         * testsuite/gdb_index_test_1.sh: New test source file.
4292         * testsuite/gdb_index_test_2.sh: New test source file.
4293
4294 2012-03-19  Doug Kwan  <dougkwan@google.com>
4295
4296         * arm.cc (Target_arm::do_define_standard_symbols): New method.
4297         (Target_arm::do_finalize_sections): Remove code which defines
4298         __exidx_start and __exidx_end.  Make symbol table parameter
4299         anonymous as it is not used.
4300         * gold.cc (queue_middle_tasks): Call target hook to define any
4301         target-specific symbols.
4302         * target.h (Target::define_standard_symbols): New method.
4303         (Target::do_define_standard_symbols): Same.
4304         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
4305         * testsuite/Makefile.in: Regenerate.
4306         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
4307         and __exidx_end.
4308         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
4309         relocations are generated for __exidx_start and __exidx_end.
4310
4311 2012-03-16  Doug Kwan  <dougkwan@google.com>
4312
4313         * testsuite/Makefile.am: Disable test initpri3b.
4314         * testsuite/Makefile.in: Regenerate.
4315
4316 2012-03-15  Doug Kwan  <dougkwan@google.com>
4317
4318         * arm.cc (Target_arm::got_section): Make .got section read-only
4319         if -z now is given.
4320
4321 2012-03-15  Ian Lance Taylor  <iant@google.com>
4322
4323         PR gold/13850
4324         * layout.cc (Layout::make_output_section): Correctly mark
4325         SHT_INIT_ARRAY, et. al., as relro.
4326
4327 2012-03-14  Doug Kwan  <dougkwan@google.com>
4328
4329         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
4330         dynamic relocations for protected symbols in shared objects.
4331
4332 2012-03-13  Ian Lance Taylor  <iant@google.com>
4333
4334         * resolve.cc (Symbol_table::resolve): When merging common symbols,
4335         keep the larger alignment.
4336
4337 2012-03-12  Cary Coutant  <ccoutant@google.com>
4338
4339         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
4340         handling of DW_LNE_define_file.
4341
4342 2012-03-12  Cary Coutant  <ccoutant@google.com>
4343
4344         * reduced_debug_output.cc
4345         (Output_reduced_debug_info_section::get_die_end): Add new FORM
4346         codes to switch.
4347
4348 2012-02-29  Cary Coutant  <ccoutant@google.com>
4349
4350         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
4351
4352 2012-02-29  Cary Coutant  <ccoutant@google.com>
4353
4354         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4355         Call Object::decompressed_section_contents.
4356         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
4357         New dtor.
4358         (Sized_dwarf_line_info::buffer_start_): New data member.
4359         * merge.cc (Output_merge_data::do_add_input_section): Call
4360         Object::decompressed_section_contents.
4361         (Output_merge_string::do_add_input_section): Likewise.
4362         * object.cc (need_decompressed_section): New function.
4363         (build_compressed_section_map): Decompress sections needed later.
4364         (Sized_relobj_file::do_decompressed_section_contents): New function.
4365         (Sized_relobj_file::do_discard_decompressed_sections): New function.
4366         * object.h (Object::decompressed_section_contents): New function.
4367         (Object::discard_decompressed_sections): New function.
4368         (Object::do_decompressed_section_contents): New function.
4369         (Object::do_discard_decompressed_sections): New function.
4370         (Compressed_section_info): New type.
4371         (Compressed_section_map): Include decompressed section contents.
4372         (Sized_relobj_file::do_decompressed_section_contents): New function.
4373         (Sized_relobj_file::do_discard_decompressed_sections): New function.
4374
4375 2012-02-16  Cary Coutant  <ccoutant@google.com>
4376
4377         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
4378         * testsuite/Makefile.in: Regenerate.
4379
4380 2012-02-14  Cary Coutant  <ccoutant@google.com>
4381
4382         * options.cc (General_options::finalize): Disallow -pie and -static.
4383
4384 2012-02-03  Doug Kwan  <dougkwan@google.com>
4385
4386         * arm.cc (Arm_relocate_functions::abs8,
4387         Arm_relocate_functions::abs16): Use
4388         Bits::has_signed_unsigned_overflow32.
4389         (Arm_relocate_functions::thm_abs8): Correct range of
4390         overflow check.
4391         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
4392         in assertions.
4393
4394 2012-02-02  Doug Kwan  <dougkwan@google.com>
4395
4396         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
4397         position independent outputs, not just shared objects.
4398
4399 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
4400
4401         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
4402         * configure: Regenerated.
4403
4404 2012-01-27  Ian Lance Taylor  <iant@google.com>
4405
4406         * reloc.h (Bits): New class with static functions, copied from
4407         namespace utils in arm.cc.
4408         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
4409         instead.
4410
4411 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4412
4413         * incremental.cc (write_info_blocks): Correct relocation offset.
4414
4415 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4416
4417         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
4418         (Relocate::tls_gd_to_le): Likewise.
4419
4420 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4421
4422         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
4423
4424 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4425
4426         * configure.ac: Check if -mcmodel=medium works.
4427         * configure: Regenerated.
4428
4429 2012-01-24  Cary Coutant  <ccoutant@google.com>
4430
4431         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
4432         definition and ...
4433         (read_unsigned_LEB_128_x): ... this new function.
4434         (read_signed_LEB_128): Replaced with inline definition and ...
4435         (read_signed_LEB_128_x): ... this new function.
4436         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
4437         (read_unsigned_LEB_128): Add inline definition.
4438         (read_signed_LEB_128_x): New function.
4439         (read_signed_LEB_128): Add inline definition.
4440         * testsuite/Makefile.am (leb128_unittest): New unit test.
4441         * testsuite/Makefile.in: Regenerate.
4442         * testsuite/leb128_unittest.cc: New unit test.
4443
4444 2012-01-23  Ian Lance Taylor  <iant@google.com>
4445
4446         PR gold/13617
4447         * i386.cc (Target_i386::do_code_fill): When using a jmp
4448         instruction, pad with nop instructions.
4449         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4450
4451 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
4452
4453         * x86_64.cc (gc_process_relocs): Add typename on types used in
4454         template.
4455         (scan_relocs): Likewise.
4456         (relocate_section): Likewise.
4457         (apply_relocation): Likewise.
4458
4459 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
4460
4461         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
4462         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
4463         under x32.
4464
4465 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
4466
4467         * x86_64.cc: Initial support for x32.
4468
4469 2012-01-03  Cary Coutant  <ccoutant@google.com>
4470
4471         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
4472         Use abstract base class for GOT.
4473         * gold/output.h (class Output_data_got_base): New abstract base class.
4474         (class Output_data_got): Derive from new base class, adjust ctors.
4475         (Output_data_got::reserve_slot): Make virtual; rename to
4476         do_reserve_slot; Adjust callers.
4477         * gold/target.h (Sized_target::init_got_plt_for_update): Return
4478         pointer to abstract base class.
4479         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
4480
4481 2011-12-18  Ian Lance Taylor  <iant@google.com>
4482
4483         * object.h (Relobj::local_symbol_value): New function.
4484         (Relobj::local_plt_offset): New function.
4485         (Relobj::local_has_got_offset): New function.
4486         (Relobj::local_got_offset): New function.
4487         (Relobj::set_local_got_offset): New function.
4488         (Relobj::do_local_symbol_value): New pure virtual function.
4489         (Relobj::do_local_plt_offset): Likewise.
4490         (Relobj::do_local_has_got_offset): Likewise.
4491         (Relobj::do_local_got_offset): Likewise.
4492         (Relobj::do_set_local_got_offset): Likewise.
4493         (Sized_relobj::do_local_has_got_offset): Rename from
4494         local_has_got_offset.
4495         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
4496         (Sized_relobj::do_set_local_got_offset): Rename from
4497         set_local_got_offset.
4498         (Sized_relobj_file::do_local_plt_offset): Rename from
4499         local_plt_offset.
4500         (Sized_relobj_file::do_local_symbol_value): New function.
4501         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
4502         local_plt_offset.
4503         * output.cc (Output_data_got::Got_entry::write): Change object to
4504         Relobj.  Use local_symbol_value.
4505         (Output_data_got::add_global_with_rel): Change rel_dyn to
4506         Output_data_reloc_generic*.  Use add_global_generic.
4507         (Output_data_got::add_global_with_rela): Remove.  Change all
4508         callers to use add_global_with_rel.
4509         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
4510         Output_data_reloc_generic*.  Use add_global_generic.
4511         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
4512         callers to use add_global_pair_with_rel.
4513         (Output_data_got::add_local): Change object to Relobj*.
4514         (Output_data_got::add_local_plt): Likewise.
4515         (Output_data_got::add_local_with_rel): Change object to Relobj*,
4516         change rel_dyn to Output_data_reloc_generic*.  Use
4517         add_local_generic.
4518         (Output_data_got::add_local_with_rela): Remove.  Change all
4519         callers to use all_local_with_rel.
4520         (Output_data_got::add_local_pair_with_rel): Change object to
4521         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
4522         add_output_section_generic.
4523         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
4524         callers to use add_local_pair_with_rel.
4525         (Output_data_got::reserve_local): Change object to Relobj*.
4526         * output.h: (class Output_data_reloc_generic): Add pure virtual
4527         declarations for add_global_generic, add_local_generic,
4528         add_output_section_generic.
4529         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
4530         functions for Output_data_reloc_generic.  Update declarations for
4531         changes listed in output.cc.
4532         (class Output_data_got): Change template parameter to got_size.
4533         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
4534         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
4535         function.
4536         (Sized_relobj_incr::do_local_plt_offset): New function.
4537         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
4538         add_global_generic.
4539
4540 2011-12-17  Cary Coutant  <ccoutant@google.com>
4541
4542         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
4543         * resolve.cc (Symbol_table::resolve): Likewise.
4544         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
4545         arrays.
4546         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4547
4548 2011-12-16  Ian Lance Taylor  <iant@google.com>
4549
4550         * output.h (Output_data_reloc_generic::add): Only call
4551         add_dynamic_reloc if this is a dynamic reloc section.
4552
4553 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
4554
4555         PR gold/13505
4556         * target-reloc.h (apply_relocation): Replace <64, false> with
4557         <size, big_endian>.
4558
4559 2011-11-25  Nick Clifton  <nickc@redhat.com>
4560
4561         * po/it.po: New Italian translation.
4562
4563 2011-11-17  Sterling Augustine  <saugustine@google.com>
4564
4565         * script.cc (script_include_directive): Implement.
4566         (read_script_file): New local variables name and search_path. Update
4567         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
4568         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
4569         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
4570
4571 2011-11-11  Sterling Augustine  <saugustine@google.com>
4572
4573         * yyscript.y (section_cmd): Add support for INCLUDE directive.
4574         (file_or_sections_cmd): Likewise.
4575
4576 2011-11-11  Doug Kwan  <dougkwan@google.com>
4577
4578         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
4579         if --just-symbols is given.
4580
4581 2011-11-10  Doug Kwan  <dougkwan@google.com>
4582
4583         PR gold/13362
4584         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
4585         when processing data relocs.
4586         * reloc.h (Relocate_functions::rel_unaligned): New method.
4587         (Relocate_functions::pcrel_unaligned): Ditto.
4588         (Relocate_functions::rel32_unaligned): Ditto.
4589         (Relocate_functions::pcrel32_unaligned): Ditto.
4590
4591 2011-11-09  Doug Kwan  <dougkwan@google.com>
4592
4593         PR gold/13362
4594         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
4595         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
4596         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
4597         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4598         (Relocate_functions::rel_unaligned): New.
4599         (Relocate_functions::rel32_unaligned): New.
4600         * target-reloc.h (relocate_for_relocatable): Add code to handle
4601         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4602         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
4603         arm_unaligned_reloc_r): New targets.
4604         * testsuite/Makefile.in: Regenerate.
4605         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
4606         linking.
4607
4608 2011-11-02  Ian Lance Taylor  <iant@google.com>
4609
4610         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
4611         NATIVE_LINKER.
4612         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
4613         * options.cc (General_options::finalize): Use library search path
4614         from configure script if specified.  If not native and no sysroot,
4615         only search TOOLLIBDIR.
4616         * options.h (Search_directory::Search_directory): Change name to
4617         const std::string&.
4618         (General_options::add_to_library_path_with_sysroot): Change arg to
4619         const std::string&.
4620         * configure, Makefile.in, config.in: Rebuild.
4621
4622 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
4623
4624         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
4625         we are working around the ARM1176 Erratum.
4626         * options.h (General_options::fix_arm1176): Add option.
4627         * testsuite/Makefile.am: Add testcases, and keep current ones
4628         working.
4629         * testsuite/Makefile.in: Regenerate.
4630         * testsuite/arm_fix_1176.s: New file.
4631         * testsuite/arm_fix_1176.sh: Likewise.
4632
4633 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
4634
4635         * arm.cc (Target_arm::Target_arm): Remove initialisation of
4636         may_use_blx_.
4637         (Target_arm::may_use_blx): Remove method.
4638         (Target_arm::set_may_use_blx): Likewise.
4639         (Target_arm::may_use_v4t_interworking): New method.
4640         (Target_arm::may_use_v5t_interworking): Likewise.
4641         (Target_arm::may_use_blx_): Remove member variable.
4642         (Arm_relocate_functions::arm_branch_common): Check for v5T
4643         interworking.
4644         (Arm_relocate_functions::thumb_branch_common): Likewise.
4645         (Reloc_stub::stub_type_for_reloc): Likewise.
4646         (Target_arm::do_finalize_sections): Correct interworking checks.
4647         * testsuite/Makefile.am: Add new tests.
4648         * testsuite/Makefile.in: Regenerate.
4649         * testsuite/arm_farcall_arm_arm.s: New test.
4650         * testsuite/arm_farcall_arm_arm.sh: Likewise.
4651         * testsuite/arm_farcall_arm_thumb.s: Likewise.
4652         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
4653         * testsuite/arm_farcall_thumb_arm.s: Likewise.
4654         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
4655         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
4656         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
4657
4658 2011-10-31  Cary Coutant  <ccoutant@google.com>
4659
4660         PR gold/13023
4661         * expression.cc (Expression::eval_with_dot): Add
4662         is_section_dot_assignment parameter.
4663         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
4664         absolute and assigning to dot within a section.
4665         * script-sections.cc
4666         (Output_section_element_assignment::set_section_addresses): Pass
4667         dot_section to set_if_absolute.
4668         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
4669         as is_section_dot_assignment flag to eval_with_dot.
4670         (Output_section_element_dot_assignment::set_section_addresses):
4671         Likewise.
4672         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
4673         parameter.  Also set value if relative to dot_section; set the
4674         symbol's output_section.
4675         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
4676         parameter.  Adjust all callers.
4677         (Expression::eval_maybe_dot): Likewise.
4678         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
4679         Adjust all callers.
4680         * testsuite/script_test_2.t: Test assignment of an absolute value
4681         to dot within an output section element.
4682
4683 2011-10-31  Cary Coutant  <ccoutant@google.com>
4684
4685         * options.h (class General_options): Add --[no-]gnu-unique options.
4686         * symtab.cc (Symbol_table::sized_write_globals): Convert
4687         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
4688
4689 2011-10-31  Cary Coutant  <ccoutant@google.com>
4690
4691         PR gold/13359
4692         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
4693         unnecessary assertion.
4694         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
4695
4696 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
4697
4698         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4699         gc_mark_symbol.
4700         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4701         gc_mark_symbol.
4702         Change to just keep the section associated with symbol.
4703         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
4704         they are externally visible and --export-dynamic is turned on.
4705         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
4706
4707 2011-10-19  Ian Lance Taylor  <iant@google.com>
4708
4709         PR gold/13163
4710         * script-sections.cc
4711         (Output_section_element_dot_assignment::needs_output_section): New
4712         function.
4713
4714 2011-10-19  Ian Lance Taylor  <iant@google.com>
4715
4716         PR gold/13204
4717         * layout.cc (Layout::segment_precedes): Don't assert failure if a
4718         --section-start option was seen.
4719         * options.h (General_options::any_section_start): New function.
4720
4721 2011-10-18  David S. Miller  <davem@davemloft.net>
4722
4723         PR binutils/13301
4724         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
4725         member to track relocation locations that have moved during TLS
4726         reloc optimizations.
4727         (Target_sparc::Relocate::Relocate): Initialize to NULL.
4728         (Target_sparc::Relocate::relocate): Adjust view down by 4
4729         bytes if it matches reloc_adjust_addr_.
4730         (Target_sparc::Relocate::relocate_tls): Always move the
4731         __tls_get_addr call delay slot instruction forward 4 bytes when
4732         performing relaxation.
4733
4734 2011-10-18  Cary Coutant  <ccoutant@google.com>
4735
4736         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
4737         (Output_file::map_no_anonymous): Check for non-zero
4738         return code from posix_fallocate.
4739
4740 2011-10-17  Cary Coutant  <ccoutant@google.com>
4741
4742         PR gold/13245
4743         * plugin.cc (is_visible_from_outside): Check for symbols
4744         referenced from dynamic objects.
4745         * resolve.cc (Symbol_table::resolve): Don't count references
4746         from dynamic objects as references from real ELF files.
4747         * testsuite/plugin_test_2.sh: Adjust expected result.
4748
4749 2011-10-17  Cary Coutant  <ccoutant@google.com>
4750
4751         * gold.cc: Include timer.h.
4752         (queue_middle_tasks): Stamp time.
4753         (queue_final_tasks): Likewise.
4754         * main.cc (main): Store timer in parameters.  Print timers
4755         for each pass.
4756         * parameters.cc (Parameters::Parameters): Initialize timer_.
4757         (Parameters::set_timer): New function.
4758         (set_parameters_timer): New function.
4759         * parameters.h (Parameters::set_timer): New function.
4760         (Parameters::timer): New function.
4761         (Parameters::timer_): New data member.
4762         (set_parameters_timer): New function.
4763         * timer.cc (Timer::stamp): New function.
4764         (Timer::get_pass_time): New function.
4765         * timer.h (Timer::stamp): New function.
4766         (Timer::get_pass_time): New function.
4767         (Timer::pass_times_): New data member.
4768
4769 2011-10-17  Cary Coutant  <ccoutant@google.com>
4770
4771         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4772         task for members of lib groups.
4773
4774 2011-10-17  Cary Coutant  <ccoutant@google.com>
4775
4776         PR gold/13288
4777         * fileread.cc (File_read::find_view): Add assert.
4778         (File_read::make_view): Move bounds check (replace with assert)...
4779         (File_read::find_or_make_view): ... to here.
4780
4781 2011-10-12  Cary Coutant  <ccoutant@google.com>
4782
4783         * output.cc (Output_file::open_base_file): Handle case where
4784         ::read returns less than requested size.
4785
4786 2011-10-10  Cary Coutant  <ccoutant@google.com>
4787
4788         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4789         Initialize defined_count_.
4790         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4791         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4792         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4793         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4794         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4795         * incremental.h (Sized_relobj_incr::defined_count_): New data
4796         member.
4797         (Sized_incr_dynobj::defined_count_): New data member.
4798         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4799         Return zeroes instead of internal error.
4800
4801 2011-10-10  Cary Coutant  <ccoutant@google.com>
4802
4803         PR gold/13249
4804         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4805         (Output_reloc::symbol_value): Return PLT offset if flag is set.
4806         * output.h (class Output_reloc): Add use_plt_offset flag.
4807         (Output_reloc::type_): Adjust size of bit field.
4808         (Output_reloc::use_plt_offset_): New bit field.
4809         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4810         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4811         flag.  Adjust all callers.
4812         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4813         creating RELATIVE relocations.
4814
4815 2011-10-10  Nick Clifton  <nickc@redhat.com>
4816
4817         * po/es.po: Updated Spanish translation.
4818         * po/fi.po: Updated Finnish translation.
4819
4820 2011-10-03   Diego Novillo  <dnovillo@google.com>
4821
4822         * options.cc (parse_uint): Fix dereference of RETVAL.
4823
4824 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
4825
4826         * layout.h (section_order_map_): New member.
4827         (get_section_order_map): New member function.
4828         * output.cc (Output_section::add_input_section): Check for patterns
4829         only when --section-ordering-file is specified.
4830         * gold.cc (queue_middle_tasks): Delay updating order of sections till
4831         output_sections have been formed.
4832         * layout.cc (Layout_Layout): Initialize section_order_map_.
4833         * plugin.cc (update_section_order): Store order in order_map. Do not
4834         update the order.
4835         * testsuite/Makefile.am: Add test case for plugin_final_layout.
4836         * testsuite/Makefile.in: Regenerate.
4837         * testsuite/plugin_section_order.c: New file.
4838         * testsuite/plugin_final_layout.cc: New file.
4839         * testsuite/plugin_final_layout.sh: New file.
4840
4841 2011-09-29  Cary Coutant  <ccoutant@google.com>
4842
4843         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4844         Check for NULL.
4845         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
4846         symbols during incremental update.
4847         (Symbol_table::add_from_dynobj): Likewise.
4848
4849 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4850             Ian Lance Taylor  <iant@google.com>
4851
4852         * symtab.cc (Symbol_table::define_special_symbol): Always
4853         canonicalize version string.
4854
4855 2011-09-26  Cary Coutant  <ccoutant@google.com>
4856
4857         * gold.cc (queue_initial_tasks): Move option checks ...
4858         * options.cc (General_options::finalize): ... to here. Disable
4859         some options; make others fatal.
4860
4861 2011-09-26  Cary Coutant  <ccoutant@google.com>
4862
4863         gcc PR lto/47247
4864         * plugin.cc (get_symbols_v2): New function.
4865         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
4866         (is_referenced_from_outside): New function.
4867         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
4868         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
4869         (get_symbols): Pass version parameter.
4870         (get_symbols_v2): New function.
4871         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
4872         parameter.
4873         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
4874         (onload): Add LDPT_GET_SYMBOLS_V2.
4875         (all_symbols_read_hook): Use get_symbols_v2; check for
4876         LDPR_PREVAILING_DEF_IRONLY_EXP.
4877         * testsuite/plugin_test_3.sh: Update expected results.
4878
4879 2011-09-23  Simon Baldwin  <simonb@google.com>
4880
4881         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
4882         configuration options.
4883         * configure: Regenerate.
4884         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
4885         * Makefile.in: Regenerate.
4886         * testsuite/Makefile.in: Regenerate.
4887
4888 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
4889
4890         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
4891
4892 2011-09-19  Cary Coutant  <ccoutant@google.com>
4893
4894         * incremental.cc (can_incremental_update): Fix typo in comment.
4895         * incremental.h (can_incremental_update): Likewise.
4896
4897 2011-09-18  Cary Coutant  <ccoutant@google.com>
4898
4899         * incremental.cc (can_incremental_update): New function.
4900         * incremental.h (can_incremental_update): New function.
4901         * layout.cc (Layout::init_fixed_output_section): Call it.
4902         (Layout::make_output_section): Don't allow patch space in .eh_frame.
4903         * object.cc (Sized_relobj_file::do_layout): Call
4904         can_incremental_update.
4905
4906 2011-09-13  Cary Coutant  <ccoutant@google.com>
4907
4908         * configure.ac: Check for glibc support for gnu_indirect_function
4909         support with static linking, setting automake conditional
4910         IFUNC_STATIC.
4911         * Makefile.in: Regenerate.
4912         * configure: Regenerate.
4913
4914         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
4915         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
4916         for IFUNC_STATIC.
4917         * testsuite/Makefile.in: Regenerate.
4918
4919 2011-09-13  Cary Coutant  <ccoutant@google.com>
4920
4921         * incremental.cc (Sized_relobj_incr::do_layout): Call
4922         report_comdat_group for kept comdat sections.
4923         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4924         * testsuite/Makefile.in: Regenerate.
4925         * testsuite/incr_comdat_test_1.cc: New source file.
4926         * testsuite/incr_comdat_test_2_v1.cc: New source file.
4927         * testsuite/incr_comdat_test_2_v2.cc: New source file.
4928         * testsuite/incr_comdat_test_2_v3.cc: New source file.
4929
4930 2011-09-13  Ian Lance Taylor  <iant@google.com>
4931
4932         * object.cc (Sized_relobj_file::do_layout): Remove unused local
4933         variable external_symbols_offset.
4934
4935 2011-09-12  Ian Lance Taylor  <iant@google.com>
4936
4937         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4938         triggered if object has no symbols.
4939
4940 2011-09-09  David S. Miller  <davem@davemloft.net>
4941
4942         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4943         (Output_fill_debug_line::do_write): Likewise.
4944
4945 2011-08-29  Cary Coutant  <ccoutant@google.com>
4946
4947         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4948         casts to match formatting specs.
4949         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
4950
4951 2011-08-26  Cary Coutant  <ccoutant@google.com>
4952
4953         * layout.cc (Free_list::allocate): Provide guarantee of minimum
4954         remaining hole size when allocating.
4955         (Layout::make_output_section): Set fill methods for debug sections.
4956         * layout.h (Free_list::Free_list_node): Move from private to
4957         public.
4958         (Free_list::set_min_hole_size): New function.
4959         (Free_list::begin, Free_list::end): New functions.
4960         (Free_list::min_hole_): New data member.
4961         * output.cc: Include dwarf.h.
4962         (Output_fill_debug_info::do_minimum_hole_size): New function.
4963         (Output_fill_debug_info::do_write): New function.
4964         (Output_fill_debug_line::do_minimum_hole_size): New function.
4965         (Output_fill_debug_line::do_write): New function.
4966         (Output_section::Output_section): Initialize new data member.
4967         (Output_section::set_final_data_size): Ensure patch space is larger
4968         than minimum hole size.
4969         (Output_section::do_write): Fill holes in debug sections.
4970         * output.h (Output_fill): New class.
4971         (Output_fill_debug_info): New class.
4972         (Output_fill_debug_line): New class.
4973         (Output_section::set_free_space_fill): New function.
4974         (Output_section::free_space_fill_): New data member.
4975         * testsuite/Makefile.am (incremental_test_3): Add
4976         --incremental-patch option.
4977         (incremental_test_4): Likewise.
4978         (incremental_test_5): Likewise.
4979         (incremental_test_6): Likewise.
4980         (incremental_copy_test): Likewise.
4981         (incremental_common_test_1): Likewise.
4982         * testsuite/Makefile.in: Regenerate.
4983
4984 2011-08-26  Nick Clifton  <nickc@redhat.com>
4985
4986         * po/es.po: Updated Spanish translation.
4987
4988 2011-08-01  Cary Coutant  <ccoutant@google.com>
4989
4990         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4991         * gold/testsuite/Makefile.in: Regenerate.
4992         * gold/testsuite/justsyms_exec.c: New source file.
4993         * gold/testsuite/justsyms_lib.c: New source file.
4994
4995 2011-08-01  Cary Coutant  <ccoutant@google.com>
4996
4997         * layout.cc (Layout::set_segment_offsets): Don't realign text
4998         segment if -Ttext was specified.
4999         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
5000         file type.
5001         * object.h (Sized_relobj_file::e_type): New function.
5002         (Sized_relobj_file::e_type_): New data member.
5003         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
5004         base address for ET_EXEC files.
5005         * target.cc (Target::do_make_elf_object_implementation): Allow
5006         ET_EXEC files with --just-symbols option.
5007
5008 2011-07-28  Cary Coutant  <ccoutant@google.com>
5009
5010         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
5011         Add thread_number parameter.
5012         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
5013         * workqueue-threads.cc
5014         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
5015         current thread if its thread number is greater than desired thread
5016         count.
5017         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
5018         Add thread_number parameter.
5019         (Workqueue::should_cancel_thread): Likewise.
5020         (Workqueue::find_runnable_or_wait): Pass thread_number to
5021         should_cancel_thread.
5022         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
5023         parameter.
5024
5025 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
5026
5027         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
5028         only after checking if it cannot be forced local.
5029         * symtab.h (is_externally_visible): Check if the symbol is not forced
5030         local.
5031
5032 2011-07-15  Ian Lance Taylor  <iant@google.com>
5033
5034         * options.h (class General_options): Add --print-output-format.
5035         Move -EL next to -EB, for  better --help output.
5036         * target-select.cc: Include <cstdio>, "options.h", and
5037         "parameters.h".
5038         (Target_selector::do_target_bfd_name): New function.
5039         (print_output_format): New function.
5040         * target-select.h (class Target_selector): Update declarations.
5041         (Target_selector::target_bfd_name): New function.
5042         (print_output_format): Declare.
5043         * main.cc: Include "target-select.h".
5044         (main): Handle --print-output-format.
5045         * gold.cc: Include "target-select.h".
5046         (queue_initial_tasks): Handle --print-output-format when there are
5047         no input files.
5048         * parameters.cc (parameters_force_valid_target): Give a better
5049         error message if -EB/-EL does not match target.
5050         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
5051         function.
5052
5053 2011-07-15  Ian Lance Taylor  <iant@google.com>
5054
5055         * i386.cc (class Output_data_plt_i386): Add layout_ field.
5056         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
5057         (Output_data_plt_i386::do_write): Write address of .dynamic
5058         section to first entry in .got.plt section.
5059         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
5060         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5061         Initialize layout_.
5062         (Output_data_plt_x86_64::do_write): Write address of .dynamic
5063         section to first entry in .got.plt section.
5064         * layout.h (Layout::dynamic_section): New function.
5065
5066 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
5067
5068         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
5069         to claim_file call.
5070         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
5071         input_section_position_, and input_section_glob_.
5072         (read_layout_from_file): Call function section_ordering_specified.
5073         * layout.h (is_section_ordering_specified): New function.
5074         (section_ordering_specified): New function.
5075         (section_ordering_specified_): New boolean member.
5076         * main.cc(main): Call load_plugins after layout object is defined.
5077         * output.cc (Output_section::add_input_section): Use
5078         function section_ordering_specified to check if section ordering is
5079         needed.
5080         * output.cc (Output_section::add_relaxed_input_section): Use
5081         function section_ordering_specified to check if section ordering is
5082         needed.
5083         (Output_section::update_section_layout): New function.
5084         (Output_section::sort_attached_input_sections): Check if input section
5085         must be reordered.
5086         * output.h (Output_section::update_section_layout): New function.
5087         * plugin.cc (get_section_count): New function.
5088         (get_section_type): New function.
5089         (get_section_name): New function.
5090         (get_section_contents): New function.
5091         (update_section_order): New function.
5092         (allow_section_ordering): New function.
5093         (Plugin::load): Add the new interfaces to the transfer vector.
5094         (Plugin_manager::load_plugins): New parameter.
5095         (Plugin_manager::all_symbols_read): New parameter.
5096         (Plugin_manager::claim_file): New parameter. Save the elf object for
5097         unclaimed objects.
5098         (Plugin_manager::get_elf_object): New function.
5099         (Plugin_manager::get_view): Change to directly use the bool to check
5100         if get_view is called from claim_file_hook.
5101         * plugin.h (input_objects): New function
5102         (Plugin__manager::load_plugins): New parameter.
5103         (Plugin_manager::claim_file): New parameter.
5104         (Plugin_manager::get_elf_object): New function.
5105         (Plugin_manager::in_claim_file_handler): New function.
5106         (Plugin_manager::in_claim_file_handler_): New member.
5107         (layout): New function.
5108         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
5109         handler with an extra parameter. Make the elf object before calling
5110         claim_file handler.
5111         * testsuite/plugin_test.c (get_section_count): New function pointer.
5112         (get_section_type): New function pointer.
5113         (get_section_name): New function pointer.
5114         (get_section_contents): New function pointer.
5115         (update_section_order): New function pointer.
5116         (allow_section_ordering): New function pointer.
5117         (onload): Check if the new interfaces exist.
5118
5119 2011-07-13  Ian Lance Taylor  <iant@google.com>
5120
5121         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
5122         relro section.
5123         * x86_64.cc (Target_x86_64::got_section): Likewise.
5124         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
5125         (relro_now_test_SOURCES): New variable.
5126         (relro_now_test_DEPENDENCIES): New variable.
5127         (relro_now_test_LDFLAGS): New variable.
5128         (relro_now_test_LDADD): New variable.
5129         (relro_now_test.so): New target.
5130         * testsuite/Makefile.in: Rebuild.
5131
5132 2011-07-12  Ian Lance Taylor  <iant@google.com>
5133
5134         PR gold/12980
5135         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
5136         GLOB_DAT relocation rather than a RELATIVE relocation for a
5137         protected symbol when creating a shared library.
5138         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5139         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
5140         * testsuite/protected_main_1.cc (main): Test that protected
5141         function has same address.
5142
5143 2011-07-11  Ian Lance Taylor  <iant@google.com>
5144
5145         PR gold/12979
5146         * options.h (class General_options): Add -Bgroup.
5147         * options.cc (General_options::finalize): If -Bgroup is set,
5148         default to --unresolved-symbols=report-all.
5149         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
5150         * target-reloc.h (issue_undefined_symbol_error): Handle
5151         --unresolved-symbols=report-all.
5152
5153 2011-07-08  Ian Lance Taylor  <iant@google.com>
5154
5155         PR gold/11985
5156         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
5157         if linker script discards key sections.
5158         (Layout::create_dynamic_symtab): Likewise.
5159         (Layout::assign_local_dynsym_offsets): Likewise.
5160         (Layout::sized_create_version_sections): Likewise.
5161         (Layout::create_interp): Likewise.
5162         (Layout::finish_dynamic_section): Likewise.
5163         (Layout::set_dynamic_symbol_size): Likewise.
5164
5165 2011-07-08  Ian Lance Taylor  <iant@google.com>
5166
5167         PR gold/12386
5168         * options.h (class General_options): Add --unresolved-symbols.
5169         * target-reloc.h (issue_undefined_symbol_error): Check
5170         --unresolved-symbols.  Add comments.
5171
5172 2011-07-08  Ian Lance Taylor  <iant@google.com>
5173
5174         * testsuite/odr_violation2.cc (Ordering::operator()): Make
5175         expression more complex.
5176
5177 2011-07-08  Ian Lance Taylor  <iant@google.com>
5178
5179         PR gold/11317
5180         * target-reloc.h (issue_undefined_symbol_error): New inline
5181         function, broken out of relocate_section.
5182         (relocate_section): Call issue_undefined_symbol_error.
5183         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5184         there is no TLS segment if we are about to issue an undefined
5185         symbol error.
5186         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5187
5188 2011-07-08  Ian Lance Taylor  <iant@google.com>
5189
5190         PR gold/12279
5191         * resolve.cc (Symbol_table::should_override): Add fromtype
5192         parameter.  Change all callers.  Give error when linking together
5193         TLS and non-TLS symbol.
5194         (Symbol_table::should_override_with_special): Add fromtype
5195         parameter.  Change all callers.
5196         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5197         there is no TLS segment if we have reported some errors.
5198         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5199
5200 2011-07-08  Ian Lance Taylor  <iant@google.com>
5201
5202         PR gold/12372
5203         * target.h (Target::plt_address_for_global): New function.
5204         (Target::plt_address_for_local): New function.
5205         (Target::plt_section_for_global): Remove.
5206         (Target::plt_section_for_local): Remove.
5207         (Target::do_plt_address_for_global): New virtual function.
5208         (Target::do_plt_address_for_local): New virtual function.
5209         (Target::do_plt_section_for_global): Remove.
5210         (Target::do_plt_section_for_local): Remove.
5211         (Target::register_global_plt_entry): Add Symbol_table and Layout
5212         parameters.
5213         * output.cc (Output_data_got::Got_entry::write): Use
5214         plt_address_for_global and plt_address_for_local.
5215         * layout.cc (Layout::add_target_dynamic_tags): Use size and
5216         address of output section.
5217         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
5218         got_irelative_, and irelative_count_ fields.  Update
5219         declarations.
5220         (Output_data_plt_i386::has_irelative_section): New function.
5221         (Output_data_plt_i386::entry_count): Add irelative_count_.
5222         (Output_data_plt_i386::set_final_data_size): Likewise.
5223         (class Target_i386): Add got_irelative_ and rel_irelative_
5224         fields.  Update declarations.
5225         (Target_i386::Target_i386): Initialize new fields.
5226         (Target_i386::do_plt_address_for_global): New function replacing
5227         do_plt_section_for_global.
5228         (Target_i386::do_plt_address_for_local): New function replacing
5229         do_plt_section_for_local.
5230         (Target_i386::got_section): Create got_irelative_.
5231         (Target_i386::rel_irelative_section): New function.
5232         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
5233         fields.  Don't define __rel_iplt_{start,end}.
5234         (Output_data_plt_i386::add_entry): Add symtab and layout
5235         parameters.  Change all callers.  Use different PLT and GOT for
5236         IFUNC symbols.
5237         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
5238         layout parameters.  Change all callers.  Use different PLT and
5239         GOT.
5240         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
5241         (Output_data_plt_i386::rel_irelative): New function.
5242         (Output_data_plt_i386::address_for_global): New function.
5243         (Output_data_plt_i386::address_for_local): New function.
5244         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
5245         IRELATIVE GOT when changing IFUNC GOT entries.
5246         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
5247         reloc.
5248         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
5249         if we didn't create an IRELATIVE GOT.
5250         (Target_i386::Relocate::relocate): Use plt_address_for_global and
5251         plt_address_for_local.
5252         (Target_i386::do_dynsym_value): Use plt_address_for_global.
5253         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
5254         got_irelative_, and irelative_count_ fields.  Update
5255         declarations.
5256         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5257         Initialize new fields.  Remove symtab parameter.  Change all
5258         callers.
5259         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
5260         irelative_count_.
5261         (Output_data_plt_x86_64::has_irelative_section): New function.
5262         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
5263         (class Target_x86_64): Add got_irelative_ and rel_irelative_
5264         fields.  Update declarations.
5265         (Target_x86_64::Target_x86_64): Initialize new fields.
5266         (Target_x86_64::do_plt_address_for_global): New function replacing
5267         do_plt_section_for_global.
5268         (Target_x86_64::do_plt_address_for_local): New function replacing
5269         do_plt_section_for_local.
5270         (Target_x86_64::got_section): Create got_irelative_.
5271         (Target_x86_64::rela_irelative_section): New function.
5272         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
5273         all callers.  Don't create __rel_iplt_{start,end}.
5274         (Output_data_plt_x86_64::add_entry): Add symtab and layout
5275         parameters.  Change all callers.  Use different PLT and GOT for
5276         IFUNC symbols.
5277         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
5278         layout parameters.  Change all callers.  Use different PLT and
5279         GOT.
5280         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
5281         parameters.  Change all callers.  Use different PLT and GOT for
5282         IFUNC symbols.
5283         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
5284         (Output_data_plt_x86_64::rela_irelative): New function.
5285         (Output_data_plt_x86_64::address_for_global): New function.
5286         (Output_data_plt_x86_64::address_for_local): New function.
5287         (Output_data_plt_x86_64::set_final_data_size): Likewise.
5288         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
5289         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
5290         (Target_x86_64::register_global_plt_entry): Add symtab and layout
5291         parameters.
5292         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
5293         reloc.
5294         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
5295         symbols if we didn't create an IRELATIVE GOT.
5296         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
5297         plt_address_for_local.
5298         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
5299         * testsuite/ifuncvar1.c: New test file.
5300         * testsuite/ifuncvar2.c: New test file.
5301         * testsuite/ifuncvar3.c: New test file.
5302         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
5303         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
5304         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
5305         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
5306         * testsuite/Makefile.in: Rebuild.
5307
5308 2011-07-07  Cary Coutant  <ccoutant@google.com>
5309
5310         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
5311         (two_file_test_1_ndebug.o): Likewise.
5312         (two_file_test_1b_ndebug.o): Likewise.
5313         (two_file_test_2_ndebug.o): Likewise.
5314         (two_file_test_main_ndebug.o): Likewise.
5315         (incremental_test_2): Link with no-debug versions.
5316
5317 2011-07-06  Cary Coutant  <ccoutant@google.com>
5318
5319         * gold/incremental.cc
5320         (Output_section_incremental_inputs::write_info_blocks): Check for
5321         hidden and internal symbols.
5322
5323 2011-07-06  Cary Coutant  <ccoutant@google.com>
5324
5325         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
5326         Check disposition for startup file.
5327         (Incremental_inputs::report_command_line): Ignore
5328         --incremental-startup-unchanged option.
5329         * options.cc (General_options::parse_incremental_startup_unchanged):
5330         New function.
5331         (General_options::General_options): Initialize new data member.
5332         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
5333         (General_options): Add --incremental-startup-unchanged option.
5334         (General_options::incremental_startup_disposition): New function.
5335         (General_options::incremental_startup_disposition_): New data member.
5336
5337 2011-07-06  Cary Coutant  <ccoutant@google.com>
5338
5339         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
5340         input file index to Script_info ctor.
5341         (Sized_incremental_binary::do_file_has_changed): Find the
5342         command-line argument for files named in scripts.
5343         * incremental.h (Script_info::Script_info): New ctor
5344         with input file index.
5345         (Script_info::input_file_index): New function.
5346         (Script_info::input_file_index_): New data member.
5347         (Incremental_binary::get_library): Add const.
5348         (Incremental_binary::get_script_info): Add const.
5349         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
5350         * testsuite/Makefile.am (incremental_test_5): New test case.
5351         (incremental_test_6): New test case.
5352         * testsuite/Makefile.in: Regenerate.
5353
5354 2011-07-06  Cary Coutant  <ccoutant@google.com>
5355
5356         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
5357         debug output when command lines differ.
5358
5359 2011-07-06  Cary Coutant  <ccoutant@google.com>
5360
5361         * incremental.cc (Incremental_inputs::report_command_line): Ignore
5362         --incremental-patch option.
5363         * layout.cc (Free_list::allocate): Extend allocation beyond original
5364         end if enabled.
5365         (Layout::make_output_section): Mark sections that should get
5366         patch space.
5367         * options.cc (parse_percent): New function.
5368         * options.h (parse_percent): New function.
5369         (DEFINE_percent): New macro.
5370         (General_options): Add --incremental-patch option.
5371         * output.cc (Output_section::Output_section): Initialize new data
5372         members.
5373         (Output_section::add_input_section): Print section name when out
5374         of patch space.
5375         (Output_section::add_output_section_data): Likewise.
5376         (Output_section::set_final_data_size): Add patch space when
5377         doing --incremental-full.
5378         (Output_section::do_reset_address_and_file_offset): Remove patch
5379         space.
5380         (Output_segment::set_section_list_addresses): Print debug output
5381         only if --incremental-update.
5382         * output.h (Output_section::set_is_patch_space_allowed): New function.
5383         (Output_section::is_patch_space_allowed_): New data member.
5384         (Output_section::patch_space_): New data member.
5385         * parameters.cc (Parameters::incremental_full): New function.
5386         * parameters.h (Parameters::incremental_full): New function
5387         * testsuite/Makefile.am (incremental_test_2): Add test for
5388         --incremental-patch option.
5389         * testsuite/Makefile.in: Regenerate.
5390         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
5391         (t18): Remove function body.
5392
5393 2011-07-05  Doug Kwan  <dougkwan@google.com>
5394
5395         PR gold/12771
5396         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
5397         Arm_Address type for relocation result.
5398         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
5399         overflow check.
5400         (Arm_relocate_functions::abs32): Use unaligned access.
5401         (Arm_relocate_functions::rel32): Ditto.
5402         (Arm_relocate_functions::prel31): Ditto.
5403         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
5404         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
5405         static data relocations.
5406         * testsuite/Makefile.in: Regnerate.
5407         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
5408
5409 2011-07-05  Ian Lance Taylor  <iant@google.com>
5410
5411         PR gold/12392
5412         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
5413         symbols if necessary.
5414         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5415
5416 2011-07-05  Ian Lance Taylor  <iant@google.com>
5417
5418         PR gold/12952
5419         * resolve.cc (Symbol::override_base_with_special): Simply override
5420         version with special symbol version, ignoring previous version.
5421
5422 2011-07-05  Ian Lance Taylor  <iant@google.com>
5423
5424         * object.cc (Sized_relobj_file::include_section_group): Add
5425         information to comment about signature location.
5426
5427 2011-07-02  Ian Lance Taylor  <iant@google.com>
5428
5429         PR gold/12957
5430         * options.h (class General_options): Add -f and -F.
5431         * options.cc (General_options::finalize): Fatal error if -f/-F
5432         are used without -shared.
5433         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
5434
5435 2011-07-02  Ian Lance Taylor  <iant@google.com>
5436
5437         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
5438
5439 2011-07-01  Ian Lance Taylor  <iant@google.com>
5440
5441         PR gold/12525
5442         PR gold/12952
5443         * resolve.cc (Symbol::override_base_with_special): Don't override
5444         the version if the overriding symbol has a different name.
5445         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
5446         all callers.  If we give an error about an undefined version,
5447         define the base version if necessary.
5448         * dynobj.h (class Versions): Update declaration.
5449         * testsuite/weak_alias_test_5.cc: New file.
5450         * testsuite/weak_alias_test.script: New file.
5451         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
5452         and versioned_alias have the right value, and call t2.
5453         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
5454         weak_alias_test_5.so.
5455         (weak_alias_test_LDADD): Likewise.
5456         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
5457         * testsuite/Makefile.in: Rebuild.
5458
5459 2011-07-01  Ian Lance Taylor  <iant@google.com>
5460
5461         PR gold/12525
5462         * options.h (class General_options): Support -z notext.
5463         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
5464         -Wl,-z,notext.
5465         (two_file_shared_nonpic.so): Likewise.
5466         (two_file_shared_mixed.so): Likewise.
5467         (two_file_shared_mixed_1.so): Likewise.
5468         (weak_undef_lib_nonpic.so): Likewise.
5469         (alt/weak_undef_lib_nonpic.so): Likewise.
5470         (tls_test_shared_nonpic.so): Likewise.
5471         * testsuite/Makefile.in: Rebuild.
5472
5473 2011-07-01  Ian Lance Taylor  <iant@google.com>
5474
5475         PR gold/12525
5476         * configure.ac: Test whether static linking works, setting
5477         the automake conditional HAVE_STATIC.
5478         * testsuite/Makefile.am: Disable tests using -static if
5479         HAVE_STATIC is not true.
5480         * configure, testsuite/Makefile.in: Rebuild.
5481
5482 2011-07-01  Ian Lance Taylor  <iant@google.com>
5483
5484         PR gold/12525
5485         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
5486         Assert if we see DW_EH_PE_indirect.
5487         * target.h (Target::ehframe_datarel_base): New function.
5488         (Target::do_ehframe_datarel_base): New target function.
5489         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
5490         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
5491         function.
5492
5493 2011-07-01  Ian Lance Taylor  <iant@google.com>
5494
5495         PR gold/12571
5496         * options.h (class General_options): Add
5497         --ld-generated-unwind-info.
5498         * ehframe.cc (Fde::write): Add address parameter.  Change all
5499         callers.  If associated with PLT, fill in address and size.
5500         (Cie::set_output_offset): Only add merge mapping if there is an
5501         object.
5502         (Cie::write): Add address parameter.  Change all callers.
5503         (Eh_frame::add_ehframe_for_plt): New function.
5504         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
5505         input_offset_ fields into union u_, with new plt field.
5506         (Fde::Fde): Adjust for new union field.
5507         (Fde::Fde) [Output_data version]: New constructor.
5508         (Fde::add_mapping): Only add merge mapping if there is an object.
5509         (class Cie): Update declarations.
5510         (class Eh_frame): Declare add_ehframe_for_plt.
5511         * layout.cc (Layout::layout_eh_frame): Break out code into
5512         make_eh_frame_section, and call it.
5513         (Layout::make_eh_frame_section): New function.
5514         (Layout::add_eh_frame_for_plt): New function.
5515         * layout.h (class Layout): Update declarations.
5516         * merge.cc (Merge_map::add_mapping): Add assertion.
5517         * i386.cc: Include "dwarf.h".
5518         (class Output_data_plt_i386): Make first_plt_entry,
5519         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
5520         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5521         and plt_eh_frame_fde.
5522         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
5523         boundary.  Call add_eh_frame_for_plt if appropriate.
5524         * x86_64.cc: Include "dwarf.h".
5525         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
5526         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
5527         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5528         and plt_eh_frame_fde.
5529         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
5530         appropriate.
5531
5532 2011-06-29  Ian Lance Taylor  <iant@google.com>
5533
5534         PR gold/12629
5535         * object.cc (Sized_relobj_file::layout_section): Change shdr
5536         parameter to be const.
5537         (Sized_relobj_file::layout_eh_frame_section): New function, broken
5538         out of do_layout.
5539         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
5540         appropriate.  Call layout_eh_frame_section.
5541         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
5542         sections.
5543         * object.h (class Sized_relobj_file): Update declarations.
5544
5545 2011-06-29  Ian Lance Taylor  <iant@google.com>
5546
5547         PR gold/12652
5548         * script.cc (Token::integer_value): Accept trailing M/m/K/k
5549         modifier.
5550         (Lex::gather_token): Accept trailing M/m/K/k for integers.
5551
5552 2011-06-29  Ian Lance Taylor  <iant@google.com>
5553
5554         PR gold/12675
5555         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
5556         SHT_X86_64_UNWIND.
5557         * layout.cc (Layout::layout_eh_frame): Likewise.
5558
5559 2011-06-29  Ian Lance Taylor  <iant@google.com>
5560
5561         PR gold/12695
5562         * layout.cc (Layout::symtab_section_shndx): New function.
5563         * layout.h (class Layout): Declare symtab_section_shndx.
5564         * output.cc (Output_section::write_header): Call it.
5565
5566 2011-06-29  Ian Lance Taylor  <iant@google.com>
5567
5568         PR gold/12818
5569         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
5570         symbols which are not used in a relocation.
5571
5572 2011-06-28  Ian Lance Taylor  <iant@google.com>
5573
5574         PR gold/12898
5575         * layout.cc (Layout::segment_precedes): Don't crash if a linker
5576         script create indistinguishable segments.
5577         (Layout::set_segment_offsets): Use stable_sort when sorting
5578         segments.  Pass this to Compare_segments constructor.
5579         * layout.h (class Layout): Make segment_precedes non-static.
5580         (class Compare_segments): Change from struct to class.  Add
5581         layout_ field.  Add constructor.
5582         * script-sections.cc
5583         (Script_sections::attach_sections_using_phdrs_clause): Rename
5584         local orphan to is_orphan.  Don't report failure to put empty
5585         section in segment.  On attachment failure, report name of
5586         section, and attach to first PT_LOAD segment.
5587
5588 2011-06-28  Ian Lance Taylor  <iant@google.com>
5589
5590         PR gold/12934
5591         * target-select.cc (Target_selector::Target_selector): Add
5592         emulation parameter.  Change all callers.
5593         (select_target_by_bfd_name): Rename from select_target_by_name.
5594         Change all callers.
5595         (select_target_by_emulation): New function.
5596         (supported_emulation_names): New function.
5597         * target-select.h (class Target_selector): Add emulation_ field.
5598         Update declarations.
5599         (Target_selector::recognize_by_bfd_name): Rename from
5600         recognize_by_name.  Change all callers.
5601         (Target_selector::supported_bfd_names): Rename from
5602         supported_names.  Change all callers.
5603         (Target_selector::recognize_by_emulation): New function.
5604         (Target_selector::supported_emulations): New function.
5605         (Target_selector::emulation): New function.
5606         (Target_selector::do_recognize_by_bfd_name): Rename from
5607         do_recognize_by_name.  Change all callers.
5608         (Target_selector::do_supported_bfd_names): Rename from
5609         do_supported_names.  Change all callers.
5610         (Target_selector::do_recognize_by_emulation): New function.
5611         (Target_selector::do_supported_emulations): New function.
5612         (select_target_by_bfd_name): Change name in declaration.
5613         (select_target_by_emulation): Declare.
5614         (supported_emulation_names): Declare.
5615         * parameters.cc (parameters_force_valid_target): Try to find
5616         target based on emulation from -m option.
5617         * options.h (class General_options): Change doc string for -m.
5618         * options.cc (help): Print emulations.
5619         (General_options::parse_V): Likewise.
5620         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
5621         Add emulation parameter.  Change all callers.
5622
5623 2011-06-28  Ian Lance Taylor  <iant@google.com>
5624
5625         * target.h (class Target): Add osabi_ field.
5626         (Target::osabi): New function.
5627         (Target::set_osabi): New function.
5628         (Target::Target): Initialize osabi_.
5629         (Target::do_adjust_elf_header): Make pure virtual.
5630         (Sized_target::do_adjust_elf_header): Declare.
5631         * target.cc (Sized_target::do_adjust_elf_header): New function.
5632         (class Sized_target): Instantiate all versions.
5633         * freebsd.h (class Target_freebsd): Remove.
5634         (Target_selector_freebsd::do_recognize): Call set_osabi on
5635         Target.
5636         (Target_selector_freebsd::do_recognize_by_name): Likewise.
5637         (Target_selector_freebsd::set_osabi): Remove.
5638         * i386.cc (class Target_i386): Inherit from Sized_target rather
5639         than Target_freebsd.
5640         * x86_64.cc (class Target_x86_64): Likewise.
5641
5642 2011-06-28  Ian Lance Taylor  <iant@google.com>
5643
5644         * target.h (Target::can_check_for_function_pointers): Rewrite.
5645         Make non-virtual.
5646         (Target::can_icf_inline_merge_sections): Likewise.
5647         (Target::section_may_have_icf_unsafe_poineters): Likewise.
5648         (Target::Target_info): Add can_icf_inline_merge_sections field.
5649         (Target::do_can_check_for_function_pointers): New virtual
5650         function.
5651         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
5652         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
5653         from can_check_for_function_pointers, move in file.
5654         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
5655         section_may_have_icf_unsafe_poineters, move in file.
5656         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
5657         * i386.cc (Target_i386::do_can_check_for_function_pointers):
5658         Rename from can_check_for_function_pointers, move in file.
5659         (Target_i386::can_icf_inline_merge_sections): Remove.
5660         (Target_i386::i386_info): Initialize
5661         can_icf_inline_merge_sections.
5662         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
5663         Initialize can_icf_inline_merge_sections.
5664         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
5665         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
5666         Rename from can_check_for_function_pointers, move in file.
5667         (Target_x86_64::can_icf_inline_merge_sections): Remove.
5668         (Target_x86_64::x86_64_info): Initialize
5669         can_icf_inline_merge_sections.
5670         * testsuite/testfile.cc (Target_test::test_target_info):
5671         Likewise.
5672         * icf.cc (get_section_contents): Correct formatting.
5673
5674 2011-06-27  Ian Lance Taylor  <iant@google.com>
5675
5676         * symtab.cc (Symbol::versioned_name): New function.
5677         (Symbol_table::add_to_final_symtab): Use versioned_name when
5678         appropriate.
5679         (Symbol_table::sized_write_symbol): Likewise.
5680         * symtab.h (class Symbol): Declare versioned_name.
5681         * stringpool.h (class Stringpool_template): Add variant of add
5682         which takes a std::basic_string.
5683         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
5684         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
5685         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
5686         (ver_test_12.o): New target.
5687         * testsuite/Makefile.in: Rebuild.
5688
5689 2011-06-27  Doug Kwan  <dougkwan@google.com>
5690
5691         * arm.cc (Arm_relocate_functions::thm_jump8,
5692         Arm_relocate_functions::thm_jump11): Use a wider signed
5693         type to compute offset.
5694         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
5695         arm_thm_jump8.
5696         * testsuite/Makefile.in: Regenerate.
5697         * testsuite/arm_branch_in_range.sh: Check test results of
5698         arm_thm_jump11 and arm_thm_jump8.
5699         * testsuite/arm_thm_jump11.s: New test source file.
5700         * testsuite/arm_thm_jump11.t: New linker script.
5701         * testsuite/arm_thm_jump8.s: New test source file.
5702         * testsuite/arm_thm_jump8.t: New linker script.
5703
5704 2011-06-24  Ian Lance Taylor  <iant@google.com>
5705
5706         * layout.cc: Include "object.h".
5707         (ctors_sections_in_init_array): New static variable.
5708         (Layout::is_ctors_in_init_array): New function.
5709         (Layout::layout): Add entry to ctors_sections_in_init_array if
5710         appropriate.
5711         * layout.h (class Layout): Declare is_ctors_in_init_array.
5712         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
5713         is_ctors_reverse_view is set.
5714         (Sized_relobj_file::write_sections): Add layout parameter.  Change
5715         all callers.  Set is_ctors_reverse_view field of View_size.
5716         (Sized_relobj_file::reverse_words): New function.
5717         * object.h (Sized_relobj_file::View_size): Add
5718         is_ctors_reverse_view field.
5719         (class Sized_relobj_file): Update declarations.
5720         * testsuite/initpri3.c: New test.
5721         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
5722         initpri3b.
5723         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
5724         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
5725         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
5726         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
5727         * testsuite/Makefile.in: Rebuild.
5728
5729 2011-06-24  Cary Coutant  <ccoutant@google.com>
5730
5731         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
5732         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
5733         (debug_msg_cdebug.err): New targets.
5734         * testsuite/Makefile.in: Regenerate.
5735         * testsuite/debug_msg.sh: Check output of link with compressed debug.
5736         Fix checks for link with shared library.
5737
5738 2011-06-24  Doug Kwan  <dougkwan@google.com>
5739
5740         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
5741         skip empty text sections.
5742         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
5743
5744 2011-06-22  Ian Lance Taylor  <iant@google.com>
5745
5746         PR gold/12910
5747         * options.h (class General_options): Add --ctors-in-init-array.
5748         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
5749         friends as SHT_PROGBITS for merging sections.
5750         (Layout::layout): Remove special handling of .init_array and
5751         friends.  Don't sort if doing relocatable link.  Sort for .ctors
5752         and .dtors if ctors_in_init_array.
5753         (Layout::make_output_section): Force correct section types for
5754         .init_array and friends.  Don't sort if doing relocatable link,
5755         Don't sort .ctors and .dtors if ctors_in_init_array.
5756         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
5757         (Layout::output_section_name): Add relobj parameter.  Change all
5758         callers.  Handle .ctors. and .dtors. in code rather than table.
5759         Handle .ctors and .dtors if ctors_in_init_array.
5760         (Layout::match_file_name): New function, moved from output.cc.
5761         * layout.h (class Layout): Update declarations.
5762         * output.cc: Include "layout.h".
5763         (Input_section_sort_entry::get_priority): New function.
5764         (Input_section_sort_entry::match_file_name): Just call
5765         Layout::match_file_name.
5766         (Output_section::Input_section_sort_init_fini_compare::operator()):
5767         Handle .ctors and .dtors.  Sort by explicit priority rather than
5768         by name.
5769         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
5770         * testsuite/initpri2.c: New test.
5771         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5772         (check_PROGRAMS): Add initpri2.
5773         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5774         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5775         * configure, testsuite/Makefile.in: Rebuild.
5776
5777 2011-06-19  Ian Lance Taylor  <iant@google.com>
5778
5779         PR gold/12880
5780         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5781         .interp section to a PT_INTERP segment even if we have seen a
5782         --dynamic-linker option.  Don't do it if we have seen a PHDRS
5783         clause in a linker script.
5784         (Layout::finalize): Don't create a .interp section if we've
5785         already create a PT_INTERP segment.
5786         (Layout::create_interp): Always call choose_output_section (revert
5787         patch of 2011-06-17).  Don't create PT_INTERP segment.
5788         * script-sections.cc
5789         (Script_sections::create_note_and_tls_segments): Add a .interp
5790         section to a PT_INTERP segment even if we have seen a
5791         --dynamic-linker option.
5792
5793 2011-06-18  Ian Lance Taylor  <iant@google.com>
5794
5795         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5796         merely because a non-PT_LOAD segment has a dynamic reloc.
5797
5798 2011-06-18  Ian Lance Taylor  <iant@google.com>
5799
5800         * layout.cc (Layout::finish_dynamic_section): Don't create
5801         DT_FLAGS entry if not needed.
5802
5803 2011-06-18  Ian Lance Taylor  <iant@google.com>
5804
5805         PR gold/12745
5806         * layout.cc (Layout::layout_eh_frame): Correct handling of
5807         writable .eh_frame section.
5808
5809 2011-06-17  Ian Lance Taylor  <iant@google.com>
5810
5811         PR gold/12893
5812         * resolve.cc (Symbol_table::resolve): Don't give an error if a
5813         symbol is redefined with the exact same object and value.
5814
5815 2011-06-17  Ian Lance Taylor  <iant@google.com>
5816
5817         PR gold/12880
5818         * layout.h (class Layout): Add interp_segment_ field.
5819         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5820         (Layout::attach_allocated_section_to_segment): If making shared
5821         library, put .interp section in PT_INTERP segment.
5822         (Layout::finalize): Also call create_interp if -dynamic-linker
5823         option was used.
5824         (Layout::create_interp): Assert that there is no PT_INTERP
5825         segment.  If not using a SECTIONS clause, use make_output_section.
5826         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5827         * script-sections.cc
5828         (Script_sections::create_note_and_tls_segments): If making shared
5829         library, put .interp section in PT_INTERP segment.
5830
5831 2011-06-17  Ian Lance Taylor  <iant@google.com>
5832
5833         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5834         when making a shared library.
5835
5836 2011-06-17  Ian Lance Taylor  <iant@google.com>
5837
5838         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
5839         parameter.  Change all callers.  Don't issue warning about PC32
5840         against locally defined symbol.
5841
5842 2011-06-16  Ian Lance Taylor  <iant@google.com>
5843
5844         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
5845         occurs in same object.
5846
5847 2011-06-14  Alan Modra  <amodra@gmail.com>
5848
5849         * po/POTFILES.in: Regenerate.
5850
5851 2011-06-09  Ian Lance Taylor  <iant@google.com>
5852
5853         * script-sections.cc
5854         (Orphan_output_section::set_section_addresses): For a relocatable
5855         link set address to 0.
5856
5857 2011-06-09  Cary Coutant  <ccoutant@google.com>
5858
5859         PR gold/12804
5860         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
5861         used with --compress-debug-sections.
5862         * gold/object.cc (Sized_relobj_file::do_layout): Report
5863         uncompressed size of compressed input sections.
5864
5865 2011-06-08  Cary Coutant  <ccoutant@google.com>
5866
5867         PR gold/12804
5868         * testsuite/two_file_test_2_v1.cc: Change initialization of
5869         v2 to keep it in .data.
5870
5871 2011-06-07  Cary Coutant  <ccoutant@google.com>
5872
5873         * common.cc (Symbol_table::do_allocate_commons_list): Call
5874         gold_fallback.
5875         * errors.cc (Errors::fatal): Adjust call to gold_exit.
5876         (Errors::fallback): New function.
5877         (gold_fallback): New function.
5878         * errors.h (Errors::fallback): New function.
5879         * gold.cc (gold_exit): Change status parameter to enum; adjust
5880         all callers.
5881         (queue_initial_tasks): Call gold_fallback.
5882         * gold.h: Include cstdlib.
5883         (Exit_status): New enum type.
5884         (gold_exit): Change status parameter to enum.
5885         (gold_fallback): New function.
5886         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
5887         (Layout::create_symtab_sections): Likewise.
5888         (Layout::create_shdrs): Likewise.
5889         * main.cc (main): Adjust call to gold_exit.
5890         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
5891         (Output_data_got::add_got_entry_pair): Likewise.
5892         (Output_section::add_input_section): Likewise.
5893         (Output_section::add_output_section_data): Likewise.
5894         (Output_segment::set_section_list_addresses): Likewise.
5895         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
5896
5897 2011-06-07  Cary Coutant  <ccoutant@google.com>
5898
5899         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
5900         for incremental links.
5901         * output.cc (Output_segment::set_section_list_addresses): Remove
5902         FIXME and test for TLS or BSS.
5903
5904 2011-06-07  Cary Coutant  <ccoutant@google.com>
5905
5906         * testsuite/Makefile.am: Add incremental_copy_test,
5907         incremental_common_test_1.
5908         * testsuite/Makefile.in: Regenerate.
5909         * testsuite/common_test_1_v1.c: New source file.
5910         * testsuite/common_test_1_v2.c: New source file.
5911         * testsuite/copy_test_v1.cc: New source file.
5912
5913 2011-06-07  Cary Coutant  <ccoutant@google.com>
5914
5915         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
5916         update, allocate common from bss section's free list.
5917         * incremental-dump.cc (dump_incremental_inputs): Print flag for
5918         linker-defined symbols.
5919         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5920         Skip GOT and PLT entries that are no longer referenced.
5921         (Output_section_incremental_inputs::write_info_blocks): Mark
5922         linker-defined symbols.
5923         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5924         * output.cc (Output_section::allocate): New function.
5925         * output.h (Output_section::allocate): New function.
5926         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5927         linker-defined symbols.
5928         (Symbol::override_base_with_special): Copy is_predefined_ flag.
5929         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5930         (Symbol::init_base_output_data): Likewise.
5931         (Symbol::init_base_output_segment): Likewise.
5932         (Symbol::init_base_constant): Likewise.
5933         (Sized_symbol::init_output_data): Likewise.
5934         (Sized_symbol::init_output_segment): Likewise.
5935         (Sized_symbol::init_constant): Likewise.
5936         (Symbol_table::do_define_in_output_data): Likewise.
5937         (Symbol_table::do_define_in_output_segment): Likewise.
5938         (Symbol_table::do_define_as_constant): Likewise.
5939         * symtab.h (Symbol::is_predefined): New function.
5940         (Symbol::init_base_output_data): Add is_predefined parameter.
5941         (Symbol::init_base_output_segment): Likewise.
5942         (Symbol::init_base_constant): Likewise.
5943         (Symbol::is_predefined_): New data member.
5944         (Sized_symbol::init_output_data): Add is_predefined parameter.
5945         (Sized_symbol::init_output_segment): Likewise.
5946         (Sized_symbol::init_constant): Likewise.
5947         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5948
5949 2011-06-07  Cary Coutant  <ccoutant@google.com>
5950
5951         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
5952         instead of emit_copy_reloc.
5953         (Copy_relocs::emit_copy_reloc): Refactor.
5954         (Copy_relocs::make_copy_reloc): New function.
5955         (Copy_relocs::add_copy_reloc): Remove.
5956         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
5957         section.
5958         (Copy_relocs::make_copy_reloc): New function.
5959         (Copy_relocs::add_copy_reloc): Remove.
5960         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
5961         unchanged input files.
5962         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
5963         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
5964         Reserve BSS space for COPY relocations.
5965         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5966         (Output_section_incremental_inputs::write_info_blocks): Record
5967         whether a symbol is copied from a shared object.
5968         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
5969         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
5970         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
5971         (Incremental_input_entry_reader::get_output_symbol_index): Add
5972         is_copy parameter.
5973         (Incremental_binary::emit_copy_relocs): New function.
5974         (Incremental_binary::do_emit_copy_relocs): New function.
5975         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5976         new data member.
5977         (Sized_incremental_binary::add_copy_reloc): New function.
5978         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5979         (Sized_incremental_binary::Copy_reloc): New struct.
5980         (Sized_incremental_binary::Copy_relocs): New typedef.
5981         (Sized_incremental_binary::copy_relocs_): New data member.
5982         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5983         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5984         * target.h (Sized_target::emit_copy_reloc): New function.
5985         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5986
5987 2011-06-02  Cary Coutant  <ccoutant@google.com>
5988
5989         PR gold/12163
5990         * gold/archive.cc (Archive::Archive): Initialize new data member.
5991         (Archive::include_all_members): Return if archive has already been
5992         included.
5993         * gold/archive.h (Archive::include_all_members_): New data member.
5994
5995 2011-06-02  Nick Clifton  <nickc@redhat.com>
5996
5997         * dynobj.h: Fix spelling mistake in comment.
5998         * output.cc: Likewise.
5999
6000 2011-05-31  Doug Kwan  <dougkwan@google.com>
6001             Asier Llano
6002
6003         PR gold/12826
6004         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
6005         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
6006         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
6007         redundant arm_exidx_test.so.
6008         * testsuite/Makefile.in: Regenerate.
6009         (check_SCRIPTS): Add pr12826.sh
6010         (check_DATA): Add pr12826.stdout
6011         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
6012         * testsuite/pr12826.sh: New file.
6013         * testsuite/pr12826_1.s: Ditto.
6014         * testsuite/pr12826_1.s: Ditto.
6015
6016 2011-05-30  Ian Lance Taylor  <iant@google.com>
6017
6018         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
6019         sections.
6020
6021 2011-05-29  Ian Lance Taylor  <iant@google.com>
6022
6023         PR gold/12804
6024         * testsuite/Makefile.am: Use different file name for two_file_test
6025         temporary file for each incremental test.
6026         * testsuite/Makefile.in: Rebuild.
6027
6028 2011-05-29  Ian Lance Taylor  <iant@google.com>
6029
6030         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
6031         binary input file is empty.
6032
6033 2011-05-27  Ian Lance Taylor  <iant@google.com>
6034
6035         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
6036         (ver_test_9.so): Likewise.
6037         * testsuite/Makefile.in: Rebuild.
6038
6039 2011-05-26 Cary Coutant  <ccoutant@google.com>
6040
6041         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
6042         * incremental.cc (Incremental_inputs::report_input_section): Fix
6043         comment, indentation.
6044         (Incremental_inputs::report_comdat_group): New function.
6045         (Output_section_incremental_inputs::set_final_data_size): Adjust size
6046         of data for incremental input file entry.
6047         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
6048         group count, COMDAT group signatures.
6049         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
6050         an unchanged input file.
6051         * incremental.h (Incremental_object_entry::Incremental_object_entry):
6052         Initialize new data member.
6053         (Incremental_object_entry::add_comdat_group): New function.
6054         (Incremental_object_entry::get_comdat_group_count): New function.
6055         (Incremental_object_entry::get_comdat_signature_key): New function.
6056         (Incremental_object_entry::groups_): New data member.
6057         (Incremental_inputs::report_comdat_group): New function.
6058         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
6059         data for incremental input file entry.
6060         (Incremental_input_entry_reader::get_comdat_group_count): New function.
6061         (Incremental_input_entry_reader::get_input_section): Adjust size of
6062         data for incremental input file entry.
6063         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
6064         (Incremental_input_entry_reader::get_comdat_group_signature): New
6065         function.
6066         * object.cc (Sized_relobj::include_section_group): Report kept
6067         COMDAT groups for incremental links.
6068
6069 2011-05-24  David Meyer  <pdox@google.com>
6070
6071         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
6072         with name parameter.  Add found_name parameter.
6073         * fileread.cc (Input_file::find_file): Adjust code accordingly.
6074         * dirsearch.h (class Dirsearch): Update declaration.
6075
6076 2011-05-24  Ian Lance Taylor  <iant@google.com>
6077
6078         * archive.cc (Library_base::should_include_member): Pull in object
6079         from archive if it defines the entry symbol.
6080         * parameters.cc (Parameters::entry): New function.
6081         * parameters.h (class Parameters): Declare entry.
6082         * output.h (class Output_file_header): Remove entry_ field.
6083         * output.cc (Output_file_header::Output_file_header): Remove entry
6084         parameter.  Change all callers.
6085         (Output_file_header::entry): Use parameters->entry.
6086         * gold.cc (queue_middle_tasks): Likewise.
6087         * plugin.cc (Plugin_hook::run): Likewise.
6088
6089 2011-05-24 Cary Coutant  <ccoutant@google.com>
6090
6091         * gold.cc (queue_initial_tasks): Pass incremental base filename
6092         to Output_file::open_base_file; don't print error message.
6093         * incremental-dump.cc (main): Adjust call to
6094         Output_file::open_for_modification.
6095         * incremental-dump.cc (main): Likewise.
6096         * incremental.cc (Incremental_inputs::report_command_line):
6097         Ignore --incremental-base option when comparing command lines.
6098         Ignore parameter when given as separate argument.
6099         * options.h (class General_options): Add --incremental-base.
6100         * output.cc (Output_file::Output_file):
6101         (Output_file::open_base_file): Add base_name and writable parameters;
6102         read base file into new file; print error message here.
6103         (Output_file::map_no_anonymous): Add writable parameter; adjust all
6104         callers.
6105         * output.h (Output_file::open_for_modification): Rename to...
6106         (Output_file::open_base_file): ...this; add base_name and
6107         writable parameters; adjust all callers.
6108         (Output_file::map_no_anonymous): Add writable parameter; adjust all
6109         callers.
6110         * testsuite/Makefile.am (incremental_test_4): Test
6111         --incremental-base.
6112         * testsuite/Makefile.in: Regenerate.
6113
6114 2011-05-24 Cary Coutant  <ccoutant@google.com>
6115
6116         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
6117         incremental_test_4.
6118         * testsuite/Makefile.in: Regenerate.
6119         * testsuite/two_file_test_1_v1.cc: New test source file.
6120         * testsuite/two_file_test_1b_v1.cc: New test source file.
6121         * testsuite/two_file_test_2_v1.cc: New test source file.
6122
6123 2011-05-24 Cary Coutant  <ccoutant@google.com>
6124
6125         * dynobj.h (Dynobj::do_dynobj): New function.
6126         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
6127         flag and soname for shared objects.
6128         * incremental.cc (Incremental_inputs::report_object): Make
6129         either Incremental_object_entry or Incremental_dynobj_entry; add
6130         soname to string table.
6131         (Incremental_inputs::report_input_section): Add assertion.
6132         (Output_section_incremental_inputs::set_final_data_size): Adjust
6133         type of input file entry for shared libraries; adjust size of
6134         shared library info entry.
6135         (Output_section_incremental_inputs::write_input_files): Write
6136         as_needed flag for shared libraries.
6137         (Output_section_incremental_inputs::write_info_blocks): Adjust type
6138         of input file entry for shared libraries; write soname.
6139         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
6140         soname from incremental info.
6141         * incremental.h (enum Incremental_input_flags): Add
6142         INCREMENTAL_INPUT_AS_NEEDED.
6143         (Incremental_input_entry::Incremental_input_entry): Initialize new
6144         data member.
6145         (Incremental_input_entry::set_as_needed): New function.
6146         (Incremental_input_entry::as_needed): New function.
6147         (Incremental_input_entry::do_dynobj_entry): New function.
6148         (Incremental_input_entry::as_needed_): New data member.
6149         (Incremental_object_entry::Incremental_object_entry): Don't check
6150         for shared library.
6151         (Incremental_object_entry::do_type): Likewise.
6152         (class Incremental_dynobj_entry): New class.
6153         (Incremental_input_entry_reader::as_needed): New function.
6154         (Incremental_input_entry_reader::get_soname): New function.
6155         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
6156         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
6157         size of shared library info entry.
6158         * layout.cc (Layout::finish_dynamic_section): Don't test for
6159         incremental link when adding DT_NEEDED entries.
6160         * object.h (Object::Object): Initialize new data member.
6161         (Object::dynobj): New function.
6162         (Object::set_as_needed): New function.
6163         (Object::as_needed): New function.
6164         (Object::do_dynobj): New function.
6165         (Object::as_needed_): New data member.
6166
6167 2011-05-24 Cary Coutant  <ccoutant@google.com>
6168
6169         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
6170         info; adjust display of GOT entries.
6171         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6172         vector of input objects; remove file_status_.
6173         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
6174         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
6175         got_plt reader; call target hooks to reserve GOT entries.
6176         (Output_section_incremental_inputs::set_final_data_size): Adjust size
6177         of input file info header and GOT info entry.
6178         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
6179         relocation info.
6180         (Got_plt_view_info::got_descriptor): Remove.
6181         (Got_plt_view_info::sym_index): New data member.
6182         (Got_plt_view_info::input_index): New data member.
6183         (Local_got_offset_visitor::visit): Write input file index.
6184         (Global_got_offset_visitor::visit): Write 0 for input file index.
6185         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
6186         with sym_index and input_index.
6187         (Output_section_incremental_inputs::write_got_plt): Adjust size of
6188         incremental info GOT entry; replace got_descriptor with input_index.
6189         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
6190         map from input file index to object.
6191         (Sized_relobj_incr::do_layout): Replace direct data member reference
6192         with accessor function.
6193         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
6194         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
6195         Adjust size of input file info header.
6196         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
6197         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
6198         (Incremental_input_entry_reader::get_input_section): Adjust size of
6199         input file info header.
6200         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
6201         of incremental info GOT entry.
6202         (Incremental_got_plt_reader::get_got_desc): Remove.
6203         (Incremental_got_plt_reader::get_got_symndx): New function.
6204         (Incremental_got_plt_reader::get_got_input_index): New function.
6205         (Sized_incremental_binary::Sized_incremental_binary): Remove
6206         file_status_; add input_objects_.
6207         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
6208         (Sized_incremental_binary::set_file_is_unchanged): Remove.
6209         (Sized_incremental_binary::file_is_unchanged): Remove.
6210         (Sized_incremental_binary::set_input_object): New function.
6211         (Sized_incremental_binary::input_object): New function.
6212         (Sized_incremental_binary::file_status_): Remove.
6213         (Sized_incremental_binary::input_objects_): New data member.
6214         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
6215         references.
6216         (Sized_relobj_incr::invalid_address): Move to base class.
6217         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
6218         class.
6219         (Sized_relobj_incr::do_output_section_offset): Likewise.
6220         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
6221         (Sized_relobj_incr::section_offsets_): Likewise.
6222         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
6223         function.
6224         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
6225         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
6226         with accessor function.
6227         (Sized_relobj_file::do_layout): Likewise.
6228         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
6229         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
6230         (Sized_relobj_file::compute_final_local_value): Replace refs to
6231         section_offsets_ with accessor function.
6232         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
6233         * object.h (Relobj::Relobj): Initialize new data members.
6234         (Relobj::add_dyn_reloc): New function.
6235         (Relobj::first_dyn_reloc): New function.
6236         (Relobj::dyn_reloc_count): New function.
6237         (Relobj::first_dyn_reloc_): New data member.
6238         (Relobj::dyn_reloc_count_): New data member.
6239         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
6240         references.
6241         (Sized_relobj::Address): New typedef.
6242         (Sized_relobj::invalid_address): Move here from child class.
6243         (Sized_relobj::Sized_relobj): Initialize new data members.
6244         (Sized_relobj::sized_relobj): New function.
6245         (Sized_relobj::is_output_section_offset_invalid): Move here from
6246         child class.
6247         (Sized_relobj::get_output_section_offset): Likewise.
6248         (Sized_relobj::local_has_got_offset): Likewise.
6249         (Sized_relobj::local_got_offset): Likewise.
6250         (Sized_relobj::set_local_got_offset): Likewise.
6251         (Sized_relobj::do_for_all_local_got_entries): Likewise.
6252         (Sized_relobj::clear_got_offsets): New function.
6253         (Sized_relobj::section_offsets): Move here from child class.
6254         (Sized_relobj::do_output_section_offset): Likewise.
6255         (Sized_relobj::do_set_section_offset): Likewise.
6256         (Sized_relobj::Local_got_offsets): Likewise.
6257         (Sized_relobj::local_got_offsets_): Likewise.
6258         (Sized_relobj::section_offsets_): Likewise.
6259         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
6260         references.
6261         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
6262         class.
6263         (Sized_relobj_file::sized_relobj): New function
6264         (Sized_relobj_file::local_has_got_offset): Move to base class.
6265         (Sized_relobj_file::local_got_offset): Likewise.
6266         (Sized_relobj_file::set_local_got_offset): Likewise.
6267         (Sized_relobj_file::get_output_section_offset): Likewise.
6268         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
6269         (Sized_relobj_file::do_output_section_offset): Likewise.
6270         (Sized_relobj_file::do_set_section_offset): Likewise.
6271         (Sized_relobj_file::Local_got_offsets): Likewise.
6272         (Sized_relobj_file::local_got_offsets_): Likewise.
6273         (Sized_relobj_file::section_offsets_): Likewise.
6274         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
6275         (all constructors).
6276         (set_needs_dynsym_index): Convert relobj to derived class pointer.
6277         (Output_reloc::get_symbol_index): Likewise.
6278         (Output_reloc::local_section_offset): Likewise.
6279         (Output_reloc::get_address): Likewise.
6280         (Output_reloc::symbol_value): Likewise.
6281         (Output_data_got::reserve_slot): Move to class definition.
6282         (Output_data_got::reserve_local): New function.
6283         (Output_data_got::reserve_slot_for_global): Remove.
6284         (Output_data_got::reserve_global): New function.
6285         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
6286         (all constructors, two instantiations).
6287         (Output_reloc::get_relobj): New function (two instantiations).
6288         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
6289         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
6290         (Output_data_reloc::add_global): Adjust type of relobj.
6291         (Output_data_reloc::add_global_relative): Likewise.
6292         (Output_data_reloc::add_symbolless_global_addend): Likewise.
6293         (Output_data_reloc::add_local): Likewise.
6294         (Output_data_reloc::add_local_relative): Likewise.
6295         (Output_data_reloc::add_symbolless_local_addend): Likewise.
6296         (Output_data_reloc::add_local_section): Likewise.
6297         (Output_data_reloc::add_output_section): Likewise.
6298         (Output_data_reloc::add_absolute): Likewise.
6299         (Output_data_reloc::add_target_specific): Likewise.
6300         (Output_data_got::reserve_slot): Move definition here.
6301         (Output_data_got::reserve_local): New function.
6302         (Output_data_got::reserve_global): New function.
6303         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
6304         section_offsets_ with accessor function.
6305         (Sized_relobj_file::write_sections): Likewise.
6306         (Sized_relobj_file::do_relocate_sections): Likewise.
6307         * target.h (Sized_target::reserve_local_got_entry): New function.
6308         (Sized_target::reserve_global_got_entry): New function.
6309         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
6310         (Target_x86_64::reserve_global_got_entry): New function.
6311         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
6312
6313 2011-05-23 Cary Coutant  <ccoutant@google.com>
6314
6315         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
6316         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
6317         bit when checking got_type.
6318         * incremental.cc (Sized_incremental_binary::setup_readers):
6319         Store symbol table and string table locations; initialize bit vector
6320         of file status flags.
6321         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
6322         unchanged files.
6323         (Sized_incremental_binary::do_process_got_plt): New function.
6324         (Sized_incremental_binary::get_symtab_view): Use stored locations.
6325         (Output_section_incremental_inputs::set_final_data_size): Record
6326         file index for each input file.
6327         (Output_section_incremental_inputs::write_got_plt): Store file index
6328         instead of input entry offset for each GOT entry.
6329         * incremental.h
6330         (Incremental_input_entry::Incremental_input_entry): Initialize new
6331         data member.
6332         (Incremental_input_entry::set_offset): Store file index.
6333         (Incremental_input_entry::get_file_index): New function.
6334         (Incremental_input_entry::file_index_): New data member.
6335         (Incremental_binary::process_got_plt): New function.
6336         (Incremental_binary::do_process_got_plt): New function.
6337         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6338         data members.
6339         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
6340         (Sized_incremental_binary::set_file_is_unchanged): New function.
6341         (Sized_incremental_binary::file_is_unchanged): New function.
6342         (Sized_incremental_binary::do_process_got_plt): New function.
6343         (Sized_incremental_binary::file_status_): New data member.
6344         (Sized_incremental_binary::main_symtab_loc_): New data member.
6345         (Sized_incremental_binary::main_strtab_loc_): New data member.
6346         * output.cc (Output_data_got::Got_entry::write): Add case
6347         RESERVED_CODE.
6348         (Output_data_got::add_global): Call add_got_entry.
6349         (Output_data_got::add_global_plt): Likewise.
6350         (Output_data_got::add_global_with_rel): Likewise.
6351         (Output_data_got::add_global_with_rela): Likewise.
6352         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
6353         (Output_data_got::add_global_pair_with_rela): Likewise.
6354         (Output_data_got::add_local): Call add_got_entry.
6355         (Output_data_got::add_local_plt): Likewise.
6356         (Output_data_got::add_local_with_rel): Likewise.
6357         (Output_data_got::add_local_with_rela): Likewise.
6358         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
6359         (Output_data_got::add_local_pair_with_rela): Likewise.
6360         (Output_data_got::reserve_slot): New function.
6361         (Output_data_got::reserve_slot_for_global): New function.
6362         (Output_data_got::add_got_entry): New function.
6363         (Output_data_got::add_got_entry_pair): New function.
6364         (Output_section::add_output_section_data): Edit FIXME.
6365         * output.h
6366         (Output_section_data_build::Output_section_data_build): New
6367         constructor with size parameter.
6368         (Output_data_space::Output_data_space): Likewise.
6369         (Output_data_got::Output_data_got): Initialize new data member; new
6370         constructor with size parameter.
6371         (Output_data_got::add_constant): Call add_got_entry.
6372         (Output_data_got::reserve_slot): New function.
6373         (Output_data_got::reserve_slot_for_global): New function.
6374         (class Output_data_got::Got_entry): Add RESERVED_CODE.
6375         (Output_data_got::add_got_entry): New function.
6376         (Output_data_got::add_got_entry_pair): New function.
6377         (Output_data_got::free_list_): New data member.
6378         * target.h (Sized_target::init_got_plt_for_update): New function.
6379         (Sized_target::register_global_plt_entry): New function.
6380         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
6381         Initialize new data member; call init; add constructor with PLT count.
6382         (Output_data_plt_x86_64::init): New function.
6383         (Output_data_plt_x86_64::add_relocation): New function.
6384         (Output_data_plt_x86_64::reserve_slot): New function.
6385         (Output_data_plt_x86_64::free_list_): New data member.
6386         (Target_x86_64::init_got_plt_for_update): New function.
6387         (Target_x86_64::register_global_plt_entry): New function.
6388         (Output_data_plt_x86_64::add_entry): Allocate from free list for
6389         incremental updates.
6390         (Output_data_plt_x86_64::add_relocation): New function.
6391         * testsuite/object_unittest.cc (Object_test): Set default options.
6392
6393 2011-05-16  Ian Lance Taylor  <iant@google.com>
6394
6395         * options.h (class General_options): Make -i a synonym for -r.
6396
6397 2011-05-16  Ian Lance Taylor  <iant@google.com>
6398
6399         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
6400
6401 2011-05-10 Cary Coutant  <ccoutant@google.com>
6402
6403         * object.cc (Sized_relobj::do_count_local_symbols): Check for
6404         strip_all (-s).
6405
6406 2011-05-06  Ian Lance Taylor  <iant@google.com>
6407
6408         * layout.cc (Layout::layout): If the output section flags change,
6409         update the ordering.
6410
6411 2011-04-25 Cary Coutant  <ccoutant@google.com>
6412
6413         * incremental-dump.cc (dump_incremental_inputs): Print local
6414         symbol info for each input file.
6415         * incremental.cc
6416         (Output_section_incremental_inputs::set_final_data_size): Add local
6417         symbol info to input file entries in incremental info.
6418         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6419         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
6420         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
6421         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
6422         implementation.
6423         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
6424         (Sized_incr_relobj::do_relocate): Write the local symbols.
6425         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
6426         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
6427         Adjust size of input file header.
6428         (Incremental_inputs_reader::get_local_symbol_offset): New function.
6429         (Incremental_inputs_reader::get_local_symbol_count): New function.
6430         (Incremental_inputs_reader::get_input_section): Adjust size of input
6431         file header.
6432         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
6433         (Sized_incr_relobj::This): New typedef.
6434         (Sized_incr_relobj::sym_size): New const data member.
6435         (Sized_incr_relobj::Local_symbol): New struct.
6436         (Sized_incr_relobj::do_output_local_symbol_count): New function.
6437         (Sized_incr_relobj::do_local_symbol_offset): New function.
6438         (Sized_incr_relobj::local_symbol_count_): New data member.
6439         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
6440         (Sized_incr_relobj::local_symbol_index_): New data member.
6441         (Sized_incr_relobj::local_symbol_offset_): New data member.
6442         (Sized_incr_relobj::local_dynsym_offset_): New data member.
6443         (Sized_incr_relobj::local_symbols_): New data member.
6444         * object.h (Relobj::output_local_symbol_count): New function.
6445         (Relobj::local_symbol_offset): New function.
6446         (Relobj::do_output_local_symbol_count): New function.
6447         (Relobj::do_local_symbol_offset): New function.
6448         (Sized_relobj::do_output_local_symbol_count): New function.
6449         (Sized_relobj::do_local_symbol_offset): New function.
6450
6451 2011-04-22  Vladimir Simonov  <sv@sw.ru>
6452
6453         * descriptors.cc (set_close_on_exec): New function.
6454         (Descriptors::open): Use set_close_on_exec.
6455         * output.cc (S_ISLNK): Define if not defined.
6456
6457 2011-04-22 Cary Coutant  <ccoutant@google.com>
6458
6459         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6460         global symbol map.
6461         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6462         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
6463         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
6464         relocations.
6465         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
6466         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
6467         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
6468         * incremental.h
6469         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
6470         function.
6471         (Incremental_binary::apply_incremental_relocs): New function.
6472         (Incremental_binary::do_apply_incremental_relocs): New function.
6473         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6474         data member.
6475         (Sized_incremental_binary::add_global_symbol): New function.
6476         (Sized_incremental_binary::global_symbol): New function.
6477         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6478         (Sized_incremental_binary::symbol_map_): New data member.
6479         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
6480         * target.h (Sized_target::apply_relocation): New function.
6481         * target-reloc.h (apply_relocation): New function.
6482         * x86_64.cc (Target_x86_64::apply_relocation): New function.
6483
6484 2011-04-22  Doug Kwan  <dougkwan@google.com>
6485
6486         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
6487         flag of a SHT_ARM_EXIDX section.
6488         * testsuite/Makefile.am (arm_exidx_test): New test rules.
6489         * testsuite/Makefile.in: Regenerate.
6490         * testsuite/arm_exidx_test.s: New file.
6491         * testsuite/arm_exidx_test.sh: Same.
6492
6493 2011-04-20 Cary Coutant  <ccoutant@google.com>
6494
6495         PR gold/12689
6496         * archive.h (Incremental_archive_entry::Archive_member):
6497         Initialize arg_serial_ (second constructor).
6498
6499 2011-04-17  Ian Lance Taylor  <iant@google.com>
6500
6501         * object.cc (Relocate_info::location): Simplify location string.
6502         * errors.cc (Errors::error_at_location): Don't print program
6503         name.
6504         (Errors::warning_at_location): Likewise.
6505         (Errors::undefined_symbol): Likewise.
6506         * testsuite/debug_msg.sh: Update accordingly.
6507
6508 2011-04-14 Cary Coutant  <ccoutant@google.com>
6509
6510         * gold/layout.cc (Layout::symtab_section_offset): New function.
6511         * gold/layout.h (Layout::symtab_section_offset): New function.
6512         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
6513
6514 2011-04-12  Ian Lance Taylor  <iant@google.com>
6515
6516         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
6517         with MREMAP_MAYMOVE.
6518         * output.h (class Output_file): Add map_is_allocated_ field.
6519         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
6520         not available, provide stubs.  If mremap is not available, #define
6521         it to gold_mremap.
6522         (MREMAP_MAYMOVE): Define if not defined.
6523         (Output_file::Output_file): Initialize map_is_allocated_.
6524         (Output_file::resize): Check map_is_allocated_.
6525         (Output_file::map_anonymous): If mmap fails, use malloc.
6526         (Output_file::unmap): Don't do anything for an anonymous map.
6527         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
6528         is not available, provide stubs.
6529         (File_read::View::~View): Use free rather than delete[].
6530         (File_read::make_view): Use malloc rather than new[].  If mmap
6531         fails, use malloc.
6532         (File_read::find_or_make_view): Use malloc rather than new[].
6533         * gold.h: Remove HAVE_REMAP code.
6534         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
6535         exists.  Rename mremap to gold_mremap.  If mmap is not available
6536         don't do anything.
6537         * configure, config.in: Rebuild.
6538
6539 2011-04-11  Ian Lance Taylor  <iant@google.com>
6540
6541         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
6542         initialize local variable v.
6543
6544 2011-04-11  Cary Coutant  <ccoutant@google.com>
6545
6546         * archive.cc (Archive::include_member): Adjust call to
6547         report_object.
6548         (Add_archive_symbols::run): Track argument serial numbers.
6549         (Lib_group::include_member): Likewise.
6550         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
6551         * archive.h (Incremental_archive_entry::Archive_member):
6552         Initialize arg_serial_.
6553         (Archive_member::arg_serial_): New data member.
6554         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
6555         (Sized_dynobj::do_add_symbols): Track symbols when doing an
6556         incremental link.
6557         (Sized_dynobj::do_for_all_local_got_entries): New function.
6558         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
6559         function.
6560         * fileread.cc (get_mtime): New function.
6561         * fileread.h (get_mtime): New function.
6562         * gold.cc (queue_initial_tasks): Check for incremental update.
6563         (process_incremental_input): New function.
6564         (queue_middle_tasks): Don't force valid target for incremental
6565         update.
6566         * incremental-dump.cc (find_input_containing_global): Adjust
6567         size of symbol info entry.
6568         (dump_incremental_inputs): Dump argument serial number and
6569         in_system_directory flag; bias shndx by 1; print symbol names
6570         when dumping per-file symbol lists; use new symbol info readers.
6571         * incremental.cc
6572         (Output_section_incremental_inputs:update_data_size): New function.
6573         (Sized_incremental_binary::setup_readers): Setup input readers
6574         for each input file; build maps for files added from libraries
6575         and scripts.
6576         (Sized_incremental_binary::check_input_args): New function.
6577         (Sized_incremental_binary::do_check_inputs): Build map of argument
6578         serial numbers to input arguments.
6579         (Sized_incremental_binary::do_file_has_changed): Rename
6580         do_file_is_unchanged to this; compare file modification times.
6581         (Sized_incremental_binary::do_init_layout): New function.
6582         (Sized_incremental_binary::do_reserve_layout): New function.
6583         (Sized_incremental_binary::do_get_input_reader): Remove.
6584         (Sized_incremental_binary::get_symtab_view): New function.
6585         (Incremental_checker::can_incrementally_link_output_file): Remove.
6586         (Incremental_inputs::report_command_line): Exclude --debug options.
6587         (Incremental_inputs::report_archive_begin): Add parameter; track
6588         argument serial numbers; don't put input file entry for archive
6589         before archive members.
6590         (Incremental_inputs::report_archive_end): Put input file entry
6591         for archive after archive members.
6592         (Incremental_inputs::report_object): Add parameter; track argument
6593         serial numbers and in_system_directory flag.
6594         (Incremental_inputs::report_script): Add parameter; track argument
6595         serial numbers.
6596         (Output_section_incremental_inputs::set_final_data_size): Adjust
6597         size of symbol info entry; check for forwarding symbols.
6598         (Output_section_incremental_inputs::write_input_files): Write
6599         in_system_directory flag and argument serial number.
6600         (Output_section_incremental_inputs::write_info_blocks): Map section
6601         indices between incremental info and original input file; store
6602         input section index for each symbol.
6603         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
6604         change operator() to visit().
6605         (class Global_got_offset_visitor): Likewise.
6606         (class Global_symbol_visitor_got_plt):
6607         (Output_section_incremental_inputs::write_got_plt): Use new visitor
6608         classes.
6609         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
6610         (Sized_incr_relobj::do_read_symbols): New function.
6611         (Sized_incr_relobj::do_layout): New function.
6612         (Sized_incr_relobj::do_layout_deferred_sections): New function.
6613         (Sized_incr_relobj::do_add_symbols): New function.
6614         (Sized_incr_relobj::do_should_include_member): New function.
6615         (Sized_incr_relobj::do_for_all_global_symbols): New function.
6616         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
6617         (Sized_incr_relobj::do_section_size): New function.
6618         (Sized_incr_relobj::do_section_name): New function.
6619         (Sized_incr_relobj::do_section_contents): New function.
6620         (Sized_incr_relobj::do_section_flags): New function.
6621         (Sized_incr_relobj::do_section_entsize): New function.
6622         (Sized_incr_relobj::do_section_address): New function.
6623         (Sized_incr_relobj::do_section_type): New function.
6624         (Sized_incr_relobj::do_section_link): New function.
6625         (Sized_incr_relobj::do_section_info): New function.
6626         (Sized_incr_relobj::do_section_addralign): New function.
6627         (Sized_incr_relobj::do_initialize_xindex): New function.
6628         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
6629         (Sized_incr_relobj::do_read_relocs): New function.
6630         (Sized_incr_relobj::do_gc_process_relocs): New function.
6631         (Sized_incr_relobj::do_scan_relocs): New function.
6632         (Sized_incr_relobj::do_count_local_symbols): New function.
6633         (Sized_incr_relobj::do_finalize_local_symbols): New function.
6634         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
6635         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
6636         (Sized_incr_relobj::do_relocate): New function.
6637         (Sized_incr_relobj::do_set_section_offset): New function.
6638         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
6639         (Sized_incr_dynobj::do_read_symbols): New function.
6640         (Sized_incr_dynobj::do_layout): New function.
6641         (Sized_incr_dynobj::do_add_symbols): New function.
6642         (Sized_incr_dynobj::do_should_include_member): New function.
6643         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
6644         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
6645         (Sized_incr_dynobj::do_section_size): New function.
6646         (Sized_incr_dynobj::do_section_name): New function.
6647         (Sized_incr_dynobj::do_section_contents): New function.
6648         (Sized_incr_dynobj::do_section_flags): New function.
6649         (Sized_incr_dynobj::do_section_entsize): New function.
6650         (Sized_incr_dynobj::do_section_address): New function.
6651         (Sized_incr_dynobj::do_section_type): New function.
6652         (Sized_incr_dynobj::do_section_link): New function.
6653         (Sized_incr_dynobj::do_section_info): New function.
6654         (Sized_incr_dynobj::do_section_addralign): New function.
6655         (Sized_incr_dynobj::do_initialize_xindex): New function.
6656         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
6657         (make_sized_incremental_object): New function.
6658         (Incremental_library::copy_unused_symbols): New function.
6659         (Incremental_library::do_for_all_unused_symbols): New function.
6660         * incremental.h (enum Incremental_input_flags): New type.
6661         (class Incremental_checker): Remove.
6662         (Incremental_input_entry::Incremental_input_entry): Add argument
6663         serial number.
6664         (Incremental_input_entry::arg_serial): New function.
6665         (Incremental_input_entry::set_is_in_system_directory): New function.
6666         (Incremental_input_entry::is_in_system_directory): New function.
6667         (Incremental_input_entry::arg_serial_): New data member.
6668         (Incremental_input_entry::is_in_system_directory_): New data member.
6669         (class Script_info): Move here from script.h.
6670         (Script_info::Script_info): Add filename parameter.
6671         (Script_info::filename): New function.
6672         (Script_info::filename_): New data member.
6673         (Incremental_script_entry::Incremental_script_entry): Add argument
6674         serial number.
6675         (Incremental_object_entry::Incremental_object_entry): Likewise.
6676         (Incremental_object_entry::add_input_section): Build list of input
6677         sections with map to original shndx.
6678         (Incremental_object_entry::get_input_section_index): New function.
6679         (Incremental_object_entry::shndx_): New data member.
6680         (Incremental_object_entry::name_key_): Rename; adjust all refs.
6681         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
6682         (Incremental_archive_entry::Incremental_archive_entry): Add argument
6683         serial number.
6684         (Incremental_inputs::report_archive_begin): Likewise.
6685         (Incremental_inputs::report_object): Likewise.
6686         (Incremental_inputs::report_script): Likewise.
6687         (class Incremental_global_symbol_reader): New class.
6688         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
6689         and store flags and input file type.
6690         (Incremental_input_entry_reader::arg_serial): New function.
6691         (Incremental_input_entry_reader::type): Extract type from flags.
6692         (Incremental_input_entry_reader::is_in_system_directory): New function.
6693         (Incremental_input_entry_reader::get_input_section_count): Call
6694         accessor function for type.
6695         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
6696         function for type; adjust size of global symbol entry.
6697         (Incremental_input_entry_reader::get_global_symbol_count): Call
6698         accessor function for type.
6699         (Incremental_input_entry_reader::get_object_count): Likewise.
6700         (Incremental_input_entry_reader::get_object_offset): Likewise.
6701         (Incremental_input_entry_reader::get_member_count): Likewise.
6702         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
6703         (Incremental_input_entry_reader::get_member_offset): Likewise.
6704         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
6705         (Incremental_input_entry_reader::Global_symbol_info): Remove.
6706         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
6707         (Incremental_input_entry_reader::get_global_symbol_reader): New
6708         function.
6709         (Incremental_input_entry_reader::get_output_symbol_index): New
6710         function.
6711         (Incremental_input_entry_reader::type_): Remove.
6712         (Incremental_input_entry_reader::flags_): New data member.
6713         (Incremental_inputs_reader::input_file_offset): New function.
6714         (Incremental_inputs_reader::input_file_index): New function.
6715         (Incremental_inputs_reader::input_file): Call input_file_offset.
6716         (Incremental_inputs_reader::input_file_at_offset): New function.
6717         (Incremental_relocs_reader::get_r_type): Reformat.
6718         (Incremental_relocs_reader::get_r_shndx): Reformat.
6719         (Incremental_relocs_reader::get_r_offset): Reformat.
6720         (Incremental_relocs_reader::data): New function.
6721         (Incremental_binary::Incremental_binary): Initialize new data members.
6722         (Incremental_binary::check_inputs): Add cmdline parameter.
6723         (Incremental_binary::file_is_unchanged): Remove.
6724         (Input_reader::arg_serial): New function.
6725         (Input_reader::get_unused_symbol_count): New function.
6726         (Input_reader::get_unused_symbol): New function.
6727         (Input_reader::do_arg_serial): New function.
6728         (Input_reader::do_get_unused_symbol_count): New function.
6729         (Input_reader::do_get_unused_symbol): New function.
6730         (Incremental_binary::input_file_count): New function.
6731         (Incremental_binary::get_input_reader): Change signature to use
6732         index instead of filename.
6733         (Incremental_binary::file_has_changed): New function.
6734         (Incremental_binary::get_input_argument): New function.
6735         (Incremental_binary::get_library): New function.
6736         (Incremental_binary::get_script_info): New function.
6737         (Incremental_binary::init_layout): New function.
6738         (Incremental_binary::reserve_layout): New function.
6739         (Incremental_binary::output_file): New function.
6740         (Incremental_binary::do_check_inputs): New function.
6741         (Incremental_binary::do_file_is_unchanged): Remove.
6742         (Incremental_binary::do_file_has_changed): New function.
6743         (Incremental_binary::do_init_layout): New function.
6744         (Incremental_binary::do_reserve_layout): New function.
6745         (Incremental_binary::do_input_file_count): New function.
6746         (Incremental_binary::do_get_input_reader): Change signature.
6747         (Incremental_binary::input_args_map_): New data member.
6748         (Incremental_binary::library_map_): New data member.
6749         (Incremental_binary::script_map_): New data member.
6750         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6751         new data members.
6752         (Sized_incremental_binary::output_section): New function.
6753         (Sized_incremental_binary::inputs_reader): Add const.
6754         (Sized_incremental_binary::symtab_reader): Add const.
6755         (Sized_incremental_binary::relocs_reader): Add const.
6756         (Sized_incremental_binary::got_plt_reader): Add const.
6757         (Sized_incremental_binary::get_symtab_view): New function.
6758         (Sized_incremental_binary::Inputs_reader): New typedef.
6759         (Sized_incremental_binary::Input_entry_reader): New typedef.
6760         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
6761         (Sized_incremental_binary::do_file_is_unchanged): Remove.
6762         (Sized_incremental_binary::do_file_has_changed): New function.
6763         (Sized_incremental_binary::do_init_layout): New function.
6764         (Sized_incremental_binary::do_reserve_layout): New function.
6765         (Sized_input_reader::Inputs_reader): Remove.
6766         (Sized_input_reader::Input_entry_reader): Remove.
6767         (Sized_input_reader::do_arg_serial): New function.
6768         (Sized_input_reader::do_get_unused_symbol_count): New function.
6769         (Sized_input_reader::do_get_unused_symbol): New function.
6770         (Sized_incremental_binary::do_input_file_count): New function.
6771         (Sized_incremental_binary::do_get_input_reader): Change signature;
6772         use index instead of filename.
6773         (Sized_incremental_binary::section_map_): New data member.
6774         (Sized_incremental_binary::input_entry_readers_): New data member.
6775         (class Sized_incr_relobj): New class.
6776         (class Sized_incr_dynobj): New class.
6777         (make_sized_incremental_object): New function.
6778         (class Incremental_library): New class.
6779         * layout.cc (Free_list::num_lists): New static data member.
6780         (Free_list::num_nodes): New static data member.
6781         (Free_list::num_removes): New static data member.
6782         (Free_list::num_remove_visits): New static data member.
6783         (Free_list::num_allocates): New static data member.
6784         (Free_list::num_allocate_visits): New static data member.
6785         (Free_list::init): New function.
6786         (Free_list::remove): New function.
6787         (Free_list::allocate): New function.
6788         (Free_list::dump): New function.
6789         (Free_list::print_stats): New function.
6790         (Layout_task_runner::run): Resize output file for incremental updates.
6791         (Layout::Layout): Initialize new data members.
6792         (Layout::set_incremental_base): New function.
6793         (Layout::init_fixed_output_section): New function.
6794         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6795         incremental updates.
6796         (Layout::create_gold_note): Do not create gold note section for
6797         incremental updates.
6798         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6799         for incremental updates.
6800         (Layout::set_section_offsets): For incremental updates, allocate space
6801         from free list.
6802         (Layout::create_symtab_sections): Layout with offsets relative to
6803         start of section; for incremental updates, allocate space from free
6804         list.
6805         (Layout::create_shdrs): For incremental updates, allocate space from
6806         free list.
6807         (Layout::finish_dynamic_section): For incremental updates, do not
6808         check --as-needed (fixed in subsequent patch).
6809         * layout.h (class Free_list): New class.
6810         (Layout::set_incremental_base): New function.
6811         (Layout::incremental_base): New function.
6812         (Layout::init_fixed_output_section): New function.
6813         (Layout::allocate): New function.
6814         (Layout::incremental_base_): New data member.
6815         (Layout::free_list_): New data member.
6816         * main.cc (main): Print Free_list statistics.
6817         * object.cc (Relobj::finalize_incremental_relocs): Add
6818         clear_counts parameter; clear counts only when clear_counts is set.
6819         (Sized_relobj::Sized_relobj): Initialize new base class.
6820         (Sized_relobj::do_layout): Don't report special sections.
6821         (Sized_relobj::do_for_all_local_got_entries): New function.
6822         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6823         symtab_off to all symbol table offsets.
6824         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6825         * object.h (class Got_offset_list): Move to top of file.
6826         (Object::Object): Allow case where input_file == NULL.
6827         (Object::~Object): Likewise.
6828         (Object::input_file): Assert that input_file != NULL.
6829         (Object::lock): Allow case where input_file == NULL.
6830         (Object::unlock): Likewise.
6831         (Object::is_locked): Likewise.
6832         (Object::token): Likewise.
6833         (Object::release): Likewise.
6834         (Object::is_incremental): New function.
6835         (Object::get_mtime): New function.
6836         (Object::for_all_local_got_entries): New function.
6837         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6838         (Object::set_is_in_system_directory): New function.
6839         (Object::is_in_system_directory): New function.
6840         (Object::do_is_incremental): New function.
6841         (Object::do_get_mtime): New function.
6842         (Object::do_for_all_local_got_entries): New function.
6843         (Object::is_in_system_directory_): New data member.
6844         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
6845         (class Sized_relobj_base): New class.
6846         (class Sized_relobj): Derive from Sized_relobj_base.
6847         (class Sized_relobj::Symbols): Redeclare from base class.
6848         (class Sized_relobj::local_got_offset_list): Remove.
6849         (class Sized_relobj::Output_sections): Redeclare from base class.
6850         (class Sized_relobj::do_for_all_local_got_entries): New function.
6851         (class Sized_relobj::write_local_symbols): Add offset parameter.
6852         (class Sized_relobj::local_symbol_offset_): Update comment.
6853         (class Sized_relobj::local_dynsym_offset_): Update comment.
6854         * options.cc (Input_arguments::add_file): Remove const.
6855         * options.h (Input_file_argument::Input_file_argument):
6856         Initialize arg_serial_ (all constructors).
6857         (Input_file_argument::set_arg_serial): New function.
6858         (Input_file_argument::arg_serial): New function.
6859         (Input_file_argument::arg_serial_): New data member.
6860         (Input_arguments::Input_arguments): Initialize file_count_.
6861         (Input_arguments::add_file): Remove const.
6862         (Input_arguments::number_of_input_files): New function.
6863         (Input_arguments::file_count_): New data member.
6864         (Command_line::number_of_input_files): Call
6865         Input_arguments::number_of_input_files.
6866         * output.cc (Output_segment_headers::Output_segment_headers):
6867         Set current size.
6868         (Output_section::Input_section::current_data_size): New function.
6869         (Output_section::Output_section): Initialize new data members.
6870         (Output_section::add_input_section): Don't do merge sections for
6871         an incremental link; allocate space from free list for an
6872         incremental update.
6873         (Output_section::add_output_section_data): Allocate space from
6874         free list for an incremental update.
6875         (Output_section::update_data_size): New function.
6876         (Output_section::set_fixed_layout): New function.
6877         (Output_section::reserve): New function.
6878         (Output_segment::set_section_addresses): Remove const.
6879         (Output_segment::set_section_list_addresses): Remove const; allocate
6880         space from free list for an incremental update.
6881         (Output_segment::set_offset): Adjust size of RELRO segment for an
6882         incremental update.
6883         * output.h (Output_data::current_data_size): Move here from
6884         child classes.
6885         (Output_data::pre_finalize_data_size): New function.
6886         (Output_data::update_data_size): New function.
6887         (Output_section_headers::update_data_size): new function.
6888         (Output_section_data_build::current_data_size): Move to Output_data.
6889         (Output_data_strtab::update_data_size): New function.
6890         (Output_section::current_data_size): Move to Output_data.
6891         (Output_section::set_fixed_layout): New function.
6892         (Output_section::has_fixed_layout): New function.
6893         (Output_section::reserve): New function.
6894         (Output_section::update_data_size): New function.
6895         (Output_section::has_fixed_layout_): New data member.
6896         (Output_section::free_list_): New data member.
6897         (Output_segment::set_section_addresses): Remove const.
6898         (Output_segment::set_section_list_addresses): Remove const.
6899         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
6900         New function.
6901         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
6902         New function.
6903         * readsyms.cc (Read_symbols::do_read_symbols): Add library
6904         parameter when calling Add_symbols constructor; store argument
6905         serial number for members of a lib group.
6906         (Add_symbols::locks): Allow case where token == NULL.
6907         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
6908         (Read_member::~Read_member): New function.
6909         (Read_member::is_runnable): New function.
6910         (Read_member::locks): New function.
6911         (Read_member::run): New function.
6912         (Check_script::~Check_script): New function.
6913         (Check_script::is_runnable): New function.
6914         (Check_script::locks): New function.
6915         (Check_script::run): New function.
6916         (Check_library::~Check_library): New function.
6917         (Check_library::is_runnable): New function.
6918         (Check_library::locks): New function.
6919         (Check_library::run): New function.
6920         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6921         (Add_symbols::library_): New data member.
6922         (class Read_member): New class.
6923         (class Check_script): New class.
6924         (class Check_library): New class.
6925         * reloc.cc (Read_relocs::is_runnable): Allow case where
6926         token == NULL.
6927         (Read_relocs::locks): Likewise.
6928         (Scan_relocs::locks): Likewise.
6929         (Relocate_task::locks): Likewise.
6930         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6931         to clear counters.
6932         (Sized_relobj::incremental_relocs_scan): Fix comment.
6933         (Sized_relobj::do_relocate): Pass output file offset to
6934         write_local_symbols.
6935         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6936         from class declaration.
6937         * script.cc (read_input_script): Allocate Script_info; pass
6938         argument serial number to report_script.
6939         * script.h (class Script_info): Move to incremental.h.
6940         * symtab.cc (Symbol_table::add_from_incrobj): New function.
6941         * symtab.h (Symbol_table::add_from_incrobj): New function.
6942         (Symbol_table::set_file_offset): New function.
6943
6944 2011-04-05  Cary Coutant  <ccoutant@google.com>
6945
6946         * incremental-dump.cc (dump_incremental_inputs): Change signature
6947         to take a Sized_incremental_binary; change caller.  Use readers
6948         in Sized_incremental_binary.
6949         * incremental.cc
6950         (Sized_incremental_binary::find_incremental_inputs_sections):
6951         Rename do_find_incremental_inputs_sections to this.
6952         (Sized_incremental_binary::setup_readers): New function.
6953         (Sized_incremental_binary::do_check_inputs): Check
6954         has_incremental_info_ flag; move setup code to setup_readers;
6955         use input readers.
6956         (Sized_incremental_binary::do_file_is_unchanged): New function.
6957         (Sized_incremental_binary::do_get_input_reader): New function.
6958         * incremental.h (class Incremental_binary): Move to end of file.
6959         (Incremental_binary::file_is_unchanged): New function.
6960         (Incremental_binary::do_file_is_unchanged): New function.
6961         (Incremental_binary::Input_reader): New class.
6962         (Incremental_binary::get_input_reader): New function.
6963         (class Sized_incremental_binary): Move to end of file.
6964         (Sized_incremental_binary::Sized_incremental_binary): Setup the
6965         input section reader classes.
6966         (Sized_incremental_binary::has_incremental_info): New function.
6967         (Sized_incremental_binary::inputs_reader): New function.
6968         (Sized_incremental_binary::symtab_reader): New function.
6969         (Sized_incremental_binary::relocs_reader): New function.
6970         (Sized_incremental_binary::got_plt_reader): New function.
6971         (Sized_incremental_binary::do_file_is_unchanged): New function.
6972         (Sized_incremental_binary::Sized_input_reader): New class.
6973         (Sized_incremental_binary::get_input_reader): New function.
6974         (Sized_incremental_binary::find_incremental_inputs_sections):
6975         Rename do_find_incremental_inputs_sections to this.
6976         (Sized_incremental_binary::setup_readers): New function.
6977         (Sized_incremental_binary::has_incremental_info_): New data member.
6978         (Sized_incremental_binary::inputs_reader_): New data member.
6979         (Sized_incremental_binary::symtab_reader_): New data member.
6980         (Sized_incremental_binary::relocs_reader_): New data member.
6981         (Sized_incremental_binary::got_plt_reader_): New data member.
6982         (Sized_incremental_binary::current_input_file_): New data member.
6983
6984 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
6985
6986         PR gold/12640
6987         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6988         violation.
6989
6990 2011-03-30  Cary Coutant  <ccoutant@google.com>
6991
6992         * archive.cc (Archive::include_member): Adjust call to report_object.
6993         (Add_archive_symbols::run): Add script_info to call to
6994         report_archive_begin.
6995         (Lib_group::include_member): Adjust call to report_object.
6996         (Add_lib_group_symbols::run): Adjust call to report_object.
6997         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6998         blocks.  Add object count for script input files.
6999         * incremental.cc (Incremental_inputs::report_archive_begin): Add
7000         script_info parameter; change all callers.
7001         (Incremental_inputs::report_object): Add script_info parameter;
7002         change all callers.
7003         (Incremental_inputs::report_script): Store backpointer to
7004         incremental info entry.
7005         (Output_section_incremental_inputs::set_final_data_size): Record
7006         additional information for scripts.
7007         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7008         * incremental.h (Incremental_script_entry::add_object): New function.
7009         (Incremental_script_entry::get_object_count): New function.
7010         (Incremental_script_entry::get_object): New function.
7011         (Incremental_script_entry::objects_): New data member; adjust
7012         constructor.
7013         (Incremental_inputs::report_archive_begin): Add script_info parameter.
7014         (Incremental_inputs::report_object): Add script_info parameter.
7015         (Incremental_inputs_reader::get_object_count): New function.
7016         (Incremental_inputs_reader::get_object_offset): New function.
7017         * options.cc (Input_arguments::add_file): Return reference to
7018         new input argument.
7019         * options.h (Input_argument::set_script_info): New function.
7020         (Input_argument::script_info): New function.
7021         (Input_argument::script_info_): New data member; adjust all
7022         constructors.
7023         (Input_file_group::add_file): Return reference to new input argument.
7024         (Input_file_lib::add_file): Likewise.
7025         (Input_arguments::add_file): Likewise.
7026         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
7027         * script.cc (Parser_closure::Parser_closure): Add script_info
7028         parameter; adjust all callers.
7029         (Parser_closure::script_info): New function.
7030         (Parser_closure::script_info_): New data member.
7031         (read_input_script): Report scripts earlier to incremental info.
7032         (script_add_file): Set script_info in Input_argument.
7033         (script_add_library): Likewise.
7034         * script.h (Script_options::Script_info): Rewrite class.
7035
7036 2011-03-29  Cary Coutant  <ccoutant@google.com>
7037
7038         * archive.cc (Library_base::should_include_member): Move
7039         method here from class Archive.
7040         (Archive::Archive): Initialize base class.
7041         (Archive::should_include_member): Move to base class.
7042         (Archive::do_for_all_unused_symbols): New function.
7043         (Add_archive_symbols::run): Remove redundant access to
7044         incremental_inputs.
7045         (Lib_group::Lib_group): Initialize base class.
7046         (Lib_group::do_filename): New function.
7047         (Lib_group::include_member): Pass pointer to Lib_group to
7048         report_object.
7049         (Lib_group::do_for_all_unused_symbols): New function.
7050         (Add_lib_group_symbols::run): Report archive information for
7051         incremental links.
7052         * archive.h (class Library_base): New base class.
7053         (class Archive): Derive from Library_base.
7054         (Archive::filename): Move to base class.
7055         (Archive::set_incremental_info): Likewise.
7056         (Archive::incremental_info): Likewise.
7057         (Archive::Should_include): Likewise.
7058         (Archive::should_include_member): Likewise.
7059         (Archive::Armap_entry): Remove.
7060         (Archive::Unused_symbol_iterator): Remove.
7061         (Archive::unused_symbols_begin): Remove.
7062         (Archive::unused_symbols_end): Remove.
7063         (Archive::do_filename): New function.
7064         (Archive::do_get_mtime): New function.
7065         (Archive::do_for_all_unused_symbols): New function.
7066         (Archive::task_): Move to base class.
7067         (Archive::incremental_info_): Likewise.
7068         (class Lib_group): Derive from Library_base.
7069         (Lib_group::do_filename): New function.
7070         (Lib_group::do_get_mtime): New function.
7071         (Lib_group::do_for_all_unused_symbols): New function.
7072         (Lib_group::task_): Move to base class.
7073         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
7074         function.
7075         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
7076         function.
7077         * incremental.cc (Incremental_inputs::report_archive_begin):
7078         Use Library_base; call library's get_mtime; add incremental inputs
7079         entry before members.
7080         (class Unused_symbol_visitor): New class.
7081         (Incremental_inputs::report_archive_end): Use Library_base; use
7082         visitor class to record unused symbols; don't add incremental inputs
7083         entry after members.
7084         (Incremental_inputs::report_object): Use Library_base.
7085         * incremental.h
7086         (Incremental_archive_entry::Incremental_archive_entry): Remove
7087         unused Archive parameter.
7088         (Incremental_inputs::report_archive_begin): Use Library_base.
7089         (Incremental_inputs::report_archive_end): Likewise.
7090         (Incremental_inputs::report_object): Likewise.
7091         * object.cc (Sized_relobj::do_for_all_global_symbols): New
7092         function.
7093         * object.h (Object::for_all_global_symbols): New function.
7094         (Object::do_for_all_global_symbols): New function.
7095         (Sized_relobj::do_for_all_global_symbols): New function.
7096         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
7097         function.
7098         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
7099         function.
7100
7101 2011-03-27  Ian Lance Taylor  <iant@google.com>
7102
7103         * archive.cc (Archive::interpret_header): Return -1 if something
7104         goes wrong.  Change callers accordingly.
7105
7106 2011-03-25  Cary Coutant  <ccoutant@google.com>
7107
7108         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
7109         * testsuite/Makefile.in: Regenerate.
7110
7111 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
7112
7113         * plugin.cc (get_view): New.
7114         (Plugin::load): Pass get_view to the plugin.
7115         (Plugin_manager::get_view): New.
7116
7117 2011-03-21  Ian Lance Taylor  <iant@google.com>
7118
7119         * testsuite/final_layout.sh: Rewrite to not use dc.
7120         * testsuite/relro_test.sh: Fail if dc is not present.
7121
7122 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
7123
7124         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
7125         Change == to -eq.
7126         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
7127         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
7128         Change == to -eq.
7129         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
7130         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
7131
7132 2011-03-14  Ian Lance Taylor  <iant@google.com>
7133
7134         * script-sections.cc (Sort_output_sections::script_compare):
7135         Rename from is_before, change return type.
7136         (Sort_output_sections::operator()): Adjust accordingly.
7137
7138 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
7139
7140         PR gold/12572
7141         * testsuite/odr_violation2.cc: Add comment to make all error line
7142         numbers double digits.
7143         * testsuite/debug_msg.sh: Adjust expected errors.
7144
7145 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
7146
7147         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
7148         but mark earlier ones as non-canonical
7149         (offset_to_iterator): Update search target and example
7150         (do_addr2line): Return extra lines in a vector*
7151         (format_file_lineno): Extract from do_addr2line
7152         (one_addr2line): Add vector* out-param
7153         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
7154         when a lineno entry appeared last for its instruction
7155         (Dwarf_line_info): Add vector* out-param
7156         * object.cc (Relocate_info): Pass NULL for the vector* out-param
7157         * symtab.cc (Odr_violation_compare): Include the lineno in the
7158         comparison again.
7159         (linenos_from_loc): New. Combine the canonical line for an
7160         address with its other lines.
7161         (True_if_intersect): New. Helper functor to make
7162         std::set_intersection a query.
7163         (detect_odr_violations): Compare sets of lines instead of just
7164         one line for each function. This became less deterministic, but
7165         has fewer false positives.
7166         * symtab.h: Declarations.
7167         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
7168         mix an optimized and non-optimized object in the same binary
7169         (odr_violation2.so): Same.
7170         * testsuite/Makefile.in: Regenerate from Makefile.am.
7171         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
7172         * testsuite/debug_msg.sh: Update line numbers and add
7173         assertions.
7174         * testsuite/odr_violation1.cc: Use OdrDerived, in a
7175         non-optimized context.
7176         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
7177         isn't inlined, and use OdrDerived in an optimized context.
7178         * testsuite/odr_header1.h: Defines OdrDerived, where
7179         optimization will change the
7180         first-instruction-in-the-destructor's file and line number.
7181         * testsuite/odr_header2.h: Defines OdrBase.
7182
7183 2011-03-09  Ian Lance Taylor  <iant@google.com>
7184
7185         * fileread.cc (File_read::clear_views): Don't delete the whole
7186         file view.
7187
7188 2011-03-08  Ian Lance Taylor  <iant@google.com>
7189
7190         PR gold/12525
7191         * fileread.cc: #include <climits>.
7192         (GOLD_IOV_MAX): Define.
7193         (File_read::read_multiple): Limit number of entries by iov_max.
7194         * fileread.h (class File_read): Always set max_readv_entries to
7195         128.
7196
7197 2011-03-07  Ian Lance Taylor  <iant@google.com>
7198
7199         PR gold/12525
7200         * options.h (class General_options): Add -dy and -dn.
7201
7202 2011-03-02  Cary Coutant  <ccoutant@google.com>
7203
7204         * testsuite/script_test_9.t: Add TLS segment.
7205
7206 2011-03-02  Simon Baldwin  <simonb@google.com>
7207
7208         * configure.ac: Add check for gnu_indirect_function support in
7209         the toolchain building binutils.
7210         * configure: Rebuild.
7211
7212 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
7213
7214         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
7215         plugin only symbols.
7216         (Symbol_table::sized_finalize_symbol) Mark symbol only present
7217         in plugin files as not needed in the symbol table.
7218
7219 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
7220
7221         * output.cc (Output_section::add_input_section): Delay fill
7222         generation for section ordering.
7223
7224 2011-02-09  Ian Lance Taylor  <iant@google.com>
7225
7226         PR gold/12316
7227         * object.h (class Sized_relobj): Remove clear_local_symbols.
7228         * reloc.cc (Sized_relobj::do_relocate): Don't call
7229         clear_local_symbols.
7230
7231 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
7232
7233         * plugin.cc (is_visible_from_outside): Return true for symbols
7234         in the -u option.
7235
7236 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
7237
7238         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
7239         filename.
7240
7241 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
7242
7243         * icf.h (is_section_foldable_candidate): Change type of parameter
7244         to std::string.
7245         * icf.cc (Icf::find_identical_sections): Change type of local variable
7246         section_name to be std::string.
7247         (is_function_ctor_or_dtor): Change type of parameter to std::string.
7248
7249 2011-01-25  Ian Lance Taylor  <iant@google.com>
7250
7251         * script.cc (script_add_extern): Rewrite to use
7252         add_symbol_reference.
7253
7254 2011-01-25  Doug Kwan  <dougkwan@google.com>
7255
7256         * icf.cc (get_section_contents): Always lock section's object.
7257
7258 2011-01-24  Ian Lance Taylor  <iant@google.com>
7259
7260         * options.h (class General_options): Accept
7261         --no-detect-odr-violations.
7262
7263 2011-01-24  Ian Lance Taylor  <iant@google.com>
7264
7265         * version.cc (version_string): Bump to 1.11.
7266
7267 2011-01-24  Ian Lance Taylor  <iant@google.com>
7268
7269         * plugin.cc (class Plugin_rescan): Define new class.
7270         (Plugin_manager::claim_file): Set any_claimed_.
7271         (Plugin_manager::save_archive): New function.
7272         (Plugin_manager::save_input_group): New function.
7273         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
7274         necessary.
7275         (Plugin_manager::new_undefined_symbol): New function.
7276         (Plugin_manager::rescan): New function.
7277         (Plugin_manager::rescannable_defines): New function.
7278         (Plugin_manager::add_input_file): Set any_added_.
7279         * plugin.h (class Plugin_manager): define new fields rescannable_,
7280         undefined_symbols_, any_claimed_, and any_added_.  Declare
7281         Plugin_rescan as friend.  Declare new functions.
7282         (Plugin_manager::Rescannable): Define type.
7283         (Plugin_manager::Rescannable_list): Define type.
7284         (Plugin_manager::Undefined_symbol_list): Define type.
7285         (Plugin_manager::Plugin_manager): Initialize new fields.
7286         * archive.cc (Archive::defines_symbol): New function.
7287         (Add_archive_symbols::run): Pass archive to plugins if any.
7288         * archive.h (class Archive): Declare defines_symbol.
7289         * readsyms.cc (Input_group::~Input_group): New function.
7290         (Finish_group::run): Pass input_group to plugins if any.
7291         * readsyms.h (class Input_group): Declare destructor.
7292         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
7293         any.
7294
7295 2011-01-10  Ian Lance Taylor  <iant@google.com>
7296
7297         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
7298         section as relro.
7299         (Layout::set_segment_offsets): Reset increase_relro before calling
7300         set_section_addresses a second time.
7301
7302 2011-01-04  Cary Coutant  <ccoutant@google.com>
7303
7304         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
7305         sections before NOBITS sections.
7306
7307 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
7308
7309         * version.cc (print_version): Update copyright to 2011.
7310
7311 2010-12-23  Cary Coutant  <ccoutant@google.com>
7312
7313         * output.h (Output_data_reloc::add_output_section): Pass OD instead
7314         of OS to this->add.  Add OD parameter to second form of the function.
7315
7316 2010-12-20  Ian Lance Taylor  <iant@google.com>
7317
7318         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
7319         second of two consecutive entries with same offset.
7320
7321 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7322
7323         * testsuite/Makefile.am (ifuncmain2static_LDADD)
7324         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
7325         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
7326         to avoid unneeded links against $(LDADD).
7327         * testsuite/Makefile.in: Regenerate.
7328
7329 2010-12-15  Ian Lance Taylor  <iant@google.com>
7330
7331         PR gold/12324
7332         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
7333         for R_X86_64_32 and R_X86_64_PC32.
7334         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
7335         ver_matching_def_pic.o.
7336         (ver_matching_def_pic.o): New target.
7337
7338 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7339
7340         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
7341         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
7342         Move definition before File_read::View member definitions.
7343         (File_read::View::~View): Initialize and hold lock before
7344         updating current_mapped_bytes.
7345
7346 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7347
7348         * dwarf_reader.cc: Remove outdated comment.
7349         * gold-threads.cc: Fix typo in error message.
7350         * archive.cc: Fix typos in comments.
7351         * archive.h: Likewise.
7352         * arm-reloc-property.cc: Likewise.
7353         * arm-reloc-property.h: Likewise.
7354         * arm-reloc.def: Likewise.
7355         * arm.cc: Likewise.
7356         * attributes.h: Likewise.
7357         * cref.cc: Likewise.
7358         * ehframe.cc: Likewise.
7359         * fileread.h: Likewise.
7360         * gold.h: Likewise.
7361         * i386.cc: Likewise.
7362         * icf.cc: Likewise.
7363         * incremental.h: Likewise.
7364         * int_encoding.cc: Likewise.
7365         * layout.h: Likewise.
7366         * main.cc: Likewise.
7367         * merge.h: Likewise.
7368         * object.cc: Likewise.
7369         * object.h: Likewise.
7370         * options.cc: Likewise.
7371         * readsyms.cc: Likewise.
7372         * reduced_debug_output.cc: Likewise.
7373         * reloc.cc: Likewise.
7374         * script-sections.cc: Likewise.
7375         * sparc.cc: Likewise.
7376         * symtab.h: Likewise.
7377         * target-reloc.h: Likewise.
7378         * target.cc: Likewise.
7379         * target.h: Likewise.
7380         * timer.cc: Likewise.
7381         * timer.h: Likewise.
7382         * x86_64.cc: Likewise.
7383
7384 2010-12-09  Cary Coutant  <ccoutant@google.com>
7385
7386         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
7387         stack.
7388         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
7389         parameter; change all callers.
7390         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
7391         * options.h (warn_execstack): New option.
7392
7393 2010-12-07  Doug Kwan  <dougkwan@google.com>
7394
7395         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
7396         like function call relocations.
7397
7398 2010-12-07  Ian Lance Taylor  <iant@google.com>
7399
7400         * archive.cc (Archive::get_elf_object_for_member): Permit
7401         punconfigured to be NULL.
7402         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
7403         (Archive::include_member): Pass NULL to get_elf_object_for_member
7404         if we searched for the archive and this is the first included
7405         object.
7406
7407 2010-12-01  Ian Lance Taylor  <iant@google.com>
7408
7409         * dwarf_reader.h (class Sized_dwarf_line_info): Add
7410         track_relocs_type_ field.
7411         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7412         Set track_relocs_type_.
7413         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
7414         contents when using RELA relocs.
7415         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
7416         reloc_map_.
7417         * reloc.cc (Track_relocs::next_addend): New function.
7418         * reloc.h (class Track_relocs): Declare next_addend.
7419
7420 2010-12-01  Ian Lance Taylor  <iant@google.com>
7421
7422         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
7423         virtual destructor.
7424
7425 2010-12-01  Ian Lance Taylor  <iant@google.com>
7426
7427         * README: Update compilers known to work and fail.
7428
7429 2010-11-23  Matthias Klose  <doko@ubuntu.com>
7430
7431         * configure.in: For --enable-gold, handle value `default' instead of
7432         `both*'.  Always install ld as ld.bfd, install as ld if gold is
7433         not the default.
7434         * configure: Regenerate.
7435
7436 2010-11-18  Doug Kwan  <dougkwan@google.com>
7437
7438         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
7439         and right_alignment to be zero.  Store result alignment only if it is
7440         greater than existing alignment.
7441
7442 2010-11-16  Cary Coutant  <ccoutant@google.com>
7443
7444         PR gold/12220
7445         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7446         Check for ".zdebug_line".
7447
7448 2010-11-16  Doug Kwan  <dougkwan@google.com>
7449             Cary Coutant  <ccoutant@google.com>
7450
7451         * output.h (Output_segment::set_section_addresses): Pass increase_relro
7452         by reference; adjust all callers.
7453         * output.cc (Output_segment::set_section_addresses): Adjust references
7454         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
7455         list is empty.
7456         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
7457         end at page boundary.
7458
7459 2010-11-16  Cary Coutant  <ccoutant@google.com>
7460
7461         PR gold/12220
7462         * layout.cc (Layout::choose_output_section): Transform names of
7463         compressed sections even when using a script with a SECTIONS clause.
7464         (Layout::output_section_name): Remove code to transform
7465         compressed debug section names.
7466         * output.cc (Output_section::add_input_section): Use uncompressed
7467         section size when tracking input sections.
7468
7469 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
7470
7471         * symtab.h (Symbol::NON_PIC_REF): Remove.
7472         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
7473         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
7474         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
7475         (Symbol::use_plt_offset): Take a flags argument and pass it
7476         directly to needs_dynamic_reloc.  Restrict check for undefined
7477         weak symbols to function calls.
7478         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
7479         (Target_arm::Scan::global): Use it.
7480         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
7481         (Target_arm::Relocate::relocate): Likewise.
7482         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
7483         parameter with an r_type parameter.  Use get_reference_flags
7484         to get the flags.
7485         (Target_arm::Relocate::relocate): Update accordingly.
7486         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
7487         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
7488         (Target_i386::Scan::global): Likewise.
7489         (Target_i386::Relocate::relocate): Likewise.
7490         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
7491         parameter with an r_type parameter.  Use get_reference_flags
7492         to get the flags.
7493         (Target_i386::Relocate::relocate): Update accordingly.
7494         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
7495         (Target_powerpc::Scan::global): Use it.
7496         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
7497         (Target_powerpc::Relocate::relocate): Likewise.
7498         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
7499         (Target_sparc::Scan::global): Use it.
7500         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
7501         (Target_sparc::Relocate::relocate): Likewise.
7502         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
7503         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
7504         (Target_x86_64::Scan::global): Likewise.
7505         (Target_x86_64::Relocate::relocate): Likewise.
7506
7507 2010-11-08  Doug Kwan  <dougkwan@google.com>
7508             Cary Coutant  <ccoutant@google.com>
7509
7510         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
7511         (Arm_exidx_merge_section::section_contents_): New data member.
7512         (Arm_input_section::Arm_input_section): Initialize original_contents_.
7513         (Arm_input_section::~Arm_input_section): De-allocate memory.
7514         (Arm_input_section::original_contents_): New data member.
7515         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
7516         in parameters instead of calling Object::section_contents without
7517         locking.
7518         (Arm_output_section::group_section): New parameter TASK.  Pass it
7519         to callees that need locking objects.
7520         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
7521         to lock EXIDX input sections.  Fix a formatting issue.  Call
7522         Arm_exidx_merged_section::build_contents to create merged section
7523         contents.
7524         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
7525         to lock object of stub table owner.
7526         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
7527         TEXT_SIZE to initialize data member TEXT_SIZE_.
7528         (Arm_exidx_input_section::addralign): Fix typo in comment.
7529         (Arm_exidx_input_section::text_size): New method.
7530         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
7531         that require locking objects.  Lock objects before scanning for stubs
7532         and updating local symbols.
7533         (Arm_input_section<big_endian>::init): Copy contents of original
7534         input section.
7535         (Arm_input_section<big_endian>::do_write): Use saved contents of
7536         original input section instead of calling Object::section_contents
7537         without locking.
7538         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
7539         size without calling Object::section_size().
7540         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
7541         for size.  Allocate a buffer for merged EXIDX entries.
7542         (Arm_exidx_merged_section::build_contents): New method.
7543         (Arm_exidx_merged_section::do_write): Move merge section contents
7544         building code to Arm_exidx_merged_section::build_contetns.  Write
7545         out contetns in buffer instead of building it on the fly.
7546         (Arm_relobj::make_exidx_input_section): Also pass text section size
7547         to Arm_exidx_input_section constructor.
7548         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
7549         (Arm_dynobj::do_read_symbols): Fix memory leak.
7550         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
7551         * target.h: (class Task): Add forward declaration.
7552         (Target::relax): Add new parameter TASK and pass it to
7553         Target::do_relax().
7554         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
7555
7556 2010-11-05  Cary Coutant  <ccoutant@google.com>
7557
7558         PR gold/10708
7559         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
7560         object when reading from the file.
7561         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
7562         second layout pass.
7563         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
7564         when reading section contents.
7565         (get_section_contents): Likewise.
7566         (icf::find_identical_sections): Likewise.
7567         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
7568         object when reading from the file.
7569         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
7570         the object when doing deferred section layout.
7571
7572 2010-11-03  Nick Clifton  <nickc@redhat.com>
7573
7574         PR gold/12001
7575         * script.h (class Symbol_assignment: name): New member.  Returns
7576         the name of the symbol.
7577         * scrfipt.cc (Script_options::is_pending_assignment): New member.
7578         Returns true if the given symbol name is on the list of
7579         assignments wating to be processed.
7580         * archive.cc (should_incldue_member): If the symbol is undefined,
7581         check to see if it is on the list of symbols pending assignment.
7582
7583 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
7584
7585         * script-sections.cc (Script_sections::find_memory_region): Check
7586         for a NULL output section pointer.
7587
7588 2010-10-29  Doug Kwan  <dougkwan@google.com>
7589
7590         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
7591         Output_section::add_relaxed_input_section.
7592         * output.cc (Output_section::add_relaxed_input_section): Add new
7593         arguments LAYOUT and NAME.  Set section order index.
7594         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7595         Copy section order index.
7596         * output.h (Output_section::add_relaxed_input_section): Add new
7597         arguments LAYOUT and NAME.
7598
7599 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7600
7601         * testsuite/Makefile.am: Move gcctestdir/ld rule to
7602         NATIVE_OR_CROSS_LINKER.
7603         * testsuite/Makefile.in: Regenerate.
7604
7605 2010-10-20  Doug Kwan  <dougkwan@google.com>
7606
7607         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
7608         without SHF_LINK_ORDER flags.
7609         * layout.cc (Layout::choose_output_section): Do not filter
7610         SHF_LINK_ORDER flag in a relocatable link.
7611
7612 2010-10-17  Cary Coutant  <ccoutant@google.com>
7613
7614         * output.h (Output_segment::set_section_addresses): Change function
7615         signature.  Update all callers.
7616         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
7617         sections.
7618         (Output_segment::set_section_addresses): Align after last TLS
7619         section.  Add padding before last relro section instead of after.
7620
7621 2010-10-17  Doug Kwan  <dougkwan@google.com>
7622
7623         * gold/arm.cc (Target_arm::got_section): Use correct order and set
7624         GOT output section to be writable.
7625
7626 2010-10-14  Cary Coutant  <ccoutant@google.com>
7627
7628         * debug.h (DEBUG_INCREMENTAL): New flag.
7629         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
7630         * gold.cc (queue_initial_tasks): Check parameters for incremental link
7631         mode.
7632         * incremental.cc (report_command_line): Ignore all forms of
7633         --incremental.
7634         * layout.cc (Layout::Layout): Check parameters for incremental link
7635         mode.
7636         * options.cc (General_options::parse_incremental): New function.
7637         (General_options::parse_no_incremental): New function.
7638         (General_options::parse_incremental_full): New function.
7639         (General_options::parse_incremental_update): New function.
7640         (General_options::incremental_mode_): New data member.
7641         (General_options::finalize): Check incremental_mode_.
7642         * options.h (General_options): Update help text for --incremental.
7643         Add --no-incremental, --incremental-full, --incremental-update.
7644         (General_options::Incremental_mode): New enum type.
7645         (General_options::incremental_mode): New function.
7646         (General_options::incremental_mode_): New data member.
7647         * parameters.cc (Parameters::incremental_mode_): New data member.
7648         (Parameters::set_options): Set incremental_mode_.
7649         (Parameters::set_incremental_full): New function.
7650         (Parameters::incremental): New function.
7651         (Parameters::incremental_update): New function.
7652         (set_parameters_incremental_full): New function.
7653         * parameters.h (Parameters::set_incremental_full): New function.
7654         (Parameters::incremental): New function.
7655         (Parameters::incremental_update): New function.
7656         (Parameters::incremental_mode_): New data member.
7657         (set_parameters_incremental_full): New function.
7658         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
7659         incremental link mode.
7660         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
7661         (Sized_relobj::do_relocate_sections): Likewise.
7662         * testsuite/Makefile.am (incremental_test): Use --incremental-full
7663         option.
7664         * testsuite/Makefile.in: Regenerate.
7665         * testsuite/incremental_test.sh: Filter all forms of --incremental.
7666
7667 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7668
7669         * script-sections.h (class Script_sections): Make
7670         Sections_elements typedef public.
7671         * script-sections.cc (class Sort_output_sections): Add elements_
7672         field.  Add constructor which sets it; change all callers.
7673         (Sort_output_sections::is_before): New function.
7674         (Sort_output_sections::operator()): Call is_before.
7675         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
7676         conditional.
7677         * testsuite/script_test_10.sh: New test. Test script section
7678         order.
7679         * testsuite/script_test_10.t: Likewise.
7680         * testsuite/script_test_10.s: Likewise.
7681         * testsuite/Makefile.am: Wrap the cross linker tests and the
7682         common tests into NATIVE_OR_CROSS_LINKER.
7683         (check_SCRIPTS): Add script_test_10.sh.
7684         (check_DATA): Add script_test_10.stdout.
7685         (script_test_10.o, script_test_10): New targets.
7686         (script_test_10.stdout): New target.
7687         * configure, testsuite/Makefile.in: Regenerate.
7688
7689 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7690
7691         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
7692         error for the deprecated relocations.
7693         (Target_arm::Scan::global): Likewise.
7694         (Target_arm::Relocate::relocate): Likewise.
7695
7696 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
7697
7698         * fileread.cc (Input_file::find_file): Initialize *found_name
7699         and *namep when using the fallback search for case 4.
7700
7701 2010-10-11  Cary Coutant  <ccoutant@google.com>
7702
7703         * options.h (class General_options): Redefine -z lazy as an alias for
7704         the negation of -z now.
7705
7706 2010-10-11  Ian Lance Taylor  <iant@google.com>
7707
7708         * resolve.cc (symbol_to_bits): Report the value of the unsupported
7709         binding.
7710
7711 2010-10-06  Nick Clifton  <nickc@redhat.com>
7712
7713         * script-sections.cc(class Memory_region): Remove
7714         current_lma_offset_ field.  Rename current_vma_offset_ to
7715         current_offset_.  Add last_section_ field.
7716         (Memory_region::get_current_vma_address): Rename to
7717         get_current_address.
7718         (Memory_region::get_current_lma_address): Delete.
7719         (Memory_region::increment_vma_offset): Rename to
7720         increment_offset.
7721         (Memory_region::increment_lma_offset): Delete.
7722         (Memory_region::attributes_compatible): New method.  Returns
7723         true if the provided section is compatible with the region.
7724         (Memory_region::get_last_section): New method.  Returns the last
7725         section to use the region.
7726         (Memory_region::set_last_section): New method.  Stores the last
7727         section to use the region.
7728         (Script_sections::block_in_region): New method.  Returns true if
7729         a block of memory is contained within a region.
7730         (Script_sections::find_memory_region): New method.  Locates a
7731         memory region to be used to set a VMA or LMA address.
7732         (Output_section_definition::set_section_addresses): Add code to
7733         check for addresses set by memory regions.
7734         (Output_segment::set_section_addresses): Remove memory region
7735         walking code.
7736         (Script_sections::create_segment): Add a warning if a header
7737         segment is created outside of any region.
7738         * script-sections.h (class Script_sections): Add prototypes for
7739         find_memory_region and block_in_region methods.
7740         * testsuite/memory_test.s: Use .long instead of .word.
7741         * testsuite/memory_test.t: Add some more output sections.
7742         * testsuite/memory_test.sh: Update expected output.
7743
7744 2010-10-02  Doug Kwan  <dougkwan@google.com>
7745
7746         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
7747         defintion to symtab.h
7748         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
7749         declaration to defintion.
7750
7751 2010-10-01  Nick Clifton  <nickc@redhat.com>
7752
7753         * expression.cc (eval): Replace dummy argument with NULL.
7754         (eval_maybe_dot): Check for a NULL result section pointer.
7755         (Symbol_expression::value): Likewise.
7756         (Dot_expression::value): Likewise.
7757         (BINARY_EXPRESSION): Likewise.
7758         (Max_expression::value): Likewise.
7759         (Min_expression::value): Likewise.
7760         (Absolute_expression::value): Likewise.
7761         (Addr_expression::value_from_output_section): Likewise.
7762         (Loaddddr_expression::value_from_output_section): Likewise.
7763         (Segment_start_expression::value): Likewise.
7764         * script-sections.cc
7765         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
7766         argument with NULL.
7767         (Sections_elememt_dot_assignment::set_section_addresses):
7768         Likewise.
7769         (Output_data_expression::do_write_to_buffer): Likewise.
7770         (Output_section_definition::finalize_symbols): Likewise.
7771         (Output_section_definition::set_section_addresses): Likewise.
7772
7773 2010-09-30  Doug Kwan  <dougkwan@google.com>
7774
7775         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
7776
7777 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
7778
7779         * target.h (Target::can_icf_inline_merge_sections): New virtual
7780         function.
7781         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7782         virtual function.
7783         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
7784         virtual function.
7785         * icf.cc (get_section_contents): Inline merge sections only when
7786         target allows it.
7787
7788 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7789
7790         * configure: Regenerate.
7791
7792 2010-09-17  Ian Lance Taylor  <iant@google.com>
7793
7794         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7795         * testsuite/Makefile.am (memory_test.o): New target.
7796         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7797         memory_test.t.
7798         * testsuite/Makefile.in: Rebuild.
7799
7800 2010-09-17  Doug Kwan  <dougkwan@google.com>
7801
7802         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7803         defintion if relocation uses GOT entries of the symbol.
7804         * testsuite/icf_safe_test.sh: Fix test.
7805         * testsuite/icf_safe_so_test.sh: Fix test.
7806
7807 2010-09-16  Cary Coutant  <ccoutant@google.com>
7808
7809         * script_sections.cc (class Memory_region): Remove "NULL" from
7810         vector initializations.
7811
7812 2010-09-15  Cary Coutant  <ccoutant@google.com>
7813
7814         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7815         Resolve forwarding symbols.
7816
7817 2010-09-15  Doug Kwan  <dougkwan@google.com>
7818
7819         * gold/testsuite/script_test_3.t: Add ARM special sections.
7820         * gold/testsuite/script_test_4.t: Same.
7821         * gold/testsuite/script_test_5.t: Same.
7822         * gold/testsuite/script_test_6.t: Same.
7823         * gold/testsuite/script_test_7.t: Same.
7824         * gold/testsuite/script_test_7.t: Same.
7825         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7826
7827 2010-09-14  Cary Coutant  <ccoutant@google.com>
7828
7829         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7830         (Target_x86_64::Relocate::relocate_tls): Replace check for
7831         saw_tls_block_reloc_ with test for executable section.
7832
7833 2010-09-12  Cary Coutant  <ccoutant@google.com>
7834
7835         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7836         position-independent executables to shared libraries need dynamic
7837         relocations.
7838         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
7839         position-independent executables.
7840         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
7841         * testsuite/Makefile.in: Regenerate.
7842
7843 2010-09-10  Nick Clifton  <nickc@redhat.com>
7844
7845         PR gold/11997
7846         * testsuite/memory_test.t: Discard any sections that are not
7847         needed.
7848
7849 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
7850
7851         PR gold/11996
7852         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
7853         "This::" to work around a bug in gcc 4.2.
7854
7855         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
7856
7857 2010-09-09  Rafael Espindola  <espindola@google.com>
7858
7859         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
7860         sections with different PF_X flags in the same segment.
7861         (Layout::find_first_load_seg): Search all segments to find the first
7862         one.
7863         * options.h (rosegment): New.
7864
7865 2010-09-08  Rafael Espindola  <espindola@google.com>
7866
7867         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
7868
7869 2010-09-08  Doug Kwan  <dougkwan@google.com>
7870
7871         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
7872         (Arm_relobj::do_relocate_sections): Add new parameter for output
7873         file to match the parent.
7874         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
7875         of local symbols instead of input values.  Update code to track
7876         changes in gold::relocate_section.
7877         * object.cc (Sized_relobj::compute_final_local_value): New methods.
7878         (Sized_relobj::compute_final_local_value_internal): New methods.
7879         (Sized_relobj::do_finalize_local_symbols): Move code from loop
7880         body into private version of Sized_relobj::compute_final_local_value.
7881         Call the inline method.
7882         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
7883         merged symbol value if there is one.
7884         (Symbol_value::has_output_value): New method defintiion.
7885         (Sized_relobj::Compute_final_local_value_status): New enum type.
7886         (Sized_relobj::compute_final_local_value): New methods.
7887         (Sized_relobj::compute_final_local_value_internal): New methods.
7888         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
7889         and arm_cortex_a8.sh.
7890         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
7891         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
7892         New tests.
7893         * Makefile.in: Regenerate.
7894         * testsuite/arm_bl_out_of_range.s: Update test.
7895         * testsuite/thumb_bl_out_of_range.s: Ditto.
7896         * testsuite/thumb_blx_out_of_range.s: Ditto.
7897         * testsuite/arm_branch_out_of_range.sh: New file.
7898         * testsuite/arm_cortex_a8.sh: Ditto.
7899         * testsuite/arm_cortex_a8_b.s: Ditto.
7900         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
7901         * testsuite/arm_cortex_a8_b_local.s: Ditto.
7902         * testsuite/arm_cortex_a8_bl.s: Ditto.
7903         * testsuite/arm_cortex_a8_blx.s: Ditto.
7904         * testsuite/arm_cortex_a8_local.s: Ditto.
7905         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
7906         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
7907
7908 2010-09-08  Rafael Espindola  <espindola@google.com>
7909
7910         * Makefile.am (memory_test.stdout): Run readelf with -W.
7911         * Makefile.in: Regenerate.
7912         * testsuite/memory_test.sh: Make the regexps accept both 32 and
7913         64 bit output.
7914
7915 2010-09-08  Rafael Espindola  <espindola@google.com>
7916
7917         * script-sections.cc (Script_sections::add_memory_region): Convert
7918         field precision to int.
7919         * script.cc (script_set_section_region, script_set_section_region):
7920         Convert field precision to int.
7921
7922 2010-09-08  Rafael Espindola  <espindola@google.com>
7923
7924         * arm.cc (do_finalize_sections): Create the __exidx_start and
7925         __exdix_end symbols even when the section is missing.
7926
7927 2010-09-08  Nick Clifton  <nickc@redhat.com>
7928
7929         * README: Remove claim that MEMORY is not supported.
7930         * expression.cc (script_exp_function_origin)
7931         (script_exp_function_length): Move from here to ...
7932         * script.cc: ... here.
7933         (script_set_section_region, script_add_memory)
7934         (script_parse_memory_attr, script_include_directive): New
7935         functions.
7936         * script-sections.cc
7937         (class Memory_region): New class.
7938         (class Output_section_definition): Add set_memory_region,
7939         set_section_vma, set_section_lma and get_section_name methods.
7940         (class Script_Sections): Add add_memory_region,
7941         find_memory_region, find_memory_region_origin,
7942         find_memory_region_length and set_memory_region methods.
7943         Have set_section_addresses method walk the list of set memory
7944         regions.
7945         Extend the print methos to display memory regions.
7946         * script-sections.h: Add prototypes for new methods.
7947         Add enum for MEMORY region attributes.
7948         * yyscript.y: Add support for parsing MEMORY regions.
7949         * script-c.h: Add prototypes for new functions.
7950         * testsuite/Makefile.am: Add test of MEMORY region functionality.
7951         * testsuite/Makefile.in: Regenerate.
7952         * testsuite/memory_test.sh: New script.
7953         * testsuite/memory_test.s: New assembler source file.
7954         * testsuite/memory_test.t: New linker script.
7955
7956 2010-08-27  Doug Kwan  <dougkwan@google.com>
7957
7958         * gold/resolve.cc (Symbol_table::should_override): Let a weak
7959         reference override an existing dynamic weak reference.
7960         * testsuite/Makefile.am: Add new test dyn_weak_ref.
7961         * testsuite/Makefile.in: Regenerate.
7962         * testsuite/dyn_weak_ref.sh: New file.
7963         * testsuite/dyn_weak_ref_1.c: Ditto.
7964         * testsuite/dyn_weak_ref_2.c: Ditto.
7965
7966 2010-08-27  Ian Lance Taylor  <iant@google.com>
7967
7968         * incremental.h (class Incremental_input_entry): Add virtual
7969         destructor.
7970
7971 2010-08-27  Ian Lance Taylor  <iant@google.com>
7972
7973         * testsuite/start_lib_test_3.c: Mark t3 as used.
7974
7975 2010-08-27  Nick Clifton  <nickc@redhat.com>
7976
7977         * options.cc (version_script): Fix small typo in previous
7978         whitespace tidyup.
7979
7980 2010-08-25  Nick Clifton  <nickc@redhat.com>
7981
7982         * archive.cc: Formatting fixes: Remove whitespace between
7983         typename and following asterisk.  Remove whitespace between
7984         function name and opening parenthesis.
7985         * archive.h: Likewise.
7986         * arm.cc: Likewise.
7987         * attributes.cc: Likewise.
7988         * attributes.h: Likewise.
7989         * common.cc: Likewise.
7990         * copy-relocs.cc: Likewise.
7991         * dirsearch.h: Likewise.
7992         * dynobj.cc: Likewise.
7993         * ehframe.cc: Likewise.
7994         * ehframe.h: Likewise.
7995         * expression.cc: Likewise.
7996         * fileread.cc: Likewise.
7997         * fileread.h: Likewise.
7998         * gc.h: Likewise.
7999         * gold-threads.cc: Likewise.
8000         * gold.cc: Likewise.
8001         * i386.cc: Likewise.
8002         * icf.h: Likewise.
8003         * incremental-dump.cc: Likewise.
8004         * incremental.cc: Likewise.
8005         * layout.cc: Likewise.
8006         * layout.h: Likewise.
8007         * main.cc: Likewise.
8008         * merge.cc: Likewise.
8009         * merge.h: Likewise.
8010         * object.cc: Likewise.
8011         * object.h: Likewise.
8012         * options.cc: Likewise.
8013         * options.h: Likewise.
8014         * output.cc: Likewise.
8015         * output.h: Likewise.
8016         * plugin.cc: Likewise.
8017         * plugin.h: Likewise.
8018         * powerpc.cc: Likewise.
8019         * reloc.cc: Likewise.
8020         * script-c.h: Likewise.
8021         * script-sections.cc: Likewise.
8022         * script.cc: Likewise.
8023         * stringpool.cc: Likewise.
8024         * symtab.cc: Likewise.
8025         * symtab.h: Likewise.
8026         * target.cc: Likewise.
8027         * timer.cc: Likewise.
8028         * timer.h: Likewise.
8029         * version.cc: Likewise.
8030         * x86_64.cc: Likewise.
8031
8032 2010-08-24  Nick Clifton  <nickc@redhat.com>
8033
8034         PR 11899
8035         * layout.cc (segment_precedes): Sort segments by their physical
8036         addresses, if they have been set.
8037
8038 2010-08-23  Cary Coutant  <ccoutant@google.com>
8039
8040         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
8041         symbols data.
8042         (Lib_group::include_member): Unlock object after deleting its
8043         symbols data.
8044         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
8045         the bug fixed here.
8046
8047 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
8048             Cary Coutant  <ccoutant@google.com>
8049
8050         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
8051         constructor, and set_blocker.
8052         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
8053         readsyms_blocker_.
8054         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
8055         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
8056         * testsuite/Makefile.am (start_lib_test): New test case.
8057         * testsuite/Makefile.in: Regenerate.
8058         * testsuite/start_lib_test_main.c: New file.
8059         * testsuite/start_lib_test_1.c: New file.
8060         * testsuite/start_lib_test_2.c: New file.
8061         * testsuite/start_lib_test_3.c: New file.
8062
8063 2010-08-19  Ian Lance Taylor  <iant@google.com>
8064
8065         * Makefile.in: Rebuild with automake 1.11.1.
8066         * aclocal.m4: Likewise.
8067         * testsuite/Makefile.in: Likewise.
8068
8069 2010-08-19  Ian Lance Taylor  <iant@google.com>
8070
8071         PR 10893
8072         * i386.cc (class Output_data_plt_i386): Update declarations.
8073         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
8074         local_ifuncs_ fields.
8075         (Target_i386::do_plt_section_for_global): New function.
8076         (Target_i386::do_plt_section_for_local): New function.
8077         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
8078         parameter; change all callers.  Initialize global_ifuncs_ and
8079         local_ifuncs_.  If doing a static link define __rel_iplt_start and
8080         __rel_iplt_end.
8081         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
8082         (Output_data_plt_i386::add_local_ifunc_entry): New function.
8083         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
8084         symbols.
8085         (Target_i386::make_plt_section): New function, broken out of
8086         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
8087         (Target_i386::make_plt_entry): Call make_plt_section.
8088         (Target_i386::make_local_ifunc_plt_entry): New function.
8089         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
8090         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
8091         R_386_IRELATIVE to switch.
8092         (Target_i386::Scan::global): Likewise.
8093         (Target_i386::Relocate::relocate): Likewise.
8094         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
8095         switch.
8096         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
8097         (Target_x86_64::do_plt_section_for_global): New function.
8098         (Target_x86_64::do_plt_section_for_local): New function.
8099         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
8100         parameter; change all callers.  If doing a static link define
8101         __rela_iplt_start and __rela_iplt_end.
8102         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
8103         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
8104         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
8105         to point to .plt.
8106         (Target_x86_64::make_local_ifunc_plt_entry): New function.
8107         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
8108         switch.
8109         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
8110         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
8111         R_X86_64_IRELATIVE to switch.
8112         (Target_x86_64::Scan::global): Likewise.
8113         (Target_x86_64::Relocate::relocate): Likewise.
8114         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
8115         switch.
8116         * target.h (class Target): Add plt_section_for_global and
8117         plt_section_for_local functions.  Add do_plt_section_for_global
8118         and do_plt_section_for_local virtual functions.
8119         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
8120         clarifying comments.
8121         (Symbol::use_plt_offset): Handle IFUNC symbol.
8122         * object.cc (Sized_relobj::Sized_relobj): Initialize
8123         local_plt_offsets_.
8124         (Sized_relobj::local_has_plt_offset): New function.
8125         (Sized_relobj::local_plt_offset): New function.
8126         (Sized_relobj::set_local_plt_offset): New function.
8127         (Sized_relobj::do_count): Handle IFUNC symbol.
8128         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
8129         a bit away from input_shndx_ field.  Add set_is_func_symbol and
8130         is_ifunc_symbol functions.
8131         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
8132         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
8133         local_plt_offsets_ field.
8134         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
8135         * output.h (class Output_section_data): Add non-const
8136         output_section function.
8137         (class Output_data_got): Update declarations.
8138         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
8139         Add use_plt_offset parameter to global and local constructors.
8140         Change all callers.  Change local_sym_index_ field to 31 bits.
8141         Change GSYM_CODE and CONSTANT_CODE accordingly.
8142         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
8143         doing a static link don't set sh_link field.
8144         (Output_data_got::Got_entry::write): Use PLT offset if
8145         appropriate.
8146         (Output_data_got::add_global_plt): New function.
8147         (Output_data_got::add_local_plt): New function.
8148         * target-reloc.h (relocate_section): Handle IFUNC symbol.
8149         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
8150         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
8151         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
8152         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
8153         IFUNC conditional.
8154         * testsuite/ifunc-sel.h: New file.
8155         * testsuite/ifuncmain1.c: New file.
8156         * testsuite/ifuncmain1vis.c: New file.
8157         * testsuite/ifuncmod1.c: New file.
8158         * testsuite/ifuncdep2.c: New file.
8159         * testsuite/ifuncmain2.c: New file.
8160         * testsuite/ifuncmain3.c: New file.
8161         * testsuite/ifuncmod3.c: New file.
8162         * testsuite/ifuncmain4.c: New file.
8163         * testsuite/ifuncmain5.c: New file.
8164         * testsuite/ifuncmod5.c: New file.
8165         * testsuite/ifuncmain6pie.c: New file.
8166         * testsuite/ifuncmod6.c: New file.
8167         * testsuite/ifuncmain7.c: New file.
8168         * configure, testsuite/Makefile.in: Rebuild.
8169
8170 2010-08-18  Ian Lance Taylor  <iant@google.com>
8171
8172         * incremental.cc
8173         (Output_section_incremental_inputs::write_input_files): Add cast
8174         to avoid signed/unsigned comparison warning.
8175         (Output_section_incremental_inputs::write_info_blocks): Likewise.
8176
8177 2010-08-12  Cary Coutant  <ccoutant@google.com>
8178
8179         * common.cc (Sort_commons::operator()): Remove unnecessary code.
8180
8181 2010-08-13  Ian Lance Taylor  <iant@google.com>
8182
8183         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
8184
8185 2010-08-12  Cary Coutant  <ccoutant@google.com>
8186             Doug Kwan  <dougkwan@google.com>
8187
8188         * resolve.cc (Symbol_table::should_override): When a weak dynamic
8189         defintion overrides non-weak undef, remember that the original undef
8190         is not weak.
8191         * symtab.cc (Symbol_table::sized_write_global): For undef without
8192         an original weak binding, set binding to global in output.
8193         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
8194         * testsuite/Makefile.in: Regenerate.
8195         * testsuite/strong_ref_weak_def.sh: New file.
8196         * testsuite/strong_ref_weak_def_1.c: Ditto.
8197         * testsuite/strong_ref_weak_def_2.c: Ditto.
8198
8199 2010-08-12  Cary Coutant  <ccoutant@google.com>
8200
8201         * testsuite/incremental_test.sh: Rewrite.
8202         * testsuite/incremental_test_1.c: Rewrite.
8203         * testsuite/incremental_test_2.c: Rewrite.
8204
8205 2010-08-12  Cary Coutant  <ccoutant@google.com>
8206
8207         * arm.cc (Target_arm::got_size): Add const.
8208         (Target_arm::got_entry_count): New function.
8209         (Target_arm::plt_entry_count): New function.
8210         (Target_arm::first_plt_entry_offset): New function.
8211         (Target_arm::plt_entry_size): New function.
8212         (Output_data_plt_arm::entry_count): New function.
8213         (Output_data_plt_arm::first_plt_entry_offset): New function.
8214         (Output_data_plt_arm::get_plt_entry_size): New function.
8215         * i386.cc (Target_i386::got_size): Add const.
8216         (Target_i386::got_entry_count): New function.
8217         (Target_i386::plt_entry_count): New function.
8218         (Target_i386::first_plt_entry_offset): New function.
8219         (Target_i386::plt_entry_size): New function.
8220         (Output_data_plt_i386::entry_count): New function.
8221         (Output_data_plt_i386::first_plt_entry_offset): New function.
8222         (Output_data_plt_i386::get_plt_entry_size): New function.
8223         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
8224         find_incremental_inputs_sections.  Dump incremental_got_plt section.
8225         * incremental.cc: Include target.h.
8226         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
8227         parameter.  Adjust all callers.  Find incremental_got_plt section.
8228         (Incremental_inputs::create_data_sections): Create incremental_got_plt
8229         section.
8230         (Output_section_incremental_inputs::set_final_data_size): Calculate
8231         size of incremental_got_plt section.
8232         (Output_section_incremental_inputs::do_write): Write the
8233         incremental_got_plt section.
8234         (Got_plt_view_info): New struct.
8235         (Local_got_offset_visitor): New class.
8236         (Global_got_offset_visitor): New class.
8237         (Global_symbol_visitor_got_plt): New class.
8238         (Output_section_incremental_inputs::write_got_plt): New function.
8239         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
8240         Add parameter.  Adjust all callers.
8241         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8242         (Incremental_inputs::got_plt_section): New function.
8243         (Incremental_inputs::got_plt_section_): New data member.
8244         (Incremental_got_plt_reader): New class.
8245         * layout.cc (Layout::create_incremental_info_sections): Add the
8246         incremental_got_plt section.
8247         * object.h (Got_offset_list::get_list): New function.
8248         (Got offset_list::for_all_got_offsets): New function.
8249         (Sized_relobj::local_got_offset_list): New function.
8250         * powerpc.cc (Target_powerpc::got_size): Add const.
8251         (Target_powerpc::got_entry_count): New function.
8252         (Target_powerpc::plt_entry_count): New function.
8253         (Target_powerpc::first_plt_entry_offset): New function.
8254         (Target_powerpc::plt_entry_size): New function.
8255         (Output_data_plt_powerpc::entry_count): New function.
8256         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
8257         (Output_data_plt_powerpc::get_plt_entry_size): New function.
8258         * sparc.cc (Target_sparc::got_size): Add const.
8259         (Target_sparc::got_entry_count): New function.
8260         (Target_sparc::plt_entry_count): New function.
8261         (Target_sparc::first_plt_entry_offset): New function.
8262         (Target_sparc::plt_entry_size): New function.
8263         (Output_data_plt_sparc::entry_count): New function.
8264         (Output_data_plt_sparc::first_plt_entry_offset): New function.
8265         (Output_data_plt_sparc::get_plt_entry_size): New function.
8266         * symtab.h (Symbol::got_offset_list): New function.
8267         (Symbol_table::for_all_symbols): New function.
8268         * target.h (Sized_target::got_entry_count): New function.
8269         (Sized_target::plt_entry_count): New function.
8270         (Sized_target::plt_entry_size): New function.
8271         * x86_64.cc (Target_x86_64::got_size): Add const.
8272         (Target_x86_64::got_entry_count): New function.
8273         (Target_x86_64::plt_entry_count): New function.
8274         (Target_x86_64::first_plt_entry_offset): New function.
8275         (Target_x86_64::plt_entry_size): New function.
8276         (Output_data_plt_x86_64::entry_count): New function.
8277         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
8278         (Output_data_plt_x86_64::get_plt_entry_size): New function.
8279
8280 2010-08-12  Cary Coutant  <ccoutant@google.com>
8281
8282         * archive.cc: Include incremental.h.
8283         (Archive::Archive): Initialize incremental_info_.
8284         (Archive::include_member): Record archive members in incremental info.
8285         (Add_archive_symbols::run): Record begin and end of an archive in
8286         incremental info.
8287         (Lib_group::include_member): Record objects in incremental info.
8288         * archive.h (Incremental_archive_entry): Forward declaration.
8289         (Archive::set_incremental_info): New member function.
8290         (Archive::incremental_info): New member function.
8291         (Archive::Unused_symbol_iterator): New class.
8292         (Archive::unused_symbols_begin): New member function.
8293         (Archive::unused_symbols_end): New member function.
8294         (Archive::incremental_info_): New data member.
8295         * incremental-dump.cc (find_input_containing_global): New function.
8296         (dump_incremental_inputs): Dump new incremental info sections.
8297         * incremental.cc: Include symtab.h.
8298         (Output_section_incremental_inputs): New class.
8299         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
8300         new incremental info sections.
8301         (Sized_incremental_binary::do_check_inputs): Likewise.
8302         (Incremental_inputs::report_archive): Remove.
8303         (Incremental_inputs::report_archive_begin): New function.
8304         (Incremental_inputs::report_archive_end): New function.
8305         (Incremental_inputs::report_object): New function.
8306         (Incremental_inputs::finalize_inputs): Remove.
8307         (Incremental_inputs::report_input_section): New function.
8308         (Incremental_inputs::report_script): Rewrite.
8309         (Incremental_inputs::finalize): Do nothing but finalize string table.
8310         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8311         (Incremental_inputs::sized_create_inputs_section_data): Remove.
8312         (Incremental_inputs::create_data_sections): New function.
8313         (Incremental_inputs::relocs_entsize): New function.
8314         (Output_section_incremental_inputs::set_final_data_size): New function.
8315         (Output_section_incremental_inputs::do_write): New function.
8316         (Output_section_incremental_inputs::write_header): New function.
8317         (Output_section_incremental_inputs::write_input_files): New function.
8318         (Output_section_incremental_inputs::write_info_blocks): New function.
8319         (Output_section_incremental_inputs::write_symtab): New function.
8320         * incremental.h (Incremental_script_entry): Forward declaration.
8321         (Incremental_object_entry): Forward declaration.
8322         (Incremental_archive_entry): Forward declaration.
8323         (Incremental_inputs): Forward declaration.
8324         (Incremental_inputs_header_data): Remove.
8325         (Incremental_inputs_header): Remove.
8326         (Incremental_inputs_header_write): Remove.
8327         (Incremental_inputs_entry_data): Remove.
8328         (Incremental_inputs_entry): Remove.
8329         (Incremental_inputs_entry_write): Remove.
8330         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
8331         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
8332         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8333         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
8334         Likewise.
8335         (Incremental_input_entry): New class.
8336         (Incremental_script_entry): New class.
8337         (Incremental_object_entry): New class.
8338         (Incremental_archive_entry): New class.
8339         (Incremental_inputs::Incremental_inputs): Initialize new data members.
8340         (Incremental_inputs::report_inputs): Remove.
8341         (Incremental_inputs::report_archive): Remove.
8342         (Incremental_inputs::report_archive_begin): New function.
8343         (Incremental_inputs::report_archive_end): New function.
8344         (Incremental_inputs::report_object): Change prototype.
8345         (Incremental_inputs::report_input_section): New function.
8346         (Incremental_inputs::report_script): Change prototype.
8347         (Incremental_inputs::get_reloc_count): New function.
8348         (Incremental_inputs::set_reloc_count): New function.
8349         (Incremental_inputs::create_data_sections): New function.
8350         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8351         (Incremental_inputs::inputs_section): New function.
8352         (Incremental_inputs::symtab_section): New function.
8353         (Incremental_inputs::relocs_section): New function.
8354         (Incremental_inputs::get_stringpool): Add const.
8355         (Incremental_inputs::command_line): Add const.
8356         (Incremental_inputs::inputs): Remove.
8357         (Incremental_inputs::command_line_key): New function.
8358         (Incremental_inputs::input_file_count): New function.
8359         (Incremental_inputs::input_files): New function.
8360         (Incremental_inputs::relocs_entsize): New function.
8361         (Incremental_inputs::sized_create_inputs_section_data): Remove.
8362         (Incremental_inputs::finalize_inputs): Remove.
8363         (Incremental_inputs::Input_info): Remove.
8364         (Incremental_inputs::lock_): Remove.
8365         (Incremental_inputs::inputs_): Change type.
8366         (Incremental_inputs::inputs_map_): Remove.
8367         (Incremental_inputs::current_object_entry_): New data member.
8368         (Incremental_inputs::inputs_section_): New data member.
8369         (Incremental_inputs::symtab_section_): New data member.
8370         (Incremental_inputs::relocs_section_): New data member.
8371         (Incremental_inputs::reloc_count_): New data member.
8372         (Incremental_inputs_reader): New class.
8373         (Incremental_symtab_reader): New class.
8374         (Incremental_relocs_reader): New class.
8375         * layout.cc (Layout::finalize): Move finalization of incremental info
8376         and creation of incremental info sections to follow finalization of
8377         symbol table.  Set offsets for postprocessing sections.
8378         (Layout::create_incremental_info_sections): Call
8379         Incremental_inputs::create_data_sections.  Add incremental symtab
8380         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
8381         sections to layout after input sections.
8382         * layout.h (struct Timespec): Forward declaration.
8383         (Layout::incremental_inputs): Add const.
8384         (Layout::create_incremental_info_sections): Add parameter.
8385         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
8386         * object.cc: Include incremental.h.
8387         (Relobj::finalize_incremental_relocs): New function.
8388         (Sized_relobj::do_layout): Record input sections in incremental info.
8389         * object.h (Object::output_section): New function.
8390         (Object::output_section_offset): Moved from Relobj.
8391         (Object::get_incremental_reloc_base): New function.
8392         (Object::get_incremental_reloc_count): New function.
8393         (Object::do_output_section): New function.
8394         (Object::do_output_section_offset): Moved from Relobj.
8395         (Object::do_get_incremental_reloc_base): New function.
8396         (Object::do_get_incremental_reloc_count): New function.
8397         (Object::Object): Initialize new data members.
8398         (Relobj::output_section): Renamed do_output_section and moved to
8399         protected.
8400         (Relobj::output_section_offset): Moved to Object.
8401         (Relobj::do_get_incremental_reloc_base): New function.
8402         (Relobj::do_get_incremental_reloc_count): New function.
8403         (Relobj::allocate_incremental_reloc_counts): New function.
8404         (Relobj::count_incremental_reloc): New function.
8405         (Relobj::finalize_incremental_relocs): New function.
8406         (Relobj::next_incremental_reloc_index): New function.
8407         (Relobj::reloc_counts_): New data member.
8408         (Relobj::reloc_bases_): New data member.
8409         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
8410         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
8411         (Sized_relobj::incremental_relocs_scan): New function.
8412         (Sized_relobj::incremental_relocs_scan_reltype): New function.
8413         (Sized_relobj::incremental_relocs_write): New function.
8414         (Sized_relobj::incremental_relocs_write_reltype): New function.
8415         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
8416         incremental link.
8417         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
8418         archives and object files elsewhere.
8419         (Add_symbols::run): Report object files here.
8420         (Finish_group::run): Report end of archive at end of group.
8421         * reloc.cc: Include layout.h, incremental.h.
8422         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
8423         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
8424         (Sized_relobj::incremental_relocs_scan): New function.
8425         (Sized_relobj::incremental_relocs_scan_reltype): New function.
8426         (Sized_relobj::do_relocate_sections): Write incremental relocations.
8427         (Sized_relobj::incremental_relocs_write): New function.
8428         (Sized_relobj::incremental_relocs_write_reltype): New function.
8429         * script.cc (read_input_script): Rewrite test for incremental link.
8430         Change call to Incremental_inputs::report_script.
8431         * symtab.h (Symbol_table::first_global_index): New function.
8432         (Symbol_table::output_count): New function.
8433
8434 2010-08-12  Doug Kwan  <dougkwan@google.com>
8435
8436         * arm.cc (Target_arm::merge_object_attributes): Check command line
8437         options --no-wchar-size-warning and --no-enum-size-warning.
8438         * options.h (General_options): Add ld-compatible options
8439         --no-enum-size-warning and --no-wchar-size-warning.
8440
8441 2010-08-04  Ian Lance Taylor  <iant@google.com>
8442
8443         * x86_64.cc (Target_x86_64::Scan::local): Use
8444         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
8445         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
8446         (Target_x86_64::Scan::global): Likewise.
8447         (Target_x86_64::Relocate::relocate): Likewise.
8448         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
8449         Likewise.
8450
8451 2010-08-03  Cary Coutant  <ccoutant@google.com>
8452
8453         * merge.cc (Output_merge_string::do_add_input_section): Count strings
8454         to reserve space in merged_strings vector. Keep total input size
8455         for stats.
8456         (Output_merge_string::do_print_merge_stats): Print total input size.
8457         * merge.h (Output_merge_string): Add input_size_ field.
8458         * stringpool.cc (Stringpool_template::string_length): Move
8459         implementations out of Stringpool_template class and place in
8460         stringpool.h.
8461         * stringpool.h (string_length): Move out of Stringpool_template.
8462
8463 2010-08-03  Ian Lance Taylor  <iant@google.com>
8464
8465         PR 11712
8466         * layout.cc (relaxation_loop_body): If address of load segment is
8467         set, adjust address to include headers if possible.
8468
8469 2010-08-03  Ian Lance Taylor  <iant@google.com>
8470
8471         * version.cc (version_string): Bump to 1.10.
8472
8473 2010-08-03  Ian Lance Taylor  <iant@google.com>
8474
8475         PR 11805
8476         * layout.h (enum Output_section_order): Define.
8477         (class Layout): Update declarations.
8478         * layout.cc (Layout::get_output_section): Add order parameter.
8479         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
8480         is_first_non_relro parameters.  Change all callers.
8481         (Layout::choose_output_section): Likewise.
8482         (Layout::add_output_section_data): Likewise.
8483         (Layout::make_output_section): Likewise.  Set order.
8484         (Layout::default_section_order): New function.
8485         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
8486         * output.cc (Output_section::Output_section): Initialize order_.
8487         Don't initialize deleted fields.
8488         (Output_segment::Output_segment): Don't initialize deleted
8489         fields.
8490         (Output_segment::add_output_section_to_load): New function
8491         replacing add_output_section.  Change all callers to call this or
8492         add_output_section_to_nonload.
8493         (Output_segment::add_output_section_to_nonload): New function.
8494         (Output_segment::remove_output_section): Rewrite.
8495         (Output_segment::add_initial_output_data): Likewise.
8496         (Output_segment::has_any_data_sections): Likewise.
8497         (Output_segment::is_first_section_relro): Likewise.
8498         (Output_segment::maximum_alignment): Likewise.
8499         (Output_segment::has_dynamic_reloc): New function replacing
8500         dynamic_reloc_count.  Change all callers.
8501         (Output_segment::has_dynamic_reloc_list): New function replacing
8502         dynamic_reloc_count_list.  Change all callers.
8503         (Output_segment::set_section_addresses): Rewrite.
8504         (Output_segment::set_offset): Rewrite.
8505         (Output_segment::find_first_and_last_list): Remove.
8506         (Output_segment::set_tls_offsets): Rewrite.
8507         (Output_segment::first_section_load_address): Likewise.
8508         (Output_segment::output_section_count): Likewise.
8509         (Output_segment::section_with_lowest_load_address): Likewise.
8510         (Output_segment::write_section_headers): Likewise.
8511         (Output_segment::print_sections_to_map): Likewise.
8512         * output.h (class Output_data): Remove dynamic_reloc_count_
8513         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
8514         (Output_data::add_dynamic_reloc): Rewrite.
8515         (Output_data::has_dynamic_reloc): New function.
8516         (Output_data::dynamic_reloc_count): Remove.
8517         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
8518         is_last_relro_, is_first_non_relro_, is_interp_,
8519         is_dynamic_linker_section_ fields.  Add order and set_order
8520         functions.  Remove is_relro_local, set_is_relro_local,
8521         is_last_relro, set_is_last_relro, is_first_non_relro,
8522         set_is_first_non_relro functions, is_interp, set_is_interp,
8523         is_dynamic_linker_section, and set_is_dynamic_linker_section
8524         functions.
8525         (class Output_segment): Change Output_data_list from std::list to
8526         std:;vector.  Add output_lists_ field.  Remove output_data_ and
8527         output_bss_ fields.  Update declarations.
8528
8529 2010-08-02  Ian Lance Taylor  <iant@google.com>
8530
8531         * arm.cc (Target_arm::gc_process_relocs): Use typename.
8532         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
8533         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
8534
8535 2010-08-02  Ian Lance Taylor  <iant@google.com>
8536
8537         PR 11855
8538         * script.cc (Script_options::Script_options): Initialize
8539         symbol_definitions_ and symbol_references_.
8540         (Script_options::add_symbol_assignment): Update
8541         symbol_definitions_ and symbol_references_.
8542         (Script_options::add_symbol_reference): New function.
8543         (script_symbol): New function.
8544         * script.h (class Script_options): Add symbol_definitions_ and
8545         symbol_references_ fields.
8546         (Script_options::referenced_const_iterator): New type.
8547         (Script_options::referenced_begin): New function.
8548         (Script_options::referenced_end): New function.
8549         (Script_options::is_referenced): New function.
8550         (Script_options::any_unreferenced): New function.
8551         * script-c.h (script_symbol): Declare.
8552         * yyscript.y (exp): Call script_symbol.
8553         * symtab.cc: Include "script.h".
8554         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
8555         Change all callers.  Check symbols referenced by scripts.
8556         (Symbol_table::add_undefined_symbols_from_command_line): Add
8557         layout parameter.  Change all callers.
8558         (Symbol_table::do_add_undefined_symbols_from_command_line):
8559         Likewise.  Break out loop body.  Check symbols referenced by
8560         scripts.
8561         (Symbol_table::add_undefined_symbol_from_command_line): New
8562         function broken out of
8563         do_add_undefined_symbols_from_command_line.
8564         * symtab.h (class Symbol_table): Update declarations.
8565         * archive.cc: Include "layout.h".
8566         (Archive::should_include_member): Add layout parameter.  Change
8567         all callers.  Check for symbol mentioned in expression.
8568         * archive.h (class Archive): Update declaration.
8569         * object.cc (Sized_relobj::do_should_include_member): Add layout
8570         parameter.
8571         * object.h (Object::should_include_member): Add layout parameter.
8572         Change all callers.
8573         (Object::do_should_include_member): Add layout parameter.
8574         (class Sized_relobj): Update declaration.
8575         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
8576         parameter.
8577         * dynobj.h (class Sized_dynobj): Update declaration.
8578         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
8579         layout parameter.
8580         * plugin.h (class Sized_pluginobj): Update declaration.
8581
8582 2010-08-02  Ian Lance Taylor  <iant@google.com>
8583
8584         PR 11866
8585         * output.cc (Output_segment::set_offset): Search for the first and
8586         last sections rather than assuming that the list is in order.
8587         (Output_segment::find_first_and_last_list): New function.
8588         * output.h (class Output_segment): Update declarations.
8589         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
8590         (relro_strip_test_SOURCES): New variable.
8591         (relro_strip_test_DEPENDENCIES): New variable.
8592         (relro_strip_test_LDFLAGS): New variable.
8593         (relro_strip_test_LDADD): New variable.
8594         (relro_strip_test.so): New target.
8595
8596 2010-08-02  Ian Lance Taylor  <iant@google.com>
8597
8598         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
8599         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
8600         (Target_i386::got_tlsdesc_section): New function.
8601         (Target_i386::got_section): Create space for GOT entries for
8602         TLSDESC relocations.
8603         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
8604         R_386_TLS_GOTDESC.
8605         (Target_i386::Scan::global): Likewise.
8606         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
8607         using TLSDESC GOT.
8608         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
8609         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
8610         (Target_x86_64::got_tlsdesc_section): New function.
8611         (Target_x86_64::got_section): Create space for GOT entries for
8612         TLSDESC relocations.
8613         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
8614         R_386_TLS_GOTDESC.
8615         (Target_x86_64::Scan::global): Likewise.
8616         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
8617         using TLSDESC GOT.
8618
8619 2010-08-02  Ian Lance Taylor  <iant@google.com>
8620
8621         * testsuite/final_layout.sh: Use dc to convert from hex to
8622         decimal.
8623
8624 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
8625
8626         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
8627         paramter to the call to gold::gc_process_relocs.
8628         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
8629         paramter to the call to gold::gc_process_relocs.
8630         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
8631         parameter to the call to gold::gc_process_relocs.
8632         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
8633         template parameter to the call to gold::gc_process_relocs.
8634         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
8635         paramter to the call to gold::gc_process_relocs.
8636         * gc.h (get_embedded_addend_size): New function.
8637         (gc_process_relocs): Save the size of the reloc for use by ICF.
8638         * icf.cc (get_section_contents): Get the addend from the text section
8639         for SHT_REL relocation sections.
8640         * icf.h (Icf::Reloc_addend_size_info): New typedef.
8641         (Icf::Reloc_info): Add new member reloc_addend_size_info.
8642         * int_encoding.h (read_from_pointer): New overloaded function.
8643         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
8644         * testsuite/icf_sht_rel_addend_test.sh: New file.
8645         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
8646         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
8647
8648 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8649
8650         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
8651         * Makefile.in: Regenerate.
8652         * testsuite/Makefile.in: Regenerate.
8653
8654 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
8655
8656         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
8657         * gold/testsuite/debug_msg.cc: Likewise.
8658         * gold/testsuite/odr_violation1.cc
8659         * gold/testsuite/odr_violation2.cc
8660
8661 2010-07-21  Cary Coutant  <ccoutant@google.com>
8662
8663         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
8664         string, and length fields.
8665         (Output_merge_string::Merged_strings_list): New type.
8666         (Output_merge_string::Merged_strings_lists): New typedef.
8667         (Output_merge_string): Replace merged_strings_ with
8668         merged_strings_lists_.
8669         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
8670         Merged_strings_list per input object and section.  Don't store pointer
8671         to the string.  Don't store length with each merged string entry.
8672         (Output_merge_string::finalize_merged_data): Loop over list of merged
8673         strings lists.  Recompute length of each merged string.
8674
8675 2010-07-15  Cary Coutant  <ccoutant@google.com>
8676
8677         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
8678         here.
8679
8680 2010-07-14  Ian Lance Taylor  <iant@google.com>
8681
8682         * descriptors.cc (Descriptors::open): Report correct name in error
8683         message.
8684
8685 2010-07-13  Doug Kwan  <dougkwan@google.com>
8686
8687         * arm.cc (Arm_input_section::Arm_input_section): For a
8688         SHT_ARM_EXIDX section, always keeps the input sections.
8689         (Arm_input_section::set_exidx_section_link): New method.
8690         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
8691         has_errors_ to false.
8692         (Arm_exidx_input_section::has_errors,
8693         Arm_exidx_input_section::set_has_errors): New methods.
8694         (Arm_exidx_input_section::has_errors_): New data member.
8695         (Arm_relobj::get_exidx_shndx_list): New method.
8696         (Arm_output_section::append_text_sections_to_list): Do not skip
8697         section without SHF_EXECINSTR.
8698         (Arm_output_section::fix_exidx_coverage): Skip input sections with
8699         errors.
8700         (Arm_relobj::make_exidx_input_section): Add new parameter for text
8701         section header.  Make error messages more verbose.  Check for
8702         a non-executable section linked to an EXIDX section.
8703         (Arm_relobj::do_read_symbols): Remove error checking, which has been
8704         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
8705         check that there is no deferred EXIDX section if we exit early.
8706         Instead of not making an EXIDX section in case of an error, make one
8707         and set the has_errors flag of it.
8708         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
8709         in a relocatable link.
8710         (Target_arm::do_relax): Look for the EXIDX output section instead of
8711         assuming that it is called .ARM.exidx.
8712         (Target_arm::fix_exidx_coverage): Add a new parameter for input
8713         section list.  Do not check for SHF_EXECINSTR section flags but
8714         skip any input section with errors.
8715         * output.cc (Output_section::Output_section): Initialize
8716         always_keeps_input_sections_ to false.
8717         (Output_section::add_input_section): Check for
8718         always_keeps_input_sections_.
8719         *  output.h (Output_section::always_keeps_input_sections,
8720         Output_section::set_always_keeps_input_sections): New methods.
8721         (Output_section::always_keeps_input_sections): New data member.
8722
8723 2010-07-13  Rafael Espindola  <espindola@google.com>
8724
8725         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
8726         * fileread.h (Input_file): Add try_extra_search_path and find_file.
8727
8728 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
8729             Ian Lance Taylor  <iant@google.com>
8730
8731         * output.h (Output_section_lookup_maps::add_merge_section):
8732         Correct check of whether value was inserted.
8733         (Output_section_lookup_maps::add_merge_input_section): Likewise.
8734         (Output_section_lookup_maps::add_relaxed_input_section):
8735         Likewise.
8736         * arm.cc (Target_arm::got_section): Remove used local os.
8737         * i386.cc (Target_i386::got_section): Likewise.
8738         * x86_64.cc (Target_x86_64::got_section): Likewise.
8739         * sparc.cc (Target_sparc::got_section): Likewise.
8740         (Target_sparc::relocate): Remove unused local have_got_offset.
8741         * powerpc.cc (Target_powerpc::relocate): Likewise.
8742
8743 2010-07-13  Ian Lance Taylor  <iant@google.com>
8744
8745         * compressed_output.cc (zlib_decompress): Fix signature in
8746         !HAVE_ZLIB_H case.
8747
8748         * archive.cc (Archive::include_member): Unlock an external member
8749         of a thin archive.  Don't bother to delete an object we know is
8750         NULL.
8751
8752 2010-07-12  Cary Coutant  <ccoutant@google.com>
8753
8754         * compressed_output.cc (zlib_decompress): New function.
8755         (get_uncompressed_size): New function.
8756         (decompress_input_section): New function.
8757         * compressed_output.h (get_uncompressed_size): New function.
8758         (decompress_input_section): New function.
8759         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
8760         Handle compressed debug sections.
8761         * layout.cc (is_compressed_debug_section): New function.
8762         (Layout::output_section_name): Map compressed section names to
8763         canonical names.
8764         * layout.h (is_compressed_debug_section): New function.
8765         (is_debug_info_section): Recognize compressed debug sections.
8766         * merge.cc: Include compressed_output.h.
8767         (Output_merge_data::do_add_input_section): Handle compressed
8768         debug sections.
8769         (Output_merge_string::do_add_input_section): Handle compressed
8770         debug sections.
8771         * object.cc: Include compressed_output.h.
8772         (Sized_relobj::Sized_relobj): Initialize new data members.
8773         (build_compressed_section_map): New function.
8774         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8775         * object.h (Object::section_is_compressed): New method.
8776         (Object::do_section_is_compressed): New method.
8777         (Sized_relobj::Compressed_section_map): New type.
8778         (Sized_relobj::do_section_is_compressed): New method.
8779         (Sized_relobj::compressed_sections_): New data member.
8780         * output.cc (Output_section::add_input_section): Handle compressed
8781         debug sections.
8782         * reloc.cc: Include compressed_output.h.
8783         (Sized_relobj::write_sections): Handle compressed debug sections.
8784
8785 2010-07-08  Cary Coutant  <ccoutant@google.com>
8786
8787         * resolve.cc (Symbol_table::resolve): Remember whether undef was
8788         weak when resolving to a dynamic def.
8789         (Symbol_table::should_override): Add adjust_dyndef flag; set it
8790         for weak undef/dynamic def cases. Adjust callers.
8791         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8792         undef_binding_weak_.
8793         (Symbol_table::sized_write_globals): Adjust symbol binding.
8794         (Symbol_table::sized_write_symbol): Add binding parameter.
8795         * symtab.h (Symbol::set_undef_binding): New method.
8796         (Symbol::is_undef_binding_weak): New method.
8797         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8798         (Symbol_table::should_override): Add new parameter.
8799         (Symbol_table::sized_write_symbol): Add new parameter.
8800
8801         * testsuite/weak_undef_file1.cc: Add new test case.
8802         * testsuite/weak_undef_file2.cc: Fix header comment.
8803         * testsuite/weak_undef_test.cc: Add new test case.
8804
8805 2010-06-29  Doug Kwan  <dougkwan@google.com>
8806
8807         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8808         Initialize USE_SYMBOL_.
8809         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8810         definition.
8811         (Arm_reloc_property::uses_symbol_): New data member declaration.
8812         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8813         uses symbol value and symbol is undefined but not weakly undefined.
8814
8815 2010-06-28  Rafael Espindola  <espindola@google.com>
8816
8817         * plugin.cc (Plugin::load): Use dlerror.
8818
8819 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
8820
8821         * symtab.cc (detect_odr_violations): When reporting an ODR
8822         violation, report an object where the symbol is defined.
8823
8824 2010-06-25  Doug Kwan  <dougkwan@google.com>
8825
8826         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8827         (Target_arm::section_may_have_icf_unsafe_pointers): New method
8828         definition.
8829         (Target_arm::Scan::local_reloc_may_be_function_pointer,
8830         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8831         target hook to detect function points.
8832         (Target_arm::Scan::possible_function_pointer_reloc): New method.
8833         * icf.h (Icf::check_section_for_function_pointers): Change type of
8834         parameter SECTION_NAME to const reference to std::string.  Use
8835         target hook to determine if section may have unsafe pointers.
8836         * target.h (Target::section_may_have_icf_unsafe_pointers): New
8837         method definition.
8838
8839 2010-06-21  Rafael Espindola  <espindola@google.com>
8840
8841         * fileread.cc (Input_file::find_fie): New
8842         (Input_file::open): Use Input_file::find_fie.
8843         * fileread.h (Input_file::find_fie): New
8844         * plugin.cc (set_extra_library_path): New.
8845         (Plugin::load): Add set_extra_library_path to the transfer vector.
8846         (Plugin_manager::set_extra_library_path): New.
8847         (Plugin_manager::add_input_file): Use the extra search path if set.
8848         (set_extra_library_path(): New.
8849         * plugin.h (Plugin_manager): Add set_extra_library_path and
8850         extra_search_path_.
8851
8852 2010-06-19  Cary Coutant  <ccoutant@google.com>
8853
8854         * layout.cc (gdb_sections): Add .debug_types.
8855         (lines_only_debug_sections): Likewise.
8856
8857 2010-06-18  Rafael Espindola  <espindola@google.com>
8858
8859         * plugin.cc (add_input_file,add_input_library)
8860         (Plugin_manager::add_input_file): Make filename arguments const.
8861         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
8862         const.
8863
8864 2010-06-16  Doug Kwan  <dougkwan@google.com>
8865
8866         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
8867         .ARM.attributes section if we have not merged any input
8868         attributes sections.
8869
8870 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8871
8872         * arm.cc: Allow combining objects with no EABI version
8873         information.
8874
8875 2010-06-15  Rafael Espindola  <espindola@google.com>
8876
8877         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
8878
8879 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8880
8881         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
8882         (struct iovec): Correct !HAVE_READV definition.
8883
8884 2010-06-10  Cary Coutant  <ccoutant@google.com>
8885
8886         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
8887         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
8888         reloc sections.
8889         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
8890
8891         PR 11683
8892         * symtab.h (Symbol::is_placeholder): New member function.
8893         * target-reloc.h (relocate_section): Check for placeholder symbols.
8894
8895         * testsuite/Makefile.am (plugin_test_8): New test.
8896         (plugin_test_9): New test.
8897         * testsuite/Makefile.in: Regenerate.
8898
8899 2010-06-09  Nick Clifton  <nickc@redhat.com>
8900
8901         * yyscript.y (input_list_element): Allow strings prefixed with
8902         the '-' character.  Treat these as libraries.
8903         * script.cc (script_add_library): New function.  Adds a library
8904         specified by "-l<name>" found in an input script.
8905         * script-c.h: Add prototype for script_add_library.
8906
8907 2010-06-07  Doug Kwan  <dougkwan@google.com>
8908
8909         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
8910         Restrict stub-group size to be within long conditional branch
8911         range when working around cortex-A8 erratum.
8912
8913 2010-06-07  Damien Diederen  <dd@crosstwine.com>
8914
8915         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
8916         #ifdef typo.
8917
8918 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
8919
8920         PR gold/11658
8921         * output.cc
8922         (Output_section::Input_section_sort_entry::compare_section_ordering):
8923         Change to return non-zero correctly.
8924         (Output_section::Input_section_sort_section_order_index_compare
8925         ::operator()): Change to fix ambiguity in comparisons.
8926
8927 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
8928
8929         * gold.h (is_wildcard_string): New function.
8930         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8931         (Layout::layout_eh_frame): Ditto.
8932         (Layout::find_section_order_index): New method.
8933         (Layout::read_layout_from_file): New method.
8934         * layout.h (Layout::find_section_order_index): New method.
8935         (Layout::read_layout_from_file): New method.
8936         (Layout::input_section_position_): New private member.
8937         (Layout::input_section_glob_): New private member.
8938         * main.cc (main): Call read_layout_from_file here.
8939         * options.h (--section-ordering-file): New option.
8940         * output.cc (Output_section::input_section_order_specified_): New
8941         member.
8942         (Output_section::Output_section): Initialize new member.
8943         (Output_section::add_input_section): Add new parameter.
8944         Keep input sections when --section-ordering-file is used.
8945         (Output_section::set_final_data_size): Sort input sections when
8946         section ordering file is specified.
8947         (Output_section::Input_section_sort_entry): Add new parameter.
8948         Check sorting type.
8949         (Output_section::Input_section_sort_entry::compare_section_ordering):
8950         New method.
8951         (Output_section::Input_section_sort_compare::operator()): Change to
8952         consider section_order_index.
8953         (Output_section::Input_section_sort_init_fini_compare::operator()):
8954         Change to consider section_order_index.
8955         (Output_section::Input_section_sort_section_order_index_compare
8956         ::operator()): New method.
8957         (Output_section::sort_attached_input_sections): Change to sort
8958         according to section order when specified.
8959         (Output_section::add_input_section<32, true>): Add new parameter.
8960         (Output_section::add_input_section<64, true>): Add new parameter.
8961         (Output_section::add_input_section<32, false>): Add new parameter.
8962         (Output_section::add_input_section<64, false>): Add new parameter.
8963         * output.h (Output_section::add_input_section): Add new parameter.
8964         (Output_section::input_section_order_specified): New
8965         method.
8966         (Output_section::set_input_section_order_specified): New method.
8967         (Input_section::Input_section): Initialize section_order_index_.
8968         (Input_section::section_order_index): New method.
8969         (Input_section::set_section_order_index): New method.
8970         (Input_section::section_order_index_): New member.
8971         (Input_section::Input_section_sort_section_order_index_compare): New
8972         struct.
8973         (Output_section::input_section_order_specified_): New member.
8974         * script-sections.cc (is_wildcard_string): Delete and move modified
8975         method to gold.h.
8976         (Output_section_element_input::Output_section_element_input): Modify
8977         call to is_wildcard_string.
8978         (Output_section_element_input::Input_section_pattern
8979         ::Input_section_pattern): Ditto.
8980         (Output_section_element_input::Output_section_element_input): Ditto.
8981         * testsuite/Makefile.am (final_layout): New test case.
8982         * testsuite/Makefile.in: Regenerate.
8983         * testsuite/final_layout.cc: New file.
8984         * testsuite/final_layout.sh: New file.
8985
8986 2010-06-01  Rafael Espindola  <espindola@google.com>
8987
8988         * plugin.cc (Plugin::load): Pass the output name to the plugin.
8989
8990 2010-06-01  Rafael Espindola  <espindola@google.com>
8991
8992         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8993         visibility of symbols.
8994
8995 2010-05-27  Doug Kwan  <dougkwan@google.com>
8996
8997         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8998         from start of output section instead of address for a local symbol
8999         in a merged or relaxed section when doing a relocatable link.
9000
9001 2010-05-26  Rafael Espindola  <espindola@google.com>
9002
9003         PR 11604
9004         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
9005         adding sections the garbage collector removed.
9006         * gold/testsuite/Makefile.am: Add test.
9007         * gold/testsuite/Makefile.in: Regenerate.
9008         * gold/testsuite/plugin_test_7.sh: New.
9009         * gold/testsuite/plugin_test_7_1.c: New.
9010         * gold/testsuite/plugin_test_7_2.c: New.
9011
9012 2010-05-26  Rafael Espindola  <espindola@google.com>
9013
9014         * script-sections.cc (Output_section_definition::set_section_addresses):
9015         Check for --section-start.
9016
9017 2010-05-26  Doug Kwan  <dougkwan@google.com>
9018
9019         * arm.cc (Arm_scan_relocatable_relocs): New class.
9020         (Target_arm::relocate_special_relocatable): New method.
9021         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
9022         (Arm_relocate_functions::thumb_branch_common): Same.
9023         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
9024         instead of Default_scan_relocatable_relocs.
9025         * target-reloc.h (relocate_for_relocatable): Let target handle
9026         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
9027         * target.h (Sized_target::relocate_special_relocatable): New method.
9028
9029 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9030
9031         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
9032
9033 2010-05-23  Doug Kwan  <dougkwan@google.com>
9034
9035         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
9036         instead of a cast.
9037         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
9038         with a direct branch, not a conditional branch, to a stub.
9039         * merge.cc (Output_merge_base::record_input_section): New method
9040         defintion.
9041         (Output_merge_data::do_add_input_section): Record input section if
9042         keeps-input-sections flag is set.
9043         (Output_merge_string::do_add_input_section): Ditto.
9044         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
9045         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
9046         INPUT_SECTIONS_.
9047         (Output_merge_base::keeps_input_sections,
9048         Output_merge_base::set_keeps_input_sections,
9049         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
9050         method definitions.
9051         (Output_merge_base::Input_sections): New type declaration.
9052         (Output_merge_base::input_sections_begin,
9053         Output_merge_base::input_sections_end,
9054         Output_merge_base::do_set_keeps_input_sections): New method definitions.
9055         (Output_merge_base::bool keeps_input_sections_,
9056         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
9057         Output_merge_base::input_sections_): New data members.
9058         (Output_merge_data::do_set_keeps_input_sections): New method
9059         defintion.
9060         (Output_merge_string::do_set_keeps_input_sections): Ditto.
9061         * output.cc (Output_section::Input_section::relobj): Move method
9062         defintion from class declaration to here and handle merge sections.
9063         (Output_section::Input_section::shndx): Ditto.
9064         (Output_section::Output_section): Remove initializations of removed
9065         data members and initialize new data member LOOKUP_MAPS_.
9066         (Output_section::add_input_section): Set keeps-input-sections flag
9067         for a newly created merge output section as appropriate.  Adjust code
9068         to use Output_section_lookup_maps class.
9069         (Output_section::add_relaxed_input_section): Adjst code for lookup
9070         maps code refactoring.
9071         (Output_section::add_merge_input_section): Add a new parameter
9072         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
9073         class.  If adding input section to a newly created merge output
9074         section fails, remove the new merge section.
9075         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
9076         Adjust code for use of the Output_section_lookup_maps class.
9077         (Output_section::find_merge_section): Ditto.
9078         (Output_section::build_lookup_maps): New method defintion.
9079         (Output_section::find_relaxed_input_section): Adjust code to use
9080         Output_section_lookup_maps class.
9081         (Output_section::get_input_sections): Export merge sections.  Adjust
9082         code to use Output_section_lookup_maps class.
9083         (Output_section:::add_script_input_section): Adjust code to use
9084         Output_section_lookup_maps class.  Update lookup maps for merge
9085         sections also.
9086         (Output_section::discard_states): Use Output_section_lookup_maps.
9087         (Output_section::restore_states): Same.
9088         * output.h (Merge_section_properties): Move class defintion out of
9089         Output_section.
9090         (Output_section_lookup_maps): New class.
9091         (Output_section::Input_section::is_merge_section): New method
9092         defintion.
9093         (Output_section::Input_section::relobj): Move defintion out of class
9094         defintion.  Declare method only.
9095         (Output_section::Input_section::shndx): Ditto.
9096         (Output_section::Input_section::output_merge_base): New method defintion.
9097         (Output_section::Input_section::u2_.pomb): New union field.
9098         (Output_section::Merge_section_by_properties_map,
9099         Output_section::Output_section_data_by_input_section_map,
9100         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
9101         Remove types.
9102         (Output_section::add_merge_input_section): Add new parameter
9103         KEEPS_INPUT_SECTIONS.
9104         (Output_section::build_lookup_maps): New method declaration.
9105         (Output_section::merge_section_map_,
9106         Output_section::merge_section_by_properties_map_,
9107         Output_section::relaxed_input_section_map_,
9108         Output_section::is_relaxed_input_section_map_valid_): Remove data
9109         members.
9110         (Output_section::lookup_maps_): New data member.
9111
9112 2010-05-21  Doug Kwan  <dougkwan@google.com>
9113
9114         PR gold/11619
9115         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
9116         avoid a compilation error.
9117
9118 2010-05-19  Rafael Espindola  <espindola@google.com>
9119
9120         * script-sections.cc (Output_section_definition::allocate_to_segment):
9121         Update the phdrs_list even when the output section is NULL.
9122         * testsuite/Makefile.am: Add test.
9123         * testsuite/Makefile.in: Regenerate.
9124         * testsuite/script_test_9.cc: New.
9125         * testsuite/script_test_9.sh: New.
9126         * testsuite/script_test_9.t: New.
9127
9128 2010-05-19  Doug Kwan  <dougkwan@google.com>
9129
9130         * arm.cc (Arm_input_section::original_size): New method.
9131         (Arm_input_section::do_addralign): Add a cast.
9132         (Arm_input_section::do_output_offset): Remove static cast.
9133         (Arm_input_section::original_addralign,
9134          Arm_input_section::original_size_): Change type to uint32_t.
9135         (Arm_input_section::init): Add safe casts for section alignment
9136         and size.
9137         (Arm_input_section::set_final_data_size): Do not set address and
9138         offset of stub table.
9139         (Arm_output_section::fix_exidx_coverage): Change use of of
9140         Output_section::Simple_input_section to that of
9141         Output_section::Input_section.
9142         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
9143         except for the first pass.
9144         * output.cc (Output_section::get_input_sections): Change type of
9145         input_sections to std::list<Input_section>.
9146         (Output_section::add_script_input_section): Rename from
9147         Output_section::add_simple_input_section.  Change type of SIS
9148         parameter from Simple_input_section to Input_section.
9149         * output.h (Output_section::Simple_input_section): Remove class.
9150         (Output_section::Input_section): Change class visibility to public.
9151         (Output_section::Input_section::addralign): Use stored alignments
9152         for special input sections if set.
9153         (Output_section::Input_section::set_addralign): New method.
9154         (Output_section::get_input_sections): Change parameter type from
9155         list of Simple_input_section to list of Input_section.
9156         (Output_section::add_script_input_section): Rename from
9157         Output_section::add_simple_input_section. Change first parameter's
9158         type from Simple_input_section to Input_section and remove the
9159         second and third parameters.
9160         * script-sections.cc (Input_section::Input_section_list): Change
9161         type to list of Output_section::Input_section/
9162         (Input_section_info::Input_section_info): Change parameter type of
9163         INPUT_SECTION to Output_section::Input_section.
9164         (Input_section_info::input_section): Change return type.
9165         (Input_section_info::input_section_): Change type to
9166         Output_section::Input_section.
9167         (Output_section_element_input::set_section_addresses): Adjust code
9168         to use Output_section::Input_section instead of
9169         Output_section::Simple_input_section.  Adjust code for renaming
9170         of Output_section::add_simple_input_section.
9171         (Orphan_output_section::set_section_addresses): Ditto.
9172
9173 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9174
9175         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
9176         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
9177
9178 2010-05-18  Rafael Espindola  <espindola@google.com>
9179
9180         * options.cc (General_options::finalize): Handle -nostdlib.
9181         * options.h (nostdlib): New option.
9182         * script.cc (script_add_search_dir): Handle -nostdlib.
9183
9184 2010-05-12  Doug Kwan  <dougkwan@google.com>
9185
9186         * arm.cc (Target_arm::do_finalize_sections): Create an empty
9187         attributes section only if there no attributes section after merging.
9188         (Target_arm::merge_object_attributes): Move value of
9189         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
9190         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
9191         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
9192         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
9193         and arm_attr_merge_7.stdout.
9194         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
9195         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
9196         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
9197         arm_attr_merge_7b.o): New rules.
9198         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
9199         arm_attr_merge_7
9200         * testsuite/Makefile.in: Regenerate.
9201         * testsuite/arm_attr_merge.sh: New file.
9202         * testsuite/arm_attr_merge_[67][ab].s: Same.
9203
9204 2010-05-05  Nick Clifton  <nickc@redhat.com>
9205
9206         * po/es.po: Updated Spanish translation.
9207
9208 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
9209
9210         * Makefile.am (install-exec-local): Properly install gold as
9211         default cross linker.
9212         * Makefile.in: Regenerated.
9213
9214 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
9215             Nick Clifton  <nickc@redhat.com>
9216
9217         * configure.ac (install_as_default): Define and set to false
9218         unless --enable-gold or --enable-gold=both/gold has been
9219         specified.
9220         * configure: Regenerate.
9221
9222         * Makefile.am (install-exec-local): Install the executable as
9223         'ld.gold'.  If install_as_default is true then also install it as
9224         'ld'.
9225         * Makefile.in: Regenerated.
9226
9227 2010-04-24  Ian Lance Taylor  <iant@google.com>
9228
9229         * layout.cc (Layout::layout_reloc): In relocatable link don't
9230         combine reloc sections for grouped sections.
9231
9232 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
9233
9234         * gc.h (gc_process_relocs): Pass information on relocs pointing to
9235         sections that are not ordinary to icf.
9236         * icf.cc (get_section_contents): Handle relocation pointing to section
9237         with no object or shndx information.
9238         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
9239         * testsuite/Makefile.in: Regenerate.
9240         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
9241         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
9242
9243 2010-04-22  Ian Lance Taylor  <iant@google.com>
9244
9245         * expression.cc (Expression::Expression_eval_info): Add
9246         result_alignment_pointer field.
9247         (Expression::eval_with_dot): Add result_alignment_pointer
9248         parameter.  Change all callers.
9249         (Expression::eval_maybe_dot): Likewise.
9250         (class Binary_expression): Add alignment_pointer parameter to
9251         left_value and right_value.  Change all callers.
9252         (BINARY_EXPRESSION): Set result alignment.
9253         (class Trinary_expression): Add alignment_pointer parameter to
9254         arg2_value and arg3_value.  Change all callers.
9255         (Trinary_cond::value): Set result alignment.
9256         (Max_expression::value, Min_expression::value): Likewise.
9257         (Align_expression::value): Likewise.
9258         * script-sections.cc (class Sections_element): Add dot_alignment
9259         parameter to set_section_addresses virtual function.  Update
9260         instantiations.
9261         (class Output_section_element): Likewise.
9262         (Script_sections::create_segments): Add dot_alignment parameter.
9263         Change all callers.
9264         (Script_sections::create_segments_from_phdrs_clause): Likewise.
9265         (Script_sections::set_phdrs_clause_addresses): Likewise.
9266         * script-sections.h: Update declarations.
9267         * script.h: Update declarations.
9268         * output.h (Output_segment::set_minimum_p_align): Don't decrease
9269         min_p_align.
9270         * testsuite/script_test_3.t: Set large alignment.
9271         * testsuite/script_test_3.sh: Make sure that at least one LOAD
9272         segment has expected alignment.
9273
9274 2010-04-22  Nick Clifton  <nickc@redhat.com>
9275
9276         * po/gold.pot: Updated by the Translation project.
9277         * po/vi.po: Updated Vietnamese translation.
9278
9279 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
9280
9281         * testsuite/Makefile.am (check_PROGRAMS): Add
9282         icf_virtual_function_folding_test.
9283         * testsuite/Makefile.in: Regenerated.
9284
9285 2010-04-15  Andrew Haley  <aph@redhat.com>
9286
9287         * options.h (merge_exidx_entries): New option.
9288         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
9289         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
9290         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
9291         (Target_arm::merge_exidx_entries): New function.
9292         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
9293         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
9294         to Arm_exidx_fixup constructor.
9295         Add new arg, merge_exidx_entries.
9296         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
9297         Arm_output_section::fix_exidx_coverage.
9298
9299 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
9300
9301         * icf.cc (get_section_contents): Check for preemptible functions.
9302         Ignore addend when appropriate.
9303         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
9304         section folded.
9305         (add_from_relobj): Check for section folded.
9306         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
9307         * symtab.h (should_add_dynsym_entry): Add new parameter.
9308         * target-reloc.h (scan_relocs): Check for section folded.
9309         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
9310         Check reloc types for function pointers in shared objects.
9311         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
9312         case.
9313         (icf_preemptible_functions_test): New test case.
9314         (icf_string_merge_test): New test case.
9315         * testsuite.Makefile.in: Regenerate.
9316         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
9317         bar_glob.  Refactor code.
9318         * testsuite/icf_preemptible_functions_test.cc: New file.
9319         * testsuite/icf_preemptible_functions_test.sh: New file.
9320         * testsuite/icf_string_merge_test.cc: New file.
9321         * testsuite/icf_string_merge_test.sh: New file.
9322         * testsuite/icf_virtual_function_folding_test.cc: New file.
9323         * testsuite/icf_virtual_function_folding_test.sh: New file.
9324
9325 2010-04-14  Doug Kwan  <dougkwan@google.com>
9326
9327         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
9328         for local symbol recounting if we remove a section due to ICF.
9329         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
9330         there are no regular objects in input.
9331
9332 2010-04-13  Doug Kwan  <dougkwan@google.com>
9333
9334         * arm.cc (Arm_input_section::set_final_data_size): Compute
9335         accurate final data size instead of using current data size.
9336
9337 2010-04-09  Doug Kwan  <dougkwan@google.com>
9338
9339         * layout.cc (Layout::choose_output_section): Handle script section
9340         types.
9341         (Layout::make_output_section_for_script): Add section type parameter.
9342         Handle script section types.
9343         * layout.h (Layout::make_output_section_for_script): Add section
9344         type parameter.
9345         * output.cc (Output_section::Output_section): Initialize data member
9346         is_noload_.
9347         (Output_section::do_reset_address_and_file_offset): Do not set address
9348         to 0 if section is a NOLOAD section.
9349         * output.h (Output_section::is_noload): New method.
9350         (Output_section::set_is_noload): Ditto.
9351         (Output_section::is_noload_): New data member.
9352         * script-c.h (Script_section_type): New enum type.
9353         (struct Parser_output_section_header): Add new file section_type.
9354         * script-sections.cc (Sections_element::output_section_name): Add
9355         parameter for returning script section type.
9356         (Output_section_definition::output_section_name): Ditto.
9357         (Output_section_definition::section_type)P; New method.
9358         (Output_section_definiton::script_section_type_name): Ditto.
9359         (Output_section_definition::script_section_type_): New data member.
9360         (Output_section_definition::Output_section_definition): Initialize
9361         data member Output_section_definition::script_section_type_.
9362         (Output_section_definition::create_sections): Pass script section type
9363         to Layout::make_output_section_for_script.
9364         (Output_section_definition::output_section_name): Return script
9365         section type to caller.
9366         (Output_section_definition::set_section_address): Do not advance
9367         dot value and load address if section type is NOLOAD.  Set address
9368         of NOLOAD sections regardless of section flags.
9369         (Output_section_definition::print): Print section type if it is
9370         not SCRIPT_SECTION_TYPE_NONE.
9371         (Output_section_definition::section_type): New method.
9372         (Output_section_definition::script_section_type_name): Ditto.
9373         (Script_sections::output_section_name): Add new parameter
9374         PSECTION_TYPE for returning script section type.  Pass it to
9375         section elements.  Handle discard sections.
9376         (Sort_output_sections::operator()): Handle NOLOAD sections.
9377         * script-sections.h (Script_sections::Section_type): New enum type.
9378         (Script_sections::output_section_name): Add a new parameter for
9379         returning script section type.
9380         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
9381         INFO and NOLOAD.
9382         * yyscript.y (union): Add new field SECTION_TYPE.
9383         (COPY, DSECT, INFO, NOLOAD): New tokens.
9384         (opt_address_and_section_type): Change type to output_section_header.
9385         (section_type): New non-terminal
9386         (section_header): Handle section type.
9387         (opt_address_and_section_type): Return section type value.
9388
9389 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
9390
9391         * testsuite/plugin_common_test_1.c (foo): Add prototype.
9392         * testsuite/plugin_common_test_2.c (foo): Likewise.
9393
9394 2010-04-08  Doug Kwan  <dougkwan@google.com>
9395
9396         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
9397         Output_merge_data.
9398         * output.cc (Output_section::add_merge_input_section): Simplify
9399         code and return status of Output_merge_base::add_input_section.
9400         Update merge section map only if Output_merge_base::add_input_section
9401         returns true.
9402
9403 2010-04-07  Doug Kwan  <dougkwan@google.com>
9404
9405         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
9406         if section is marked as containing instructions but has no mapping
9407         symbols.
9408         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
9409         correct section index.
9410         (Arm_relobj::find_linked_text_section): Ditto.
9411
9412 2010-04-07  Cary Coutant  <ccoutant@google.com>
9413
9414         * archive.cc (include_member): Destroy Read_symbols_data object before
9415         releasing file.
9416         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
9417         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
9418         (Read_symbols_data::~Read_symbols_data) New destructor.
9419         (Section_relocs::Section_relocs) New constructor.
9420         (Section_relocs::~Section_relocs) New destructor.
9421         (Read_relocs_data::Read_relocs_data) New constructor.
9422         (Read_relocs_data::~Read_relocs_data) New destructor.
9423         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
9424         pointers to NULL after deleting.
9425
9426 2010-04-07  Doug Kwan  <dougkwan@google.com>
9427
9428         * arm.cc: Replace "endianity" with "endianness" in comments.
9429         (Arm_exidx_cantunwind): Ditto.
9430         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
9431         (Arm_relobj::merge_flags_and_attributes): New method.
9432         (Arm_relobj::merge_flags_and_attributes_): New data member.
9433         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
9434         (Arm_relobj::scan_sections_for_stubs): Ditto.
9435         (Arm_relobj::do_read_symbols): Check to see if we really want to
9436         merge processor-specific flags and attributes.  Exit early if
9437         an object is empty except for section names and the undefined symbol.
9438         (Target_arm::do_finalize_sections): Move check for ELF format to
9439         Arm_relobj::do_read_symbols.  Merge processor specific flags and
9440         attributes from a regular object only when we have determined that
9441         it is aapropriate.  Do not create an .ARM.attributes section in
9442         output if there is no regular input object.
9443         (Target_arm::merge_processor_specific_flags): Check
9444         --warn-mismatch before printing any error.
9445         (Target_arm::merge_object_attributes): Ditto.
9446         * gold.cc (queue_middle_tasks): Handle the case in which there is
9447         no regular object in input.
9448         * options.cc (General_options::parse_EB): New method.
9449         (General_options::parse_EL): Same.
9450         (General_options::General_options): Initialize endianness_.
9451         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
9452         New options.
9453         (General_options::Endianness): New enum.
9454         (General_options::endianness): New method.
9455         (General_options::endianness_): New data member.
9456         * parameters.cc (Parameters::set_options): Check target endianness.
9457         (Parameters::set_target_once): Ditto.
9458         (Parameters::check_target_endianness): New method.
9459         (parameters_force_valid_target): If either -EL or -EB is specified,
9460         use it to define endianness of default target.
9461         * parameters.h (Parameters::check_target_endianness): New method
9462         declaration.
9463         * target.h (class Target): Change "endianity" to "endianness"
9464         in comments.
9465
9466 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9467
9468         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
9469         * configure: Regenerate.
9470         * Makefile.in: Regenerate.
9471         * testsuite/Makefile.in: Regenerate.
9472
9473 2010-04-06  Cary Coutant  <ccoutant@google.com>
9474
9475         gcc PR lto/42757
9476         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
9477         prevailing definitions of common symbols.
9478         * testsuite/plugin_test_6.sh: New test case.
9479         * testsuite/plugin_common_test_1.c: New test case.
9480         * testsuite/plugin_common_test_2.c: New test case.
9481         * testsuite/Makefile.am (plugin_test_6): New test case.
9482         * testsuite/Makefile.in: Regenerate.
9483
9484 2010-04-06  Nick Clifton  <nickc@redhat.com>
9485
9486         * po/vi.po: New Vietnamese translation.
9487
9488 2010-03-30  Doug Kwan  <dougkwan@google.com>
9489
9490         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
9491
9492 2010-03-25  Doug Kwan  <dougkwan@google.com>
9493
9494         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
9495         to avoid a conversion warning on a 32-bit host.
9496
9497 2010-03-24  Ian Lance Taylor  <iant@google.com>
9498
9499         * testsuite/script_test_3.t: Add a TLS segment.
9500         * testsuite/Makefile.am (check_PROGRAMS): Add
9501         tls_phdrs_script_test.
9502         (tls_phdrs_script_test_SOURCES): Define.
9503         (tls_phdrs_script_test_DEPENDENCIES): Define.
9504         (tls_phdrs_script_test_LDFLAGS): Define.
9505         (tls_phdrs_script_test_LDADD): Define.
9506         * testsuite/Makefile.in: Rebuild.
9507
9508 2010-03-23  Cary Coutant  <ccoutant@google.com>
9509
9510         * fileread.cc (find_or_make_view): Fix comment.
9511
9512 2010-03-23  Ian Lance Taylor  <iant@google.com>
9513
9514         * script-sections.cc (class Orphan_section_placement): Define
9515         PLACE_TLS and PLACE_TLS_BSS.
9516         (Orphan_section_placement::Orphan_section_placement): Initialize
9517         new places.
9518         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
9519         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
9520         (tls_script_test_SOURCES): Define.
9521         (tls_script_test_DEPENDENCIES): Define.
9522         (tls_script_test_LDFLAGS): Define.
9523         (tls_script_test_LDADD): Define.
9524         * testsuite/Makefile.in: Rebuild.
9525
9526 2010-03-22  Doug Kwan  <dougkwan@google.com>
9527
9528         * arm.cc (Arm_relocate_functions::abs8,
9529         Arm_relocate_functions::abs16): Use correct check for overflow
9530         specified in the ARM ELF specs.
9531         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
9532         target of a BLX instruction specially.
9533         (Reloc_stub::stub_type_for_reloc): Ditto.
9534         (Relocate::relocate): Use symbolic names instead of numeric relocation
9535         codes to report error.
9536         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
9537         workaround.
9538         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
9539         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
9540         thumb2_blx_out_of_range.stdout
9541         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
9542         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
9543         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
9544         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
9545         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
9546         thumb2_blx_in_range, thumb2_blx_in_range.o,
9547         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
9548         thumb2_blx_out_of_range.o): New rules.
9549         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
9550         thumb2_blx_in_range and thumb2_blx_out_of_range.
9551         * testsuite/Makefile.in: Regenerate.
9552         * arm_branch_in_range.sh: Add tests for THUMB BLX.
9553         * testsuite/thumb_blx_in_range.s: New file.
9554         * testsuite/thumb_blx_out_of_range.s: New file.
9555
9556 2010-03-22  Rafael Espindola  <espindola@google.com>
9557
9558         * archive.cc (Should_include): Move to archive.h.
9559         (should_include_member): Make it a member of Archive.
9560         (Lib_group): New.
9561         (Add_lib_group_symbols): New.
9562         * archive.h: Include options.h.
9563         (Archive_member): Moved from Archive.
9564         (Should_include): Moved from archive.cc.
9565         (Lib_group): New.
9566         (Add_lib_group_symbols): New.
9567         * dynobj.cc (do_should_include_member): New.
9568         * dynobj.h (do_should_include_member): New.
9569         * gold.cc (queue_initial_tasks): Update call to queue.
9570         * main.cc (main): Print lib group stats.
9571         * object.cc (do_should_include_member): New.
9572         * object.h: Include archive.h.
9573         (Object::should_include_member): New.
9574         (Object::do_should_include_member): New.
9575         (Sized_relobj::do_should_include_member): New.
9576         * options.cc (General_options::parse_start_lib): New.
9577         (General_options::parse_end_lib): New.
9578         (Input_arguments::add_file): Handle lib groups.
9579         (Input_arguments::start_group): Check we are not in a lib.
9580         (Input_arguments::start_lib): New.
9581         (Input_arguments::end_lib): New.
9582         * options.h (General_options): Add start_lib and end_lib.
9583         (Input_argument::lib_): New.
9584         (Input_argument::lib): New.
9585         (Input_argument::is_lib): New.
9586         (Input_file_lib): New.
9587         (Input_arguments::in_lib_): New.
9588         (Input_arguments::in_lib): New.
9589         (Input_arguments::start_lib): New.
9590         (Input_arguments::end_lib_): New.
9591         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
9592         in unused members as preempted.
9593         (Sized_pluginobj::do_should_include_member): New.
9594         * plugin.h (Sized_pluginobj::do_should_include_member): New.
9595         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
9596         return the blocker.
9597         (Read_symbols::do_whole_lib_group): New.
9598         (Read_symbols::do_lib_group): New.
9599         (Read_symbols::do_read_symbols): Handle lib groups.
9600         (Read_symbols::get_name): Handle lib groups.
9601         * readsyms.h (Read_symbols): Add an archive member pointer.
9602         (Read_symbols::do_whole_lib_group): New.
9603         (Read_symbols::do_lib_group): New.
9604         (Read_symbols::member_): New.
9605         * script.cc (read_input_script): Update call to queue_soon.
9606
9607 2010-03-19  Doug Kwan  <dougkwan@google.com>
9608
9609         * arm.cc (Stub_table::Stub_table): Initialize new data members
9610         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9611         (Stub_table::add_reloc_stub): Assign stub offset and update
9612         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9613         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
9614         New data members.
9615         (Stub_table::update_data_size_and_addralign): Use
9616         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
9617         instead of going over all reloc stubs.
9618         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
9619         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9620         Stringpool_template::offset_ to size of Stringpool_char.
9621         (Stringpool_template::new_key_offset): Remove code to initialize
9622         Stringpool_template::offset_.
9623         * stringpool.h (Stringpool_template::set_no_zero_null): Set
9624         Stringpool_template::offset_ to zero.
9625
9626 2010-03-15  Doug Kwan  <dougkwan@google.com>
9627
9628         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9629         offset_.
9630         (Stringpool_template::new_key_offset): New method.
9631         (Stringpool_template::add_string): Assign offsets when adding new
9632         strings.
9633         (Stringpool_template::set_string_offsets): Do not set string offsets
9634         when not optimizing.
9635         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
9636         member size_.
9637         (Chunked_vector::clear): Clear size_.
9638         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
9639         (Chunked_vector::size): Return size_.
9640         (Chunked_vector::push_back): Use size_ to find insert position.
9641         (Chunked_vector::size_): New data member.
9642         (Stringpool_template::set_no_zero_null): Assert string set is empty.
9643         (Stringpool_template::new_key_offset): New method declaration.
9644         (Stringpool_template::offset_): New data member.
9645
9646 2010-03-15   Rafael Espindola  <espindola@google.com>
9647
9648         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
9649         Add_symbols' constructor.
9650         * readsyms.h (Add_symbols): Remove the input_group member.
9651
9652 2010-03-10  Ian Lance Taylor  <iant@google.com>
9653
9654         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
9655         target to ask whether a reference to a symbol requires a stack
9656         split.
9657         * target.h (Target::is_call_to_non_split): New function.
9658         (Target::do_is_call_to_non_split): Declare virtual function.
9659         * target.cc: Include "symtab.h".
9660         (Target::do_is_call_to_non_split): New function.
9661         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
9662
9663 2010-03-10  Cary Coutant  <ccoutant@google.com>
9664
9665         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
9666         (File_read::open[1]): Remove initial mapping of whole_file_view_.
9667         (File_read::open[2]): Add whole_file_view_ to list of views.
9668         (File_read::make_view): Remove test of whole_file_view_.
9669         (File_read::find_or_make_view): Create whole_file_view_ if
9670         necessary.
9671         (File_read::clear_views): Replace bool parameter with enum;
9672         adjust all callers.  Don't delete views with permanent data;
9673         do delete cached views and views from archives if
9674         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
9675         if clearing the corresponding view.
9676         * fileread.h (File_read::Clear_views_mode): New enum.
9677         (File_read::View::is_permanent_view): New method.
9678         (File_read::clear_views): Replace bool parameter
9679         with enum; adjust all callers.
9680         * options.h (General_options): Change keep_files_mapped option;
9681         add map_whole_files.
9682         * readsyms.cc (Add_symbols::run): Delete sd_ object before
9683         releasing the file.
9684         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
9685         the file.
9686
9687 2010-03-10  David S. Miller  <davem@davemloft.net>
9688
9689         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
9690
9691 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
9692
9693         * icf.cc (get_section_contents): Add '@' marker after processing the
9694         merge reloc.
9695
9696 2010-03-08  Doug Kwan  <dougkwan@google.com>
9697
9698         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
9699         due to a conversion warning.
9700         (Arm_relobj::update_output_local_symbol_count): Check for local
9701         symbol with unset output index.
9702
9703 2010-03-05  Ian Lance Taylor  <iant@google.com>
9704
9705         * options.h (class General_options): Add --spare-dynamic-tags.
9706         * output.cc (Output_data_dynamic::set_final_data_size): Implement
9707         --spare-dynamic-tags.
9708
9709 2010-03-05  Ian Lance Taylor  <iant@google.com>
9710
9711         * incremental.cc: Include "libiberty.h".
9712
9713 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
9714
9715         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
9716         function, is_info_ member.
9717         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
9718         (Versions::Versions): Update caller.
9719         (Versions::define_base_version): Likewise.
9720         (Versions::add_def): Likewise.
9721
9722 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
9723
9724         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
9725         (Scan::possible_function_pointer_reloc): New function.
9726         (Scan::local_reloc_may_be_function_pointer): Change to call
9727         possible_function_pointer_reloc.
9728         (Scan::global_reloc_may_be_function_pointer): Ditto.
9729         * icf.h (Icf::check_section_for_function_pointers): Change to reject
9730         relocations in ".data.rel.ro._ZTV" section.
9731         * testsuite/icf_safe_so_test.sh: Change to pass i386.
9732         * testsuite/icf_safe_so_test.cc: Ditto.
9733         * testsuite/icf_safe_test.cc: Ditto.
9734         * testsuite/icf_safe_test.sh: Ditto.
9735
9736 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9737             Ian Lance Taylor  <iant@google.com>
9738
9739         * target-reloc.h (relocate_section): Check the symbol table index
9740         for -1U before setting the local symbol index.
9741         (scan_relocatable_relocs): If copying the relocation, record that
9742         the local symbol is required.
9743         * object.h (Symbol_value::is_output_symtab_index_set): New
9744         function.
9745         (Symbol_value::may_be_discarded_from_output_symtab): New
9746         function.
9747         (Symbol_value::has_output_symtab_entry): New function.
9748         (Symbol_value::needs_output_symtab_entry): Remove.
9749         (Symbol_value::output_symtab_index): Make sure the symbol index is
9750         set.
9751         (Symbol_value::set_output_symtab_index): Make sure the symbol
9752         index is not set.  Make sure the new index is valid.
9753         (Symbol_value::set_must_have_output_symtab_entry): New function.
9754         (Symbol_value::has_output_dynsym_entry): New function.
9755         (Symbol_value::set_output_dynsym_index): Make sure the new index
9756         is valid.
9757         (Sized_relobj::set_must_have_output_symtab_entry): New function.
9758         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
9759         local symbol if permitted.
9760         (Sized_relobj::do_finalize_local_symbols): Call
9761         is_output_symtab_index_set rather than needs_output_symtab_entry.
9762         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
9763         rather than needs_output_symtab_entry.  Call
9764         has_output_dynsym_entry rather than needs_output_dynsym_entry.
9765         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
9766         is_output_symtab_index_set rather than needs_output_symtab_entry.
9767         * testsuite/discard_locals_relocatable_test.c: New file.
9768         * testsuite/discard_locals_test.sh: Test -r.
9769         * testsuite/Makefile.am (check_DATA): Add
9770         discard_locals_relocatable_test1.syms,
9771         discard_local_relocatable_test2.syms.
9772         (MOSTLYCLEANFILES): Likewise.  Also add
9773         discard_locals_relocatable_test1.lout and
9774         discard_locals_relocatable_test2.out.
9775         (discard_locals_relocatable_test1.syms): New target.
9776         (discard_locals_relocatable_test.o): New target.
9777         (discard_locals_relocatable_test1.out): New target.
9778         (discard_locals_relocatable_test2.syms): New target.
9779         (discard_locals_relocatable_test2.out): New target.
9780         (various): Add missing ../ld-new dependencies.
9781         * testsuite/Makefile.in: Rebuild.
9782
9783 2010-03-03  Nick Clifton  <nickc@redhat.com>
9784
9785         * po/fi.po: New Finnish translation.
9786
9787 2010-03-01  Doug Kwan  <dougkwan@google.com>
9788
9789         * layout.cc (Layout::Layout): Force section types of .init_array*,
9790         .preinit_array* and .fini_array* sections.
9791         * output.cc (Output_section::Input_section_sort_entry::has_priority):
9792         Fix check of return value of std::string::find.().
9793         (Output_section::Input_section_sort_compare::operator()): Remove
9794         comment about .init_array.
9795         (Output_section::Input_section_sort_init_fini_compare::operator()):
9796         New method.
9797         (Output_section::sort_attached_input_sections): Handle .init_array
9798         and .fini_array specially.
9799         * output.h (Output_section::Inut_section_sort_compare): Update
9800         comment.
9801         (Output_section::Input_section_sort_init_fini_compare): New struct.
9802
9803 2010-02-26  Doug Kwan  <dougkwan@google.com>
9804
9805         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9806         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9807         * testsuite/debug_msg.sh: Avoid matching source line number for
9808         use of global variable undef_int.
9809
9810 2010-02-26  Doug Kwan  <dougkwan@google.com>
9811
9812         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9813         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9814         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9815         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9816         * options.cc (General_options::General_options): Initialize member
9817         fix_v4bx_.
9818         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9819         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9820         and rm_no_fix_v4bx.stdout
9821         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9822         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9823         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9824         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9825         and arm_no_fix_v4bx.
9826         * Makefile.in: Regenerate.
9827         * testsuite/arm_fix_v4bx.s: New file.
9828         * testsuite/arm_fix_v4bx.sh: Ditto.
9829
9830 2010-02-24  Doug Kwan  <dougkwan@google.com>
9831
9832         * arm.cc (Target_arm::got_section): Make the .got section the first
9833         non RELRO section in the data segment.
9834         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9835         suffixes of section names.
9836
9837 2010-02-24  Doug Kwan  <dougkwan@google.com>
9838
9839         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
9840         flags and attributes merging if an input file is a binary file.
9841         * fileread.cc (Input_file::open): Record format of original file.
9842         * fileread.h (Input_file::Format): New enum type.
9843         (Input_file::Input_file): Initialize data member format_.
9844         (Input_file::format): New method definition.
9845         (Input_file::format_):: New data member.
9846
9847 2010-02-24  Doug Kwan  <dougkwan@google.com>
9848
9849         * arm.cc (Arm_output_data_got): New class.
9850         (ARM_TCB_SIZE): New constant
9851         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
9852         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
9853         If user uses a script with a SECTIONS clause, issue only a warning
9854         for a misplaced EXIDX input section.  Otherwise, issue an error.
9855         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
9856         garbage collection.
9857         (Target_arm::got_mode_index_entry): Handle static linking.
9858         (Target_arm::Scan::local): Ditto.
9859         (Target_arm::Scan::global): Ditto.
9860         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
9861         all incorrectly implemented relocations.
9862         (Target_arm::fix_exidx_coverage): Pass layout to
9863         Arm_output_section::fix_exidx_coverage.
9864         * layout.cc (Layout::section_name_mapping): Remove trailing dots
9865         from ".ARM.exidx." and ".ARM.extab.".
9866
9867 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9868
9869         * arm.cc (Target_arm::do_finalize_sections): Create attribute
9870         section if it does not already exist.
9871         * attributes.cc (Attributes_section_data::Attributes_section_data):
9872         Don't crash if size is zero.
9873
9874 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9875             Ian Lance Taylor  <iant@google.com>
9876
9877         * gold.cc (queue_middle_tasks): If no input files were opened,
9878         exit.
9879         * workqueue.h (Task_function::Task_function): Assert that there is
9880         a blocker.
9881
9882 2010-02-22  Doug Kwan  <dougkwan@google.com>
9883
9884         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
9885         * icf.cc (get_section_contents): Cast snprintf arguments to long long
9886         types to avoid warnings due to different uint64_t implementations
9887         on different hosts.
9888
9889 2010-02-21  Doug Kwan  <dougkwan@google.com>
9890
9891         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
9892         handling of the maximum backward branch offset.
9893         (Arm_relocate_functions::thumb_branch_common): Ditto.
9894         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
9895         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
9896         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
9897         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
9898         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
9899         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
9900         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
9901         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
9902         thumb_bl_out_of_range thumb_bl_out_of_range.o,
9903         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
9904         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
9905         thumb2_bl_out_of_range.o): New rules.
9906         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
9907         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
9908         thumb2_bl_out_of_range
9909         * testsuite/Makefile.in: Regenerate.
9910         * testsuite/arm_bl_in_range.s: New file.
9911         * testsuite/arm_bl_out_of_range.s: Ditto.
9912         * testsuite/arm_branch_in_range.sh: Ditto.
9913         * testsuite/arm_branch_range.t: Ditto.
9914         * testsuite/thumb2_branch_range.t: Ditto.
9915         * testsuite/thumb_bl_in_range.s: Ditto.
9916         * testsuite/thumb_bl_out_of_range.s: Ditto.
9917         * testsuite/thumb_branch_range.t: Ditto.
9918
9919 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
9920
9921         * gc.h (gc_process_relocs): Change vectors to point to the new list.
9922         Add reloc offset information.
9923         * icf.cc (get_section_contents): Change iterators to point to the new
9924         vectors. Add reloc offset information to the contents.
9925         * icf.h (Icf::Sections_reachable_info): New typedef.
9926         (Icf::Sections_reachable_list): New typedef.
9927         (Icf::Offset_info): New typedef.
9928         (Icf::Reloc_info): New struct typedef.
9929         (Icf::Reloc_info_list): New typedef.
9930         (Icf::symbol_reloc_list): Delete method.
9931         (Icf::addend_reloc_list): Delete method.
9932         (Icf::section_reloc_list): Delete method.
9933         (Icf::reloc_info_list): New method.
9934         (Icf::reloc_info_list_): New member.
9935
9936 2010-02-19  Doug Kwan  <dougkwan@google.com>
9937
9938         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9939         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9940         * arm.cc (Arm_relocation_functions): New forward declaration.
9941         (Target_arm::Target_arm): Initialize new data members
9942         got_mod_index_offset_ and tls_base_symbol_defined_.
9943         (Target_arm::Relocate::relocate_tls): New method.
9944         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9945          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9946         New methods.
9947         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9948         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
9949         (Target_arm::got_mod_index_offset_,
9950         Target_arm::tls_base_symbol_defined_): New data members.
9951         (Target_arm::Scan::local, Target::Scan::global,
9952         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
9953         relocations.
9954
9955 2010-02-18  Doug Kwan  <dougkwan@google.com>
9956
9957         * arm.cc (Arm_relobj::find_linked_text_section): New method.
9958         (Arm_relobj::make_exidx_input_section): Pass section index of linked
9959         text section as a parameter becuase some broken tools may not set
9960         the link in section header.
9961         (Target_arm::has_got_section): New method.
9962         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
9963         without any mapping symbol as data only.  Remove warning.
9964         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
9965         link in its section header, try to discover the link by inspecting the
9966         REL31 relocation at the beginning of the section.
9967         (Target_arm::Scan::check_non_pic): Report name of offending relocation
9968         in error message.
9969         (Target_arm::Scan::global): Treat any reference to the symbol
9970         _GLOBAL_OFFSET_TABLE_ as a GOT access.
9971
9972 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
9973
9974         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
9975         (Scan::global_reloc_may_be_function_pointer): New function.
9976         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9977         (Scan::global_reloc_may_be_function_pointer): New function.
9978         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9979         (Scan::global_reloc_may_be_function_pointer): New function.
9980         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9981         (Scan::global_reloc_may_be_function_pointer): New function.
9982         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9983         (Scan::global_reloc_may_be_function_pointer): New function.
9984         (Scan::possible_function_pointer_reloc): New function.
9985         (Target_x86_64::can_check_for_function_pointers): New function.
9986         * gc.h (gc_process_relocs): Scan relocation types to determine if
9987         function pointers were taken for targets that support it.
9988         * icf.cc (Icf::find_identical_sections): Include functions for
9989         folding in safe ICF whose pointer is not taken.
9990         * icf.h (Secn_fptr_taken_set): New typedef.
9991         (fptr_section_id_): New member.
9992         (section_has_function_pointers): New function.
9993         (set_section_has_function_pointers): New function.
9994         (check_section_for_function_pointers): New function.
9995         * options.h: Fix comment for safe ICF option.
9996         * target.h (can_check_for_function_pointers): New function.
9997         * testsuite/Makefile.am: Add icf_safe_so_test test case.
9998         Modify icf_safe_test for X86-64.
9999         * testsuite/Makefile.in: Regenerate.
10000         * testsuite/icf_safe_so_test.cc: New file.
10001         * testsuite/icf_safe_so_test.sh: New file.
10002         * testsuite/icf_safe_test.cc (kept_func_3): New function.
10003         (main): Change to take pointer to function kept_func_3.
10004         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
10005         folding is done correctly for X86-64.
10006
10007 2010-02-12  David S. Miller  <davem@davemloft.net>
10008
10009         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
10010         is_symbolless parameter.
10011         (Output_reloc<SHT_REL>::is_symbolless): New.
10012         (Output_reloc<SHT_REL>::is_symbolless_): New.
10013         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
10014         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
10015         (Output_reloc<SHT_RELA>::is_symbolless): New.
10016         (Output_data_reloc::add_global): Handle is_symbolless.
10017         (Output_data_reloc::add_global_relative): Likewise.
10018         (Output_data_reloc::add_local): Likewise.
10019         (Output_data_reloc::add_local_relative): Likewise.
10020         (Output_data_reloc::add_symbolless_global_addend): New.
10021         (Output_data_reloc::add_symbolless_local_addend): New.
10022         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
10023         is_symbolless.
10024         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
10025         instead of ->is_relative_
10026         (Output_reloc::write): Likewise.
10027         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
10028         (Output_reloc::write_rel): Simplify.
10029
10030         * sparc.cc (Target_sparc::Scan::local): Use
10031         ->add_symbolless_local_addend as needed.
10032         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
10033         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
10034         based upon relocation offset.
10035
10036 2010-02-11  Doug Kwan  <dougkwan@google.com>
10037
10038         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
10039         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
10040         beginning of function.
10041         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
10042         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
10043         parameter is_32bit in calls to should_apply_static_reloc.
10044         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
10045         (check_DATA): Add arm_abs_global.stdout.
10046         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
10047         arm_abs_global.stdout): New rules.
10048         (MOSTLLYCLEANFILES): Add arm_abs_global
10049         * Makefile.in: Regenerate.
10050         * testsuite/arm_abs_global.s: New file.
10051         * testsuite/arm_abs_global.sh: Ditto.
10052         * testsuite/arm_abs_lib.s: Ditto.
10053
10054 2010-02-11  Ian Lance Taylor  <iant@google.com>
10055
10056         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
10057         Read_relocs task.
10058         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
10059         Allocate_commons_task first.
10060         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
10061         task, rather than symtab_lock_.
10062         (Gc_process_relocs::~Gc_process_relocs): New function.
10063         (Gc_process_relocs::is_runnable): Check this_blocker_.
10064         (Gc_process_relocs::locks): Use next_blocker_ rather than
10065         blocker_.
10066         (Scan_relocs::~Scan_relocs): New function.
10067         (Scan_relocs::is_runnable): Check this_blocker_ rather than
10068         symtab_lock_.
10069         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
10070         next_blocker_.
10071         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
10072         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
10073         constructor accordingly.
10074         (class Gc_process_relocs): Likewise.
10075         (class Scan_relocs): Likewise.
10076         * common.h (class Allocate_commons_task): Remove symtab_lock_
10077         field, and corresponding constructor parameter.
10078         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
10079         symtab_lock_.
10080         (Allocate_commons_task::locks): Likewise.
10081
10082 2010-02-11  Ian Lance Taylor  <iant@google.com>
10083
10084         * gold-threads.h (class Once): Define.
10085         (class Initialize_lock): Rewrite as child of Once.
10086         * gold-threads.cc (class Once_initialize): Define.
10087         (once_pointer_control): New static variable.
10088         (once_pointer, once_arg): New static variables.
10089         (c_run_once): New static function.
10090         (Once::Once, Once::run_once, Once::internal_run): New functions.
10091         (class Initialize_lock_once): Remove.
10092         (initialize_lock_control): Remove.
10093         (initialize_lock_pointer): Remove.
10094         (initialize_lock_once): Remove.
10095         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
10096         (Initialize_lock::initialize): Rewrite.
10097         (Initialize_lock::do_run_once): New function.
10098         * archive.cc (Archive::interpret_header): Only clear name if it is
10099         not already empty.
10100         * fileread.cc: Include "gold-threads.h"
10101         (file_counts_lock): New static variable.
10102         (file_counts_initialize_lock): Likewise.
10103         (File_read::release): Only increment counts when using --stats.
10104         Use a lock around the increment.
10105         * parameters.cc (class Set_parameters_target_once): Define.
10106         (set_parameters_target_once): New static variable.
10107         (Parameters::Parameters): Move here from parameters.h.
10108         (Parameters::set_target): Rewrite.
10109         (Parameters::set_target_once): New function.
10110         (Parameters::clear_target): Move here and rewrite.
10111         * parameters.h (class Parameters): Update declarations.  Add
10112         set_parameters_target_once_ field.
10113         (Parameters::Parameters): Move to parameters.cc.
10114         (Parameters::clear_target): Likewise.
10115         * readsyms.cc (Read_symbols::do_group): Create a Start_group
10116         task.
10117         (Start_group::~Start_group): New function.
10118         (Start_group::is_runnable): New function.
10119         (Start_group::locks, Start_group::run): New functions.
10120         (Finish_group::run): Change saw_undefined to size_t.
10121         * readsyms.h (class Start_group): Define.
10122         (class Finish_group): Change saw_undefined_ field to size_t.
10123         (Finish_group::Finish_group): Remove saw_undefined and
10124         this_blocker parameters.  Change all callers.
10125         (Finish_group::set_saw_undefined): New function.
10126         (Finish_group::set_blocker): New function.
10127         * symtab.h (class Symbol_table): Change saw_undefined to return
10128         size_t.  Change saw_undefined_ field to size_t.
10129         * target-select.cc (Set_target_once::do_run_once): New function.
10130         (Target_selector::Target_selector): Initialize set_target_once_
10131         field.  Don't initialize lock_ and initialize_lock_ fields.
10132         (Target_selector::instantiate_target): Rewrite.
10133         (Target_selector::set_target): New function.
10134         * target-select.h (class Set_target_once): Define.
10135         (class Target_selector): Update declarations.  Make
10136         Set_target_once a friend.  Remove lock_ and initialize_lock_
10137         fields.  Add set_target_once_ field.
10138
10139 2010-02-10  Ian Lance Taylor  <iant@google.com>
10140
10141         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
10142         queueing any tasks.
10143         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
10144         (queue_middle_tasks): Add all blockers before queueing any tasks.
10145         (queue_final_tasks): Likewise.
10146         * token.h (Task_token::add_blockers): New function.
10147         * object.h (Input_objects::number_of_relobjs): New function.
10148
10149 2010-02-10  Ian Lance Taylor  <iant@google.com>
10150
10151         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
10152         shared, not if not position independent.
10153         * x86_64.cc (Relocate::relocate_tls): Likewise.
10154         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
10155         (tls_pie_pic_test): New target.
10156         * testsuite/Makefile.in: Rebuild.
10157
10158         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
10159         (tls_test_main_pie.o, tls_test_pie.o): New targets.
10160         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
10161         * testsuite/Makefile.in: Rebuild.
10162
10163 2010-02-09  David S. Miller  <davem@davemloft.net>
10164
10165         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
10166         R_SPARC_RELATIVE using ->add_local_relative().
10167         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
10168
10169         * output.h (Output_data_dynamic::add_section_size): New method
10170         that takes two Output_data objects.
10171         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
10172         entry param.  Handle it in initializers.
10173         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
10174         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
10175         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
10176         arg.
10177         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
10178         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
10179         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
10180         for dynrel_includes_plt.
10181         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10182         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10183         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
10184         before .rela.plt
10185         (Target_sparc::do_finalize_sections): Update to pass true for
10186         dynrel_includes_plt.
10187         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
10188         output before .rela.plt
10189         (Target_powerpc::do_finalize_sections): Update to pass true for
10190         dynrel_includes_plt when 32-bit.
10191
10192 2010-02-08  Doug Kwan  <dougkwan@google.com>
10193
10194         * arm.cc (Arm_relobj::simple_input_section_output_address): New
10195         method.
10196         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
10197         Arm_relobj::scan_section_for_cortex_a8_stubs,
10198         Arm_relobj::do_relocation_section): Instead of calling
10199         Output_section::output_address, use faster
10200         Arm_relobj::simple_input_section_output_address.
10201
10202 2010-02-08  David S. Miller  <davem@davemloft.net>
10203
10204         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
10205         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
10206         relocation helper function.
10207
10208         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
10209         just like R_SPARC_GOT{10,13,22}.
10210         (Target_sparc::Scan::local): Likewise.
10211         (Target_sparc::Relocate:relocate): Likewise.
10212
10213 2010-02-06  Ian Lance Taylor  <iant@google.com>
10214
10215         * configure.ac: Rewrite targetobjs duplicate removal code to use
10216         only shell constructs.
10217         * configure: Rebuild.
10218
10219 2010-02-05  Doug Kwan  <dougkwan@google.com>
10220
10221         PR 11247
10222         * arm.cc (Arm_relobj::section_is_scannable): New method.
10223         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
10224         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
10225
10226 2010-02-04  Doug Kwan  <dougkwan@google.com>
10227
10228         PR 11247
10229         * arm-reloc-property.cc (cstdio): Include.
10230         * configure.ac (targetobjs): Remove duplicates.
10231         * configure: Regenerate.
10232         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
10233         big and little endian version for a given address size.
10234
10235 2010-02-03  Doug Kwan  <dougkwan@google.com>
10236
10237         * arm-reloc-property.cc
10238         (Arm_reloc_property_table::reloc_name_in_error_message): New method
10239         definition.
10240         * arm-reloc-property.h
10241         (Arm_reloc_property_table::get_implemented_static_reloc_property):
10242         New method definition.
10243         (Arm_reloc_property_table::reloc_name_in_error_message): New method
10244         declaration.
10245         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
10246         overflow to N.
10247         (GOT_PREL): Change implemented to Y.
10248         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
10249         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
10250         (Arm_relocate_functions::movw_abs_nc): Remove method.
10251         (Arm_relocate_functions::movt_abs): Ditto.
10252         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
10253         (Arm_relocate_functions::thm_movt_abs): Ditto.
10254         (Arm_relocate_functions::movw_rel_nc): Ditto.
10255         (Arm_relocate_functions::movw_rel): Ditto.
10256         (Arm_relocate_functions::movt_rel): Ditto.
10257         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
10258         (Arm_relocate_functions:thm_movw_rel): Ditto.
10259         (Arm_relocate_functions:thm_movt_rel): Ditto.
10260         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
10261         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
10262         New method definitions.
10263         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
10264         (Arm_relocation_functions::arm_grp_ldr): Ditto.
10265         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
10266         (Arm_relocation_functions::arm_grp_ldc): Ditto.
10267         (Target_arm::Relocate::relocate): Check for non-static or
10268         unimplemented relocation code and exit early.  Change calls to
10269         Target_arm::reloc_uses_thumb_bit and
10270         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
10271         instead.  Refactor code to handle similar relocations to increase
10272         code sharing.  Remove check for unsupported relocation code in switch
10273         statement.
10274         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
10275         relocation property table to find out size.  Change error message to
10276         print out the name of a relocation code instead of the numeric value.
10277         (Target_arm::scan_reloc_for_stub): Use relocation property table
10278         instead of calling Target_arm::reloc_uses_thumb_bit().
10279
10280 2010-02-02  Doug Kwan  <dougkwan@google.com>
10281
10282         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
10283         types of relaxed input section.
10284
10285 2010-02-02  Doug Kwan  <dougkwan@google.com>
10286
10287         * Makefile.am (HFILES): Add arm-reloc-property.h.
10288         (DEFFILES): New.
10289         (TARGETSOURCES): Add arm-reloc-property.cc
10290         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
10291         (libgold_a_SOURCES): $(DEFFILES)
10292         * Makefile.in: Regenerate.
10293         * arm-reloc-property.cc: New file.
10294         * arm-reloc-property.h: New file.
10295         * arm-reloc.def: New file.
10296         * arm.cc: Update comments.
10297         (arm-reloc-property.h): New included header.
10298         (arm_reloc_property_table): New global variable.
10299         (Target_arm::do_select_as_default_target): New method definition.
10300         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
10301         arm-reloc-property to targ_extra_obj.
10302         * parameters.cc (set_parameters_target): Call
10303         Target::select_as_default_target().
10304         * target.h (Target::select_as_default_target): New method definition.
10305         (Target::do_select_as_default_target): Same.
10306
10307 2010-02-01  Doug Kwan  <dougkwan@google.com>
10308
10309         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
10310         first_output_text_section_.
10311         (Arm_exidx_fixup::first_output_text_section): New method definition.
10312         (Arm_exidx_fixup::first_output_text_section_): New data member.
10313         (Arm_exidx_fixup::process_exidx_section): Record the first text
10314         output section seen.
10315         (Arm_output_section::fix_exidx_coverage): Set correct linked section
10316         and entsize in output section header.
10317
10318 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10319
10320         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
10321         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
10322         (Arm_relocate_functions::thm_alu11): New Method.
10323         (Arm_relocate_functions::thm_pc8): New Method.
10324         (Arm_relocate_functions::thm_pc12): New Method.
10325         (Target_arm::Scan::local): Handle the relocations.
10326         (Target_arm::Scan::global): Likewise.
10327         (Target_arm::Relocate::relocate): Likewise.
10328         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10329
10330 2010-01-29  Doug Kwan  <dougkwan@google.com>
10331
10332         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
10333         of relocation types as ld.
10334
10335 2010-01-29  Doug Kwan  <dougkwan@google.com>
10336
10337         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
10338         to public.
10339         (Arm_relocate_functions::thumb_branch_common): Ditto.
10340         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
10341         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
10342         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
10343         Arm_relocate_functions::jump24): Remove.
10344         (Target_arm::Relocate::relocate): Adjust code to call
10345         Arm_relocation_functions::arm_branch_common and
10346         Arm_relocation_functions::thumb_branch_common instead of their removed
10347         wrappers.  Merge switch-cases together to reduce source code size.
10348
10349 2010-01-29  Doug Kwan  <dougkwan@google.com>
10350
10351         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
10352         output_local_symbol_count_needs_update_.
10353         (Arm_relobj::output_local_symbol_count_needs_update,
10354          Arm_relobj::set_output_local_symbol_count_needs_update,
10355          Arm_relobj::update_output_local_symbol_count): New methods.
10356         (Arm_relobj::output_local_symbol_count_needs_update_): New data
10357         member.
10358         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
10359         of pointed function as in a R_ARM_PREL31 relocation.
10360         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
10361         for output local symbol count updating.
10362         (Target_arm::do_relax): Update output local symbol counts in objects
10363         if necessary.
10364         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
10365
10366 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10367
10368         * arm.cc: Added support for the ARM relocations:
10369         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
10370         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
10371         (Arm_relocate_functions::movw_rel_nc): Renamed (was
10372         movw_prel_nc).
10373         (Arm_relocate_functions::movw_rel): New method.
10374         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
10375         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
10376         thm_movw_prel_nc).
10377         (Arm_relocate_functions::thm_movw_rel): New method.
10378         (Arm_relocate_functions::thm_movt_rel): Renamed (was
10379         thm_movt_prel).
10380         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
10381         relocations.
10382         (Target_arm::Scan::global): Likewise.
10383         (Target_arm::Relocate::relocate): Likewise.
10384         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10385         Likewise.
10386
10387 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10388
10389         * arm.cc: Added support for ARM group relocations.
10390         (Target_arm::reloc_needs_sym_origin): New method.
10391         (Arm_relocate_functions::calc_grp_kn): New method.
10392         (Arm_relocate_functions::calc_grp_residual): New method.
10393         (Arm_relocate_functions::calc_grp_gn): New method.
10394         (Arm_relocate_functions::arm_grp_alu): New Method.
10395         (Arm_relocate_functions::arm_grp_ldr): New Method.
10396         (Arm_relocate_functions::arm_grp_ldrs): New Method.
10397         (Arm_relocate_functions::arm_grp_ldc): New Method.
10398         (Target_arm::Scan::local): Handle the ARM group relocations.
10399         (Target_arm::Scan::global): Likewise.
10400         (Target_arm::Relocate::relocate): Likewise.
10401         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10402         Likewise.
10403
10404 2010-01-26  Doug Kwan  <dougkwan@google.com>
10405
10406         * arm.cc (set): Include.
10407         (class Arm_exidx_fixup): Change type of last_input_section_ to const
10408         pointer type.
10409         (Arm_output_section::Text_section_list): New type.
10410         (Arm_output_section::append_text_sections_to_list): New method.
10411         (Arm_output_section::fix_exidx_coverage): Ditto.
10412         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
10413         (Arm_relobj::convert_input_section_to_relaxed_section): Use
10414         Relobj::set_section_offset() instead of
10415         Sized_relobj::invalidate_section_offset().
10416         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
10417         parameter for section headers. Ignore relocation sections for
10418         unallocated sections and EXIDX sections.
10419         (Target_arm::fix_exidx_coverage): New method.
10420         (Target_arm::output_section_address_less_than): New type.
10421         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
10422         linked text section instead of the EXIDX section.
10423         (Arm_output_section::create_stub_group): Add an assertion to check
10424         that this is not an EXIDX output section.
10425         (Arm_output_section::append_text_sections_to_list): New method.
10426         (Arm_output_section::fix_exidx_coverage): Ditto.
10427         (Arm_relobj::scan_sections_for_stubs): Adjust call to
10428         Arm_relobj::section_needs_reloc_stub_scanning.
10429         (Target_arm::do_relax): Fix EXIDX output section coverage in the
10430         first pass.
10431         (Target_arm::fix_exidx_coverage): New method.
10432         * object.h (Relobj::set_output_section): New method.
10433         (Sized_relobj::invalidate_section_offset): Remove method.
10434         (Sized_relobj::do_invalidate_section_offset): Remove method.
10435         (Sized_relobj::do_set_section_offset): Handle offset value -1.
10436
10437 2010-01-25  Doug Kwan  <dougkwan@google.com>
10438
10439         * arm.cc (Arm_exidx_merged_section::do_output_offset):
10440         Fix warning due to signed and unsigned comparison on a 32-bit host.
10441
10442 2010-01-22  Doug Kwan  <dougkwan@google.com>
10443
10444         * arm.cc (Target_arm::do_relax): Record an output section for section
10445         offset adjustment it contains any stub table that has changed.
10446         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
10447         offsets in an output section if necessary.
10448         * output.cc (Output_section::Output_section): Initialize
10449         section_offsets_need_adjustments_.
10450         (Output_section::add_input_section_for_script): Renamed to
10451         Output_section::add_simple_input_section.
10452         (Output_section::save_states): Add a comment.
10453         (Output_section::discard_states): New method defintion.
10454         (Output_section::adjust_section_offsets): Same.
10455         * output.h (Output_section::add_input_section_for_script): Renamed to
10456         Output_section::add_simple_input_section.
10457         (Output_section::discard_states): New method declaration.
10458         (Output_section::adjust_section_offsets): Same.
10459         (Output_section::section_offsets_need_adjustment,
10460         Output_section::set_section_offsets_need_adjustment): New method
10461         definitions.
10462         (Output_section::section_offsets_need_adjustment_): New data member.
10463         * script-sections.cc
10464         (Output_section_element_input::set_section_address): Adjust code for
10465         renaming of Output_section::add_input_section_for_script.
10466         (Orphan_output_section::set_section_address): Same.
10467
10468 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10469
10470         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
10471         Fix_v4bx enum values .
10472         * gold/options.h (General_options): New option definitions.
10473         (General_options::fix_v4bx): New method.
10474         (General_options::Fix_v4bx): New enum.
10475         * gold/options.cc (General_options::parse_fix_v4bx): New method.
10476         (General_options::parse_fix_v4bx_interworking): New method.
10477
10478 2010-01-22  Doug Kwan  <dougkwan@google.com>
10479
10480         * arm.cc (Arm_exidx_fixup): New class.
10481
10482 2010-01-21  Doug Kwan  <dougkwan@google.com>
10483
10484         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
10485         classes.
10486         (Arm_exidx_section_offset_map): New type.
10487
10488 2010-01-21  Doug Kwan  <dougkwan@google.com>
10489
10490         * arm.cc (Arm_exidx_input_section): New class.
10491         (Arm_relobj::exidx_input_section_by_link,
10492         Arm_relobj::exidx_input_section_by_shndx,
10493         Arm_relobj::make_exidx_input_section): New methods.
10494         (read_arm_attributes_section): Remove.
10495         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
10496         information about them.
10497         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
10498         to here.
10499
10500 2010-01-20  Doug Kwan  <dougkwan@google.com>
10501
10502         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
10503         Input_section_specifier to Section_id.
10504         (Target_arm::new_arm_input_section: Adjust code for change of key
10505         type.
10506         (Target_arm::find_arm_input_section): Ditto.
10507         * gc.h (object.h): Include for Section_id nand Section_id_hash.
10508         (Section_id): Remove.
10509         (Garbage_collection::Section_id_hash): Remove.
10510         * icf.h (object.h): Include for Section_id nand Section_id_hash.
10511         (Section_id): Remove.
10512         (Icf::Section_id_hash): Remove.
10513         * object.h (Section_id, Const_section_id, Section_id_hash,
10514         Const_section_id_hash): New type definitions.
10515         * output.cc (Output_section::add_relaxed_input_section): Change to
10516         use Const_section_id instead of Input_section_specifier as key type.
10517         (Output_section::add_merge_input_section): Ditto.
10518         (Output_section::build_relaxation_map): Change to use Section_id
10519         instead of Input_section_specifier as key type.
10520         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10521         Ditto.
10522         (Output_section::convert_input_sections_to_relaxed_sections): Change
10523         to use Const_section_id instead of Input_section_specifier as key type.
10524         (Output_section::find_merge_section): Ditto.
10525         (Output_section::find_relaxed_input_section): Ditto.
10526         * output.h (Input_section_specifier): Remove class.
10527         (Output_section::Output_section_data_by_input_section_map): Change
10528         key type to Const_section_id.
10529         (Output_section::Output_relaxed_input_section_by_input_section_map):
10530         Ditto.
10531         (Output_section::Relaxation_map): Change key type to Section_id.
10532
10533 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10534
10535         * gold/arm.cc: Added support for R_ARM_V4BX relocation
10536         (class Arm_v4bx_stub): New class.
10537         (DEF_STUBS): Updated definition to support v4_veneer_bx.
10538         (Stub_factory::make_arm_v4bx_stub): New method.
10539         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
10540         (Stub_table::empty): Handle v4bx stubs.
10541         (Stub_table::add_arm_v4bx_stub): New method.
10542         (Stub_table::find_arm_v4bx_stub): New method.
10543         (Arm_relocate_functions::v4bx): New method.
10544         (Target_arm::fix_v4bx): New method.
10545         (Target_arm::Target_arm): Handle R_ARM_V4BX.
10546         (Stub_table::relocate_stubs): Likewise.
10547         (Stub_table::do_write): Likewise.
10548         (Stub_table::update_data_size_and_addralign): Likewise.
10549         (Stub_table::finalize_stubs):  Likewise.
10550         (Target_arm::Scan::local): Likewise.
10551         (Target_arm::Scan::global): Likewise.
10552         (Target_arm::do_finalize_sections): Likewise.
10553         (Target_arm::Relocate::relocate): Likewise.
10554         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10555         Likewise.
10556         (Target_arm::scan_reloc_for_stub): Likewise.
10557         (Target_arm::scan_reloc_section_for_stubs): Likewise.
10558
10559 2010-01-19  Ian Lance Taylor  <iant@google.com>
10560
10561         * output.cc (Output_section_headers::do_sized_write): Write large
10562         segment count to sh_info field.
10563         (Output_file_header::do_sized_write): For large segment count,
10564         write PN_XNUM to e_phnum field.
10565
10566 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10567
10568         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
10569         (Arm_relocate_functions::thm_jump8): New function.
10570         (Arm_relocate_functions::thm_jump11): New function.
10571         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
10572         R_ARM_THM_JUMP11.
10573         (Target_arm::Scan::global): Likewise.
10574         (Target_arm::Relocate::relocate): Likewise.
10575         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10576         Likewise.
10577
10578 2010-01-14  Doug Kwan  <dougkwan@google.com>
10579
10580         * arm.cc (map, utility): Include headers.
10581         (Target_arm::apply_cortex_a8_workaround): New method.
10582         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
10583         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
10584         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
10585         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
10586         the --[no-]fix-cortex-a8 command line options.
10587         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
10588         (Target_arm::relocate_stub): Use addend in instruction template.
10589         * options.h (DEFINE_bool): Set the user-set flag.
10590         (General_options): Add --[no-]-fix-cortex options.
10591         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
10592         : Update fast look-up map after conversion.
10593
10594 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
10595
10596         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
10597         in the first pass of do_layout.
10598
10599 2010-01-13  Doug Kwan  <dougkwan@google.com>
10600
10601         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10602         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
10603         apparent compiler problem of not folding static constant integral
10604         data members of elfcpp::Elf_sizes<32>.
10605
10606 2010-01-13  Doug Kwan  <dougkwan@google.com>
10607
10608         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10609         Arm_relobj::section_needs_cortex_a8_stub_scanning,
10610         Arm_relobj::scan_section_for_cortex_a8_erratum,
10611         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
10612         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
10613         sections to scan for relocation stubs into a new method
10614         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
10615         relocation and Cortex-A8 stub scanning.
10616         (Target_arm::do_relax): Force stubs to be after stubbed sections
10617         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
10618         the beginning of a new relaxation pass.  Update a comment.
10619         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
10620
10621 2010-01-12  Ian Lance Taylor  <iant@google.com>
10622
10623         * target-reloc.h (visibility_error): New inline function.
10624         (relocate_section): Call visibility_error.
10625         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
10626         (MOSTLYCLEANFILES): Likewise.
10627         (protected_4_pic.o, protected_3.err): New targets.
10628         * testsuite/protected_4.cc: New file.
10629
10630 2010-01-12  Doug Kwan  <dougkwan@google.com>
10631
10632         * arm.cc (Cortex_a8_reloc): New class.
10633         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
10634         and cortex_a8_relocs_info_.
10635         (Target_arm::fix_cortex_a8): New method definition.
10636         (Target_arm::Cortex_a8_relocs_info): New type.
10637         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
10638         New data member declarations.
10639         (Target_arm::scan_reloc_for_stub): Record information about
10640         relocations for THUMB branches that might be exempted from the
10641         Cortex-A8 workaround.
10642         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
10643         at the beginning of a relaxation pass.
10644
10645 2010-01-12  Doug Kwan  <dougkwan@google.com>
10646
10647         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
10648         (Arm_relobj::Mapping_symbol_position,
10649          Arm_reloj::Mapping_symbol_position_less,
10650          Arm_relobj::Mapping_symbols_info): New types.
10651         (Target_arm::is_mapping_symbol_name): New method definition.
10652         (Arm_relobj::do_count_local_symbols): Save information about mapping
10653         symbols.
10654
10655 2010-01-11  Doug Kwan  <dougkwan@google.com>
10656
10657         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
10658         Arm_relocate_functions::thumb32_branch_upper,
10659         Arm_relocate_functions::thumb32_branch_lower,
10660         Arm_relocate_functions::thumb32_cond_branch_offset,
10661         Arm_relocate_functions::thumb32_cond_branch_upper,
10662         Arm_relocate_functions::thumb32_cond_branch_lower,
10663         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
10664         branch offset encoding.
10665         (Arm_relocate_functions::thumb_branch_common): Use new branch
10666         offset encoding methods to avoid code duplication.
10667         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
10668         (Stub_addend_reader::operator()): Use new branch encoding method
10669         to avoid code duplication.
10670
10671 2010-01-11  Doug Kwan  <dougkwan@google.com>
10672
10673         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
10674         (Target_arm::do_finalize_sections): Define special EXIDX section
10675         symbols only if referenced.
10676         * gc.h (Garbage_collection::add_reference): New method.
10677         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
10678         code duplication.
10679
10680 2010-01-11  Ian Lance Taylor  <iant@google.com>
10681
10682         * script.cc (Version_script_info::build_expression_list_lookup):
10683         Change complaing about duplicate wildcard match from error to
10684         warning.
10685
10686         * script.cc (class Lazy_demangler): Recreate--revert part of patch
10687         of 2009-12-30.
10688         (Version_script_info::Version_script_info): Initialize globs_,
10689         default_version_, default_is_global_, and exact_.  Don't
10690         initialize globals_ or locals_.
10691         (Version_script_info::build_lookup_tables): Build local symbols
10692         first.
10693         (Version_script_info::unquote): New function.
10694         (Version_script_info::add_exact_match): New function.
10695         (Version_script_info::build_expression_list_lookup): Remove lookup
10696         parameter.  Add is_global parameter.  Change all callers.  Handle
10697         wildcard pattern specially.  Unquote pattern.  Call
10698         add_exact_match.
10699         (Version_script_info::get_name_to_match): New function.
10700         (Version_script_info::get_symbol_version): New function.
10701         (Version_script_info::get_symbol_version_helper): Remove.
10702         (Version_script_info::check_unmatched_names): Call unquote.
10703         * script.h (class Version_script_info): Change get_symbol_version
10704         to be non-inline and add is_global parameter; change all callers.
10705         Rewrite symbol_is_local.  Update declarations.  Define struct
10706         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
10707         Remove globals_ and locals_ members.  Add exact_, globs_,
10708         default_version_, is_global_.
10709         (Version_script_info::Glob): Remove pattern, add expression and
10710         is_global.  Update constructor.  Change all callers.
10711         * dynobj.cc (Versions::finalize): Mark the version symbol as the
10712         default version.
10713         (Versions::symbol_section_contents): If a symbol is undefined, or
10714         defined in a dynamic object, set the version index to
10715         VER_NDX_LOCAL.
10716         * symtab.cc (Symbol_table::add_from_relobj): Don't call
10717         symbol_is_local.
10718         (Symbol_table::add_from_pluginobj): Likewise.
10719         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
10720
10721 2010-01-11  Doug Kwan  <dougkwan@google.com>
10722
10723         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
10724         (incremental_dump_LDADD): Add linking option for libintl.
10725         * Makefile.in: Regenerate.
10726
10727 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
10728
10729         PR gold/11144
10730         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
10731         instead of -Ds.
10732         * testsuite/Makefile.in: Regenerated.
10733
10734 2010-01-10  Doug Kwan  <dougkwan@google.com>
10735
10736         * options.h (DEFINE_var): Use parentheses around argument varname__
10737         in macro body to avoid any unintended subsequent substitutions.
10738
10739 2010-01-10  Ian Lance Taylor  <iant@google.com>
10740
10741         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
10742         candidates before doing symbol resolution.
10743
10744         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
10745         ODR candidates if only one is weak.
10746
10747 2010-01-08  Ian Lance Taylor  <iant@google.com>
10748
10749         * script.cc (Version_script_info::build_expression_list_lookup):
10750         Don't warn about ambiguous version, just record the ambiguity.
10751         (Version_script_info::get_symbol_version_helper): Give error if
10752         version is ambiguous.
10753
10754 2010-01-08  Doug Kwan  <dougkwan@google.com>
10755
10756         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
10757         prev_data_size_ and prev_addralign_.  Remove initializer for
10758         deleted data member has_been_changed_.
10759         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
10760         to determine if the table is empty.
10761         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
10762         Remove.
10763         (Stub_table::add_reloc_stub): Define method in class definition
10764         instead of just declaring it there.
10765         (Stub_table::add_cortex_a8_stub): New method definition.
10766         (Stub_table::update_data_size_and_addralign): Ditto.
10767         (Stub_table::finalize_stubs): Ditto.
10768         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
10769         (Stub_table::do_addralign_): Return address alignment in the
10770         (Stub_table::do_reset_address_and_file_offset): Define method in
10771         class definition instead of declaring it there.  Set current data
10772         size to be the data size of the previous pass.
10773         (Stub_table::set_final_data_size): Use current data size as the
10774         final data size.
10775         (Stub_table::relocate_stub): Change parameter type of stub from
10776         Reloc_stub pointer to Stub pointer.
10777         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10778         (Stub_table::Cortex_a8_stub_list): New typedef.
10779         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10780          Stub_table::prev_addralign_): New data member.
10781         (Arm_relobj::Arm_relobj): Initialize data member
10782         section_has_cortex_a8_workaround_.
10783         (Arm_relobj::section_has_cortex_a8_workaround,
10784          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
10785          definitions.
10786         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10787         declarations.
10788         (Target_arm::relocate_stub): Change parameter type of stub from
10789         Reloc_stub pointer to Stub pointer.
10790         (Insn_template::size, Insn_template::alignment): Handle
10791         THUMB16_SPECIAL_TYPE.
10792         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10793          Stub_table::update_data_size_and_addralign,
10794          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10795         definitions.
10796         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10797         (Stub_table::do_write): Ditto.
10798         (Target_arm::do_relax): Adjust code for changes in Stub_table.
10799
10800 2010-01-08  Ian Lance Taylor  <iant@google.com>
10801
10802         PR 11108
10803         * symtab.h (class Symbol): Remove fields is_target_special_ and
10804         has_plt_offset_.  Add field is_defined_in_discarded_section_.
10805         (Symbol::is_defined_in_discarded_section): New function.
10806         (Symbol::set_is_defined_in_discarded_section): New function.
10807         (Symbol::has_plt_offset): Rewrite.
10808         (Symbol::set_plt_offset): Verify that new offset is not -1U.
10809         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10810         Don't initialize is_target_special_ or has_plt_offset_.
10811         Initialize is_defined_in_discarded_section_.
10812         (Symbol_table::add_from_relobj): If appropriate, set
10813         is_defined_in_discarded_section.
10814         * resolve.cc (Symbol::override_base_with_special): Don't test
10815         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
10816         * target-reloc.h (relocate_section): Do special handling for
10817         symbols defined in discarded sections for global symbols as well
10818         as local symbols.
10819
10820 2010-01-08  Ian Lance Taylor  <iant@google.com>
10821
10822         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10823         the SHT_SYMTAB case.
10824
10825 2010-01-08  Ian Lance Taylor  <iant@google.com>
10826
10827         * object.cc (Sized_relobj::do_layout): Don't get confused if
10828         layout_eh_frame returns NULL.
10829
10830 2010-01-08  Ian Lance Taylor  <iant@google.com>
10831
10832         PR 11084
10833         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10834         dynamic symbol table, use the normal symbol table.
10835         (Sized_dynobj::do_read_symbols): Remove assertion about type of
10836         symbol table.
10837
10838 2010-01-08  Ian Lance Taylor  <iant@google.com>
10839
10840         PR 11072
10841         * layout.cc (Layout::include_section): Remove .gnu_debuglink
10842         sections.
10843
10844 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
10845
10846         * version.cc (print_version): Change to "Copyright 2010".
10847
10848 2010-01-08  Ian Lance Taylor  <iant@google.com>
10849
10850         PR 10287
10851         PR 11063
10852         * i386.cc (class Target_i386): Change return type of plt_section
10853         to be non-const.
10854         (class Output_data_plt_i386): Add tls_desc_rel_ field.
10855         (Output_data_plt_i386::Output_data_plt_i386): Initialize
10856         tls_desc_rel_ field.
10857         (Output_data_plt_i386::rel_tls_desc): New function.
10858         (Target_i386::rel_tls_desc_section): New function.
10859         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
10860         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
10861         R_386_TLS_DESC reloc in rel_tls_desc_section.
10862         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
10863         Define struct Tlsdesc_info.
10864         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
10865         (Target_x86_64::do_reloc_symbol_index): New function.
10866         (Target_x86_64::add_tlsdesc_info): New function.
10867         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
10868         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
10869         tlsdesc_rel_ field.
10870         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
10871         all callers.
10872         (Output_data_plt_x86_64::rela_tlsdesc): New function.
10873         (Target_x86_64::rela_tlsdesc_section): New function.
10874         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
10875         handling.
10876         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
10877         (Target_x86_64::do_reloc_addend): New function.
10878         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
10879         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
10880         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
10881         (Output_reloc::type): New function.
10882         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
10883         (Output_reloc::is_target_specific): New function.
10884         (Output_reloc::target_arg): New function.
10885         (class Output_reloc) [SHT_RELA]: Add four new constructors for
10886         absolute relocs and target specific relocs.
10887         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
10888         add_target_specific.
10889         (class Output_data_reloc) [SHT_RELA]: Likewise.
10890         * output.cc (Output_reloc::Output_reloc): Add four new versions
10891         for absolute relocs and target specific relocs.
10892         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
10893         (Output_reloc::get_symbol_index): Likewise.
10894         (Output_reloc::local_section_offset): Check that local_sym_index_
10895         is not TARGET_CODE or 0.
10896         (Output_reloc::symbol_value): Likewise.
10897         (Output_reloc::write) [SHT_RELA]: Call target for target specific
10898         reloc.
10899         * target.h (class Target): Add reloc_symbol_index and reloc_addend
10900         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
10901         functions.
10902         * layout.cc (add_target_dynamic_tags): Use output section for
10903         DT_PLTRELSZ and DT_JMPREL.
10904
10905 2010-01-07  Ian Lance Taylor  <iant@google.com>
10906
10907         PR 11061
10908         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
10909         function.
10910         (class Output_data_reloc_generic): Define.
10911         (class Output_data_reloc_base): Change base class to
10912         Output_data_reloc_generic.  Change add() method to call
10913         bump_relative_reloc_count for a relative reloc.  Remove
10914         sort_relocs_ field.
10915         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
10916         to sort_relocs().
10917         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10918         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
10919         appropriate.
10920         * layout.h (class Layout): Update declaration.
10921
10922 2010-01-07  Ian Lance Taylor  <iant@google.com>
10923
10924         * output.h (class Output_data): Add const version of
10925         output_section and do_output_section.
10926         (class Output_section_data): Add const version of
10927         do_output_section.
10928         (class Output_section): Likewise.
10929         * layout.cc (Layout::add_target_dynamic_tags): New function.
10930         * layout.h (class Layout): Update declarations.
10931         * arm.cc (Target_arm::do_finalize_sections): Use
10932         add_target_dynamic_tags.
10933         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10934         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10935         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10936         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10937
10938 2010-01-07  Ian Lance Taylor  <iant@google.com>
10939
10940         PR 11042
10941         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10942         object as needed.
10943
10944 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
10945             Ian Lance Taylor  <iant@google.com>
10946
10947         PR 11019
10948         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
10949         Xindex::read_symtab_xindex.
10950
10951 2010-01-07  Doug Kwan  <dougkwan@google.com>
10952
10953         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
10954         (Insn_template::thumb16_bcond_insn): New method declaration.
10955         (Insn_template): Fix spelling.
10956         (Stub::thumb16_special): New method declaration.
10957         (Stub::do_write): Define virtual method which was previously pure
10958         virtual.
10959         (Stub::do_thumb16_special): New method declaration.
10960         (Stub::do_fixed_endian_write): New template member.
10961         (Reloc_stub::do_write): Remove.
10962         (Reloc_stub::do_fixed_endian_write): Remove.
10963         (Cortex_a8_stub): New class definition.
10964         (Stub_factory::make_cortex_a8_stub): New method definition.
10965         (Stub_factory::Stub_factory): Add missing static storage class
10966         qualifier for elf32_arm_stub_a8_veneer_blx.
10967
10968 2010-01-07  Ian Lance Taylor  <iant@google.com>
10969
10970         PR 10980
10971         * options.h (class General_options): Add --warn-unresolved-symbols
10972         and --error-unresolved-symbols.
10973         * errors.cc (Errors::undefined_symbol): Implement
10974         --warn-unresolved-symbols.
10975
10976         * options.h (class General_options): Add -z text and -z textoff.
10977         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10978
10979 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
10980
10981         * gc.h (Garbage_collection::Cident_section_map): New typedef.
10982         (Garbage_collection::cident_sections): New function.
10983         (Garbage_collection::add_cident_section): New function.
10984         (Garbage_collection::cident_sections_): New member.
10985         (gc_process_relocs): Add references to sections whose names are C
10986         identifiers.
10987         * gold.h (cident_section_start_prefix): New constant.
10988         (cident_section_stop_prefix): New constant.
10989         (is_cident): New function.
10990         * layout.cc (Layout::define_section_symbols): Replace string constants
10991         with the newly defined constants.
10992         * object.cc (Sized_relobj::do_layout): Track sections whose names are
10993         C identifiers.
10994         * testsuite/Makefile.am: Add gc_orphan_section_test.
10995         * testsuite/Makefile.in: Regenerate.
10996         * testsuite/gc_orphan_section_test.cc: New file.
10997         * testsuite/gc_orphan_section_test.sh: New file.
10998
10999 2010-01-06  Ian Lance Taylor  <iant@google.com>
11000
11001         PR 10980
11002         * options.h (class General_options): Add --warn-shared-textrel.
11003         * layout.cc (Layout::finish_dynamic_section): Implement
11004         --warn-shared-textrel.
11005
11006         PR 10980
11007         * options.h (class General_options): Add --warn-multiple-gp.
11008
11009 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11010
11011         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
11012         $(THREADSLIB) and $(LIBDL).
11013         * Makefile.in: Rebuild.
11014
11015 2010-01-06  Ian Lance Taylor  <iant@google.com>
11016
11017         PR 10980
11018         * options.cc (General_options::parse_section_start): New function.
11019         (General_options::section_start): New function.
11020         (General_options::General_options): Initialize all members.
11021         * options.h: Include <map>
11022         (class General_options): Add --section-start.  Add section_starts_
11023         member.
11024         * layout.cc (Layout::attach_allocated_section_to_segment): If
11025         --section-start was used, set the address of the segment.  Remove
11026         local sort_sections.
11027         (Layout::relaxation_loop_body): If the address of the load segment
11028         has been set by --section-start, don't use it.
11029         * output.h (Output_segment::update_flags_for_output_section): New
11030         function.
11031         * output.cc (Output_segment::add_output_section): Call
11032         update_flags_for_output_section.
11033
11034 2010-01-05  Ian Lance Taylor  <iant@google.com>
11035
11036         PR 10980
11037         * options.h (class General_options): Add --undefined-version.
11038         * script.cc (struct Version_expression): Add was_matched_by_symbol
11039         field.
11040         (Version_script_info::matched_symbol): New function.
11041         (Version_script_info::get_symbol_version_helper): Call
11042         matched_symbol.
11043         (Version_script_info::check_unmatched_names): New function.
11044         * script.h (class Version_script_info): Update declarations.
11045         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
11046
11047         * options.h (class General_options): Use DEFINE_bool_alias for
11048         allow_multiple_definition.
11049         * resolve.cc (Symbol_table::should_override): Don't test
11050         allow_multiple_definition.
11051
11052         PR 10980
11053         * options.h (class General_options): Add --cref.
11054         * main.cc (main): Print cref table if --cref.  Don't close mapfile
11055         until after printing cref table.
11056         * cref.cc: Include "symtab.h".
11057         (class Cref_inputs): Define Cref_table_compare and Cref_table.
11058         (Cref_table_compare::operator()): New function.
11059         (Cref_inputs::gather_cref): New function.
11060         (filecol): New static const.
11061         (Cref_inputs::print_cref): New function.
11062         (Cref::print_cref): New function.
11063         * cref.h: Include <cstdio>.
11064         (class Cref): Update declarations.
11065         * mapfile.h (Mapfile::file): New function.
11066         * object.h (class Object): Define Symbols.  Declare virtual
11067         do_get_global_symbols.
11068         (Object::get_global_symbols): New function.
11069         * object.cc (Input_objects::add_object): Pass object to cref_ if
11070         --cref.
11071         (Input_objects::archive_start): Likewise.
11072         (Input_objects::archive_stop): Likewise.
11073         (Input_objects::print_cref): New function.
11074         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
11075         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
11076         --cref.
11077         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
11078         function.
11079         * plugin.h (class Sized_pluginobj): Update declarations.
11080
11081 2010-01-05  Ian Lance Taylor  <iant@google.com>
11082
11083         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
11084         to is_default_version.  Rename insdef to insdefault.
11085         (Symbol_table::add_from_relobj): Rename def to is_default_version
11086         and local to is_forced_local.
11087         (Symbol_table::add_from_pluginobj): Likewise.
11088         (Symbol_table::add_from_dynobj): Likewise.
11089         (Symbol_table::define_special_symbol): Rename insdef to
11090         insdefault.
11091
11092 2010-01-04  Ian Lance Taylor  <iant@google.com>
11093
11094         PR 10980
11095         * options.h (class General_options): Add
11096         --allow-multiple-definition and -z muldefs.
11097         * resolve.cc (Symbol_table::should_override): Don't warn about a
11098         multiple symbol definition if --allow-multiple-definition or -z
11099         muldefs.
11100
11101         PR 10980
11102         * options.h (class General_options): Add --add-needed and
11103         --copy-dt-needed-entries.  Tweak --as-needed help entry.
11104         * object.cc (Input_objects::check_dynamic_dependencies): Give an
11105         error if --copy-dt-needed-entries aka --add-needed is used and
11106         would cause a change in behaviour.
11107
11108         PR 10980
11109         * options.h (class General_options): Add -G as a short version of
11110         --shared.  Add no-op options -assert, -g, and -i.
11111
11112 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
11113
11114         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
11115         check for .text or .gnu.linkonce.t sections.
11116         * icf.cc (Icf::find_identical_sections): Ditto.
11117         Change the detection for mangled function name within the section
11118         name.
11119         * icf.h (is_section_foldable_candidate): New function.
11120
11121 2009-12-30  Ian Lance Taylor  <iant@google.com>
11122
11123         PR 10980
11124         * options.h (class General_options): Permit two dashes with
11125         --retain-symbols-file.
11126
11127 2009-12-30  Ian Lance Taylor  <iant@google.com>
11128
11129         PR 10979
11130         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
11131         don't put the file header and segment headers in the text
11132         segment.
11133
11134         PR 10979
11135         * common.cc (Sort_commons::operator()): Stabilize sort when both
11136         entries are NULL.
11137         (Symbol_table::do_allocate_commons_list): When allocating common
11138         symbols, skip a symbol which is no longer common.
11139         * symtab.h (Symbol::is_common): Test whether the symbol comes from
11140         an object before checking its type.
11141         * testsuite/common_test_2.c: New file.
11142         * testsuite/common_test_3.c: New file.
11143         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
11144         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
11145         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
11146         (common_test_2_pic.o, common_test_2.so): New targets.
11147         (common_test_3_pic.o, common_test_3.so): New targets.
11148         * testsuite/Makefile.in: Rebuild.
11149
11150         PR 10979
11151         * script.cc (read_input_script): If we see a new SECTIONS clause,
11152         and we have added an input section, give an error.
11153         * layout.h (class Layout): Add have_added_input_section function.
11154         Add have_added_input_section_ field.
11155         * layout.cc (Layout::Layout): Initialize
11156         have_added_input_section_.
11157         (Layout::layout): Set have_added_input_section_.
11158         (Layout::layout_eh_frame): Likewise.
11159
11160 2009-12-30  Ian Lance Taylor  <iant@google.com>
11161
11162         PR 10931
11163         * options.h (class General_options): Add --sort-common option.
11164         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
11165         * common.cc (Sort_common): Add sort_order parameter to
11166         constructor.  Add sort_order_ field.
11167         (Sort_commons::operator): Check sort_order_.
11168         (Symbol_table::allocate_commons): Determine the sort order.
11169         (Symbol_table::do_allocate_commons): Add sort_order parameter.
11170         Change all callers.
11171         (Symbol_table::do_allocate_commons_list): Likewise.
11172
11173 2009-12-30  Ian Lance Taylor  <iant@google.com>
11174
11175         PR 10916
11176         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
11177         symbols from this object, don't change the visibility of an
11178         undefined symbol.
11179         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
11180
11181 2009-12-30  Ian Lance Taylor  <iant@google.com>
11182
11183         PR 10861
11184         * script.h (class Version_script_info): Define Language enum.
11185         Update declarations.  Define Glob, Exact, and Lookup types.  Add
11186         new fields globals_, locals_, and is_finalized_.
11187         * script.cc: Various formatting fixes.
11188         (class Parser_closure): Change language_stack_ from a vector of
11189         std::string to one of Version_script_info::Language.  Adjust all
11190         uses accordingly.
11191         (class Lazy_demangler): Remove.
11192         (struct Version_expression): Change language from std::string to
11193         Version_script_info::Language.
11194         (Version_script_info::Version_script_info): New function.
11195         (Version_script_info::~Version_script_info): Don't call clear.
11196         (Version_script_info::finalize): New function.
11197         (Version_script_info::build_lookup_tables): New function.
11198         (Version_script_info::build_expression_list_lookup): New
11199         function.
11200         (Version_script_info::get_symbol_version_helper): Rewrite to use
11201         lookup tables.
11202         (Version_script_info::print_expression_list): Adjust to use
11203         Version_script_info::Language.
11204         (script_push_lex_into_version_mode): Check that the version script
11205         has not been finalized.
11206         (version_script_push_lang): Change language string to
11207         Version_script_info::Language.
11208         * options.cc (Command_line::version_script): New function.
11209         * options.h (class General_options): Add finalize_dynamic_list
11210         function.  Change version_script from declaration to definition.
11211         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
11212         * testsuite/version_script.map: Remove duplicate def of foo.
11213         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
11214         version_script.map.
11215         * testsuite/Makefile.in: Rebuild.
11216
11217 2009-12-30  Ian Lance Taylor  <iant@google.com>
11218
11219         PR 10843
11220         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
11221         if the input symbol index is 0, make the output symbol index 0.
11222
11223 2009-12-30  Ian Lance Taylor  <iant@google.com>
11224
11225         PR 10670
11226         * options.h (class General_options): Add -x/--discard-all.
11227         * object.cc (Sized_relobj::do_count_local_symbols): Handle
11228         --discard-all.  If the local symbol needs a dynamic entry, check
11229         that before handling --discard-locals.
11230
11231 2009-12-30  Ian Lance Taylor  <iant@google.com>
11232
11233         PR 10450
11234         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
11235         flags to PF_R.
11236         (Output_segment::add_output_section): Don't change the flags if
11237         the type is PT_TLS.
11238
11239         PR 10450
11240         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
11241         GNU hash table if they need a dynamic value.  Otherwise, don't add
11242         them if they are defined in a dynamic object or are forced local.
11243
11244 2009-12-29  Ian Lance Taylor  <iant@google.com>
11245
11246         PR 10450
11247         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
11248         .gnu.hash table for a 32-bit target.
11249
11250         PR 10450
11251         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
11252         regular and a dynamic object only needs a dynamic symbol table
11253         entry if it is externally visible.
11254
11255         PR 10450
11256         * i386.cc (class Target_i386): Initialize global_offset_table_ in
11257         constructor.  Add global_offset_table_ field.
11258         (Target_i386::got_section): Set global_offset_table_.
11259         (Target_i386::do_finalize_sections): Set global_offset_table_
11260         size.
11261         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
11262         in constructor.  Add global_offset_table_ field.
11263         (Target_x86_64::got_section): Set global_offset_table_.
11264         (Target_x86_64::do_finalize_sections): Set global_offset_table_
11265         size.
11266
11267         * layout.cc (Layout::Layout): Initialize increase_relro_.
11268         (Layout::get_output_section): Add is_relro, is_last_relro, and
11269         is_first_non_relro parameters.  Change all callers.
11270         (Layout::choose_output_section): Likewise.
11271         (Layout::add_output_section_data): Likewise.
11272         (Layout::make_output_section): Likewise.
11273         (Layout::set_segment_offsets): Clear increase_relro when using a
11274         linker script.
11275         * layout.h (class Layout): Add increase_relro method.  Add
11276         increase_relro_ field.  Update declarations.
11277         * output.cc (Output_section::Output_section): Initialize
11278         is_last_relro_ and is_first_non_relro_.
11279         (Output_segment::add_output_section): Group relro sections is
11280         do_sort is true.  Handle is_last_relro and is_first_non_relro.
11281         (Output_segment::maximum_alignment): Remove relro handling.
11282         (Output_segment::set_section_addresses): Add increase_relro
11283         parameter.  Change all callers.  Add initial alignment to align
11284         relro sections on separate page.  Remove old relro handling.
11285         (Output_segment::set_section_list_addresses): Remove in_relro
11286         parameter.  Change all callers.
11287         (Output_segment::set_offset): Add increase parameter.  Change all
11288         callers.  Remove old relro handling.
11289         * output.h (class Output_section): Add new methods: is_last_relro,
11290         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
11291         Add is_last_relro_ and is_first_non_relro_ fields.
11292         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
11293         Create separate .got.plt section.  Call increase_relro.
11294         * x86_64.cc (Target_x86_64::got_section): Likewise.
11295         * testsuite/relro_script_test.t: Add .got.plt.
11296
11297         PR 10450
11298         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
11299         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
11300         (Layout::finalize): Call set_dynamic_symbol_size.
11301         (Layout::set_dynamic_symbol_size): New function.
11302         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
11303         set_dynamic_symbol_size.
11304
11305         PR 10450
11306         * output.h (class Output_section): Add is_entsize_zero_ field.
11307         * output.cc (Output_section::Output_section): Initialize
11308         is_entsize_zero_.
11309         (Output_section::set_entsize): If two different entsizes are
11310         requested, force it to zero.
11311         (Output_section::add_input_section): Set flags for .debug_str
11312         before updating section flags.  Set entsize.
11313         (Output_section::update_flags_for_input_section): Set SHF_MERGE
11314         and SHF_STRING if all input sections have those flags.
11315
11316 2009-12-29   Rafael Espindola  <espindola@google.com>
11317
11318         * main.cc (main): Fix the sys time reporting.
11319         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
11320         reporting.
11321
11322 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
11323
11324         * options.cc (General_options::parse_version): Allow -v to exit
11325         without an error if there is nothing to link.
11326
11327 2009-12-29  Ian Lance Taylor  <iant@google.com>
11328
11329         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
11330         using a version of gcc before 4.1.
11331         * configure: Rebuild.
11332
11333 2009-12-28  Chris Demetriou  <cgd@google.com>
11334
11335         * attributes.cc (Output_attributes_section_data::do_write): Use
11336         std::vector::front rather than std::vector::data.
11337
11338 2009-12-28  Ian Lance Taylor  <iant@google.com>
11339
11340         * symtab.h (class Symbol_table): Add enum Defined.
11341         * resolve.cc (Symbol_table::should_override): Add defined
11342         parameter.  Change all callers.  Test whether object is NULL
11343         before calling a method on it.
11344         (Symbol_table::report_resolve_problem): Add defined parameter.
11345         Change all callers.
11346         (Symbol_table::should_override_with_special): Likewise.
11347         * symtab.cc (Symbol_table::define_in_output_data): Add defined
11348         parameter.  Change all callers.
11349         (Symbol_table::do_define_in_output_data): Likewise.
11350         (Symbol_table::define_in_output_segment): Likewise.
11351         (Symbol_table::do_define_in_output_segment): Likewise.
11352         (Symbol_table::define_as_constant): Likewise.
11353         (Symbol_table::do_define_as_constant): Likewise.
11354         * script.h (class Symbol_assignment): Add is_defsym parameter to
11355         constructor; change all callers.
11356         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
11357         parameter.  Change all callers.  Add is_defsym_ field.
11358         (class Parser_closure): Add parsing_defsym parameter to
11359         constructor; change all callers.  Add parsing_defsym accessor
11360         function.  Add parsing_defsym_ field.
11361
11362 2009-12-28  Ian Lance Taylor  <iant@google.com>
11363
11364         * gold.cc (queue_middle_tasks): Fix formatting.
11365         * object.cc (Relobj::is_section_name_included): Likewise.
11366
11367 2009-12-23  Ian Lance Taylor  <iant@google.com>
11368
11369         * i386.cc (Target_i386::do_calls_non_split): Recognize
11370         -fsplit-stack prologue for a function with a static chain.
11371         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
11372         -fsplit-stack prologue when using %r11.
11373
11374 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
11375
11376         * options.cc (General_options::parse_version): Make -v continue and do
11377         the link like GNU ld does.
11378
11379 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
11380
11381         * Makefile.am (CCFILES): Add timer.cc.
11382         (HFILES): Add timer.h.
11383         * configure.ac: Check for sysconf and times.
11384         * main.cc: include timer.h.
11385         (main): Use Timer instead of get_run_time.
11386         * timer.cc: New.
11387         * timer.h: New.
11388         * workqueue.cc: include timer.h.
11389         (Workqueue::find_and_run_task):
11390         Report user, sys and wall time.
11391         * Makefile.in: Regenerate.
11392         * config.in: Regenerate.
11393         * configure: Regenerate.
11394
11395 2009-12-16  Doug Kwan  <dougkwan@google.com>
11396
11397         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
11398         sections.
11399         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
11400         relaxed input sections.
11401         * output.cc (Output_section::find_relaxed_input_section): Change
11402         return type to Output_relaxed_input_section pointer.  Adjust code
11403         for new type of relaxed_input_section_map_.
11404         * output.h (Output_section::find_relaxed_input_section): Change
11405         return type to Output_relaxed_input_section pointer.
11406         (Output_section::Output_relaxed_input_section_by_input_section_map):
11407         New type.
11408         (Output_section::relaxed_input_section_map_): Change type to
11409         Output_section::Output_relaxed_input_section_by_input_section_map.
11410         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
11411         input section.
11412
11413 2009-12-15  Ian Lance Taylor  <iant@google.com>
11414
11415         * layout.cc (Layout::create_shstrtab): Only write out after input
11416         sections if we are compressing debug sections.
11417
11418 2009-12-15  Ian Lance Taylor  <iant@google.com>
11419
11420         * archive.cc (Archive::add_symbols): Only look up a symbol without
11421         a version if there is, in fact, a version.
11422
11423 2009-12-14  Ian Lance Taylor  <iant@google.com>
11424
11425         Revert -Wshadow changes, all changes from:
11426         2009-12-11  Doug Kwan  <dougkwan@google.com>
11427         2009-12-11  Nick Clifton  <nickc@redhat.com>
11428         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
11429
11430 2009-12-11  Doug Kwan  <dougkwan@google.com>
11431
11432         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
11433         due to -Wshadow.
11434         * attributes.cc (Object_attribute::size): Ditto.
11435         (Attributes_section_data::size): Ditto.
11436         (Attributes_section_data::Attributes_section_data): Ditto.
11437         (Output_attributes_section_data::do_write): Ditto.
11438         * attributes.h (Object_attribute::set_type): Ditto.
11439         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
11440
11441 2009-12-11  Nick Clifton  <nickc@redhat.com>
11442
11443         * archive.cc: Fix shadowed variable warnings.
11444         * arm.cc: Likewise.
11445         * compressed_output.cc: Likewise.
11446         * compressed_output.h: Likewise.
11447         * configure: Likewise.
11448         * dwarf_reader.cc: Likewise.
11449         * dynobj.cc: Likewise.
11450         * dynobj.h: Likewise.
11451         * ehframe.cc: Likewise.
11452         * ehframe.h: Likewise.
11453         * errors.cc: Likewise.
11454         * expression.cc: Likewise.
11455         * fileread.cc: Likewise.
11456         * fileread.h: Likewise.
11457         * freebsd.h: Likewise.
11458         * i386.cc: Likewise.
11459         * icf.cc: Likewise.
11460         * incremental.h: Likewise.
11461         * layout.cc: Likewise.
11462         * layout.h: Likewise.
11463         * mapfile.cc: Likewise.
11464         * merge.cc: Likewise.
11465         * merge.h: Likewise.
11466         * object.cc: Likewise.
11467         * object.h: Likewise.
11468         * options.h: Likewise.
11469         * output.cc: Likewise.
11470         * output.h: Likewise.
11471         * parameters.cc: Likewise.
11472         * plugin.cc: Likewise.
11473         * powerpc.cc: Likewise.
11474         * reduced_debug_output.cc: Likewise.
11475         * reduced_debug_output.h: Likewise.
11476         * reloc.cc: Likewise.
11477         * reloc.h: Likewise.
11478         * resolve.cc: Likewise.
11479         * script-sections.cc: Likewise.
11480         * script.cc: Likewise.
11481         * script.h: Likewise.
11482         * sparc.cc: Likewise.
11483         * symtab.cc: Likewise.
11484         * symtab.h: Likewise.
11485         * target-select.cc: Likewise.
11486         * target-select.h: Likewise.
11487         * token.h: Likewise.
11488         * workqueue.cc: Likewise.
11489         * workqueue.h: Likewise.
11490         * x86_64.cc: Likewise.
11491
11492 2009-12-10  Doug Kwan  <dougkwan@google.com>
11493
11494         * arm.cc (attributes.h): New include.
11495         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
11496         (Arm_relobj::~Arm_relobj): Delete object pointed by
11497         attributes_section_data_.
11498         (Arm_relobj::attributes_section_data): New method definition.
11499         (Arm_relobj::attributes_section_data_): New data member declaration.
11500         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
11501         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
11502         attributes_section_data_.
11503         (Arm_dynobj::attributes_section_data): New method definition.
11504         (Arm_dynobj::attributes_section_data_): New data member declaration.
11505         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
11506         initialization value of may_use_blx_ to false.
11507         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
11508         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
11509         object attributes to compute results instead of hard-coding.
11510         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
11511         Target_arm::get_secondary_compatible_arch,
11512         Target_arm::set_secondary_compatible_arch
11513         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11514         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
11515         New method declarations.
11516         (Target_arm::get_aeabi_object_attribute): New method definition.
11517         (Target_arm::attributes_section_data_): New data member declaration.
11518         (read_arm_attributes_section): New template definition.
11519         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
11520         (Arm_dynobj::do_read_symbols): Ditto.
11521         (Target_arm::do_finalize_sections): Merge attributes sections from
11522         input.  Check for BLX use after attributes section merging.
11523         Fix __exidx_start and __exidx_end visibility.  Create an
11524         .ARM.attributes section if necessary.
11525         (Target_arm::get_secondary_compatible_arch,
11526         Target_arm::set_secondary_compatible_arch,
11527         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11528         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
11529         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
11530         New method definitions.
11531
11532 2009-12-09  Ian Lance Taylor  <iant@google.com>
11533
11534         * plugin.cc (Plugin::load): Don't cast from void* to a function
11535         pointer.
11536
11537 2009-12-09  Ian Lance Taylor  <iant@google.com>
11538
11539         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
11540         information fields.
11541
11542 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
11543
11544         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
11545         Replace two_file_shared_1.so with two_file_shared_2.so.
11546         * testsuite/Makefile.in: Regenerated.
11547
11548 2009-12-08  Doug Kwan  <dougkwan@google.com>
11549
11550         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
11551         (HFILES): Add attributes.h and int_encoding.h.
11552         * Makefile.in: Regenerate.
11553         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
11554         function definitions to int_encoding.cc
11555         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
11556         prototypes to int_encoding.h
11557         * reduced_debug_output.cc (int_encoding.h): New include.
11558         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
11559         function definitions to int_encoding.cc
11560         (insert_into_vector, read_from_pointer): Move template definitions to
11561         int_encoding.h
11562         * attributes.cc: New file.
11563         * attributes.h: New file.
11564         * int_encoding.cc: New file.
11565         * int_encoding.h: New file.
11566
11567 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
11568
11569         PR gold/11055
11570         * incremental-dump.cc (dump_incremental_inputs): New.
11571         (main): Use dump_incremental_inputs.
11572
11573 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
11574
11575         PR gold/10893
11576         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
11577         checking elfcpp::STT_FUNC.
11578         (Target_i386::Relocate::relocate): Likewise.
11579         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
11580
11581         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
11582         symbols from shared libraries into normal FUNC symbols.
11583
11584         * symtab.h (Symbol): Add is_func and use it.
11585
11586 2009-12-05  Doug Kwan  <dougkwan@google.com>
11587
11588         * arm.cc (Target_arm::arm_info): Initialize new fields
11589         attributes_section and attributes_vendor.
11590         * i386.cc (Target_i386::i386_info): Same.
11591         * object.cc (Sized_relobj::do_layout): Skip attribute section.
11592         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
11593         fields attributes_section and attributes_vendor.
11594         * sparc.cc (Target_sparc::sparc_info): Same.
11595         * target.h (Target::attributes_section, Target::attributes_vendor,
11596         Target::is_attributes_section, Target::attribute_arg_type,
11597         Target::attributes_order): New method definitions.
11598         (Target::Target_info::attributes_section,
11599         Target::Target_info::attributes_vendor): New fields.
11600         (Target::do_attribute_arg_type, Target::do_attributes_order): New
11601         virtual method definitions.
11602         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
11603         attributes_section and attributes_vendor.
11604         * testsuite/testfile.cc (Target_test::test_target_info): Same.
11605
11606 2009-12-05  Doug Kwan  <dougkwan@google.com>
11607
11608         * arm.cc: Update comments about interworking and stub generation.
11609         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
11610         considered as non-PIC.
11611         (Arm_relocate_functions::base_abs): Fix formatting.
11612         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
11613         of function to use GOT entry address instead of offset.
11614         (Target_arm::Scan::global): Issue an error if a symbol would need a
11615         PLT does not get one because it is untyped.  Remove code to create
11616         dynamic symbols for relative branches.
11617         (Target_arm::Relocate::relocate: Use 0 instead of false since function
11618         takes unsigned integer instead of boolean.
11619
11620 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
11621
11622         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
11623         (two_file_test_LDADD): Likewise.
11624         (common_test_1_LDADD): Likewise.
11625         (exception_test_LDADD) Likewise.
11626         (weak_test_LDADD): Likewise.
11627         (many_sections_test_LDADD): Likewise.
11628         (initpri1_LDADD): Likewise.
11629         (script_test_1_LDADD): Likewise.
11630         (script_test_2_LDADD): Likewise.
11631         (justsyms_LDADD): Likewise.
11632         (binary_test_LDADD): Likewise.
11633         (large_LDADD): Likewise.
11634         * testsuite/Makefile.in: Regenerated.
11635
11636 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
11637
11638         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
11639         (Symbol_table::override_with_special): Likewise.
11640         (Symbol_table::add_from_object): Likewise.
11641
11642 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
11643
11644         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11645         Don't set the data_offset twice.
11646
11647 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
11648
11649         * testsuite/Makefile.in: Regenerate.
11650
11651 2009-12-03  Doug Kwan  <dougkwan@google.com>
11652
11653         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
11654         (Target_arm::do_finalize_sections): Add parameter for symbol table
11655         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
11656         * i386.cc (Target_i386::do_finalize_sections): Add an additional
11657         parameter for symbol table pointer.
11658         * layout.cc (Layout::finalize): Call Target::finalize_sections with
11659         an additional parameter for a pointer to symbol table.
11660         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
11661         parameter for a symbol table pointer.
11662         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
11663         * target.h (Target::finalize_sections, Target::do_finalize_sections):
11664         Ditto.
11665         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
11666         parameter for a symbol table pointer.
11667
11668 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
11669
11670         * incremental.cc (Incremental_inputs_header)
11671         (Incremental_inputs_header_write, Incremental_inputs_entry)
11672         (Incremental_inputs_entry_write): Move ...
11673         * incremental.h (Incremental_inputs_header)
11674         (Incremental_inputs_header_write, Incremental_inputs_entry)
11675         (Incremental_inputs_entry_write): here.
11676
11677 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11678
11679         * incremental.cc (make_sized_incremental_binary): Set the target.
11680         Error if it is incompatible.
11681         * output.h (Output_file): Add filename method.
11682
11683 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11684
11685         * incremental.cc (Incremental_inputs_entry): Remove unused argument
11686         from the get_* methods.
11687
11688 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11689
11690         * incremental-dump.cc (main): Check that the offeset of a script is 0.
11691         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11692         Write 0 for the data_offset of scripts.
11693
11694 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11695
11696         * testsuite/Makefile.am: Add the incremental_test.sh test.
11697         * testsuite/incremental_test.sh: New.
11698         * testsuite/incremental_test_1.c: New.
11699         * testsuite/incremental_test_2.c: New.
11700
11701 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
11702
11703         * incremental-dump.cc (main): Fix typos.
11704
11705 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
11706
11707         PR gold/11025
11708         * incremental-dump.cc (main): Use llu to print 64 bit values.
11709
11710 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
11711             H.J. Lu  <hongjiu.lu@intel.com>
11712
11713         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
11714         $(LIBDL).
11715         (incremental_dump_LDADD): Likewise.
11716         * Makefile.in: Regenerated.
11717
11718 2009-11-25  Doug Kwan  <dougkwan@google.com>
11719
11720         Revert:
11721
11722         2009-11-25  Doug Kwan  <dougkwan@google.com>
11723
11724                 * arm.cc (Target_arm::Target_arm): Move method definition
11725                 outside of class definition.  Add code to handle
11726                 --target1-rel, --target1-abs and --target2= options.
11727                 (Target_arm::get_reloc_reloc_type): Change method to be
11728                 non-static and const.
11729                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
11730                 New data member declaration.
11731                 (Target_arm::Scan::local, Target_arm::Scan::global,
11732                 Target_arm::Relocate::relocate,
11733                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11734                 Adjust call to Target_arm::get_real_reloc_type.
11735                 (Target_arm::get_real_reloc_type): Use command line options
11736                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11737                 * options.h (--target1-rel, --target1-abs, --target2): New
11738                 ARM-only options.
11739
11740 2009-11-25  Doug Kwan  <dougkwan@google.com>
11741
11742         * arm.cc (Target_arm::Target_arm): Move method definition outside of
11743         class definition.  Add code to handle --target1-rel, --target1-abs
11744         and --target2= options.
11745         (Target_arm::get_reloc_reloc_type): Change method to be non-static
11746         and const.
11747         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
11748         member declaration.
11749         (Target_arm::Scan::local, Target_arm::Scan::global,
11750         Target_arm::Relocate::relocate,
11751         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
11752         call to Target_arm::get_real_reloc_type.
11753         (Target_arm::get_real_reloc_type): Use command line options to
11754         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11755         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
11756         options.
11757
11758 2009-11-25  Doug Kwan  <dougkwan@google.com>
11759
11760         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
11761         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
11762         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
11763         formatting.
11764         (Arm_relocate_functions::thm_call): Replace body with a call to
11765         Arm_relocate_functions::thumb_branch_common.
11766         (Arm_relocate_functions::thm_jump24,
11767         Arm_relocate_functions::thm_xpc22): New method definitions.
11768         (Arm_relocate_functions::thumb_branch_common): New method definition.
11769         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
11770         operator.
11771         (Target_arm::Relocate::relocate): Adjust call to thm_call.
11772         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
11773
11774 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11775
11776         * Makefile.am: Build incremental-dump
11777         * Makefile.in: Regenerate.
11778         * incremental-dump.cc: New.
11779         * incremental.cc (Incremental_inputs_header_data,
11780         Incremental_inputs_entry_data): Move to incremental.h
11781         * incremental.h: (Incremental_inputs_header_data,
11782         Incremental_inputs_entry_data): Move from incremental.cc
11783
11784 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11785
11786         * incremental.cc (Incremental_inputs_header,
11787         Incremental_inputs_header_write, Incremental_inputs_entry,
11788         Incremental_inputs_entry_write): Add a typedef with the data type.
11789
11790 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11791
11792         * incremental.cc (Incremental_inputs_header,
11793         Incremental_inputs_header_write, Incremental_inputs_entry,
11794         Incremental_inputs_entry_write): Update comment about which
11795         type has the filed descriptions.
11796
11797 2009-11-15  Doug Kwan  <dougkwan@google.com>
11798
11799         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11800         (Arm_relocate_functions::arm_branch_common): Change method defintion
11801         in class definition to a method declaration and update list of formal
11802         parameters.
11803         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11804         Arm_relocation_functions::jump24): Adjust call to
11805         Arm_relocate_functions::arm_branch_common.  Update list of formal
11806         parameters.
11807         (Arm_relocate_functions::xpc25): New method definition.
11808         (Arm_relocate_functions::arm_branch_common): Move method defintion
11809         out from class definition.  Use stubs for mode-switching and extending
11810         branch ranges.
11811         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11812         specially.  Change code to enable use of stubs in ARM branches.
11813
11814 2009-11-10  Doug Kwan  <dougkwan@google.com>
11815
11816         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11817         in method declaration.
11818         (Target_arm::relocate_stub): New method declaration.
11819         (Target_arm::default_target): Change to return a pointer instead of
11820         a const reference.
11821         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11822         Target_arm::default_target.
11823         (Arm_Relobj::do_relocate_sections): Remove options paramater in
11824         method definition.
11825         (Target_arm::relocate_section): Adjust view.
11826         (Target_arm::relocate_stub): New method definition.
11827
11828 2009-11-10  Doug Kwan  <dougkwan@google.com>
11829
11830         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11831         a format warning.
11832         * incremental.cc (open_incremental_binary): Initialized local
11833         variables to avoid warnings.
11834         * object.cc (make_elf_object): Ditto.
11835         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11836         a format warning.
11837
11838 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
11839
11840         PR gold/10930
11841         * testsuite/plugin_test.c: Include "config.h".
11842
11843 2009-11-09  Doug Kwan  <dougkwan@google.com>
11844
11845         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
11846         (arm_symbol_value): Remove.
11847         (Arm_relocate_functions::arm_branch_common,
11848         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
11849         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
11850         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
11851         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
11852         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
11853         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
11854         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
11855         Arm_relocate_functions::thm_mobw_abs_nc,
11856         Arm_relocate_functions::thm_mov_abs,
11857         Arm_relocate_functions::movw_prel_nc,
11858         Arm_relocate_functions::thm_movt_abs,
11859         Arm_relocate_functions::movt_prel,
11860         Arm_relocate_functions::thm_movw_prel_nc,
11861         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
11862         (Target_arm::Relocate::relocate): Only decompose address into two
11863         parts if relocation type uses the thumb-bit and pass the actual
11864         bit instead of a flag indicating that the thumb-bit is used.  Adjust
11865         calls to methods in Arm_relocate_functions for this change.
11866
11867 2009-11-08  Ian Lance Taylor  <iant@google.com>
11868
11869         PR 10925
11870         * reloc.cc: Instantiate
11871         Sized_relobj::initialize_input_to_output_maps and
11872         Sized_relobj:free_input_to_output_maps.
11873
11874 2009-11-06  Ian Lance Taylor  <iant@google.com>
11875
11876         PR 10876
11877         * defstd.cc (in_segment): Set only_if_ref true for "end".
11878
11879 2009-11-06  Doug Kwan  <dougkwan@google.com>
11880
11881         * arm.cc (class Reloc_stub): Correct a comment.
11882         (Target_arm::Target_arm): Initialize arm_input_section_map_.
11883         (Target_arm::scan_section_for_stubs): New method declaration.
11884         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
11885         Change methods from private to protected.
11886         (Target_arm::do_may_relax): New method definition.
11887         (Target_arm::do_relax, Target_arm::group_sections,
11888         Target_arm::scan_reloc_for_stub,
11889         Target_arm::scan_reloc_section_for_stubs): New method declarations.
11890         (Target_arm::arm_input_section_map_): New data member declaration.
11891         (Target_arm::scan_reloc_for_stub,
11892         Target_arm::scan_reloc_section_for_stubs,
11893         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
11894         Target_arm::do_relax): New method definitions.
11895
11896 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
11897
11898         * configure.ac: Check for (struct stat)::st_mtim
11899         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
11900         * config.in: Regenerate.
11901         * configure: Regenerate.
11902
11903 2009-11-05  Ian Lance Taylor  <iant@google.com>
11904
11905         PR 10910
11906         * output.cc (Output_segment::add_output_section): Add missing
11907         return statement.
11908
11909 2009-11-04  Ian Lance Taylor  <iant@google.com>
11910
11911         PR 10880
11912         * object.h (class Object): Add is_needed and set_is_needed
11913         methods.  Add is_needed_ field.  Make bool fields into bitfields.
11914         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
11915         defined in a dynamic object and referenced by a regular object,
11916         set is_needed for the dynamic object.
11917         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11918         if the file is marked with as_needed and it is not needed.
11919
11920 2009-11-04  Ian Lance Taylor  <iant@google.com>
11921
11922         PR 10887
11923         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11924         tags if data is discarded by linker script.
11925         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11926         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11927         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11928         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11929
11930 2009-11-04  Ian Lance Taylor  <iant@google.com>
11931
11932         * layout.cc (Layout::get_output_section): Add is_interp and
11933         is_dynamic_linker_section parameters.  Change all callers.
11934         (Layout::choose_output_section): Likewise.
11935         (Layout::make_output_section): Likewise.
11936         (Layout::add_output_section_data): Add is_dynamic_linker_section
11937         parameter.  Change all callers.
11938         * layout.h (class Layout): Update declarations.
11939         * output.h (class Output_section): Add is_interp, set_is_interp,
11940         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11941         Add is_interp_, is_dynamic_linker_section_ fields.  Change
11942         generate_code_fills_at_write_ to a bitfield.
11943         * output.cc (Output_section::Output_sections): Initialize new
11944         fields.
11945         (Output_segment::add_output_section): Add do_sort parameter.
11946         Change all callers.
11947
11948 2009-11-03  Ian Lance Taylor  <iant@google.com>
11949
11950         PR 10860
11951         * options.h (class General_options): Add --warn-common.
11952         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
11953         merging two common symbols.
11954         (Symbol_table::should_override): Handle --warn-common when merging
11955         a common symbol with a defined symbol.  Use report_resolve_problem
11956         for multiple definitions.
11957         (Symbol_table::report_resolve_problem): New function.
11958         * symtab.h (class Symbol_table): Declare report_resolve_problem.
11959
11960 2009-11-03  Doug Kwan  <dougkwan@google.com>
11961
11962         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
11963         stub_factory_.
11964         (Target_arm::stub_factory): New method definition.
11965         (Target_arm::new_arm_input_section,
11966         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
11967         Target_arm::reloc_uses_thumb_bit): New method declarations.
11968         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
11969         New type definitions.
11970         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
11971         member declarations.
11972         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
11973         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
11974         New method definitions.
11975
11976 2009-11-03  Ian Lance Taylor  <iant@google.com>
11977
11978         * options.h (class General_options): Add --warn_constructors.
11979
11980 2009-11-03  Ian Lance Taylor  <iant@google.com>
11981
11982         PR 10893
11983         * defstd.cc (in_section): Add entries for __rel_iplt_start,
11984         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11985
11986 2009-11-03  Ian Lance Taylor  <iant@google.com>
11987
11988         PR 10895
11989         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11990         --msgid-bugs-address.
11991         (install-pdf): New target.
11992         (install-data_yes): Look up one directory to find mkinstalldirs.
11993
11994 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
11995
11996         * po/Make-in (.po.gmo): Don't generate .gmo files in source
11997         tree.
11998
11999 2009-10-30  Doug Kwan  <dougkwan@google.com>
12000
12001         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
12002
12003 2009-10-30  Doug Kwan  <dougkwan@google.com>
12004
12005         * arm.cc (Stub_addend_reader): New struct template definition
12006         and partial specializations.
12007         (Stub_addend_reader::operator()): New method definition for a
12008         partially specialized template.
12009
12010 2009-10-30  Doug Kwan  <dougkwan@google.com>
12011
12012         * arm.cc (Arm_relobj::processor_specific_flags): New method
12013         definition.
12014         (Arm_relobj::do_read_symbols): New method declaration.
12015         (Arm_relobj::processor_specific_flags_): New data member declaration.
12016         (Arm_dynobj): New class definition.
12017         (Target_arm::do_finalize_sections): Add input_objects parameter.
12018         (Target_arm::do_adjust_elf_header): New method declaration.
12019         (Target_arm::are_eabi_versions_compatible,
12020         (Target_arm::merge_processor_specific_flags): New method declaration.
12021         (Target_arm::do_make_elf_object): New overloaded method definitions
12022         and declaration.
12023         (Arm_relobj::do_read_symbols): New method definition.
12024         (Arm_dynobj::do_read_symbols): Ditto.
12025         (Target_arm::do_finalize_sections): Add input_objects parameters.
12026         Merge processor-specific flags from all input objects.
12027         (Target_arm::are_eabi_versions_compatible,
12028         Target_arm::merge_processor_specific_flags,
12029         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
12030         New method definitions.
12031         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
12032         Input_objects pointer type parameter.
12033         * layout.cc (Layout::finalize): Pass input objects to target's.
12034         finalize_sections function.
12035         * output.cc (Output_file_header::do_sized_write): Set ELF file
12036         header's processor-specific flags.
12037         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
12038         Input_objects pointer type parameter.
12039         * sparc.cc (Target_sparc::do_finalize_sections): Same.
12040         * target.h (Input_objects): New forward class declaration.
12041         (Target::processor_specific_flags,
12042         Target::are_processor_specific_flags_sect): New method definitions.
12043         (Target::finalize_sections): Add input_objects parameter.
12044         (Target::Target): Initialize processor_specific_flags_ and
12045         are_processor_specific_flags_set_.
12046         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
12047         parameter.
12048         (Target::set_processor_specific_flags): New method definition.
12049         (Target::processor_specific_flags_,
12050         Target::are_processor_specific_flags_set_): New data member
12051         declarations.
12052         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
12053         Input_objects pointer type parameter.
12054
12055 2009-10-30  Doug Kwan  <dougkwan@google.com>
12056
12057         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
12058
12059 2009-10-28  Ian Lance Taylor  <iant@google.com>
12060
12061         * object.h (class Relobj): Drop options parameter from
12062         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
12063         do_scan_relocs, do_relocate.  Change all callers.
12064         (class Sized_relobj): Drop options parameters from
12065         do_gc_process_relocs, do_scan_relocs, do_relocate,
12066         do_relocate_sections, relocate_sections, emit_relocs_scan,
12067         emit_relocs_scan_reltype.  Change all callers.
12068         (struct Relocate_info): Remove options field and all references to
12069         it.
12070         * reloc.h (class Read_relocs): Remove options constructor
12071         parameter and options_ field.  Change all callers.
12072         (class Gc_process_relocs, class Scan_relocs): Likewise.
12073         (class Relocate_task): Likewise.
12074         * target-reloc.h (scan_relocs): Remove options parameter.  Change
12075         all callers.
12076         (scan_relocatable_relocs): Likewise.
12077         * target.h (class Sized_target): Remove options parameter from
12078         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
12079         all callers.
12080         * gc.h (gc_process_relocs): Remove options parameter.  Change all
12081         callers.
12082         * arm.cc: Update functions to remove options parameters.
12083         * i386.cc: Likewise.
12084         * powerpc.cc: Likewise.
12085         * sparc.cc: Likewise.
12086         * x86_64.cc: Likewise.
12087         * testsuite/testfile.cc: Likewise.
12088
12089 2009-10-28  Doug Kwan  <dougkwan@google.com>
12090
12091         * arm.cc (Arm_relobj): New class definition.
12092         (Arm_relobj::scan_sections_for_stubs,
12093         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
12094         New method definitions.
12095
12096 2009-10-28  Cary Coutant  <ccoutant@google.com>
12097
12098         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
12099         (Plugin::cleanup_done_): New member.
12100         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
12101         (Plugin_manager::cleanup_done_): Remove.
12102         (Plugin_manager::add_input_file): Edit error message.
12103         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
12104         (Plugin_manager::cleanup): Remove use of cleanup_done_.
12105
12106 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
12107
12108         * fileread.cc: (File_read::View::~View): Use the new
12109         data_ownership_ filed.
12110         (File_read::~File_read): Dispose the new whole_file_view_.
12111         (File_read::open): Mmap the whole file if needed.
12112         (File_read::open): Use whole_file_view_ instead of contents_.
12113         (File_read::find_view): Use whole_file_view_ if applicable.
12114         (File_read::do_read): Use whole_file_view_ instead of contents_.
12115         (File_read::make_view): Use whole_file_view_ instead of contents_,
12116         update File_read::View::View call.
12117         (File_read::find_or_make_view): Update File_read::View::View
12118         call.
12119         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
12120         remove contents_
12121         (File_read::View::Data_ownership): New enum.
12122         (File_read::View::View): Replace bool mapped_ with Data_ownership
12123         argument.
12124         (File_read::View::mapped_): Remove (replaced by data_ownership_).
12125         (File_read::View::data_ownership_): New field.
12126         (File_read::contents_): Remove (replaced by whole_file_view_).
12127         (File_read::whole_file_view_): New field.
12128         * options.h (class General_options): Add --keep-files-mapped.
12129
12130 2009-10-27  Cary Coutant  <ccoutant@google.com>
12131
12132         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
12133         * testsuite/Makefile.am (plugin_test_5): New test case.
12134         * testsuite/Makefile.in: Regenerate.
12135
12136 2009-10-25  Doug Kwan  <dougkwan@google.com>
12137
12138         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
12139         from private to protected to allow access by child class.
12140         (Sized_relobj::do_relocate_sections): New method declaration.
12141         (Sized_relobj::relocate_sections): Virtualize.
12142         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
12143         Sized_relobj::relocate_sections.  Instantiate template explicitly
12144         for different target sizes and endianity.
12145
12146 2009-10-24  Doug Kwan  <dougkwan@google.com>
12147
12148         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
12149         (Arm_input_section::as_arm_input_section): New method.
12150         (Arm_output_section): New class definition.
12151         (Arm_output_section::create_stub_group,
12152         Arm_output_section::group_sections): New method definitions.
12153
12154 2009-10-22  Doug Kwan  <dougkwan@google.com>
12155
12156         * arm.cc (Arm_input_section): New class definition.
12157         (Arm_input_section::init, Arm_input_section:do_write,
12158         Arm_input_section::set_final_data_size,
12159         Arm_input_section::do_reset_address_and_file_offset): New method
12160         definitions.
12161
12162 2009-10-21  Doug Kwan  <dougkwan@google.com>
12163
12164         * arm.cc (Stub_table, Arm_input_section): New forward class
12165         declarations.
12166         (Stub_table): New class defintion.
12167         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
12168         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
12169         New method definition.
12170
12171 2009-10-21  Doug Kwan  <dougkwan@google.com>
12172
12173         * arm.cc: Update copyright comments.
12174         (Target_arm): New forward class template declaration.
12175         (Arm_address): New type.
12176         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
12177         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
12178         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
12179         constants.
12180         (Insn_template): Same.
12181         (DEF_STUBS): New macro.
12182         (Stub_type): New enum type.
12183         (Stub_template): New class definition.
12184         (Stub): Same.
12185         (Reloc_stub): Same.
12186         (Stub_factory): Same.
12187         (Target_arm::Target_arm): Initialize may_use_blx_ and
12188         should_force_pic_veneer_.
12189         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
12190         Target_arm::should_force_pic_veneer,
12191         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
12192         Target_arm::using_thumb_only, Target_arm:;default_target): New
12193         method defintions.
12194         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
12195         New data member declarations.
12196         (Insn_template::size, Insn_template::alignment): New method defintions.
12197         (Stub_template::Stub_template): New method definition.
12198         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
12199         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
12200         (Stub_factory::Stub_factory): New method definition.
12201         * gold.h (string_hash): New template.
12202         * output.h (Input_section_specifier::hash_value): Use
12203         gold::string_hash.
12204         (Input_section_specifier::string_hash): Remove.
12205         * stringpool.cc (Stringpool_template::string_hash): Use
12206         gold::string_hash.
12207
12208 2009-10-20  Doug Kwan  <dougkwan@google.com>
12209
12210         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
12211         symbols of relaxed input sections.
12212         * output.h (Output_section::find_relaxed_input_section): Make
12213         method public.
12214
12215 2009-10-16  Doug Kwan  <dougkwan@google.com>
12216
12217         * dynobj.cc (Versions::Versions): Initialize version_script_.
12218         Only insert base version symbol definition for a shared object
12219         if version script defines any version versions.
12220         (Versions::define_base_version): New method definition.
12221         (Versions::add_def): Check that base version is not needed.
12222         (Versions::add_need): Define base version lazily.
12223         * dynobj.h (Versions::define_base_version): New method declaration.
12224         (Versions::needs_base_version_): New data member declaration.
12225         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
12226         (check_DATA): Add no_version_test.stdout.
12227         (libno_version_test.so, no_version_test.o no_version_test.stdout):
12228         New make rules.
12229         * testsuite/Makefile.in: Regenerate.
12230         * testsuite/no_version_test.c: New file.
12231         * testsuite/no_version_test.sh: Ditto.
12232
12233 2009-10-16  Doug Kwan  <dougkwan@google.com>
12234
12235         * expression.cc (class Segment_start_expression): New class definition.
12236         (Segment_start_expression::value): New method definition.
12237         (script_exp_function_segment_start): Return a new
12238         Segment_start_expression.
12239         * gold/script-c.h (script_saw_segment_start_expression): New function
12240         prototype.
12241         * script-sections.cc (Script_sections::Script_sections): Initialize
12242         SAW_SEGMENT_START_EXPRESSION_ to false.
12243         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
12244         and -Tbbs options to specify section addresses if given in
12245         command line and no SEGMENT_START expression is seen in a script.
12246         * script-sections.h (Script_sections::saw_segment_start_expression,
12247         Script_sections::set_saw_segment_start_expression): New method
12248         definition.
12249         (Script_sections::saw_segment_start_expression_): New data member
12250         declaration.
12251         * script.cc (script_saw_segment_start_expression): New function.
12252         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
12253         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
12254         script_test_7.sh and script_test_8.sh.
12255         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
12256         script_test_8.stdout.
12257         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
12258         (script_test_6, script_test_6.stdout, script_test_7,
12259         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
12260         * Makefile.in: Regenerate.
12261         * testsuite/script_test_6.sh: New file.
12262         * testsuite/script_test_6.t: Same.
12263         * testsuite/script_test_7.sh: Same.
12264         * testsuite/script_test_7.t: Same.
12265         * testsuite/script_test_8.sh: Same.
12266
12267 2009-10-16  Doug Kwan  <dougkwan@google.com>
12268
12269         * output.cc (Output_segment::set_section_list_address): Cast
12270         expressions to unsigned long long type to avoid format warnings.
12271
12272 2009-10-15  Ian Lance Taylor  <iant@google.com>
12273
12274         * script.cc (Script_options::add_symbol_assignment): Always add a
12275         dot assignment to script_sections_.
12276         * script-sections.cc (Script_sections::add_dot_assignment):
12277         Initialize if necessary.
12278
12279         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
12280         program headers with no load segment if there is a linker script.
12281
12282         * layout.cc (Layout::set_segment_offsets): Align the file offset
12283         to the segment aligment for -N or -n with no load segment.
12284         * output.cc (Output_segment::add_output_section): Don't crash if
12285         the first section is a TLS section.
12286         (Output_segment::set_section_list_addresses): Print an error
12287         message if the address moves backward in a linker script.
12288         * script-sections.cc
12289         (Output_section_element_input::set_section_addresses): Don't
12290         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
12291         (Orphan_output_section::set_section_addresses): Likewise.
12292
12293 2009-10-15  Doug Kwan  <dougkwan@google.com>
12294
12295         * layout.cc (Layout::finish_dynamic_section): Generate tags
12296         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
12297         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
12298         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
12299
12300 2009-10-14  Ian Lance Taylor  <iant@google.com>
12301
12302         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
12303         fields.
12304         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
12305         data_shdr fields of relinfo.
12306         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
12307         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
12308         R_386_TLS_LDO_32, adjust based on section flags.
12309         (Target_i386::Relocate::fix_up_ldo): Remove.
12310
12311 2009-10-13  Ian Lance Taylor  <iant@google.com>
12312
12313         Add support for -pie.
12314         * options.h (class General_options): Add -pie and
12315         --pic-executable.
12316         (General_options::output_is_position_independent): Test -pie.
12317         (General_options::output_is_executable): Return true if not shared
12318         and not relocatable.
12319         (General_options::output_is_pie): Remove.
12320         * options.cc (General_options::finalize): Reject incompatible uses
12321         of -pie.
12322         * gold.cc (queue_middle_tasks): A -pie link is not static.
12323         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
12324         * symtab.cc (Symbol::final_value_is_known): Return false if
12325         output_is_position_independent.
12326         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
12327         output_is_position_independent.
12328         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
12329         output_is_position_independent.
12330         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
12331         output_is_position_independent.
12332         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
12333         two_file_pie_test.
12334         (basic_pie_test.o, basic_pie_test): New targets.
12335         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
12336         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
12337         (two_file_pie_test): New target.
12338         * testsuite/Makefile.in: Rebuild.
12339         * README: Remove note saying that -pie is not supported.
12340
12341 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
12342
12343         * options.h (class General_options): Add -init and -fini.
12344         * layout.cc (Layout::finish_dynamic_section): Emit
12345         given init and fini functions.
12346
12347 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
12348
12349         * gc.h (gc_process_relocs): Check if icf is enabled using new
12350         function.
12351         * gold.cc (queue_initial_tasks): Likewise.
12352         (queue_middle_tasks): Likewise.
12353         * object.cc (do_layout): Likewise.
12354         * symtab.cc (is_section_folded): Likewise.
12355         * main.cc (main): Likewise.
12356         * reloc.cc (Read_relocs::run): Likewise.
12357         (Sized_relobj::do_scan_relocs): Likewise.
12358         * icf.cc (is_function_ctor_or_dtor): New function.
12359         (Icf::find_identical_sections): Check if function is ctor or dtor when
12360         safe icf is chosen.
12361         * options.h (General_options::icf): Change option to be an enum.
12362         (Icf_status): New enum.
12363         (icf_enabled): New method.
12364         (icf_safe_folding): New method.
12365         (set_icf_status): New method.
12366         (icf_status_): New variable.
12367         * (options.cc) (General_options::finalize): Set icf_status_.
12368         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
12369         icf_test and icf_keep_unique_test to use the --icf enum flag.
12370         * testsuite/icf_safe_test.sh: New file.
12371         * testsuite/icf_safe_test.cc: New file.
12372
12373 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
12374
12375         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
12376         includes to gc.h and icf.h.
12377         * arm.cc: Include gc.h.
12378         * gold.cc: Likewise.
12379         * i386.cc: Likewise.
12380         * powerpc.cc: Likewise.
12381         * sparc.cc: Likewise.
12382         * x86_64.cc: Likewise.
12383         * gc.h: Include icf.h.
12384
12385 2009-10-11  Ian Lance Taylor  <iant@google.com>
12386
12387         * plugin.cc: Include "gold.h" before other header files.
12388
12389 2009-10-10  Chris Demetriou  <cgd@google.com>
12390
12391         * options.h (Input_file_argument::Input_file_type): New enum.
12392         (Input_file_argument::is_lib_): Replace with...
12393         (Input_file_argument::type_): New member.
12394         (Input_file_argument::Input_file_argument): Take Input_file_type
12395         'type' rather than boolean 'is_lib' as second argument.
12396         (Input_file_argument::is_lib): Use type_.
12397         (Input_file_argument::is_searched_file): New function.
12398         (Input_file_argument::may_need_search): Handle is_searched_file.
12399         * options.cc (General_options::parse_library): Support -l:filename.
12400         (General_options::parse_just_symbols): Update for Input_file_argument
12401         changes.
12402         (Command_line::process): Likewise.
12403         * archive.cc (Archive::get_file_and_offset): Likewise.
12404         * plugin.cc (Plugin_manager::release_input_file): Likewise.
12405         * script.cc (read_script_file, script_add_file): Likewise.
12406         * fileread.cc (Input_file::Input_file): Likewise.
12407         (Input_file::will_search_for): Handle is_searched_file.
12408         (Input_file::open): Likewise.
12409         * readsyms.cc (Read_symbols::get_name): Likewise.
12410         * testsuite/Makefile.am (searched_file_test): New test.
12411         * testsuite/Makefile.in: Regenerate.
12412         * testsuite/searched_file_test.cc: New file.
12413         * testsuite/searched_file_test_lib.cc: New file.
12414
12415 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12416             Ian Lance Taylor  <iant@google.com>
12417
12418         * descriptor.cc: Include <cstdio> and "binary-io.h".
12419         (Descriptors::open): Open the files in binary mode always.
12420         * script.cc (Lex::get_token): Treat \r as whitespace.
12421
12422 2009-10-09  Ian Lance Taylor  <iant@google.com>
12423
12424         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
12425
12426 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12427             Ian Lance Taylor  <iant@google.com>
12428
12429         * configure.ac: Check for readv function also.
12430         * fileread.cc (readv): Define if not HAVE_READV.
12431         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
12432         does not exist.
12433         * config.in: Regenerate.
12434         * configure: Regenerate.
12435
12436 2009-10-09  Doug Kwan  <dougkwan@google.com>
12437
12438         * layout.cc (Layout::make_output_section): Call target hook to make
12439         ordinary output section.
12440         (Layout::finalize): Adjust parameter list of call the
12441         Target::may_relax().
12442         * layout.h (class Layout::section_list): New method.
12443         * merge.h (Output_merge_base::entsize): Change visibility to public.
12444         (Output_merge_base::is_string, Output_merge_base::do_is_string):
12445         New methods.
12446         (Output_merge_string::do_is_string): New method.
12447         * object.cc (Sized_relobj::do_setup): renamed from
12448         Sized_relobj::set_up.
12449         * object.h (Sized_relobj::adjust_shndx,
12450         Sized_relobj::initializ_input_to_output_maps,
12451         Sized_relobj::free_input_to_output_maps): Change visibilities to
12452         protected.
12453         (Sized_relobj::setup): Virtualize.
12454         (Sized_relobj::do_setup): New method declaration.
12455         (Sized_relobj::invalidate_section_offset,
12456         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
12457         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
12458         * options.cc (parse_int): New function.
12459         * options.h (parse_int): New declaration.
12460         (DEFINE_int): New macro.
12461         (stub_group_size): New option.
12462         * output.cc (Output_section::Output_section): Initialize memebers
12463         merge_section_map_, merge_section_by_properties_map_,
12464         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
12465         (Output_section::add_input_section): Handled deferred code-fill
12466         generation and remove an old comment.
12467         (Output_section::add_relaxed_input_section): New method definition.
12468         (Output_section::add_merge_input_section): Use merge section by
12469         properties map to speed to search.  Update merge section maps
12470         as appropriate.
12471         (Output_section::build_relaxation_map): New method definition.
12472         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
12473         Same.
12474         (Output_section::relax_input_section): Renamed to
12475         Output_section::convert_input_sections_to_relaxed_sections and change
12476         interface to take a vector of pointers to relaxed sections.
12477         (Output_section::find_merge_section,
12478         Output_section::find_relaxed_input_section): New method definitions.
12479         (Output_section::is_input_address_mapped,
12480         Output_section::output_offset, Output_section::output_address):
12481         Use output section data maps to speed up searching.
12482         (Output_section::find_starting_output_address): Add comments.
12483         (Output_section::do_write,
12484         Output_section::write_to_postprocessing_buffer): Do code-fill
12485         generation as appropriate.
12486         (Output_section::get_input_sections): Invalidate relaxed input section
12487         map.
12488         (Output_section::restore_states): Adjust type of checkpoint .
12489         Invalidate relaxed input section map.
12490         * output.h (Output_merge_base): New class declaration.
12491         (Input_section_specifier): New class defintion.
12492         (class Output_relaxed_input_section) Change base class to
12493         Output_section_data_build.
12494         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
12495         base class initializer.
12496         (Output_section::add_relaxed_input_section): New method declaration.
12497         (Output_section::Input_section): Change visibility to protected.
12498         (Output_section::Input_section::relobj,
12499         Output_section::Input_section::shndx): Handle relaxed input sections.
12500         Output_section::input_sections) Change visibility to protected.  Also
12501         define overload to return a non-const pointer.
12502         (Output_section::Merge_section_properties): New class defintion.
12503         (Output_section::Merge_section_by_properties_map,
12504         Output_section::Output_section_data_by_input_section_map,
12505         Output_section::Relaxation_map): New types.
12506         (Output_section::relax_input_section): Rename method to
12507         Output_section::convert_input_sections_to_relaxed_sections and change
12508         interface to take a vector of relaxed section pointers.
12509         (Output_section::find_merge_section,
12510         Output_section::find_relaxed_input_section,
12511         Output_section::build_relaxation_map,
12512         Output_section::convert_input_sections_in_list_to_relaxed_sections):
12513         New method declarations.
12514         (Output_section::merge_section_map_
12515         Output_section::merge_section_by_properties_map_,
12516         Output_section::relaxed_input_section_map_,
12517         Output_section::is_relaxed_input_section_map_valid_,
12518         Output_section::generate_code_fills_at_write_): New data members.
12519         * script-sections.cc
12520         (Output_section_element_input::set_section_addresses): Call
12521         current_data_size and addralign methods of relaxed input sections.
12522         (Orphan_output_section::set_section_addresses): Call current_data_size
12523         and addralign methods of relaxed input sections.
12524         * symtab.cc (Symbol_table::compute_final_value): Extract template
12525         from the body of Symbol_table::sized_finalize_symbol.
12526         (Symbol_table::sized_finalized_symbol): Call
12527         Symbol_table::compute_final_value.
12528         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
12529         (Symbol_table::compute_final_value): New templated method declaration.
12530         * target.cc (Target::do_make_output_section): New method defintion.
12531         * target.h (Target::make_output_section): New method declaration.
12532         (Target::relax): Add more parameters for input objects, symbol table
12533         and layout.  Adjust call to do_relax.
12534         (Target::do_make_output_section): New method declaration.
12535         (Target::do_relax): Add parameters for input objects, symbol table
12536         and layout.
12537
12538 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12539
12540         * pread.c: Include stdio.h.
12541
12542 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12543
12544         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
12545         defined.
12546
12547 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12548
12549         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
12550         Change read_shndx type to unsigned int.
12551         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12552         int.
12553         (Sized_dwarf_line_info::read_line_mappings): Likewise.
12554         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
12555         Change read_shndx type to unsigned int.
12556         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12557         int.
12558         (Sized_dwarf_line_info::read_line_mappings): Likewise.
12559         * layout.cc (Layout::create_symtab_sections): Cast the result of
12560         local_symcount * symsize to off_t in the gold_assert.
12561
12562 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12563
12564         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
12565         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
12566         R_ARM_BASE_ABS.
12567         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
12568         (Arm_relocate_functions::thm_abs5): New function.
12569         (Arm_relocate_functions::abs12): New function.
12570         (Arm_relocate_functions::abs16): New function.
12571         (Arm_relocate_functions::base_abs): New function.
12572         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
12573         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
12574         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
12575         R_ARM_BASE_ABS.
12576         (Scan::global): Likewise.
12577         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
12578         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
12579         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
12580         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
12581         R_ARM_BASE_ABS.
12582
12583 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12584
12585         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
12586         (Arm_relocate_functions::movt_prel): New function.
12587         (Arm_relocate_functions::thm_movw_prel_nc): New function.
12588         (Arm_relocate_functions::thm_movt_prel): New function.
12589         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
12590         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
12591         (Scan::global, Relocate::relocate): Likewise.
12592         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12593
12594 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
12595
12596         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
12597         Incremental_checker.
12598         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
12599         unsigned int.
12600         (class Incremental_inputs_header): New class.
12601         (Incremental_inputs_header_writer): Edit comment.
12602         (Incremental_inputs_entry): New class.
12603         (Incremental_inputs_entry_writer): Edit comment.
12604         (Sized_incremental_binary::do_find_incremental_inputs_section):
12605         Add *strtab_shndx parameter, fill it.
12606         (Sized_incremental_binary::do_check_inputs): New method.
12607         (Incremental_checker::can_incrementally_link_output_file): Use
12608         Sized_incremental_binary::check_inputs.
12609         (Incremental_inputs::report_command_line): Save command line in
12610         command_line_.
12611         * incremental.h:
12612         (Incremental_binary::find_incremental_inputs_section): New
12613         method.
12614         (Incremental_binary::do_find_incremental_inputs_section): Add
12615         strtab_shndx parameter.
12616         (Incremental_binary::do_check_inputs): New pure virtual method.
12617         (Sized_incremental_binary::do_check_inputs): Declare.
12618         (Incremental_checker::Incremental_checker): Add incremental_inputs
12619         parameter, use it to initialize incremental_inputs_.
12620         (Incremental_checker::incremental_inputs_): New field.
12621         (Incremental_checker::command_line): New method.
12622         (Incremental_checker::inputs): New method.
12623         (Incremental_checker::command_line_): New field.
12624
12625 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
12626
12627         * incremental.cc: Include <cstdarg> and "target-select.h".
12628         (vexplain_no_incremental): New function.
12629         (explain_no_incremental): New function.
12630         (Incremental_binary::error): New method.
12631         (Sized_incremental_binary::do_find_incremental_inputs_section): New
12632         method.
12633         (make_sized_incremental_binary): New function.
12634         (open_incremental_binary): New function.
12635         (can_incrementally_link_file): Add checks if output is ELF and has
12636         inputs section.
12637         * incremental.h: Include "elfcpp_file.h" and "output.h".
12638         (Incremental_binary): New class.
12639         (Sized_incremental_binary): New class.
12640         (open_incremental_binary): Declare.
12641         * object.cc (is_elf_object): Use
12642         elfcpp::Elf_recognizer::is_elf_file.
12643         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
12644         * output.h (Output_file::filesize): New method.
12645
12646 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12647
12648         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
12649         New function.
12650         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
12651         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
12652         function.
12653         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
12654         function.
12655         (Arm_relocate_functions::movw_abs_nc): New function.
12656         (Arm_relocate_functions::movt_abs): New function.
12657         (Arm_relocate_functions::thm_movw_abs_nc): New function.
12658         (Arm_relocate_functions::thm_movt_abs): New function.
12659         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
12660         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
12661         (Scan::global): Likewise.
12662         (Relocate::relocate): Likewise.
12663         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12664
12665 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12666
12667         * arm.cc (Arm_relocate_functions::got_prel) New function.
12668         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
12669         (Relocate::relocate): Likewise.
12670         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12671
12672 2009-10-06  Ian Lance Taylor  <iant@google.com>
12673
12674         * options.h (class General_options): Define
12675         split_stack_adjust_size parameter.
12676         * object.h (class Object): Add uses_split_stack_ and
12677         has_no_split_stack_ fields.  Add uses_split_stack and
12678         has_no_split_stack accessor functions.  Declare
12679         handle_split_stack_section.
12680         (class Reloc_symbol_changes): Define.
12681         (class Sized_relobj): Define Function_offsets.  Declare
12682         split_stack_adjust, split_stack_adjust_reltype, and
12683         find_functions.
12684         * object.cc (Object::handle_split_stack_section): New function.
12685         (Sized_relobj::do_layout): Call handle_split_stack_section.
12686         * dynobj.cc (Sized_dynobj::do_layout): Call
12687         handle_split_stack_section.
12688         * reloc.cc (Sized_relobj::relocate_sections): Call
12689         split_stack_adjust for executable sections in split_stack
12690         objects.  Pass reloc_map to relocate_section.
12691         (Sized_relobj::split_stack_adjust): New function.
12692         (Sized_relobj::split_stack_adjust_reltype): New function.
12693         (Sized_relobj::find_functions): New function.
12694         * target-reloc.h: Include "object.h".
12695         (relocate_section): Add reloc_symbol_changes parameter.  Change
12696         all callers.
12697         * target.h (class Target): Add calls_non_split method.  Declare
12698         do_calls_non_split virtual method.  Declare match_view and
12699         set_view_to_nop.
12700         * target.cc: Include "elfcpp.h".
12701         (Target::do_calls_non_split): New function.
12702         (Target::match_view): New function.
12703         (Target::set_view_to_nop): New function.
12704         * gold.cc (queue_middle_tasks): Give an error if mixing
12705         split-stack and non-split-stack objects with -r.
12706         * i386.cc (Target_i386::relocate_section): Add
12707         reloc_symbol_changes parameter.
12708         (Target_i386::do_calls_non_split): New function.
12709         * x86_64.cc (Target_x86_64::relocate_section): Add
12710         reloc_symbol_changes parameter.
12711         (Target_x86_64::do_calls_non_split): New function.
12712         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
12713         parameter.
12714         * powerpc.cc (Target_powerpc::relocate_section): Add
12715         reloc_symbol_changes parameter.
12716         * sparc.cc (Target_sparc::relocate_section): Add
12717         reloc_symbol_changes parameter.
12718         * configure.ac: Call AM_CONDITIONAL for the default target.
12719         * configure: Rebuild.
12720         * testsuite/Makefile.am (TEST_AS): New variable.
12721         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
12722         (check_DATA): Add split_i386 and split_x86_64 files.
12723         (SPLIT_DEFSYMS): Define.
12724         (split_i386_[1234n].o): New targets.
12725         (split_i386_[124]): New targets.
12726         (split_i386_[1234r].stdout): New targets.
12727         (split_x86_64_[1234n].o): New targets.
12728         (split_x86_64_[124]): New targets.
12729         (split_x86_64_[1234r].stdout): New targets.
12730         (MOSTLYCLEANFILES): Add new executables.
12731         * testsuite/split_i386.sh: New file.
12732         * testsuite/split_x86_64.sh: New file.
12733         * testsuite/split_i386_1.s: New file.
12734         * testsuite/split_i386_2.s: New file.
12735         * testsuite/split_i386_3.s: New file.
12736         * testsuite/split_i386_4.s: New file.
12737         * testsuite/split_i386_n.s: New file.
12738         * testsuite/split_x86_64_1.s: New file.
12739         * testsuite/split_x86_64_2.s: New file.
12740         * testsuite/split_x86_64_3.s: New file.
12741         * testsuite/split_x86_64_4.s: New file.
12742         * testsuite/split_x86_64_n.s: New file.
12743         * testsuite/testfile.cc (Target_test): Update relocation_section
12744         function.
12745         * testsuite/Makefile.in: Rebuild.
12746
12747 2009-10-06  Ian Lance Taylor  <iant@google.com>
12748
12749         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
12750         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
12751         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
12752         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
12753         the address on ldo_addrs_.
12754         (Target_i386::Relocate::fix_up_ldo): New function.
12755
12756 2009-10-06   Rafael Espindola  <espindola@google.com>
12757
12758         * plugin.cc (add_input_library): New.
12759         (Plugin::load): Add add_input_library to tv.
12760         (Plugin_manager::add_input_file): Add the is_lib argument.
12761         (add_input_file): Update call to Plugin_manager::add_input_file.
12762         (add_input_library): New.
12763         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
12764
12765 2009-09-30  Doug Kwan  <dougkwan@google.com>
12766
12767         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
12768         symbol and call Symbol::may_need_copy_reloc to determine if
12769         a copy reloc is needed.
12770         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12771         nocopyreloc is given in command line.
12772         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12773         given in command line.
12774         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12775         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
12776         of the removed Target_i386::may_need_copy_reloc.
12777         * options.h (copyreloc): New option with default value false.
12778         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12779         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12780         instead of the removed Target_powerpc::may_need_copy_reloc.
12781         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12782         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
12783         instead of the removed Target_sparc::may_need_copy_reloc.
12784         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
12785         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
12786         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12787         instead of the removed Target_x86_64::may_need_copy_reloc.
12788
12789 2009-09-30  Ian Lance Taylor  <iant@google.com>
12790
12791         * object.h (class Object): Remove target_ field, and target,
12792         sized_target, and set_target methods.
12793         (Object::sized_target): Remove.
12794         (class Sized_relobj): Update declarations.  Remove sized_target.
12795         * object.cc (Sized_relobj::setup): Remove target parameter.
12796         Change all callers.
12797         (Input_objects::add_object): Don't do anything with the target.
12798         (make_elf_sized_object): Add punconfigured parameter.  Change all
12799         callers.  Set or test parameter target.
12800         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12801         Change all callers.
12802         * parameters.cc (Parameters::set_target): Change parameter type to
12803         be non-const.
12804         (Parameters::default_target): Remove.
12805         (set_parameters_target): Change parameter type to be non-const.
12806         (parameters_force_valid_target): New function.
12807         (parameters_clear_target): New function.
12808         * parameters.h (class Parameters): Update declarations.  Remove
12809         default_target method.  Add sized_target and clear_target
12810         methods.  Change target_ to be non-const.
12811         (set_parameters_target): Update declaration.
12812         (parameters_force_valid_target): Declare.
12813         (parameters_clear_target): Declare.
12814         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12815         as NULL if we aren't searching.
12816         (Add_symbols::run): Don't check for compatible target.
12817         * fileread.cc (Input_file::open_binary): Call
12818         parameters_force_valid_target.
12819         * gold.cc (queue_middle_tasks): Likewise.
12820         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
12821         set_target on object.
12822         * dynobj.h (class Sized_dynobj): Update declarations.
12823         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12824         make_elf_object returns NULL.
12825         (Archive::include_member): Don't check whether object target is
12826         compatible.
12827         * output.cc (Output_section::add_input_section): Get target from
12828         parameters.
12829         (Output_section::relax_input_section): Likewise.
12830         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12831         parameters.
12832         (Sized_relobj::do_scan_relocs): Likewise.
12833         (Sized_relobj::relocate_sections): Likewise.
12834         * resolve.cc (Symbol_table::resolve): Likewise.
12835         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
12836         parameter.  Change all callers.
12837         (Symbol_table::add_from_object): Get target from parameters.
12838         (Symbol_table::add_from_relobj): Don't check object target.
12839         (Symbol_table::add_from_dynobj): Likewise.
12840         (Symbol_table::define_special_symbol): Get target from
12841         parameters.
12842         * symtab.h (class Symbol_table): Update declaration.
12843         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
12844         parameter.  Change all callers.  Clear parameter target.
12845         (Binary_test): Test target here.
12846         * testsuite/object_unittest.cc (gold_testsuite): Remove
12847         target_test_pointer parameter.  Change all callers.
12848         (Object_test): Test target here.
12849
12850 2009-09-26  Ian Lance Taylor  <iant@google.com>
12851
12852         * testsuite/initpri1.c: Don't try to use constructor priorities if
12853         compiling with gcc before 4.3.
12854
12855 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
12856
12857         * testsuite/retain_symbols_file_test.sh (check_present): Change
12858         output file name to retain_symbols_file_test.stdout.
12859         (check_absent): Likewise.
12860
12861 2009-09-18  Craig Silverstein  <csilvers@google.com>
12862
12863         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
12864         * options.cc: Include <cerrno> and <fstream>.
12865         (General_options::finalize): Parse -retain-symbols-file tag.
12866         * options.h: New flag.
12867         (General_options): New method should_retain_symbol, new
12868         variable symbols_to_retain.
12869         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
12870         should_retain_symbol map.
12871         * testsuite/Makefile.am (retain_symbols_file_test): New test.
12872         * testsuite/Makefile.in: Regenerate.
12873         * testsuite/retain_symbols_file_test.sh: New file.
12874
12875 2009-09-18  Nick Clifton  <nickc@redhat.com>
12876
12877         * po/es.po: Updated Spanish translation.
12878
12879 2009-09-17  Doug Kwan  <dougkwan@google.com>
12880
12881         * debug.h (DEBUG_RELAXATION): New constant.
12882         (DEBUG_ALL): Add DEBUG_RELAXATION.
12883         (debug_string_to_enum): Add relaxation debug option.
12884         * layout.cc
12885         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
12886         Layout::Relaxation_debug_check::read_sections,
12887         Layout::Relaxation_debug_check::read_sections): New method definitions.
12888         (Layout::Layout): Initialize data members
12889         record_output_section_data_from_scrips_,
12890         script_output_section_data_list_ and relaxation_debug_check_.
12891         (Layout::save_segments, Layout::restore_segments,
12892         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12893         Layout::relaxation_loop_body): New method definitions.
12894         (Layout::finalize): Support relaxation.  Move section layout code to
12895         Layout::relaxation_loop_body.
12896         (Layout::set_asection_address_from_script): Move code for orphan
12897         section placement out.
12898         (Layout::place_orphan_sections_in_script): New method definition.
12899         * layout.h (Output_segment_headers, Output_file_header):
12900         New forward class declarations.
12901         (Layout::~Layout): Define.
12902         (Layout::new_output_section_data_from_script): New method definition.
12903         (Layout::place_orphan_sections_in_script): New method declaration.
12904         (Layout::Segment_states): New type declaration.
12905         (Layout::save_segments, Layout::restore_segments,
12906         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12907         Layout::relaxation_loop_body): New method declarations.
12908         (Layout::Output_section_data_list): New type declaration.
12909         (Layout::Relaxation_debug_check): New class definition.
12910         (Layout::record_output_section_data_from_script_,
12911         Layout::script_output_section_data_list_, Layout::segment_states_,
12912         Layout::relaxation_debug_check_): New data members.
12913         * output.cc: (Output_section_headers::do_size): New method definition.
12914         (Output_section_headers::Output_section_headers): Move size
12915         computation to Output_section_headers::do_size.
12916         (Output_segment_headers::do_size): New method definition.
12917         (Output_file_header::Output_file_header): Move size computation to
12918         Output_file_header::do_size and call it.
12919         (Output_file_header::do_size): New method definition.
12920         (Output_data_group::Output_data_group): Adjust call to
12921         Output_section_data.
12922         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12923         (Output_symtab_xindex::do_write): Add array bound check.
12924         (Output_section::Input_section::print_to_mapfile): Handle
12925         RELAXED_INPUT_SECTION_CODE.
12926         (Output_section::Output_section): Initialize data member checkpoint_.
12927         (Output_section::~Output_section): Delete checkpoint object pointed
12928         by checkpoint_.
12929         (Output_section::add_input_section): Always add an Input_section if
12930         relaxing.
12931         (Output_section::add_merge_input_section): Add assert.
12932         (Output_section::relax_input_section): New method definition.
12933         (Output_section::set_final_data_size): Set load address to zero for
12934         an unallocated section.
12935         (Output_section::do_address_and_file_offset_have_reset_values):
12936         New method definition.
12937         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12938         Handle relaxed input section.
12939         (Output_section::sort_attached_input_sections): Checkpoint input
12940         section list lazily.
12941         (Output_section::get_input_sections): Change type of input_sections to
12942         list of Simple_input_section pointers.  Checkpoint input section list
12943         lazily.  Also handle relaxed input sections.
12944         (Output_section::add_input_section_for_script): Take a reference to
12945         a Simple_input_section object instead of Relobj pointer and section
12946         index as parameter.  Handle relaxed input sections.
12947         (Output_section::save_states, Output_section::restore_states): New
12948         method definitions.
12949         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
12950         (Output_data::is_data_size_fixed): New method definition.
12951         (Output_data::reset_addresss_and_file_offset): Do not reset data size
12952         if it is fixed.
12953         (Output_data::address_and_file_offset_have_reset_values): New method
12954         definition.
12955         (Output_data::do_address_and_file_offset_have_reset_values): New method
12956         definition.
12957         (Output_data::set_data_size): Check that data size is not fixed.
12958         (Output_data::fix_data_size): New method definition.
12959         (Output_data::is_data_size_fixed_): New data member.
12960         (Output_section_headers::set_final_data_size): New method definition.
12961         (Output_section_headers::do_size): New method declaration.
12962         (Output_segment_headers::set_final_data_size): New method definition.
12963         (Output_segment_headers::do_size): New method declaration.
12964         (Output_file_header::set_final_data_size)::New method definition.
12965         (Output_file_header::do_size)::New method declaration.
12966         (Output_section_data::Output_section_data): Add new parameter
12967         is_data_size_fixed and use it to fix data size.
12968         (Output_data_const::Output_data_const): Adjust call to base class
12969         constructor and fix data size.
12970         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
12971         base class constructor and fix data size.
12972         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
12973         base class constructor and fix data size.
12974         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
12975         class constructor and fix data size.
12976         (Output_data_group::set_final_data_size): New method definition.
12977         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12978         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12979         class constructor and fix data size.
12980         (Output_relaxed_input_section): New class definition.
12981         (Output_section::Simple_input_section): New class definition.
12982         (Output_section::get_input_sections): Adjust parameter list.
12983         (Output_section::add_input_section_for_script): Same.
12984         (Output_section::save_states, Output_section::restore_states,
12985         Output_section::do_address_and_file_offset_have_reset_values,
12986         (Output_section::Input_section::Input_section): Handle
12987         RELAXED_INPUT_SECTION_CODE.  Add new overload for
12988         Output_relaxed_input_section.
12989         (Output_section::Input_section::is_input_section,
12990         Output_section::Input_section::set_output_section): Handle relaxed
12991         input section.
12992         (Output_section::Input_section::is_relaxed_input_section,
12993         Output_section::Input_section::output_section_data,
12994         Output_section::Input_section::relaxed_input_section): New method
12995         definitions.
12996         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12997         value.
12998         (Output_section::Input_section::u1_): Update comments.
12999         (Output_section::Input_section::u2_): Add new union member poris.
13000         (Output_section::Checkpoint_output_section): New classs definition.
13001         (Output_section::relax_input_section): New method declaration.
13002         (Output_section::checkpoint_): New data member.
13003         (Output_segment): Update comments.
13004         (Output_segment::Output_segment): Un-privatize copy constructor.
13005         (Output_segment::operator=): Un-privatize.
13006         * script-sections.cc (Output_section_element::Input_section_list):
13007         Change element type to Output_section::Simple_input_section.
13008         (Output_section_element_dot_assignment::set_section_addresses):
13009         Register output section data for relaxation clean up.
13010         (Output_data_exression::Output_data_expression): Adjust call to base
13011         constructor to fix data size.
13012         (Output_section_element_data::set_section_addresses): Register
13013         Output_data_expression object for relaxation clean up.
13014         (struct Input_section_info): Replace Relobj pointer and section index
13015         pair with Output_section::Simple_input_section and Convert struct to a
13016         class.
13017         (Input_section_sorter::operator()): Adjust access to
13018         Input_section_info data member to use accessors.
13019         (Output_section_element_input::set_section_addresses): Use layout
13020         parameter.  Adjust code to use Output_section::Simple_input_section
13021         and Input_secction_info classes.  Register filler for relaxation
13022         clean up.
13023         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
13024         and section index pair with Output_section::Simple_input_section
13025         class.  Adjust code accordingly.
13026         (Phdrs_element::release_segment): New method definition.
13027         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
13028         segment list.
13029         (Script_sections::release_segments): New method definition.
13030         * gold/script-sections.h (Script_sections::release_segments): New
13031         method declaration.
13032         * gold/target.h (Target::may_relax, Target::relax,
13033         Target::do_may_relax, Target::do_relax): New method definitions.
13034
13035 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13036
13037         * arm.cc (has_signed_unsigned_overflow): New function.
13038         (Arm_relocate_functions::abs8): New function.
13039         (Target_arm::Scan::local): Handle R_ARM_ABS8.
13040         (Target_arm::Scan::global): Likewise.
13041         (Target_arm::relocate::relocate): Likewise.
13042         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
13043         Likewise.
13044
13045 2009-09-16  Cary Coutant  <ccoutant@google.com>
13046
13047         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
13048         * testsuite/Makefile.in: Regenerate.
13049
13050 2009-09-11  Nick Clifton  <nickc@redhat.com>
13051
13052         * po/gold.pot: Updated by the Translation project.
13053
13054 2009-09-08  Cary Coutant  <ccoutant@google.com>
13055
13056         * output.cc (Output_file::open): Add execute permission to empty file.
13057         * testsuite/Makefile.am (permission_test): New test.
13058         * testsuite/Makefile.in: Regenerate.
13059
13060 2009-09-02  Ian Lance Taylor  <iant@google.com>
13061
13062         * output.cc (Output_file::resize): Call map_no_anonymous rather
13063         than map.
13064
13065 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
13066
13067         * gold.cc: Include "incremental.h".
13068         (queue_initial_tasks): Call Incremental_checker methods.
13069         * incremental.cc: Include "output.h".
13070         (Incremental_checker::can_incrementally_link_output_file): New
13071         method.
13072         * incremental.h (Incremental_checker): New class.
13073
13074         * output.cc (Output_file::open_for_modification): New method.
13075         (Output_file::map_anonymous): Changed return type to bool.  Record
13076         map in base_ field.
13077         (Output_file::map_no_anonymous): New method, broken out of map.
13078         (Output_file::map): Use map_no_anonymous and map_anonymous.
13079         * output.h (class Output_file): Update declarations.
13080
13081 2009-08-24  Cary Coutant  <ccoutant@google.com>
13082
13083         * options.h (Command_line::Pre_options): New class.
13084         (Command_line::pre_options): New member.
13085         * options.cc (gold::options::ready_to_register): New variable.
13086         (One_option::register_option): Do nothing if not registering options.
13087         Assert if same short option registered twice.
13088         (General_options::General_options): Turn off option registration when
13089         done constructing.
13090         (Command_line::Pre_options::Pre_options): New constructor.
13091
13092 2009-08-24  Cary Coutant  <ccoutant@google.com>
13093
13094         * options.h (General_options::no_keep_memory): Remove incorrect
13095         short option.
13096
13097 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
13098
13099         * Makefile.am (am__skiplex, am__skipyacc): New.
13100         * Makefile.in: Regenerate.
13101
13102 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
13103
13104         * Makefile.am (AM_CPPFLAGS): Renamed from ...
13105         (INCLUDES): ... this.
13106         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
13107         (AM_CPPFLAGS): Renamed from ...
13108         (INCLUDE): ... this.
13109         * Makefile.in, testsuite/Makefile.in: Regenerate.
13110
13111         * Makefile.in: Regenerate.
13112         * aclocal.m4: Likewise.
13113         * config.in: Likewise.
13114         * configure: Likewise.
13115         * testsuite/Makefile.in: Likewise.
13116
13117         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13118         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13119         * Makefile.in: Regenerate.
13120         * testsuite/Makefile.in: Regenerate.
13121
13122 2009-08-19  Cary Coutant  <ccoutant@google.com>
13123
13124         * resolve.cc (Symbol_table::resolve): Don't complain about defined
13125         symbols in shared libraries overridden by hidden or internal symbols
13126         in the main program.
13127
13128 2009-08-19  Chris Demetriou  <cgd@google.com>
13129
13130         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
13131         checking source file names in error messages.
13132
13133 2009-08-18  Doug Kwan  <dougkwan@google.com>
13134
13135         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
13136         an elcpp::Ehdr as parameter.  Adjust call to set_target.
13137         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
13138         an elfcpp::Ehdr as parameter.
13139         * object.cc (Object::set_target): Remove the version that looks up
13140         a target and sets it.
13141         (Sized_relobj::setup): Take a Target object instead of
13142         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
13143         (make_elf_sized_object): Find target and ask target to
13144         make an ELF object.
13145         * object.h: (Object::set_target): Remove the version that looks up
13146         a target and sets it.
13147         (Sized_relobj::setup): Take a Target object instead of
13148         an elfcpp:Ehdr as parameter.
13149         * target.cc: Include dynobj.h.
13150         (Target::do_make_elf_object_implementation): New.
13151         (Target::do_make_elf_object): New.
13152         * target.h (Target::make_elf_object): New template declaration.
13153         (Target::do_make_elf_object): New method declarations.
13154         (Target::do_make_elf_object_implementation): New template declaration.
13155
13156 2009-08-14  Ian Lance Taylor  <iant@google.com>
13157
13158         * gold.h (FUNCTION_NAME): Define.
13159         (gold_unreachable): Use FUNCTION_NAME.
13160
13161 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
13162
13163         * icf.cc (Icf::find_identical_sections): Issue a warning when a
13164         symbol in the --keep-unique list is not found.
13165
13166 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
13167
13168         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
13169         been maked as --keep-unique.
13170         (Icf::unfold_section): New function.
13171         * icf.h (Icf::unfold_section): New function.
13172         * options.h (General_options::keep_unique): New option.
13173         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
13174         * testsuite/Makefile.in: Regenerate.
13175         * testsuite/icf_keep_unique_test.sh: New file.
13176         * testsuite/icf_keep_unique_test.cc: New file.
13177
13178 2009-08-12  Cary Coutant  <ccoutant@google.com>
13179
13180         PR 10471
13181         * resolve.cc (Symbol_table::resolve): Check for references from
13182         dynamic objects to hidden and internal symbols.
13183         * testsuite/Makefile.am (hidden_test.sh): New test.
13184         * testsuite/Makefile.in: Regenerate.
13185         * testsuite/hidden_test.sh: New script.
13186         * testsuite/hidden_test_1.c: New test source.
13187         * testsuite/hidden_test_main.c: New test source.
13188
13189 2009-08-11  Doug Kwan  <dougkwan@google.com>
13190
13191         * arm.cc: Update comments.
13192         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
13193         segment to locate the .ARM.exidx section if present.
13194
13195 2009-08-09  Doug Kwan  <dougkwan@google.com>
13196
13197         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
13198         patch.
13199
13200 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
13201         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
13202         compiler warnings.
13203
13204 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
13205
13206         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
13207         valid tls_segment only for non-debug-section relocations.
13208         * testsuite/Makefile.am: Add gc_tls_test.
13209         * testsuite/Makefile.in: Regenerate.
13210         * testsuite/gc_tls_test.cc: New file.
13211         * testsuite/gc_tls_test.sh: New file.
13212
13213 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
13214
13215         * icf.cc: New file.
13216         * icf.h: New file.
13217         * Makefile.am (CCFILES): Add icf.cc.
13218         (HFILES): Add icf.h
13219         * Makefile.in: Regenerate.
13220         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
13221         * gc.h (gc_process_relocs): Populate lists used by icf to contain
13222         section, symbol and addend information for the relocs.
13223         * gold.cc (queue_middle_tasks): Call identical code folding.
13224         * gold.h: Add defines for multimap.
13225         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
13226         to the call of finalize_local_symbols.
13227         * main.cc (main): Create object of class Icf.
13228         * object.cc (Sized_relobj::do_layout): Allow this function to be
13229         called twice during icf.
13230         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
13231         to sections marked as identical by icf.
13232         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
13233         when available.
13234         (Sized_relobj::do_section_entsize): New function.
13235         * object.h (Object::section_entsize): New function.
13236         (Object::do_section_entsize): New pure virtual function.
13237         (Relobj::finalize_local_symbols): Add new parameter.
13238         (Relobj::do_section_entsize): New function.
13239         * options.h (General_options::icf): New option.
13240         (General_options::icf_iterations): New option.
13241         (General_options::print_icf_sections): New option.
13242         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
13243         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
13244         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
13245         icf.
13246         * symtab.cc (Symbol_table::is_section_folded): New function.
13247         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
13248         to sections marked as identical by icf.
13249         * symtab.h (Symbol_table::set_icf): New function.
13250         (Symbol_table::icf): New function.
13251         (Symbol_table::is_section_folded): New function.
13252         (Symbol_table::icf_): New data member.
13253         * target-reloc.h (relocate_section): Ignore sections folded by icf.
13254         * testsuite/Makefile.am: Add commands to build icf_test.
13255         * testsuite/Makefile.in: Regenerate.
13256         * testsuite/icf_test.sh: New file.
13257         * testsuite/icf_test.cc: New file.
13258
13259 2009-07-24  Chris Demetriou  <cgd@google.com>
13260
13261         * layout.cc (is_compressible_debug_section): Fix incorrect
13262         comment about compressed section names.
13263
13264 2009-07-20  Ian Lance Taylor  <ian@airs.com>
13265
13266         PR 10419
13267         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
13268
13269 2009-07-16  Ian Lance Taylor  <iant@google.com>
13270
13271         PR 10400
13272         * layout.h: #include <map>.
13273         (class Kept_section): Change from struct to class.  Add accessors
13274         and setters.  Add section size to Comdat_group mapping.  Change
13275         Comdat_group to std::map.  Add is_comdat_ field.  Add
13276         linkonce_size field in union.
13277         (class Layout): Update declaration of find_or_add_kept_section.
13278         Don't declare find_kept_object.
13279         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
13280         parameter.  Add object, shndx, is_comdat, and is_group_name
13281         parameters.  Change all callers.  Adjust for new Kept_section.
13282         (Layout::find_kept_object): Remove.
13283         * object.cc (Sized_relobj::include_section_group): Update use of
13284         Kept_section.  Rename secnum to shndx.  Only record
13285         Kept_comdat_section if sections are the same size.
13286         (Sized_relobj::include_linkonce_section): Update use of
13287         Kept_section.  Only record Kept_comdat_section if sections are the
13288         same size.  Set size of linkonce section.
13289         (Sized_relobj::map_to_kept_section): Update call to
13290         get_kept_comdat_section.
13291         * object.h (class Sized_relobj): Rename fields in
13292         Kept_comdat_section to drop trailing underscores; change object
13293         field to Relobj*.  Change Kept_comdat_section_table to store
13294         struct rather than pointer.
13295         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
13296         Add kept_object and kept_shndx parameters.  Change all callers.
13297         (Sized_relobj::get_kept_comdat_section): Change return type to
13298         bool.  Add kept_object and kept_shndx parameters.  Change all
13299         callers.
13300         * plugin.cc (Pluginobj::include_comdat_group): Update call to
13301         Layout::find_or_add_kept_section.
13302
13303 2009-07-09  Ian Lance Taylor  <iant@google.com>
13304
13305         * merge.cc (Object_merge_map::initialize_input_to_output_map):
13306         Reserve space in the hash table.
13307
13308 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
13309
13310         * fileread.cc (File_read::get_mtime): New method.
13311         * fileread.h (Timespec): New structure.
13312         (File_read::get_mtime): New method.
13313         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
13314         Renamed from timestamp_nsec.
13315         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
13316         Elf_Xword.
13317         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
13318         timestamp_nsec.
13319         (Incremental_inputs::report_archive): Save mtime; style fix.
13320         (Incremental_inputs::report_obejct): Save mtime; style fix.
13321         (Incremental_inputs::report_script): Save mtime; style fix.
13322         (Incremental_inputs::finalize_inputs): Style fix.
13323         (Incremental_inputs::finalize): Style fix.
13324         (Incremental_inputs::create_input_section_data): Store inputs
13325         mtime.
13326         * incremental.h (Incremental_inputs::report_script): Add mtime
13327         argument.
13328         (Incremental_inputs::Input_info::Input_info): Intialize only one
13329         union member.
13330         (Incremental_inputs::Input_info::archive): Move to nameless
13331         union.
13332         (Incremental_inputs::Input_info::obejct): Move to nameless union.
13333         (Incremental_inputs::Input_info::script): Move to nameless union.
13334         (Incremental_inputs::mtime): New field.
13335         * script.cc (read_input_script): Pass file mtime to
13336         Incremental_input.
13337         * script.h (Script_info::inputs): Style fix.
13338
13339 2009-07-01  Ian Lance Taylor  <ian@airs.com>
13340
13341         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
13342         instead of 32.
13343
13344 2009-06-24  Ian Lance Taylor  <iant@google.com>
13345
13346         PR 10156
13347         * layout.cc (Layout::choose_output_section): If we find an
13348         existing section, update the flags.
13349         (Layout::create_notes): New function, broken out of
13350         Layout::finalize.
13351         (Layout::finalize): Don't create note sections.
13352         (Layout::create_note): Don't crash if linker script discards
13353         section.
13354         (Layout::create_gold_note): Likewise.
13355         (Layout::create_build_id): Likewise.  Don't set
13356         after_input_sections on the section.
13357         (Layout::create_executable_stack_info): Remove target parameter.
13358         Change caller.
13359         * layout.h (class Layout): Declare create_notes.  Update
13360         declaration of create_executable_stack_info.
13361         * gold.cc (queue_middle_tasks): Call create_notes.
13362         * output.cc (Output_section::update_flags_for_input_section): Move
13363         here from output.h.  If SHF_ALLOC flag is newly set, mark address
13364         invalid.
13365         * output.h (Output_data::mark_address_invalid): New function.
13366         (class Output_section): Only declare, not define,
13367         update_flags_for_input_section.  Remove set_flags.
13368
13369 2009-06-24  Ian Lance Taylor  <iant@google.com>
13370
13371         * script-sections.cc (Output_section_definition::
13372         set_section_addresses): Rename shadowing local load_address to
13373         laddr.
13374
13375 2009-06-24  Ian Lance Taylor  <iant@google.com>
13376
13377         PR 10244
13378         * reloc.cc (relocate_sections): Skip empty relocation sections.
13379
13380 2009-06-23  Ian Lance Taylor  <iant@google.com>
13381
13382         PR 10156
13383         * layout.cc (Layout::create_note): Use choose_output_section
13384         rather than make_output_section.
13385
13386 2009-06-23  Ian Lance Taylor  <iant@google.com>
13387
13388         PR 10237
13389         * options.cc (General_options::parse_V): Set printed_version_.
13390         (General_options::General_options): Initialize printed_version_.
13391         * options.h (class General_options): Add printed_version_ field.
13392         * gold.cc (queue_initial_tasks): If there are no input files,
13393         don't give a fatal error if we printed the version information.
13394         (queue_middle_tasks): If using -r with a shared object, give a
13395         fatal error rather than an ordinary error.
13396
13397 2009-06-23  Ian Lance Taylor  <iant@google.com>
13398
13399         PR 10219
13400         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
13401         (Layout::make_output_section): Set have_stabstr_section_ if we see
13402         a .stab*str section.
13403         (Layout::finalize): Call link_stabs_sections.
13404         (Layout::link_stabs_sections): New file.
13405         * layout.h (class Layout): Add have_stabstr_section_ field.
13406         Declare link_stabs_sections.
13407
13408 2009-06-23  Doug Kwan  <dougkwan@google.com>
13409
13410         * Makefile.am (libgold_a_LIBADD): New.
13411         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
13412         * Makefile.in: Regenerate.
13413         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
13414         * configure: Regenerate.
13415         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
13416         * fileread.cc: Include sys/state.h
13417         * gold.h: Declare memmem and strndup if found missing.
13418         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
13419
13420 2009-06-23  Ian Lance Taylor  <iant@google.com>
13421
13422         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
13423         * configure: Rebuild.
13424
13425 2009-06-23  Ian Lance Taylor  <iant@google.com>
13426
13427         PR 10147
13428         * object.cc (Object::section_contents): Don't try to get a view if
13429         the section has length zero.
13430         (Object::handle_gnu_warning_section): If the section is empty, use
13431         the name of the section as the warning.
13432
13433 2009-06-23  Ian Lance Taylor  <iant@google.com>
13434
13435         PR 10133
13436         * stringpool.h (class Stringpool_template): Add optimize_ field.
13437         (Stringpool_template::set_optimize): New function.
13438         * stringpool.cc (Stringpool_template::Stringpool_template):
13439         Initialize optimize_ field.
13440         (Stringpool_template::set_string_offsets): Test local optimize
13441         fild rather than parameter.
13442         * layout.cc (Layout::Layout): Call set_optimize on the section
13443         name stringpool.
13444
13445 2009-06-22  Ian Lance Taylor  <iant@google.com>
13446
13447         PR 10030
13448         * yyscript.y: Parse TARGET.
13449         * script.cc (script_set_target): New function.
13450         * script-c.h (script_set_target): Declare.
13451         * options.cc (General_options::string_to_object_format): Rename
13452         from string_to_object_format in anonymous namespace.  Change
13453         callers.
13454         * options.h (class General_options): Declare
13455         string_to_object_format.
13456
13457 2009-06-22  Ian Lance Taylor  <iant@google.com>
13458
13459         * script-sections.cc (Script_sections::create_segments): Don't put
13460         program headers in a PT_LOAD segment if -n or -N.
13461
13462 2009-06-22  Ian Lance Taylor  <iant@google.com>
13463
13464         PR 10141
13465         * options.h (class General_options): Add -z lazy and -z now.  Sort
13466         -z options into alphabetical order.
13467         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
13468
13469 2009-06-21  Ian Lance Taylor  <iant@google.com>
13470
13471         * layout.cc (Layout::make_output_section): Call
13472         Target::new_output_section.
13473         (Layout::attach_allocated_section_to_segment): Put large section
13474         sections in a separate load segment with the large segment flag
13475         set.
13476         (Layout::segment_precedes): Sort large data segments after other
13477         load segments.
13478         (align_file_offset): New static function.
13479         (Layout::set_segment_offsets): Use align_file_offset.
13480         * output.h (class Output_section): Add is_small_section_ and
13481         is_large_section_ fields.
13482         (Output_section::is_small_section): New function.
13483         (Output_section::set_is_small_section):  New function.
13484         (Output_section::is_large_section): New function.
13485         (Output_section::set_is_large_section): New function.
13486         (Output_section::is_large_data_section): New function.
13487         (class Output_segment): Add is_large_data_segment_ field.
13488         (Output_segment::is_large_data_segment): New function.
13489         (Output_segment::set_is_large_data_segment): New function.
13490         * output.cc (Output_section::Output_section): Initialize new
13491         fields.
13492         (Output_segment::Output_segment): Likewise.
13493         (Output_segment::add_output_section): Add assertion that large
13494         data sections always go in large data segments.  Force small data
13495         sections to the end of the list of data sections.  Force small BSS
13496         sections to the start of the list of BSS sections.  For large BSS
13497         sections to the end of the list of BSS sections.
13498         * symtab.h (class Symbol): Declare is_common_shndx.
13499         (Symbol::is_defined): Check Symbol::is_common_shndx.
13500         (Symbol::is_common): Likewise.
13501         (class Symbol_table): Define enum Commons_section_type.  Update
13502         declarations.  Add small_commons_ and large_commons_ fields.
13503         * symtab.cc (Symbol::is_common_shndx): New function.
13504         (Symbol_table::Symbol_table): Initialize new fields.
13505         (Symbol_table::add_from_object): Put small and large common
13506         symbols in the right list.
13507         (Symbol_table::sized_finalized_symbol): Check
13508         Symbol::is_common_shndx.
13509         (Symbol_table::sized_write_globals): Likewise.
13510         * common.cc (Symbol_table::do_allocate_commons): Allocate new
13511         common symbol lists.  Don't call do_allocate_commons_list if the
13512         list is empty.
13513         (Symbol_table::do_allocate_commons_list): Remove is_tls
13514         parameter.  Add comons_section_type parameter.  Change all
13515         callers.  Handle small and large common symbols.
13516         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
13517         Symbol::is_common_shndx.
13518         * resolve.cc (symbol_to_bits): Likewise.
13519         * target.h (Target::small_common_shndx): New function.
13520         (Target::small_common_section_flags): New function.
13521         (Target::large_common_shndx): New function.
13522         (Target::large_common_section_flags): New function.
13523         (Target::new_output_section): New function.
13524         (Target::Target_info): Add small_common_shndx, large_common_shndx,
13525         small_common_section_flags, and large_common_section_flags
13526         fields.
13527         (Target::do_new_output_section): New virtual function.
13528         * arm.cc (Target_arm::arm_info): Initialize new fields.
13529         * i386.cc (Target_i386::i386_info): Likewise.
13530         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
13531         Likewise.
13532         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
13533         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13534         (Target_x86_64::do_new_output_section): New function.
13535         * configure.ac: Define conditional MCMODEL_MEDIUM.
13536         * testsuite/Makefile.am (check_PROGRAMS): Add large.
13537         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
13538         (large_LDFLAGS): Define.
13539         * testsuite/large.c: New file.
13540         * testsuite/testfile.cc (Target_test::test_target_info):
13541         Initialize new fields.
13542         * configure, testsuite/Makefile.in: Rebuild.
13543
13544 2009-06-05  Doug Kwan  <dougkwan@google.com>
13545
13546         * Makefile.am (CCFILES): Add target.cc.
13547         * Makefile.in: Regenerate.
13548         * i386.cc (class Target_i386): Define new virtual method to
13549         override do_is_local_label_name in parent.
13550         * object.cc (Sized_relobj::do_count_local_symbols): Discard
13551         local symbols if --discard-locals or -X is given.
13552         * options.h (class General_options): Declare new options
13553         '--discard-locals' and '-X' for discarding locals.
13554         * target.h (class Target): Define new methods is_local_label_name.
13555         Declare new virtual method do_is_local_label_name.
13556         * target.cc: New file.
13557         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
13558         (check_SCRIPTS): Add discard_locals_test.sh.
13559         (check_DATA): Add discard_local_tests.syms.
13560         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
13561         (discard_local_tests.syms, discard_locals_test.o): New make rules.
13562         * testsuite/Makefile.in: Regenerate.
13563         * testsuite/discard_locals_test.c: New file.
13564         * testsuite/discard_locals_test.sh: Same.
13565
13566 2009-06-05  Doug Kwan  <dougkwan@google.com>
13567
13568         * object.cc (Sized_relobj::Sized_relobj): Initialize
13569         discarded_eh_frame_shndx_ to -1U.
13570         (Sized_relobj::do_layout): Record index of a discard .eh_frame
13571         section.
13572         (Sized_relobj::do_count_local_symbols): Skip local symbols in
13573         a discarded .eh_frame section.
13574         (Sized_relobj::do_finalize_local_symbols): Ditto.
13575         * object.h (class Sized_relobj): Declare new member
13576         discarded_eh_frame_shndx_.
13577         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
13578         (local_labels_test.o, local_labels_test): New rules.
13579         * testsuite/Makefile.in: Regenerate.
13580
13581 2009-06-04  Doug Kwan  <dougkwan@google.com>
13582
13583         * layout.cc (Layout::section_name_mapping): Add mapping for
13584         special ARM sections.
13585
13586 2009-06-03  Doug Kwan  <dougkwan@google.com>
13587
13588         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
13589         (utils::has_overflow): Same.
13590
13591 2009-06-03  Ian Lance Taylor  <iant@google.com>
13592
13593         * layout.cc (Layout::section_name_mapping): New array, replacing
13594         Layout::linkonce_mapping.
13595         (Layout::section_name_mapping_count): New variable, replacing
13596         Layout::linkonce_mapping_count.
13597         (Layout::linkonce_output_name): Remove.
13598         (Layout::output_section_name): Rewrite.
13599         * layout.h (class Layout): Rename Linkonce_mapping to
13600         Section_name_mapping, linkonce_mapping to section_name_mapping,
13601         linkonce_mapping_count to section_name_mapping_count.  Don't
13602         declare linkonce_output_name.
13603
13604 2009-06-03  Doug Kwan  <dougkwan@google.com>
13605
13606         * gold/arm.cc (namespace utils): New.
13607         (Target_arm::reloc_is_non_pic): Define new method.
13608         (class Arm_relocate_functions): New.
13609         (Target_arm::Relocate::relocate): Handle relocation types used by
13610         Android.
13611
13612 2009-06-03  Ian Lance Taylor  <iant@google.com>
13613
13614         * arm.cc (Target_arm::scan::global): Use || instead of |.
13615
13616 2009-06-02  Doug Kwan  <dougkwan@google.com>
13617
13618         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
13619         issued_non_pic_error_.
13620         (class Target_arm::Scan): Declare new method check_non_pic.
13621         Define new method symbol_needs_plt_entry.
13622         Declare new data member issued_non_pic_error_.
13623         (class Target_arm::Relocate): Declare new method
13624         should_apply_static_reloc.
13625         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
13626         (Target_arm::Scan::check_non_pic): Define new method.
13627         (Target_arm::Scan::local): Handle a small subset of reloc types used
13628         by Android.
13629         (Target_arm::Scan::local): Same.
13630         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
13631
13632 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
13633
13634         * incremental.cc (Incremental_inputs::report_command_line): Filter
13635         out --incremental-* options.
13636
13637 2009-05-29  Doug Kwan  <dougkwan@google.com>
13638
13639         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
13640         template class.
13641         (class Target_arm): Update comment.
13642         (Target_arm::Target_arm): Initialize new data members GOT_,
13643         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
13644         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
13645         and Target_arm::rel_dyn_section.
13646         Declare new_enum Target_arm::Got_type.
13647         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
13648         and DYNBSS_.
13649         Update commments for member do_dynsym_value.
13650         (Target_arm::got_size, Target_arm::plt_section,
13651         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
13652         new methods inside class defintion.
13653         (Target_arm::got_section): Define new method.
13654         (Target_arm::rel_dyn_section): Same.
13655         (Output_data_plt_arm): New template class.
13656         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
13657         (Output_data_plt_arm:do_adjust_output_section): Define new method.
13658         (Output_data_plt_arm::add_entry): Same.
13659         (Output_data_plt_arm::first_plt_entry): Define new
13660         static data member for PLT instruction template.
13661         (Output_data_plt_arm::plt_entry): Same.
13662         (Output_data_plt_arm::do_write): Define new method.
13663         (Target_arm::make_plt_entry): Same.
13664         (Target_arm::do_finalize_sections): Same.
13665         (Target_arm::do_dynsym_value): Same.
13666
13667 2009-05-28  Doug Kwan  <dougkwan@google.com>
13668
13669         * Makefile.am (TARGETSOURCES): Add arm.cc.
13670         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
13671         * Makefile.in: Regenerate.
13672         * arm.cc: New file.
13673         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
13674
13675 2009-05-26  Doug Kwan  <dougkwan@google.com>
13676
13677         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
13678         (General_options::check_excluded_libs): Strip off directories in
13679         archive name before matching like GNU ld does.
13680         * testsuite/Makefile.am (MOSTLYCLEANFILES,
13681         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
13682         (exclude_libs_test_LDFLAGS): Add linker option
13683         -Wl,--exclude-libs,libexclude_libs_test_3
13684         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
13685         an explicit archive without using -l.
13686         (alt/libexclude_libs_test_3.a): New make rule.
13687         * testsuite/Makefile.in: Regenerate.
13688         * testsuite/exclude_libs_test.c : Declare lib3_default().
13689         (main): Call it.
13690         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
13691         * exclude_libs_test_3.c: New file.
13692
13693 2009-05-26  Nick Clifton  <nickc@redhat.com>
13694
13695         * po/id.po: New Indonesian translation.
13696         * po/gold.pot: Updated template file.
13697
13698 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
13699
13700         * testsuite/Makefile.am: Add -ffunction-sections to compile
13701         gc_comdat_test files.  Add -Wl,--gc-sections to build
13702         gc_comdat_test.
13703         * testsuite/Makefile.in: Regenerate.
13704         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
13705
13706 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
13707
13708         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
13709         kept comdat section was garbage collected.
13710         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
13711         * testsuite/Makefile.in: Regenerate.
13712         * testsuite/gc_comdat_test.sh: New file.
13713         * testsuite/gc_comdat_test_1.cc: New file.
13714         * testsuite/gc_comdat_test_2.cc: New file.
13715
13716 2009-05-19  Doug Kwan  <dougkwan@google.com>
13717
13718         * archive.cc (Archive::Archive): Move constructor from archive.h
13719         to here.  Initialize no_export_.
13720         (Archive::get_elf_object_for_member): Set no_export flag of object.
13721         * archive.h (Archive::Archive): Move constructor body to
13722         archive.cc.
13723         (Archive::no_export): New method.
13724         (Archive::no_export_): New field.
13725         * object.h (Object::Object): Initialize no_export_ to false.
13726         (Object::no_export, Object::set_no_export): New methods.
13727         (Object::no_export_): New field.
13728         * options.cc (General_options::parse_exclude_libs): New method.
13729         (General_options::check_excluded_libs) Same.
13730         * options.h (exclude_libs): New option.
13731         (General_options::check_excluded_libs): New method declaration.
13732         (General_options::excluded_libs_): New field.
13733         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
13734         default or protected visibility if an object has no-export flag set.
13735         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
13736         (check_SCRIPTS): Add exclude_libs_test.sh.
13737         (check_DATA): Add exclude_libs_test.syms.
13738         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
13739         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
13740         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
13741         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
13742         (exclude_libs_test.syms, libexclude_libs_test_1.a,
13743         libexclude_libs_test_2.a): New rules.
13744         * testsuite/Makefile.in: Regenerate.
13745         * testsuite/exclude_libs_test.c: New file.
13746         * testsuite/exclude_libs_test.sh: Ditto.
13747         * testsuite/exclude_libs_test_1.c: Ditto.
13748         * testsuite/exclude_libs_test_2.c: Ditto.
13749
13750 2009-05-15  Ian Lance Taylor  <iant@google.com>
13751
13752         * configure.ac: Check for declarations for cases where libiberty.h
13753         checks HAVE_DECL_xxx.
13754         * configure, config.in: Rebuild.
13755
13756 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
13757
13758         * gold.h (Incremental_argument_list): Remove (invalid) forward
13759         declaration.
13760         * incremental.cc (Incremental_inputs::report_achive): New method.
13761         (Incremental_inputs::report_object): New method.
13762         (Incremental_inputs::report_script): New method.
13763         (Incremental_inputs::finalize_inputs): New method.
13764         (Incremental_inputs::finalize): Call finalize_inputs().
13765         (Incremental_inputs::sized_create_incremental_inputs_section_data):
13766         Create inputs entries.
13767         * incremental.h (Incremental_input_type): New enum.
13768         (Incremental_inputs::Incremental_input): Initialize new fields.
13769         (Incremental_inputs::report_inputs): New method.
13770         (Incremental_inputs::report_achive): New method.
13771         (Incremental_inputs::report_object): New method.
13772         (Incremental_inputs::report_script): New method.
13773         (Incremental_inputs::finalize_inputs): New method.
13774         (Incremental_inputs::Input_info): New struct.
13775         (Incremental_inputs::Input_info_map): New typedef.
13776         (Incremental_inputs::lock_): New field.
13777         (Incremental_inputs::Inputs_): New field.
13778         (Incremental_inputs::Inputs_map): New field.
13779         * main.cc (main): Call Incremental_input::report_inputs.
13780         * options.h (Input_argument_list): Typedef moved from
13781         Input_arguments.
13782         (Input_file_group::Files): Remove, use ::Input_argument_list.
13783         (Input_file_group::Input_argument_list): Remove, use
13784         ::Input_argument_list.
13785         * plugin.cc (Plugin_manager::add_input_file): Add error in
13786         incremental build.
13787         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13788         functions.
13789         * script.cc (read_input_script): Call
13790         Incremental_input::report_script.
13791         * script.h (Script_info): New class.
13792
13793 2009-04-27  Ian Lance Taylor  <iant@google.com>
13794
13795         * x86_64.cc (do_adjust_output_section): Set entsize to
13796         plt_entry_size.
13797
13798 2009-04-23  Elliott Hughes  <enh@google.com>
13799
13800         * output.cc (Output_file::close): After short writes, continue
13801         writing from the correct offset in the buffer being written.
13802
13803 2009-04-23  Chris Demetriou  <cgd@google.com>
13804
13805         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13806         * configure: Regenerate.
13807         * config.in: Regenerate.
13808         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13809         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13810
13811 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
13812
13813         * incremental.cc (Incremental_inputs_header_data): Renamed from
13814         Incremental_input_header_data.
13815         (Incremental_inputs_header_data::data_size): New field.
13816         (Incremental_inputs_header_data::put_input_file_count): Renamed
13817         from input_file_count.
13818         (Incremental_inputs_header_data::put_command_line_offset): Renamed
13819         from command_line_offset.
13820         (Incremental_inputs_header_data::put_reserved): Renamed from
13821         put_reserved.
13822         (Incremental_inputs_entry_data): Renamed from
13823         Incremental_input_entry_data.
13824         (Incremental_inputs_entry_data::data_size): New field.
13825         (Incremental_inputs::report_command_line): New method.
13826         (Incremental_inputs::finalize): New method.
13827         (Incremental_inputs::create_incremental_inputs_data): New method.
13828         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13829         * incremental.h: New file.
13830         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13831         (Layout::finalize): Create incremental inputs section in
13832         incremental builds.
13833         (Layout::create_incremental_info_sections): New method.
13834         * layout.h (Layout::incremental_inputs): New method.
13835         (Layout::create_incremental_info_sections): New method.
13836         (Layout::incremental_inputs_): New field.
13837         * main.cc (main): Notify Incremental_input of the command line.
13838
13839 2009-04-01  Ian Lance Taylor  <iant@google.com>
13840             Mikolaj Zalewski  <mikolajz@google.com>
13841
13842         * gold.h (reserve_unordered_map): Define, three versions, one for
13843         each version of Unordered_map.
13844         * layout.cc (Layout::Layout): Remove options parameter.  Add
13845         number_of_input_files parameter.  Don't initialize options_.
13846         Initialize number_of_input_files_ and resized_signatures_.  Move
13847         sections_are_attached_.
13848         (Layout::layout_group): Reserve space for group_signatures_.
13849         (Layout::find_or_add_kept_section): Change name parameter to be a
13850         reference.  Resize signatures_ map when it gets large enough.
13851         (Layout::layout_eh_frame): Use parameters->options() instead of
13852         this->options_.
13853         (Layout::make_output_section): Likewise.
13854         (Layout::attach_allocated_section_to_segment): Likewise.
13855         (Layout::finalize, Layout::create_executable_stack): Likewise.
13856         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
13857         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
13858         * layout.h (class Layout): Update declarations.  Remove options_
13859         field.  Add number_of_input_files_ and resized_signatures_
13860         fields.  Move sections_are_attached_ field.
13861         * main.cc (main): Pass number of input files to Layout
13862         constructor.  Don't pass options.
13863
13864 2009-03-30  Ian Lance Taylor  <iant@google.com>
13865
13866         * ffsll.c (ffsll): Correct implementation.
13867
13868 2009-03-27  Ian Lance Taylor  <iant@google.com>
13869
13870         * ffsll.c: New file.
13871         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
13872         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
13873         * ftruncate.c (ftruncate): Declare before definition.
13874         * mremap.c (mremap): Likewise.
13875         * pread.c (pread): Likewise.
13876         * configure, Makefile.in, config.in: Rebuild.
13877
13878         * mremap.c: New file.
13879         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
13880         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
13881         (mremap): Declare if HAVE_MREMAP is not defined.
13882         * configure, Makefile.in, config.in: Rebuild.
13883
13884 2009-03-27  Cary Coutant  <ccoutant@google.com>
13885
13886         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
13887         position independent.
13888         * sparc.cc (Target_sparc::check_non_pic): Likewise.
13889         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
13890
13891 2009-03-24  Cary Coutant  <ccoutant@google.com>
13892
13893         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
13894         an executable.
13895         (needs_dynamic_reloc): Likewise.
13896
13897 2009-03-24  Ian Lance Taylor  <iant@google.com>
13898
13899         * yyscript.y (file_cmd): Recognize EXTERN.
13900         (extern_name_list, extern_name_list_body): New nonterminals.
13901         * script.cc (script_add_extern): Define.
13902         * script-c.h (script_add_extern): Declare.
13903
13904 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
13905
13906         * object.cc (is_elf_object): Define.
13907         * object.h (is_elf_object): Declare.
13908         * archive.cc (Archive::get_elf_object_for_member): Call
13909         is_elf_object.
13910         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
13911
13912 2009-03-24  Elliott Hughes  <enh@google.com>
13913
13914         * output.cc (Output_file::map_anonymous): Define.
13915         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
13916         try an anonymous one.  Report the size if the mmap fails.
13917         * output.h (class Output_file): Declare map_anonymous.
13918
13919 2009-03-24  Ian Lance Taylor  <iant@google.com>
13920
13921         * target-select.cc (instantiate_target): Don't acquire the lock if
13922         the instantiated_target_ field has already been set.
13923
13924 2009-03-23  Ian Lance Taylor  <iant@google.com>
13925
13926         * gold-threads.h (class Initialize_lock): Define.
13927         * gold-threads.cc (class Initialize_lock_once): Define.
13928         (initialize_lock_control): New static variable.
13929         (initialize_lock_pointer): New static variable.
13930         (initialize_lock_once): New static function.
13931         (Initialize_lock::Initialize_lock): Define.
13932         (Initialize_lock::initialize): Define.
13933         * target-select.h: Include "gold-threads.h".
13934         (class Target_selector): Add lock_ and initialize_lock_ fields.
13935         Don't define instantiate_target, just declare it.
13936         * target-select.cc (Target_selector::Target_selector): Initialize
13937         new fields.
13938         (Target_selector::instantiate_target): Define.
13939         * descriptors.h: Include "gold-threads.h".
13940         (class Descriptors): Add initialize_lock_ field.
13941         * descriptors.cc (Descriptors::Descriptors): Initialize new
13942         field.
13943         (Descriptors::open): Use initialize_lock_ field
13944         * errors.h (class Errors): Add initialize_lock_ field.
13945         * errors.cc (Errors::Errors): Initialize new field.
13946         (Errors::initialize_lock): Use initialize_lock_ field.
13947         * powerpc.cc (class Target_selector_powerpc): Remove
13948         instantiated_target_ field.  In do_recognize call
13949         instantiate_target rather than do_instantiate_target.  In
13950         do_instantiate_target just allocate a new target.
13951         * sparc.cc (class Target_selector_sparc): Likewise.
13952
13953         * freebsd.h: New file.
13954         * i386.cc: Include "freebsd.h".
13955         (Target_i386): Derive from Target_freebsd rather than
13956         Sized_target.
13957         (Target_selector_i386): Derive from Target_selector_freebsd rather
13958         than Target_selector.
13959         * x86_64.cc: Include "freebsd.h".
13960         (Target_x86_64): Derive from Target_freebsd rather than
13961         Sized_target.
13962         (Target_selector_x86_64): Derive from Target_selector_freebsd
13963         rather than Target_selector.
13964         * target.h (class Target): Add adjust_elf_header and
13965         do_adjust_elf_header.
13966         * output.cc (Output_file_header:: do_sized_write): Call target
13967         adjust_elf_header routine.
13968         * configure.tgt: Set targ_osabi.
13969         * configure.ac: Define GOLD_DEFAULT_OSABI.
13970         * parameters.cc (Parameters::default_target): Pass
13971         GOLD_DEFAULT_OSABI to select_target.
13972         * target-select.h (class Target_selector): Make instantiate_target
13973         protected rather than private.
13974         * Makefile.am (HFILES): Add freebsd.h.
13975         * configure, Makefile.in, config.in: Rebuild.
13976
13977         * merge.cc (do_add_input_section): Correct pend value.  Change
13978         message about last entry not being null terminated from error to
13979         warning.
13980
13981 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
13982
13983         * incremental.cc: New file.
13984         * Makefile.am (CCFILES): Add incremental.cc.
13985         * Makefile.in: Rebuild.
13986
13987 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
13988
13989         * layout.cc (Layout::output_section_name): Preserve names
13990         of '.note.' sections.
13991
13992 2009-03-19  Ian Lance Taylor  <iant@google.com>
13993
13994         * descriptors.cc (Descriptors::open): Check that the options are
13995         valid before using them.
13996
13997 2009-03-18  Ian Lance Taylor  <iant@google.com>
13998
13999         * script-sections.h: Include <list>.
14000         (class Script_sections): Change Sections_elements from std::vector
14001         to std::list.  Typedef public Elements_iterator.  Add
14002         orphan_section_placement_, data_segment_align_start_, and
14003         saw_data_segment_align_ fields.  Remove data_segment_align_index_
14004         field.
14005         * script-sections.cc (class Orphan_section_placement): New class.
14006         (class Sections_element): Add virtual functions is_relro and
14007         orphan_section_init.  Remove virtual function place_orphan_here.
14008         (class Output_section_definition): Add is_relro and
14009         orphan_section_init.  Remove place_orphan_here.
14010         (class Orphan_output_section): Likewise.
14011         (Script_sections::Script_sections): Update for field changes.
14012         (Script_sections::data_segment_align): Set saw_data_segment_align_
14013         and data_segment_align_start_, not data_segment_align_index.
14014         (Script_sections::data_segment_relro_end): Check
14015         saw_data_segment_align_.  Use data_segment_align_start_ rather
14016         than data_segment_align_index_.
14017         (Script_sections::place_orphan): Rewrite to use
14018         Orphan_section_placement.
14019
14020 2009-03-17  Ian Lance Taylor  <iant@google.com>
14021
14022         * archive.cc (Archive::add_symbols): Check for a version attached
14023         to the symbol name in the archive map.
14024         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
14025         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
14026         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
14027         (ver_test_11.a): New target.
14028         * testsuite/Makefile.in: Rebuild.
14029
14030         * configure.ac: Check for chsize and posix_fallocate.  Replace
14031         ftruncate.
14032         * ftruncate.c: New file, from gnulib.
14033         * output.cc (posix_fallocate): Define dummy version if not
14034         HAVE_POSIX_FALLOCATE.
14035         (Output_file::map): Call posix_fallocate rather than lseek and
14036         write.
14037         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
14038         * configure, Makefile.in, config.in: Rebuild.
14039
14040 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
14041
14042         * layout.h (Layout::create_note): Add section_name parameter.
14043         * layout.cc (Layout::create_note): Likewise.
14044         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
14045
14046 2009-03-17  Ian Lance Taylor  <iant@google.com>
14047
14048         * descriptors.cc: Include "options.h".
14049         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
14050         (Descriptors::open): Always use O_CLOEXEC when opening a new
14051         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
14052         then set FD_CLOEXEC.
14053
14054         * sparc.cc (class Target_sparc): Add has_got_section.
14055         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
14056         make sure we have a GOT section.
14057
14058         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
14059         (Target_sparc::Scan::local): Likewise.
14060         (Target_sparc::Scan::global): Likewise.
14061         (Target_sparc::Relocate::relocate): Likewise.
14062         (Target_sparc::Relocate::relocate_tls): Likewise.
14063
14064         * symtab.cc (Symbol_table::define_default_version): New function,
14065         broken out of add_from_object.
14066         (Symbol_table::add_from_object): Call define_default_version.
14067         (Symbol_table::define_special_symbol): Add resolve_oldsym
14068         parameter.  Change all callers.  If the version for a symbol comes
14069         from a version script, resolve it with the symbol with the same
14070         name with no version.  Also add the symbol without a version if
14071         appropriate.
14072         (do_define_in_output_data): If resolving with oldsym, don't delete
14073         sym.
14074         (do_define_in_output_segment): Likewise.
14075         (do_define_as_constant): Likewise.
14076         * symtab.h (class Symbol_table): Update declarations.
14077
14078 2009-03-13  Ian Lance Taylor  <iant@google.com>
14079
14080         * readsyms.cc (Read_symbols::incompatible_warning): New function.
14081         (Read_symbols::requeue): New function.
14082         (Read_symbols::do_read_symbols): If make_elf_object fails because
14083         the target type is not configured, and the file was searched for,
14084         issue a warning and retry with the next directory.
14085         (Add_symbols::run): If the file has an incompatible format, and
14086         it was searched for, requeue the Read_symbols task.  On error,
14087         release the object.
14088         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
14089         dirindex parameter to constructor.  Change all callers.  Declare
14090         incompatible_warning and requeue.
14091         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
14092         input_argument_ and input_group_ fields.  Add them to
14093         constructor.  Change all callers.
14094         (class Read_script): Add dirindex_ field.  Add it to constructor.
14095         Change all callers.
14096         * archive.cc (Archive::setup): Remove input_objects parameter.
14097         Change all callers.
14098         (Archive::get_file_and_offset): Likewise.
14099         (Archive::read_all_symbols): Likewise.
14100         (Archive::read_symbols): Likewise.
14101         (Archive::get_elf_object_for_member): Remove input_objects
14102         parameter.  Add punconfigured parameter.  Change all callers.
14103         (Archive::add_symbols): Change return type to bool.  Check return
14104         value of include_member.
14105         (Archive::include_all_members): Likewise.
14106         (Archive::include_member): Change return type to bool.  Return
14107         false if first included object has incompatible target.  Set
14108         included_member_ field.
14109         (Add_archive_symbols::run): If add_symbols returns false, requeue
14110         Read_symbols task.
14111         * archive.h (class Archive): Add included_member_ field.
14112         Initialize it in constructor.  Add input_file and searched_for
14113         methods.  Update declarations.
14114         (class Add_archive_symbols): Add dirpath_, dirindex_, and
14115         input_argument_ fields.  Add them to constructor.  Change all
14116         callers.
14117         * script.cc: Include "target-select.h".
14118         (class Parser_closure): Add skip_on_incompatible_target_ and
14119         found_incompatible_target_ fields.  Add
14120         skip_on_incompatible_target parameter to constructor.  Change all
14121         callers.  Add methods skip_on_incompatible_target,
14122         clear_skip_on_incompatible_target, found_incompatible_target, and
14123         set_found_incompatible_target.
14124         (read_input_script): Add dirindex parameter.  Change all callers.
14125         If parser finds an incompatible target, requeue Read_symbols
14126         task.
14127         (script_set_symbol): Clear skip_on_incompatible_target in
14128         closure.
14129         (script_add_assertion, script_parse_option): Likewise.
14130         (script_start_sections, script_add_phdr): Likewise.
14131         (script_check_output_format): New function.
14132         * script.h (read_input_script): Update declaration.
14133         * script-c.h (script_check_output_format): Declare.
14134         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
14135         (ignore_cmd): Remove OUTPUT_FORMAT.
14136         * fileread.cc (Input_file::Input_file): Add explicit this.
14137         (Input_file::will_search_for): New function.
14138         (Input_file::open): Add pindex parameter.  Change all callers.
14139         * fileread.h (class Input_file): Add input_file_argument method.
14140         Declare will_search_for.  Update declarations.
14141         * object.cc (make_elf_object): Add punconfigured parameter.
14142         Change all callers.
14143         * object.h (class Object): Make input_file public.  Add
14144         searched_for method.
14145         (make_elf_object): Update declaration.
14146         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
14147         restart search.
14148         * dirsearch.h (class Dirsearch): Update declaration.
14149         * options.h (class General_options): Add --warn-search-mismatch.
14150         * parameters.cc (Parameters::is_compatible_target): New function.
14151         * parameters.h (class Parameters): Declare is_compatible_target.
14152         * workqueue.cc (Workqueue::add_blocker): New function.
14153         * workqueue.h (class Workqueue): Declare add_blocker.
14154
14155         * fileread.cc (Input_file::open): Remove options parameter.
14156         Change all callers.
14157         (Input_file::open_binary): Likewise.
14158         * script.cc (read_input_script): Likewise.
14159         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
14160         options parameter from constructor.  Change all callers.
14161         (class Read_script): Likewise.
14162         * fileread.h (class Input_file): Update declarations.
14163         * script.h (read_input_script): Update declaration.
14164
14165 2009-03-10  Nick Clifton  <nickc@redhat.com>
14166
14167         * po/es.po: New Spanish translation.
14168
14169 2009-03-06  Cary Coutant  <ccoutant@google.com>
14170
14171         * options.cc (parse_short_option): Keep dash_z from registering itself.
14172
14173 2009-03-03  Ian Lance Taylor  <iant@google.com>
14174
14175         PR 9918
14176         * target-reloc.h (relocate_section): Pass output_section to
14177         relocate.
14178         * i386.cc (Target_i386::should_apply_static_reloc): Add
14179         output_section parameter.  Change all callers.
14180         (Target_i386::Relocate::relocate): Add output_section parameter.
14181         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14182         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
14183         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
14184         * testsuite/two_file_shared.sh: New script.
14185         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
14186         (check_DATA): Add two_file_shared.dbg.
14187         (two_file_shared.dbg): New target.
14188         * testsuite/Makefile.in: Rebuild.
14189
14190 2009-03-01  Ian Lance Taylor  <iant@google.com>
14191
14192         * configure.ac: Check for byteswap.h.
14193         * configure: Rebuild.
14194         * config.in: Rebuild.
14195
14196 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
14197
14198         * layout.cc (Layout::find_or_add_kept_section): New function.
14199         (Layout::add_comdat): Removed.
14200         * layout.h (struct Kept_section): Move out of class Layout.
14201         Remove trailing underscores from field names.  Add group_sections
14202         field.  Rename group_ field to is_group.  Change all uses.
14203         (class Layout): Declare find_or_add_kept_section, not add_comdat.
14204         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
14205         comdat_groups_ field.
14206         (Sized_relobj::include_section_group): Use
14207         find_or_add_kept_section and Kept_section::group_sections.
14208         (Sized_relobj::include_linkonce_section): Likewise.
14209         * object.cc (class Sized_relobj): Don't define Comdat_group or
14210         Comdat_group_table.  Remove find_comdat_group and
14211         add_comdat_group.  Remove comdat_groups_ field.
14212         * plugin.cc (include_comdat_group): Use
14213         Layout::find_or_add_kept_section.
14214
14215 2009-02-28  Ian Lance Taylor  <iant@google.com>
14216
14217         * README: --gc-sections and map files are now supported.  Document
14218         some build requirements.
14219
14220         PR 6992
14221         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
14222         relocatable link set the value of the section symbol to zero.
14223         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
14224         relocatable link don't include the section address in the local
14225         symbol value.
14226
14227 2009-02-27  Ian Lance Taylor  <iant@google.com>
14228
14229         PR 6811
14230         * options.h (class Search_directory): Add is_system_directory.
14231         (class General_options): Declare is_in_system_directory.
14232         * options.cc (get_relative_sysroot): Make static.
14233         (get_default_sysroot): Make static.
14234         (General_optoins::is_in_system_directory): New function.
14235         * fileread.cc (Input_file::is_in_system_directory): New function.
14236         * fileread.h (class Input_file): Declare is_in_system_directory.
14237         * object.h (class Object): Add is_in_system_directory.
14238         (class Input_objects): Remove system_library_directory_ field.
14239         * object.cc (Input_objects::add_object): Don't set
14240         system_library_directory_.
14241         (input_objects::found_in_system_library_directory): Remove.
14242         * symtab.cc (Symbol_table::write_globals): Remove input_objects
14243         parameter.  Change all callers.
14244         (Symbol_table::sized_write_globals): Likewise.
14245         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
14246         Call Object::is_in_system_directory.
14247         * symtab.h (class Symbol_table): Update declarations.
14248
14249         PR 5990
14250         * descriptors.h (Open_descriptor): Add is_on_stack field.
14251         * descriptors.cc (Descriptors::open): If the descriptor is on the
14252         top of the stack, remove it.  Initialize is_on_stack field.
14253         (Descriptors::release): Only add pod to stack if it is not on the
14254         stack already.
14255         (Descriptors::close_some_descriptor): Clear stack_next and
14256         is_on_stack fields.
14257
14258         PR 7091
14259         * output.cc (Output_section::find_starting_output_address): Rename
14260         from starting_output_address; add PADDR parameter; change return
14261         type.
14262         * output.h (class Output_section): Declare
14263         find_starting_output_address instead of starting_output_address.
14264         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
14265         section symbol for which we can't find a merge section.
14266
14267         PR 9836
14268         * symtab.cc (Symbol_table::add_from_object): If the visibility is
14269         hidden or internal, force the symbol to be local.
14270         * resolve.cc (Symbol::override_visibility): Define.
14271         (Symbol::override_base): Use override_visibility.
14272         (Symbol_table::resolve): Likewise.
14273         (Symbol::override_base_with_special): Likewise.
14274         (Symbol_table::override_with_special): If the visibility is hidden
14275         or internal, force the symbol to be local.
14276         * symtab.h (class Symbol): Add set_visibility and
14277         override_visibility.
14278         * testsuite/ver_test_1.sh: New file.
14279         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
14280         (check_DATA): Add ver_test_1.syms.
14281         (ver_test_1.syms): New target.
14282         * testsuite/Makefile.in: Rebuild.
14283
14284 2009-02-25  Cary Coutant  <ccoutant@google.com>
14285
14286         * layout.cc (Layout::choose_output_section): Don't rename sections
14287         when using a linker script that has a SECTIONS clause.
14288         * Makefile.in: Regenerate.
14289
14290         * testsuite/Makefile.am (script_test_5.sh): New test case.
14291         * testsuite/Makefile.in: Regenerate.
14292         * testsuite/script_test_5.cc: New file.
14293         * testsuite/script_test_5.sh: New file.
14294         * testsuite/script_test_5.t: New file.
14295
14296 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
14297
14298         * archive.cc (Archive::include_member): Update calls to add_symbols.
14299         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
14300         the Layout argument.
14301         * dynobj.h (do_add_symbols): Add the Layout argument.
14302         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
14303         Layout argument.
14304         * object.h (Object::add_symbols): Add the Layout argument.
14305         (Object::do_add_symbols): Add the Layout argument.
14306         (Sized_relobj::do_add_symbols): Add the Layout argument.
14307         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
14308         Unify the two versions.
14309         (Add_plugin_symbols): Remove.
14310         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
14311         (Sized_pluginobj::do_add_symbols): Unify the two versions.
14312         (Add_plugin_symbols): Remove.
14313         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
14314         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
14315         (Add_symbols::run): Make it work with Pulginobj.
14316
14317 2009-02-06  Ian Lance Taylor  <iant@google.com>
14318
14319         * object.cc (Sized_relobj::do_layout): Make info message start
14320         with lower case letter.
14321
14322 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
14323
14324         * binary.cc: Fix file comment.
14325
14326         * options.h (enum Incremental_disposition): Define.
14327         (class General_options): Add new options: --incremental,
14328         --incremental_changed, --incremental_unchanged,
14329         --incremental_unknown.  Add incremental_disposition_ and
14330         implicit_incremental_ fields.
14331         (General_options::incremental_disposition): New function.
14332         (class Position_dependent_options): Add incremental_disposition
14333         option.
14334         (Position_dependent_options::copy_from_options): Set incremental
14335         dispositions.
14336         * options.cc (General_options::parse_incremental_changed): New
14337         function.
14338         (General_options::parse_incremental_unchanged): New function.
14339         (General_options::parse_incremental_unknown): New function.
14340         (General_options::General_options): Initialize new fields
14341         incremental_disposition_ and implicit_incremental_.
14342         (General_options::finalize): Check for uasge of --incremental-*
14343         without --incremental.
14344
14345 2009-02-06  Chris Demetriou  <cgd@google.com>
14346
14347         * gold.h (gold_undefined_symbol): Change to take only a Symbol
14348         pointer and to report location as the file name associated with
14349         the symbol.
14350         (gold_undefined_symbol_at_location): New function to replace the
14351         old gold_undefined_symbol functionality.
14352         * target-reloc.h (relocate_section): Update to use
14353         gold_undefined_symbol_at_location.
14354         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14355         Call gold_undefined_symbol function rather than gold_error.
14356         * errors.h (Errors::undefined_symbol): Take location as a
14357         string, rather than calculating it from a relocation.
14358         * errors.cc (Errors::fatal): Print "fatal error:" before the
14359         formatted message.
14360         (Errors::error, Errors::error_at_location): Print "error: "
14361         before the formatted message.
14362         (Errors::undefined_symbol): Take location as a string, rather
14363         than calculating it from a relocation.
14364         (gold_undefined_symbol_at_location): New function akin to
14365         old gold_undefined_symbol, calculates location from relocation.
14366         (gold_undefined_symbol): Change to take only a Symbol pointer
14367         and to report location as the file name associated with the symbol.
14368         * testsuite/debug_msg.sh: Update for changed error messages.
14369         * testsuite/undef_symbol.sh: Likewise.
14370
14371 2009-02-04  Duncan Sands  <baldrick@free.fr>
14372
14373         PR 9812
14374         * reduced_debug_output.h
14375         (Output_reduced_debug_abbrev_section::failed): Use format for
14376         gold_warning.
14377         (Output_reduced_debug_info_section::faild): Likewise.
14378
14379 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
14380
14381         * script.cc (Lazy_demangler): New class.
14382         (Version_script_info::get_symbol_version_helper): Demangle a
14383         symbol only once.
14384
14385 2009-01-29  Cary Coutant  <ccoutant@google.com>
14386
14387         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
14388         to __tls_get_addr.
14389         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14390
14391 2009-01-28  Ian Lance Taylor  <iant@google.com>
14392
14393         * version.cc (version_string): Bump to 1.9.
14394
14395         * gold.h: Include <cstring> and <stdint.h>.
14396         * version.cc: Include <cstdio>.
14397         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
14398         warning.
14399         * reduced_debug_output.cc (insert_into_vector): Rename from
14400         Insert_into_vector; change all callers.  Use Swap_unaligned to
14401         avoid aliasing issue; remove union since it is unnecessary.
14402
14403 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
14404
14405         * Makefile.am (CCFILES): Add gc.cc.
14406         (HFILES): Add gc.h.
14407         * Makefile.in: Regenerate.
14408         * gold.cc (Gc_runner): New class.
14409         (queue_initial_tasks): Call garbage collection related tasks
14410         when corresponding options are invoked.
14411         (queue_middle_gc_tasks): New function.
14412         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
14413         processed early before laying out sections during garbage collection.
14414         * gold.h (queue_middle_gc_tasks): New function.
14415         (is_prefix_of): Move from "layout.cc".
14416         * i386.cc (Target_i386::gc_process_relocs): New function.
14417         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
14418         * main.cc (main): Create object of class "Garbage_collection".
14419         * object.cc (Relobj::copy_symbols_data): New function.
14420         (Relobj::is_section_name_included): New function.
14421         (Sized_relobj::do_layout): Allow this function to be called twice
14422         during garbage collection and defer layout of section during the
14423         first call.
14424         * object.h (Relobj::get_symbols_data): New function.
14425         (Relobj::is_section_name_included): New function.
14426         (Relobj::copy_symbols_data): New function.
14427         (Relobj::set_symbols_data): New function.
14428         (Relobj::get_relocs_data): New function.
14429         (Relobj::set_relocs_data): New function.
14430         (Relobj::is_output_section_offset_invalid): New pure virtual function.
14431         (Relobj::gc_process_relocs): New function.
14432         (Relobj::do_gc_process_relocs): New pure virtual function.
14433         (Relobj::sd_): New data member.
14434         (Sized_relobj::is_output_section_offset_invalid): New function.
14435         (Sized_relobj::do_gc_process_relocs): New function.
14436         * options.h (General_options::gc_sections): Modify to not be a no-op.
14437         (General_options::print_gc_sections): New option.
14438         * plugin.cc (Plugin_finish::run): Remove function call to
14439         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
14440         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
14441         * reloc.cc (Read_relocs::run): Add task to process relocs and
14442         determine unreferenced sections when doing garbage collection.
14443         (Gc_process_relocs): New class.
14444         (Sized_relobj::do_gc_process_relocs): New function.
14445         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
14446         sections that are garbage collected.
14447         * reloc.h (Gc_process_relocs): New class.
14448         * sparc.cc (Target_sparc::gc_process_relocs): New function.
14449         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
14450         symbols whose corresponding sections are garbage collected.
14451         (Symbol_table::Symbol_table): Add new parameter for the garbage
14452         collection object.
14453         (Symbol_table::gc_mark_undef_symbols): New function.
14454         (Symbol_table::gc_mark_symbol_for_shlib): New function.
14455         (Symbol_table::gc_mark_dyn_syms): New function.
14456         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
14457         as garbage.
14458         (Symbol_table::add_from_object): Likewise.
14459         (Symbol_table::add_from_relobj): When building shared objects, do not
14460         treat externally visible symbols as garbage.
14461         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
14462         table information for static and relocatable links.
14463         * symtab.h (Symbol_table::set_gc): New function.
14464         (Symbol_table::gc): New function.
14465         (Symbol_table::gc_mark_undef_symbols): New function.
14466         (Symbol_table::gc_mark_symbol_for_shlib): New function.
14467         (Symbol_table::gc_mark_dyn_syms): New function.
14468         (Symbol_table::gc_): New data member.
14469         * target.h (Sized_target::gc_process_relocs): New pure virtual
14470         function.
14471         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
14472         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
14473
14474 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
14475
14476         * options.h (General_options::gc_sections): Define as a no-op for now.
14477         (General_options::no_keep_memory): Ditto.
14478         (General_options::Bshareable): Define.
14479         * options.cc (General_options::finalize): Honor -Bshareable.
14480
14481 2009-01-20  Andreas Schwab  <schwab@suse.de>
14482
14483         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
14484         read the value in the contents, since we don't use it.  Use the
14485         template endianness when writing.
14486         (Relocate::relocate): Use it for R_PPC_REL16_HA.
14487
14488 2009-01-19  Andreas Schwab  <schwab@suse.de>
14489
14490         * configure.tgt (powerpc64-*): Fix targ_obj.
14491
14492 2009-01-15  Ian Lance Taylor  <iant@google.com>
14493
14494         * object.cc (Sized_relobj::write_local_symbols): Don't write out
14495         local symbols when stripping all symbols.
14496
14497 2009-01-14  Cary Coutant  <ccoutant@google.com>
14498
14499         * output.cc (Output_reloc): Add explicit instantiations.
14500
14501 2009-01-14  Cary Coutant  <ccoutant@google.com>
14502
14503         * archive.cc (Archive::get_elf_object_for_member): Remove call
14504         to File_read::claim_for_plugin.
14505         * descriptors.cc (Descriptors::open): Remove reference to
14506         is_claimed.
14507         (Descriptors::claim_for_plugin): Remove.
14508         * descriptors.h (Descriptors::claim_for_plugin): Remove.
14509         (Descriptors::is_claimed): Remove.
14510         (claim_descriptor_for_plugin): Remove.
14511         * fileread.cc (File_read::claim_for_plugin): Remove.
14512         * fileread.h (File_read::claim_for_plugin): Remove.
14513         (File_read::descriptor): Reopen descriptor if necessary.
14514         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
14515         (Plugin_manager::all_symbols_read): Add task parameter. Change
14516         all callers.
14517         (Plugin_manager::get_input_file): New function.
14518         (Plugin_manager::release_input_file): New function.
14519         (Pluginobj::Pluginobj): Add filesize parameter and initialize
14520         corresponding data member.
14521         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
14522         and pass to base constructor. Change all callers.
14523         (get_input_file, release_input_file): New functions.
14524         (make_sized_plugin_object): Add filesize parameter. Change all callers.
14525         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
14526         (Plugin_manager::all_symbols_read): Add task parameter.
14527         (Plugin_manager::get_input_file): New function.
14528         (Plugin_manager::release_input_file): New function.
14529         (Plugin_manager::task_): New data member.
14530         (Pluginobj::Pluginobj): Add filesize parameter.
14531         (Pluginobj::filename): New function.
14532         (Pluginobj::descriptor): New function.
14533         (Pluginobj::filesize): New function.
14534         (Pluginobj::filesize_): New data member.
14535         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
14536         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
14537         File_read::claim_for_plugin; use Object::unlock to unlock the file.
14538
14539         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
14540         with archive libraries.
14541         * testsuite/Makefile.in: Regenerate.
14542         * testsuite/plugin_test.c (struct sym_info): New type.
14543         (get_input_file, release_input_file): New static variables.
14544         (onload): Capture new transfer vector entries.
14545         (claim_file_hook): Stop reading at end of file according to filesize.
14546         Factor out parsing of readelf output into separate function.
14547         (all_symbols_read_hook): Exercise get_input_file and release_input_file
14548         APIs and get the source file name from the symbol table.  Convert
14549         source file name to corresponding object file name.  Print info
14550         message when adding new input files.
14551         (parse_readelf_line): New function.
14552         * testsuite/plugin_test_1.sh: Add checks for new info messages.
14553         * testsuite/plugin_test_2.sh: Likewise.
14554         * testsuite/plugin_test_3.sh: Likewise.
14555         * testsuite/plugin_test_4.sh: New test case.
14556
14557 2009-01-07  Ian Lance Taylor  <iant@google.com>
14558
14559         * version.cc (version_string): Bump to 1.8.
14560
14561 2008-12-23  Cary Coutant  <ccoutant@google.com>
14562
14563         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
14564         * plugin.cc (Plugin_manager::finish): Rename as
14565         layout_deferred_objects.  Move cleanup to separate function.
14566         (Plugin_manager::cleanup): New function.
14567         (Plugin_finish::run): Call layout_deferred_objects and cleanup
14568         separately.
14569         * plugin.h (Plugin_manager::finish): Rename as
14570         layout_deferred_objects.
14571         (Plugin_manager::cleanup): New function.
14572         (Plugin_manager::cleanup_done): New field.
14573
14574 2008-12-23  Cary Coutant  <ccoutant@google.com>
14575
14576         * plugin.cc (is_visible_from_outside): New function.
14577         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
14578         so we don't return "IR only" status for exported symbols or -r links.
14579
14580         * testsuite/Makefile.am (plugin_test_3): New test case.
14581         * testsuite/Makefile.in: Regenerate.
14582         * testsuite/plugin_test_3.sh: New file.
14583
14584 2008-12-22  Cary Coutant  <ccoutant@google.com>
14585
14586         * object.cc (Sized_relobj::layout_section): New function.
14587         (Sized_relobj::do_layout): Defer layout of input sections until after
14588         plugin has provided replacement files.
14589         (Sized_relobj::do_layout_deferred_sections): New function.
14590         * object.h (Relobj::set_section_offset): Remove virtual keyword.
14591         (Relobj::layout_deferred_sections): New function.
14592         (Relobj::do_layout_deferred_sections): New function.
14593         (Sized_relobj::do_layout_deferred_sections): New function.
14594         (Sized_relobj::layout_section): New function.
14595         (Sized_relobj::Deferred_layout): New structure.
14596         (Sized_relobj::deferred_layout_): New field.
14597         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
14598         Change all callers.  Layout deferred sections.
14599         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
14600         references.
14601         (Plugin_hook::run): Move code from do_plugin_hook inline.
14602         (Plugin_hook::do_plugin_hook): Remove.
14603         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
14604         (Plugin_manager::finish): Renamed, was cleanup.
14605         (Plugin_manager::should_defer_layout): New function.
14606         (Plugin_manager::add_deferred_layout_object): New function.
14607         (Plugin_manager::Deferred_layout_list): New type.
14608         (Plugin_manager::deferred_layout_objects_): New field.
14609         (Plugin_hook::do_plugin_hook): Remove.
14610
14611 2008-12-17  Ian Lance Taylor  <iant@google.com>
14612
14613         * options.h (class General_options): Add --no case for
14614         --export-dynamic.
14615
14616 2008-12-16  Cary Coutant  <ccoutant@google.com>
14617
14618         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
14619         vector.
14620         (Plugin_manager::claim_file): Create plugin object even if
14621         plugin did not call the add_symbols callback.
14622         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
14623         asking for more symbols than were added.
14624         * testsuite/Makefile.am (plugin_test_1): Add test case with
14625         no global symbols.
14626         (empty.syms): New target.
14627         * testsuite/Makefile.in: Regenerate.
14628         * testsuite/plugin_test.c (claim_file_hook): Add new debug
14629         message. Don't call add_symbols if no globals.
14630         (all_symbols_read_hook): Don't provide replacement for empty
14631         claimed file.
14632
14633 2008-12-12  Ian Lance Taylor  <iant@google.com>
14634
14635         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
14636         r_type == 0 for a local symbol with r_sym == 0.
14637         (scan_relocatable_relocs): Pass r_sym to
14638         local_non_section_strategy.
14639         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
14640         r_sym parameter.
14641
14642         * configure.ac: Update test for TLS descriptors: they are
14643         supported as of glibc 2.9.
14644         * configure: Rebuild.
14645
14646 2008-12-11  Ian Lance Taylor  <iant@google.com>
14647
14648         PR 7091
14649         * target-reloc.h (Default_scan_relocatable_relocs): For each
14650         function, map r_type == 0 to RELOC_DISCARD.
14651
14652 2008-12-10  Cary Coutant  <ccoutant@google.com>
14653
14654         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
14655         object to override a kept COMDAT group from a plugin object.
14656
14657 2008-12-09  Ian Lance Taylor  <iant@google.com>
14658
14659         PR 7088
14660         * yyscript.y (file_cmd): Handle INPUT.
14661
14662         * testsuite/initpri1.c: Change all declarations to be full
14663         prototypes by adding void, to avoid compiler warnings.
14664
14665 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
14666
14667         * options.cc (General_options::parse_plugin_opt): New.
14668         (General_options::add_plugin): The argument now is just the filename.
14669         (General_options::add_plugin_option): New.
14670         * options.h (plugin_opt): New.
14671         (add_plugin): Change argument name.
14672         (add_plugin_option): New.
14673         * plugin.cc (Plugin::load): Don't parse the plugin option.
14674         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
14675         (Plugin::add_option): New.
14676         (Plugin::args_): Change type.
14677         (Plugin::filename_): New.
14678         (Plugin_manager::add_plugin_option): New.
14679         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
14680         * testsuite/Makefile.in: Regenerate.
14681
14682 2008-12-05  Cary Coutant  <ccoutant@google.com>
14683
14684         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
14685         Handle --strip-lto-sections option.
14686         * options.h (strip_lto_sections): New option.
14687
14688 2008-12-01  Cary Coutant  <ccoutant@google.com>
14689
14690         * plugin.cc (ld_plugin_message): Change format parameter to const.
14691         Fix mismatch between new[] and delete.
14692
14693 2008-11-14  Cary Coutant  <ccoutant@google.com>
14694
14695         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
14696         instead of -1U.
14697
14698 2008-11-05  Craig Silverstein  <csilvers@google.com>
14699
14700         * options.cc (General_options::parse_dynamic_list): New function.
14701         * options.h (General_options): New flags dynamic_list,
14702         dynamic_list_data, dynamic_list_cpp_new, and
14703         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
14704         (General_options::in_dynamic_list): New function.
14705         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
14706         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
14707         (Lex::can_continue_name): Likewise.
14708         (yylex): Likewise.
14709         (read_script_file): New parameter script_options.
14710         (read_dynamic_list): New function.
14711         (Script_options::define_dynamic_list): New function.
14712         (dynamic_list_keyword_parsecodes): New variable.
14713         (dynamic_list_keywords): New variable.
14714         * script.h (Script_options::define_dynamic_list): New function
14715         prototype.
14716         (read_dynamic_list): New function prototype.
14717         * symtab.cc (strprefix): New macro.
14718         (Symbol::should_add_dynsym_entry): Support dynamic_list,
14719         dynamic_list_data, dynamic_list_cpp_new, and
14720         dynamic_list_cpp_typeinfo.
14721         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
14722         (dynamic_list_expr): New rule.
14723         (dynamic_list_nodes): Likewise.
14724         (dynamic_list_node): Likewise.
14725         * testsuite/Makefile.am (dynamic_list): New test.
14726         * testsuite/Makefile.in: Regenerated.
14727         * testsuite/dynamic_list.t: New file.
14728         * testsuite/dynamic_list.sh: New file.
14729
14730 2008-11-05  Craig Silverstein  <csilvers@google.com>
14731
14732         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
14733         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
14734         (t11_last): Likewise.
14735         * testsuite/ver_test_6.c (main): Likewise.
14736
14737 2008-10-07  Cary Coutant  <ccoutant@google.com>
14738
14739         * options.c (General_options::finalize): Add check for -static and
14740         -shared.
14741         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
14742         is not empty.
14743
14744 2008-10-02  Cary Coutant  <ccoutant@google.com>
14745
14746         * plugin.cc (make_sized_plugin_object): Fix conditional
14747         compilation to work when not all targets are enabled.
14748
14749 2008-09-29  Cary Coutant  <ccoutant@google.com>
14750
14751         * archive.cc (Archive::get_file_and_offset): Use filename instead
14752         of name to get library path.
14753         (Archive::include_member): Unlock external member of a thin archive.
14754
14755         * testsuite/Makefile.am (TEST_AR): New variable.
14756         (thin_archive_test_1): New test.
14757         (thin_archive_test_2): New test.
14758         * testsuite/Makefile.in: Regenerate.
14759         * testsuite/thin_archive_main.cc: New file.
14760         * testsuite/thin_archive_test_1.cc: New file.
14761         * testsuite/thin_archive_test_2.cc: New file.
14762         * testsuite/thin_archive_test_3.cc: New file.
14763         * testsuite/thin_archive_test_4.cc: New file.
14764
14765 2008-09-29  Cary Coutant  <ccoutant@google.com>
14766
14767         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
14768         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
14769         instead of -1U.
14770         (Sized_relobj::do_finalize_local_symbols): Likewise.
14771         (Sized_relobj::map_to_kept_section): Likewise.
14772         * object.h (Sized_relobj::invalid_address): New constant.
14773         (Sized_relobj::do_output_section_offset): Check for invalid_address
14774         and return -1ULL.
14775         * output.cc (Output_reloc::local_section_offset): Use constant
14776         invalid_address instead of -1U.
14777         (Output_reloc::get_address): Likewise.
14778         (Output_section::output_address): Change -1U to -1ULL.
14779         * output.h (Output_reloc::invalid_address): New constant.
14780         * reloc.cc (Sized_relobj::write_sections): Use constant
14781         invalid_address instead of -1U.
14782         (Sized_relobj::relocate_sections): Likewise.
14783         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
14784         values for merge sections.
14785         * target-reloc.h (relocate_for_relocatable): Use constant
14786         invalid_address instead of -1U.
14787
14788 2008-09-19  Cary Coutant  <ccoutant@google.com>
14789
14790         Add plugin functionality for link-time optimization (LTO).
14791         * configure.ac (plugins): Add --enable-plugins option.
14792         * configure: Regenerate.
14793         * config.in: Regenerate.
14794         * Makefile.am (LIBDL): New variable.
14795         (CCFILES): Add plugin.cc.
14796         (HFILES): Add plugin.h.
14797         (ldadd_var): Add LIBDL.
14798         * Makefile.in: Regenerate.
14799
14800         * archive.cc: Include "plugin.h".
14801         (Archive::setup): Don't preread archive symbols when using a plugin.
14802         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
14803         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14804         files.
14805         (Archive::include_member): Add symbols from plugin objects.
14806         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14807         * descriptors.cc (Descriptors::open): Check for file descriptors
14808         abandoned by plugins.
14809         (Descriptors::claim_for_plugin): New function.
14810         * descriptors.h (Descriptors::claim_for_plugin): New function.
14811         (Open_descriptor::is_claimed): New field.
14812         (claim_descriptor_for_plugin): New function.
14813         * fileread.cc (File_read::claim_for_plugin): New function.
14814         * fileread.h (File_read::claim_for_plugin): New function.
14815         (File_read::descriptor): New function.
14816         * gold.cc: Include "plugin.h".
14817         (queue_initial_tasks): Add task to call plugin hooks for generating
14818         new object files.
14819         * main.cc: Include "plugin.h".
14820         (main): Load plugin libraries.
14821         * object.h (Pluginobj): Declare.
14822         (Object::pluginobj): New function.
14823         (Object::do_pluginobj): New function.
14824         (Object::set_target): New function.
14825         * options.cc: Include "plugin.h".
14826         (General_options::parse_plugin): New function.
14827         (General_options::General_options): Initialize plugins_ field.
14828         (General_options::add_plugin): New function.
14829         * options.h (Plugin_manager): Declare.
14830         (General_options): Add --plugin option.
14831         (General_options::has_plugins): New function.
14832         (General_options::plugins): New function.
14833         (General_options::add_plugin): New function.
14834         (General_options::plugins_): New field.
14835         * plugin.cc: New file.
14836         * plugin.h: New file.
14837         * readsyms.cc: Include "plugin.h".
14838         (Read_symbols::do_read_symbols): Check for archive before checking
14839         for ELF file.  Call plugin hooks to claim files.
14840         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
14841         from a real object file; force override when processing replacement
14842         files.
14843         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
14844         (Symbol::init_base_object): Likewise.
14845         (Symbol::init_base_output_data): Likewise.
14846         (Symbol::init_base_output_segment): Likewise.
14847         (Symbol::init_base_constant): Likewise.
14848         (Symbol::init_base_undefined): Likewise.
14849         (Symbol::output_section): Assert that object is not a plugin.
14850         (Symbol_table::add_from_pluginobj): New function.
14851         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
14852         undefined.
14853         (Symbol_table::sized_write_globals): Likewise.
14854         (Symbol_table::add_from_pluginobj): Instantiate template.
14855         * symtab.h (Sized_pluginobj): Declare.
14856         (Symbol::in_real_elf): New function.
14857         (Symbol::set_in_real_elf): New function.
14858         (Symbol::in_real_elf_): New field.
14859         (Symbol_table::add_from_pluginobj): New function.
14860
14861         * testsuite/Makefile.am (AM_CFLAGS): New variable.
14862         (LIBDL): New variable.
14863         (LDADD): Add LIBDL.
14864         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
14865         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
14866         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
14867         (MOSTLYCLEANFILES): Likewise.
14868         * testsuite/Makefile.in: Regenerate.
14869         * testsuite/plugin_test.c: New file.
14870         * testsuite/plugin_test_1.sh: New file.
14871         * testsuite/plugin_test_2.sh: New file.
14872
14873 2008-09-16  Ian Lance Taylor  <iant@google.com>
14874
14875         * target-reloc.h (relocate_section): Check whether a symbol is
14876         defined by the ABI before reporting an undefined symbol error.
14877         * target.h (Target::is_defined_by_abi): Make parameter const.
14878         (Target::do_is_defined_by_abi): Likewise.
14879         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
14880         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
14881         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
14882         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
14883         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
14884         * testsuite/Makefile.in: Rebuild.
14885
14886         * fileread.cc (make_view): Add casts to avoid warning.
14887
14888 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14889
14890         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
14891         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14892
14893 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14894
14895         * options.h (General_options::output_is_executable): New.
14896         (General_options::output_is_pie): New.
14897         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
14898         for shared libraries.
14899         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14900
14901 2008-09-11  Chris Demetriou  <cgd@google.com>
14902
14903         * options.h (origin): New -z option.
14904         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
14905         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
14906         in DT_FLAGS_1.
14907
14908 2008-09-05  Cary Coutant  <ccoutant@google.com>
14909
14910         * fileread.cc (File_read::make_view): Add check for attempt to map
14911         beyond end of file.
14912
14913 2008-09-05  Cary Coutant  <ccoutant@google.com>
14914
14915         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
14916         explicit instantiations.
14917
14918 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
14919
14920         PR gold/6858
14921         * options.cc (General_options::finalize): Allow undefined symbols
14922         in shlibs if linking -shared.
14923
14924         PR gold/6859
14925         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14926         symbols as not needing a dynsym entry.
14927
14928 2008-08-20  Craig Silverstein  <csilvers@google.com>
14929
14930         * fileread.cc (File_read::open): Do not lock the file unless it
14931         was successfully opened.
14932
14933 2008-08-14  Cary Coutant  <ccoutant@google.com>
14934
14935         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14936         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14937         * testsuite/tls_test.cc (struct int128): 128-bit struct
14938         for testing TLS relocs with non-zero addend.
14939         (v12): New TLS variable.
14940         (t12): New test.
14941         (t_last): Add check for v12.
14942         * testsuite/tls_test.h (t12): New function.
14943         * testsuite/tls_test_main.cc (thread_routine): Call new test.
14944
14945 2008-08-13  Ian Lance Taylor  <iant@google.com>
14946
14947         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14948         set tls_segment_ or relro_segment_.
14949         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
14950         when appropriate.
14951         * output.h (Output_section::clear_is_relro): New function.
14952         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
14953         sections specially even when output_data_ is empty.
14954         (Output_segment::maximum_alignment): When first section is relro,
14955         only force alignment for PT_LOAD segments.
14956         * script.cc (script_data_segment_align): New function.
14957         (script_data_segment_relro_end): New function.
14958         * script-c.h (script_data_segment_align): Declare.
14959         (script_data_segment_relro_end): Declare.
14960         * script-sections.h (class Script_sections): Declare
14961         data_segment_align and data_segment_relro_end.  Add fields
14962         segment_align_index_ and saw_relro_end_.
14963         * script-sections.cc (class Sections_element): Add set_is_relro
14964         virtual function.  Add new bool* parameter to place_orphan_here.
14965         Add get_output_section virtual function.
14966         (class Output_section_definition): Add set_is_relro.  Add new
14967         bool* parameter to place_orphan_here.  Add get_output_section.
14968         Add is_relro_ field.
14969         (Output_section_definition::Output_section_definition): Initialize
14970         evaluated_address_, evaluated_load_address, evaluated_addralign_,
14971         and is_relro_ fields.
14972         (Output_section_definition::place_orphan_here): Add is_relro
14973         parameter.
14974         (Output_section_definition::set_section_addresses): Set relro for
14975         output section.
14976         (Output_section_definition::alternate_constraint): Likewise.
14977         (class Orphan_output_section): Add new bool* parameter to
14978         place_orphan_here.  Add get_output_section.
14979         (Orphan_output_section::place_orphan_here): Add is_relro
14980         parameter.
14981         (Script_sections::Script_sections): Initialize
14982         data_segment_align_index_ and saw_relro_end_.
14983         (Script_sections::data_segment_align): New function.
14984         (Script_sections::data_segment_relro_end): New function.
14985         (Script_sections::place_orphan): Set or clear is_relro.
14986         (Script_sections::set_section_addresses): Force alignment of first
14987         TLS section.
14988         * yyscript.y (exp): Call script_data_segment_align and
14989         script_data_segment_relro_end.
14990         * testsuite/relro_script_test.t: New file.
14991         * testsuite/relro_test.cc (using_script): Declare.
14992         (t1, t2): Test using_script.
14993         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14994         (relro_script_test_SOURCES): Define.
14995         (relro_script_test_DEPENDENCIES): Define.
14996         (relro_script_test_LDFLAGS): Define.
14997         (relro_script_test_LDADD): Define.
14998         (relro_script_test.so): New target.
14999         * testsuite/Makefile.in: Rebuild.
15000
15001 2008-08-06  Cary Coutant <ccoutant@google.com>
15002
15003         * archive.cc (Archive::total_archives, Archive::total_members)
15004         (Archive::total_members_loaded): New variables.
15005         (Archive::setup): Add parameter.  Add option to preread
15006         archive symbols.
15007         (Archive::read_armap): Add counter.
15008         (Archive::get_file_and_offset): New function.
15009         (Archive::get_elf_object_for_member): New function.
15010         (Archive::read_all_symbols): New function.
15011         (Archive::read_symbols): New function.
15012         (Archive::add_symbols): Add counters.
15013         (Archive::include_all_members): Use armap to find members if it's
15014         already built.
15015         (Archive::include_member): Skip reading symbols if already read.
15016         Factored code into Archive::get_file_and_offset and
15017         Archive::get_elf_object_for_member.  Changed call to
15018         Mapfile::report_include_archive_member.
15019         (Archive::print_stats): New function.
15020         * archive.h: Declare Object and Read_symbols_data classes.
15021         (Archive::Archive): Add initializers for new members.
15022         (Archive::setup): Add parameter.
15023         (Archive::print_stats): New function.
15024         (Archive::total_archives, Archive::total_members)
15025         (Archive::total_members_loaded): New variables.
15026         (Archive::get_file_and_offset): New function.
15027         (Archive::get_elf_object_for_member): New function.
15028         (Archive::read_all_symbols): New function.
15029         (Archive::read_symbols): New function.
15030         (Archive::Archive_member): New class.
15031         (Archive::members_): New member.
15032         (Archive::num_members_): New member.
15033         * main.cc: Include archive.h.
15034         (main): Call Archive::print_stats.
15035         * mapfile.cc (Mapfile::report_include_archive_member): Delete
15036         archive parameter; member_name is now the fully-decorated name.
15037         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
15038         * options.h: (General_options): Add --preread-archive-symbols option.
15039         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
15040         Archive::setup.
15041
15042 2008-08-04  Ian Lance Taylor  <iant@google.com>
15043
15044         * symtab.h (Symbol::use_plt_offset): New function.
15045         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
15046         * powerpc.cc (Relocate::relocate): Likewise.
15047         * sparc.cc (Relocate::relocate): Likewise.
15048         * x86_64.cc (Relocate::relocate): Likewise.
15049         * testsuite/weak_plt.sh: New test.
15050         * testsuite/weak_plt_main.cc: New test.
15051         * testsuite/weak_plt_shared.cc: New test.
15052         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
15053         (check_PROGRAMS): Add weak_plt.
15054         (check_DATA): Add weak_plt_shared.so.
15055         (weak_plt_main_pic.o, weak_plt): New targets.
15056         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
15057         * testsuite/Makefile.in: Rebuild.
15058
15059         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
15060         gcctestdir/ld.
15061         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
15062         * testsuite/Makefile.in: Rebuild.
15063
15064 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
15065
15066         * Makefile.am (POTFILES.in): Set LC_ALL=C.
15067         * Makefile.in: Regenerate.
15068         * po/POTFILES.in: Regenerate.
15069
15070 2008-07-29  Ian Lance Taylor  <iant@google.com>
15071
15072         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
15073         symbols before other symbols.
15074         * testsuite/script_test_2.cc (test_addr): Declare.
15075         (test_addr_alias): Declare.
15076         (main): Check that test_addr and test_addr_alias have the right
15077         values.
15078         * testsuite/script_test_2.t: Define test_addr_alias and
15079         test_addr.
15080
15081 2008-07-24  Ian Lance Taylor  <iant@google.com>
15082
15083         PR 5990
15084         * descriptors.cc: New file.
15085         * descriptors.h: New file.
15086         * gold-threads.h (class Hold_optional_lock): New class.
15087         * fileread.cc: Include "descriptors.h".
15088         (File_read::~File_read): Release descriptor rather than closing
15089         it.
15090         (File_read::open) [file]: Call open_descriptor rather than open.
15091         Set is_descriptor_opened_.
15092         (File_read::open) [memory]: Assert that descriptor is not open.
15093         (File_read::reopen_descriptor): New function.
15094         (File_read::release): Release descriptor.
15095         (File_read::do_read): Make non-const.  Reopen descriptor.
15096         (File_read::read): Make non-const.
15097         (File_read::make_view): Reopen descriptor.
15098         (File_read::do_readv): Likewise.
15099         * fileread.h (class File_read): Add is_descriptor_opened_ field.
15100         Update declarations.
15101         * layout.cc: Include "descriptors.h".
15102         (Layout::create_build_id): Use open_descriptor rather than open.
15103         * output.cc: Include "descriptors.h".
15104         (Output_file::open): Use open_descriptor rather than open.
15105         * archive.cc (Archive::const_iterator): Change Archive to be
15106         non-const.
15107         (Archive::begin, Archive::end): Make non-const.
15108         (Archive::count_members): Likewise.
15109         * archive.h (class Archive): Update declarations.
15110         * object.h (Object::read): Make non-const.
15111         * Makefile.am (CCFILES): Add descriptors.cc.
15112         (HFILES): Add descriptors.h.
15113         * Makefile.in: Rebuild.
15114
15115         PR 6716
15116         * gold.h: Always include <clocale>.  Add Solaris workarounds
15117         following code in binutils/sysdep.h.
15118
15119         PR 6048
15120         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
15121         this->eh_frame_hdr_ is NULL before using it.
15122
15123         * dynobj.cc (Versions::Versions): Update comment.
15124
15125         * dynobj.cc (Versions::Versions): If there is an soname, use it as
15126         the base version name.
15127
15128         * stringpool.cc (Stringpool_template::add_with_length): Set key to
15129         array size plus one.
15130         (Stringpool_template::set_string_offsets): Subtract one from key
15131         before using it as an array index.
15132         (Stringpool_template::get_offset_with_length): Likewise.
15133         (Stringpool_template::write_to_buffer): Likewise.
15134         * stringpool.h (Stringpool_template::get_offset_from_key):
15135         Likewise.
15136
15137 2008-07-23  Ian Lance Taylor  <iant@google.com>
15138
15139         PR 6658
15140         * object.h (Merged_symbol_value::value): Do our best to handle a
15141         negative addend.
15142
15143         PR 6647
15144         * script.cc (Version_script_info::get_versions): Don't add empty
15145         version tag to return value.
15146         (Version_script_info::get_symbol_version_helper): Change return
15147         type to bool.  Add pversion parameter.  Change all callers.
15148         (script_register_vers_node): Don't require a non-NULL tag.
15149         * script.h (class Version_script_info): Update declarations.
15150         (Version_script_info::get_symbol_version): Change return type to
15151         bool.  Add version parameter.  Change all callers.
15152         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
15153         handling.  Handle an empty version from a version script.
15154         (Symbol_table::define_special_symbol): Likewise.
15155         * testsuite/ver_test_10.script: New file.
15156         * testsuite/ver_test_10.sh: New file.
15157         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
15158         (check_DATA): Add ver_test_10.syms.
15159         (ver_test_10.syms, ver_test_10.so): New target.
15160         * testsuite/Makefile.in: Rebuild.
15161
15162 2008-07-23  Simon Baldwin  <simonb@google.com>
15163
15164         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
15165         to zero for undefined symbols from dynamic libraries.
15166
15167 2008-07-23  Ian Lance Taylor  <iant@google.com>
15168
15169         * symtab.cc (Symbol_table::resolve): Remove version parameter.
15170         Change all callers.
15171         * symtab.h (class Symbol_table): Update declaration.
15172         * testsuite/ver_test_9.cc: New file.
15173         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
15174         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
15175         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
15176         (ver_test_9.so, ver_test_9.o): New targets.
15177         * testsuite/Makefile.in: Rebuild.
15178
15179 2008-07-22  Ian Lance Taylor  <iant@google.com>
15180
15181         * options.h (class General_options): Define --check-sections.
15182         * layout.cc (Layout::set_segment_offsets): Handle
15183         --check-sections.
15184
15185         * options.h (class General_options): Define -n/--nmagic and
15186         -N/--omagic.
15187         * options.cc (General_options::finalize): For -n/--nmagic or
15188         -N/--omagic, set -static.
15189         * layout.cc (Layout::attach_allocated_section_to_segment): If
15190         -N/--omagic, don't put read-only and read-write sections in
15191         different segments.
15192         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
15193         finding a read-only segment.
15194         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
15195         don't set the minimum segment alignment to the common page size,
15196         and don't set the file offset to the address modulo the page size.
15197         * script-sections.cc (Script_sections::create_segments): If
15198         -n/--omagic, don't put read-only and read-write sections in
15199         different segments.
15200
15201         * cref.cc: New file.
15202         * cref.h: New file.
15203         * options.h (class General_options): Add --print-symbol-counts.
15204         * main.cc (main): Issue defined symbol report if requested.
15205         * archive.cc (Archive::interpret_header): Make into a const member
15206         function.
15207         (Archive::add_symbols): Call Input_objects::archive_start and
15208         archive_stop.
15209         (Archive::const_iterator): Define new class.
15210         (Archive::begin, Archive::end): New functions.
15211         (Archive::include_all_members): Rewrite to use iterator.
15212         (Archive::count_members): New function.
15213         * archive.h (class Archive): Update declarations.
15214         (Archive::filename): New function.
15215         * object.cc: Include "cref.h".
15216         (Sized_relobj::Sized_relobj): Initialize defined_count_.
15217         (Sized_relobj::do_get_global_symbol_counts): New function.
15218         (Input_objects::add_object): Add object to cross-referencer.
15219         (Input_objects::archive_start): New function.
15220         (Input_objects::archive_stop): New function.
15221         (Input_objects::print_symbol_counts): New function.
15222         * object.h: Declare Cref and Archive.
15223         (Object::get_global_symbol_counts): New function.
15224         (Object::do_get_global_symbol_counts): New pure virtual function.
15225         (class Sized_relobj): Add defined_count_ field.  Update
15226         declarations.
15227         (class Input_objects): Add cref_ field.  Update constructor.
15228         Update declarations.
15229         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
15230         defined_count_.
15231         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
15232         symbol counts.
15233         (Sized_dynobj::do_get_global_symbol_counts): New function.
15234         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
15235         defined_count_.  Update declarations.  Define Symbols typedef.
15236         * symtab.cc (Symbol_table::add_from_relobj): Add defined
15237         parameter.  Change all callers.
15238         (Symbol_table::add_from_dynobj): Add sympointers and defined
15239         parameters.  Change all callers.
15240         * symtab.h (class Symbol_table): Update declarations.
15241         * Makefile.am (CCFILES): Add cref.cc.
15242         (HFILES): Add cref.h.
15243         * Makefile.in: Rebuild.
15244
15245 2008-07-22  Simon Baldwin  <simonb@google.com>
15246
15247         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
15248         to zero when writing undefined symbols.
15249
15250 2008-07-22  Ian Lance Taylor  <iant@google.com>
15251
15252         * output.cc (Output_section::add_input_section): Don't try to
15253         merge empty merge sections.
15254
15255 2008-07-21  Craig Silverstein  <csilvers@google.com>
15256
15257         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15258         Include symbol version in error message.
15259
15260 2008-07-20  Chris Demetriou  <cgd@google.com>
15261
15262         * configure.ac (gold_cv_c_random_seed): New configured variable.
15263         (RANDOM_SEED_CFLAGS): New substituted variable.
15264         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
15265         * configure: Rebuild.
15266         * Makefile.in: Likewise.
15267         * testsuite/Makefile.in: Likewise.
15268
15269 2008-07-18  Ian Lance Taylor  <iant@google.com>
15270
15271         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
15272         where we see NAME/NULL and NAME/VERSION  as separate symbols.
15273         * testsuite/ver_test_main.cc (main): Call t4.
15274         (t4, t4_2a): Define.
15275         * testsuite/ver_test_2.cc (t4_2): Define.
15276         * testsuite/ver_test_2.script: Put t4_2a in VER2.
15277         * testsuite/ver_test_4.cc (t4_2a): Define.
15278         * testsuite/ver_test_4.script: Put t4_2a in VER2.
15279         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
15280
15281 2008-07-17  Ian Lance Taylor  <iant@google.com>
15282
15283         * dynobj.cc (Versions::add_def): If we give an error about a
15284         missing version, go ahead and create the version anyhow.
15285
15286 2008-07-10  Ian Lance Taylor  <iant@google.com>
15287
15288         Handle output sections with more than 0x7fffffff bytes.
15289         * object.h (class Relobj): Change map_to_output_ to
15290         output_sections_, and just keep a section pointer.  Change all
15291         uses.  Move comdat group support to Sized_relobj.
15292         (Relobj::is_section_specially_mapped): Remove.
15293         (Relobj::output_section): Remove poff parameter.  Change all
15294         callers.
15295         (Relobj::output_section_offset): New function.
15296         (Relobj::set_section_offset): Rewrite.
15297         (Relobj::map_to_output): Remove.
15298         (Relobj::output_sections): New function.
15299         (Relobj::do_output_section_offset): New pure virtual function.
15300         (Relobj::do_set_section_offset): Likewise.
15301         (class Sized_relobj): Add section_offsets_ field.  Add comdat
15302         group support from Relobj.  Update declarations.
15303         (Sized_relobj::get_output_section_offset): New function.
15304         (Sized_relobj::do_output_section_offset): New function.
15305         (Sized_relobj::do_set_section_offset): New function.
15306         * object.cc (Relobj::output_section_address): Remove.
15307         (Sized_relobj::Sized_relobj): Initialize new fields.
15308         (Sized_relobj::include_section_group): Cast find_kept_object to
15309         Sized_relobj.
15310         (Sized_relobj::include_linkonce_section): Likewise.
15311         (Sized_relobj::do_layout): Use separate arrays for output section
15312         and output offset.
15313         (Sized_relobj::do_count_local_symbols): Change map_to_output to
15314         output_sections.
15315         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
15316         output_sections and section_offsets.
15317         (Sized_relobj::write_local_symbols): Likewise.
15318         (map_to_kept_section): Compute output address directly.
15319         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
15320         output_sections and section_offsets.
15321         (Sized_relobj::write_sections): Likewise.
15322         (Sized_relobj::relocate_sections): Likewise.
15323         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
15324         * output.h (class Output_reloc): Update declarations.  Change
15325         u2_.relobj to Sized_relobj*.
15326         (class Output_data_reloc): Change add functions to use
15327         Sized_relobj*.
15328         * output.cc (Output_reloc::Output_reloc): Change relobj to
15329         Sized_relobj*.
15330         (Output_reloc::local_section_offset): Change return type to
15331         Elf_Addr.  Use get_output_section_offset.
15332         (Output_reloc::get_address): Likewise.
15333         (Output_section::is_input_address_mapped): Don't call
15334         is_section_specially_mapped.
15335         (Output_section::output_offset): Likewise.
15336         (Output_section::output_address): Likewise.
15337         (Output_section::starting_output_address): Likewise.
15338         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
15339         parameter to Sized_relobj*.
15340         (Copy_relocs::need_copy_reloc): Likewise.
15341         (Copy_relocs::save): Likewise.
15342         * copy-relocs.h (class Copy_relocs): Update declarations.
15343         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
15344         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
15345         * target-reloc.h (relocate_for_relocatable): Change
15346         offset_in_output_section type to Elf_Addr.  Change code that uses
15347         it as well.
15348         * layout.cc (Layout::layout): Always set *off.
15349         * mapfile.cc (Mapfile::print_input_section): Use
15350         output_section_offset.
15351         * i386.cc (Target_i386::copy_reloc): Change object parameter to
15352         Sized_relobj*.
15353         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
15354         * sparc.cc (Target_sparc::copy_reloc): Likewise.
15355         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
15356
15357 2008-07-03  Ian Lance Taylor  <iant@google.com>
15358
15359         * layout.cc (Layout::include_section): Do not discard unrecognized
15360         SHT_STRTAB sections.
15361
15362 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
15363
15364         * script.cc (Lex::can_continue_name): Make '?' allowable in
15365         version-script names.
15366         * testsuite/version_script.map: Change glob pattern to use '?'
15367
15368 2008-06-30  Manish Singh  <yosh@gimp.org>
15369
15370         PR 6585
15371         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
15372         Correct typo.
15373
15374 2008-06-30  Ian Lance Taylor  <iant@google.com>
15375
15376         PR 6660
15377         PR 6682
15378         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
15379         versions]: Don't try to read the value in the contents, since we
15380         don't use it.  Use the template endianness when writing.
15381
15382 2008-06-25  Cary Coutant  <ccoutant@google.com>
15383
15384         * fileread.cc (File_read::make_view): Assert on zero-length view.
15385         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
15386         symbol table when there are no symbols to read.
15387
15388 2008-06-23  Craig Silverstein  <csilvers@google.com>
15389
15390         * version.cc (version_string): Bump to 1.7
15391
15392 2008-06-18  Craig Silverstein  <csilvers@google.com>
15393
15394         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
15395         constant 0xFFFF to type Valtype.
15396         (Powerpc_relocate_functions::rel16_ha): Likewise.
15397
15398 2008-06-17  Ian Lance Taylor  <iant@google.com>
15399
15400         * output.h (Output_section::Input_section): Initialize p2align_ to
15401         zero for Output_section_data constructors.
15402         (Output_section::Input_section::addralign): If not an input
15403         section, return the alignment of the Output_section_data.
15404         * testsuite/copy_test.cc: New file.
15405         * testsuite/copy_test_1.cc: New file.
15406         * testsuite/copy_test_2.cc: New file.
15407         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
15408         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
15409         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
15410         (copy_test_1_pic.o, copy_test_1.so): New targets.
15411         (copy_test_2_pic.o, copy_test_2.so): New targets.
15412         * testsuite/Makefile.in: Rebuild.
15413
15414         * script-sections.cc (Script_sections::place_orphan): Initialize
15415         local variable exact.
15416
15417 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
15418
15419         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
15420
15421 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
15422             David S. Miller  <davem@davemloft.net>
15423
15424         * powerpc.cc: New file.
15425         * Makefile.am (TARGETSOURCES): Add powerpc.cc
15426         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
15427         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
15428         * Makefile.in: Rebuild.
15429
15430 2008-06-09  Ian Lance Taylor  <iant@google.com>
15431
15432         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
15433         <exception>.
15434         (throwing, orig_terminate): New static variables.
15435         (terminate_handler): New static function.
15436         (t2): Set terminate handler.
15437
15438 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
15439
15440         PR 6584
15441         * binary.cc (Binary_to_elf::sized_convert): Fix .data
15442         alignment.
15443
15444 2008-05-30  Cary Coutant  <ccoutant@google.com>
15445
15446         * archive.cc (Archive::include_all_members) Correct to step
15447         over symbol table and extended name table in thin archives.
15448
15449 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
15450
15451         PR 6407
15452         * target-reloc.h (relocate_for_relocatable): Fix new_offset
15453         calculation.
15454
15455 2008-05-28  Caleb Howe  <cshowe@google.com>
15456
15457         * reduced_debug_output.cc: New file.
15458         * reduced_debug_output.h: New file.
15459         * options.h (class General_options): Add --strip-debug-non-line.
15460         * options.cc (General_options::finalize): Add strip_debug_non_line
15461         to the strip heirarchy.
15462         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
15463         fields.
15464         * layout.cc: Include "reduced_debug_output.h".
15465         (Layout::Layout): Initialize new fields.
15466         (line_only_debug_sections): New static array.
15467         (is_lines_only_debug_sections): New static inline function.
15468         (Layout::include_section): Handle --strip-debug-non-line.
15469         (Layout::make_output_section): If --strip-debug-non-line, build
15470         new output sections for .debug_abbrev and .debug_info.
15471         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
15472         gold.  Warn about possible overflow.
15473         (read_signed_LEB_128): Likewise.
15474         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
15475         (read_signed_LEB_128): Declare.
15476         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
15477         (HFILES): Add reduced_debug_output.h.
15478         * Makefile.in: Rebuild.
15479
15480 2008-05-21  Ian Lance Taylor  <iant@google.com>
15481
15482         * mapfile.cc: New file.
15483         * mapfile.h: New file.
15484         * options.h (class General_options): Add -M/--print-map and -Map.
15485         * options.cc (General_options::finalize): Make -M equivalent to
15486         -Map -.
15487         * main.cc: Include <cstdio> and "mapfile.h".
15488         (main): Open mapfile if requested.
15489         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
15490         constructor.  Change caller.
15491         (queue_initial_tasks): Add mapfile parameter.  Change caller.
15492         (queue_middle_tasks): Likewise.
15493         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
15494         declarations.
15495         * archive.cc: Include "mapfile.h".
15496         (Archive::add_symbols): Add mapfile parameter.  Change all
15497         callers.  Pass mapfile, symbol, and reason to include_member.
15498         (Archive::include_all_members): Add mapfile parameter.  Change all
15499         callers.
15500         (Archive::include_member): Add mapfile, sym, and why parameters.
15501         Change all callers.  Report inclusion to map file.
15502         * archive.h: Include "fileread.h".
15503         (class Archive): Update declarations.
15504         (Archive::file): New const method.
15505         (class Add_archive_symbols): Add mapfile_ field.  Update
15506         constructor.  Change all callers.
15507         * readsyms.h (class Read_symbols): Likewise.
15508         (class Finish_group): Likewise.
15509         (class Read_script): Likewise.
15510         * common.cc: Include "mapfile.h".
15511         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
15512         all callers.
15513         (Symbol_table::do_allocate_commons): Likewise.
15514         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
15515         symbol allocation to mapfile.
15516         * common.h (class Allocate_commons_task): Add mapfile_ field.
15517         Update constructor.  Change all callers.
15518         * symtab.h (class Symbol_table): Update declarations.
15519         * layout.cc: Include "mapfile.h".
15520         (Layout_task_runner::run): Print information to mapfile.
15521         (Layout::create_gold_note): Change Output_data_fixed_space to
15522         Output_data_zero_fill.
15523         (Layout::create_build_id): Likewise.
15524         (Layout::print_to_mapfile): New function.
15525         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
15526         constructor.  Change caller.
15527         (class Layout): Declare print_to_mapfile.
15528         * output.cc (Output_section::Input_section::print_to_mapfile): New
15529         function.
15530         (Output_section::add_input_section): If producing a map, always
15531         add to input_sections_ list.
15532         (Output_section::do_print_to_mapfile): New function.
15533         (Output_segment::print_sections_to_mapfile): New function.
15534         (Output_segment::print_section_list_to_mapfile): New function.
15535         * output.h: Include "mapfile.h".
15536         (Output_data::print_to_mapfile): New function.
15537         (Output_data::do_print_to_mapfile): New virtual function.
15538         (Output_segment_headers::do_print_to_mapfile): New function.
15539         (Output_file_header::do_print_to_mapfile): New function.
15540         (Output_data_const::do_print_to_mapfile): New function.
15541         (class Output_data_const_buffer): Add map_name_ field.  Update
15542         constructor.  Change all callers.  Add do_print_to_mapfile
15543         function.
15544         (class Output_data_fixed_space): Likewise.
15545         (class Output_data_space): Likewise.
15546         (class Output_data_zero_fill): New class.
15547         (Output_data_strtab::do_print_to_mapfile): New function.
15548         (Output_data_reloc_base::do_print_to_mapfile): New function.
15549         (Output_relocatable_relocs::do_print_to_mapfile): New function.
15550         (Output_data_group::do_print_to_mapfile): New function.
15551         (Output_data_got::do_print_to_mapfile): New function.
15552         (Output_data_dynamic::do_print_to_mapfile): New function.
15553         (Output_symtab_xindex::do_print_to_mapfile): New function.
15554         (class Output_section): Declare do_print_to_mapflie.  Declare
15555         print_to_mapfile in Input_section.
15556         (class Output_segment): Declare new functions.
15557         * object.h (Sized_relobj::symbol_count): New function.
15558         * script-sections.cc
15559         (Output_section_element_dot_assignment::set_section_addresses):
15560         Change Output_data_fixed_space to Output_data_zero_fill.
15561         (Output_data_expression::do_print_to_mapfile): New function.
15562         * script.cc (read_input_script): Add mapfile parameter.  Change
15563         all callers.
15564         * script.h (read_input_script): Update declaration.
15565         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
15566         (Eh_frame::do_print_to_mapfile): New function.
15567         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
15568         (Output_merge_string::do_print_to_mapfile): New function.
15569         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
15570         function.
15571         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
15572         function.
15573         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
15574         function.
15575         * Makefile.am (CCFILES): Add mapfile.cc.
15576         (HFILES): Add mapfile.h.
15577         * Makefile.in: Rebuild.
15578
15579 2008-05-19  Ian Lance Taylor  <iant@google.com>
15580
15581         * options.h (class General_options): Add -z relro.
15582         * layout.cc (Layout::Layout): Initialize relro_segment_.
15583         (Layout::add_output_section_data): Return the output section.
15584         (Layout::make_output_section): Rcognize relro sections and mark
15585         them appropriately.
15586         (Layout::attach_allocated_section_to_segment): Put relro sections
15587         in a PT_GNU_RELRO segment.
15588         (Layout::create_initial_dynamic_sections): Mark the .dynamic
15589         section as relro.
15590         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
15591         PT_TLS segments.
15592         (Layout::linkonce_mapping): Map d.rel.ro.local to
15593         .data.rel.ro.local.
15594         (Layout::output_section_name): Us .data.rel.ro.local for any
15595         section which begins with that.
15596         * layout.h (class Layout): Update add_output_section_data
15597         declaration.  Add relro_segment_ field.
15598         * output.cc (Output_section::Output_section): Initialize is_relro_
15599         and is_relro_local_ fields.
15600         (Output_segment::add_output_section): Group relro sections.
15601         (Output_segment::is_first_section_relro): New function.
15602         (Output_segment::maximum_alignment): If there is a relro section,
15603         align the segment to the common page size.
15604         (Output_segment::set_section_addresses): Track whether we are
15605         looking at relro sections.  If the last section is a relro
15606         section, align to the common page size.
15607         (Output_segment::set_section_list_addresses): Add in_relro
15608         parameter.  Change all callers.  Align to the page size when
15609         moving from relro to non-relro section.
15610         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
15611         segment.
15612         * output.h (class Output_section): Add is_relro_ and
15613         is_relro_local_ fields.
15614         (Output_section::is_relro): New function.
15615         (Output_section::set_is_relro): New function.
15616         (Output_section::is_relro_local): New function.
15617         (Output_section::set_is_relro_local): New function.
15618         (class Output_segment): Update declarations.
15619         * i386.cc (Target_i386::got_section): Mark .got section as relro.
15620         * sparc.cc (Target_sparc::got_section): Likewise.
15621         * x86_64.cc (Target_x86_64::got_section): Likewise.
15622         * testsuite/relro_test_main.cc: New file.
15623         * testsuite/relro_test.cc: New file.
15624         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
15625         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
15626         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
15627         (relro_test.so, relro_test_pic.o): New targets.
15628         * testsuite/Makefile.in: Rebuild.
15629
15630 2008-05-16  Ian Lance Taylor  <iant@google.com>
15631
15632         * output.cc (Output_segment::add_output_section): Remove front
15633         parameter.
15634         * output.h (class Output_segment): Remove
15635         add_initial_output_section and overloaded add_output_section.
15636         Update declaration of remaining add_output_section.
15637         * layout.cc (Layout::create_interp): Call add_output_section
15638         rather than add_initial_output_section.
15639         (Layout::finish_dynamic_section): Likewise.
15640
15641         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
15642         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
15643         know the dynamic type.
15644         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
15645         field.  Initialize it in constructor.
15646         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
15647         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
15648         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
15649         reloc.
15650
15651         * output.cc (Output_reloc::get_address): Change return type to
15652         Elf_Addr.
15653         * output.h (class Output_reloc): Update get_address declaration.
15654         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
15655         for section addresses.
15656
15657 2008-05-09  Ian Lance Taylor  <iant@google.com>
15658
15659         PR 6493
15660         * gold.cc (gold_nomem): Use return value of write.
15661
15662 2008-05-08  Ian Lance Taylor  <iant@google.com>
15663
15664         * symtab.c (Symbol::init_base_output_data): Add version
15665         parameter.  Change all callers.
15666         (Symbol::init_base_output_segment): Likewise.
15667         (Symbol::init_base_constant): Likewise.
15668         (Symbol::init_base_undefined): Likewise.
15669         (Sized_symbol::init_output_data): Likewise.
15670         (Sized_symbol::init_output_segment): Likewise.
15671         (Sized_symbol::init_constant): Likewise.
15672         (Sized_symbol::init_undefined): Likewise.
15673         (Symbol_table::do_define_in_output_data): If the new symbol has a
15674         version, mark it as the default.
15675         (Symbol_table::do_define_in_output_segment): Likewise.
15676         (Symbol_table::do_define_as_constant): Likewise.
15677         * symtab.h (class Symbol): Update declarations.
15678         (class Sized_symbol): Likewise.
15679         * resolve.cc (Symbol::override_version): New function.
15680         (Symbol::override_base): Call override_version.
15681         (Symbol::override_base_with_special): Likewise.
15682         * testsuite/ver_script_8.script: New file.
15683         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
15684         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
15685         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
15686         (ver_test_8_1.so, ver_test_8_2.so): New targets.
15687
15688 2008-05-06  Ian Lance Taylor  <iant@google.com>
15689
15690         PR 6049
15691         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
15692         functions.
15693         (class General_options): Remove existing --undefined, and add
15694         --no-undefined instead.  Add new --undefined as synonym for -u.
15695         * archive.cc (Archive::add_symbols): Check whether symbol was
15696         named with -u.
15697         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
15698         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
15699         all uses.  Add IS_UNDEFINED.  Update declarations to split
15700         different versions of init_base.  Declare init_base_undefined.
15701         (Symbol::is_defined): Handle IS_UNDEFINED.
15702         (Symbol::is_undefined): Likewise.
15703         (Symbol::is_weak_undefined): Call is_undefined.
15704         (Symbol::is_absolute): Handle IS_CONSTANT.
15705         (class Sized_symbol): Update declarations to split different
15706         versions of init.  Declare init_undefined.
15707         (class Symbol_table): Declare new functions.
15708         * symtab.cc (Symbol::init_base_object): Rename from init_base.
15709         Change all callers.
15710         (Symbol::init_base_output_data): Likewise.
15711         (Symbol::init_base_output_segment): Likewise.
15712         (Symbol::init_base_constant): Likewise.
15713         (Symbol::init_base_undefined): New function.
15714         (Sized_symbol::init_object): Rename from init.  Change all
15715         callers.
15716         (Sized_symbol::init_output_data): Likewise.
15717         (Sized_symbol::init_output_segment): Likewise.
15718         (Sized_symbol::init_constant): Likewise.
15719         (Sized_symbol::init_undefined): New function.
15720         (Symbol_table::add_undefined_symbols_from_command_line): New
15721         function.
15722         (Symbol_table::do_add_undefined_symbols_from_command_line): New
15723         function.
15724         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
15725         (Symbol::output_section): Likewise.
15726         (Symbol::set_output_section): Likewise.
15727         (Symbol_table::sized_finalize_symbol): Likewise.
15728         (Symbol_table::sized_write_globals): Likewise.
15729         * resolve.cc (Symbol_table::should_override): Likewise.
15730         (Symbol::override_base_with_special): Likewise.
15731
15732         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
15733         symbol, change it to have default visibility.
15734         * testsuite/protected_1.cc: New file.
15735         * testsuite/protected_2.cc: New file.
15736         * testsuite/protected_3.cc: New file.
15737         * testsuite/protected_main_1.cc: New file.
15738         * testsuite/protected_main_2.cc: New file.
15739         * testsuite/protected_main_3.cc: New file.
15740         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
15741         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
15742         (protected_1_LDFLAGS, protected_1_LDADD): Define.
15743         (protected_1.so): New target.
15744         (protected_1_pic.o, protected_2_pic.o): New targets.
15745         (protected_3_pic.o): New target.
15746         (check_PROGRAMS): Add protected_2.
15747         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
15748         (protected_2_LDFLAGS, protected_2_LDADD): Define.
15749         * testsuite/Makefile.in: Rebuild.
15750
15751         * options.h (DEFINE_var): Add set_user_set_##varname__.
15752         (DEFINE_bool_alias): New macro.
15753         (class General_options): Define -Bstatic using DEFINE_bool_alias
15754         rather than DEFINE_special.  Add --undefined as an alias for -z
15755         defs.
15756         * options.cc (General_options::parse_Bstatic): Remove.
15757
15758         * options.h (class General_options): Add --fatal-warnings.
15759         * main.cc (main): Implement --fatal-warnings.
15760         * errors.h (Errors::warning_count): New function.
15761
15762         * options.h (class General_options): Add -Bsymbolic-functions.
15763         * symtab.h (Symbol::is_preemptible): Check for
15764         -Bsymbolic-functions.
15765
15766 2008-05-05  Ian Lance Taylor  <iant@google.com>
15767
15768         * options.h (DEFINE_bool): For DASH_Z, create the negative option
15769         as noVARNAME rather than no-VARNAME.
15770         (class General_options): Add option -z combreloc.
15771         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15772         get_address.
15773         (Output_reloc::sort_before) [SHT_REL]: New function.
15774         (Output_reloc::sort_before) [SHT_RELA]: New function.
15775         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
15776         Sort_relocs_comparison.
15777         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15778         parameter.  Change all callers.
15779         (Output_data_reloc::Output_data_reloc) [both versions]: Add
15780         sort_relocs parameter.  Change all callers.
15781         * output.cc (Output_reloc::get_address): New function, broken out
15782         of write_rel.
15783         (Output_reloc::write_rel): Call it.
15784         (Output_reloc::compare): New function.
15785         (Output_data_reloc_base::do_write): Optionally sort relocs.
15786
15787         * configure.ac: If targ_extra_obj is set, link it in.
15788         * configure.tgt: Initialize all variables.
15789         (x86_64*): Set targ_extra_obj and targ_extra_size.
15790         * configure: Rebuild.
15791
15792         * object.cc (Sized_relobj::include_section_group): Adjust section
15793         indexes read from group data.  Build vector to pass to
15794         layout_group.
15795         * layout.cc (Layout::layout_group): Add flags and shndxes
15796         parameters.  Remove contents parameter.  Change caller.  Update
15797         explicit instantiations.
15798         * layout.h (class Layout): Update layout_group declaration.
15799         * output.cc (Output_data_group::Output_data_group): Add flags and
15800         input_shndxes parameters.  Remove contents parameter.  Change
15801         caller.
15802         (Output_data_group::do_write): Change input_sections_ to
15803         input_shndxes_.
15804         * output.h (class Output_data_group): Update constructor
15805         declaration.  Rename input_sections_ to input_shndxes_.
15806         * testsuite/many_sections_test.cc: Add template.
15807
15808 2008-04-30  Cary Coutant  <ccoutant@google.com>
15809
15810         * target-reloc.h (relocate_section): Fix dead-pointer bug.
15811
15812         * layout.cc (Layout::include_section): Refactored check for debug
15813         info section.
15814         (Layout::add_comdat): Add new parameters.  Change type
15815         of signature parameter.  Add object and shndx to signatures table.
15816         (Layout::find_kept_object): New function.
15817         * layout.h: Include <cstring>.
15818         (Layout::is_debug_info_section): New function.
15819         (Layout::add_comdat): Add new parameters.
15820         (Layout::find_kept_object): New function.
15821         (Layout::Kept_section): New struct.
15822         (Layout::Signatures): Change type of map range.
15823         * object.cc (Relobj::output_section_address): New function.
15824         (Sized_relobj::include_section_group): Add new parameters.  Change
15825         calls to Layout::add_comdat.  Change to build table of kept comdat
15826         groups and table mapping discarded sections to kept sections.
15827         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
15828         (Sized_relobj::do_layout): Change calls to include_section_group and
15829         include_linkonce_section.
15830         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15831         value to zero when section is discarded.
15832         (Sized_relobj::map_to_kept_section): New function.
15833         * object.h (Relobj::output_section_address): New function.
15834         (Relobj::Comdat_group): New type.
15835         (Relobj::find_comdat_group): New function.
15836         (Relobj::Comdat_group_table): New type.
15837         (Relobj::Kept_comdat_section): New type.
15838         (Relobj::Kept_comdat_section_table): New type.
15839         (Relobj::add_comdat_group): New function.
15840         (Relobj::set_kept_comdat_section): New function.
15841         (Relobj::get_kept_comdat_section): New function.
15842         (Relobj::comdat_groups_): New field.
15843         (Relobj::kept_comdat_sections_): New field.
15844         (Symbol_value::input_value): Update comment.
15845         (Sized_relobj::map_to_kept_section) New function.
15846         (Sized_relobj::include_linkonce_section): Add new parameter.
15847         * target-reloc.h (Comdat_behavior): New type.
15848         (get_comdat_behavior): New function.
15849         (relocate_section): Add code to map a discarded section to the
15850         corresponding kept section when applying a relocation.
15851
15852 2008-04-30  Craig Silverstein  <csilvers@google.com>
15853
15854         * dwarf_reader.cc (next_generation_count): New static var.
15855         (Addr2line_cache_entry): New struct.
15856         (addr2line_cache): New static var.
15857         (Dwarf_line_info::one_addr2line): Added caching.
15858         (Dwarf_line_info::clear_addr2line_cache): New function.
15859         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
15860         cache-size parameter.
15861         (Dwarf_line_info::one_addr2line_cache): New function.
15862         * symtab.cc (Symbol_table::detect_odr_violations): Pass
15863         new cache-size argument to one_addr2line(), and clear cache.
15864
15865 2008-04-28  Cary Coutant  <ccoutant@google.com>
15866
15867         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
15868         R_386_PC8 relocations.
15869
15870 2008-04-23  Ian Lance Taylor  <iant@google.com>
15871
15872         * object.cc (Sized_relobj::include_section_group): Check for
15873         invalid section group.
15874
15875         * object.cc (make_elf_object): Correct test for 64-bit ELF file
15876         header size.
15877
15878         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
15879         than read for file header.
15880         * archive.cc (Archive::include_member): Likewise.
15881
15882 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
15883
15884         * aclocal.m4: Regenerate.
15885         * configure: Regenerate.
15886
15887 2008-04-19  Ian Lance Taylor  <iant@google.com>
15888
15889         * version.cc (version_string): Bump to 1.6.
15890
15891         * testsuite/Makefile.am (many_sections_r_test): New target.
15892         (many_sections_r_test_SOURCES): Remove.
15893         (many_sections_r_test_DEPENDENCIES): Remove.
15894         (many_sections_r_test_LDFLAGS): Remove.
15895         (many_sections_r_test_LDADD): Remove.
15896
15897         * object.cc (Sized_relobj::do_add_symbols): Always pass
15898         local_symbol_count_ to add_from_relobj.
15899
15900         * testsuite/Makefile.am (many_sections_check.h): Only check one in
15901         every thousand variables.
15902         * testsuite/Makefile.in: Rebuild.
15903
15904         * object.cc (Xindex::initialize_symtab_xindex): New function.
15905         (Xindex::read_symtab_xindex): New function.
15906         (Xindex::sym_xindex_to_shndx): New function.
15907         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
15908         available.
15909         (Sized_relobj::do_initialize_xindex): New function.
15910         (Sized_relobj::do_read_symbols): Adjust section links.
15911         (Sized_relobj::symbol_section_and_value): Add is_ordinary
15912         parameter.  Change all callers.
15913         (Sized_relobj::include_section_group): Adjust section links and
15914         symbol section indexes.
15915         (Sized_relobj::do_layout): Adjust section links.
15916         (Sized_relobj::do_count_local_symbols): Adjust section links and
15917         symbol section indexes.
15918         (Sized_relobj::do_finalize_local_symbols): Distinguish between
15919         ordinary and special symbols.
15920         (Sized_relobj::write_local_symbols): Add symtab_xindex and
15921         dynsym_xindex parameters.  Change all callers.  Adjust section
15922         links.  Use SHN_XINDEX when needed.
15923         (Sized_relobj::get_symbol_location_info): Adjust section links.
15924         Don't get fooled by special symbols.
15925         * object.h (class Xindex): Define.
15926         (class Object): Add xindex_ parameter.  Declare virtual functoin
15927         do_initialize_xindex.
15928         (Object::adjust_sym_shndx): New function.
15929         (Object::set_xindex): New protected function.
15930         (class Symbol_value): Add is_ordinary_shndx_ field.
15931         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15932         (Symbol_value::value): Assert ordinary section.
15933         (Symbol_value::initialize_input_to_output_map): Likewise.
15934         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15935         Change all callers.
15936         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
15937         all callers.
15938         (class Sized_relobj): Update declarations.
15939         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15940         parameter.  Change all callers.
15941         (Sized_relobj::adjust_shndx): New function.
15942         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15943         field.
15944         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15945         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
15946         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
15947         (Sized_dynobj::read_dynsym_section): Adjust section links.
15948         (Sized_dynobj::read_dynamic): Likewise.
15949         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
15950         section links.
15951         (Sized_dynobj::do_initialize_xindex): New function.
15952         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
15953         do_initialize_xindex.
15954         (Sized_dynobj::adjust_shndx): New function.
15955         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
15956         dynsym_xindex_ fields.
15957         (Layout::finalize): Add a call to set_section_indexes before
15958         creating the symtab sections.
15959         (Layout::set_section_indexes): Don't do anything if the section
15960         already has a section index.
15961         (Layout::create_symtab_sections): Add shnum parameter.  Change
15962         caller.  Create .symtab_shndx section if needed.
15963         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
15964         caller.
15965         (Layout::allocated_output_section_count): New function.
15966         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
15967         needed.
15968         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
15969         fields.  Update declarations.
15970         (Layout::symtab_xindex): New function.
15971         (Layout::dynsym_xindex): New function.
15972         (class Write_symbols_task): Add layout_ field.
15973         (Write_symbols_task::Write_symbols_task): Add layout parameter.
15974         Change caller.
15975         * output.cc (Output_section_headers::Output_section_headers): Add
15976         shstrtab_section parameter.  Change all callers.
15977         (Output_section_headers::do_sized_write): Store overflow values
15978         for section count and section string table section index in
15979         section header zero.
15980         (Output_file_header::do_sized_write): Check for overflow of
15981         section count and section string table section index.
15982         (Output_symtab_xindex::do_write): New function.
15983         (Output_symtab_xindex::endian_do_write): New function.
15984         * output.h (class Output_section_headers): Add shstrtab_section_.
15985         Update declarations.
15986         (class Output_symtab_xindex): Define.
15987         (Output_section::has_out_shndx): New function.
15988         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15989         field.
15990         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15991         Change all callers.
15992         (Sized_symbol::init): Likewise.
15993         (Symbol::output_section): Check for ordinary symbol.
15994         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
15995         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
15996         callers.
15997         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15998         Change all callers.  Simplify handling of symbols from sections
15999         not included in the link.
16000         (Symbol_table::add_from_dynobj): Handle ordinary symbol
16001         distinction.
16002         (Weak_alias_sorter::operator()): Assert that symbols are
16003         ordinary.
16004         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
16005         distinction.
16006         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
16007         parameters.  Change all callers.
16008         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
16009         symbol distinction.  Use SHN_XINDEX when needed.
16010         (Symbol_table::write_section_symbol): Add symtab_xindex
16011         parameter.  Change all callers.
16012         (Symbol_table::sized_write_section_symbol): Likewise.  Use
16013         SHN_XINDEX when needed.
16014         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
16015         declarations.
16016         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
16017         (Symbol::is_defined): Check is_ordinary.
16018         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
16019         (Symbol::is_absolute, Symbol::is_common): Likewise.
16020         (class Sized_symbol): Update declarations.
16021         (class Symbol_table): Update declarations.
16022         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
16023         parameters.  Change all callers.
16024         (Sized_symbol::override): Likewise.
16025         (Symbol_table::override): Likewise.
16026         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
16027         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
16028         is_ordinary, and orig_st_shndx parameters.  Change all callers.
16029         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
16030         to be in an ordinary section.
16031         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
16032         object and is_ordinary parameters.  Change all callers.
16033         (Sized_dwarf_line_info::read_relocs): Add object parameter.
16034         Change all callers.  Don't add undefined or non-ordinary symbols
16035         to reloc_map_.
16036         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
16037         Change all callers.
16038         * dwarf_reader.h (class Sized_dwarf_line_info): Update
16039         declarations.
16040         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
16041         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
16042         (Sized_relobj::relocate_sections): Likewise.
16043         * target-reloc.h (scan_relocs): Adjust section symbol index.
16044         (scan_relocatable_relocs): Likewise.
16045         * i386.cc (Scan::local): Check for ordinary symbols.
16046         * sparc.cc (Scan::local): Likewise.
16047         * x86_64.cc (Scan::local): Likewise.
16048         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
16049         to symbol_section_and_value.
16050         * testsuite/many_sections_test.cc: New file.
16051         * testsuite/Makefile.am (BUILT_SOURCES): Define.
16052         (check_PROGRAMS): Add many_sections_test.
16053         (many_sections_test_SOURCES): Define.
16054         (many_sections_test_DEPENDENCIES): Define.
16055         (many_sections_test_LDFLAGS): Define.
16056         (BUILT_SOURCES): Add many_sections_define.h.
16057         (many_sections_define.h): New target.
16058         (BUILT_SOURCES): Add many_sections_check.h.
16059         (many_sections_check.h): New target.
16060         (check_PROGRAMS): Add many_sections_r_test.
16061         (many_sections_r_test_SOURCES): Define.
16062         (many_sections_r_test_DEPENDENCIES): Define.
16063         (many_sections_r_test_LDFLAGS): Define.
16064         (many_sections_r_test_LDADD): Define.
16065         (many_sections_r_test.o): New target.
16066         * testsuite/Makefile.in: Rebuild.
16067
16068 2008-04-17  Cary Coutant  <ccoutant@google.com>
16069
16070         * errors.cc (Errors::info): New function.
16071         (gold_info): New function.
16072         * errors.h (Errors::info): New function.
16073         * gold.h (gold_info): New function.
16074         * object.cc (Input_objects::add_object): Print trace output.
16075         * options.cc (options::parse_set): New function.
16076         (General_options::parse_wrap): Deleted.
16077         (General_options::General_options): Deleted initializer.
16078         * options.h (options::String_set): New typedef.
16079         (options::parse_set): New function.
16080         (DEFINE_set): New macro.
16081         (General_options::wrap): Changed to use DEFINE_set. Changed
16082         callers of any_wrap_symbols and is_wrap_symbol.
16083         (General_options::trace, General_options::trace_symbol):
16084         New options.
16085         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
16086         (General_options::wrap_symbols_): Deleted.
16087         * symtab.cc (Symbol_table::add_from_object): Print trace output.
16088
16089 2008-04-17  David S. Miller  <davem@davemloft.net>
16090
16091         * options.cc (General_options::parse_V): New function.
16092         * options.h: Add entries for -V and -Qy.
16093
16094 2008-04-17  Ian Lance Taylor  <iant@google.com>
16095
16096         * common.cc (Symbol_table::allocate_commons): Remove options
16097         parameter.  Change caller.
16098         (Symbol_table::do_allocate_commons): Remove options parameter.
16099         Change caller.  Just call do_allocate_commons_list twice.
16100         (Symbol_table::do_allocate_commons_list): New function, broken out
16101         of do_allocate_commons.
16102         * common.h (class Allocate_commons_task): Remove options_ field.
16103         Update constructor.
16104         * symtab.cc (Symbol_table::Symbol_table): Initialize
16105         tls_commons_.
16106         (Symbol_table::add_from_object): Put TLS common symbols on
16107         tls_commons_ list.
16108         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
16109         which are IN_OUTPUT_DATA.
16110         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
16111         allocate_commons and do_allocate_commons declarations.  Declare
16112         do_allocate_commons_list.
16113         * gold.cc (queue_middle_tasks): Update creation of
16114         Allocate_commons_task to not pass options.
16115         * testsuite/Makefile.am (INCLUDES): Add -I.. .
16116         (TLS_TEST_C_FLAGS): New variable.
16117         (tls_test_c_pic.o): New target.
16118         (tls_test_shared.so): Link in tls_test_c_pic.o.
16119         (tls_test_c_pic_ie.o): New target.
16120         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
16121         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
16122         (tls_test_c.o): New target.
16123         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
16124         (tls_pic_test_LDADD): Likewise.
16125         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
16126         (tls_shared_gd_to_ie_test_LDADD): Likewise.
16127         (tls_test_c_gnu2.o): New target.
16128         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
16129         tls_test_c_gnu2.o.
16130         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
16131         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
16132         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
16133         * testsuite/tls_test.cc: Include "config.h".
16134         (t_last): Call t11_last.
16135         * testsuite/tls_test.h (t11, t11_last): Declare.
16136         * testsuite/tls_test_c.c: New file.
16137         * testsuite/tls_test_main.cc (thread_routine): Call t11.
16138         * configure.ac: Check for OpenMP support.
16139         * configure, config.in, Makefile.in: Rebuild.
16140         * testsuite/Makefile.in: Rebuild.
16141
16142 2008-04-16  Cary Coutant  <ccoutant@google.com>
16143
16144         * i386.cc (Target_i386::define_tls_base_symbol): New function.
16145         (Target_i386::tls_base_symbol_defined_): New field.
16146         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16147         (Target_i386::Scan::global): Likewise.
16148         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
16149         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
16150         (Target_x86_64::tls_base_symbol_defined_): New field.
16151         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16152         (Target_x86_64::Scan::global): Likewise.
16153
16154 2008-04-16  Cary Coutant  <ccoutant@google.com>
16155
16156         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
16157         (Symbol::needs_plt_entry): Allow weak undefined symbols.
16158         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
16159         building shared libraries.
16160         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
16161         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
16162         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
16163         * testsuite/Makefile.in: Rebuild.
16164         * testsuite/weak_undef.h: New file.
16165         * testsuite/weak_undef_file1.cc: Add extra test cases.
16166         * testsuite/weak_undef_file2.cc: Likewise.
16167         * testsuite/weak_undef_test.cc: Likewise.
16168
16169 2008-04-16  David S. Miller  <davem@davemloft.net>
16170
16171         * sparc.cc (Target_sparc::Scan): Change from struct to class.
16172         Add issued_non_pic_error_ field.  Declare check_non_pic.
16173         (Target_sparc::Scan::check_non_pic): New function.
16174         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
16175         (Target_sparc::Scan::global): Likewise.
16176
16177         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
16178         * configure: Rebuild.
16179
16180         * options.h (DEFINE_enable): New macro.
16181         (new_dtags): New enable option.
16182         (initfirst, interpose, loadfltr, nodefaultlib,
16183         nodelete, nodlopen, nodump): New -z options.
16184         * layout.cc (Layout:finish_dynamic_section): If new
16185         dtags enabled, emit DT_RUNPATH.  Also, emit a
16186         DT_FLAGS_1 containing any specified -z flags.
16187
16188 2008-04-16  Ian Lance Taylor  <iant@google.com>
16189
16190         * copy-relocs.cc: New file.
16191         * copy-relocs.h: New file.
16192         * reloc.cc: Remove Copy_relocs code.
16193         * reloc.h: Likewise.
16194         * reloc-types.h (struct Reloc_types) [both versions]: Add
16195         get_reloc_addend_noerror.
16196         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
16197         variants of add_global which take an addend which must be zero.
16198         * i386.cc: Include "copy-relocs.h".
16199         (class Target_i386): Change type of copy_relocs_ to variable,
16200         update initializer.
16201         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
16202         Change all callers.
16203         (Target_i386::do_finalize_sections): Change handling of
16204         copy_relocs_.
16205         * sparc.cc: Include "copy-relocs.h".
16206         (class Target_sparc): Change type of copy_relocs_ to variable,
16207         update initializer.
16208         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
16209         Change all callers.
16210         (Target_sparc::do_finalize_sections): Change handling of
16211         copy_relocs_.
16212         * x86_64.cc: Include "copy-relocs.h".
16213         (class Target_x86_64): Change type of copy_relocs_ to variable,
16214         update initializer.
16215         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
16216         class.  Change all callers.
16217         (Target_x86_64::do_finalize_sections): Change handling of
16218         copy_relocs_.
16219         * Makefile.am (CCFILES): Add copy-relocs.cc.
16220         (HFILES): Add copy-relocs.h.
16221
16222         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
16223
16224         * testsuite/script_test_4.sh: Permit leading zeroes.
16225
16226 2008-04-15  Ian Lance Taylor  <iant@google.com>
16227
16228         * script-sections.cc (Script_sections::create_segments): Use
16229         header_size_adjustment even when there is enough room for the
16230         headers.
16231         * testsuite/script_test_4.sh: New file.
16232         * testsuite/script_test_4.t: New file.
16233         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
16234         (check_DATA): Add script_test_4.stdout.
16235         (MOSTLYCLEANFILES): Likewise.
16236         (script_test_4): New target.
16237         (script_test_4.stdout): New target.
16238         * testsuite/Makefile.in: Rebuild.
16239
16240         * sparc.cc: Add definitions for Output_data_plt_sparc class
16241         constants.
16242
16243 2008-04-14  David S. Miller  <davem@davemloft.net>
16244
16245         * sparc.cc: New file.
16246         * Makefile.am (TARGETSOURCES): Add sparc.cc
16247         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
16248         * configure.tgt: Document targ_extra_size and
16249         targ_extra_big_endian.  Add entries for sparc-* and
16250         sparc64-*.
16251         * configure.ac: Handle targ_extra_size and
16252         targ_extra_big_endian.
16253         * Makefile.in: Rebuild.
16254         * configure: Likewise.
16255         * po/POTFILES.in: Likewise.
16256         * po/gold.pot: Likewise.
16257
16258 2008-04-14  Ian Lance Taylor  <iant@google.com>
16259
16260         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
16261         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
16262         in the name/type/flags to section mapping.  Don't call
16263         allocate_output_section.
16264         (Layout::choose_output_section): Change parameter from adjust_name
16265         to is_input_section.  Don't permit input sections after sections
16266         are attached to segments.  Don't call allocate_output_section.
16267         (Layout::layout_eh_frame): Call update_flags_for_input_section,
16268         not write_enable_output_section.
16269         (Layout::make_output_section): Don't push to
16270         unattached_section_list_ nor call attach_to_segment.  Call
16271         attach_section_to_segment if sections are attached.
16272         (Layout::attach_sections_to_segments): New function.
16273         (Layout::attach_section_to_segment): New function.
16274         (Layout::attach_allocated_section_to_segment): Rename from
16275         attach_to_segment.  Remove flags parameter.
16276         (Layout::allocate_output_section): Remove function.
16277         (Layout::write_enable_output_section): Remove function.
16278         * layout.h (class Layout): Update for above changes.  Add new
16279         field sections_are_attached_.
16280         * output.h (Output_section::update_flags_for_input_section): New
16281         function.
16282         * output.cc (Output_section::add_input_section): Call
16283         update_flags_for_input_section.
16284         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
16285
16286 2008-04-11  Cary Coutant  <ccoutant@google.com>
16287
16288         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
16289         thought unnecessary.
16290         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
16291
16292 2008-04-11  Ian Lance Taylor  <iant@google.com>
16293
16294         * output.h (class Output_section_data): Remove inline definition
16295         of set_addralign.
16296         * output.cc (Output_section_data::set_addralign): New function.
16297
16298 2008-04-11  Cary Coutant  <ccoutant@google.com>
16299
16300         Add support for TLS descriptors for i386 and x86_64.
16301         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
16302         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
16303         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
16304         GOT_TYPE_TLS_DESC.
16305         (Target_i386::got_mod_index_entry): Remove unnecessary code.
16306         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
16307         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
16308         relocations.
16309         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
16310         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
16311         Fix problem with initial-exec relocations.
16312         (Target_i386::Relocate::relocate_tls): Likewise.
16313         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
16314         relaxation.
16315         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
16316         support for section-plus-offset dynamic table entries.
16317         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
16318         (Output_data_dynamic::Dynamic_entry): Add support for
16319         section-plus-offset dynamic table entries.
16320         (Output_data_dynamic::Classification): Likewise.
16321         (Output_data_dynamic::classification_): Renamed offset_.
16322         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
16323         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
16324         (Target_x86_64::make_plt_section): New function.
16325         (Target_x86_64::reserve_tlsdesc_entries): New function.
16326         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
16327         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
16328         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
16329         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
16330         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
16331         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
16332         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
16333         add extra PLT entry for TLS descriptors.
16334         (Output_data_plt_x86_64::got_): New field.
16335         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
16336         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
16337         fields.
16338         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
16339         descriptors.
16340         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
16341         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
16342         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
16343         R_386_TLS_DESC_CALL relocations.
16344         (Target_x86_64::Scan::global): Likewise.
16345         (Target_x86_64::do_finalize_sections): Add dynamic table entries
16346         for TLS descriptors.
16347         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
16348         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
16349         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
16350         GD-to-IE relaxation.
16351         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
16352         and TLS_DESCRIPTORS.
16353         * Makefile.in: Rebuild.
16354         * configure: Rebuild.
16355         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
16356         (tls_test_shared2.so): New target.
16357         (tls_shared_gd_to_ie_test_SOURCES): New variable.
16358         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
16359         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
16360         (tls_shared_gd_to_ie_test_LDADD): New variable.
16361         (tls_shared_gnu2_gd_to_ie_test): New target.
16362         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
16363         New targets.
16364         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
16365         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
16366         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
16367         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
16368         (tls_shared_gnu2_test): New target.
16369         (tls_test_gnu2_shared.so): New target.
16370         (tls_shared_gnu2_test_SOURCES): New variable.
16371         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
16372         (tls_shared_gnu2_test_LDFLAGS): New variable.
16373         (tls_shared_gnu2_test_LDADD): New variable.
16374         * testsuite/Makefile.in: Rebuild.
16375         * testsuite/Makefile.
16376
16377 2008-04-11  Ian Lance Taylor  <iant@google.com>
16378
16379         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
16380         justsyms.t.
16381         * testsuite/Makefile.in: Rebuild.
16382
16383         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
16384         long.
16385         * testsuite/script_test_2.cc (main): Adjust test.
16386
16387 2008-04-11  David S. Miller  <davem@davemloft.net>
16388             Ian Lance Taylor  <iant@google.com>
16389
16390         * options.h (General_options): Add entries for '-Y' and
16391         '-relax'.
16392         * options.cc (General_options:finalize): If -Y was used, add those
16393         entries to the library path instead of the default "/lib" and
16394         "/usr/lib".
16395
16396 2008-04-11  David S. Miller  <davem@davemloft.net>
16397
16398         * testsuite/justsyms.t: Start at 0x100.
16399         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
16400         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
16401         long.
16402         * testsuite/script_test_2.cc: Adjust string and section length
16403         checks.
16404
16405 2008-04-09  Ian Lance Taylor  <iant@google.com>
16406
16407         PR gold/5996
16408         * script-sections.cc (Sections_element::allocate_to_segment): Add
16409         orphan parameter.
16410         (Output_section_definition::allocate_to_segment): Likewise.
16411         (Orphan_output_section::allocate_to_segment): Likewise.
16412         (Script_sections::attach_sections_using_phdrs_clause): Don't
16413         propagate non-PT_LOAD segments to orphan sections.
16414         * testsuite/Makefile.am (script_test_3.stdout): Generate using
16415         readelf rather than objdump.
16416         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
16417         .interp section and PT_INTERP segment are the same size.
16418         * testsuite/Makefile.in: Rebuild.
16419
16420         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
16421         aliases for symbols defined in the same object.
16422         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
16423         (weak_alias_test_SOURCES): New variable.
16424         (weak_alias_test_DEPENDENCIES): New variable.
16425         (weak_alias_test_LDFLAGS): New variable.
16426         (weak_alias_test_LDADD): New variable.
16427         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
16428         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
16429         (weak_alias_test_3.o): New target.
16430         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
16431         * testsuite/weak_alias_test_main.cc: New file.
16432         * testsuite/weak_alias_test_1.cc: New file.
16433         * testsuite/weak_alias_test_2.cc: New file.
16434         * testsuite/weak_alias_test_3.cc: New file.
16435
16436 2008-04-08  Ian Lance Taylor  <iant@google.com>
16437
16438         * options.h (class General_options): Add --noinhibit-exec option.
16439         * main.cc (main): Check --noinhibit-exec.
16440
16441         * options.h (class General_options): Define --wrap as a special
16442         option.  Add wrap_symbols_ field.
16443         (General_options::any_wrap_symbols): New function.
16444         (General_options::is_wrap_symbol): New function.
16445         * options.cc (General_options::parse_wrap): New function.
16446         (General_options::General_options): Initialize wrap_symbols_.
16447         * symtab.cc (Symbol_table::wrap_symbol): New function.
16448         (Symbol_table::add_from_object): Handle --wrap.
16449         * symtab.h (class Symbol_table): Declare wrap_symbol.
16450         * target.h (Target::wrap_char): New function.
16451         (Target::Target_info): Add wrap_char field.
16452         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
16453         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
16454         * testsuite/testfile.cc (Target_test::test_target_info):
16455         Likewise.
16456
16457         * errors.cc (Errors::undefined_symbol): Mention symbol version if
16458         there is one.
16459
16460         * layout.h (class Layout): Add added_eh_frame_data_ field.
16461         * layout.cc (Layout::Layout): Initialize new field.
16462         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
16463         output section until we find a section we merged successfully.
16464         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
16465         that the size be non-zero.
16466
16467         * merge.cc (Object_merge_map::get_output_offset): Remove inline
16468         qualifier.
16469
16470 2008-04-08  Craig Silverstein  <csilvers@google.com>
16471
16472         * configure.ac: Export new conditional variable HAVE_ZLIB.
16473         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
16474         on HAVE_ZLIB.
16475         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
16476         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16477
16478 2008-04-07  Ian Lance Taylor  <iant@google.com>
16479
16480         * version.cc (version_string): Set to "1.5".
16481
16482         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
16483         Add issued_non_pic_error_ field.  Declare check_non_pic.
16484         (Target_x86_64::Scan::check_non_pic): New function.
16485         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
16486         (Target_x86_64::Scan::global): Likewise.
16487
16488         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
16489         addend parameter.  Change caller.  Handle merge sections.
16490         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
16491         Address to Addend.  Don't add in the result of
16492         local_section_offset, pass down the addend and use the returned
16493         value.
16494         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
16495         Update declarations of local_section_offset and symbol_value.
16496         * testsuite/two_file_test_1.cc (t18): New function.
16497         * testsuite/two_file_test_2.cc (f18): New function.
16498         * testsuite/two_file_test_main.cc (main): Call t18.
16499         * testsuite/two_file_test.h (t18, f18): Declare.
16500
16501         * configure.ac: Don't test for objdump, c++filt, or readelf.
16502         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
16503         conditionals.
16504         (TEST_READELF): New variable.
16505         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
16506         (check_PROGRAMS): Add two_file_strip_test.
16507         (two_file_strip_test): New target.
16508         (check_PROGRAMS): Add two_file_same_shared_strip_test.
16509         (two_file_same_shared_strip_test_SOURCES): New variable.
16510         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
16511         (two_file_same_shared_strip_test_LDFLAGS): New variable.
16512         (two_file_same_shared_strip_test_LDADD): New variable.
16513         (two_file_shared_strip.so): New target.
16514         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
16515         (ver_test_5.syms, ver_test_7.syms): Likewise.
16516         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
16517         (strip_test_3.stdout): Use TEST_OBJDUMP.
16518         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16519
16520 2008-04-04  Cary Coutant  <ccoutant@google.com>
16521
16522         * symtab.h (Symbol::is_weak_undefined): New function.
16523         (Symbol::is_strong_undefined): New function.
16524         (Symbol::is_absolute): New function.
16525         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
16526         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
16527         absolute symbols.
16528         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
16529         (weak_undef_test): New target.
16530         * testsuite/Makefile.in: Rebuild.
16531         * testsuite/weak_undef_file1.cc: New file.
16532         * testsuite/weak_undef_file2.cc: New file.
16533         * testsuite/weak_undef_test.cc: New file.
16534
16535 2008-04-03  Craig Silverstein  <csilvers@google.com>
16536
16537         * compressed_output.h (class Output_compressed_section): Use
16538         unsigned buffer.
16539         * compressed_output.cc (zlib_compress): Use unsigned buffers,
16540         add zlib header.
16541         (zlib_compressed_suffix): Removed.
16542         (Output_compressed_section::set_final_data_size): Use unsigned
16543         buffers.
16544         * testsuite/Makefile.am (flagstest_compress_debug_sections):
16545         Fix linker invocation.
16546         (flagstest_o_specialfile_and_compress_debug_sections):
16547         Likewise.
16548         * testsuite/Makefile.in: Regenerated.
16549
16550 2008-04-02  David S. Miller  <davem@davemloft.net>
16551
16552         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
16553         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
16554
16555 2008-04-02  Craig Silverstein  <csilvers@google.com>
16556
16557         * TODO: New file.
16558
16559 2008-04-02  Ian Lance Taylor  <iant@google.com>
16560
16561         * fileread.cc (File_read::find_view): Add byteshift and vshifted
16562         parameters.  Update for new key type to views_.  Change all
16563         callers.
16564         (File_read::read): Adjust for byteshift in returned view.
16565         (File_read::add_view): New function, broken out of
16566         find_and_make_view.
16567         (File_read::make_view): New function, broken out of
16568         find_and_make_view.
16569         (File_read::find_or_make_view): Add offset and aligned
16570         parameters.  Rewrite accordingly.  Change all callers.
16571         (File_read::get_view): Add offset and aligned parameters.  Adjust
16572         for byteshift in return value.
16573         (File_read::get_lasting_view): Likewise.
16574         * fileread.h (class File_read): Update declarations.
16575         (class File_read::View): Add byteshift_ field.  Add byteshift to
16576         constructor.  Add byteshift method.
16577         * archive.h (Archive::clear_uncached_views): New function.
16578         (Archive::get_view): Add aligned parameter.  Change all callers.
16579         * object.h (Object::get_view): Add aligned parameter.  Change all
16580         callers.
16581         (Object::get_lasting_view): Likewise.
16582
16583         * fileread.cc (File_read::release): Don't call clear_views if
16584         there are multiple objects.
16585         * fileread.h (File_read::clear_uncached_views): New function.
16586         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
16587         on the archive.
16588
16589 2008-03-31  Cary Coutant  <ccoutant@google.com>
16590
16591         Add thin archive support.
16592         * archive.cc (Archive::armagt): New const.
16593         (Archive::setup): Remove task parameter and calls to unlock.
16594         (Archive::unlock_nested_archives): New function.
16595         (Archive::read_header): Add nested_off parameter. Change
16596         all callers.
16597         (Archive::interpret_header): Likewise.
16598         (Archive::include_all_members): Change to handle thin
16599         archives.
16600         (Archive::include_member): Likewise.
16601         * archive.h (Archive::Archive): Add new parameters and
16602         initializers.
16603         (Archive::armagt): New const.
16604         (Archive::setup): Remove task parameter.
16605         (Archive::unlock_nested_archives): New function.
16606         (Archive::read_header): Add nested_off parameter.
16607         (Archive::interpret_header): Likewise.
16608         (Archive::Nested_archive_table): New typedef.
16609         (Archive::is_thin_archive_): New field.
16610         (Archive::nested_archives_): New field.
16611         (Archive::options_): New field.
16612         (Archive::dirpath_): New field.
16613         (Archive::task_): New field.
16614         * readsyms.cc (Read_symbols::do_read_symbols): Add check
16615         for thin archives.  Pass additional parameters to
16616         Archive::Archive.  Unlock the archive file after calling
16617         Archive::setup.
16618
16619 2008-03-29  Ian Lance Taylor  <iant@google.com>
16620
16621         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
16622         version symbol to be local.
16623         * testsuite/ver_test_4.sh: New file.
16624         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
16625         (check_DATA): Add ver_test_4.syms.
16626         (ver_test_4.syms): New target.
16627         * testsuite/Makefile.in: Rebuild.
16628
16629         * output.cc
16630         (Output_section::Input_section_sort_entry::has_priority): New
16631         function.
16632         (Output_section::Input_section_sort_entry::match_file_name): New
16633         function.
16634         (Output_section::Input_section_sort_entry::match_section_name):
16635         Remove.
16636         (Output_section::Input_section_sort_entry::match_section_name_prefix):
16637         Remove.
16638         (Output_section::Input_section_sort_entry::match_section_file):
16639         Remove.
16640         (Output_section::Input_section_sort_compare::operator()): Rewrite
16641         using new Input_section_sort_entry functions.  Sort crtbegin and
16642         crtend first.  Sort sections with no priority before sections with
16643         a priority.
16644         * testsuite/initpri1.c (d3): Check j != 4.
16645         (cd5): New constructor/destructor function.
16646         (main): Check j != 2.
16647
16648         * symtab.cc (Symbol_table::add_from_object): If we don't use the
16649         new symbol when resolving, don't call set_is_default.
16650         * testsuite/ver_test_7.cc: New file.
16651         * testsuite/ver_test_7.sh: New file.
16652         * testsuite/Makefile.am (ver_test_7.so): New target.
16653         (ver_test_7.o): New target.
16654         (check_SCRIPTS): Add ver_test_7.sh.
16655         (check_DATA): Add ver_test_7.syms.
16656         (ver_test_7.syms): New target.
16657
16658 2008-03-28  Ian Lance Taylor  <iant@google.com>
16659
16660         * layout.cc (Layout::layout): If we see an input section with a
16661         name that needs sorting, set the must_sort flag for the output
16662         section.
16663         (Layout::make_output_section): If the name of the output section
16664         indicates that it might require sorting, set the may_sort flag.
16665         * output.h (Output_section::may_sort_attached_input_sections): New
16666         function.
16667         (Output_section::set_may_sort_attached_input_sections): New
16668         function.
16669         (Output_section::must_sort_attached_input_sections): New
16670         function.
16671         (Output_section::set_must_sort_attached_input_sections): New
16672         function.
16673         (class Output_section): Declare Input_section_sort_entry.  Define
16674         Input_section_sort_compare.  Declare
16675         sort_attached_input_sections.  Add new fields:
16676         may_sort_attached_input_sections_,
16677         must_sort_attached_input_sections_,
16678         attached_input_sections_are_sorted_.
16679         * output.cc (Output_section::Output_section): Initialize new
16680         fields.
16681         (Output_section::add_input_section): Add an entry to
16682         input_sections_ if may_sort or must_sort are true.
16683         (Output_section::set_final_data_size): Call
16684         sort_attached_input_sections if necessary.
16685         (Output_section::Input_section_sort_entry): Define new class.
16686         (Output_section::Input_section_sort_compare::operator()): New
16687         function.
16688         (Output_section::sort_attached_input_sections): New function.
16689         * configure.ac: Check whether the compiler supports constructor
16690         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
16691         * testsuite/initpri1.c: New file.
16692         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
16693         CONSTRUCTOR_PRIORITY.
16694         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
16695         (initpri1_LDFLAGS): New variable.
16696         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16697
16698 2008-03-27  Ian Lance Taylor  <iant@google.com>
16699
16700         * common.cc (Sort_commons::operator): Correct sorting algorithm.
16701         * testsuite/common_test_1.c: New file.
16702         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
16703         (common_test_1_SOURCES): New variable.
16704         (common_test_1_DEPENDENCIES): New variable.
16705         (common_test_1_LDFLAGS): New variable.
16706
16707         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
16708         and commons_ correctly when NAME/VERSION does not override
16709         NAME/NULL.
16710         * testsuite/ver_test_6.c: New file.
16711         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
16712         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
16713         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
16714
16715 2008-03-26  Ian Lance Taylor  <iant@google.com>
16716
16717         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
16718         of an undefined symbol from a version script.
16719         * testsuite/Makefile.am (ver_test_5.so): New target.
16720         (ver_test_5.o): New target.
16721         (check_SCRIPTS): Add ver_test_5.sh.
16722         (check_DATA): Add ver_test_5.syms.
16723         (ver_test_5.syms): New target.
16724         * testsuite/ver_test_5.cc: New file.
16725         * testsuite/ver_test_5.script: New file.
16726         * testsuite/ver_test_5.sh: New file.
16727         * Makefile.in, testsuite/Makefile.in: Rebuild.
16728
16729         PR gold/5986
16730         Fix problems building gold with gcc 4.3.0.
16731         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
16732         (gold_error_at_location, gold_warning_at_location): Use it.
16733         * configure.ac: Check whether we can compile and use a template
16734         function with a printf attribute.
16735         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
16736         when jumping over bytes.
16737         * object.cc: Instantiate Object::read_section_data.
16738         * debug.h: Include <cstring>
16739         * dwarf_reader.cc: Include <algorithm>
16740         * main.cc: Include <cstring>.
16741         * options.cc: Include <cstring>.
16742         * output.cc: Include <cstring>.
16743         * script.cc: Include <cstring>.
16744         * script.h: Include <string>.
16745         * symtab.cc: Include <cstring> and <algorithm>.
16746         * target-select.cc: Include <cstring>.
16747         * version.cc: Include <string>.
16748         * testsuite/testmain.cc: Include <cstdlib>.
16749         * configure, config.in: Rebuild.
16750
16751 2008-03-25  Ian Lance Taylor  <iant@google.com>
16752
16753         * options.cc: Include "../bfd/bfdver.h".
16754         (options::help): Print bug reporting address.
16755
16756         * version.cc (print_version): Adjust output for current value of
16757         BFD_VERSION_STRING.
16758
16759         * NEWS: New file.
16760
16761         * options.cc (options::help): Print list of supported targets.
16762         * target-select.h: Include <vector>.
16763         (class Target_selector): Make machine_, size_, and is_big_endian_
16764         fields const.  Add bfd_name_ and instantiated_target_ fields.
16765         (Target_selector::Target_selector): Add bfd_name parameter.
16766         (Target_selector::recognize): Make non-virtual, call
16767         do_recognize.
16768         (Target_selector::recognize_by_name): Make non-virtual, call
16769         do_recognize_by_name.
16770         (Target_selector::supported_names): New function.
16771         (Target_selector::bfd_name): New function.
16772         (Target_selector::do_instantiate_target): New pure virtual
16773         function.
16774         (Target_selector::do_recognize): New virtual function.
16775         (Target_selector::do_recognize_by_name): New virtual function.
16776         (Target_selector::instantiate_target): New private function.
16777         (supported_target_names): Declare.
16778         * target-select.cc (Target_selector::Target_selector): Update for
16779         new parameter and fields.
16780         (select_target_by_name): Check that the name matches before
16781         calling recognize_by_name.
16782         (supported_target_names): New function.
16783         * i386.cc (class Target_selector_i386): Update Target_selector
16784         constructor call.  Remove recognize and recognize_by_name.  Add
16785         do_instantiate_target.
16786         * x86_64.cc (class Target_selector_x86_64): Likewise.
16787         * testsuite/testfile.cc (class Target_selector_test): Update for
16788         changes to Target_selector.
16789
16790         * README: Rewrite, with some notes on unsupported features.
16791
16792 2008-03-24  Cary Coutant  <ccoutant@google.com>
16793
16794         * i386.cc (Target_i386::Got_type): New enum declaration.
16795         (Target_i386::Scan::local): Updated callers of Output_data_got
16796         member functions.
16797         (Target_i386::Scan::global): Likewise.
16798         (Target_i386::Relocate::relocate): Likewise.
16799         (Target_i386::Relocate::relocate_tls): Likewise.
16800         * object.h (Got_offset_list): New class.
16801         (Sized_relobj::local_has_got_offset): Added got_type parameter.
16802         (Sized_relobj::local_got_offset): Likewise.
16803         (Sized_relobj::set_local_got_offset): Likewise.
16804         (Sized_relobj::local_has_tls_got_offset): Removed.
16805         (Sized_relobj::local_tls_got_offset): Removed.
16806         (Sized_relobj::set_local_tls_got_offset): Removed.
16807         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16808         * output.cc (Output_data_got::add_global): Added got_type parameter.
16809         (Output_data_got::add_global_with_rel): Likewise.
16810         (Output_data_got::add_global_with_rela): Likewise.
16811         (Output_data_got::add_global_pair_with_rel): New function.
16812         (Output_data_got::add_global_pair_with_rela): New function.
16813         (Output_data_got::add_local): Added got_type parameter.
16814         (Output_data_got::add_local_with_rel): Likewise.
16815         (Output_data_got::add_local_with_rela): Likewise.
16816         (Output_data_got::add_local_pair_with_rel): New function.
16817         (Output_data_got::add_local_pair_with_rela): New function.
16818         (Output_data_got::add_global_tls): Removed.
16819         (Output_data_got::add_global_tls_with_rel): Removed.
16820         (Output_data_got::add_global_tls_with_rela): Removed.
16821         (Output_data_got::add_local_tls): Removed.
16822         (Output_data_got::add_local_tls_with_rel): Removed.
16823         (Output_data_got::add_local_tls_with_rela): Removed.
16824         * output.h (Output_data_got::add_global): Added got_type parameter.
16825         (Output_data_got::add_global_with_rel): Likewise.
16826         (Output_data_got::add_global_with_rela): Likewise.
16827         (Output_data_got::add_global_pair_with_rel): New function.
16828         (Output_data_got::add_global_pair_with_rela): New function.
16829         (Output_data_got::add_local): Added got_type parameter.
16830         (Output_data_got::add_local_with_rel): Likewise.
16831         (Output_data_got::add_local_with_rela): Likewise.
16832         (Output_data_got::add_local_pair_with_rel): New function.
16833         (Output_data_got::add_local_pair_with_rela): New function.
16834         (Output_data_got::add_global_tls): Removed.
16835         (Output_data_got::add_global_tls_with_rel): Removed.
16836         (Output_data_got::add_global_tls_with_rela): Removed.
16837         (Output_data_got::add_local_tls): Removed.
16838         (Output_data_got::add_local_tls_with_rel): Removed.
16839         (Output_data_got::add_local_tls_with_rela): Removed.
16840         * resolve.cc (Symbol::override_base_with_special): Removed
16841         reference to has_got_offset_ field.
16842         * symtab.cc (Symbol::init_fields): Replaced initialization
16843         of got_offset_ with got_offsets_.  Removed initialization
16844         of has_got_offset_
16845         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
16846         (Symbol::got_offset): Likewise.
16847         (Symbol::set_got_offset): Likewise.
16848         (Symbol::has_tls_got_offset): Removed.
16849         (Symbol::tls_got_offset): Removed.
16850         (Symbol::set_tls_got_offset): Removed.
16851         (Symbol::got_offset_): Removed.
16852         (Symbol::tls_mod_got_offset_): Removed.
16853         (Symbol::tls_pair_got_offset_): Removed.
16854         (Symbol::got_offsets_): New field.
16855         (Symbol::has_got_offset): Removed.
16856         (Symbol::has_tls_mod_got_offset): Removed.
16857         (Symbol::has_tls_pair_got_offset): Removed.
16858         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
16859         (Target_x86_64::Scan::local): Updated callers of Output_data_got
16860         member functions.
16861         (Target_x86_64::Scan::global): Likewise.
16862         (Target_x86_64::Relocate::relocate): Likewise.
16863         (Target_x86_64::Relocate::relocate_tls): Likewise.
16864
16865 2008-03-25  Ben Elliston  <bje@au.ibm.com>
16866
16867         * yyscript.y: Fix spelling error in comment.
16868
16869 2008-03-24  Ian Lance Taylor  <iant@google.com>
16870
16871         * options.h (class General_options): Define build_id option.
16872         * layout.h (class Layout): Declare write_build_id, create_note,
16873         create_build_id.  Add build_id_note_ member.
16874         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
16875         "libiberty.h", "md5.h", "sha1.h".
16876         (Layout::Layout): Initialize eh_frame_data_,
16877         eh_frame_hdr_section_, and build_id_note_.
16878         (Layout::finalize): Call create_build_id.
16879         (Layout::create_note): New function, broken out of
16880         Layout::create_gold_note.
16881         (Layout::create_gold_note): Call create_note.
16882         (Layout::create_build_id): New function.
16883         (Layout::write_build_id): New function.
16884         (Close_task_runner::run): Call write_build_id.
16885
16886         * x86_64.cc: Correct license to GPLv3.
16887
16888 2008-03-23  Ian Lance Taylor  <iant@google.com>
16889
16890         * options.cc: Include "demangle.h".
16891         (parse_optional_string): New function.
16892         (parse_long_option): Handle takes_optional_argument.
16893         (parse_short_option): Update dash_z initializer.  Handle
16894         takes_optional_argument.
16895         (General_options::General_options): Initialize do_demangle_.
16896         (General_options::finalize): Set do_demangle_.  Handle demangling
16897         style.
16898         * options.h (parse_optional_string): Declare.
16899         (struct One_option): Add optional_arg field.  Update constructor.
16900         Update call constructor calls.  Add takes_optional_argument
16901         function.
16902         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
16903         (DEFINE_optional_string): Define.
16904         (General_options::demangle): Change from DEFINE_bool to
16905         DEFINE_optional_string.
16906         (General_options::no_demangle): New function.
16907         (General_options::do_demangle): New function.
16908         (General_options::set_do_demangle): New function.
16909         (General_options::execstack_status_): Move definition to end of
16910         class definition.
16911         (General_options::static_): Likewise.
16912         (General_options::do_demangle_): New field.
16913         * object.cc (big_endian>::get_symbol_location_info): Call
16914         Options::do_demangle, not Options::demangle.
16915         * symtab.cc (demangle): Likewise.
16916
16917 2008-03-22  Ian Lance Taylor  <iant@google.com>
16918
16919         * gold.h: Include <cstddef> and <sys/types.h>
16920         * options.h: Include <cstring>.
16921
16922 2008-03-21  Ian Lance Taylor  <iant@google.com>
16923
16924         * Added source code to GNU binutils.
16925 \f
16926 Copyright (C) 2008-2015 Free Software Foundation, Inc.
16927
16928 Copying and distribution of this file, with or without modification,
16929 are permitted in any medium without royalty provided the copyright
16930 notice and this notice are preserved.
16931
16932 Local Variables:
16933 mode: change-log
16934 left-margin: 8
16935 fill-column: 74
16936 version-control: never
16937 End: