7d281a9f23f73f0bb8cf7aa8daf67e9466e00b87
[external/binutils.git] / gold / ChangeLog
1 2015-03-21  Cary Coutant  <cary@google.com>
2
3         PR gold/14217
4         * output.cc (Output_segment::is_first_section_relro): Don't ignore
5         .tdata section.
6         (Output_segment::set_section_addresses): Don't align size of relro
7         segment for .tbss.
8
9 2015-03-21  Cary Coutant  <cary@google.com>
10
11         PR gold/18010
12         * stringpool.cc (Stringpool_template): Don't optimize if section
13         alignment is greater than sizeof(char).
14
15 2015-03-21  Cary Coutant  <cary@google.com>
16
17         PR gold/18048
18         * script-c.h (script_include_directive): Add first_token parameter.
19         * script.cc (script_include_directive): Add first_token parameter, and
20         pass it to read_script_file.
21         * yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
22         (PARSING_MEMORY_DEF): New tokens.
23         (top): Add new productions for INCLUDE files.
24         (file_cmd): Replace file_or_sections_cmd with copy of its productions.
25         Pass PARSING_LINKER_SCRIPT to script_include_directive.
26         (section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
27         (section_cmd): Pass PARSING_SECTION_CMDS.
28         (file_or_sections_cmd): Remove.
29         (memory_def): Pass PARSING_MEMORY_DEF.
30         * testsuite/Makefile.am (memory_test_2): New test.
31         * testsuite/Makefile.in: Regenerate.
32         * testsuite/memory_test_inc.t: New script file.
33         * testsuite/memory_test_inc_1.t.src: New script file.
34         * testsuite/memory_test_inc_2.t.src: New script file.
35         * testsuite/memory_test_inc_3.t.src: New script file.
36
37 2015-03-21  Cary Coutant  <cary@google.com>
38
39         * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
40         (Sized_relobj_dwo::setup): Build compressed section map.
41         (Sized_relobj_dwo::do_decompressed_section_contents): Delete.
42         * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
43         section map.
44         * object.cc (Sized_relobj_file::Sized_relobj_file): Remove
45         compressed_sections_ field.
46         (build_compressed_section_map): Take Object instead of
47         Sized_relobj_file parameter; add decompress_if_needed parameter.
48         (Sized_relobj_file::do_find_special_sections): Store compressed
49         section map in parent Object.
50         (Sized_relobj_file::do_decompressed_section_contents): Move
51         implementation to Object::decompressed_section_contents.
52         (Sized_relobj_file::do_discard_decompressed_sections): Move
53         implementation to Object::discard_decompressed_sections.
54         * object.h (build_compressed_section_map): Declare.
55         (Object::Object): Add compressed_sections_ field.
56         (Object::section_is_compressed): Move implementation here.
57         (Object::decompressed_section_contents): De-virtualize.
58         (Object::discard_decompressed_sections): De-virtualize.
59         (Object::do_section_is_compressed): Delete.
60         (Object::do_decompressed_section_contents): Delete.
61         (Object::set_compressed_sections): New method.
62         (Object::compressed_sections): New method.
63         (Object::compressed_sections_): New data member.
64         (Compressed_section_info, Compressed_section_map): Move to top of file.
65         (Sized_relobj_file::do_section_is_compressed): Delete.
66         (Sized_relobj_file::do_decompressed_section_contents): Delete.
67         (Sized_relobj_file::do_discard_decompressed_sections): Delete.
68         (Sized_relobj_file::compressed_sections_): Move to Object class.
69
70 2015-03-21  Cary Coutant  <ccoutant@google.com>
71
72         PR gold/18152
73         * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
74         deferred objects.
75
76 2015-03-11  Cary Coutant  <ccoutant@google.com>
77
78         * options.cc (General_options::finalize): Don't allow -z relro
79         with incremental linking.
80         * testsuite/Makefile.am (incremental_test): Add -z norelro.
81         (incremental_test_2): Likewise.
82         (incremental_test_3): Likewise.
83         (incremental_test_4): Likewise.
84         (incremental_test_5): Likewise.
85         (incremental_test_6): Likewise.
86         (incremental_copy_test): Likewise.
87         (incremental_common_test_1): Likewise.
88         (incremental_comdat_test_1): Likewise.
89         * testsuite/Makefile.in: Regenerate.
90
91 2015-03-09  Cary Coutant  <ccoutant@google.com>
92
93         PR gold/14675
94         * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
95         return enum indicating whether .eh_frame section is empty, optimizable,
96         unrecognized, or an end marker. Adjust explicit instantiations.
97         * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
98         (Eh_frame::add_ehframe_input_section): Change return type.
99         * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
100         * layout.cc (Layout::layout_eh_frame): Don't add optimized sections
101         to the .eh_frame output section until we see the end marker.
102         (Layout::finalize_eh_frame_section): New.
103         * layout.h: (Layout::finalize_eh_frame_section): New.
104
105 2015-03-05  H.J. Lu  <hongjiu.lu@intel.com>
106
107         * output.cc (Relobj::initialize_input_to_output_map<size>):
108         Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
109
110 2015-03-04  Cary Coutant  <ccoutant@google.com>
111
112         * parameters.cc (Parameters::set_target_once): Call
113         Target::select_as_default_target just once from here...
114         (set_parameters_target): ...instead of from here.
115
116 2015-03-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
117
118         * ehframe.cc (Cie::set_output_offset): Pass in and use a
119         Output_section_data instead of a Merge_map.
120         (Eh_frame::Eh_frame): Don't initialize merge_map_.
121         (Eh_frame::read_cie): Use add_merge_mapping instead of
122         Merge_map::add_mapping.
123         (Eh_frame::read_fde): Ditto.
124         (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
125         (Eh_frame::do_output_offset): Use merge_output_offset istead of
126         merge_map_->get_output_offset.
127         (Eh_frame::do_is_merge_section_for): Delete.
128         * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
129         instead of a Merge_map.
130         (Cie::set_output_offset): Pass in a Output_section_data instead of a
131         Merge_map.
132         (Eh_frame::do_is_merge_section_for): Delete.
133         (Eh_frame::merge_map_): Delete.
134         * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
135         and use a Output_section_data instead of a Merge_map.
136         (Object_merge_map::add_mapping): Ditto.
137         (Object_merge_map::get_output_offset): Remove the merge_map argument.
138         (Object_merge_map::is_merge_section_for): Pass in and use a
139         Output_section_data instead of a Merge_map.
140         (Merge_map): Delete.
141         (Output_merge_base::do_output_offset): Use merge_output_offset instead
142         of merge_map_.get_output_offset.
143         (Output_merge_base::do_is_merge_section_for): Delete.
144         (Output_merge_data::do_add_input_section): Use
145         object->add_merge_mapping instead of add_mapping.
146         (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
147         * merge.h (Merge_map): Delete forward declaration.
148         (Object_merge_map::add_mapping): Pass in and use a Output_section_data
149         instead of a Merge_map.
150         (Object_merge_map::get_output_offset): Remove the merge_map argument.
151         (Object_merge_map::is_merge_section_for): Pass in and use a
152         Output_section_data instead of a Merge_map.
153         (Input_merge_map::Object_merge_map::merge_map): Replace with
154         output_data.
155         (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
156         Output_section_data instead of a Merge_map.
157         (Merge_map): Delete.
158         (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
159         (Output_merge_base::do_is_merge_section_for): Delete.
160         (Output_merge_base::add_mapping): Delete.
161         (Output_merge_base::merge_map_): Delete.
162         * object.cc (Relobj::initialize_input_to_output_map): New.
163         (Relobj::initialize_input_to_output_map): New.
164         (Relobj::merge_output_offset): New.
165         (Relobj::is_merge_section_for): New.
166         (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
167         bits.
168         * object.h (Relobj::merge_map): Delete.
169         (initialize_input_to_output_map): New.
170         (set_merge_map): Delete.
171         (add_merge_mapping): New.
172         (merge_output_offset): New.
173         (is_merge_section_for): New.
174         * output.cc (Output_section::Input_section::is_merge_section_for):
175         Use object->is_merge_section_for.
176         * output.h (Output_section_data::is_merge_section_for): Delete.
177         (Output_section_data::do_is_merge_section_for): Delete.
178         * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
179         Use object->initialize_input_to_output_map.
180         (Merged_symbol_value<size>::value_from_output_section): Use
181         object->merge_output_offset.
182
183 2015-03-02  Peter Collingbourne  <pcc@google.com>
184             Cary Coutant  <ccoutant@google.com>
185
186         * output.cc (Output_section::add_merge_input_section): Do not
187         attempt to merge sections with an entsize of 0.
188
189 2015-03-02  Khem Raj  <raj.khem@gmail.com>
190
191         * attributes.h (class Output_attributes_section_data ): Add
192         do_print_to_mapfile function.
193
194 2015-02-24  Alan Modra  <amodra@gmail.com>
195
196         PR 18010
197         * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
198         complain if value is not a multiple of four.
199         (Target_powerpc::Relocate::relocate): Correct handling of
200         R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
201
202 2015-02-21  H.J. Lu  <hongjiu.lu@intel.com>
203
204         * configure.ac (default_size): Set to 32 for x32.
205         * configure: Regenerated.
206
207 2015-02-18  Alan Modra  <amodra@gmail.com>
208
209         PR 17954
210         * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
211         visibility.
212
213 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
214
215         * gc.h (Garbage_collection::add_reference): Don't use find.
216
217 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
218
219         * object.cc (write_local_symbols): avoid std::vector copy.
220
221 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
222
223         * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
224
225 2015-02-09  Mark Wielaard  <mjw@redhat.com>
226
227         * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
228         DW_LANG_Fortran03 and DW_LANG_Fortran08.
229
230 2015-02-16  Cary Coutant  <ccoutant@google.com>
231
232         PR gold/13577
233         PR gold/16992
234         * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
235         DF_SYMBOLIC if --dynamic-list option is used.
236         * options.cc (General_options::finalize): --dynamic-list is not
237         mutually exclusive with -Bsymbolic.
238         * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
239         listed in --dynamic-list.
240         * testsuite/Makefile.am (dynamic_list_lib2.so): Add
241         -Bsymbolic-functions.
242         * testsuite/Makefile.in: Regenerate.
243
244 2015-02-16  Cary Coutant  <ccoutant@google.com>
245
246         PR gold/17971
247         * incremental.cc: Remove redundant include of "output.h".
248
249 2015-02-12  Jing Yu  <jingyu@google.com>
250
251         * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
252         TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
253         New relocation.
254         * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
255         TLSLE_MOVW_* relocations.
256         (Target_aarch64::Scan::global): Likewise.
257         (Target_aarch64::Relocate::relocate): Likewise.
258         (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
259         for new TLSLE_MOVW_* relocations.
260
261 2015-02-11  Will Newton  <will.newton@linaro.org>
262
263         PR gold/13321
264         * arm.cc (Target_arm::make_plt_section): Create an ARM
265         state mapping symbol at the start of the PLT.
266
267 2015-02-09  H.J. Lu  <hongjiu.lu@intel.com>
268
269         * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
270         Replace two_file_shared_2.so with two_file_shared_1.so.
271         * testsuite/Makefile.in: Regenerated.
272
273 2015-02-09  Alan Modra  <amodra@gmail.com>
274
275         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
276         plugin_test_thin.a and defsym_test.
277         * testsuite/Makefile.in: Regenerate.
278
279 2015-02-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
280
281         * merge.cc (do_add_input_section): Combine loop epilogue into main loop
282         body.
283
284 2015-02-04  Peter Collingbourne  <pcc@google.com>
285
286         * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
287         forwarding symbols when computing symbol resolution info for plugins.
288         * plugin.h (Plugin_manager::symtab): New method.
289         (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
290
291 2015-02-03  Cary Coutant  <ccoutant@google.com>
292             Peter Collingbourne  <pcc@google.com>
293
294         PR gold/15660
295         * archive.cc (Thin_archive_object_unlocker): New class.
296         (Archive::include_member): Unlock external members of thin archives.
297         * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
298         (plugin_test_2): Likewise.
299         (plugin_test_3): Likewise.
300         (plugin_test_4): Likewise.
301         (plugin_test_5): Likewise.
302         (plugin_test_6): Likewise.
303         (plugin_test_7): Likewise.
304         (plugin_test_8): Likewise.
305         (plugin_test_9): Likewise.
306         (plugin_test_10): Likewise.
307         (plugin_test_11): New test case.
308         * testsuite/Makefile.in: Regenerate.
309         * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
310         file to decide whether to claim file.
311         (all_symbols_read_hook): Likewise.
312         * testsuite/plugin_test_1.sh: Adjust expected output.
313         * testsuite/plugin_test_2.sh: Likewise.
314         * testsuite/plugin_test_3.sh: Likewise.
315         * testsuite/plugin_test_6.sh: Likewise.
316         * testsuite/plugin_test_tls.sh: Likewise.
317         * testsuite/plugin_test_11.sh: New testcase.
318
319 2015-02-03  Cary Coutant  <ccoutant@google.com>
320
321         * descriptors.cc (Descriptors::open): Set artificially-low limit for
322         file descriptors when debugging enabled. Add debug output.
323         (Descriptors::release): Add debug output.
324         (Descriptors::close_some_descriptor): Likewise.
325         (Descriptors::close_all): Likewise.
326         * fileread.cc (File_read::lock): Likewise.
327         (File_read::unlock): Likewise.
328
329 2015-02-02  Cary Coutant  <ccoutant@google.com>
330
331         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
332         executable output file.
333
334 2015-01-22  Han Shen  <shenhan@google.com>
335
336         * arm.cc (Target_arm::Target_arm): Add initialization for new members.
337         (Target_arm::do_plt_address_for_global): New method.
338         (Target_arm::do_plt_address_for_local): New method.
339         (Target_arm::rel_irelative_section): New method.
340         (Target_arm::make_data_plt): Add more parameters for plt ctor.
341         (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
342         (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
343         (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
344         (Target_arm::Scan::check_non_pic): Add ifunc support.
345         (Target_arm::Scan::local): Add ifunc support.
346         (Target_arm::Scan::global): Add ifunc support.
347         (Target_arm::make_plt_section): New method.
348         (Target_arm::make_plt_entry): Change to call to make_plt_section.
349         (Target_arm::make_local_ifunc_plt_entry): New method.
350         (Target_arm::got_irelative_): New member.
351         (Target_arm::rel_irelative_): New member.
352         (Target_arm::got_section): Add creation for got_irelative_.
353         (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
354         (Target_arm::Relocate::relocate): Properly set local ifunc address.
355         (Target_arm::do_dynsym_value): Properly set global ifunc address.
356         (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
357         (Output_data_plt_arm::IRelative_data): New type.
358         (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
359         (Output_data_plt_arm::add_entry): Add more parameters.
360         (Output_data_plt_arm::add_relocation): New method.
361         (Output_data_plt_arm::add_local_ifunc_entry): New method.
362         (Output_data_plt_arm::rel_irelative): New method.
363         (Output_data_plt_arm::entry_count): Modified.
364         (Output_data_plt_arm::address_for_global): New method.
365         (Output_data_plt_arm::address_for_local): New method.
366 gold/
367         (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
368         (Output_data_plt_arm::insert_irelative_data): New method.
369         (Output_data_plt_arm::irelative_rel_): New member.
370         (Output_data_plt_arm::got_): New member.
371         (Output_data_plt_arm::got_irelative_): New member.
372         (Output_data_plt_arm::irelative_count_): New member.
373         (Output_data_plt_arm::IRelative_data_vec): New typedef.
374         (Output_data_plt_arm::irelative_data_vec_): New member.
375         (Output_data_plt_arm::do_write): Write out irelative entries.
376         (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
377         more parameters to ctor.
378         (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
379         more parameters to ctor.
380         * output.h (Output_data_reloc::add_local_relative): New method.
381         * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
382
383 2015-01-29  Alan Modra  <amodra@gmail.com>
384
385         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
386         and GOT_TLSGD to LE optimization.
387
388 2015-01-28  Cary Coutant  <ccoutant@google.com>
389
390         * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
391         for undef TLS symbols.
392         (Target_x86_64::Relocate::relocate_tls): Likewise.
393         (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
394
395 2015-01-25  Cary Coutant  <ccoutant@google.com>
396
397         * output.cc (Output_segment::set_section_addresses): Fix calculation
398         of size of relro segment.
399
400 2015-01-22  Alan Modra  <amodra@gmail.com>
401
402         * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
403         condition for need of ifunc plt entry.
404         (Target_powerpc::Scan::global <got relocs>): Likewise.
405
406 2015-01-14  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
407
408         * mips.cc (reloc_high): Add r_sym.
409         (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
410         reloc_high constructor.
411         (Mips_relocate_functions::relgot16_local): Likewise.
412         (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
413         r_type to decide whether LO16 matches HI16.
414         (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
415         rello16 and relgot16_local.
416
417 2015-01-09  Cary Coutant  <ccoutant@google.com>
418
419         * layout.cc (Layout::set_segment_offsets): Don't align start of segment
420         unless alignment is larger than page size.
421
422 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
423             Cary Coutant  <ccoutant@google.com>
424
425         PR gold/17729
426         * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
427         (DEFAULT_TARGET_X32): Set for x32.
428         * x86_64.cc (cmp_insn_32): New.
429         (lea_r10_insn_32): Likewise.
430         (lea_r11_insn_32): Likewise.
431         (cmp_insn_64): Likewise.
432         (lea_r10_insn_64): Likewise.
433         (lea_r11_insn_64): Likewise.
434         (Target_x86_64<size>::do_calls_non_split): Handle x32.
435         * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
436         (check_DATA): Add split_x32 files.
437         (split_x32_[1234n].o): New targets.
438         (split_x32_[124]): New targets.
439         (split_x32_[1234r].stdout): New targets.
440         * testsuite/split_x32.sh: New file.
441         * testsuite/split_x32_1.s: Likewise.
442         * testsuite/split_x32_2.s: Likewise.
443         * testsuite/split_x32_3.s: Likewise.
444         * testsuite/split_x32_4.s: Likewise.
445         * testsuite/split_x32_n.s: Likewise.
446         * configure: Regenerated.
447         * testsuite/Makefile.in: Likewise.
448
449 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
450
451         PR gold/17809
452         * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
453         x32.
454
455 2015-01-02  Alan Modra  <amodra@gmail.com>
456
457         * version.cc (print_version): Just print current year.
458         * dwp.cc (print_version): Likewise.
459
460 2015-01-01  Alan Modra  <amodra@gmail.com>
461
462         Update year range in copyright notice of all files.
463
464 2014-12-25  Alan Modra  <amodra@gmail.com>
465
466         * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
467         new enums.
468         (Target_arm::merge_object_attributes, ): Likewise.
469
470 2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
471
472         * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
473         as hard float only when Tag_ABI_VFP_args is 1, using new enum value
474         AEABI_VFP_args_vfp to check that.
475         (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
476         value and replace hardcoded values by enum values.
477
478 2014-12-22  Cary Coutant  <ccoutant@google.com>
479
480         * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
481
482 2014-12-20  H.J. Lu  <hongjiu.lu@intel.com>
483
484         PR gold/14608
485         * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
486         to "return i * i * 3;".
487
488 2014-12-16  Cary Coutant  <ccoutant@google.com>
489
490         * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
491         (Mapfile::print_output_data): Use current_data_size() to avoid
492         assert for sections requiring postprocessing; if address is not valid,
493         print 0.
494         (Mapfile::print_output_section): Use current_data_size(); print note
495         that addresses and sizes are before compression.
496
497 2014-12-14  H.J. Lu  <hongjiu.lu@intel.com>
498
499         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
500         Cast current_group_size to unsigned long when reporting error.
501
502 2014-12-10  Jing Yu  <jingyu@google.com>
503
504         * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
505         (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
506         Update error message.
507         (Target_aarch64::do_relax): Use absolute value of option
508         stub_group_size. Replace local variable with class member
509         stub_group_size_.
510
511 2014-12-04  Alan Modra  <amodra@gmail.com>
512
513         * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
514         addend of PLTREL24 reloc when not generating a plt stub.  Make
515         max_branch_offset an "Address".
516         (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
517         (Target_powerpc::Relocate::relocate): Likewise.
518
519 2014-12-04  Alan Modra  <amodra@gmail.com>
520
521         PR 17670
522         * symtab.cc (Symbol::set_undefined): Remove assertion.
523         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
524         on symbols defined in discarded sections, instead return false.
525         Rearrange params, update all callers.
526         (Target_powerpc::Branch_info::make_stub): Don't make stubs for
527         branches to syms in discarded sections.
528         (Global_symbol_visitor_opd::operator()): Set discarded opd syms
529         undefined and flag as discarded.
530         (Target_powerpc::Relocate::relocate): Localize variable.
531
532 2014-12-03  H.J. Lu  <hongjiu.lu@intel.com>
533
534         PR gold/17675
535         * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
536         * testsuite/Makefile.in: Regenerated.
537
538 2014-12-03  Alan Modra  <amodra@gmail.com>
539
540         PR 17566
541         * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
542         when adding dynamic relocations against section symbols.
543
544 2014-12-01  Dimitry Ivanov <dimitry@google.com>
545
546         * layout.cc (Layout::finish_dynamic_section): When '-z global'
547         is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
548         * options.h (General_options): New -z option (global).
549
550 2014-12-01  Cary Coutant  <ccoutant@google.com>
551
552         PR gold/17578
553         * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
554         is given.
555         (Layout::create_executable_stack_info): Warn when -z noexecstack is
556         given but some inputs require executable stack.
557
558 2014-11-26  Cary Coutant  <ccoutant@google.com>
559
560         * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
561         .debug_str_offsets; strip .debug_gnu_pubnames and
562         .debug_gnu_pubtypes.
563         (lines_only_debug_sections): Strip all four new sections.
564
565 2014-11-26  Jing Yu  <jingyu@google.com>
566
567         * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
568         register to be x0 when to relax TLSDESC_LD64_LO12.
569
570 2014-11-26  Alan Modra  <amodra@gmail.com>
571
572         * powerpc.cc (struct Stub_table_owner): New.
573         (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
574         unsigned int vector.  Update all references.
575         (powerpc_relobj::set_stub_table): Take an unsigned int param
576         rather than a Stub_table.  Update callers.
577         (Powerpc_relobj::clear_stub_table): New function.
578         (Target_powerpc): Add relax_failed_, relax_fail_count_ and
579         stub_group_size_ vars.
580         (Target_powerpc::new_stub_table): Delete.
581         (max_branch_delta): New function, extracted from..
582         (Target_powerpc::Relocate::relocate): ..here..
583         (Target_powerpc::Branch_info::make_stub): ..and here.  Return
584         status on whether stub created successfully.
585         (Stub_control::Stub_control): Add "no_size_errors" param.  Move
586         default sizing to..
587         (Target_powerpc::do_relax): ..here.  Init stub_group_size_ and
588         reduce on relax failure.
589         (Target_powerpc::group_sections): Add "no_size_errors" param.
590         Use stub_group_size_.  Set up group info in a temp vector,
591         before building Stub_table vector.  Account for input sections
592         possibly already converted to relaxed sections.
593         (Stub_table::init): Delete.  Merge into..
594         (Stub_table::Stub_table): ..here.
595         (Stub_table::can_reach_stub): New function.
596         (Stub_table::add_plt_call_entry): Add "from" parameter and
597         return true iff stub could be reached.
598         (Stub_table::add_long_branch_entry): Similarly.  Add "r_type"
599         param too.
600         (Stub_table::clear_stubs): Add "all" param.
601
602 2014-11-26  Alan Modra  <amodra@gmail.com>
603
604         * powerpc.cc (Stub_control::set_output_and_owner): New function.
605         (Target_powerpc::group_sections): Use it.
606
607 2014-11-25  Cary Coutant  <ccoutant@google.com>
608
609         * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
610         (Binary_to_elf::write_symbol): Add st_size parameter.
611         * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
612
613 2014-11-25  Cary Coutant  <ccoutant@google.com>
614
615         PR gold/17639
616         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
617         (Sized_relobj_file::do_layout): Handle deferred sections properly
618         during GC pass 1. Don't add reloc sections to deferred list twice.
619         * object.h (Sized_relobj_file::is_deferred_layout): New function.
620         (Sized_relobj_file::is_deferred_layout_): New data member.
621
622 2014-11-21  H.J. Lu  <hongjiu.lu@intel.com>
623
624         PR gold/17619
625         * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
626         Check PC-relative offset overflow in PLT entry.
627
628 2014-11-21  Alan Modra  <amodra@gmail.com>
629
630         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
631         for undefined weaks.
632
633 2014-11-20  Alan Modra  <amodra@gmail.com>
634
635         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
636         from --stub-group-size parameter divided by 1024.
637         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
638         template parameter.  Update all uses.
639         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
640         has_stub_value.  Set for long branches.  Don't report overflow for
641         branch to undefined weak symbols.  Print info message on
642         overflowing branch to stub.
643
644 2014-11-20  Alan Modra  <amodra@gmail.com>
645
646         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
647
648 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
649
650         * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
651         entry for R_X86_64_GOTPLT64.
652         (Target_x86_64<size>::Relocate::relocate): Update comments for
653         R_X86_64_GOTPLT64.
654
655 2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>
656
657         * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
658         * plugin.h: add lock definition
659
660 2014-10-29  Han Shen  <shenhan@google.com>
661             Jing Yu   <jingyu@google.com>
662
663         * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
664         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
665         TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
666         Symbol::TLS_REF.
667         * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
668         method.
669         (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
670         (Target_aarch64::tls_ld_to_le): New method.
671         (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
672         for 64bit targets.
673         (Output_data_plt_aarch64::irelative_rel_): New data member.
674         (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
675         (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
676         (Output_data_plt_aarch64::add_relocation): New method.
677         (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
678         offset. Add got_irelative size to got size.
679         (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
680         type string with the new typename.
681         (AArch64_relocate_functions::update_adr): Replace parameter x with
682         immed.
683         (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
684         (AArch64_relocate_functions::reloc_common): New method.
685         (AArch64_relocate_funcsions::rela_general): Extract common part out
686         into reloc_common method.
687         (AArch64_relocate_functions::rela_general): Likewise.
688         (AArch64_relocate_functions::pcrela_general): Likewise.
689         (AArch64_relocate_functions::adr): New method.
690         (AArch64_relocate_functions::adrp): Calculate immed before calling
691         update_adr.
692         (AArch64_relocate_functions::adrp): Likewise.
693         (AArch64_relocate_functions::movnz): Cast x to SignedW type when
694         comparing x to 0. Calculate immed from ~x when x < 0.
695         (Target_aarch64::optimize_tls_reloc): Add new cases for
696         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
697         TLSLD_MOVW_DTPREL_G0_NC.
698         (Target_aarch64::possible_function_pointer_reloc): Implement this
699         method.
700         (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
701         comment.
702         (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
703         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
704         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
705         (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
706         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
707         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
708         (Target_aarch64::make_plt_entry): Call add_entry with two more
709         parameters.
710         (Target_aarch64::make_local_ifunc_plt_entry): New method.
711         (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
712         ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
713         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
714         (Target_aarch64::Relocate::relocate_tls): Add cases for
715         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
716         TLSLD_MOVW_DTPREL_G0_NC.
717         * testsuite/icf_safe_so_test.cc: Correct test comment.
718         * testsuite/icf_safe_test.sh: Add AArch64 arch.
719
720 2014-10-22  Alan Modra  <amodra@gmail.com>
721
722         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
723         thread_starter.
724
725 2014-10-18  Andreas Schwab  <schwab@linux-m68k.org>
726
727         * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
728
729 2014-10-17  Cary Coutant  <ccoutant@google.com>
730
731         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
732         Add "typename" keyword.
733
734 2014-10-15  Han Shen  <shenhan@google.com>
735             Jing Yu   <jingyu@google.com>
736
737         Patch for gold aarch64 backend to support relaxation.
738         * aarch64-reloc.def: Change format.
739         * aarch64.cc (class Reloc_stub): New class.
740         (class Stub_table): New class.
741         (class AArch64_relobj): New class.
742         (class AArch64_input_section): New class.
743         (class AArch64_output_section): New class.
744         (Target_aarch64::new_stub_table): New method.
745         (Target_aarch64::new_aarch64_input_section): New method.
746         (Target_aarch64::find_aarch64_input_section): New method.
747         (Target_aarch64::scan_section_for_stubs): New method.
748         (Target_aarch64::scan_reloc_section_for_stubs): New method.
749         (Target_aarch64::relocate_stub): New method.
750         (Target_aarch64::current_target): New method.
751         (Target_aarch64::do_make_elf_object): New method.
752         (Target_aarch64::do_may_relax): New method.
753         (Target_aarch64::do_relax): New method.
754         (Target_aarch64::group_sections): New method.
755         (Target_aarch64::scan_reloc_for_stub): New method.
756         (Target_aarch64::do_make_output_section): New method.
757         (Target_aarch64::stub_tables_): New data member.
758         (Target_aarch64::aarch64_input_section_map_): New data member.
759         (AArch64_relocate_functions::maybe_apply_stub): New method.
760
761 2014-09-30  Cary Coutant  <ccoutant@google.com>
762
763         PR gold/17432
764         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
765
766 2014-09-30  Kito Cheng  <kito@0xlab.org>
767
768         PR gold/13597
769         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
770         hash table before sysv-style hash table.
771
772 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
773
774         * options.h (--pic-executable): Add negative to alias to -no-pie.
775
776 2014-09-26  Cary Coutant  <ccoutant@google.com>
777
778         PR gold/16773
779         * object.cc (Sized_relobj_file): Compute value of section symbols
780         for TLS sections the same as TLS symbols.
781
782 2014-09-25  Cary Coutant  <ccoutant@google.com>
783
784         PR gold/17432
785         * resolve.cc (Symbol_table::resolve): Override common placeholder
786         symbols, but adjust sizes.
787         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
788         symbols to common lists.
789
790 2014-09-24  Alan Modra  <amodra@gmail.com>
791
792         * po/POTFILES.in: Regenerate.
793
794 2014-09-23  Taiju Tsuiki  <tzik@google.com>
795             Cary Coutant  <ccoutant@google.com>
796
797         PR gold/14860
798         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
799         on input_sections_blocker.
800         * layout.cc (Write_sections_task::locks): Unblock
801         input_sections_blocker_.
802         * layout.h (Write_sections_task::Write_sections_task): Add
803         input_sections_blocker.
804         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
805         to DEPENDENCIES.
806         * testsuite/Makefile.in: Regenerate.
807
808 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
809
810         * testsuite/Makefile.am (plugin_test_10): New test.
811         * testsuite/Makefile.in: Regenerate
812         * testsuite/plugin_common_test_2.c (c1): Align to 8.
813         * testsuite/plugin_test_10.sh: New file.
814
815 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
816
817         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
818         * resolve.cc (Symbol_table::resolve): Don't override common symbols
819         during the replacement phase.
820
821 2014-09-17  Han Shen  <shenhan@google.com>
822             Jing Yu  <jingyu@google.com>
823
824         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
825         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
826         * aarch64.cc (Target_aarch64): Add data members
827         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
828         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
829         constructor.
830         (Target_aarch64::do_reloc_symbol_index): New method.
831         (Target_aarch64::do_reloc_addend): New method.
832         (Target_aarch64::add_tlsdesc_info): New method.
833         (Target_aarch64::do_dynsym_value): New method.
834         (Target_aarch64::do_make_data_plt): Add new parameters: got,
835         got_irelative. Pass them to Output_data_plt_aarch64_standard.
836         (Target_aarch64::make_data_plt): Add new parameters: got,
837         got_irelative. Pass them to do_make_data_plt.
838         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
839         (Target_aarch64::Relocate:tls_gd_to_le): New method.
840         (Target_aarch64::Relocate:tls_ie_to_le): New method.
841         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
842         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
843         (Target_aarch64::got_tlsdesc_section): New method.
844         (Target_aarch64::make_local_ifunc_plt_entry): New method.
845         (Target_aarch64::define_tls_base_symbol): New method.
846         (Target_aarch64::reserve_tlsdesc_entries): New method.
847         (Target_aarch64::got_mod_index_entry): New method.
848         (Target_aarch64::rela_tlsdesc_section): New method.
849         (Target_aarch64::rela_irelative_section): New method.
850         (Target_aarch64::Tlsdesc_info): New struct.
851         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
852         relocations and tlsdesc relocations.
853         (Target_aarch64::optimize_tls_reloc): Implement method.
854         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
855         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
856         in constructor.
857         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
858         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
859         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
860         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
861         (Output_data_plt_aarch64::rela_tlsdesc): New method.
862         (Output_data_plt_aarch64::rela_irelative): New method.
863         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
864         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
865         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
866         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
867         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
868         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
869         (Output_data_plt_aarch64_standard): New member variables:
870         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
871         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
872         New parameter: got, got_irelative.
873         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
874         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
875         (Output_data_plt_aarch64::do_write): Replace got_address with
876         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
877         (AArch64_relocate_functions::update_movnz): New method.
878         (AArch64_relocate_functions): Correct format.
879         (AArch64_relocate_functions::movnz): New method.
880         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
881         before the switch. Add new cases to switch.
882         Check ie_to_le relaxation on tlsie relocations. Add code handling
883         tlsgd tlsdesc cases.
884         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
885         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
886         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
887         Call reloc_name_in_error_message to print unsupported reloc.
888         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
889         make_data_plt.
890         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
891         relocs. Fill in some more dynamic tags.
892         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
893         Skip call tls_get_addr when tlsgd is relaxed.
894         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
895         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
896         tlsdesc->ie relaxation.
897
898 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
899
900         * mips.cc (Target_mips_nacl): New class.
901         (Target_selector_mips_nacl): New class.
902         (target_selector_mips32): Rename from target_selector_mips32be and use
903         Target_selector_mips_nacl instead of Target_selector_mips.
904         (target_selector_mips32el): Rename from target_selector_mips32 and use
905         Target_selector_mips_nacl instead of Target_selector_mips.
906         (target_selector_mips64): Rename from target_selector_mips64be and use
907         Target_selector_mips_nacl instead of Target_selector_mips.
908         (target_selector_mips64el): Rename from target_selector_mips64 and use
909         Target_selector_mips_nacl instead of Target_selector_mips.
910         (Target_mips::mips_info): Add const attribute.
911
912 2014-09-02  Cary Coutant  <ccoutant@google.com>
913
914         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
915         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
916         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
917         (Sized_incr_dynobj::do_section_name): Likewise.
918         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
919         (Sized_incr_dynobj::do_section_name): Likewise.
920         * object.h (Object::section_name): Likewise.
921         (Object::do_section_name): Likewise.
922         (Sized_relobj_file::do_section_name): Likewise.
923         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
924         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
925
926 2014-09-02  Cary Coutant  <ccoutant@google.com>
927
928         PR gold/17005
929         * ehframe.cc (Fde::write): Add output_offset parameter.
930         (Cie::write): Likewise.
931         (Eh_frame::set_final_data_size): Account for offset within output
932         section.
933         (Eh_frame::do_sized_write): Likewise.
934         * ehframe.h (Fde::write): Add output_offset parameter.
935         (Cie::write): Likewise.
936         * output.cc (Output_section::Input_section_sort_entry): Remove
937         section_has_name_; add output_section_name parameter. Use
938         output section name for non-input sections.
939         (Output_section::Input_section_sort_entry::section_has_name): Remove.
940         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
941         (Output_section::Input_section_sort_compare): Remove logic for
942         sections without names.
943         (Output_section::Input_section_sort_init_fini_compare): Likewise.
944         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
945         Likewise.
946         (Output_section::Input_section_sort_section_name_compare): Likewise.
947
948 2014-08-29 Han Shen <shenhan@google.com>
949            Jing Yu <jingyu@google.com>
950
951         * aarch64-reloc-property.cc
952         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
953         reference reloc property in the table.
954         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
955         3 other entries.
956         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
957         2 new overloaded methods.
958         (Output_data_got_aarch64::do_write): Add code to write out
959         static relocs.
960         (class Output_data_got_aarch64::Static_reloc): New class to wrap
961         static relocs.
962         (Output_data_got_aarch64::static_relocs): New vector to
963         hold static relocs.
964         (Target_aarch64::TCB_SIZE): New const static memeber.
965         (Target_aarch64::tcb_size): New method.
966         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
967         (Target_aarch64::Relocate::relocate_tls): New method.
968         (Target_aarch64::Scan::local): Add code handling new reloc types.
969         (Target_aarch64::Scan::global): Add code handling new reloc types.
970
971 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
972
973         * options.h (-no-pie): Add option.
974
975 2014-08-08  Jing Yu  <jingyu@google.com>
976             Han Shen  <shenhan@google.com>
977
978         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
979         (DEFFILES): add aarch64-reloc.def.
980         (TARGETSOURCES): Add aarch64-reloc-property.cc.
981         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
982         * Makefile.in: Regenerate.
983         * aarch64-reloc-property.cc: New file.
984         * aarch64-reloc-property.h: New file.
985         * aarch64-reloc.def: New file.
986         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
987         with tab to make the format consistent.
988         (Output_data_got_aarch64::symbol_table_): New method.
989         (Target_aarch64::do_plt_address_for_global): New method.
990         (Target_aarch64::do_plt_address_for_local): New method.
991         (Target_aarch64::do_select_as_default_target): New method.
992         (Target_aarch64::do_make_data_plt): New method.
993         (Target_aarch64::make_data_plt): New method.
994         (Output_data_plt_aarch64::has_irelative_section): New method.
995         (Output_data_plt_aarch64::address_for_global): New method.
996         (Output_data_plt_aarch64::address_for_local): New method.
997         (Output_data_plt_aarch64::irelative_rel_): New parameter.
998         (Output_data_plt_aarch64::add_entry): Implement contents.
999         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
1000         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
1001         the got_pov entry to plt0.
1002         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
1003         Implement contents.
1004         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
1005         (AArch64_howto): New struct.
1006         (aarch64_howto[]): New static const array.
1007         (AArch64_relocate_functions): New class.
1008         (Target_aarch64::Scan::get_reference_flags): Remove method.
1009         (Target_aarch64::Scan::local): Implement to support a few relocations.
1010         (Target_aarch64::Scan::global): Implement to support a few relocations.
1011         (Target_aarch64::make_plt_section): Implement contents.
1012         (Target_aarch64::make_plt_entry): Implement contents.
1013         (Target_aarch64::do_finalize_sections): Implement contents.
1014         (Target_aarch64::Relocate::relocate): Implement a few relocations.
1015         (Target_aarch64::relocate_section): Implement contents.
1016
1017 2014-08-06  Alan Modra  <amodra@gmail.com>
1018
1019         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
1020
1021 2014-08-06  Alan Modra  <amodra@gmail.com>
1022
1023         PR 13227
1024         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
1025
1026 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
1027
1028         * object.cc (Relobj::is_section_name_included): Add
1029         ".rodata.nptl_version" to not garbage collect this section.
1030
1031 2014-07-08  Cary Coutant  <ccoutant@google.com>
1032
1033         * expression.cc (struct Expression::Expression_eval_info): Add
1034         new fields type_pointer, vis_pointer, and nonvis_pointer.
1035         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
1036         nonvis_pointer parameters. Adjust all calls.
1037         (Symbol_expression::value): Update type, visibility, and nonvis bits
1038         in caller.
1039         * script.cc (Symbol_assignment::sized_finalize): Update type,
1040         visibility, and remaining st_other bits for new symbol.
1041         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
1042         vis_pointer, and nonvis_pointer parameters.
1043         * symtab.h (Symbol::set_type): New method.
1044
1045         * testsuite/Makefile.am (defsym_test): New test.
1046         * testsuite/Makefile.in: Regenerate.
1047         * testsuite/defsym_test.c: New file.
1048         * testsuite/defsym_test.sh: New file.
1049
1050 2014-07-08  Cary Coutant  <ccoutant@google.com>
1051
1052         PR gold/15639
1053         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
1054         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
1055         (Sized_dynobj::base_read_symbols): ...new method.
1056         * object.h (Sized_relobj_file::base_read_symbols): New method.
1057         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
1058         (Sized_relobj_file::base_read_symbols): ...new method.
1059         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
1060         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
1061         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
1062
1063 2014-07-04  Alan Modra  <amodra@gmail.com>
1064
1065         * po/POTFILES.in: Regenerate.
1066
1067 2014-07-02  Jing Yu  <jingyu@google.com>
1068
1069         * aarch64.cc: New file
1070         * Makefile.am (TARGETSOURCES): Add aarch64.cc
1071         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
1072         * Makefile.in: Regenerate.
1073         * configure.tgt: Add entries for aarch64*.
1074         * configure.ac:  Likewise.
1075         * configure: Likewise.
1076
1077 2014-06-27  Alan Modra  <amodra@gmail.com>
1078
1079         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
1080
1081 2014-06-24  Cary Coutant  <ccoutant@google.com>
1082
1083         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
1084         sections.
1085         (Dwo_file::sized_read_unit_index): Likewise.
1086
1087 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1088
1089         * mips.cc: New file.
1090         * Makefile.am (TARGETSOURCES): Add mips.cc
1091         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
1092         * configure.tgt: Add entries for mips*.
1093         * configure.ac: Likewise.
1094         * Makefile.in: Regenerate.
1095         * configure: Likewise.
1096
1097 2014-06-09  Cary Coutant  <ccoutant@google.com>
1098
1099         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
1100         unit_length is within section bounds.
1101
1102 2014-06-09  Cary Coutant  <ccoutant@google.com>
1103
1104         PR gold/16980
1105         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
1106         map.
1107
1108 2014-06-07  Alan Modra  <amodra@gmail.com>
1109
1110         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
1111
1112 2014-06-06  Cary Coutant  <ccoutant@google.com>
1113
1114         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
1115         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
1116         (Dwarf_pubnames_table::read_header): Likewise.
1117         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
1118         .debug_gnu_pubtypes.
1119
1120 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
1121
1122         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
1123         * Makefile.in, configure: Regenerate.
1124
1125 2014-06-03  Alan Modra  <amodra@gmail.com>
1126
1127         * powerpc.cc (addis_12_2): Define.
1128         (Stub_table::do_write): Support fusion on ELFv2 stubs.
1129
1130 2014-06-03  Alan Modra  <amodra@gmail.com>
1131
1132         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
1133         st_other output.
1134
1135 2014-06-02  Alan Modra  <amodra@gmail.com>
1136
1137         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
1138         Only ignore relocs on ELFv1.
1139         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
1140
1141 2014-05-30  Cary Coutant  <ccoutant@google.com>
1142
1143         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
1144         * testsuite/Makefile.in: Regenerate.
1145         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
1146
1147 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
1148
1149         PR gold/16945
1150         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
1151         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
1152
1153 2014-05-15  Alan Modra  <amodra@gmail.com>
1154
1155         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
1156         Compare FDE contents with DW_CFA_nop rather than 0.
1157
1158 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
1159
1160         * symtab.h (may_need_copy_reloc): Remove check for position independent
1161         code.
1162         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
1163         position independence before pc absolute may_need_copy_reloc call.
1164         Add check for executable output befor pc relative may_need_copy_reloc
1165         call.
1166         * i386.cc: Ditto.
1167         * arm.cc: Ditto.
1168         * sparc.cc: Ditto.
1169         * tilegx.cc: Ditto.
1170         * powerpc.cc: Add check for no position independence before
1171         may_need_copy_reloc calls.
1172         * testsuite/pie_copyrelocs_test.cc: New file.
1173         * testsuite/pie_copyrelocs_shared_test.cc: New file.
1174         * Makefile.am (pie_copyrelocs_test): New test.
1175         * Makefile.in: Regenerate.
1176
1177 2014-05-08  Martin Liška  <mliska@suse.cz>
1178
1179         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
1180
1181 2014-05-06  Cary Coutant  <ccoutant@google.com>
1182
1183         PR gold/16900
1184         * i386.cc (Output_data_got_plt_i386): New class.
1185         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
1186         parameter. Change all callers.
1187         (Output_data_plt_i386::layout_): Remove.
1188         (Output_data_plt_i386::got_plt_): Change type.
1189         (Target_i386::got_plt_): Change type. Change all references.
1190         (Target_i386::got_section): Create instance of new class.
1191         (Output_data_got_plt_i386::do_write): New function.
1192         * x86_64.cc (Output_data_got_plt_x86_64): New class.
1193         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
1194         parameter. Change all callers.
1195         (Output_data_plt_x86_64::layout_): Remove.
1196         (Output_data_plt_x86_64::got_plt_): Change type.
1197         (Target_x86_64::got_plt_): Change type. Change all references.
1198         (Target_x86_64::got_section): Create instance of new class.
1199         (Output_data_got_plt_x86_64::do_write): New function.
1200         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
1201         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
1202         class.
1203
1204 2014-05-05  Cary Coutant  <ccoutant@google.com>
1205
1206         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
1207         if we have pubnames/pubtypes.
1208
1209 2014-05-02  Cary Coutant  <ccoutant@google.com>
1210
1211         * defstd.cc (in_segment): Define __ehdr_start here...
1212         * layout.cc (Layout::finalize): ...Instead of here.  Set the
1213         output segment when known.
1214         * resolve.cc (Symbol::override_base_with_special): Remember
1215         the original binding.
1216         * symtab.cc (Symbol::set_output_segment): New function.
1217         (Symbol::set_undefined): New function.
1218         * symtab.h (Symbol::is_weak_undefined): Check original undef
1219         binding.
1220         (Symbol::is_strong_undefined): New function.
1221         (Symbol::set_output_segment): New function.
1222         (Symbol::set_undefined): New function.
1223         * target-reloc.h (is_strong_undefined): Remove.
1224         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
1225         Check for hidden undefs.
1226         (relocate_section): Call Symbol::is_strong_undefined.
1227
1228         * testsuite/Makefile.am (ehdr_start_test_1)
1229         (ehdr_start_test_2, ehdr_start_test_3)
1230         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
1231         * testsuite/Makefile.in: Regenerate.
1232         * testsuite/ehdr_start_def.cc: New source file.
1233         * testsuite/ehdr_start_test.cc: New source file.
1234         * testsuite/ehdr_start_test.t: New linker script.
1235         * testsuite/ehdr_start_test_4.sh: New shell script.
1236
1237 2014-04-23  Cary Coutant  <ccoutant@google.com>
1238
1239         PR gold/16870
1240         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
1241
1242 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1243
1244         * layout.cc (Layout::include_section): Allow a target to decide
1245         whether to include a section.
1246         * target.h (Target::should_include_section): New function.
1247         (Target::do_should_include_section): New function.
1248
1249 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1250
1251         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
1252         inline into ...
1253         (Copy_relocs::emit): ... here.
1254         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
1255         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
1256         (Copy_reloc_entry::entries_): Change from private to protected.
1257
1258 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
1259
1260         * icf.cc (get_section_contents): Replace copies of reloc
1261         vectors with const references.
1262
1263 2014-04-02  Cary Coutant  <ccoutant@google.com>
1264
1265         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
1266         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
1267         * configure: Regenerate.
1268         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
1269         -fno-use-linker-plugin.
1270         (LINK1, CXXLINK1): Add it to the link command.
1271         * testsuite/Makefile.in: Regenerate.
1272
1273 2014-03-12  Alan Modra  <amodra@gmail.com>
1274
1275         * Makefile.in: Regenerate.
1276
1277 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1278
1279         * symtab.h (Symbol::set_nonvis): New function.
1280
1281 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1282
1283         * symtab.cc (Sized_symbol<32>::init_output_data):
1284         Instantiate the template.
1285         (Sized_symbol<64>::init_output_data): Likewise.
1286
1287 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1288
1289         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
1290         adjust dynamic symbol value.
1291         * target.h (Target::adjust_dyn_symbol): New function.
1292         (Target::do_adjust_dyn_symbol): New function.
1293
1294 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1295
1296         * output.cc (Output_data_dynamic::Dynamic_entry::write):
1297         Get the value of DYNAMIC_CUSTOM dynamic entry.
1298         * output.h (Output_data_dynamic::add_custom): New function.
1299         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
1300         dynamic entry.
1301         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
1302         * target.h (Target::dynamic_tag_custom_value): New function.
1303         (Target::do_dynamic_tag_custom_value): New function.
1304
1305 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1306
1307         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
1308         dynsym indexes.
1309         * target.h (Target::has_custom_set_dynsym_indexes): New function.
1310         (Target::do_has_custom_set_dynsym_indexes): New function.
1311         (Target::set_dynsym_indexes): New function.
1312         (Target::do_set_dynsym_indexes): New function.
1313
1314 2014-03-07  Alan Modra  <amodra@gmail.com>
1315
1316         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
1317         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
1318         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
1319         (Powerpc_relocate_functions::has_overflow_bitfield,
1320         overflowed): Use the above.
1321         (Target_powerpc::Relocate::relocate): Correct overflow checking
1322         for a number of relocations.  Modify overflow test for 16-bit
1323         fields in instructions to signed/unsigned according to whether
1324         the field takes a signed or unsigned value.
1325
1326 2014-03-05  Alan Modra  <amodra@gmail.com>
1327
1328         Update copyright years.
1329
1330 2014-03-05  Alan Modra  <amodra@gmail.com>
1331
1332         * powerpc.cc (Target_powerpc::Scan::local, global): Support
1333         R_PPC64_ADDR64_LOCAL.
1334         (Target_powerpc::Relocate::relocate): Likewise.
1335
1336 2014-03-03  Alan Modra  <amodra@gmail.com>
1337
1338         * dwp.cc (print_version): Update copyright year to current.
1339
1340 2014-02-10  Alan Modra  <amodra@gmail.com>
1341
1342         * po/gold.pot: Regenerate.
1343
1344 2014-02-06  Cary Coutant  <ccoutant@google.com>
1345
1346         Fix problem where -u is ignored when a weak undef is seen.
1347
1348         * archive.cc (Library_base::should_include_member): Reorder
1349         code to check for -u option if a weak undef has already been seen.
1350         * testsuite/Makefile.am (weak_undef_test_2): New test case.
1351         * testsuite/Makefile.in: Regenerate.
1352         * testsuite/weak_undef_file3.cc: New file.
1353         * testsuite/weak_undef_file4.cc: New file.
1354         * testsuite/weak_undef_test_2.cc: New file.
1355
1356 2014-02-05  Cary Coutant  <ccoutant@google.com>
1357
1358         Fix issues with gold undefined symbol diagnostics.
1359
1360         PR binutils/15435
1361         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
1362         check to here.
1363         * target-reloc.h (is_strong_undefined): New function.
1364         (relocate_section): Move undef vtable symbol check from here.
1365         Check for is_strong_undefined.
1366
1367 2014-02-05  Cary Coutant  <ccoutant@google.com>
1368
1369         Fix problems with the --dynamic-list option.
1370
1371         PR gold/13577
1372         * options.cc (General_options::parse_dynamic_list):
1373         Set have_dynamic_list_.
1374         (General_options::General_options): Initialize have_dynamic_list_.
1375         (General_options::finalize): Turn off -Bsymbolic and
1376         -Bsymbolic-functions if --dynamic-list provided.
1377         * options.h (General_options::have_dynamic_list): New function.
1378         (General_options::have_dynamic_list_): New data member.
1379         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
1380         correctly.
1381
1382         PR gold/16530
1383         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
1384         in --dynamic-list, mark it.
1385
1386         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
1387         (dynamic_list_2): New test case.
1388         * testsuite/Makefile.in: Regenerate.
1389         * testsuite/dynamic_list_2.cc: New file.
1390         * testsuite/dynamic_list_2.t: New file.
1391         * testsuite/dynamic_list_lib1.cc: New file.
1392         * testsuite/dynamic_list_lib2.cc: New file.
1393         * testsuite/gc_dynamic_list_test.c: New file.
1394         * testsuite/gc_dynamic_list_test.sh: New file.
1395         * testsuite/gc_dynamic_list_test.t: New file.
1396
1397 2014-01-28  Cary Coutant  <ccoutant@google.com>
1398
1399         Add .gdb_index version 7 support.
1400
1401         * gold/dwarf_reader.cc: include <utility> (for make_pair).
1402         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
1403         debug sections.
1404         (Dwarf_ranges_table::read_ranges_table): Likewise.
1405         (Dwarf_pubnames_table::read_section): Check for GNU-style
1406         sections, and for compressed debug sections.
1407         (Dwarf_pubnames_table::read_header): Compute end address of table.
1408         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
1409         for end of list by offset, not by offset == 0.
1410         (Dwarf_info_reader::do_read_string_table): Check for compressed
1411         debug sections.
1412         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1413         Initialize new data members.
1414         (Dwarf_pubnames_table::next_name): return flag_byte.
1415         (Dwarf_pubnames_table::end_of_table_): New data member.
1416         (Dwarf_pubnames_table::is_gnu_style_): New data member.
1417         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
1418         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
1419         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
1420         read skeleton type unit DIEs.
1421         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
1422         (Gdb_index::do_write): Write flag_byte.
1423         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
1424         (Gdb_index::Cu_vector): Store flags along with cu indexes.
1425         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
1426         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
1427
1428 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
1429
1430         * version.cc (print_version): Update copyright year to 2014.
1431
1432 2013-12-19  Dimitry Andric  <dimitry@andric.com>
1433
1434         * stringpool.cc (Stringpool_template::reserve): Add
1435         HAVE_UNORDERED_MAP case.
1436         * stringpool.cc (Stringpool_template::print_stats): Likewise.
1437
1438 2013-12-18  Cary Coutant  <ccoutant@google.com>
1439
1440         * configure.ac: Check for <unordered_set> and <unordered_map>.
1441         * config.in: Regenerate.
1442         * configure: Regenerate.
1443         * system.h: Use <unordered_set> and <unordered_map> if available.
1444
1445 2013-12-10  Roland McGrath  <mcgrathr@google.com>
1446
1447         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
1448         with $(INSTALL_PROGRAM_ENV).
1449         * Makefile.in: Regenerate.
1450
1451 2013-11-22  Cary Coutant  <ccoutant@google.com>
1452
1453         * configure.ac: Add check for which library is needed for
1454         dlopen.
1455         * configure: Regenerate.
1456
1457 2013-11-22  Cary Coutant  <ccoutant@google.com>
1458
1459         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
1460         assembler.
1461         * testsuite/Makefile.in: Regenerate.
1462
1463 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
1464
1465         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
1466         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
1467         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
1468         (Target_x86_64<size>::Scan::local): Likewise.
1469         (Target_x86_64<size>::Scan::global): Likewise.
1470         (Target_x86_64<size>::Relocate::relocate): Likewise.
1471         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
1472         Likewise.
1473         (Target_x86_64<size>::Scan::check_non_pic(): Handle
1474         R_X86_64_PC32_BND.
1475
1476         * testsuite/Makefile.am (check_PROGRAMS): Add
1477         exception_x86_64_bnd_test.
1478         (exception_x86_64_bnd_test_SOURCES): New macro.
1479         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
1480         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
1481         (exception_x86_64_bnd_test_LDADD): Likewise.
1482         (exception_x86_64_bnd_1.o): New rule.
1483         (exception_x86_64_bnd_2.o): Likewise.
1484         * testsuite/Makefile.in: Regenerated.
1485
1486 2013-11-15  Alan Modra  <amodra@gmail.com>
1487
1488         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
1489         accessor.
1490         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
1491         Only call ppc64_local_entry_offset for 64-bit.  Restrict
1492         symval_for_branch lookup to ELFv1.
1493         (Stub_table::add_plt_call_entry): Use unsigned int off.
1494         (Output_data_glink::Address, invalid_address): New.
1495         (Output_data_glink::add_eh_frame): Move out of line.  Add
1496         support for ELFv2.
1497         (Output_data_glink::add_global_entry, find_global_entry,
1498         global_entry_address): New functions.
1499         (Output_data_glink::global_entry_stubs_, end_branch_table_,
1500         ge_size): New variables.
1501         (Output_data_glink::set_final_data_size): Add global entry
1502         stub sizing.
1503         (Output_data_glink::do_write): Write global entry stubs.
1504         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
1505         parameter.  Return true for ELFv2.  Adjust callers.
1506         (Target_powerpc::Scan::local, global): Restrict opd lookup to
1507         ELFv1.  Similarly for ifunc and dynamic relocation processing
1508         specific to ELFv1.  Recognize that symbols are defined on
1509         their plt entries for ELFv2.
1510         (Target_powerpc::symval_for_branch): Assert if called for
1511         ELFv2 or ppc32.
1512         (Target_powerpc::Relocate::relocate): Use global entry plt
1513         stub for symbol value if such exists on ELFv2.
1514         (Target_powerpc::Relocate::relocate): Don't call
1515         symval_for_branch when ELFv2.  Do adjust for local entry
1516         offset when ELFv2.
1517         (Target_powerpc::do_dynsym_value): Set symbols to global entry
1518         plt stub for ELFv2.
1519         (Target_powerpc::do_plt_address_for_global): Similarly.
1520
1521 2013-11-14  Cary Coutant  <ccoutant@google.com>
1522
1523         Revert patch -- this did not fix the problem, and there is
1524         no race there.
1525
1526         2013-11-14  Cary Coutant  <ccoutant@google.com>
1527
1528             PR gold/14860
1529             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1530             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1531             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1532             updating fde_offsets_.
1533             (Eh_frame_hdr::lock_): New data member.
1534
1535 2013-11-14  Cary Coutant  <ccoutant@google.com>
1536
1537         * dwp.cc (Dwo_file_entry): New type.
1538         (File_list): Use Dwo_file_entry.
1539         (Dwo_file::verify): New function.
1540         (Dwo_file::verify_dwo_list): New function.
1541         (Dwo_file::sized_verify_dwo_list): New function.
1542         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
1543         list.
1544         (Dwp_options): New enum type.
1545         (dwp_options): Add --verify-only.
1546         (usage): Likewise.
1547         (main): Likewise.
1548         * dwp.h (gold_info): Add declaration.
1549
1550 2013-11-14  Cary Coutant  <ccoutant@google.com>
1551
1552         PR gold/14860
1553         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1554         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1555         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1556         updating fde_offsets_.
1557         (Eh_frame_hdr::lock_): New data member.
1558
1559 2013-11-06  Cary Coutant  <ccoutant@google.com>
1560
1561         PR gold/15758
1562         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
1563         before reloc sections.
1564
1565 2013-11-04  Alan Modra  <amodra@gmail.com>
1566
1567         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
1568         (Symbol::needs_dynamic_reloc): Test new flag.
1569         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
1570         (Target_powerpc::Scan::get_reference_flags): Add target param.
1571         Return FUNC_DESC_ABI for 64-bit ELFv1.
1572         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
1573         call.
1574         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
1575         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
1576
1577 2013-10-31  Cary Coutant  <ccoutant@google.com>
1578
1579         Restore support for dwp v2 DWARF package file format.
1580
1581         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1582         tu_length parameter.  Adjust all callers.
1583         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1584         * dwp.cc: Include dwarf.h.
1585         (Section_bounds): New struct type.
1586         (Unit_set): New struct type.
1587         (Dwo_file::Dwo_file): Initialize new data member.
1588         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1589         Combine and rename to...
1590         (Dwo_file::read_unit_index): ...this.
1591         (Dwo_file::sized_read_compunit_index)
1592         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1593         (Dwo_file::sized_read_unit_index): ...this.
1594         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1595         parameters; add section_id parameter.
1596         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1597         (Dwo_file::add_unit_set): ...this.
1598         (Dwo_file::shndx_map_): Remove.
1599         (Dwo_file::sect_offsets_): New data member.
1600         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1601         (Dwp_output_file::add_section): Rename to...
1602         (Dwp_output_file::add_contribution): ...this.
1603         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1604         (Dwp_output_file::add_tu_set): Likewise.
1605         (Dwp_output_file::Contribution): New type.
1606         (Dwp_output_file::Section::contributions): New data member.
1607         (Dwp_output_file::Cu_or_tu_set): Remove.
1608         (Dwp_output_file::Section::Section): New ctor.
1609         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1610         (Dwp_output_file::Dwp_index::Section_table): New type.
1611         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1612         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1613         parameter.
1614         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1615         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1616         (Dwp_output_file::Dwp_index::section_table): New member function.
1617         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1618         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1619         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1620         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1621         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1622         (Dwp_output_file::Dwp_index::section_table_): New data member.
1623         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1624         (Dwp_output_file::add_output_section): New member function.
1625         (Dwp_output_file::write_new_section): New member function.
1626         (Dwp_output_file::write_contributions): New member function.
1627         (Dwp_output_file::section_id_map_): New data member.
1628         (class Dwo_id_info_reader): Remove.
1629         (class Unit_reader): New class.
1630         (get_dwarf_section_name): New function.
1631         (Dwo_file::read_executable): Adjust initializations of class data.
1632         (Dwo_file::read): Add support for v2 package file format.
1633         (Dwo_file::read_unit_index): Likewise.
1634         (Dwo_file::sized_read_unit_index): Likewise.
1635         (Dwo_file::copy_section): Likewise.
1636         (Dwo_file::add_unit_set): Likewise.
1637         (Dwp_output_file::add_output_section): Likewise.
1638         (Dwp_output_file::add_contribution): Likewise.
1639         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1640         for empty slot.
1641         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1642         file format.
1643         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1644         slot.
1645         (Dwp_output_file::initialize): Remove unused function.
1646         (Dwp_output_file::finalize): Add support for v2 package file format.
1647         (Dwp_output_file::write_index): Likewise.
1648         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1649         function prototype.
1650
1651 2013-10-31  Cary Coutant  <ccoutant@google.com>
1652
1653         * configure.ac: Fix check for -fmerge-constants.
1654         * configure.ac: Regenerate.
1655
1656 2013-10-30  Roland McGrath  <mcgrathr@google.com>
1657
1658         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
1659         Correct 9-byte nop sequence to match what the assembler generates.
1660
1661 2013-10-30  Alan Modra  <amodra@gmail.com>
1662
1663         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
1664         ppc64_local_entry_offset, ppc64_local_entry_offset,
1665         do_read_symbols): New functions.
1666         (Powerpc_relobj::e_flags_, st_other_): New vars.
1667         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
1668         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
1669         (Powerpc_relobj::e_flags_): New var.
1670         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
1671         and adjust for ELFv2.
1672         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
1673         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
1674         (Powerpc_dynobj::do_find_special_sections): Likewise.
1675         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
1676         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
1677         to ELFv2 local entry.
1678         (Target_powerpc::do_relax): No thread safe barriers needed for
1679         ELFv2.
1680         (Output_data_plt_powerpc::initial_plt_entry_size_,
1681         plt_entry_size): Delete.  Replace all uses with
1682         first_plt_entry_offset() and plt_entry_size().
1683         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
1684         reserved_size parm.  Update callers.
1685         (Output_data_plt_powerpc::entry_count): Update.
1686         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
1687         and use Target_powerpc::first_plt_entry_offset().
1688         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
1689         rename to plt_entry_size.
1690         (Output_data_plt_powerpc::add_ifunc_entry,
1691         add_local_ifunc_entry): Adjust reloc for ELFv2.
1692         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
1693         (glink_eh_frame_fde_64v2): New.
1694         (Stub_table::plt_call_size): Support ELFv2 sizing.
1695         (Output_data_glink::add_eh_frame): Use the new FDE.
1696         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
1697         (Stub_table::do_write): Write ELFv2 stubs and glink.
1698         (Target_powerpc::Relocate::relocate): Replaces nop after call
1699         with ld 2,24(1) and adjust local offset destination for ELFv2.
1700
1701 2013-10-30  Alan Modra  <amodra@gmail.com>
1702
1703         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
1704         (Target_powerpc::Scan::global, local): Likewise.
1705         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
1706         on all ppc64 @h and @ha relocs.
1707
1708 2013-10-14  Alan Modra  <amodra@gmail.com>
1709
1710         * output.h (Output_data_got::add_constant): Tidy.
1711         (Output_data_got::add_constant_pair): New function.
1712         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
1713         methods used so as to first call reserve_ent().
1714
1715 2013-10-11  Roland McGrath  <mcgrathr@google.com>
1716
1717         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
1718         add_got_entry and add_got_entry_pair.
1719
1720         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
1721         (HAVE_PUBNAMES): Likewise.
1722         * configure: Regenerate.
1723
1724         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
1725         * testsuite/Makefile.in: Regenerate.
1726
1727         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
1728         Remove const from declaration.
1729         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
1730         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
1731         * output.h (Output_file_header): Remove const from member target_
1732         and corresponding constructor argument.
1733         * output.cc (Output_file_header::Output_file_header): Update prototype.
1734         (Output_file_header::do_sized_write): Use this->target_ in place
1735         of parameters()->target().
1736
1737         * testsuite/undef_symbol.cc (Foo::get_a): New method.
1738
1739         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
1740         * configure: Regenerate.
1741         * Makefile.in: Regenerate.
1742         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
1743         * testsuite/merge_string_literals_2.c: Likewise.
1744         * testsuite/Makefile.am
1745         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
1746         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
1747         literal -fmerge-constants.
1748         * testsuite/Makefile.in: Regenerate.
1749
1750         * i386.cc (Target_i386): Remove unused member dynbss_.
1751         * arm.cc (Target_arm): Likewise.
1752         * powerpc.cc (Target_powerpc): Likewise.
1753         * sparc.cc (Target_sparc): Likewise.
1754         * tilegx.cc (Target_tilegx): Likewise.
1755         * x86_64.cc (Target_x86_64): Likewise.
1756         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
1757         type_signature_, type_offset_.
1758         * plugin.h (Plugin_hook): Remove unused member layout_.
1759         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
1760         mapfile_.
1761         (Read_member): Remove unused members input_objects_, symtab_,
1762         mapfile_, layout_.
1763         (Check_library): Remove unused member symtab_.
1764         * archive.h (Lib_group): Remove unused member lib_.
1765         * archive.cc (Lib_group::Lib_group): Update initializer.
1766         * incremental.h (Incremental_binary): Remove unused member target_.
1767         (Incremental_script_entry): Removed unused member script_.
1768         * layout.h (Write_symbols_task): Remove unused member input_objects_.
1769         * icf.h (Icf): Remove unused member num_tracked_relocs.
1770
1771         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1772         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1773         its only use.
1774         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1775
1776         * archive.h: Use struct rather than class for forward declaration
1777         of Read_symbols_data.
1778
1779 2013-10-07  Cary Coutant  <ccoutant@google.com>
1780
1781         PR gold/16010
1782         * testsuite/Makefile.am (icf_test): Fix dependencies.
1783         (icf_safe_test): Likewise.
1784         (icf_safe_so_test): Likewise.
1785         (large_symbol_alignment): Add empty _LDADD rule.
1786         * testsuite/Makefile.in: Regenerate.
1787
1788 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
1789
1790         PR gold/15927
1791         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1792         relocation for R_X86_64_32 on x32.
1793
1794 2013-08-27  Roland McGrath  <mcgrathr@google.com>
1795
1796         * output.cc (Output_segment::set_section_addresses): Take new
1797         Target* argument.  If target->isolate_execinstr() and the segment
1798         is executable and starts at a target->abi_pagesize() boundary,
1799         pad its end out to a target->abi_pagesize() boundary with code fill.
1800         * output.h (Output_segment::set_section_addresses): Update decl.
1801         * layout.h (Layout::check_output_data_for_reset_values): Take new
1802         argument RELAX_OUTPUTS.
1803         (Layout): New member relax_output_list_.
1804         (Layout::add_relax_output): New method.
1805         * layout.cc (Layout::Layout): Update constructor.
1806         (Layout::reset_relax_output): New method.
1807         (Layout::clean_up_after_relaxation): Call it.
1808         (Layout::prepare_for_relaxation): Update caller.
1809         (Layout::set_segment_offsets): Update callers of set_section_addresses.
1810         Call reset_relax_output before re-processing segments for
1811         isolate_execinstr case.
1812         (Layout::write_data): Handle relax_output_list_.
1813         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1814         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
1815
1816 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
1817
1818         PR binutils/15834
1819         * object.h: Fix typos.
1820
1821 2013-08-16  Roland McGrath  <mcgrathr@google.com>
1822
1823         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1824         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1825
1826 2013-08-07  Cary Coutant  <ccoutant@google.com>
1827
1828         Revert support for v2 DWP files:
1829
1830         2013-03-01  Cary Coutant  <ccoutant@google.com>
1831
1832             Add dwp support for v2 DWARF package file format.
1833             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1834             tu_length parameter.  Adjust all callers.
1835             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1836             * dwp.cc: Include dwarf.h.
1837             (Section_bounds): New struct type.
1838             (Unit_set): New struct type.
1839             (Dwo_file::Dwo_file): Initialize new data member.
1840             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1841             Combine and rename to...
1842             (Dwo_file::read_unit_index): ...this.
1843             (Dwo_file::sized_read_compunit_index)
1844             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1845             (Dwo_file::sized_read_unit_index): ...this.
1846             (Dwo_file::copy_section): Remove section_name, is_str_offsets
1847             parameters; add section_id parameter.
1848             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1849             (Dwo_file::add_unit_set): ...this.
1850             (Dwo_file::shndx_map_): Remove.
1851             (Dwo_file::sect_offsets_): New data member.
1852             (Dwp_output_file::Dwp_output_file): Initialize new data members.
1853             (Dwp_output_file::add_section): Rename to...
1854             (Dwp_output_file::add_contribution): ...this.
1855             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1856             (Dwp_output_file::add_tu_set): Likewise.
1857             (Dwp_output_file::Contribution): New type.
1858             (Dwp_output_file::Section::contributions): New data member.
1859             (Dwp_output_file::Cu_or_tu_set): Remove.
1860             (Dwp_output_file::Section::Section): New ctor.
1861             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1862             (Dwp_output_file::Dwp_index::Section_table): New type.
1863             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1864             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1865             parameter.
1866             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1867             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1868             (Dwp_output_file::Dwp_index::section_table): New member function.
1869             (Dwp_output_file::Dwp_index::section_table_end): New member function.
1870             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1871             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1872             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1873             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1874             (Dwp_output_file::Dwp_index::section_table_): New data member.
1875             (Dwp_output_file::Dwp_index::section_mask_): New data member.
1876             (Dwp_output_file::add_output_section): New member function.
1877             (Dwp_output_file::write_new_section): New member function.
1878             (Dwp_output_file::write_contributions): New member function.
1879             (Dwp_output_file::section_id_map_): New data member.
1880             (class Dwo_id_info_reader): Remove.
1881             (class Unit_reader): New class.
1882             (get_dwarf_section_name): New function.
1883             (Dwo_file::read_executable): Adjust initializations of class data.
1884             (Dwo_file::read): Add support for v2 package file format.
1885             (Dwo_file::read_unit_index): Likewise.
1886             (Dwo_file::sized_read_unit_index): Likewise.
1887             (Dwo_file::copy_section): Likewise.
1888             (Dwo_file::add_unit_set): Likewise.
1889             (Dwp_output_file::add_output_section): Likewise.
1890             (Dwp_output_file::add_contribution): Likewise.
1891             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1892             for empty slot.
1893             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1894             file format.
1895             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1896             slot.
1897             (Dwp_output_file::initialize): Remove unused function.
1898             (Dwp_output_file::finalize): Add support for v2 package file format.
1899             (Dwp_output_file::write_index): Likewise.
1900             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1901             function prototype.
1902
1903 2013-07-31  Cary Coutant  <ccoutant@google.com>
1904
1905         * object.cc (Sized_relobj::do_output_section_address): New function.
1906         (Sized_relobj): Instantiate explicitly.
1907         * object.h (Object::output_section_address): New function.
1908         (Object::do_output_section_address): New function.
1909         (Sized_relobj::do_output_section_address): New function.
1910         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1911
1912 2013-07-30  Cary Coutant  <ccoutant@google.com>
1913             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1914
1915         * parameters.cc (Parameters::entry): Return target-specific entry
1916         symbol name.
1917         * target.h (Target::entry_symbol_name): New function.
1918         (Target_info::entry_symbol_name): New data member.
1919
1920         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1921         * i386.cc (Target_i386::i386_info): Likewise.
1922         (Target_i386_nacl::i386_nacl_info): Likewise.
1923         * sparc.cc (Target_sparc::sparc_info): Likewise.
1924         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1925         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1926         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1927         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1928
1929 2013-07-22  Sterling Augustine  <saugustine@google.com>
1930
1931         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1932         Convert parameter shndx to local variable. Add parameters symtab
1933         and symtab_size.  Scan over section names.  Find relocation
1934         section corresponding to current section.  Create and initialize
1935         reloc_mapper_ and reloc_type_.
1936         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
1937         unit_length to off_t.  Initialize member unit_length_.  Fill in field
1938         cu_offset_.
1939         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1940         Initialize new fields unit_length_ and cu_offset_.
1941         (Dwarf_pubnames_table::read_section): Update prototype.
1942         (Dwarf_pubnames_table::cu_offset): New member function.
1943         (Dwarf_pubnames_table::subsection_size): Likewise.
1944         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
1945         New fields.
1946         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
1947         member functions public.
1948         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
1949         Update comment.  Rework logic.  Move repeated parts to...
1950         (Gdb_index_info_reader::read_pubtable): ...here. New function.
1951         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
1952         pubtypes_table_, and stmt_list_offset.
1953         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1954         Gdb_index::find_pubtype_offset,
1955         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
1956         (Gdb_index::pubnames_read): Update prototype and rework logic.
1957         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
1958         Forward declare.
1959         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1960         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
1961         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
1962         Gdb_index::map_pubtable_to_dies):
1963         Declare functions.
1964         (Gdb_index::pubnames_read): Update declaration.
1965         (Gdb_index::Pubname_offset_map): New type.
1966         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
1967         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
1968         Gdb_index::stmt_list_offset): Declare.
1969         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1970         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1971         Gdb_index::pubtypes_offset_): Remove.
1972
1973 2013-07-19  Roland McGrath  <mcgrathr@google.com>
1974
1975         * options.h (General_options): Add -Trodata-segment option.
1976         * parameters.cc (Parameters::check_rodata_segment): New function.
1977         (Parameters::set_target_once): Call it.
1978         * parameters.h (Parameters): Declare it (private member function).
1979         * layout.cc (load_seg_unusable_for_headers): New function, broken
1980         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
1981         then validate rodata segment rather than text segment.
1982         (relaxation_loop_body): Call that.
1983         (is_text_segment): New function.  Don't admit a non-executable
1984         segment if TARGET->isolate_execinstr().
1985         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
1986
1987 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
1988
1989         PR gold/15070
1990         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1991         * nacl.h (Sniff_file::View::View): Request aligned view.
1992
1993 2013-07-11  Cary Coutant  <ccoutant@google.com>
1994
1995         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1996         correct BRLT entry size.
1997
1998 2013-07-03  Alan Modra  <amodra@gmail.com>
1999
2000         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
2001         comment.
2002
2003 2013-07-01  Cary Coutant  <ccoutant@google.com>
2004
2005         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
2006         reloc_type_.
2007         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
2008         (Dwarf_ranges_table::lookup_reloc): New function.
2009         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
2010         reloc_type_.
2011         (Dwarf_ranges_table::lookup_reloc): New function.
2012         (Dwarf_ranges_table::reloc_type_): New data member.
2013
2014 2013-06-27  Jing Yu  <jingyu@google.com>
2015
2016         PR gold/15662
2017         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
2018         function.
2019         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
2020         (Target_powerpc::do_relax): Call the above.
2021
2022 2013-06-27  Cary Coutant  <ccoutant@google.com>
2023
2024         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
2025         on garbage collected .opd section.
2026
2027 2013-06-27  Alan Modra  <amodra@gmail.com>
2028
2029         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
2030         is non-zero.
2031         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
2032         (Target_powerpc::do_function_location): Likewise for loc->shndx.
2033
2034 2013-06-14  Cary Coutant  <ccoutant@google.com>
2035
2036         * resolve.cc (Symbol::override_base): Don't override st_type
2037         from plugin placeholder symbols.
2038         (Symbol_table::resolve): Likewise.
2039         (Symbol_table::should_override): Don't complain about TLS mismatch
2040         if the TO symbol is a plugin placeholder.
2041         * testsuite/Makefile.am (plugin_test_tls): New test.
2042         * testsuite/Makefile.in: Regenerate.
2043         * testsuite/plugin_test_tls.sh: New test script.
2044         * testsuite/two_file_test_2_tls.cc: New test source.
2045         * testsuite/two_file_test_tls.cc: New test source.
2046
2047 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2048
2049         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
2050         the maximum segment alignment is larger than the page size.
2051         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
2052         correctly aligns the symbols with large alignemnt.
2053         * testsuite/Makefile.in: Regenerate.
2054         * testsuite/large_symbol_alignment.cc: New file.
2055
2056 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2057             Sriraman Tallam  <tmsriram@google.com>
2058
2059         * options.h (sort_section): New option.
2060         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
2061         Rename from Input_section_sort_section_name_special_ordering_compare.
2062         (Input_section_sort_section_name_compare): New struct.
2063         * output.cc (Output_section::Input_section_sort_section_name_compare::
2064         operator()): New function.
2065         (Output_section::sort_attached_input_sections): Use new sort function
2066         for .text if --sort-section=name is specified.
2067         * layout.cc (Layout::make_output_section):
2068         Add sorting by name when --sort-section=name is specified.
2069         * testsuite/Makefile.am (text_section_grouping): Test option
2070         --sort-section=name.
2071         * testsuite/Makefile.in: Regenerate.
2072         * testsuite/section_sorting_name.cc: New file.
2073         * testsuite/section_sorting_name.sh: New file.
2074
2075 2013-05-21  Cary Coutant  <ccoutant@google.com>
2076
2077         * symtab.h (Symbol::is_cxx_vtable): New function.
2078         * target-reloc.h (relocate_section): Check for vtable symbol.
2079         * testsuite/Makefile.am (missing_key_func.sh): New test case.
2080         * testsuite/Makefile.in: Regenerate.
2081         * testsuite/missing_key_func.cc: New test source.
2082         * testsuite/missing_key_func.sh: New test script.
2083
2084 2013-05-21  Cary Coutant  <ccoutant@google.com>
2085
2086         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
2087         type of enclosing symbol.
2088         (Relocate_info::location): Check symbol type when describing symbol.
2089         * object.h (Symbol_location_info): Remove unused line_number;
2090         add enclosing_symbol_type.
2091         * testsuite/debug_msg.sh: Adjust expected output.
2092
2093 2013-05-13  Cary Coutant  <ccoutant@google.com>
2094
2095         * configure.ac: Export DEFAULT_TARGET.
2096         * configure: Regenerate.
2097         * Makefile.in: Regenerate.
2098         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
2099         * testsuite/Makefile.in: Regenerate.
2100         * testsuite/debug_msg.sh: Delete duplicate tests.
2101         Don't check undef_int error message match for powerpc where the
2102         source file and line number aren't available.
2103
2104 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2105
2106         * options.h (General_options): Add --rosegment-gap option.
2107         * options.cc (finalize): --rosegment-gap implies --rosegment.
2108         * layout.cc (set_segment_offsets): Let user option override
2109         target->rosegment_gap().
2110
2111 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2112
2113         * options.h (General_options): Remove leading space from help
2114         messages for -nostdlib and --rosegment.
2115
2116 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
2117
2118         PR ld/15365
2119         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
2120
2121 2013-05-03  Alan Modra  <amodra@gmail.com>
2122
2123         * merge.cc (Output_merge_string::do_add_input_section): Correct
2124         scan for number of strings.  Rename vars to avoid shadowing.
2125         Include missing terminator in input_size_.
2126
2127 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
2128
2129         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
2130         Restore empty string handling.
2131
2132 2013-05-01  Cary Coutant  <ccoutant@google.com>
2133
2134         * stringpool.cc (Stringpool_template::new_key_offset): Fix
2135         uninitialized warning.
2136
2137 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2138
2139         * output.cc (Output_section::add_merge_input_section): Allow
2140         to merge sections if the alignment is more than character size.
2141         * merge.h (Output_merge_string::Output_merge_string): Remove
2142         assert.
2143         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
2144         only not-null strings. Check the alignment of strings.
2145         * stringpool.h
2146         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
2147         alignment as the argument.
2148         (Stringpool_template<Stringpool_char>::addralign_): New class member.
2149         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
2150         Align non-zero length strings according to the addralign_.
2151         (Stringpool_template<Stringpool_char>::set_string_offsets):
2152         Updating offsets according to the given alignment.
2153         * testsuite/Makefile.am (text_section_grouping): Test if string
2154         literals are getting merged.
2155         * testsuite/Makefile.in: Regenerate.
2156         * testsuite/merge_string_literals_1.c: New file.
2157         * testsuite/merge_string_literals_2.c: Ditto.
2158         * testsuite/merge_string_literals.sh: Ditto.
2159
2160 2013-04-26  Ian Lance Taylor  <iant@google.com>
2161
2162         * target-reloc.h (relocate_section): If the reloc offset is out of
2163         range, pass VIEW as NULL to relocate.relocate.
2164         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
2165         * i386.cc (Target_i386::Relocate::relocate): Likewise.
2166         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
2167         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
2168         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
2169         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2170
2171 2013-04-26  Geoff Pike  <gpike@chromium.org>
2172
2173         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
2174         * layout.cc (Hash_task): New class.
2175         (Layout::queue_build_id_tasks): New function.
2176         (Layout::write_build_id): Handle single-thread portion of build ID
2177         computation.  (In some cases, all of it is single-threaded.)  Replace
2178         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
2179         functionality in fewer lines of code.
2180         * layout.h (Layout::queue_build_id_tasks): New function declaration.
2181         * options.h (General_options): make "--build-id" default to tree
2182         rather than sha1.  Add two new options related to --build-id=tree:
2183         --build-id-chunk-size-for-treehash and
2184         --build-id-min-file-size-for-treehash.
2185         * Makefile.am: add testing of --build-id=tree and related new options
2186         (these tests will be invoked by "make check").
2187         * Makefile.in: Regenerate.
2188
2189 2013-04-25  Alan Modra  <amodra@gmail.com>
2190
2191         * configure.tgt: Add powerpcle and powerpc64le.
2192
2193 2013-04-22  Alan Modra  <amodra@gmail.com>
2194
2195         PR gold/15355
2196         * layout.cc (Layout::segment_precedes): Allow more than one
2197         segment with the same type and flags.
2198
2199 2013-04-15  Cary Coutant  <ccoutant@google.com>
2200
2201         * layout.cc (Layout::set_relocatable_section_offsets): Don't
2202         allocate space in file for BSS sections.
2203
2204 2013-04-15  Cary Coutant  <ccoutant@google.com>
2205
2206         * script-sections.cc (Orphan_output_section): Reset address
2207         to zero after each orphaned section for relocatable links.
2208
2209 2013-04-15  Cary Coutant  <ccoutant@google.com>
2210
2211         * symtab.cc (Symbol_table::sized_write_globals): Subtract
2212         section starting address for relocatable link.
2213         * testsuite/Makefile.am (script_test_11): New test.
2214         * testsuite/Makefile.in: Regenerate.
2215         * testsuite/script_test_11.c: New source file.
2216         * testsuite/script_test_11.t: New linker script.
2217
2218 2013-04-13  Alan Modra  <amodra@gmail.com>
2219
2220         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
2221         owner when sections are not adjacent and exceed group size.
2222         (Target_powerpc::group_sections): Handle corner case.
2223         (Target_powerpc::Branch_info::make_stub): Handle case where
2224         stub table doesn't exist due to branches in non-exec sections.
2225         (Target_powerpc::Relocate::relocate): Likewise.
2226
2227 2013-04-11  Alan Modra  <amodra@gmail.com>
2228
2229         PR gold/15354
2230         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
2231         .branch_lt to match bfd ld.  Adjust comments throughout file.
2232
2233 2013-04-04  Ian Lance Taylor  <iant@google.com>
2234
2235         GCC PR c++/56840
2236         * object.cc (do_layout_deferred_sections): Handle .eh_frame
2237         sections before checking whether they are included in the link.
2238
2239 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
2240
2241         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
2242         object before calling the plugin claim_file handler.  Pass the elf
2243         object of the archive to the plugin. Delete the elf object if the
2244         plugin claims the file.
2245
2246 2013-03-21  Alan Modra  <amodra@gmail.com>
2247
2248         * layout.cc (Layout::set_segment_offsets): Accept writable .text
2249         segment when omagic.
2250
2251 2013-03-21  Alan Modra  <amodra@gmail.com>
2252
2253         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
2254         comparison warning.
2255         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
2256         uninitialized" warning.
2257
2258 2013-03-20  Alan Modra  <amodra@gmail.com>
2259
2260         * symtab.h (Symbol::clear_version): New function.
2261         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
2262         is_needed by weak references.  Clear version for symbols defined
2263         in as-needed objects that are not needed.
2264
2265 2013-03-15  Alan Modra  <amodra@gmail.com>
2266
2267         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
2268         static and public.  Add report_err param.  Return false for data refs.
2269         (Target_powerpc::rela_dyn_section): New overloaded function.
2270         (Target_powerpc::plt_, iplt_): Elucidate.
2271         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
2272         (Output_data_plt_powerpc::do_write): Don't write .iplt.
2273         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
2274         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
2275         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
2276         push_branch and make_plt_entry for ifunc syms when
2277         reloc_needs_plt_for_ifunc.
2278         (Target_powerpc::Relocate::relocate): Don't use plt entry value
2279         for ifunc unless reloc_needs_plt_for_ifunc.
2280
2281 2013-03-15  Alan Modra  <amodra@gmail.com>
2282
2283         * gc.h (gc_process_relocs): Don't look through function descriptors.
2284         * icf.cc (get_section_contents): Do so here instead.
2285
2286 2013-03-13  Alan Modra  <amodra@gmail.com>
2287
2288         * powerpc.cc (is_branch_reloc): Forward declare.
2289         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
2290         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
2291         false for 64-bit, true for 32-bit non-branch relocs.
2292         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
2293         * testsuite/Makefile.am (icf_test): Use linker map file instead of
2294         nm output.
2295         (icf_safe_test): Generate linker map file as well as nm output.
2296         (icf_safe_so_test): Likewise.
2297         * testsuite/Makefile.in: Regenerate.
2298         * testsuite/icf_test.sh: Parse linker map file to determine
2299         section folding.
2300         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
2301         * testsuite/icf_safe_so_test.sh: Likewise.
2302         (X86_32_or_ARM_specific_safe_fold): Merge into..
2303         (arch_specific_safe_fold): ..this.
2304         (X86_64_specific_safe_fold): Delete unused function.
2305
2306 2013-03-12  Alan Modra  <amodra@gmail.com>
2307
2308         * gc.h (gc_process_relocs): Look through function descriptors
2309         to determine shndx, symvalue and addend used by ICF.  Tidy
2310         variable duplication.
2311
2312 2013-03-11  Alan Modra  <amodra@gmail.com>
2313
2314         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
2315         * layout.cc (Layout_task_runner::run): ..to here.
2316         * symtab.h (struct Symbol_location): Extract from..
2317         (class Symbol_table): ..here.
2318         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
2319         * target.h (class Target): Add function_location and
2320         do_function_location functions.
2321         (class Sized_target): Add do_function_location.
2322         * object.h (class Sized_relobj_file): Move find_shdr..
2323         (class Object): ..to here.
2324         * object.cc: Likewise.  Update to suit.  Instantiate.
2325         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
2326         * powerpc.cc (class Powerpc_dynobj): New.
2327         (Target_powerpc::do_function_location): New function.
2328         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
2329         (Powerpc_dynobj::do_read_symbols): New function.
2330         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
2331
2332 2013-03-08  Ian Lance Taylor  <iant@google.com>
2333
2334         * options.cc (General_options::string_to_object_format): Accept
2335         "default".
2336
2337 2013-03-08  Alan Modra  <amodra@gmail.com>
2338
2339         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
2340         pointer to Post_fde.
2341         (struct Post_fde): Move definition to here..
2342         * ehframe.cc (struct Post_fde): ..from here.
2343         (Cie::write): Don't alloc Post_fde.
2344         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
2345
2346 2013-03-07  Alan Modra  <amodra@gmail.com>
2347
2348         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
2349         relocation referencing .LC0.
2350         * testsuite/discard_locals_test.sh: Remove FIXMEs.
2351
2352 2013-03-07  Alan Modra  <amodra@gmail.com>
2353
2354         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
2355         always_inline.  Add assembly for powerpc to avoid GOT.
2356
2357 2013-03-07  Alan Modra  <amodra@gmail.com>
2358
2359         * testsuite/script_test_10.sh: Don't test .bss section
2360         header number.
2361
2362 2013-03-06  Alan Modra  <amodra@gmail.com>
2363
2364         * powerpc.cc (class Powerpc_relobj): Move some member functions.
2365         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
2366         all callers.  Handle folded sections.
2367         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
2368         to Powerpc_relobj.
2369         (Global_symbol_visitor_opd::operator()): Likewise.
2370
2371 2013-03-04  Alan Modra  <amodra@gmail.com>
2372
2373         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
2374         * testsuite/Makefile.in: Regenerate.
2375
2376 2013-03-01  Cary Coutant  <ccoutant@google.com>
2377
2378         Add dwp support for v2 DWARF package file format.
2379         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2380         tu_length parameter.  Adjust all callers.
2381         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2382         * dwp.cc: Include dwarf.h.
2383         (Section_bounds): New struct type.
2384         (Unit_set): New struct type.
2385         (Dwo_file::Dwo_file): Initialize new data member.
2386         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2387         Combine and rename to...
2388         (Dwo_file::read_unit_index): ...this.
2389         (Dwo_file::sized_read_compunit_index)
2390         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2391         (Dwo_file::sized_read_unit_index): ...this.
2392         (Dwo_file::copy_section): Remove section_name, is_str_offsets
2393         parameters; add section_id parameter.
2394         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2395         (Dwo_file::add_unit_set): ...this.
2396         (Dwo_file::shndx_map_): Remove.
2397         (Dwo_file::sect_offsets_): New data member.
2398         (Dwp_output_file::Dwp_output_file): Initialize new data members.
2399         (Dwp_output_file::add_section): Rename to...
2400         (Dwp_output_file::add_contribution): ...this.
2401         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2402         (Dwp_output_file::add_tu_set): Likewise.
2403         (Dwp_output_file::Contribution): New type.
2404         (Dwp_output_file::Section::contributions): New data member.
2405         (Dwp_output_file::Cu_or_tu_set): Remove.
2406         (Dwp_output_file::Section::Section): New ctor.
2407         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2408         (Dwp_output_file::Dwp_index::Section_table): New type.
2409         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2410         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2411         parameter.
2412         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2413         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2414         (Dwp_output_file::Dwp_index::section_table): New member function.
2415         (Dwp_output_file::Dwp_index::section_table_end): New member function.
2416         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2417         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2418         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2419         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2420         (Dwp_output_file::Dwp_index::section_table_): New data member.
2421         (Dwp_output_file::Dwp_index::section_mask_): New data member.
2422         (Dwp_output_file::add_output_section): New member function.
2423         (Dwp_output_file::write_new_section): New member function.
2424         (Dwp_output_file::write_contributions): New member function.
2425         (Dwp_output_file::section_id_map_): New data member.
2426         (class Dwo_id_info_reader): Remove.
2427         (class Unit_reader): New class.
2428         (get_dwarf_section_name): New function.
2429         (Dwo_file::read_executable): Adjust initializations of class data.
2430         (Dwo_file::read): Add support for v2 package file format.
2431         (Dwo_file::read_unit_index): Likewise.
2432         (Dwo_file::sized_read_unit_index): Likewise.
2433         (Dwo_file::copy_section): Likewise.
2434         (Dwo_file::add_unit_set): Likewise.
2435         (Dwp_output_file::add_output_section): Likewise.
2436         (Dwp_output_file::add_contribution): Likewise.
2437         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2438         for empty slot.
2439         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2440         file format.
2441         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2442         slot.
2443         (Dwp_output_file::initialize): Remove unused function.
2444         (Dwp_output_file::finalize): Add support for v2 package file format.
2445         (Dwp_output_file::write_index): Likewise.
2446         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2447         function prototype.
2448
2449 2013-03-01  Cary Coutant  <ccoutant@google.com>
2450
2451         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
2452         function into class definition in header file.
2453         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
2454         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
2455         New function.
2456         (Dwarf_info_reader::check_buffer): Move here from .cc file.
2457
2458 2013-02-28  Alan Modra  <amodra@gmail.com>
2459
2460         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
2461         * target.cc (Target::do_plt_fde_location): New function.
2462         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
2463         accessor function, and constructor param.
2464         (struct Post_fde, Post_fdes): Declare.
2465         (Cie::write): Add post_fdes param.
2466         * ehframe.cc (Fde::write): Use plt_fde_location.
2467         (struct Post_fde): Define.
2468         (Cie::write): Stash FDEs added post merge mapping.
2469         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
2470         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
2471         (Eh_frame::do_sized_write): Arrange to write post map FDES after
2472         other FDEs.
2473         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
2474         (Target_powerpc::has_glink): New function.
2475         (Target_powerpc::do_relax): Add eh_frame info for stubs.
2476         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
2477         glink_eh_frame_fde_32, default_fde): New data.
2478         (Stub_table::eh_frame_added_): New var.
2479         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
2480         Make const.
2481         (Stub_table::add_eh_frame): New function.
2482         (Output_data_glink::add_eh_frame): New function.
2483         (Target_powerpc::make_glink_section): Call add_eh_frame.
2484
2485 2013-02-15  Ian Lance Taylor  <iant@google.com>
2486
2487         * options.h (DEFINE_uint64_alias): Define.
2488         (class General_options): Add -Ttext-segment as an alias for
2489         -Ttext.
2490
2491 2013-02-15  Alan Modra  <amodra@gmail.com>
2492
2493         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
2494         (Stub_table::do_write): ..here, two places.
2495         (Stub_table::plt_call_size): Use it here too.
2496
2497 2013-02-11  Ian Lance Taylor  <iant@google.com>
2498
2499         * descriptors.cc (Descriptors::close_all): New function.
2500         * descriptors.h (class Descriptors): Declare close_all.
2501         (close_all_descriptors): New inline function.
2502         * plugin.cc: Include "descriptors.h".
2503         (Plugin_manager::cleanup): Call close_all_descriptors.
2504
2505 2013-02-06  Alan Modra  <amodra@gmail.com>
2506
2507         * README: Update coding style link.
2508
2509 2013-01-28  Cary Coutant  <ccoutant@google.com>
2510
2511         * dwp.cc (File_list): New typedef.
2512         (Dwo_name_info_reader): New class.
2513         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
2514         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
2515         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
2516         (Dwo_file::read_executable): New function.
2517         (Dwo_file::read): Move common setup code to ...
2518         (Dwo_file::make_object): ... here.
2519         (dwp_options): Add --exec/-e.
2520         (usage): Likewise.
2521         (main): Likewise.
2522
2523 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
2524
2525         * layout.cc (Layout::layout): Check for option text_reorder.
2526         (Layout::make_output_section): Ditto.
2527         * options.h (text_reorder): New option.
2528         * output.cc (Input_section_sort_compare): Remove special ordering
2529         of section names.
2530         (Output_section::
2531          Input_section_sort_section_name_special_ordering_compare::
2532          operator()): New function.
2533         (Output_section::sort_attached_input_sections): Use new sort function
2534         for .text.
2535         * output.h (Input_section_sort_section_name_special_ordering_compare):
2536         New struct.
2537         * testsuite/Makefile.am (text_section_grouping): Test option
2538         --no-text-reorder
2539         * testsuite/Makefile.in: Regenerate.
2540         * testsuite/text_section_grouping.sh: Check order of functions without
2541         default text reordering.
2542
2543 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
2544
2545         * options.h (General_options): Change default to true for new_dtags.
2546
2547 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
2548
2549         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
2550         when enable_new_dtags is false.  Only add DT_RUNPATH when
2551         enable_new_dtags is true.
2552
2553 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
2554
2555         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
2556         used in declaration and definition consistent.
2557         (Target_powerpc::symval_for_branch): Ditto.
2558
2559 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
2560
2561         * testsuite/plugin_final_layout.cc: Fix comment.
2562
2563 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
2564
2565         * layout.cc (Layout::layout): Do not do default sorting for
2566         text sections when section ordering is specified.
2567         (make_output_section): Ditto.
2568         * testsuite/plugin_final_layout.cc: Name the function sections
2569         to catch reordering issues.
2570
2571 2013-01-15  Alan Modra  <amodra@gmail.com>
2572
2573         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
2574         plt-thread-safe.
2575
2576 2013-01-15  Alan Modra  <amodra@gmail.com>
2577
2578         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
2579         * testsuite/Makefile.in: Regenerate.
2580
2581 2013-01-14  Alan Modra  <amodra@gmail.com>
2582
2583         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
2584         * testsuite/Makefile.in: Regenerate.
2585
2586 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
2587
2588         PR bfd/14430
2589         Fix mingw gold build with plugins enabled
2590         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
2591         * configure.ac: Export DLOPEN_LIBS and add headers check.
2592         * plugin.cc: Handle non-dlfcn case.
2593         * Makefile.in: Regenerate.
2594         * config.in: Regenerate.
2595         * configure: Regenerate.
2596         * testsuite/Makefile.in: Regenerate.
2597
2598 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
2599
2600         * output.h (sort_attached_input_sections): Change to be public.
2601         * script-sections.cc
2602         (Output_section_definition::set_section_addresses): Sort
2603         attached input sections according to section order before linker
2604         script assigns section addresses.
2605         (Orphan_output_section::set_section_addresses): Sort
2606         attached input sections according to section order before linker
2607         script assigns section addresses.
2608         * Makefile.am (final_layout.sh): Use a simple linker script to
2609         check if section ordering still works.
2610         * Makefile.in: Regenerate.
2611
2612 2013-01-09  Ben Cheng  <bccheng@google.com>
2613
2614         * arm.cc (Target_arm::attributes_accept_div): New function.
2615         (Target_arm::attributes_forbid_div): New function.
2616         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
2617         attribute using the same new functions as what bfd/elf32_arm.c
2618         does.
2619
2620 2013-01-07  Cary Coutant  <ccoutant@google.com>
2621
2622         PR gold/14993
2623         * output.cc (Output_section::add_input_section): For incremental
2624         updates, don't track input sections that are allocated from patch
2625         space.
2626
2627 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
2628             Ian Lance Taylor  <iant@google.com>
2629
2630         PR gold/14897
2631         * configure.ac (--enable-ld): Removed.
2632         (install_as_default): Set to yes only for --enable-gold=default
2633         or --disable-ld.
2634         * configure: Regenerated.
2635
2636 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
2637
2638         * options.h (General_options): Add -fuse-ld= for GCC linker
2639         option compatibility.
2640
2641 2013-01-04  Cary Coutant  <ccoutant@google.com>
2642
2643         * configure.ac: Fix typo restoring CXXFLAGS.
2644         * configure: Regenerate.
2645
2646 2013-01-04  Cary Coutant  <ccoutant@google.com>
2647
2648         * testsuite/Makefile.am (CXXLINK_S): New macro.
2649         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
2650         * testsuite/Makefile.in: Regenerate.
2651
2652 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
2653
2654         * version.cc (print_version): Update copyright year to 2013.
2655
2656 2012-12-20  Ian Lance Taylor  <iant@google.com>
2657
2658         * layout.cc (Layout::special_ordering_of_input_section): New
2659         function.
2660         (Layout::layout): If input section requires special ordering, must
2661         sort input sections.
2662         (Layout::make_output_section): May sort .text input sections.
2663         (Layout::is_section_name_prefix_grouped): Remove.
2664         * layout.h (class Layout): Declare
2665         special_ordering_of_input_section.  Don't declare
2666         is_section_name_prefix_grouped.
2667         * output.cc (Output_section::add_input_section): Revert last
2668         change.
2669         (Output_section::Input_section_sort::match_file_name): Don't crash
2670         if called on output section data.
2671         (Output_section::Input_section_sort_compare): Sort based on
2672         special ordering.
2673         (Output_section::Input_section_sort_section_order_index_compare):
2674         Revert last patch.
2675         (Output_section::sort_attached_input_sections): Likewise.
2676
2677 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
2678
2679         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
2680         * layout.h (Layout::is_section_name_prefix_grouped): New function.
2681         * output.cc (Output_section::add_input_section): Check if section
2682         name contains special prefix.  Keep input sections to sort such
2683         sections.
2684         (Output_section::Input_section_sort_section_order_index_compare
2685          ::operator()): Group sections according to prefixes.
2686         (Output_section::sort_attached_input_sections): Add condition to
2687         Input_section_entry constructor call.
2688         * testsuite/Makefile.am (text_section_grouping): New test.
2689         * testsuite/Makefile.in: Regenerate.
2690         * testsuite/text_section_grouping.cc: New file.
2691         * testsuite/text_section_grouping.sh: New file.
2692
2693 2012-12-17  Nick Clifton  <nickc@redhat.com>
2694
2695         * Makefile.am: Add copyright notice.
2696         * NEWS: Likewise.
2697         * README: Likewise.
2698         * configure.ac: Likewise.
2699         * ftruncate.c: Likewise.
2700         * Makefile.in: Regenerate.
2701
2702 2012-12-14  Cary Coutant  <ccoutant@google.com>
2703
2704         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
2705         --no-as-needed flag.
2706         (exception_separate_shared_12_test): Likewise.
2707         (incremental_copy_test): Likewise.
2708         * testsuite/Makefile.in: Regenerate.
2709
2710 2012-12-14  Cary Coutant  <ccoutant@google.com>
2711
2712         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
2713         (Dwp_output_file::Dwp_index::enter_set): Add assert.
2714
2715 2012-12-12  Alan Modra  <amodra@gmail.com>
2716
2717         * powerpc.cc (class Track_tls): New.
2718         (class Relocate, class Scan): Inherit Track_tls.
2719         (Target_powerpc::Scan::local, global): Track tls optimization
2720         and avoid creating plt entry for __tls_get_addr if all uses
2721         are optimized away.
2722         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
2723
2724 2012-12-12  Alan Modra  <amodra@gmail.com>
2725
2726         * options.h (General_options): Add --toc-sort/--no-toc-sort.
2727         Replace no_toc_optimize with toc_optimize.
2728         * output.h (Output_section::input_sections): Provide non-const variant.
2729         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
2730         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
2731         accessors.
2732         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
2733         (class Sort_toc_sections): New.
2734         (Target_powerpc::do_finalize_sections): Sort toc sections.
2735         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
2736
2737 2012-12-10  Roland McGrath  <mcgrathr@google.com>
2738
2739         * testsuite/binary_unittest.cc (read_all): New function.
2740         (Sized_binary_test): Use it instead of ::read.
2741         * fileread.cc (do_read): Don't assume pread always reads the whole
2742         amount in a single call.
2743
2744 2012-12-10  Alan Modra  <amodra@gmail.com>
2745
2746         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
2747         Set EM_PPC64 or EM_PPC here.
2748         (Target_selector_powerpc::do_recognize): Delete.
2749
2750 2012-12-10  Alan Modra  <amodra@gmail.com>
2751
2752         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
2753         stub_table_.
2754         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
2755
2756 2012-12-07  Roland McGrath  <mcgrathr@google.com>
2757
2758         * testsuite/binary_unittest.cc (Sized_binary_test):
2759         Use open_descriptor rather than ::open.
2760
2761 2012-12-07  Alan Modra  <amodra@gmail.com>
2762
2763         * powerpc.cc (Stub_table::do_write): Delete redundant Address
2764         typedef and invalid_address constant.
2765         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2766         instantiate constants.
2767
2768 2012-12-06  Roland McGrath  <mcgrathr@google.com>
2769
2770         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2771         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2772         * aclocal.m4: Regenerate.
2773         * configure: Regenerate.
2774         * Makefile.in: Regenerate.
2775         * testsuite/Makefile.in: Regenerate.
2776
2777 2012-12-07  Alan Modra  <amodra@gmail.com>
2778
2779         * options.h (General_options): Add no_toc_optimize.
2780         * powerpc.cc (ok_lo_toc_insn): New function.
2781         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2782
2783 2012-12-06  Alan Modra  <amodra@gmail.com>
2784
2785         * options.h (General_options): Add plt_align, plt_static_chain,
2786         plt_thread_safe.  Update stub_group_size help text.
2787         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2788         for new plt_thread_safe_ var.
2789         (use_plt_offset): Correct comments.
2790         (Target_powerpc::do_relax): Look for thread creation symbols to
2791         determine default plt_thread_safe value.  Clear plt call stubs
2792         as well as branch stubs each iteration.
2793         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2794         insn constants.
2795         (l, hi, ha, write_insn): Move earlier.
2796         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2797         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2798         plt stubs too.
2799         (Stub_table::update_size): Adjust.
2800         (Stub_table::prev_size, set_prev_size): Delete.
2801         (Stub_table::stub_align): Let --plt-align affect result.
2802         (Stub_table::plt_call_size): Calculate sizes for various stubs.
2803         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2804         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2805         (Stub_table::do_write): Support more stub variants.
2806
2807 2012-12-04  Alan Modra  <amodra@gmail.com>
2808
2809         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2810         (Target_powerpc::do_define_standard_symbols): New function.
2811
2812 2012-12-03  Alan Modra  <amodra@gmail.com>
2813
2814         * output.h: Formatting, whitespace.
2815
2816 2012-12-03  Alan Modra  <amodra@gmail.com>
2817
2818         * layout.h (Layout::get_executable_sections): Declare.
2819         * layout.cc (Layout::get_executable_sections): New function.
2820         * arm.cc (Target_arm::group_sections): Use it.
2821         (Arm_output_section::group_sections): Delete now redundant test.
2822         * output.cc (Output_reloc::Output_reloc): Add is_relative.
2823         param to handle relative relocs.
2824         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2825         (Output_data_reloc::add_absolute): Adjust.
2826         (Output_data_reloc::add_relative): New function.
2827         (Output_data::reset_data_size): New function.
2828         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2829         (Output_section::set_addralign): New function.
2830         (Output_section::checkpoint_set_addralign): New function.
2831         (Output_section::clear_section_offsets_need_adjustment): New function.
2832         (Output_section::input_sections): Make public.
2833         * powerpc.cc (class Output_data_brlt_powerpc): New.
2834         (class Stub_table, class Stub_control): New.
2835         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
2836         stub_table_, set_stub_table, stub_table): New vectors and accessor
2837         functions.
2838         (Target_powerpc::do_may_relax, do_relax, push_branch,
2839         new_stub_table, stub_tables, brlt_section, group_sections,
2840         add_branch_lookup_table, find_branch_lookup_table,
2841         write_branch_lookup_table, make_brlt_section): New functions.
2842         (Target_powerpc::struct Sort_sections, class Branch_info): New.
2843         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
2844         branch_info_): New vars.
2845         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
2846         make call stubs here.
2847         (Output_data_glink): Remove all call stub handling from this class.
2848         (Target_powerpc::Scan::local, global): Save interesting branch
2849         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
2850         (Target_powerpc::do_finalize_sections): Only make reg save/restore
2851         functions on final link.
2852         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
2853         Handle long branch destinations too.
2854         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
2855         do_plt_address_for_local): Adjust lookup of plt call stubs.
2856
2857 2012-11-30  Alan Modra  <amodra@gmail.com>
2858
2859         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
2860         relocs against protected symbols when building 32-bit shared libs.
2861
2862 2012-11-30  Alan Modra  <amodra@gmail.com>
2863
2864         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
2865         param.  Call got_section() to make .got.  Update all callers
2866         and their callers and so on.
2867
2868 2012-11-30  Alan Modra  <amodra@gmail.com>
2869
2870         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
2871         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
2872         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
2873         value if it already exists.
2874
2875 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
2876
2877         PR gold/14858
2878         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
2879
2880 2012-11-14  Roland McGrath  <mcgrathr@google.com>
2881
2882         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
2883         than bfc instruction for data sandboxing.
2884
2885 2012-11-08  Alan Modra  <amodra@gmail.com>
2886
2887         * po/POTFILES.in: Regenerate.
2888
2889 2012-11-05  Alan Modra  <amodra@gmail.com>
2890
2891         * configure.ac: Apply 2012-09-10 change to config.in here.
2892         * configure: Regenerate.
2893
2894 2012-11-05  Alan Modra  <amodra@gmail.com>
2895
2896         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
2897         (struct Opd_ent): Use "Address" rather than "Offset".
2898         (Output_data_got_powerpc::got_base_offset): Return Valtype.
2899         (Target_powerpc::got_section): Make public.
2900         (Target_powerpc::scan_relocs): Move code setting symbols..
2901         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
2902         Create _SDA_BASE_ only when referenced.
2903
2904 2012-11-02  Roland McGrath  <mcgrathr@google.com>
2905
2906         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
2907         from last change.
2908
2909 2012-11-01  Roland McGrath  <mcgrathr@google.com>
2910
2911         * target.h (Sized_target::relocate_relocs): Use Elf_Off
2912         for offset_in_output_section parameter.
2913         (Sized_target::relocate_special_relocatable): Likewise.
2914         * arm.cc (Target_arm::relocate_relocs): Likewise.
2915         (Target_arm::relocate_special_relocatable): Likewise.
2916         * i386.cc (Target_i386::relocate_relocs): Likewise.
2917         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2918         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2919         * target-reloc.h (relocate_relocs): Likewise.
2920         * testsuite/testfile.cc (Target_test): Likewise.
2921         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2922         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2923
2924         * system.h: Move inclusion of <clocale> to after <libintl.h> in
2925         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2926
2927         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2928         parameter, which is unused in the [!F_SETFD] case.
2929
2930         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2931         SYMNDX to off_t before comparing it to this->data_size().
2932         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2933         * incremental.cc (Output_section_incremental_inputs::do_write):
2934         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2935
2936         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2937
2938 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
2939
2940         * gold.cc (Target_arm::do_adjust_elf_header): Add the
2941         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2942         in EABI_VER5.
2943
2944 2012-10-29  Cary Coutant  <ccoutant@google.com>
2945
2946         * dwp.cc (usage): Add file and exit status parameters;
2947         add --help and --version options.
2948         (print_version): New function.
2949         (main): Add --help and --version options.
2950
2951 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2952
2953         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
2954         final_layout_sequence.txt.
2955         * testsuite/Makefile.in: Regenerated.
2956
2957 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2958
2959         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
2960         COMPILE generated by automake.
2961         (LINK1): Likewise.
2962         (CXXCOMPILE1): Likewise.
2963         (CXXLINK1): Likewise.
2964         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
2965         (LINK): Likewise.
2966         (CXXCOMPILE): Likewise.
2967         (CXXLINK): Likewise.
2968         * testsuite/Makefile.in: Regenerated.
2969
2970 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2971
2972         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2973         on bad fwrite return.
2974
2975 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2976
2977         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2978         on val.
2979
2980 2012-10-23  Cary Coutant  <ccoutant@google.com>
2981
2982         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2983         * testsuite/Makefile.in: Regenerate.
2984         * testsuite/dwp_test.h: New source file.
2985         * testsuite/dwp_test_1.cc: New source file.
2986         * testsuite/dwp_test_1.s: New source file.
2987         * testsuite/dwp_test_1.sh: New source file.
2988         * testsuite/dwp_test_1b.cc: New source file.
2989         * testsuite/dwp_test_1b.s: New source file.
2990         * testsuite/dwp_test_2.cc: New source file.
2991         * testsuite/dwp_test_2.s: New source file.
2992         * testsuite/dwp_test_2.sh: New source file.
2993         * testsuite/dwp_test_main.cc: New source file.
2994         * testsuite/dwp_test_main.s: New source file.
2995
2996 2012-10-23  Cary Coutant  <ccoutant@google.com>
2997
2998         * dwp.h: New header file.
2999         * dwp.cc: New source file.
3000         * gold.h: Move shared declarations to system.h.
3001         * system.h: New header file.
3002         * Makefile.am: Add dwp.
3003         * Makefile.in: Regenerate.
3004
3005 2012-10-23  Cary Coutant  <ccoutant@google.com>
3006
3007         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
3008         Dwarf_info_reader::read_from_pointer.
3009         (Dwarf_pubnames_table::read_header): Likewise.
3010         (Dwarf_pubnames_table::next_name): Likewise.
3011         (Dwarf_die::read_attributes): Likewise.
3012         (Dwarf_die::skip_attributes): Likewise.
3013         (Dwarf_info_reader::read_from_pointer): New function template.
3014         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
3015         (Dwarf_pubnames_table): Likewise.
3016         (Dwarf_info_reader::read_from_pointer): New function template.
3017         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
3018         Dwarf_pubnames_table ctor.
3019
3020 2012-10-23  Cary Coutant  <ccoutant@google.com>
3021
3022         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
3023         abbrev_shndx.
3024         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
3025         abbrev_shndx_.
3026         (Dwarf_info_reader::set_abbrev_shndx): New method.
3027         (Dwarf_info_reader::abbrev_shndx_): New data member.
3028
3029 2012-10-23  Cary Coutant  <ccoutant@google.com>
3030
3031         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
3032         from object, not parameters.
3033         (Dwarf_info_reader::parse): Likewise.
3034         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
3035         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
3036         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
3037         methods.
3038
3039 2012-10-23  Cary Coutant  <ccoutant@google.com>
3040
3041         * fileread.cc (Input_file::Input_file): New constructor.
3042         * fileread.h (class Input_file): Add new constructor.
3043
3044 2012-10-18  Alan Modra  <amodra@gmail.com>
3045
3046         PR gold/14727
3047         * object.cc (Relobj::is_section_name_included): Also match
3048         .sdata personality section.
3049
3050 2012-10-18  Alan Modra  <amodra@gmail.com>
3051
3052         * target-reloc.h (class Default_comdat_behavior): New, package up..
3053         (get_comdat_behaviour): ..this.
3054         (relocate_section): Add Relocate_comdat_behavior template arg,
3055         adjust code to suit.
3056         * arm.cc (Target_arm::relocate_section): Adjust to suit.
3057         (Target_arm::scan_reloc_section): Likewise.
3058         * i386.cc (Target_i386::relocate_section): Likewise.
3059         * sparc.cc (Target_sparc::relocate_section): Likewise.
3060         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
3061         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
3062         * powerpc.cc (class Relocate_comdat_behavior): New.
3063         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
3064         gold::relocate_section with new template arg.
3065
3066 2012-10-18  Alan Modra  <amodra@gmail.com>
3067
3068         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
3069         dynamic relocs for GOT_TPREL got entries, without symbol if
3070         resolving locally.
3071         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
3072         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
3073         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
3074
3075 2012-10-17  Alan Modra  <amodra@gmail.com>
3076
3077         PR gold/14726
3078         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
3079
3080 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
3081
3082         * layout.cc (Layout::include_section): Keep sections marked
3083         SHF_EXCLUDE when doing relocatable links.
3084
3085 2012-10-16  Alan Modra  <amodra@gmail.com>
3086
3087         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
3088         (Target_powerpc::do_finalize_sections): Call it.
3089         (Output_data_save_res): New class and supporting functions.
3090         (Target_powerpc::symval_for_branch): Only look up .opd entry for
3091         normal symbols defined in object files.
3092
3093 2012-10-12  Alan Modra  <amodra@gmail.com>
3094
3095         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
3096         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
3097         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
3098         section if scan_opd_relocs not yet called.
3099         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
3100
3101 2012-10-12  Alan Modra  <amodra@gmail.com>
3102
3103         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3104         add_local_ifunc_entry): Revert last change.
3105         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
3106
3107 2012-10-05  Alan Modra  <amodra@gmail.com>
3108
3109         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
3110         do_plt_address_for_global): New functions.
3111         (Output_data_got_powerpc::do_write): Don't segfault when linking
3112         statically.
3113         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3114         add_local_ifunc_entry): Return true on adding entry..
3115         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
3116         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
3117         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
3118         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
3119         set up symbols here.
3120         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
3121         syms here.  Do so even when no .iplt.  Don't segfault when linking
3122         statically.
3123         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
3124         new variants without reloc param.
3125         (Glink_sym_ent::Glink_sym_ent): Likewise.
3126         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
3127         reloc when refs will resolve to plt call stub.
3128         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
3129         R_PPC_PLTREL24 to resolve locally.
3130         (Target_powerpc::Scan::global): Correct ifunc handling.
3131         (Target_powerpc::Relocate::relocate): Correct local sym glink
3132         lookup.  Don't destroy "value" when we have a plt call stub,
3133         and when checking plt call validity.
3134         (Target_powerpc::do_dynsym_value): Simplify.
3135
3136 2012-10-05  Alan Modra  <amodra@gmail.com>
3137
3138         * i386.cc (Output_data_plt_i386::address_for_global,
3139         address_for_local): Add plt offset to returned value.  Adjust uses.
3140         * sparc.cc (Output_data_plt_sparc::address_for_global,
3141         address_for_local): Likewise.
3142         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
3143         address_for_local): Likewise.
3144         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
3145         address_for_local): Likewise.
3146         * target.h (Target::plt_address_for_global, plt_address_for_local):
3147         Update comment.
3148         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
3149         (Output_data_got::Got_entry::write): Nor here.
3150         * output.h: Comment fix.
3151
3152 2012-10-02  Jiong Wang  <jiwang@tilera.com>
3153
3154         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
3155         global_offset_table_ value for larget got.
3156         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
3157
3158 2012-09-29  Alan Modra  <amodra@gmail.com>
3159
3160         * powerpc.cc (Target_powerpc::iplt_): New output section.
3161         (Target_powerpc::iplt_section, make_iplt_section,
3162         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
3163         (Target_powerpc::make_plt_entry): Handle ifunc syms.
3164         Target_powerpc::plt_entry_count): Count iplt entries too.
3165         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
3166         reloc section in constructor.  New params.
3167         (Target_powerpc::make_plt_section): Create reloc section here instead.
3168         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
3169         functions.
3170         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
3171         (Output_data_glink::add_entry, find_entry): New functions to
3172         deal with local syms.
3173         (Glink_sym_ent): Add support for local syms.
3174         (Output_data_glink::do_write): Handle ifunc plt entries.
3175         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3176         (Target_powerpc::Scan::local, global): Handle ifunc syms.
3177         (Target_powerpc::Relocate::relocate): Likewise.
3178         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
3179
3180 2012-09-25  Alan Modra  <amodra@gmail.com>
3181
3182         * object.h (Sized_relobj_file::adjust_local_symbol,
3183         do_adjust_local_symbol): New functions.
3184         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
3185         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
3186         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
3187         and irregular opd entry spacing.
3188         (Powerpc_relobj::do_read_relocs): Add opd size checks.
3189         (Global_symbol_visitor_opd): New functor.
3190         (Target_powerpc::do_finalize_sections): Omit global symbols defined
3191         on deleted opd entries.
3192
3193 2012-09-15  Jiong Wang  <jiwang@tilera.com>
3194
3195         * tilegx.cc: New file.
3196         * Makefile.am (TARGETSOURCES): Add tilegx.cc
3197         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
3198         * configure.tgt: Add entries for tilegx*.
3199         * configure.ac: Likewise.
3200         * Makefile.in: Rebuild.
3201         * configure: Likewise.
3202         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
3203         tilegx.
3204
3205 2012-09-13  Alan Modra  <amodra@gmail.com>
3206
3207         * target-reloc.h (scan_relocs): Call scan.local for relocs
3208         against symbols in discarded sections.  Pass is_discarded
3209         param.
3210         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
3211         Add is_discarded param.
3212         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
3213         is_discarded to flag opd entry as discarded.  Don't emit dyn
3214         relocs on such entries.
3215         (Target_powerpc::Scan::global): Similarly detect and handle
3216         such opd entries.
3217         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
3218         opd_ent_.  Update all uses.
3219         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
3220         (Target_powerpc::relocate_section): Zero out discarded opd
3221         entry relocs.
3222
3223 2012-09-12  Ian Lance Taylor  <iant@google.com>
3224
3225         PR gold/14570
3226         * output.cc: Rename Output_data_got template parameter from size
3227         to got_size for all functions.  Compile all variants of
3228         Output_data_got.
3229         (Output_data_got::Got_entry::write): Correct use of size for
3230         symbol value.  Use local_is_tls rather than casting to
3231         Sized_relobj_file.
3232         * object.h (class Object): Add local_is_tls and do_local_is_tls.
3233         (class Sized_relobj_file): Add do_local_is_tls.
3234         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
3235
3236 2012-09-11  Alan Modra  <amodra@gmail.com>
3237
3238         PR gold/14566
3239         * layout.cc (Layout::set_segment_offsets): When using
3240         common-page-size alignment, ensure we are on a new max-page-size
3241         page.
3242         * output.cc (Output_segment::set_section_addresses): Use
3243         abi_pagesize, not common_pagesize for relro boundary.
3244         (Output_segment::set_offset): Likewise.
3245
3246 2012-09-11  Alan Modra  <amodra@gmail.com>
3247
3248         * output.h (Output_data_got::add_global_tls, add_local_tls,
3249         add_local_tls_pair): New functions.
3250         (Output_data_got::add_local_pair_with_rel): Remove second
3251         reloc param.  Expand comment.
3252         (Output_data_got::Got_entry): Rename use_plt_offset_ to
3253         use_plt_or_tls_offset_, similarly for constructor param.
3254         (Output_data_got::Got_entry::write): Add got_index param.
3255         * output.cc (Output_data_got::add_global_tls, add_local_tls,
3256         add_local_tls_pair): New functions.
3257         (Output_data_got::Got_entry::write): Handle tls symbols
3258         with use_plt_or_tls_offset_ set specially.
3259         (Output_data_got::add_local_pair_with_rel): Only one reloc.
3260         (Output_data_got::do_write): Replace iterator with index, pass
3261         index to entry write function.
3262         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
3263         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
3264         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
3265         call.
3266         * i386.cc (Target_i386::Scan::local): Likewise.
3267         * sparc.cc (Target_sparc::Scan::local): Likewise.
3268         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
3269         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
3270         do_tls_offset_for_global): New functions.
3271         (Target_powerpc::Scan::local): Correct TLS relocations and got
3272         entry values.
3273         (Target_powerpc::Scan::global): Don't emit unnecessary
3274         dynamic relocations on TLS GOT entries.
3275
3276 2012-09-10  Matthias Klose  <doko@ubuntu.com>
3277
3278         * config.in: Disable sanity check for kfreebsd.
3279
3280 2012-09-10  Sterling Augustine  <saugustine@google.com>
3281
3282         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
3283         (Gdb_index::pubtypes_read): New parameter.
3284         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
3285         to calls.
3286         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
3287         pubtypes_object_.
3288
3289 2012-09-09  Alan Modra  <amodra@gmail.com>
3290
3291         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
3292         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
3293         * gc.h (gc_process_relocs): Call target gc_add_reference.
3294         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
3295         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
3296         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
3297         unnecessary cast.
3298         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
3299         to cater for when we don't need code offset.  Update use.
3300         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
3301         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
3302         set_opd_valid): New functions.
3303         (Target_powerpc::do_gc_add_reference): New function.
3304         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
3305         stashed refs.
3306         (Target_powerpc::do_gc_mark_symbol): New function.
3307
3308 2012-09-06  Cary Coutant  <ccoutant@google.com>
3309
3310         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
3311         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
3312         (Dwarf_die::skip_attributes): Likewise.
3313         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
3314         * testsuite/gdb_index_test.cc (inline_func_1): New function.
3315         (main): Call it.
3316         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
3317
3318 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
3319
3320         * testsuite/script_test_3.t: Add .got.plt output section
3321         statement.
3322         * testsuite/script_test_4.t: Likewise.
3323
3324 2012-09-05  Alan Modra  <amodra@gmail.com>
3325
3326         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
3327         update all uses and lose "enum" when using type.
3328
3329 2012-09-05  Alan Modra  <amodra@gmail.com>
3330
3331         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
3332         * configure: Regenerate.
3333         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
3334         (plugin_final_layout.stdout): Likewise.
3335         (memory_test): Set page sizes to 0x1000.
3336         * testsuite/Makefile.in: Regenerate.
3337         * testsuite/discard_locals_test.sh: Add FIXME comment.
3338         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
3339         * testsuite/pr14265.t: Add .got output section statement.
3340         * testsuite/script_test_2.t: Likewise.
3341         * testsuite/script_test_3.t: Likewise.
3342         * testsuite/script_test_4.t: Likewise.
3343         * testsuite/script_test_5.t: Likewise.
3344         * testsuite/script_test_6.t: Likewise.
3345         * testsuite/script_test_7.t: Likewise.
3346         * testsuite/script_test_9.t: Likewise.
3347
3348 2012-09-05  Alan Modra  <amodra@gmail.com>
3349
3350         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
3351         (Powerpc_relocate_functions::Status): New typedef.
3352         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3353         (Target_powerpc::Scan::local): Handle REL64.
3354         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
3355         for REL32 and REL64.
3356         (Target_powerpc::symval_for_branch): New function, extracted from..
3357         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
3358         checks.  Report overflow errors.
3359
3360 2012-09-05  Alan Modra  <amodra@gmail.com>
3361
3362         * object.h (Sized_relobj_file::emit_relocs): Delete.
3363         (Sized_relobj_file::emit_relocs_reltype): Delete.
3364         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
3365         relocate_relocs for --emit-relocs.
3366         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
3367         * output.h: Update comment.
3368         (Output_segment::first_section): New function.
3369         (Output_segment::first_section_load_address): Use first_section.
3370         * output.cc (Output_segment::first_section): New function extracted..
3371         (Output_segment::first_section_load_address): ..from here.  Delete.
3372         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
3373         * target.h (Sized_target::relocate_for_relocatable): Likewise.
3374         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
3375         adjust call to target.h function.
3376         * i386.cc (Target_i386): Likewise.
3377         * sparc.cc (Target_sparc): Likewise.
3378         * x86_64.cc (Target_x86_64): Likewise.
3379         * powerpc.cc (Target_powerpc): Likewise.
3380         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
3381         first tls section has section symbol for optimised local dynamic
3382         output relocs.
3383         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
3384         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
3385         optimised tls code.
3386         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
3387         Rename to relocate_relocs.  Update error message.
3388
3389 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
3390
3391         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
3392         --just-symbols.
3393
3394 2012-08-31  Alan Modra  <amodra@gmail.com>
3395
3396         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
3397         (Powerpc_relobj::toc_base_offset): New stub function.
3398         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
3399         got_mod_index_offset to tlsld_got_offset.  Update all refs.
3400         (Target_powerpc::Relocate::enum skip_tls): New.
3401         (Target_powerpc::call_tls_get_addr_): New var.
3402         (Target_powerpc::is_branch_reloc): Move to file scope.
3403         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
3404         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
3405         New functions.
3406         (Target_powerpc::enum Got_type): Delete old values, add new ones.
3407         (powerpc_info): Correct common_pagesize for ppc64.
3408         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
3409         (Powerpc_relocate_functions): Add overflow check enums and functions.
3410         Add non-shift version of rela, rela_ua.  Delete all rel public
3411         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
3412         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
3413         addr16_ha3, addr14 functions.
3414         (Output_data_got_powerpc::add_constant_pair): New function.
3415         (Output_data_got_powerpc::got_base_offset): Likewise.
3416         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
3417         (instruction constants): Sort, add some more.
3418         (Output_data_glink::do_write): Add and use Address typedef.  Use
3419         object->toc_base_offset() stub for 64-bit.
3420         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
3421         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3422         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
3423         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
3424         Always treat .opd relocs as against locally defined symbol.
3425         Correct condition for RELATIVE relocs.
3426         (Target_powerpc::do_finalize_sections): Test for NULL sections.
3427         (Target_powerpc::Relocate::relocate): Use plt call stub as value
3428         for 32-bit syms with a plt entry.  Correct ppc64 toc base
3429         calculations.  Handle TLS relocs, and more.  Add overflow
3430         checking and adjust for Powerpc_relocate_functions changes.
3431         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
3432         Reinstate --emit-relocs code with FIXME.
3433
3434 2012-08-30  Alan Modra  <amodra@gmail.com>
3435
3436         * layout.cc (Layout::set_segment_offsets): Set p_align to
3437         abi_pagesize, not common_pagesize.
3438         (Layout::relaxation_loop_body): Similarly use abi_pagesize
3439         to determine whether file header can go in segment.
3440
3441 2012-08-30  Alan Modra  <amodra@gmail.com>
3442
3443         * output.h (Output_reloc::Output_reloc <output section>): Add
3444         is_relative param.  Adjust calls.
3445         (Output_reloc::add_output_section_relative): New functions.
3446         * output.cc (Output_reloc::Output_reloc <output section>): Handle
3447         is_relative.
3448         (Output_reloc::symbol_value): Handle SECTION_CODE.
3449
3450 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
3451
3452         * gold.cc (queue_middle_tasks): Call layout again when unique
3453         segments for sections is desired.
3454         * layout.cc (Layout::Layout): Initialize new members.
3455         (Layout::get_output_section_flags): New function.
3456         (Layout::choose_output_section): Call get_output_section_flags.
3457         (Layout::layout): Make output section for mapping to a unique segment.
3458         (Layout::insert_section_segment_map): New function.
3459         (Layout::attach_allocated_section_to_segment): Make unique segment for
3460         output sections marked so.
3461         (Layout::segment_precedes): Check for unique segments when sorting.
3462         * layout.h (Layout::Unique_segment_info): New struct.
3463         (Layout::Section_segment_map): New typedef.
3464         (Layout::insert_section_segment_map): New function.
3465         (Layout::get_output_section_flags): New function.
3466         (Layout::is_unique_segment_for_sections_specified): New function.
3467         (Layout::set_unique_segment_for_sections_specified): New function.
3468         (Layout::unique_segment_for_sections_specified_): New member.
3469         (Layout::section_segment_map_): New member.
3470         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
3471         Rename is_gc_pass_one to is_pass_one.
3472         Rename is_gc_pass_two to is_pass_two.
3473         Rename is_gc_or_icf to is_two_pass.
3474         Check for which pass based on whether symbols data is present.
3475         Make it two pass when unique segments for sections is desired.
3476         * output.cc (Output_section::Output_section): Initialize new
3477         members.
3478         * output.h (Output_section::is_unique_segment): New function.
3479         (Output_section::set_is_unique_segment): New function.
3480         (Output_section::is_unique_segment_): New member.
3481         (Output_section::extra_segment_flags): New function.
3482         (Output_section::set_extra_segment_flags): New function.
3483         (Output_section::extra_segment_flags_): New member.
3484         (Output_section::segment_alignment): New function.
3485         (Output_section::set_segment_alignment): New function.
3486         (Output_section::segment_alignment_): New member.
3487         (Output_segment::Output_segment): Initialize is_unique_segment_.
3488         (Output_segment::is_unique_segment): New function.
3489         (Output_segment::set_is_unique_segment): New function.
3490         (Output_segment::is_unique_segment_): New member.
3491         * plugin.cc (allow_unique_segment_for_sections): New function.
3492         (unique_segment_for_sections): New function.
3493         (Plugin::load): Add new functions to transfer vector.
3494         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
3495         * Makefile.in: Regenerate.
3496         * testsuite/plugin_final_layout.sh: Check if unique segment
3497         functionality works.
3498         * testsuite/plugin_section_order.c (onload): Check if new interfaces
3499         are available.
3500         (allow_unique_segment_for_sections): New global.
3501         (unique_segment_for_sections): New global.
3502         (claim_file_hook): Call allow_unique_segment_for_sections.
3503         (all_symbols_read_hook): Call unique_segment_for_sections.
3504
3505 2012-08-22  Cary Coutant  <ccoutant@google.com>
3506
3507         * layout.cc (Layout::include_section): Don't assert on GROUP
3508         sections with --emit-relocs.
3509
3510 2012-08-21  Cary Coutant  <ccoutant@google.com>
3511
3512         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
3513         if --export-dynamic-symbol names an undef symbol.
3514
3515 2012-08-18  Alan Modra  <amodra@gmail.com>
3516
3517         * powerpc.cc: Formatting and white space.
3518         (Powerpc_relobj): Rename got2_section_ to special_.
3519         Add opd_ent_shndx_ and opd_ent_off_ vectors.
3520         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
3521         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
3522         (Target_powerpc): Add Address typedef and invalid_address.  Use
3523         throughout.
3524         (Target_powerpc::is_branch_reloc): New function.
3525         (Powerpc_relocate_functions): Add Address typedef, use throughout.
3526         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
3527         for dst_mask, value and addend.
3528         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
3529         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
3530         (Output_data_glink::do_write): Correct toc base.  Don't try to use
3531         uint16_t for 24-bit offset.  Use get_output_section_offset and
3532         check return.
3533         (Target_powerpc::Scan::local): Handle more relocs.
3534         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
3535         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
3536         Plug in toc restoring insn after plt calls.  Translate branches
3537         to function descriptor symbols to corresponding entry point.
3538         (Target_powerpc::relocate_for_relocatable): Check return from
3539         get_output_section_offset.
3540         * symtab.h: Comment typo.
3541
3542 2012-08-14  Ian Lance Taylor  <iant@google.com>
3543
3544         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
3545         unsupported_relocal_local to call unsupported_reloc_global.
3546
3547 2012-08-14  Nick Clifton  <nickc@redhat.com>
3548
3549         PR ld/14265
3550         * script-sections.cc (Sections_element::output_section_name): Add
3551         keep return parameter.
3552         (Output_section_element::match_name): Add keep return parameter.
3553         Return the value of the keep_ member.
3554         * script-sections.h (class Output_section): Update
3555         output_section_name prototype.
3556         * layout.cc (Layout::keep_input_section): New public member
3557         function.
3558         (Layout::choose_output_section): Pass keep parameter to
3559         output_section_name.
3560         * layout.h (class Layout): Add keep_input_section.
3561         * object.cc (Sized_relobj_file::do_layout): Check for kept input
3562         sections.
3563         * testsuite/Makefile.am: Add a test.
3564         * testsuite/Makefile.in: Regenerate.
3565         * testsuite/pr14265.c: Source file for the test.
3566         * testsuite/pr14265.t: Linker script for the test.
3567         * testsuite/pr14265.sh: Shell script for the test.
3568
3569 2012-08-14  Alan Modra  <amodra@gmail.com>
3570
3571         * target.h (Target::output_section_name): New function.
3572         (Target::do_output_section_name): New function.
3573         * layout.cc (Layout::choose_output_section): Call the above.
3574         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
3575
3576 2012-08-14  Alan Modra  <amodra@gmail.com>
3577
3578         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
3579         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
3580         for replace_constant call.
3581         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
3582         (Output_data_glink::do_print_to_mapfile): New function.
3583         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
3584         (Target_powerpc::Relocate::relocate): Likewise.
3585
3586 2012-08-14  Alan Modra  <amodra@gmail.com>
3587
3588         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
3589         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
3590         (Output_data_glink::add_entry,find_entry): Remove shndx param.
3591         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
3592         all references to shndx_.  Handle special case for R_PPC_PLTREL24
3593         here.
3594         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
3595         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
3596         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
3597         here.
3598         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
3599         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
3600
3601 2012-08-12  Alan Modra  <amodra@gmail.com>
3602
3603         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
3604         (glink insn constants): Use uint32_t.
3605         (Output_data_glink::add_entry): Use insert, not [] operator.
3606
3607 2012-08-11  Alan Modra  <amodra@gmail.com>
3608
3609         * object.h (Sized_relobj_file::find_shdr): New function.
3610         (Sized_relobj_file::find_special_sections): New function.
3611         * object.cc (Sized_relobj_file::find_shdr): New function.
3612         (Sized_relobj_file::find_eh_frame): Use find_shdr.
3613         (Sized_relobj_file::find_special_sections): New function, split out..
3614         (Sized_relobj_file::do_read_symbols): ..from here.
3615         * output.h (Output_data_got::replace_constant): New function.
3616         (Output_data_got::num_entries): New function.
3617         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
3618         (Output_data_got::got_offset): Protected rather than private.
3619         (Output_data_got::replace_got_entry): New function.
3620         * output.cc (Output_data_got::replace_got_entry): New function.
3621         * powerpc.cc (class Powerpc_relobj): New.
3622         (class Powerpc_relocate_functions): Delete all psymval variants or
3623         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
3624         Implement _ha functions using corresponding _hi function.
3625         (Powerpc_relobj::find_special_sections): New function.
3626         (Target_powerpc::do_make_elf_object): New function.
3627         (class Output_data_got_powerpc): New.
3628         (class Output_data_glink): New.
3629         (class Powerpc_scan_relocatable_reloc): New.
3630         Many more changes througout file.
3631
3632 2012-08-09  Nick Clifton  <nickc@redhat.com>
3633
3634         * po/vi.po: Updated Vietnamese translation.
3635
3636 2012-08-07  Ian Lance Taylor  <iant@google.com>
3637
3638         * layout.cc (Layout::add_target_dynamic_tags): If
3639         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
3640         plt_rel.
3641
3642 2012-07-30  Nick Clifton  <nickc@redhat.com>
3643
3644         * po/gold.pot: Updated template.
3645         * po/es.po: Updated Spanish translation.
3646
3647 2012-07-18  Cary Coutant  <ccoutant@google.com>
3648
3649         PR gold/14344
3650         * configure.ac: Add check for -gpubnames support.
3651         * configure: Regenerate.
3652         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
3653         support; force -gno-pubnames.
3654         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
3655         support.
3656         (gdb_index_test_4): New test.
3657         * testsuite/Makefile.in: Regenerate.
3658         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
3659         * testsuite/gdb_index_test_2.sh: Likewise.
3660         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
3661         * testsuite/gdb_index_test_4.sh: New script.
3662         * testsuite/gdb_index_test_comm.sh: New script with common code;
3663         don't look for space after colon.
3664
3665 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
3666
3667         * gold.cc (queue_middle_tasks): Update function order only after
3668         deferred objects due to plugins are processed.
3669
3670 2012-07-11  Ian Lance Taylor  <iant@google.com>
3671
3672         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
3673         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
3674         (Target_arm::scan_reloc_for_stub): Likewise.
3675         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
3676         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
3677         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
3678         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
3679         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
3680
3681 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
3682             Ian Lance Taylor  <iant@google.com>
3683
3684         PR gold/14309
3685         * configure.ac: Test whether std::tr1::hash<off_t> works.
3686         * gold.h: Add a specialization for std::tr1::hash<off_t> if
3687         needed.
3688         * output.h (class Output_fill): Add virtual destructor.
3689         * configure, config.in: Rebuild.
3690
3691 2012-06-22  Roland McGrath  <mcgrathr@google.com>
3692
3693         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
3694
3695 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
3696
3697         * plugin.cc (Plugin::load): Handle position independent executables.
3698
3699 2012-06-06  Cary Coutant  <ccoutant@google.com>
3700
3701         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
3702         add .debug_macro.
3703         (lines_only_debug_sections): Likewise.
3704         (gdb_fast_lookup_sections): New static array.
3705         (is_gdb_debug_section): Rename formal parameter.
3706         (is_lines_only_debug_section): Likewise.
3707         (is_gdb_fast_lookup_section): New function.
3708         (Layout::include_section): Check for ".zdebug_" prefix; pass
3709         section name suffix to is_gdb_debug_section, et al.; check for
3710         fast-lookup sections when building .gdb_index.
3711         * options.h (--strip-debug-gdb): Update GDB version number.
3712
3713 2012-06-06  Cary Coutant  <ccoutant@google.com>
3714
3715         * configure.ac: Add check for fallocate.
3716         * configure: Regenerate.
3717         * config.in: Regenerate.
3718
3719         * options.h (class General_options): Add --mmap-output-file and
3720         --posix-fallocate options.
3721         * output.cc: (posix_fallocate): Remove; replace with...
3722         (gold_fallocate): New function.
3723         (Output_file::map_no_anonymous): Call gold_fallocate.
3724         (Output_file::map): Check --mmap-output-file option.
3725
3726 2012-06-05  Jing Yu  <jingyu@google.com>
3727
3728         * gold.h (textdomain): Add do {} to empty while(0).
3729         (bindtextdomain): Likewise.
3730
3731 2012-06-04  Cary Coutant  <ccoutant@google.com>
3732
3733         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
3734         has_dynsym_index.
3735
3736 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
3737
3738         * symtab.cc (Symbol_table::define_special_symbol):
3739         Initialize *poldsym to prevent uninitialized variable errors.
3740
3741 2012-05-23  Cary Coutant  <ccoutant@google.com>
3742
3743         * layout.cc (Layout::section_name_mapping): Add rules to handle
3744         exact match on .data.rel.ro.local or .data.rel.ro.
3745         (Layout::output_section_name): Check for exact matches.
3746
3747 2012-05-23  Cary Coutant  <ccoutant@google.com>
3748
3749         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
3750         more carefully.
3751
3752 2012-05-22  Cary Coutant  <ccoutant@google.com>
3753
3754         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
3755         object before exporting symbol.
3756
3757 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
3758
3759         * testsuite/tls_test.cc: Include "config.h" first.
3760         * testsuite/tls_test_c.c: Likewise.
3761
3762 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
3763             Nick Clifton  <nickc@redhat.com>
3764
3765         PR 14072
3766         * configure.in: Add check that sysdep.h has been included before
3767         any system header files.
3768         * configure: Regenerate.
3769         * config.in: Regenerate.
3770
3771 2012-05-14  Cary Coutant  <ccoutant@google.com>
3772
3773         * layout.cc (Layout::make_output_section): Mark .tdata section
3774         as RELRO.
3775         * testsuite/relro_test.cc: Add a TLS variable.
3776
3777 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
3778
3779         PR gold/14091
3780         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3781         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3782         R_X86_64_64.
3783
3784 2012-05-08  Cary Coutant  <ccoutant@google.com>
3785
3786         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3787         (lines_only_debug_sections): Likewise.
3788
3789 2012-05-02  Roland McGrath  <mcgrathr@google.com>
3790
3791         * nacl.cc: New file.
3792         * nacl.h: New file.
3793         * Makefile.am (CCFILES, HFILES): Add them.
3794         * Makefile.in: Regenerate.
3795         * i386.cc (Output_data_plt_i386_nacl): New class.
3796         (Output_data_plt_i386_nacl_exec): New class.
3797         (Output_data_plt_i386_nacl_dyn): New class.
3798         (Target_i386_nacl): New class.
3799         (Target_selector_i386_nacl): New class.
3800         (target_selector_i386): Use it instead of Target_selector_i386.
3801         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3802         (Target_x86_64_nacl): New class.
3803         (Target_selector_x86_64_nacl): New class.
3804         (target_selector_x86_64, target_selector_x32): Use it instead of
3805         Target_selector_x86_64.
3806         * arm.cc (Output_data_plt_arm_nacl): New class.
3807         (Target_arm_nacl): New class.
3808         (Target_selector_arm_nacl): New class.
3809         (target_selector_arm, target_selector_armbe): Use it instead of
3810         Target_selector_arm.
3811
3812         * target-select.cc (select_target): Take new Input_file* and off_t
3813         arguments, pass them on to recognize method of selector.
3814         * object.cc (make_elf_sized_object): Update caller.
3815         * parameters.cc (parameters_force_valid_target): Likewise.
3816         * incremental.cc (make_sized_incremental_binary): Likewise.
3817         * target-select.h: Update decl.
3818         (Target_selector::recognize): Take new Input_file* argument,
3819         pass it on to do_recognize.
3820         (Target_selector::do_recognize): Take new Input_file* argument.
3821         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3822         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3823         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3824         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3825
3826         * target.h (Target::Target_info): New members isolate_execinstr
3827         and rosegment_gap.
3828         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3829         * arm.cc (Target_arm::arm_info): Update initializer.
3830         * i386.cc (Target_i386::i386_info): Likewise.
3831         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3832         * sparc.cc (Target_sparc::sparc_info): Likewise.
3833         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3834         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3835         * layout.cc (Layout::attach_allocated_section_to_segment):
3836         Take new const Target* argument.  If target->isolate_execinstr(), act
3837         like --rosegment.
3838         (Layout::find_first_load_seg): Take new const Target* argument;
3839         if target->isolate_execinstr(), reject PF_X segments.
3840         (Layout::relaxation_loop_body): Update caller.
3841         (Layout::set_segment_offsets): If target->isolate_execinstr(),
3842         reset file offset to zero when we hit LOAD_SEG, and then do a second
3843         loop over the segments before LOAD_SEG to reassign offsets after
3844         addresses have been determined.  Handle target->rosegment_gap().
3845         (Layout::attach_section_to_segment): Take new const Target* argument;
3846         pass it to attach_allocated_section_to_segment.
3847         (Layout::make_output_section): Update caller.
3848         (Layout::attach_sections_to_segments): Take new const Target* argument;
3849         pass it to attach_section_to_segment.
3850         * gold.cc (queue_middle_tasks): Update caller.
3851         * layout.h (Layout): Update method decls with new arguments.
3852
3853         * arm.cc (Target_arm::Target_arm): Take optional argument for the
3854         Target_info pointer to use.
3855         (Target_arm::do_make_data_plt): New virtual method.
3856         (Target_arm::make_data_plt): New method that calls it.
3857         (Target_arm::make_plt_entry): Use it.
3858         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
3859         for the section alignment.
3860         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
3861         method.
3862         (Output_data_plt_arm::first_plt_entry_offset): Call it.
3863         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
3864         method.
3865         (Output_data_plt_arm::get_plt_entry_size): Call it.
3866         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
3867         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
3868         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
3869         method.
3870         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
3871         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
3872         method instead of sizeof(plt_entry).
3873         (Output_data_plt_arm::add_entry): Likewise.
3874         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
3875         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
3876         than static method.
3877         (Target_arm::plt_entry_size): Likewise.
3878         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
3879         Move to ...
3880         (Output_data_plt_arm_standard): ... here, new class.
3881         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
3882         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
3883         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
3884
3885         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3886         Take additional argument for the PLT entry size.
3887         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
3888         Use get_plt_entry_size method rather than plt_entry_size variable.
3889         (Output_data_plt_x86_64::reserve_slot): Likewise.
3890         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
3891         (Output_data_plt_x86_64::add_entry): Likewise.
3892         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
3893         (Output_data_plt_x86_64::address_for_global): Likewise.
3894         (Output_data_plt_x86_64::address_for_local): Likewise.
3895         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3896         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
3897         Make method non-static.
3898         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
3899         method.
3900         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
3901         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
3902         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
3903         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
3904         virtual method.
3905         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
3906         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
3907         virtual method.
3908         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
3909         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
3910         virtual method.
3911         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3912         (Output_data_plt_x86_64::plt_entry_size)
3913         (Output_data_plt_x86_64::first_plt_entry)
3914         (Output_data_plt_x86_64::plt_entry)
3915         (Output_data_plt_x86_64::tlsdesc_plt_entry)
3916         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3917         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3918         (Output_data_plt_x86_64_standard): ... here, new class.
3919         (Target_x86_64::Target_x86_64): Take optional argument for the
3920         Target_info pointer to use.
3921         (Target_x86_64::do_make_data_plt): New virtual method.
3922         (Target_x86_64::make_data_plt): New method to call it.
3923         (Target_x86_64::init_got_plt_for_update): Use that.
3924         Call this->plt_->add_eh_frame method here.
3925         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3926         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3927         rather than static method.
3928         (Target_x86_64::plt_entry_size): Likewise.
3929         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3930         rather than plt_entry_size variable.  Move guts of PLT filling to...
3931         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3932         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3933         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3934
3935         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3936         additional argument for the section alignment.
3937         Don't do add_eh_frame_for_plt here.
3938         (Output_data_plt_i386::first_plt_entry_offset): Make the method
3939         non-static.  Use get_plt_entry_size method rather than plt_entry_size
3940         variable.
3941         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3942         method.
3943         (Output_data_plt_i386::get_plt_entry_size): Call it.
3944         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
3945         (Output_data_plt_i386::add_eh_frame): New method to call it.
3946         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
3947         method.
3948         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
3949         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
3950         method.
3951         (Output_data_plt_i386::fill_plt_entry): New method to call it.
3952         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
3953         method instead of plt_entry_size.
3954         (Output_data_plt_i386::plt_entry_size)
3955         (Output_data_plt_i386::plt_eh_frame_fde_size)
3956         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
3957         (Output_data_plt_i386_standard): ... here, new class.
3958         (Output_data_plt_i386_exec): New class.
3959         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
3960         (Output_data_plt_i386_exec::first_plt_entry): ... here.
3961         (Output_data_plt_i386::exec_plt_entry): Move to ...
3962         (Output_data_plt_i386_exec::plt_entry): ... here.
3963         (Output_data_plt_i386_dyn): New class.
3964         (Output_data_plt_i386::first_plt_entry): Move to ...
3965         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
3966         (Output_data_plt_i386::dyn_plt_entry): Move to ...
3967         (Output_data_plt_i386_dyn::plt_entry): ... here.
3968         (Target_i386::Target_i386): Take optional argument for the Target_info
3969         pointer to use.
3970         (Target_i386::do_make_data_plt): New virtual method.
3971         (Target_i386::make_data_plt): New method to call it.
3972         (Target_i386::make_plt_section): Use that.
3973         Call this->plt_->add_eh_frame method here.
3974         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3975         rather than plt_entry_size variable.
3976         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3977         (Output_data_plt_i386::address_for_local): Likewise.
3978         (Output_data_plt_i386::do_write): Likewise.
3979         Move guts of PLT filling to...
3980         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3981         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3982         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3983         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3984
3985 2012-05-01  Cary Coutant  <ccoutant@google.com>
3986
3987         * dwarf_reader.cc (Dwarf_die::read_attributes)
3988         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3989         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3990         * reduced_debug_output.cc
3991         (Output_reduced_debug_info_section::get_die_end): Remove
3992         DW_FORM_GNU_ref_index.  Add default case.
3993
3994 2012-04-26  Mark Wielaard  <mjw@redhat.com>
3995
3996         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3997         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3998         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3999         DW_AT_high_pc as offset from DW_AT_low_pc.
4000
4001         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
4002         * testsuite/Makefile.in: Regenerate.
4003         * testsuite/gdb_index_test_3.c: New test source file.
4004         * testsuite/gdb_index_test_3.sh: New test source file.
4005
4006 2012-04-25  Ian Lance Taylor  <iant@google.com>
4007
4008         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
4009         pointer.
4010         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
4011         as a class, not a struct.
4012         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
4013         (Target_arm::apply_cortex_a8_workaround): Likewise.
4014         * gc.h: Declare Reloc_types as a struct, not a class.
4015         * object.h: Declare Symbols_data as a struct.
4016         * reloc.h: Declare Read_relocs_data as a struct.
4017         * target.h: Declare Relocate_info as a struct.
4018
4019 2012-04-24  David S. Miller  <davem@davemloft.net>
4020
4021         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
4022         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
4023         and R_SPARC_WPLT30.
4024
4025 2012-04-24  Cary Coutant  <ccoutant@google.com>
4026
4027         * incremental-dump.cc (find_input_containing_global): Replace
4028         magic number with symbolic constant.
4029         (dump_incremental_inputs): Update version number.
4030         * incremental.cc (Output_section_incremental_inputs): Update version
4031         number; import symbolic constants from Incremental_inputs_reader.
4032         (Incremental_inputs::create_data_sections): Align relocations
4033         section correctly for 64-bit targets.
4034         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
4035         constants; add padding.
4036         (Output_section_incremental_inputs::write_header): Add assert for
4037         header_size.
4038         (Output_section_incremental_inputs::write_input_files): Add assert
4039         for input_entry_size.
4040         (Output_section_incremental_inputs::write_info_blocks): Add padding;
4041         add assert for object_info_size, input_section_entry_size,
4042         global_sym_entry_size.
4043         * incremental.h (Incremental_inputs_reader): Add symbolic constants
4044         for data structure sizes; use them.
4045         (Incremental_input_entry_reader): Import symbolic constants from
4046         Incremental_inputs_reader; use them.
4047
4048 2012-04-23  David S. Miller  <davem@davemloft.net>
4049
4050         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
4051         and elf_flags_set_.
4052         (Target_sparc::Target_sparc): Initialize new fields.
4053         (Target_sparc::do_make_elf_object): New function.
4054         (Target_sparc::do_adjust_elf_header): New function.
4055
4056 2012-04-23  Cary Coutant  <ccoutant@google.com>
4057
4058         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
4059         CU range table of gdb index.
4060
4061 2012-04-20  David S. Miller  <davem@davemloft.net>
4062
4063         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
4064         instead of false.
4065
4066 2012-04-16  David S. Miller  <davem@davemloft.net>
4067
4068         * sparc.cc (Target_sparc::got_address): New function.
4069         (Sparc_relocate_functions::gdop_hix22): New function.
4070         (Sparc_relocate_functions::gdop_lox10): New function.
4071         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
4072         relocs.
4073         (Target_sparc::Scan::local): Likewise if the global symbol is not
4074         preemptible and is not IFUNC.
4075         (Target_sparc::Relocate::relocate): Perform GOTDATA code
4076         transformations for local and non-preemptible non-IFUNC global
4077         symbols.
4078
4079         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
4080         writing out 64-bit part of ranges.
4081
4082         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
4083         -fpic and -fpie respectively.
4084         * Makefile.in: Regenerate.
4085
4086         * sparc.cc (class Target_sparc): Add rela_ifunc_.
4087         (Target_sparc::Target_sparc): Initialize new field.
4088         (Target_sparc::do_plt_section_for_global): New function.
4089         (Target_sparc::do_plt_section_for_local): New function.
4090         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
4091         (Target_sparc::make_plt_section): New function, broken out of
4092         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
4093         (Target_sparc::make_plt_entry): Call make_plt_section.
4094         (Target_sparc::make_local_ifunc_plt_entry): New function.
4095         (Target_sparc::rela_ifunc_section): New function.
4096         (Target_sparc::plt_section): Remove const.
4097         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
4098         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
4099         and ifunc_count_ fields.
4100         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
4101         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
4102         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
4103         (Output_data_plt_sparc::rela_ifunc): New function.
4104         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
4105         (Output_data_plt_sparc::has_ifunc_section): New function.
4106         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
4107         (Output_data_plt_sparc::address_for_global): New function.
4108         (Output_data_plt_sparc::address_for_local): New function.
4109         (Output_data_plt_sparc::plt_index_to_offset): New function.
4110         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
4111         and entry_count.
4112         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
4113         entry_count.
4114         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
4115         R_SPARC_JMP_IREL to switch.
4116         (Target_sparc::Scan::check_non_pic): Likewise.
4117         (Target_sparc::Scan::local): Handle IFUNC symbols.
4118         (Target_sparc::Scan::local): Likewise.
4119         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
4120         and plt_address_for_local.
4121         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
4122         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
4123
4124         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
4125         (class Output_data_reloc): Adjust calls to Output_reloc_type.
4126         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
4127         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
4128         global relocs too.
4129         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
4130         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
4131         calls.
4132         * sparc.cc (Target_sparc::Scan::global): Likewise.
4133         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4134
4135 2012-04-16  Cary Coutant  <ccoutant@google.com>
4136
4137         * archive.cc (Library_base::should_include_member): Check for
4138         --export-dynamic-symbol.
4139         * options.h (class General_options): Add --export-dynamic-symbol.
4140         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
4141         --export-dynamic-symbol.
4142         (Symbol_table::gc_mark_undef_symbols): Likewise.
4143         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
4144
4145 2012-04-12  David S. Miller  <davem@davemloft.net>
4146
4147         * sparc.cc (Reloc::wdisp10): New relocation method.
4148         (Reloc::h34): Likewise.
4149         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
4150         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
4151         R_SPARC_WDISP10.
4152         (Target_sparc::Scan::local): Likewise.
4153         (Target_sparc::Scan::global): Likewise.
4154         (Target_sparc::Relocate::relocate): Likewise.
4155
4156 2012-04-09  Cary Coutant  <ccoutant@google.com>
4157
4158         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
4159         low_pc == 0.
4160
4161 2012-04-06  Ian Lance Taylor  <iant@google.com>
4162
4163         * timer.cc: #include <unistd.h>.
4164
4165 2012-04-06  Roland McGrath  <mcgrathr@google.com>
4166
4167         * configure.in (AC_CHECK_HEADERS): Add locale.h.
4168         * config.in: Regenerate.
4169         * configure: Regenerate.
4170
4171 2012-04-05  Nick Clifton  <nickc@redhat.com>
4172
4173         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
4174         (AM_LC_MESSAGES): Add.
4175         * aclocal.m4: Regenerate.
4176         * config.in: Regenerate.
4177         * configure: Regenerate.
4178
4179 2012-03-21  Cary Coutant  <ccoutant@google.com>
4180
4181         * Makefile.am: Add gdb-index.cc, gdb-index.h.
4182         * Makefile.in: Regenerate.
4183         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
4184         (Sized_elf_reloc_mapper::symbol_section): New function.
4185         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
4186         (make_elf_reloc_mapper): New function.
4187         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
4188         (Dwarf_abbrev_table::do_read_abbrevs): New function.
4189         (Dwarf_abbrev_table::do_get_abbrev): New function.
4190         (Dwarf_ranges_table::read_ranges_table): New function.
4191         (Dwarf_ranges_table::read_range_list): New function.
4192         (Dwarf_pubnames_table::read_section): New function.
4193         (Dwarf_pubnames_table::read_header): New function.
4194         (Dwarf_pubnames_table::next_name): New function.
4195         (Dwarf_die::Dwarf_die): New function.
4196         (Dwarf_die::read_attributes): New function.
4197         (Dwarf_die::skip_attributes): New function.
4198         (Dwarf_die::set_name): New function.
4199         (Dwarf_die::set_linkage_name): New function.
4200         (Dwarf_die::attribute): New function.
4201         (Dwarf_die::string_attribute): New function.
4202         (Dwarf_die::int_attribute): New function.
4203         (Dwarf_die::uint_attribute): New function.
4204         (Dwarf_die::ref_attribute): New function.
4205         (Dwarf_die::child_offset): New function.
4206         (Dwarf_die::sibling_offset): New function.
4207         (Dwarf_info_reader::check_buffer): New function.
4208         (Dwarf_info_reader::parse): New function.
4209         (Dwarf_info_reader::do_parse): New function.
4210         (Dwarf_info_reader::do_read_string_table): New function.
4211         (Dwarf_info_reader::lookup_reloc): New function.
4212         (Dwarf_info_reader::get_string): New function.
4213         (Dwarf_info_reader::visit_compilation_unit): New function.
4214         (Dwarf_info_reader::visit_type_unit): New function.
4215         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
4216         Sized_elf_reloc_mapper.
4217         (Sized_dwarf_line_info::symbol_section): Remove function.
4218         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
4219         (Sized_dwarf_line_info::read_line_mappings): Remove object
4220         parameter, adjust callers.
4221         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
4222         * dwarf_reader.h: Include <sys/types.h>.
4223         (class Track_relocs): Remove forward declaration.
4224         (class Elf_reloc_mapper): New class.
4225         (class Sized_elf_reloc_mapper): New class.
4226         (class Dwarf_abbrev_table): New class.
4227         (class Dwarf_range_list): New class.
4228         (class Dwarf_ranges_table): New class.
4229         (class Dwarf_pubnames_table): New class.
4230         (class Dwarf_die): New class.
4231         (class Dwarf_info_reader): New class.
4232         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
4233         (Sized_dwarf_line_info::symbol_section): Remove member function.
4234         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
4235         base class.
4236         * gdb-index.cc: New source file.
4237         * gdb-index.h: New source file.
4238         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
4239         and .debug_types sections, call Layout::add_to_gdb_index.
4240         (Sized_relobj_incr::do_section_name): Implement.
4241         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
4242         return type; Implement.
4243         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
4244         return type.
4245         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
4246         parameter list and return type.
4247         (Sized_incr_dynobj::do_section_contents): Likewise.
4248         * layout.cc: Include gdb-index.h.
4249         (Layout::Layout): Initialize gdb_index_data_.
4250         (Layout::init_fixed_output_section): Check for .gdb_index section.
4251         (Layout::add_to_gdb_index): New function. Instantiate.
4252         * layout.h: Add forward declaration for class Gdb_index.
4253         (Layout::add_to_gdb_index): New member function.
4254         (Layout::gdb_index_data_): New data member.
4255         * main.cc: Include gdb-index.h.
4256         (main): Print statistics for gdb index.
4257         * object.cc (Object::section_contents): Move code into
4258         do_section_contents.
4259         (need_decompressed_section): Check for sections needed when building
4260         gdb index.
4261         (build_compressed_section_map): Likewise.
4262         (Sized_relobj_file::do_read_symbols): Need local symbols when building
4263         gdb index.
4264         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
4265         sections; call Layout::add_to_gdb_index.
4266         (Sized_relobj_file::do_decompressed_section_contents): Call
4267         do_section_contents directly.
4268         * object.h (Object::do_section_contents): Adjust parameter list and
4269         return type.
4270         (Object::do_decompressed_section_contents): Call do_section_contents
4271         directly.
4272         (Sized_relobj_file::do_section_contents): Adjust parameter list and
4273         return type.
4274         * options.h (class General_options): Add --gdb-index option.
4275         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
4276         list and return type.
4277         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
4278         * reloc.h (Track_relocs::checkpoint): New function.
4279         (Track_relocs::reset): New function.
4280
4281         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
4282         New test cases.
4283         * testsuite/Makefile.in: Regenerate.
4284         * testsuite/gdb_index_test.cc: New test source file.
4285         * testsuite/gdb_index_test_1.sh: New test source file.
4286         * testsuite/gdb_index_test_2.sh: New test source file.
4287
4288 2012-03-19  Doug Kwan  <dougkwan@google.com>
4289
4290         * arm.cc (Target_arm::do_define_standard_symbols): New method.
4291         (Target_arm::do_finalize_sections): Remove code which defines
4292         __exidx_start and __exidx_end.  Make symbol table parameter
4293         anonymous as it is not used.
4294         * gold.cc (queue_middle_tasks): Call target hook to define any
4295         target-specific symbols.
4296         * target.h (Target::define_standard_symbols): New method.
4297         (Target::do_define_standard_symbols): Same.
4298         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
4299         * testsuite/Makefile.in: Regenerate.
4300         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
4301         and __exidx_end.
4302         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
4303         relocations are generated for __exidx_start and __exidx_end.
4304
4305 2012-03-16  Doug Kwan  <dougkwan@google.com>
4306
4307         * testsuite/Makefile.am: Disable test initpri3b.
4308         * testsuite/Makefile.in: Regenerate.
4309
4310 2012-03-15  Doug Kwan  <dougkwan@google.com>
4311
4312         * arm.cc (Target_arm::got_section): Make .got section read-only
4313         if -z now is given.
4314
4315 2012-03-15  Ian Lance Taylor  <iant@google.com>
4316
4317         PR gold/13850
4318         * layout.cc (Layout::make_output_section): Correctly mark
4319         SHT_INIT_ARRAY, et. al., as relro.
4320
4321 2012-03-14  Doug Kwan  <dougkwan@google.com>
4322
4323         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
4324         dynamic relocations for protected symbols in shared objects.
4325
4326 2012-03-13  Ian Lance Taylor  <iant@google.com>
4327
4328         * resolve.cc (Symbol_table::resolve): When merging common symbols,
4329         keep the larger alignment.
4330
4331 2012-03-12  Cary Coutant  <ccoutant@google.com>
4332
4333         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
4334         handling of DW_LNE_define_file.
4335
4336 2012-03-12  Cary Coutant  <ccoutant@google.com>
4337
4338         * reduced_debug_output.cc
4339         (Output_reduced_debug_info_section::get_die_end): Add new FORM
4340         codes to switch.
4341
4342 2012-02-29  Cary Coutant  <ccoutant@google.com>
4343
4344         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
4345
4346 2012-02-29  Cary Coutant  <ccoutant@google.com>
4347
4348         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4349         Call Object::decompressed_section_contents.
4350         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
4351         New dtor.
4352         (Sized_dwarf_line_info::buffer_start_): New data member.
4353         * merge.cc (Output_merge_data::do_add_input_section): Call
4354         Object::decompressed_section_contents.
4355         (Output_merge_string::do_add_input_section): Likewise.
4356         * object.cc (need_decompressed_section): New function.
4357         (build_compressed_section_map): Decompress sections needed later.
4358         (Sized_relobj_file::do_decompressed_section_contents): New function.
4359         (Sized_relobj_file::do_discard_decompressed_sections): New function.
4360         * object.h (Object::decompressed_section_contents): New function.
4361         (Object::discard_decompressed_sections): New function.
4362         (Object::do_decompressed_section_contents): New function.
4363         (Object::do_discard_decompressed_sections): New function.
4364         (Compressed_section_info): New type.
4365         (Compressed_section_map): Include decompressed section contents.
4366         (Sized_relobj_file::do_decompressed_section_contents): New function.
4367         (Sized_relobj_file::do_discard_decompressed_sections): New function.
4368
4369 2012-02-16  Cary Coutant  <ccoutant@google.com>
4370
4371         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
4372         * testsuite/Makefile.in: Regenerate.
4373
4374 2012-02-14  Cary Coutant  <ccoutant@google.com>
4375
4376         * options.cc (General_options::finalize): Disallow -pie and -static.
4377
4378 2012-02-03  Doug Kwan  <dougkwan@google.com>
4379
4380         * arm.cc (Arm_relocate_functions::abs8,
4381         Arm_relocate_functions::abs16): Use
4382         Bits::has_signed_unsigned_overflow32.
4383         (Arm_relocate_functions::thm_abs8): Correct range of
4384         overflow check.
4385         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
4386         in assertions.
4387
4388 2012-02-02  Doug Kwan  <dougkwan@google.com>
4389
4390         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
4391         position independent outputs, not just shared objects.
4392
4393 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
4394
4395         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
4396         * configure: Regenerated.
4397
4398 2012-01-27  Ian Lance Taylor  <iant@google.com>
4399
4400         * reloc.h (Bits): New class with static functions, copied from
4401         namespace utils in arm.cc.
4402         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
4403         instead.
4404
4405 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4406
4407         * incremental.cc (write_info_blocks): Correct relocation offset.
4408
4409 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4410
4411         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
4412         (Relocate::tls_gd_to_le): Likewise.
4413
4414 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4415
4416         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
4417
4418 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4419
4420         * configure.ac: Check if -mcmodel=medium works.
4421         * configure: Regenerated.
4422
4423 2012-01-24  Cary Coutant  <ccoutant@google.com>
4424
4425         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
4426         definition and ...
4427         (read_unsigned_LEB_128_x): ... this new function.
4428         (read_signed_LEB_128): Replaced with inline definition and ...
4429         (read_signed_LEB_128_x): ... this new function.
4430         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
4431         (read_unsigned_LEB_128): Add inline definition.
4432         (read_signed_LEB_128_x): New function.
4433         (read_signed_LEB_128): Add inline definition.
4434         * testsuite/Makefile.am (leb128_unittest): New unit test.
4435         * testsuite/Makefile.in: Regenerate.
4436         * testsuite/leb128_unittest.cc: New unit test.
4437
4438 2012-01-23  Ian Lance Taylor  <iant@google.com>
4439
4440         PR gold/13617
4441         * i386.cc (Target_i386::do_code_fill): When using a jmp
4442         instruction, pad with nop instructions.
4443         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4444
4445 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
4446
4447         * x86_64.cc (gc_process_relocs): Add typename on types used in
4448         template.
4449         (scan_relocs): Likewise.
4450         (relocate_section): Likewise.
4451         (apply_relocation): Likewise.
4452
4453 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
4454
4455         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
4456         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
4457         under x32.
4458
4459 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
4460
4461         * x86_64.cc: Initial support for x32.
4462
4463 2012-01-03  Cary Coutant  <ccoutant@google.com>
4464
4465         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
4466         Use abstract base class for GOT.
4467         * gold/output.h (class Output_data_got_base): New abstract base class.
4468         (class Output_data_got): Derive from new base class, adjust ctors.
4469         (Output_data_got::reserve_slot): Make virtual; rename to
4470         do_reserve_slot; Adjust callers.
4471         * gold/target.h (Sized_target::init_got_plt_for_update): Return
4472         pointer to abstract base class.
4473         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
4474
4475 2011-12-18  Ian Lance Taylor  <iant@google.com>
4476
4477         * object.h (Relobj::local_symbol_value): New function.
4478         (Relobj::local_plt_offset): New function.
4479         (Relobj::local_has_got_offset): New function.
4480         (Relobj::local_got_offset): New function.
4481         (Relobj::set_local_got_offset): New function.
4482         (Relobj::do_local_symbol_value): New pure virtual function.
4483         (Relobj::do_local_plt_offset): Likewise.
4484         (Relobj::do_local_has_got_offset): Likewise.
4485         (Relobj::do_local_got_offset): Likewise.
4486         (Relobj::do_set_local_got_offset): Likewise.
4487         (Sized_relobj::do_local_has_got_offset): Rename from
4488         local_has_got_offset.
4489         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
4490         (Sized_relobj::do_set_local_got_offset): Rename from
4491         set_local_got_offset.
4492         (Sized_relobj_file::do_local_plt_offset): Rename from
4493         local_plt_offset.
4494         (Sized_relobj_file::do_local_symbol_value): New function.
4495         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
4496         local_plt_offset.
4497         * output.cc (Output_data_got::Got_entry::write): Change object to
4498         Relobj.  Use local_symbol_value.
4499         (Output_data_got::add_global_with_rel): Change rel_dyn to
4500         Output_data_reloc_generic*.  Use add_global_generic.
4501         (Output_data_got::add_global_with_rela): Remove.  Change all
4502         callers to use add_global_with_rel.
4503         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
4504         Output_data_reloc_generic*.  Use add_global_generic.
4505         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
4506         callers to use add_global_pair_with_rel.
4507         (Output_data_got::add_local): Change object to Relobj*.
4508         (Output_data_got::add_local_plt): Likewise.
4509         (Output_data_got::add_local_with_rel): Change object to Relobj*,
4510         change rel_dyn to Output_data_reloc_generic*.  Use
4511         add_local_generic.
4512         (Output_data_got::add_local_with_rela): Remove.  Change all
4513         callers to use all_local_with_rel.
4514         (Output_data_got::add_local_pair_with_rel): Change object to
4515         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
4516         add_output_section_generic.
4517         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
4518         callers to use add_local_pair_with_rel.
4519         (Output_data_got::reserve_local): Change object to Relobj*.
4520         * output.h: (class Output_data_reloc_generic): Add pure virtual
4521         declarations for add_global_generic, add_local_generic,
4522         add_output_section_generic.
4523         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
4524         functions for Output_data_reloc_generic.  Update declarations for
4525         changes listed in output.cc.
4526         (class Output_data_got): Change template parameter to got_size.
4527         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
4528         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
4529         function.
4530         (Sized_relobj_incr::do_local_plt_offset): New function.
4531         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
4532         add_global_generic.
4533
4534 2011-12-17  Cary Coutant  <ccoutant@google.com>
4535
4536         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
4537         * resolve.cc (Symbol_table::resolve): Likewise.
4538         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
4539         arrays.
4540         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4541
4542 2011-12-16  Ian Lance Taylor  <iant@google.com>
4543
4544         * output.h (Output_data_reloc_generic::add): Only call
4545         add_dynamic_reloc if this is a dynamic reloc section.
4546
4547 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
4548
4549         PR gold/13505
4550         * target-reloc.h (apply_relocation): Replace <64, false> with
4551         <size, big_endian>.
4552
4553 2011-11-25  Nick Clifton  <nickc@redhat.com>
4554
4555         * po/it.po: New Italian translation.
4556
4557 2011-11-17  Sterling Augustine  <saugustine@google.com>
4558
4559         * script.cc (script_include_directive): Implement.
4560         (read_script_file): New local variables name and search_path. Update
4561         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
4562         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
4563         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
4564
4565 2011-11-11  Sterling Augustine  <saugustine@google.com>
4566
4567         * yyscript.y (section_cmd): Add support for INCLUDE directive.
4568         (file_or_sections_cmd): Likewise.
4569
4570 2011-11-11  Doug Kwan  <dougkwan@google.com>
4571
4572         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
4573         if --just-symbols is given.
4574
4575 2011-11-10  Doug Kwan  <dougkwan@google.com>
4576
4577         PR gold/13362
4578         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
4579         when processing data relocs.
4580         * reloc.h (Relocate_functions::rel_unaligned): New method.
4581         (Relocate_functions::pcrel_unaligned): Ditto.
4582         (Relocate_functions::rel32_unaligned): Ditto.
4583         (Relocate_functions::pcrel32_unaligned): Ditto.
4584
4585 2011-11-09  Doug Kwan  <dougkwan@google.com>
4586
4587         PR gold/13362
4588         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
4589         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
4590         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
4591         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4592         (Relocate_functions::rel_unaligned): New.
4593         (Relocate_functions::rel32_unaligned): New.
4594         * target-reloc.h (relocate_for_relocatable): Add code to handle
4595         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4596         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
4597         arm_unaligned_reloc_r): New targets.
4598         * testsuite/Makefile.in: Regenerate.
4599         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
4600         linking.
4601
4602 2011-11-02  Ian Lance Taylor  <iant@google.com>
4603
4604         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
4605         NATIVE_LINKER.
4606         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
4607         * options.cc (General_options::finalize): Use library search path
4608         from configure script if specified.  If not native and no sysroot,
4609         only search TOOLLIBDIR.
4610         * options.h (Search_directory::Search_directory): Change name to
4611         const std::string&.
4612         (General_options::add_to_library_path_with_sysroot): Change arg to
4613         const std::string&.
4614         * configure, Makefile.in, config.in: Rebuild.
4615
4616 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
4617
4618         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
4619         we are working around the ARM1176 Erratum.
4620         * options.h (General_options::fix_arm1176): Add option.
4621         * testsuite/Makefile.am: Add testcases, and keep current ones
4622         working.
4623         * testsuite/Makefile.in: Regenerate.
4624         * testsuite/arm_fix_1176.s: New file.
4625         * testsuite/arm_fix_1176.sh: Likewise.
4626
4627 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
4628
4629         * arm.cc (Target_arm::Target_arm): Remove initialisation of
4630         may_use_blx_.
4631         (Target_arm::may_use_blx): Remove method.
4632         (Target_arm::set_may_use_blx): Likewise.
4633         (Target_arm::may_use_v4t_interworking): New method.
4634         (Target_arm::may_use_v5t_interworking): Likewise.
4635         (Target_arm::may_use_blx_): Remove member variable.
4636         (Arm_relocate_functions::arm_branch_common): Check for v5T
4637         interworking.
4638         (Arm_relocate_functions::thumb_branch_common): Likewise.
4639         (Reloc_stub::stub_type_for_reloc): Likewise.
4640         (Target_arm::do_finalize_sections): Correct interworking checks.
4641         * testsuite/Makefile.am: Add new tests.
4642         * testsuite/Makefile.in: Regenerate.
4643         * testsuite/arm_farcall_arm_arm.s: New test.
4644         * testsuite/arm_farcall_arm_arm.sh: Likewise.
4645         * testsuite/arm_farcall_arm_thumb.s: Likewise.
4646         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
4647         * testsuite/arm_farcall_thumb_arm.s: Likewise.
4648         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
4649         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
4650         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
4651
4652 2011-10-31  Cary Coutant  <ccoutant@google.com>
4653
4654         PR gold/13023
4655         * expression.cc (Expression::eval_with_dot): Add
4656         is_section_dot_assignment parameter.
4657         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
4658         absolute and assigning to dot within a section.
4659         * script-sections.cc
4660         (Output_section_element_assignment::set_section_addresses): Pass
4661         dot_section to set_if_absolute.
4662         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
4663         as is_section_dot_assignment flag to eval_with_dot.
4664         (Output_section_element_dot_assignment::set_section_addresses):
4665         Likewise.
4666         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
4667         parameter.  Also set value if relative to dot_section; set the
4668         symbol's output_section.
4669         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
4670         parameter.  Adjust all callers.
4671         (Expression::eval_maybe_dot): Likewise.
4672         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
4673         Adjust all callers.
4674         * testsuite/script_test_2.t: Test assignment of an absolute value
4675         to dot within an output section element.
4676
4677 2011-10-31  Cary Coutant  <ccoutant@google.com>
4678
4679         * options.h (class General_options): Add --[no-]gnu-unique options.
4680         * symtab.cc (Symbol_table::sized_write_globals): Convert
4681         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
4682
4683 2011-10-31  Cary Coutant  <ccoutant@google.com>
4684
4685         PR gold/13359
4686         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
4687         unnecessary assertion.
4688         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
4689
4690 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
4691
4692         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4693         gc_mark_symbol.
4694         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4695         gc_mark_symbol.
4696         Change to just keep the section associated with symbol.
4697         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
4698         they are externally visible and --export-dynamic is turned on.
4699         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
4700
4701 2011-10-19  Ian Lance Taylor  <iant@google.com>
4702
4703         PR gold/13163
4704         * script-sections.cc
4705         (Output_section_element_dot_assignment::needs_output_section): New
4706         function.
4707
4708 2011-10-19  Ian Lance Taylor  <iant@google.com>
4709
4710         PR gold/13204
4711         * layout.cc (Layout::segment_precedes): Don't assert failure if a
4712         --section-start option was seen.
4713         * options.h (General_options::any_section_start): New function.
4714
4715 2011-10-18  David S. Miller  <davem@davemloft.net>
4716
4717         PR binutils/13301
4718         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
4719         member to track relocation locations that have moved during TLS
4720         reloc optimizations.
4721         (Target_sparc::Relocate::Relocate): Initialize to NULL.
4722         (Target_sparc::Relocate::relocate): Adjust view down by 4
4723         bytes if it matches reloc_adjust_addr_.
4724         (Target_sparc::Relocate::relocate_tls): Always move the
4725         __tls_get_addr call delay slot instruction forward 4 bytes when
4726         performing relaxation.
4727
4728 2011-10-18  Cary Coutant  <ccoutant@google.com>
4729
4730         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
4731         (Output_file::map_no_anonymous): Check for non-zero
4732         return code from posix_fallocate.
4733
4734 2011-10-17  Cary Coutant  <ccoutant@google.com>
4735
4736         PR gold/13245
4737         * plugin.cc (is_visible_from_outside): Check for symbols
4738         referenced from dynamic objects.
4739         * resolve.cc (Symbol_table::resolve): Don't count references
4740         from dynamic objects as references from real ELF files.
4741         * testsuite/plugin_test_2.sh: Adjust expected result.
4742
4743 2011-10-17  Cary Coutant  <ccoutant@google.com>
4744
4745         * gold.cc: Include timer.h.
4746         (queue_middle_tasks): Stamp time.
4747         (queue_final_tasks): Likewise.
4748         * main.cc (main): Store timer in parameters.  Print timers
4749         for each pass.
4750         * parameters.cc (Parameters::Parameters): Initialize timer_.
4751         (Parameters::set_timer): New function.
4752         (set_parameters_timer): New function.
4753         * parameters.h (Parameters::set_timer): New function.
4754         (Parameters::timer): New function.
4755         (Parameters::timer_): New data member.
4756         (set_parameters_timer): New function.
4757         * timer.cc (Timer::stamp): New function.
4758         (Timer::get_pass_time): New function.
4759         * timer.h (Timer::stamp): New function.
4760         (Timer::get_pass_time): New function.
4761         (Timer::pass_times_): New data member.
4762
4763 2011-10-17  Cary Coutant  <ccoutant@google.com>
4764
4765         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4766         task for members of lib groups.
4767
4768 2011-10-17  Cary Coutant  <ccoutant@google.com>
4769
4770         PR gold/13288
4771         * fileread.cc (File_read::find_view): Add assert.
4772         (File_read::make_view): Move bounds check (replace with assert)...
4773         (File_read::find_or_make_view): ... to here.
4774
4775 2011-10-12  Cary Coutant  <ccoutant@google.com>
4776
4777         * output.cc (Output_file::open_base_file): Handle case where
4778         ::read returns less than requested size.
4779
4780 2011-10-10  Cary Coutant  <ccoutant@google.com>
4781
4782         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4783         Initialize defined_count_.
4784         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4785         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4786         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4787         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4788         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4789         * incremental.h (Sized_relobj_incr::defined_count_): New data
4790         member.
4791         (Sized_incr_dynobj::defined_count_): New data member.
4792         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4793         Return zeroes instead of internal error.
4794
4795 2011-10-10  Cary Coutant  <ccoutant@google.com>
4796
4797         PR gold/13249
4798         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4799         (Output_reloc::symbol_value): Return PLT offset if flag is set.
4800         * output.h (class Output_reloc): Add use_plt_offset flag.
4801         (Output_reloc::type_): Adjust size of bit field.
4802         (Output_reloc::use_plt_offset_): New bit field.
4803         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4804         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4805         flag.  Adjust all callers.
4806         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4807         creating RELATIVE relocations.
4808
4809 2011-10-10  Nick Clifton  <nickc@redhat.com>
4810
4811         * po/es.po: Updated Spanish translation.
4812         * po/fi.po: Updated Finnish translation.
4813
4814 2011-10-03   Diego Novillo  <dnovillo@google.com>
4815
4816         * options.cc (parse_uint): Fix dereference of RETVAL.
4817
4818 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
4819
4820         * layout.h (section_order_map_): New member.
4821         (get_section_order_map): New member function.
4822         * output.cc (Output_section::add_input_section): Check for patterns
4823         only when --section-ordering-file is specified.
4824         * gold.cc (queue_middle_tasks): Delay updating order of sections till
4825         output_sections have been formed.
4826         * layout.cc (Layout_Layout): Initialize section_order_map_.
4827         * plugin.cc (update_section_order): Store order in order_map. Do not
4828         update the order.
4829         * testsuite/Makefile.am: Add test case for plugin_final_layout.
4830         * testsuite/Makefile.in: Regenerate.
4831         * testsuite/plugin_section_order.c: New file.
4832         * testsuite/plugin_final_layout.cc: New file.
4833         * testsuite/plugin_final_layout.sh: New file.
4834
4835 2011-09-29  Cary Coutant  <ccoutant@google.com>
4836
4837         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4838         Check for NULL.
4839         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
4840         symbols during incremental update.
4841         (Symbol_table::add_from_dynobj): Likewise.
4842
4843 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4844             Ian Lance Taylor  <iant@google.com>
4845
4846         * symtab.cc (Symbol_table::define_special_symbol): Always
4847         canonicalize version string.
4848
4849 2011-09-26  Cary Coutant  <ccoutant@google.com>
4850
4851         * gold.cc (queue_initial_tasks): Move option checks ...
4852         * options.cc (General_options::finalize): ... to here. Disable
4853         some options; make others fatal.
4854
4855 2011-09-26  Cary Coutant  <ccoutant@google.com>
4856
4857         gcc PR lto/47247
4858         * plugin.cc (get_symbols_v2): New function.
4859         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
4860         (is_referenced_from_outside): New function.
4861         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
4862         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
4863         (get_symbols): Pass version parameter.
4864         (get_symbols_v2): New function.
4865         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
4866         parameter.
4867         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
4868         (onload): Add LDPT_GET_SYMBOLS_V2.
4869         (all_symbols_read_hook): Use get_symbols_v2; check for
4870         LDPR_PREVAILING_DEF_IRONLY_EXP.
4871         * testsuite/plugin_test_3.sh: Update expected results.
4872
4873 2011-09-23  Simon Baldwin  <simonb@google.com>
4874
4875         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
4876         configuration options.
4877         * configure: Regenerate.
4878         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
4879         * Makefile.in: Regenerate.
4880         * testsuite/Makefile.in: Regenerate.
4881
4882 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
4883
4884         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
4885
4886 2011-09-19  Cary Coutant  <ccoutant@google.com>
4887
4888         * incremental.cc (can_incremental_update): Fix typo in comment.
4889         * incremental.h (can_incremental_update): Likewise.
4890
4891 2011-09-18  Cary Coutant  <ccoutant@google.com>
4892
4893         * incremental.cc (can_incremental_update): New function.
4894         * incremental.h (can_incremental_update): New function.
4895         * layout.cc (Layout::init_fixed_output_section): Call it.
4896         (Layout::make_output_section): Don't allow patch space in .eh_frame.
4897         * object.cc (Sized_relobj_file::do_layout): Call
4898         can_incremental_update.
4899
4900 2011-09-13  Cary Coutant  <ccoutant@google.com>
4901
4902         * configure.ac: Check for glibc support for gnu_indirect_function
4903         support with static linking, setting automake conditional
4904         IFUNC_STATIC.
4905         * Makefile.in: Regenerate.
4906         * configure: Regenerate.
4907
4908         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
4909         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
4910         for IFUNC_STATIC.
4911         * testsuite/Makefile.in: Regenerate.
4912
4913 2011-09-13  Cary Coutant  <ccoutant@google.com>
4914
4915         * incremental.cc (Sized_relobj_incr::do_layout): Call
4916         report_comdat_group for kept comdat sections.
4917         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4918         * testsuite/Makefile.in: Regenerate.
4919         * testsuite/incr_comdat_test_1.cc: New source file.
4920         * testsuite/incr_comdat_test_2_v1.cc: New source file.
4921         * testsuite/incr_comdat_test_2_v2.cc: New source file.
4922         * testsuite/incr_comdat_test_2_v3.cc: New source file.
4923
4924 2011-09-13  Ian Lance Taylor  <iant@google.com>
4925
4926         * object.cc (Sized_relobj_file::do_layout): Remove unused local
4927         variable external_symbols_offset.
4928
4929 2011-09-12  Ian Lance Taylor  <iant@google.com>
4930
4931         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4932         triggered if object has no symbols.
4933
4934 2011-09-09  David S. Miller  <davem@davemloft.net>
4935
4936         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4937         (Output_fill_debug_line::do_write): Likewise.
4938
4939 2011-08-29  Cary Coutant  <ccoutant@google.com>
4940
4941         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4942         casts to match formatting specs.
4943         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
4944
4945 2011-08-26  Cary Coutant  <ccoutant@google.com>
4946
4947         * layout.cc (Free_list::allocate): Provide guarantee of minimum
4948         remaining hole size when allocating.
4949         (Layout::make_output_section): Set fill methods for debug sections.
4950         * layout.h (Free_list::Free_list_node): Move from private to
4951         public.
4952         (Free_list::set_min_hole_size): New function.
4953         (Free_list::begin, Free_list::end): New functions.
4954         (Free_list::min_hole_): New data member.
4955         * output.cc: Include dwarf.h.
4956         (Output_fill_debug_info::do_minimum_hole_size): New function.
4957         (Output_fill_debug_info::do_write): New function.
4958         (Output_fill_debug_line::do_minimum_hole_size): New function.
4959         (Output_fill_debug_line::do_write): New function.
4960         (Output_section::Output_section): Initialize new data member.
4961         (Output_section::set_final_data_size): Ensure patch space is larger
4962         than minimum hole size.
4963         (Output_section::do_write): Fill holes in debug sections.
4964         * output.h (Output_fill): New class.
4965         (Output_fill_debug_info): New class.
4966         (Output_fill_debug_line): New class.
4967         (Output_section::set_free_space_fill): New function.
4968         (Output_section::free_space_fill_): New data member.
4969         * testsuite/Makefile.am (incremental_test_3): Add
4970         --incremental-patch option.
4971         (incremental_test_4): Likewise.
4972         (incremental_test_5): Likewise.
4973         (incremental_test_6): Likewise.
4974         (incremental_copy_test): Likewise.
4975         (incremental_common_test_1): Likewise.
4976         * testsuite/Makefile.in: Regenerate.
4977
4978 2011-08-26  Nick Clifton  <nickc@redhat.com>
4979
4980         * po/es.po: Updated Spanish translation.
4981
4982 2011-08-01  Cary Coutant  <ccoutant@google.com>
4983
4984         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4985         * gold/testsuite/Makefile.in: Regenerate.
4986         * gold/testsuite/justsyms_exec.c: New source file.
4987         * gold/testsuite/justsyms_lib.c: New source file.
4988
4989 2011-08-01  Cary Coutant  <ccoutant@google.com>
4990
4991         * layout.cc (Layout::set_segment_offsets): Don't realign text
4992         segment if -Ttext was specified.
4993         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4994         file type.
4995         * object.h (Sized_relobj_file::e_type): New function.
4996         (Sized_relobj_file::e_type_): New data member.
4997         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4998         base address for ET_EXEC files.
4999         * target.cc (Target::do_make_elf_object_implementation): Allow
5000         ET_EXEC files with --just-symbols option.
5001
5002 2011-07-28  Cary Coutant  <ccoutant@google.com>
5003
5004         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
5005         Add thread_number parameter.
5006         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
5007         * workqueue-threads.cc
5008         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
5009         current thread if its thread number is greater than desired thread
5010         count.
5011         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
5012         Add thread_number parameter.
5013         (Workqueue::should_cancel_thread): Likewise.
5014         (Workqueue::find_runnable_or_wait): Pass thread_number to
5015         should_cancel_thread.
5016         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
5017         parameter.
5018
5019 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
5020
5021         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
5022         only after checking if it cannot be forced local.
5023         * symtab.h (is_externally_visible): Check if the symbol is not forced
5024         local.
5025
5026 2011-07-15  Ian Lance Taylor  <iant@google.com>
5027
5028         * options.h (class General_options): Add --print-output-format.
5029         Move -EL next to -EB, for  better --help output.
5030         * target-select.cc: Include <cstdio>, "options.h", and
5031         "parameters.h".
5032         (Target_selector::do_target_bfd_name): New function.
5033         (print_output_format): New function.
5034         * target-select.h (class Target_selector): Update declarations.
5035         (Target_selector::target_bfd_name): New function.
5036         (print_output_format): Declare.
5037         * main.cc: Include "target-select.h".
5038         (main): Handle --print-output-format.
5039         * gold.cc: Include "target-select.h".
5040         (queue_initial_tasks): Handle --print-output-format when there are
5041         no input files.
5042         * parameters.cc (parameters_force_valid_target): Give a better
5043         error message if -EB/-EL does not match target.
5044         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
5045         function.
5046
5047 2011-07-15  Ian Lance Taylor  <iant@google.com>
5048
5049         * i386.cc (class Output_data_plt_i386): Add layout_ field.
5050         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
5051         (Output_data_plt_i386::do_write): Write address of .dynamic
5052         section to first entry in .got.plt section.
5053         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
5054         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5055         Initialize layout_.
5056         (Output_data_plt_x86_64::do_write): Write address of .dynamic
5057         section to first entry in .got.plt section.
5058         * layout.h (Layout::dynamic_section): New function.
5059
5060 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
5061
5062         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
5063         to claim_file call.
5064         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
5065         input_section_position_, and input_section_glob_.
5066         (read_layout_from_file): Call function section_ordering_specified.
5067         * layout.h (is_section_ordering_specified): New function.
5068         (section_ordering_specified): New function.
5069         (section_ordering_specified_): New boolean member.
5070         * main.cc(main): Call load_plugins after layout object is defined.
5071         * output.cc (Output_section::add_input_section): Use
5072         function section_ordering_specified to check if section ordering is
5073         needed.
5074         * output.cc (Output_section::add_relaxed_input_section): Use
5075         function section_ordering_specified to check if section ordering is
5076         needed.
5077         (Output_section::update_section_layout): New function.
5078         (Output_section::sort_attached_input_sections): Check if input section
5079         must be reordered.
5080         * output.h (Output_section::update_section_layout): New function.
5081         * plugin.cc (get_section_count): New function.
5082         (get_section_type): New function.
5083         (get_section_name): New function.
5084         (get_section_contents): New function.
5085         (update_section_order): New function.
5086         (allow_section_ordering): New function.
5087         (Plugin::load): Add the new interfaces to the transfer vector.
5088         (Plugin_manager::load_plugins): New parameter.
5089         (Plugin_manager::all_symbols_read): New parameter.
5090         (Plugin_manager::claim_file): New parameter. Save the elf object for
5091         unclaimed objects.
5092         (Plugin_manager::get_elf_object): New function.
5093         (Plugin_manager::get_view): Change to directly use the bool to check
5094         if get_view is called from claim_file_hook.
5095         * plugin.h (input_objects): New function
5096         (Plugin__manager::load_plugins): New parameter.
5097         (Plugin_manager::claim_file): New parameter.
5098         (Plugin_manager::get_elf_object): New function.
5099         (Plugin_manager::in_claim_file_handler): New function.
5100         (Plugin_manager::in_claim_file_handler_): New member.
5101         (layout): New function.
5102         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
5103         handler with an extra parameter. Make the elf object before calling
5104         claim_file handler.
5105         * testsuite/plugin_test.c (get_section_count): New function pointer.
5106         (get_section_type): New function pointer.
5107         (get_section_name): New function pointer.
5108         (get_section_contents): New function pointer.
5109         (update_section_order): New function pointer.
5110         (allow_section_ordering): New function pointer.
5111         (onload): Check if the new interfaces exist.
5112
5113 2011-07-13  Ian Lance Taylor  <iant@google.com>
5114
5115         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
5116         relro section.
5117         * x86_64.cc (Target_x86_64::got_section): Likewise.
5118         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
5119         (relro_now_test_SOURCES): New variable.
5120         (relro_now_test_DEPENDENCIES): New variable.
5121         (relro_now_test_LDFLAGS): New variable.
5122         (relro_now_test_LDADD): New variable.
5123         (relro_now_test.so): New target.
5124         * testsuite/Makefile.in: Rebuild.
5125
5126 2011-07-12  Ian Lance Taylor  <iant@google.com>
5127
5128         PR gold/12980
5129         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
5130         GLOB_DAT relocation rather than a RELATIVE relocation for a
5131         protected symbol when creating a shared library.
5132         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5133         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
5134         * testsuite/protected_main_1.cc (main): Test that protected
5135         function has same address.
5136
5137 2011-07-11  Ian Lance Taylor  <iant@google.com>
5138
5139         PR gold/12979
5140         * options.h (class General_options): Add -Bgroup.
5141         * options.cc (General_options::finalize): If -Bgroup is set,
5142         default to --unresolved-symbols=report-all.
5143         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
5144         * target-reloc.h (issue_undefined_symbol_error): Handle
5145         --unresolved-symbols=report-all.
5146
5147 2011-07-08  Ian Lance Taylor  <iant@google.com>
5148
5149         PR gold/11985
5150         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
5151         if linker script discards key sections.
5152         (Layout::create_dynamic_symtab): Likewise.
5153         (Layout::assign_local_dynsym_offsets): Likewise.
5154         (Layout::sized_create_version_sections): Likewise.
5155         (Layout::create_interp): Likewise.
5156         (Layout::finish_dynamic_section): Likewise.
5157         (Layout::set_dynamic_symbol_size): Likewise.
5158
5159 2011-07-08  Ian Lance Taylor  <iant@google.com>
5160
5161         PR gold/12386
5162         * options.h (class General_options): Add --unresolved-symbols.
5163         * target-reloc.h (issue_undefined_symbol_error): Check
5164         --unresolved-symbols.  Add comments.
5165
5166 2011-07-08  Ian Lance Taylor  <iant@google.com>
5167
5168         * testsuite/odr_violation2.cc (Ordering::operator()): Make
5169         expression more complex.
5170
5171 2011-07-08  Ian Lance Taylor  <iant@google.com>
5172
5173         PR gold/11317
5174         * target-reloc.h (issue_undefined_symbol_error): New inline
5175         function, broken out of relocate_section.
5176         (relocate_section): Call issue_undefined_symbol_error.
5177         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5178         there is no TLS segment if we are about to issue an undefined
5179         symbol error.
5180         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5181
5182 2011-07-08  Ian Lance Taylor  <iant@google.com>
5183
5184         PR gold/12279
5185         * resolve.cc (Symbol_table::should_override): Add fromtype
5186         parameter.  Change all callers.  Give error when linking together
5187         TLS and non-TLS symbol.
5188         (Symbol_table::should_override_with_special): Add fromtype
5189         parameter.  Change all callers.
5190         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5191         there is no TLS segment if we have reported some errors.
5192         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5193
5194 2011-07-08  Ian Lance Taylor  <iant@google.com>
5195
5196         PR gold/12372
5197         * target.h (Target::plt_address_for_global): New function.
5198         (Target::plt_address_for_local): New function.
5199         (Target::plt_section_for_global): Remove.
5200         (Target::plt_section_for_local): Remove.
5201         (Target::do_plt_address_for_global): New virtual function.
5202         (Target::do_plt_address_for_local): New virtual function.
5203         (Target::do_plt_section_for_global): Remove.
5204         (Target::do_plt_section_for_local): Remove.
5205         (Target::register_global_plt_entry): Add Symbol_table and Layout
5206         parameters.
5207         * output.cc (Output_data_got::Got_entry::write): Use
5208         plt_address_for_global and plt_address_for_local.
5209         * layout.cc (Layout::add_target_dynamic_tags): Use size and
5210         address of output section.
5211         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
5212         got_irelative_, and irelative_count_ fields.  Update
5213         declarations.
5214         (Output_data_plt_i386::has_irelative_section): New function.
5215         (Output_data_plt_i386::entry_count): Add irelative_count_.
5216         (Output_data_plt_i386::set_final_data_size): Likewise.
5217         (class Target_i386): Add got_irelative_ and rel_irelative_
5218         fields.  Update declarations.
5219         (Target_i386::Target_i386): Initialize new fields.
5220         (Target_i386::do_plt_address_for_global): New function replacing
5221         do_plt_section_for_global.
5222         (Target_i386::do_plt_address_for_local): New function replacing
5223         do_plt_section_for_local.
5224         (Target_i386::got_section): Create got_irelative_.
5225         (Target_i386::rel_irelative_section): New function.
5226         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
5227         fields.  Don't define __rel_iplt_{start,end}.
5228         (Output_data_plt_i386::add_entry): Add symtab and layout
5229         parameters.  Change all callers.  Use different PLT and GOT for
5230         IFUNC symbols.
5231         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
5232         layout parameters.  Change all callers.  Use different PLT and
5233         GOT.
5234         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
5235         (Output_data_plt_i386::rel_irelative): New function.
5236         (Output_data_plt_i386::address_for_global): New function.
5237         (Output_data_plt_i386::address_for_local): New function.
5238         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
5239         IRELATIVE GOT when changing IFUNC GOT entries.
5240         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
5241         reloc.
5242         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
5243         if we didn't create an IRELATIVE GOT.
5244         (Target_i386::Relocate::relocate): Use plt_address_for_global and
5245         plt_address_for_local.
5246         (Target_i386::do_dynsym_value): Use plt_address_for_global.
5247         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
5248         got_irelative_, and irelative_count_ fields.  Update
5249         declarations.
5250         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5251         Initialize new fields.  Remove symtab parameter.  Change all
5252         callers.
5253         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
5254         irelative_count_.
5255         (Output_data_plt_x86_64::has_irelative_section): New function.
5256         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
5257         (class Target_x86_64): Add got_irelative_ and rel_irelative_
5258         fields.  Update declarations.
5259         (Target_x86_64::Target_x86_64): Initialize new fields.
5260         (Target_x86_64::do_plt_address_for_global): New function replacing
5261         do_plt_section_for_global.
5262         (Target_x86_64::do_plt_address_for_local): New function replacing
5263         do_plt_section_for_local.
5264         (Target_x86_64::got_section): Create got_irelative_.
5265         (Target_x86_64::rela_irelative_section): New function.
5266         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
5267         all callers.  Don't create __rel_iplt_{start,end}.
5268         (Output_data_plt_x86_64::add_entry): Add symtab and layout
5269         parameters.  Change all callers.  Use different PLT and GOT for
5270         IFUNC symbols.
5271         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
5272         layout parameters.  Change all callers.  Use different PLT and
5273         GOT.
5274         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
5275         parameters.  Change all callers.  Use different PLT and GOT for
5276         IFUNC symbols.
5277         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
5278         (Output_data_plt_x86_64::rela_irelative): New function.
5279         (Output_data_plt_x86_64::address_for_global): New function.
5280         (Output_data_plt_x86_64::address_for_local): New function.
5281         (Output_data_plt_x86_64::set_final_data_size): Likewise.
5282         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
5283         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
5284         (Target_x86_64::register_global_plt_entry): Add symtab and layout
5285         parameters.
5286         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
5287         reloc.
5288         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
5289         symbols if we didn't create an IRELATIVE GOT.
5290         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
5291         plt_address_for_local.
5292         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
5293         * testsuite/ifuncvar1.c: New test file.
5294         * testsuite/ifuncvar2.c: New test file.
5295         * testsuite/ifuncvar3.c: New test file.
5296         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
5297         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
5298         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
5299         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
5300         * testsuite/Makefile.in: Rebuild.
5301
5302 2011-07-07  Cary Coutant  <ccoutant@google.com>
5303
5304         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
5305         (two_file_test_1_ndebug.o): Likewise.
5306         (two_file_test_1b_ndebug.o): Likewise.
5307         (two_file_test_2_ndebug.o): Likewise.
5308         (two_file_test_main_ndebug.o): Likewise.
5309         (incremental_test_2): Link with no-debug versions.
5310
5311 2011-07-06  Cary Coutant  <ccoutant@google.com>
5312
5313         * gold/incremental.cc
5314         (Output_section_incremental_inputs::write_info_blocks): Check for
5315         hidden and internal symbols.
5316
5317 2011-07-06  Cary Coutant  <ccoutant@google.com>
5318
5319         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
5320         Check disposition for startup file.
5321         (Incremental_inputs::report_command_line): Ignore
5322         --incremental-startup-unchanged option.
5323         * options.cc (General_options::parse_incremental_startup_unchanged):
5324         New function.
5325         (General_options::General_options): Initialize new data member.
5326         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
5327         (General_options): Add --incremental-startup-unchanged option.
5328         (General_options::incremental_startup_disposition): New function.
5329         (General_options::incremental_startup_disposition_): New data member.
5330
5331 2011-07-06  Cary Coutant  <ccoutant@google.com>
5332
5333         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
5334         input file index to Script_info ctor.
5335         (Sized_incremental_binary::do_file_has_changed): Find the
5336         command-line argument for files named in scripts.
5337         * incremental.h (Script_info::Script_info): New ctor
5338         with input file index.
5339         (Script_info::input_file_index): New function.
5340         (Script_info::input_file_index_): New data member.
5341         (Incremental_binary::get_library): Add const.
5342         (Incremental_binary::get_script_info): Add const.
5343         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
5344         * testsuite/Makefile.am (incremental_test_5): New test case.
5345         (incremental_test_6): New test case.
5346         * testsuite/Makefile.in: Regenerate.
5347
5348 2011-07-06  Cary Coutant  <ccoutant@google.com>
5349
5350         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
5351         debug output when command lines differ.
5352
5353 2011-07-06  Cary Coutant  <ccoutant@google.com>
5354
5355         * incremental.cc (Incremental_inputs::report_command_line): Ignore
5356         --incremental-patch option.
5357         * layout.cc (Free_list::allocate): Extend allocation beyond original
5358         end if enabled.
5359         (Layout::make_output_section): Mark sections that should get
5360         patch space.
5361         * options.cc (parse_percent): New function.
5362         * options.h (parse_percent): New function.
5363         (DEFINE_percent): New macro.
5364         (General_options): Add --incremental-patch option.
5365         * output.cc (Output_section::Output_section): Initialize new data
5366         members.
5367         (Output_section::add_input_section): Print section name when out
5368         of patch space.
5369         (Output_section::add_output_section_data): Likewise.
5370         (Output_section::set_final_data_size): Add patch space when
5371         doing --incremental-full.
5372         (Output_section::do_reset_address_and_file_offset): Remove patch
5373         space.
5374         (Output_segment::set_section_list_addresses): Print debug output
5375         only if --incremental-update.
5376         * output.h (Output_section::set_is_patch_space_allowed): New function.
5377         (Output_section::is_patch_space_allowed_): New data member.
5378         (Output_section::patch_space_): New data member.
5379         * parameters.cc (Parameters::incremental_full): New function.
5380         * parameters.h (Parameters::incremental_full): New function
5381         * testsuite/Makefile.am (incremental_test_2): Add test for
5382         --incremental-patch option.
5383         * testsuite/Makefile.in: Regenerate.
5384         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
5385         (t18): Remove function body.
5386
5387 2011-07-05  Doug Kwan  <dougkwan@google.com>
5388
5389         PR gold/12771
5390         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
5391         Arm_Address type for relocation result.
5392         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
5393         overflow check.
5394         (Arm_relocate_functions::abs32): Use unaligned access.
5395         (Arm_relocate_functions::rel32): Ditto.
5396         (Arm_relocate_functions::prel31): Ditto.
5397         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
5398         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
5399         static data relocations.
5400         * testsuite/Makefile.in: Regnerate.
5401         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
5402
5403 2011-07-05  Ian Lance Taylor  <iant@google.com>
5404
5405         PR gold/12392
5406         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
5407         symbols if necessary.
5408         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5409
5410 2011-07-05  Ian Lance Taylor  <iant@google.com>
5411
5412         PR gold/12952
5413         * resolve.cc (Symbol::override_base_with_special): Simply override
5414         version with special symbol version, ignoring previous version.
5415
5416 2011-07-05  Ian Lance Taylor  <iant@google.com>
5417
5418         * object.cc (Sized_relobj_file::include_section_group): Add
5419         information to comment about signature location.
5420
5421 2011-07-02  Ian Lance Taylor  <iant@google.com>
5422
5423         PR gold/12957
5424         * options.h (class General_options): Add -f and -F.
5425         * options.cc (General_options::finalize): Fatal error if -f/-F
5426         are used without -shared.
5427         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
5428
5429 2011-07-02  Ian Lance Taylor  <iant@google.com>
5430
5431         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
5432
5433 2011-07-01  Ian Lance Taylor  <iant@google.com>
5434
5435         PR gold/12525
5436         PR gold/12952
5437         * resolve.cc (Symbol::override_base_with_special): Don't override
5438         the version if the overriding symbol has a different name.
5439         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
5440         all callers.  If we give an error about an undefined version,
5441         define the base version if necessary.
5442         * dynobj.h (class Versions): Update declaration.
5443         * testsuite/weak_alias_test_5.cc: New file.
5444         * testsuite/weak_alias_test.script: New file.
5445         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
5446         and versioned_alias have the right value, and call t2.
5447         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
5448         weak_alias_test_5.so.
5449         (weak_alias_test_LDADD): Likewise.
5450         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
5451         * testsuite/Makefile.in: Rebuild.
5452
5453 2011-07-01  Ian Lance Taylor  <iant@google.com>
5454
5455         PR gold/12525
5456         * options.h (class General_options): Support -z notext.
5457         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
5458         -Wl,-z,notext.
5459         (two_file_shared_nonpic.so): Likewise.
5460         (two_file_shared_mixed.so): Likewise.
5461         (two_file_shared_mixed_1.so): Likewise.
5462         (weak_undef_lib_nonpic.so): Likewise.
5463         (alt/weak_undef_lib_nonpic.so): Likewise.
5464         (tls_test_shared_nonpic.so): Likewise.
5465         * testsuite/Makefile.in: Rebuild.
5466
5467 2011-07-01  Ian Lance Taylor  <iant@google.com>
5468
5469         PR gold/12525
5470         * configure.ac: Test whether static linking works, setting
5471         the automake conditional HAVE_STATIC.
5472         * testsuite/Makefile.am: Disable tests using -static if
5473         HAVE_STATIC is not true.
5474         * configure, testsuite/Makefile.in: Rebuild.
5475
5476 2011-07-01  Ian Lance Taylor  <iant@google.com>
5477
5478         PR gold/12525
5479         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
5480         Assert if we see DW_EH_PE_indirect.
5481         * target.h (Target::ehframe_datarel_base): New function.
5482         (Target::do_ehframe_datarel_base): New target function.
5483         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
5484         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
5485         function.
5486
5487 2011-07-01  Ian Lance Taylor  <iant@google.com>
5488
5489         PR gold/12571
5490         * options.h (class General_options): Add
5491         --ld-generated-unwind-info.
5492         * ehframe.cc (Fde::write): Add address parameter.  Change all
5493         callers.  If associated with PLT, fill in address and size.
5494         (Cie::set_output_offset): Only add merge mapping if there is an
5495         object.
5496         (Cie::write): Add address parameter.  Change all callers.
5497         (Eh_frame::add_ehframe_for_plt): New function.
5498         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
5499         input_offset_ fields into union u_, with new plt field.
5500         (Fde::Fde): Adjust for new union field.
5501         (Fde::Fde) [Output_data version]: New constructor.
5502         (Fde::add_mapping): Only add merge mapping if there is an object.
5503         (class Cie): Update declarations.
5504         (class Eh_frame): Declare add_ehframe_for_plt.
5505         * layout.cc (Layout::layout_eh_frame): Break out code into
5506         make_eh_frame_section, and call it.
5507         (Layout::make_eh_frame_section): New function.
5508         (Layout::add_eh_frame_for_plt): New function.
5509         * layout.h (class Layout): Update declarations.
5510         * merge.cc (Merge_map::add_mapping): Add assertion.
5511         * i386.cc: Include "dwarf.h".
5512         (class Output_data_plt_i386): Make first_plt_entry,
5513         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
5514         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5515         and plt_eh_frame_fde.
5516         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
5517         boundary.  Call add_eh_frame_for_plt if appropriate.
5518         * x86_64.cc: Include "dwarf.h".
5519         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
5520         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
5521         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5522         and plt_eh_frame_fde.
5523         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
5524         appropriate.
5525
5526 2011-06-29  Ian Lance Taylor  <iant@google.com>
5527
5528         PR gold/12629
5529         * object.cc (Sized_relobj_file::layout_section): Change shdr
5530         parameter to be const.
5531         (Sized_relobj_file::layout_eh_frame_section): New function, broken
5532         out of do_layout.
5533         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
5534         appropriate.  Call layout_eh_frame_section.
5535         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
5536         sections.
5537         * object.h (class Sized_relobj_file): Update declarations.
5538
5539 2011-06-29  Ian Lance Taylor  <iant@google.com>
5540
5541         PR gold/12652
5542         * script.cc (Token::integer_value): Accept trailing M/m/K/k
5543         modifier.
5544         (Lex::gather_token): Accept trailing M/m/K/k for integers.
5545
5546 2011-06-29  Ian Lance Taylor  <iant@google.com>
5547
5548         PR gold/12675
5549         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
5550         SHT_X86_64_UNWIND.
5551         * layout.cc (Layout::layout_eh_frame): Likewise.
5552
5553 2011-06-29  Ian Lance Taylor  <iant@google.com>
5554
5555         PR gold/12695
5556         * layout.cc (Layout::symtab_section_shndx): New function.
5557         * layout.h (class Layout): Declare symtab_section_shndx.
5558         * output.cc (Output_section::write_header): Call it.
5559
5560 2011-06-29  Ian Lance Taylor  <iant@google.com>
5561
5562         PR gold/12818
5563         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
5564         symbols which are not used in a relocation.
5565
5566 2011-06-28  Ian Lance Taylor  <iant@google.com>
5567
5568         PR gold/12898
5569         * layout.cc (Layout::segment_precedes): Don't crash if a linker
5570         script create indistinguishable segments.
5571         (Layout::set_segment_offsets): Use stable_sort when sorting
5572         segments.  Pass this to Compare_segments constructor.
5573         * layout.h (class Layout): Make segment_precedes non-static.
5574         (class Compare_segments): Change from struct to class.  Add
5575         layout_ field.  Add constructor.
5576         * script-sections.cc
5577         (Script_sections::attach_sections_using_phdrs_clause): Rename
5578         local orphan to is_orphan.  Don't report failure to put empty
5579         section in segment.  On attachment failure, report name of
5580         section, and attach to first PT_LOAD segment.
5581
5582 2011-06-28  Ian Lance Taylor  <iant@google.com>
5583
5584         PR gold/12934
5585         * target-select.cc (Target_selector::Target_selector): Add
5586         emulation parameter.  Change all callers.
5587         (select_target_by_bfd_name): Rename from select_target_by_name.
5588         Change all callers.
5589         (select_target_by_emulation): New function.
5590         (supported_emulation_names): New function.
5591         * target-select.h (class Target_selector): Add emulation_ field.
5592         Update declarations.
5593         (Target_selector::recognize_by_bfd_name): Rename from
5594         recognize_by_name.  Change all callers.
5595         (Target_selector::supported_bfd_names): Rename from
5596         supported_names.  Change all callers.
5597         (Target_selector::recognize_by_emulation): New function.
5598         (Target_selector::supported_emulations): New function.
5599         (Target_selector::emulation): New function.
5600         (Target_selector::do_recognize_by_bfd_name): Rename from
5601         do_recognize_by_name.  Change all callers.
5602         (Target_selector::do_supported_bfd_names): Rename from
5603         do_supported_names.  Change all callers.
5604         (Target_selector::do_recognize_by_emulation): New function.
5605         (Target_selector::do_supported_emulations): New function.
5606         (select_target_by_bfd_name): Change name in declaration.
5607         (select_target_by_emulation): Declare.
5608         (supported_emulation_names): Declare.
5609         * parameters.cc (parameters_force_valid_target): Try to find
5610         target based on emulation from -m option.
5611         * options.h (class General_options): Change doc string for -m.
5612         * options.cc (help): Print emulations.
5613         (General_options::parse_V): Likewise.
5614         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
5615         Add emulation parameter.  Change all callers.
5616
5617 2011-06-28  Ian Lance Taylor  <iant@google.com>
5618
5619         * target.h (class Target): Add osabi_ field.
5620         (Target::osabi): New function.
5621         (Target::set_osabi): New function.
5622         (Target::Target): Initialize osabi_.
5623         (Target::do_adjust_elf_header): Make pure virtual.
5624         (Sized_target::do_adjust_elf_header): Declare.
5625         * target.cc (Sized_target::do_adjust_elf_header): New function.
5626         (class Sized_target): Instantiate all versions.
5627         * freebsd.h (class Target_freebsd): Remove.
5628         (Target_selector_freebsd::do_recognize): Call set_osabi on
5629         Target.
5630         (Target_selector_freebsd::do_recognize_by_name): Likewise.
5631         (Target_selector_freebsd::set_osabi): Remove.
5632         * i386.cc (class Target_i386): Inherit from Sized_target rather
5633         than Target_freebsd.
5634         * x86_64.cc (class Target_x86_64): Likewise.
5635
5636 2011-06-28  Ian Lance Taylor  <iant@google.com>
5637
5638         * target.h (Target::can_check_for_function_pointers): Rewrite.
5639         Make non-virtual.
5640         (Target::can_icf_inline_merge_sections): Likewise.
5641         (Target::section_may_have_icf_unsafe_poineters): Likewise.
5642         (Target::Target_info): Add can_icf_inline_merge_sections field.
5643         (Target::do_can_check_for_function_pointers): New virtual
5644         function.
5645         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
5646         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
5647         from can_check_for_function_pointers, move in file.
5648         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
5649         section_may_have_icf_unsafe_poineters, move in file.
5650         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
5651         * i386.cc (Target_i386::do_can_check_for_function_pointers):
5652         Rename from can_check_for_function_pointers, move in file.
5653         (Target_i386::can_icf_inline_merge_sections): Remove.
5654         (Target_i386::i386_info): Initialize
5655         can_icf_inline_merge_sections.
5656         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
5657         Initialize can_icf_inline_merge_sections.
5658         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
5659         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
5660         Rename from can_check_for_function_pointers, move in file.
5661         (Target_x86_64::can_icf_inline_merge_sections): Remove.
5662         (Target_x86_64::x86_64_info): Initialize
5663         can_icf_inline_merge_sections.
5664         * testsuite/testfile.cc (Target_test::test_target_info):
5665         Likewise.
5666         * icf.cc (get_section_contents): Correct formatting.
5667
5668 2011-06-27  Ian Lance Taylor  <iant@google.com>
5669
5670         * symtab.cc (Symbol::versioned_name): New function.
5671         (Symbol_table::add_to_final_symtab): Use versioned_name when
5672         appropriate.
5673         (Symbol_table::sized_write_symbol): Likewise.
5674         * symtab.h (class Symbol): Declare versioned_name.
5675         * stringpool.h (class Stringpool_template): Add variant of add
5676         which takes a std::basic_string.
5677         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
5678         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
5679         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
5680         (ver_test_12.o): New target.
5681         * testsuite/Makefile.in: Rebuild.
5682
5683 2011-06-27  Doug Kwan  <dougkwan@google.com>
5684
5685         * arm.cc (Arm_relocate_functions::thm_jump8,
5686         Arm_relocate_functions::thm_jump11): Use a wider signed
5687         type to compute offset.
5688         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
5689         arm_thm_jump8.
5690         * testsuite/Makefile.in: Regenerate.
5691         * testsuite/arm_branch_in_range.sh: Check test results of
5692         arm_thm_jump11 and arm_thm_jump8.
5693         * testsuite/arm_thm_jump11.s: New test source file.
5694         * testsuite/arm_thm_jump11.t: New linker script.
5695         * testsuite/arm_thm_jump8.s: New test source file.
5696         * testsuite/arm_thm_jump8.t: New linker script.
5697
5698 2011-06-24  Ian Lance Taylor  <iant@google.com>
5699
5700         * layout.cc: Include "object.h".
5701         (ctors_sections_in_init_array): New static variable.
5702         (Layout::is_ctors_in_init_array): New function.
5703         (Layout::layout): Add entry to ctors_sections_in_init_array if
5704         appropriate.
5705         * layout.h (class Layout): Declare is_ctors_in_init_array.
5706         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
5707         is_ctors_reverse_view is set.
5708         (Sized_relobj_file::write_sections): Add layout parameter.  Change
5709         all callers.  Set is_ctors_reverse_view field of View_size.
5710         (Sized_relobj_file::reverse_words): New function.
5711         * object.h (Sized_relobj_file::View_size): Add
5712         is_ctors_reverse_view field.
5713         (class Sized_relobj_file): Update declarations.
5714         * testsuite/initpri3.c: New test.
5715         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
5716         initpri3b.
5717         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
5718         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
5719         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
5720         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
5721         * testsuite/Makefile.in: Rebuild.
5722
5723 2011-06-24  Cary Coutant  <ccoutant@google.com>
5724
5725         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
5726         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
5727         (debug_msg_cdebug.err): New targets.
5728         * testsuite/Makefile.in: Regenerate.
5729         * testsuite/debug_msg.sh: Check output of link with compressed debug.
5730         Fix checks for link with shared library.
5731
5732 2011-06-24  Doug Kwan  <dougkwan@google.com>
5733
5734         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
5735         skip empty text sections.
5736         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
5737
5738 2011-06-22  Ian Lance Taylor  <iant@google.com>
5739
5740         PR gold/12910
5741         * options.h (class General_options): Add --ctors-in-init-array.
5742         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
5743         friends as SHT_PROGBITS for merging sections.
5744         (Layout::layout): Remove special handling of .init_array and
5745         friends.  Don't sort if doing relocatable link.  Sort for .ctors
5746         and .dtors if ctors_in_init_array.
5747         (Layout::make_output_section): Force correct section types for
5748         .init_array and friends.  Don't sort if doing relocatable link,
5749         Don't sort .ctors and .dtors if ctors_in_init_array.
5750         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
5751         (Layout::output_section_name): Add relobj parameter.  Change all
5752         callers.  Handle .ctors. and .dtors. in code rather than table.
5753         Handle .ctors and .dtors if ctors_in_init_array.
5754         (Layout::match_file_name): New function, moved from output.cc.
5755         * layout.h (class Layout): Update declarations.
5756         * output.cc: Include "layout.h".
5757         (Input_section_sort_entry::get_priority): New function.
5758         (Input_section_sort_entry::match_file_name): Just call
5759         Layout::match_file_name.
5760         (Output_section::Input_section_sort_init_fini_compare::operator()):
5761         Handle .ctors and .dtors.  Sort by explicit priority rather than
5762         by name.
5763         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
5764         * testsuite/initpri2.c: New test.
5765         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5766         (check_PROGRAMS): Add initpri2.
5767         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5768         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5769         * configure, testsuite/Makefile.in: Rebuild.
5770
5771 2011-06-19  Ian Lance Taylor  <iant@google.com>
5772
5773         PR gold/12880
5774         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5775         .interp section to a PT_INTERP segment even if we have seen a
5776         --dynamic-linker option.  Don't do it if we have seen a PHDRS
5777         clause in a linker script.
5778         (Layout::finalize): Don't create a .interp section if we've
5779         already create a PT_INTERP segment.
5780         (Layout::create_interp): Always call choose_output_section (revert
5781         patch of 2011-06-17).  Don't create PT_INTERP segment.
5782         * script-sections.cc
5783         (Script_sections::create_note_and_tls_segments): Add a .interp
5784         section to a PT_INTERP segment even if we have seen a
5785         --dynamic-linker option.
5786
5787 2011-06-18  Ian Lance Taylor  <iant@google.com>
5788
5789         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5790         merely because a non-PT_LOAD segment has a dynamic reloc.
5791
5792 2011-06-18  Ian Lance Taylor  <iant@google.com>
5793
5794         * layout.cc (Layout::finish_dynamic_section): Don't create
5795         DT_FLAGS entry if not needed.
5796
5797 2011-06-18  Ian Lance Taylor  <iant@google.com>
5798
5799         PR gold/12745
5800         * layout.cc (Layout::layout_eh_frame): Correct handling of
5801         writable .eh_frame section.
5802
5803 2011-06-17  Ian Lance Taylor  <iant@google.com>
5804
5805         PR gold/12893
5806         * resolve.cc (Symbol_table::resolve): Don't give an error if a
5807         symbol is redefined with the exact same object and value.
5808
5809 2011-06-17  Ian Lance Taylor  <iant@google.com>
5810
5811         PR gold/12880
5812         * layout.h (class Layout): Add interp_segment_ field.
5813         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5814         (Layout::attach_allocated_section_to_segment): If making shared
5815         library, put .interp section in PT_INTERP segment.
5816         (Layout::finalize): Also call create_interp if -dynamic-linker
5817         option was used.
5818         (Layout::create_interp): Assert that there is no PT_INTERP
5819         segment.  If not using a SECTIONS clause, use make_output_section.
5820         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5821         * script-sections.cc
5822         (Script_sections::create_note_and_tls_segments): If making shared
5823         library, put .interp section in PT_INTERP segment.
5824
5825 2011-06-17  Ian Lance Taylor  <iant@google.com>
5826
5827         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5828         when making a shared library.
5829
5830 2011-06-17  Ian Lance Taylor  <iant@google.com>
5831
5832         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
5833         parameter.  Change all callers.  Don't issue warning about PC32
5834         against locally defined symbol.
5835
5836 2011-06-16  Ian Lance Taylor  <iant@google.com>
5837
5838         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
5839         occurs in same object.
5840
5841 2011-06-14  Alan Modra  <amodra@gmail.com>
5842
5843         * po/POTFILES.in: Regenerate.
5844
5845 2011-06-09  Ian Lance Taylor  <iant@google.com>
5846
5847         * script-sections.cc
5848         (Orphan_output_section::set_section_addresses): For a relocatable
5849         link set address to 0.
5850
5851 2011-06-09  Cary Coutant  <ccoutant@google.com>
5852
5853         PR gold/12804
5854         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
5855         used with --compress-debug-sections.
5856         * gold/object.cc (Sized_relobj_file::do_layout): Report
5857         uncompressed size of compressed input sections.
5858
5859 2011-06-08  Cary Coutant  <ccoutant@google.com>
5860
5861         PR gold/12804
5862         * testsuite/two_file_test_2_v1.cc: Change initialization of
5863         v2 to keep it in .data.
5864
5865 2011-06-07  Cary Coutant  <ccoutant@google.com>
5866
5867         * common.cc (Symbol_table::do_allocate_commons_list): Call
5868         gold_fallback.
5869         * errors.cc (Errors::fatal): Adjust call to gold_exit.
5870         (Errors::fallback): New function.
5871         (gold_fallback): New function.
5872         * errors.h (Errors::fallback): New function.
5873         * gold.cc (gold_exit): Change status parameter to enum; adjust
5874         all callers.
5875         (queue_initial_tasks): Call gold_fallback.
5876         * gold.h: Include cstdlib.
5877         (Exit_status): New enum type.
5878         (gold_exit): Change status parameter to enum.
5879         (gold_fallback): New function.
5880         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
5881         (Layout::create_symtab_sections): Likewise.
5882         (Layout::create_shdrs): Likewise.
5883         * main.cc (main): Adjust call to gold_exit.
5884         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
5885         (Output_data_got::add_got_entry_pair): Likewise.
5886         (Output_section::add_input_section): Likewise.
5887         (Output_section::add_output_section_data): Likewise.
5888         (Output_segment::set_section_list_addresses): Likewise.
5889         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
5890
5891 2011-06-07  Cary Coutant  <ccoutant@google.com>
5892
5893         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
5894         for incremental links.
5895         * output.cc (Output_segment::set_section_list_addresses): Remove
5896         FIXME and test for TLS or BSS.
5897
5898 2011-06-07  Cary Coutant  <ccoutant@google.com>
5899
5900         * testsuite/Makefile.am: Add incremental_copy_test,
5901         incremental_common_test_1.
5902         * testsuite/Makefile.in: Regenerate.
5903         * testsuite/common_test_1_v1.c: New source file.
5904         * testsuite/common_test_1_v2.c: New source file.
5905         * testsuite/copy_test_v1.cc: New source file.
5906
5907 2011-06-07  Cary Coutant  <ccoutant@google.com>
5908
5909         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
5910         update, allocate common from bss section's free list.
5911         * incremental-dump.cc (dump_incremental_inputs): Print flag for
5912         linker-defined symbols.
5913         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5914         Skip GOT and PLT entries that are no longer referenced.
5915         (Output_section_incremental_inputs::write_info_blocks): Mark
5916         linker-defined symbols.
5917         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5918         * output.cc (Output_section::allocate): New function.
5919         * output.h (Output_section::allocate): New function.
5920         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5921         linker-defined symbols.
5922         (Symbol::override_base_with_special): Copy is_predefined_ flag.
5923         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5924         (Symbol::init_base_output_data): Likewise.
5925         (Symbol::init_base_output_segment): Likewise.
5926         (Symbol::init_base_constant): Likewise.
5927         (Sized_symbol::init_output_data): Likewise.
5928         (Sized_symbol::init_output_segment): Likewise.
5929         (Sized_symbol::init_constant): Likewise.
5930         (Symbol_table::do_define_in_output_data): Likewise.
5931         (Symbol_table::do_define_in_output_segment): Likewise.
5932         (Symbol_table::do_define_as_constant): Likewise.
5933         * symtab.h (Symbol::is_predefined): New function.
5934         (Symbol::init_base_output_data): Add is_predefined parameter.
5935         (Symbol::init_base_output_segment): Likewise.
5936         (Symbol::init_base_constant): Likewise.
5937         (Symbol::is_predefined_): New data member.
5938         (Sized_symbol::init_output_data): Add is_predefined parameter.
5939         (Sized_symbol::init_output_segment): Likewise.
5940         (Sized_symbol::init_constant): Likewise.
5941         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5942
5943 2011-06-07  Cary Coutant  <ccoutant@google.com>
5944
5945         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
5946         instead of emit_copy_reloc.
5947         (Copy_relocs::emit_copy_reloc): Refactor.
5948         (Copy_relocs::make_copy_reloc): New function.
5949         (Copy_relocs::add_copy_reloc): Remove.
5950         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
5951         section.
5952         (Copy_relocs::make_copy_reloc): New function.
5953         (Copy_relocs::add_copy_reloc): Remove.
5954         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
5955         unchanged input files.
5956         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
5957         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
5958         Reserve BSS space for COPY relocations.
5959         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5960         (Output_section_incremental_inputs::write_info_blocks): Record
5961         whether a symbol is copied from a shared object.
5962         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
5963         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
5964         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
5965         (Incremental_input_entry_reader::get_output_symbol_index): Add
5966         is_copy parameter.
5967         (Incremental_binary::emit_copy_relocs): New function.
5968         (Incremental_binary::do_emit_copy_relocs): New function.
5969         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5970         new data member.
5971         (Sized_incremental_binary::add_copy_reloc): New function.
5972         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5973         (Sized_incremental_binary::Copy_reloc): New struct.
5974         (Sized_incremental_binary::Copy_relocs): New typedef.
5975         (Sized_incremental_binary::copy_relocs_): New data member.
5976         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5977         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5978         * target.h (Sized_target::emit_copy_reloc): New function.
5979         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5980
5981 2011-06-02  Cary Coutant  <ccoutant@google.com>
5982
5983         PR gold/12163
5984         * gold/archive.cc (Archive::Archive): Initialize new data member.
5985         (Archive::include_all_members): Return if archive has already been
5986         included.
5987         * gold/archive.h (Archive::include_all_members_): New data member.
5988
5989 2011-06-02  Nick Clifton  <nickc@redhat.com>
5990
5991         * dynobj.h: Fix spelling mistake in comment.
5992         * output.cc: Likewise.
5993
5994 2011-05-31  Doug Kwan  <dougkwan@google.com>
5995             Asier Llano
5996
5997         PR gold/12826
5998         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5999         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
6000         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
6001         redundant arm_exidx_test.so.
6002         * testsuite/Makefile.in: Regenerate.
6003         (check_SCRIPTS): Add pr12826.sh
6004         (check_DATA): Add pr12826.stdout
6005         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
6006         * testsuite/pr12826.sh: New file.
6007         * testsuite/pr12826_1.s: Ditto.
6008         * testsuite/pr12826_1.s: Ditto.
6009
6010 2011-05-30  Ian Lance Taylor  <iant@google.com>
6011
6012         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
6013         sections.
6014
6015 2011-05-29  Ian Lance Taylor  <iant@google.com>
6016
6017         PR gold/12804
6018         * testsuite/Makefile.am: Use different file name for two_file_test
6019         temporary file for each incremental test.
6020         * testsuite/Makefile.in: Rebuild.
6021
6022 2011-05-29  Ian Lance Taylor  <iant@google.com>
6023
6024         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
6025         binary input file is empty.
6026
6027 2011-05-27  Ian Lance Taylor  <iant@google.com>
6028
6029         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
6030         (ver_test_9.so): Likewise.
6031         * testsuite/Makefile.in: Rebuild.
6032
6033 2011-05-26 Cary Coutant  <ccoutant@google.com>
6034
6035         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
6036         * incremental.cc (Incremental_inputs::report_input_section): Fix
6037         comment, indentation.
6038         (Incremental_inputs::report_comdat_group): New function.
6039         (Output_section_incremental_inputs::set_final_data_size): Adjust size
6040         of data for incremental input file entry.
6041         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
6042         group count, COMDAT group signatures.
6043         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
6044         an unchanged input file.
6045         * incremental.h (Incremental_object_entry::Incremental_object_entry):
6046         Initialize new data member.
6047         (Incremental_object_entry::add_comdat_group): New function.
6048         (Incremental_object_entry::get_comdat_group_count): New function.
6049         (Incremental_object_entry::get_comdat_signature_key): New function.
6050         (Incremental_object_entry::groups_): New data member.
6051         (Incremental_inputs::report_comdat_group): New function.
6052         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
6053         data for incremental input file entry.
6054         (Incremental_input_entry_reader::get_comdat_group_count): New function.
6055         (Incremental_input_entry_reader::get_input_section): Adjust size of
6056         data for incremental input file entry.
6057         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
6058         (Incremental_input_entry_reader::get_comdat_group_signature): New
6059         function.
6060         * object.cc (Sized_relobj::include_section_group): Report kept
6061         COMDAT groups for incremental links.
6062
6063 2011-05-24  David Meyer  <pdox@google.com>
6064
6065         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
6066         with name parameter.  Add found_name parameter.
6067         * fileread.cc (Input_file::find_file): Adjust code accordingly.
6068         * dirsearch.h (class Dirsearch): Update declaration.
6069
6070 2011-05-24  Ian Lance Taylor  <iant@google.com>
6071
6072         * archive.cc (Library_base::should_include_member): Pull in object
6073         from archive if it defines the entry symbol.
6074         * parameters.cc (Parameters::entry): New function.
6075         * parameters.h (class Parameters): Declare entry.
6076         * output.h (class Output_file_header): Remove entry_ field.
6077         * output.cc (Output_file_header::Output_file_header): Remove entry
6078         parameter.  Change all callers.
6079         (Output_file_header::entry): Use parameters->entry.
6080         * gold.cc (queue_middle_tasks): Likewise.
6081         * plugin.cc (Plugin_hook::run): Likewise.
6082
6083 2011-05-24 Cary Coutant  <ccoutant@google.com>
6084
6085         * gold.cc (queue_initial_tasks): Pass incremental base filename
6086         to Output_file::open_base_file; don't print error message.
6087         * incremental-dump.cc (main): Adjust call to
6088         Output_file::open_for_modification.
6089         * incremental-dump.cc (main): Likewise.
6090         * incremental.cc (Incremental_inputs::report_command_line):
6091         Ignore --incremental-base option when comparing command lines.
6092         Ignore parameter when given as separate argument.
6093         * options.h (class General_options): Add --incremental-base.
6094         * output.cc (Output_file::Output_file):
6095         (Output_file::open_base_file): Add base_name and writable parameters;
6096         read base file into new file; print error message here.
6097         (Output_file::map_no_anonymous): Add writable parameter; adjust all
6098         callers.
6099         * output.h (Output_file::open_for_modification): Rename to...
6100         (Output_file::open_base_file): ...this; add base_name and
6101         writable parameters; adjust all callers.
6102         (Output_file::map_no_anonymous): Add writable parameter; adjust all
6103         callers.
6104         * testsuite/Makefile.am (incremental_test_4): Test
6105         --incremental-base.
6106         * testsuite/Makefile.in: Regenerate.
6107
6108 2011-05-24 Cary Coutant  <ccoutant@google.com>
6109
6110         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
6111         incremental_test_4.
6112         * testsuite/Makefile.in: Regenerate.
6113         * testsuite/two_file_test_1_v1.cc: New test source file.
6114         * testsuite/two_file_test_1b_v1.cc: New test source file.
6115         * testsuite/two_file_test_2_v1.cc: New test source file.
6116
6117 2011-05-24 Cary Coutant  <ccoutant@google.com>
6118
6119         * dynobj.h (Dynobj::do_dynobj): New function.
6120         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
6121         flag and soname for shared objects.
6122         * incremental.cc (Incremental_inputs::report_object): Make
6123         either Incremental_object_entry or Incremental_dynobj_entry; add
6124         soname to string table.
6125         (Incremental_inputs::report_input_section): Add assertion.
6126         (Output_section_incremental_inputs::set_final_data_size): Adjust
6127         type of input file entry for shared libraries; adjust size of
6128         shared library info entry.
6129         (Output_section_incremental_inputs::write_input_files): Write
6130         as_needed flag for shared libraries.
6131         (Output_section_incremental_inputs::write_info_blocks): Adjust type
6132         of input file entry for shared libraries; write soname.
6133         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
6134         soname from incremental info.
6135         * incremental.h (enum Incremental_input_flags): Add
6136         INCREMENTAL_INPUT_AS_NEEDED.
6137         (Incremental_input_entry::Incremental_input_entry): Initialize new
6138         data member.
6139         (Incremental_input_entry::set_as_needed): New function.
6140         (Incremental_input_entry::as_needed): New function.
6141         (Incremental_input_entry::do_dynobj_entry): New function.
6142         (Incremental_input_entry::as_needed_): New data member.
6143         (Incremental_object_entry::Incremental_object_entry): Don't check
6144         for shared library.
6145         (Incremental_object_entry::do_type): Likewise.
6146         (class Incremental_dynobj_entry): New class.
6147         (Incremental_input_entry_reader::as_needed): New function.
6148         (Incremental_input_entry_reader::get_soname): New function.
6149         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
6150         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
6151         size of shared library info entry.
6152         * layout.cc (Layout::finish_dynamic_section): Don't test for
6153         incremental link when adding DT_NEEDED entries.
6154         * object.h (Object::Object): Initialize new data member.
6155         (Object::dynobj): New function.
6156         (Object::set_as_needed): New function.
6157         (Object::as_needed): New function.
6158         (Object::do_dynobj): New function.
6159         (Object::as_needed_): New data member.
6160
6161 2011-05-24 Cary Coutant  <ccoutant@google.com>
6162
6163         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
6164         info; adjust display of GOT entries.
6165         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6166         vector of input objects; remove file_status_.
6167         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
6168         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
6169         got_plt reader; call target hooks to reserve GOT entries.
6170         (Output_section_incremental_inputs::set_final_data_size): Adjust size
6171         of input file info header and GOT info entry.
6172         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
6173         relocation info.
6174         (Got_plt_view_info::got_descriptor): Remove.
6175         (Got_plt_view_info::sym_index): New data member.
6176         (Got_plt_view_info::input_index): New data member.
6177         (Local_got_offset_visitor::visit): Write input file index.
6178         (Global_got_offset_visitor::visit): Write 0 for input file index.
6179         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
6180         with sym_index and input_index.
6181         (Output_section_incremental_inputs::write_got_plt): Adjust size of
6182         incremental info GOT entry; replace got_descriptor with input_index.
6183         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
6184         map from input file index to object.
6185         (Sized_relobj_incr::do_layout): Replace direct data member reference
6186         with accessor function.
6187         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
6188         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
6189         Adjust size of input file info header.
6190         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
6191         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
6192         (Incremental_input_entry_reader::get_input_section): Adjust size of
6193         input file info header.
6194         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
6195         of incremental info GOT entry.
6196         (Incremental_got_plt_reader::get_got_desc): Remove.
6197         (Incremental_got_plt_reader::get_got_symndx): New function.
6198         (Incremental_got_plt_reader::get_got_input_index): New function.
6199         (Sized_incremental_binary::Sized_incremental_binary): Remove
6200         file_status_; add input_objects_.
6201         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
6202         (Sized_incremental_binary::set_file_is_unchanged): Remove.
6203         (Sized_incremental_binary::file_is_unchanged): Remove.
6204         (Sized_incremental_binary::set_input_object): New function.
6205         (Sized_incremental_binary::input_object): New function.
6206         (Sized_incremental_binary::file_status_): Remove.
6207         (Sized_incremental_binary::input_objects_): New data member.
6208         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
6209         references.
6210         (Sized_relobj_incr::invalid_address): Move to base class.
6211         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
6212         class.
6213         (Sized_relobj_incr::do_output_section_offset): Likewise.
6214         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
6215         (Sized_relobj_incr::section_offsets_): Likewise.
6216         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
6217         function.
6218         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
6219         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
6220         with accessor function.
6221         (Sized_relobj_file::do_layout): Likewise.
6222         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
6223         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
6224         (Sized_relobj_file::compute_final_local_value): Replace refs to
6225         section_offsets_ with accessor function.
6226         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
6227         * object.h (Relobj::Relobj): Initialize new data members.
6228         (Relobj::add_dyn_reloc): New function.
6229         (Relobj::first_dyn_reloc): New function.
6230         (Relobj::dyn_reloc_count): New function.
6231         (Relobj::first_dyn_reloc_): New data member.
6232         (Relobj::dyn_reloc_count_): New data member.
6233         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
6234         references.
6235         (Sized_relobj::Address): New typedef.
6236         (Sized_relobj::invalid_address): Move here from child class.
6237         (Sized_relobj::Sized_relobj): Initialize new data members.
6238         (Sized_relobj::sized_relobj): New function.
6239         (Sized_relobj::is_output_section_offset_invalid): Move here from
6240         child class.
6241         (Sized_relobj::get_output_section_offset): Likewise.
6242         (Sized_relobj::local_has_got_offset): Likewise.
6243         (Sized_relobj::local_got_offset): Likewise.
6244         (Sized_relobj::set_local_got_offset): Likewise.
6245         (Sized_relobj::do_for_all_local_got_entries): Likewise.
6246         (Sized_relobj::clear_got_offsets): New function.
6247         (Sized_relobj::section_offsets): Move here from child class.
6248         (Sized_relobj::do_output_section_offset): Likewise.
6249         (Sized_relobj::do_set_section_offset): Likewise.
6250         (Sized_relobj::Local_got_offsets): Likewise.
6251         (Sized_relobj::local_got_offsets_): Likewise.
6252         (Sized_relobj::section_offsets_): Likewise.
6253         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
6254         references.
6255         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
6256         class.
6257         (Sized_relobj_file::sized_relobj): New function
6258         (Sized_relobj_file::local_has_got_offset): Move to base class.
6259         (Sized_relobj_file::local_got_offset): Likewise.
6260         (Sized_relobj_file::set_local_got_offset): Likewise.
6261         (Sized_relobj_file::get_output_section_offset): Likewise.
6262         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
6263         (Sized_relobj_file::do_output_section_offset): Likewise.
6264         (Sized_relobj_file::do_set_section_offset): Likewise.
6265         (Sized_relobj_file::Local_got_offsets): Likewise.
6266         (Sized_relobj_file::local_got_offsets_): Likewise.
6267         (Sized_relobj_file::section_offsets_): Likewise.
6268         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
6269         (all constructors).
6270         (set_needs_dynsym_index): Convert relobj to derived class pointer.
6271         (Output_reloc::get_symbol_index): Likewise.
6272         (Output_reloc::local_section_offset): Likewise.
6273         (Output_reloc::get_address): Likewise.
6274         (Output_reloc::symbol_value): Likewise.
6275         (Output_data_got::reserve_slot): Move to class definition.
6276         (Output_data_got::reserve_local): New function.
6277         (Output_data_got::reserve_slot_for_global): Remove.
6278         (Output_data_got::reserve_global): New function.
6279         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
6280         (all constructors, two instantiations).
6281         (Output_reloc::get_relobj): New function (two instantiations).
6282         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
6283         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
6284         (Output_data_reloc::add_global): Adjust type of relobj.
6285         (Output_data_reloc::add_global_relative): Likewise.
6286         (Output_data_reloc::add_symbolless_global_addend): Likewise.
6287         (Output_data_reloc::add_local): Likewise.
6288         (Output_data_reloc::add_local_relative): Likewise.
6289         (Output_data_reloc::add_symbolless_local_addend): Likewise.
6290         (Output_data_reloc::add_local_section): Likewise.
6291         (Output_data_reloc::add_output_section): Likewise.
6292         (Output_data_reloc::add_absolute): Likewise.
6293         (Output_data_reloc::add_target_specific): Likewise.
6294         (Output_data_got::reserve_slot): Move definition here.
6295         (Output_data_got::reserve_local): New function.
6296         (Output_data_got::reserve_global): New function.
6297         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
6298         section_offsets_ with accessor function.
6299         (Sized_relobj_file::write_sections): Likewise.
6300         (Sized_relobj_file::do_relocate_sections): Likewise.
6301         * target.h (Sized_target::reserve_local_got_entry): New function.
6302         (Sized_target::reserve_global_got_entry): New function.
6303         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
6304         (Target_x86_64::reserve_global_got_entry): New function.
6305         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
6306
6307 2011-05-23 Cary Coutant  <ccoutant@google.com>
6308
6309         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
6310         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
6311         bit when checking got_type.
6312         * incremental.cc (Sized_incremental_binary::setup_readers):
6313         Store symbol table and string table locations; initialize bit vector
6314         of file status flags.
6315         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
6316         unchanged files.
6317         (Sized_incremental_binary::do_process_got_plt): New function.
6318         (Sized_incremental_binary::get_symtab_view): Use stored locations.
6319         (Output_section_incremental_inputs::set_final_data_size): Record
6320         file index for each input file.
6321         (Output_section_incremental_inputs::write_got_plt): Store file index
6322         instead of input entry offset for each GOT entry.
6323         * incremental.h
6324         (Incremental_input_entry::Incremental_input_entry): Initialize new
6325         data member.
6326         (Incremental_input_entry::set_offset): Store file index.
6327         (Incremental_input_entry::get_file_index): New function.
6328         (Incremental_input_entry::file_index_): New data member.
6329         (Incremental_binary::process_got_plt): New function.
6330         (Incremental_binary::do_process_got_plt): New function.
6331         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6332         data members.
6333         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
6334         (Sized_incremental_binary::set_file_is_unchanged): New function.
6335         (Sized_incremental_binary::file_is_unchanged): New function.
6336         (Sized_incremental_binary::do_process_got_plt): New function.
6337         (Sized_incremental_binary::file_status_): New data member.
6338         (Sized_incremental_binary::main_symtab_loc_): New data member.
6339         (Sized_incremental_binary::main_strtab_loc_): New data member.
6340         * output.cc (Output_data_got::Got_entry::write): Add case
6341         RESERVED_CODE.
6342         (Output_data_got::add_global): Call add_got_entry.
6343         (Output_data_got::add_global_plt): Likewise.
6344         (Output_data_got::add_global_with_rel): Likewise.
6345         (Output_data_got::add_global_with_rela): Likewise.
6346         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
6347         (Output_data_got::add_global_pair_with_rela): Likewise.
6348         (Output_data_got::add_local): Call add_got_entry.
6349         (Output_data_got::add_local_plt): Likewise.
6350         (Output_data_got::add_local_with_rel): Likewise.
6351         (Output_data_got::add_local_with_rela): Likewise.
6352         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
6353         (Output_data_got::add_local_pair_with_rela): Likewise.
6354         (Output_data_got::reserve_slot): New function.
6355         (Output_data_got::reserve_slot_for_global): New function.
6356         (Output_data_got::add_got_entry): New function.
6357         (Output_data_got::add_got_entry_pair): New function.
6358         (Output_section::add_output_section_data): Edit FIXME.
6359         * output.h
6360         (Output_section_data_build::Output_section_data_build): New
6361         constructor with size parameter.
6362         (Output_data_space::Output_data_space): Likewise.
6363         (Output_data_got::Output_data_got): Initialize new data member; new
6364         constructor with size parameter.
6365         (Output_data_got::add_constant): Call add_got_entry.
6366         (Output_data_got::reserve_slot): New function.
6367         (Output_data_got::reserve_slot_for_global): New function.
6368         (class Output_data_got::Got_entry): Add RESERVED_CODE.
6369         (Output_data_got::add_got_entry): New function.
6370         (Output_data_got::add_got_entry_pair): New function.
6371         (Output_data_got::free_list_): New data member.
6372         * target.h (Sized_target::init_got_plt_for_update): New function.
6373         (Sized_target::register_global_plt_entry): New function.
6374         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
6375         Initialize new data member; call init; add constructor with PLT count.
6376         (Output_data_plt_x86_64::init): New function.
6377         (Output_data_plt_x86_64::add_relocation): New function.
6378         (Output_data_plt_x86_64::reserve_slot): New function.
6379         (Output_data_plt_x86_64::free_list_): New data member.
6380         (Target_x86_64::init_got_plt_for_update): New function.
6381         (Target_x86_64::register_global_plt_entry): New function.
6382         (Output_data_plt_x86_64::add_entry): Allocate from free list for
6383         incremental updates.
6384         (Output_data_plt_x86_64::add_relocation): New function.
6385         * testsuite/object_unittest.cc (Object_test): Set default options.
6386
6387 2011-05-16  Ian Lance Taylor  <iant@google.com>
6388
6389         * options.h (class General_options): Make -i a synonym for -r.
6390
6391 2011-05-16  Ian Lance Taylor  <iant@google.com>
6392
6393         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
6394
6395 2011-05-10 Cary Coutant  <ccoutant@google.com>
6396
6397         * object.cc (Sized_relobj::do_count_local_symbols): Check for
6398         strip_all (-s).
6399
6400 2011-05-06  Ian Lance Taylor  <iant@google.com>
6401
6402         * layout.cc (Layout::layout): If the output section flags change,
6403         update the ordering.
6404
6405 2011-04-25 Cary Coutant  <ccoutant@google.com>
6406
6407         * incremental-dump.cc (dump_incremental_inputs): Print local
6408         symbol info for each input file.
6409         * incremental.cc
6410         (Output_section_incremental_inputs::set_final_data_size): Add local
6411         symbol info to input file entries in incremental info.
6412         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6413         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
6414         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
6415         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
6416         implementation.
6417         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
6418         (Sized_incr_relobj::do_relocate): Write the local symbols.
6419         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
6420         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
6421         Adjust size of input file header.
6422         (Incremental_inputs_reader::get_local_symbol_offset): New function.
6423         (Incremental_inputs_reader::get_local_symbol_count): New function.
6424         (Incremental_inputs_reader::get_input_section): Adjust size of input
6425         file header.
6426         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
6427         (Sized_incr_relobj::This): New typedef.
6428         (Sized_incr_relobj::sym_size): New const data member.
6429         (Sized_incr_relobj::Local_symbol): New struct.
6430         (Sized_incr_relobj::do_output_local_symbol_count): New function.
6431         (Sized_incr_relobj::do_local_symbol_offset): New function.
6432         (Sized_incr_relobj::local_symbol_count_): New data member.
6433         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
6434         (Sized_incr_relobj::local_symbol_index_): New data member.
6435         (Sized_incr_relobj::local_symbol_offset_): New data member.
6436         (Sized_incr_relobj::local_dynsym_offset_): New data member.
6437         (Sized_incr_relobj::local_symbols_): New data member.
6438         * object.h (Relobj::output_local_symbol_count): New function.
6439         (Relobj::local_symbol_offset): New function.
6440         (Relobj::do_output_local_symbol_count): New function.
6441         (Relobj::do_local_symbol_offset): New function.
6442         (Sized_relobj::do_output_local_symbol_count): New function.
6443         (Sized_relobj::do_local_symbol_offset): New function.
6444
6445 2011-04-22  Vladimir Simonov  <sv@sw.ru>
6446
6447         * descriptors.cc (set_close_on_exec): New function.
6448         (Descriptors::open): Use set_close_on_exec.
6449         * output.cc (S_ISLNK): Define if not defined.
6450
6451 2011-04-22 Cary Coutant  <ccoutant@google.com>
6452
6453         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6454         global symbol map.
6455         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6456         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
6457         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
6458         relocations.
6459         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
6460         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
6461         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
6462         * incremental.h
6463         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
6464         function.
6465         (Incremental_binary::apply_incremental_relocs): New function.
6466         (Incremental_binary::do_apply_incremental_relocs): New function.
6467         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6468         data member.
6469         (Sized_incremental_binary::add_global_symbol): New function.
6470         (Sized_incremental_binary::global_symbol): New function.
6471         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6472         (Sized_incremental_binary::symbol_map_): New data member.
6473         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
6474         * target.h (Sized_target::apply_relocation): New function.
6475         * target-reloc.h (apply_relocation): New function.
6476         * x86_64.cc (Target_x86_64::apply_relocation): New function.
6477
6478 2011-04-22  Doug Kwan  <dougkwan@google.com>
6479
6480         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
6481         flag of a SHT_ARM_EXIDX section.
6482         * testsuite/Makefile.am (arm_exidx_test): New test rules.
6483         * testsuite/Makefile.in: Regenerate.
6484         * testsuite/arm_exidx_test.s: New file.
6485         * testsuite/arm_exidx_test.sh: Same.
6486
6487 2011-04-20 Cary Coutant  <ccoutant@google.com>
6488
6489         PR gold/12689
6490         * archive.h (Incremental_archive_entry::Archive_member):
6491         Initialize arg_serial_ (second constructor).
6492
6493 2011-04-17  Ian Lance Taylor  <iant@google.com>
6494
6495         * object.cc (Relocate_info::location): Simplify location string.
6496         * errors.cc (Errors::error_at_location): Don't print program
6497         name.
6498         (Errors::warning_at_location): Likewise.
6499         (Errors::undefined_symbol): Likewise.
6500         * testsuite/debug_msg.sh: Update accordingly.
6501
6502 2011-04-14 Cary Coutant  <ccoutant@google.com>
6503
6504         * gold/layout.cc (Layout::symtab_section_offset): New function.
6505         * gold/layout.h (Layout::symtab_section_offset): New function.
6506         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
6507
6508 2011-04-12  Ian Lance Taylor  <iant@google.com>
6509
6510         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
6511         with MREMAP_MAYMOVE.
6512         * output.h (class Output_file): Add map_is_allocated_ field.
6513         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
6514         not available, provide stubs.  If mremap is not available, #define
6515         it to gold_mremap.
6516         (MREMAP_MAYMOVE): Define if not defined.
6517         (Output_file::Output_file): Initialize map_is_allocated_.
6518         (Output_file::resize): Check map_is_allocated_.
6519         (Output_file::map_anonymous): If mmap fails, use malloc.
6520         (Output_file::unmap): Don't do anything for an anonymous map.
6521         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
6522         is not available, provide stubs.
6523         (File_read::View::~View): Use free rather than delete[].
6524         (File_read::make_view): Use malloc rather than new[].  If mmap
6525         fails, use malloc.
6526         (File_read::find_or_make_view): Use malloc rather than new[].
6527         * gold.h: Remove HAVE_REMAP code.
6528         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
6529         exists.  Rename mremap to gold_mremap.  If mmap is not available
6530         don't do anything.
6531         * configure, config.in: Rebuild.
6532
6533 2011-04-11  Ian Lance Taylor  <iant@google.com>
6534
6535         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
6536         initialize local variable v.
6537
6538 2011-04-11  Cary Coutant  <ccoutant@google.com>
6539
6540         * archive.cc (Archive::include_member): Adjust call to
6541         report_object.
6542         (Add_archive_symbols::run): Track argument serial numbers.
6543         (Lib_group::include_member): Likewise.
6544         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
6545         * archive.h (Incremental_archive_entry::Archive_member):
6546         Initialize arg_serial_.
6547         (Archive_member::arg_serial_): New data member.
6548         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
6549         (Sized_dynobj::do_add_symbols): Track symbols when doing an
6550         incremental link.
6551         (Sized_dynobj::do_for_all_local_got_entries): New function.
6552         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
6553         function.
6554         * fileread.cc (get_mtime): New function.
6555         * fileread.h (get_mtime): New function.
6556         * gold.cc (queue_initial_tasks): Check for incremental update.
6557         (process_incremental_input): New function.
6558         (queue_middle_tasks): Don't force valid target for incremental
6559         update.
6560         * incremental-dump.cc (find_input_containing_global): Adjust
6561         size of symbol info entry.
6562         (dump_incremental_inputs): Dump argument serial number and
6563         in_system_directory flag; bias shndx by 1; print symbol names
6564         when dumping per-file symbol lists; use new symbol info readers.
6565         * incremental.cc
6566         (Output_section_incremental_inputs:update_data_size): New function.
6567         (Sized_incremental_binary::setup_readers): Setup input readers
6568         for each input file; build maps for files added from libraries
6569         and scripts.
6570         (Sized_incremental_binary::check_input_args): New function.
6571         (Sized_incremental_binary::do_check_inputs): Build map of argument
6572         serial numbers to input arguments.
6573         (Sized_incremental_binary::do_file_has_changed): Rename
6574         do_file_is_unchanged to this; compare file modification times.
6575         (Sized_incremental_binary::do_init_layout): New function.
6576         (Sized_incremental_binary::do_reserve_layout): New function.
6577         (Sized_incremental_binary::do_get_input_reader): Remove.
6578         (Sized_incremental_binary::get_symtab_view): New function.
6579         (Incremental_checker::can_incrementally_link_output_file): Remove.
6580         (Incremental_inputs::report_command_line): Exclude --debug options.
6581         (Incremental_inputs::report_archive_begin): Add parameter; track
6582         argument serial numbers; don't put input file entry for archive
6583         before archive members.
6584         (Incremental_inputs::report_archive_end): Put input file entry
6585         for archive after archive members.
6586         (Incremental_inputs::report_object): Add parameter; track argument
6587         serial numbers and in_system_directory flag.
6588         (Incremental_inputs::report_script): Add parameter; track argument
6589         serial numbers.
6590         (Output_section_incremental_inputs::set_final_data_size): Adjust
6591         size of symbol info entry; check for forwarding symbols.
6592         (Output_section_incremental_inputs::write_input_files): Write
6593         in_system_directory flag and argument serial number.
6594         (Output_section_incremental_inputs::write_info_blocks): Map section
6595         indices between incremental info and original input file; store
6596         input section index for each symbol.
6597         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
6598         change operator() to visit().
6599         (class Global_got_offset_visitor): Likewise.
6600         (class Global_symbol_visitor_got_plt):
6601         (Output_section_incremental_inputs::write_got_plt): Use new visitor
6602         classes.
6603         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
6604         (Sized_incr_relobj::do_read_symbols): New function.
6605         (Sized_incr_relobj::do_layout): New function.
6606         (Sized_incr_relobj::do_layout_deferred_sections): New function.
6607         (Sized_incr_relobj::do_add_symbols): New function.
6608         (Sized_incr_relobj::do_should_include_member): New function.
6609         (Sized_incr_relobj::do_for_all_global_symbols): New function.
6610         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
6611         (Sized_incr_relobj::do_section_size): New function.
6612         (Sized_incr_relobj::do_section_name): New function.
6613         (Sized_incr_relobj::do_section_contents): New function.
6614         (Sized_incr_relobj::do_section_flags): New function.
6615         (Sized_incr_relobj::do_section_entsize): New function.
6616         (Sized_incr_relobj::do_section_address): New function.
6617         (Sized_incr_relobj::do_section_type): New function.
6618         (Sized_incr_relobj::do_section_link): New function.
6619         (Sized_incr_relobj::do_section_info): New function.
6620         (Sized_incr_relobj::do_section_addralign): New function.
6621         (Sized_incr_relobj::do_initialize_xindex): New function.
6622         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
6623         (Sized_incr_relobj::do_read_relocs): New function.
6624         (Sized_incr_relobj::do_gc_process_relocs): New function.
6625         (Sized_incr_relobj::do_scan_relocs): New function.
6626         (Sized_incr_relobj::do_count_local_symbols): New function.
6627         (Sized_incr_relobj::do_finalize_local_symbols): New function.
6628         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
6629         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
6630         (Sized_incr_relobj::do_relocate): New function.
6631         (Sized_incr_relobj::do_set_section_offset): New function.
6632         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
6633         (Sized_incr_dynobj::do_read_symbols): New function.
6634         (Sized_incr_dynobj::do_layout): New function.
6635         (Sized_incr_dynobj::do_add_symbols): New function.
6636         (Sized_incr_dynobj::do_should_include_member): New function.
6637         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
6638         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
6639         (Sized_incr_dynobj::do_section_size): New function.
6640         (Sized_incr_dynobj::do_section_name): New function.
6641         (Sized_incr_dynobj::do_section_contents): New function.
6642         (Sized_incr_dynobj::do_section_flags): New function.
6643         (Sized_incr_dynobj::do_section_entsize): New function.
6644         (Sized_incr_dynobj::do_section_address): New function.
6645         (Sized_incr_dynobj::do_section_type): New function.
6646         (Sized_incr_dynobj::do_section_link): New function.
6647         (Sized_incr_dynobj::do_section_info): New function.
6648         (Sized_incr_dynobj::do_section_addralign): New function.
6649         (Sized_incr_dynobj::do_initialize_xindex): New function.
6650         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
6651         (make_sized_incremental_object): New function.
6652         (Incremental_library::copy_unused_symbols): New function.
6653         (Incremental_library::do_for_all_unused_symbols): New function.
6654         * incremental.h (enum Incremental_input_flags): New type.
6655         (class Incremental_checker): Remove.
6656         (Incremental_input_entry::Incremental_input_entry): Add argument
6657         serial number.
6658         (Incremental_input_entry::arg_serial): New function.
6659         (Incremental_input_entry::set_is_in_system_directory): New function.
6660         (Incremental_input_entry::is_in_system_directory): New function.
6661         (Incremental_input_entry::arg_serial_): New data member.
6662         (Incremental_input_entry::is_in_system_directory_): New data member.
6663         (class Script_info): Move here from script.h.
6664         (Script_info::Script_info): Add filename parameter.
6665         (Script_info::filename): New function.
6666         (Script_info::filename_): New data member.
6667         (Incremental_script_entry::Incremental_script_entry): Add argument
6668         serial number.
6669         (Incremental_object_entry::Incremental_object_entry): Likewise.
6670         (Incremental_object_entry::add_input_section): Build list of input
6671         sections with map to original shndx.
6672         (Incremental_object_entry::get_input_section_index): New function.
6673         (Incremental_object_entry::shndx_): New data member.
6674         (Incremental_object_entry::name_key_): Rename; adjust all refs.
6675         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
6676         (Incremental_archive_entry::Incremental_archive_entry): Add argument
6677         serial number.
6678         (Incremental_inputs::report_archive_begin): Likewise.
6679         (Incremental_inputs::report_object): Likewise.
6680         (Incremental_inputs::report_script): Likewise.
6681         (class Incremental_global_symbol_reader): New class.
6682         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
6683         and store flags and input file type.
6684         (Incremental_input_entry_reader::arg_serial): New function.
6685         (Incremental_input_entry_reader::type): Extract type from flags.
6686         (Incremental_input_entry_reader::is_in_system_directory): New function.
6687         (Incremental_input_entry_reader::get_input_section_count): Call
6688         accessor function for type.
6689         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
6690         function for type; adjust size of global symbol entry.
6691         (Incremental_input_entry_reader::get_global_symbol_count): Call
6692         accessor function for type.
6693         (Incremental_input_entry_reader::get_object_count): Likewise.
6694         (Incremental_input_entry_reader::get_object_offset): Likewise.
6695         (Incremental_input_entry_reader::get_member_count): Likewise.
6696         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
6697         (Incremental_input_entry_reader::get_member_offset): Likewise.
6698         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
6699         (Incremental_input_entry_reader::Global_symbol_info): Remove.
6700         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
6701         (Incremental_input_entry_reader::get_global_symbol_reader): New
6702         function.
6703         (Incremental_input_entry_reader::get_output_symbol_index): New
6704         function.
6705         (Incremental_input_entry_reader::type_): Remove.
6706         (Incremental_input_entry_reader::flags_): New data member.
6707         (Incremental_inputs_reader::input_file_offset): New function.
6708         (Incremental_inputs_reader::input_file_index): New function.
6709         (Incremental_inputs_reader::input_file): Call input_file_offset.
6710         (Incremental_inputs_reader::input_file_at_offset): New function.
6711         (Incremental_relocs_reader::get_r_type): Reformat.
6712         (Incremental_relocs_reader::get_r_shndx): Reformat.
6713         (Incremental_relocs_reader::get_r_offset): Reformat.
6714         (Incremental_relocs_reader::data): New function.
6715         (Incremental_binary::Incremental_binary): Initialize new data members.
6716         (Incremental_binary::check_inputs): Add cmdline parameter.
6717         (Incremental_binary::file_is_unchanged): Remove.
6718         (Input_reader::arg_serial): New function.
6719         (Input_reader::get_unused_symbol_count): New function.
6720         (Input_reader::get_unused_symbol): New function.
6721         (Input_reader::do_arg_serial): New function.
6722         (Input_reader::do_get_unused_symbol_count): New function.
6723         (Input_reader::do_get_unused_symbol): New function.
6724         (Incremental_binary::input_file_count): New function.
6725         (Incremental_binary::get_input_reader): Change signature to use
6726         index instead of filename.
6727         (Incremental_binary::file_has_changed): New function.
6728         (Incremental_binary::get_input_argument): New function.
6729         (Incremental_binary::get_library): New function.
6730         (Incremental_binary::get_script_info): New function.
6731         (Incremental_binary::init_layout): New function.
6732         (Incremental_binary::reserve_layout): New function.
6733         (Incremental_binary::output_file): New function.
6734         (Incremental_binary::do_check_inputs): New function.
6735         (Incremental_binary::do_file_is_unchanged): Remove.
6736         (Incremental_binary::do_file_has_changed): New function.
6737         (Incremental_binary::do_init_layout): New function.
6738         (Incremental_binary::do_reserve_layout): New function.
6739         (Incremental_binary::do_input_file_count): New function.
6740         (Incremental_binary::do_get_input_reader): Change signature.
6741         (Incremental_binary::input_args_map_): New data member.
6742         (Incremental_binary::library_map_): New data member.
6743         (Incremental_binary::script_map_): New data member.
6744         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6745         new data members.
6746         (Sized_incremental_binary::output_section): New function.
6747         (Sized_incremental_binary::inputs_reader): Add const.
6748         (Sized_incremental_binary::symtab_reader): Add const.
6749         (Sized_incremental_binary::relocs_reader): Add const.
6750         (Sized_incremental_binary::got_plt_reader): Add const.
6751         (Sized_incremental_binary::get_symtab_view): New function.
6752         (Sized_incremental_binary::Inputs_reader): New typedef.
6753         (Sized_incremental_binary::Input_entry_reader): New typedef.
6754         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
6755         (Sized_incremental_binary::do_file_is_unchanged): Remove.
6756         (Sized_incremental_binary::do_file_has_changed): New function.
6757         (Sized_incremental_binary::do_init_layout): New function.
6758         (Sized_incremental_binary::do_reserve_layout): New function.
6759         (Sized_input_reader::Inputs_reader): Remove.
6760         (Sized_input_reader::Input_entry_reader): Remove.
6761         (Sized_input_reader::do_arg_serial): New function.
6762         (Sized_input_reader::do_get_unused_symbol_count): New function.
6763         (Sized_input_reader::do_get_unused_symbol): New function.
6764         (Sized_incremental_binary::do_input_file_count): New function.
6765         (Sized_incremental_binary::do_get_input_reader): Change signature;
6766         use index instead of filename.
6767         (Sized_incremental_binary::section_map_): New data member.
6768         (Sized_incremental_binary::input_entry_readers_): New data member.
6769         (class Sized_incr_relobj): New class.
6770         (class Sized_incr_dynobj): New class.
6771         (make_sized_incremental_object): New function.
6772         (class Incremental_library): New class.
6773         * layout.cc (Free_list::num_lists): New static data member.
6774         (Free_list::num_nodes): New static data member.
6775         (Free_list::num_removes): New static data member.
6776         (Free_list::num_remove_visits): New static data member.
6777         (Free_list::num_allocates): New static data member.
6778         (Free_list::num_allocate_visits): New static data member.
6779         (Free_list::init): New function.
6780         (Free_list::remove): New function.
6781         (Free_list::allocate): New function.
6782         (Free_list::dump): New function.
6783         (Free_list::print_stats): New function.
6784         (Layout_task_runner::run): Resize output file for incremental updates.
6785         (Layout::Layout): Initialize new data members.
6786         (Layout::set_incremental_base): New function.
6787         (Layout::init_fixed_output_section): New function.
6788         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6789         incremental updates.
6790         (Layout::create_gold_note): Do not create gold note section for
6791         incremental updates.
6792         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6793         for incremental updates.
6794         (Layout::set_section_offsets): For incremental updates, allocate space
6795         from free list.
6796         (Layout::create_symtab_sections): Layout with offsets relative to
6797         start of section; for incremental updates, allocate space from free
6798         list.
6799         (Layout::create_shdrs): For incremental updates, allocate space from
6800         free list.
6801         (Layout::finish_dynamic_section): For incremental updates, do not
6802         check --as-needed (fixed in subsequent patch).
6803         * layout.h (class Free_list): New class.
6804         (Layout::set_incremental_base): New function.
6805         (Layout::incremental_base): New function.
6806         (Layout::init_fixed_output_section): New function.
6807         (Layout::allocate): New function.
6808         (Layout::incremental_base_): New data member.
6809         (Layout::free_list_): New data member.
6810         * main.cc (main): Print Free_list statistics.
6811         * object.cc (Relobj::finalize_incremental_relocs): Add
6812         clear_counts parameter; clear counts only when clear_counts is set.
6813         (Sized_relobj::Sized_relobj): Initialize new base class.
6814         (Sized_relobj::do_layout): Don't report special sections.
6815         (Sized_relobj::do_for_all_local_got_entries): New function.
6816         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6817         symtab_off to all symbol table offsets.
6818         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6819         * object.h (class Got_offset_list): Move to top of file.
6820         (Object::Object): Allow case where input_file == NULL.
6821         (Object::~Object): Likewise.
6822         (Object::input_file): Assert that input_file != NULL.
6823         (Object::lock): Allow case where input_file == NULL.
6824         (Object::unlock): Likewise.
6825         (Object::is_locked): Likewise.
6826         (Object::token): Likewise.
6827         (Object::release): Likewise.
6828         (Object::is_incremental): New function.
6829         (Object::get_mtime): New function.
6830         (Object::for_all_local_got_entries): New function.
6831         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6832         (Object::set_is_in_system_directory): New function.
6833         (Object::is_in_system_directory): New function.
6834         (Object::do_is_incremental): New function.
6835         (Object::do_get_mtime): New function.
6836         (Object::do_for_all_local_got_entries): New function.
6837         (Object::is_in_system_directory_): New data member.
6838         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
6839         (class Sized_relobj_base): New class.
6840         (class Sized_relobj): Derive from Sized_relobj_base.
6841         (class Sized_relobj::Symbols): Redeclare from base class.
6842         (class Sized_relobj::local_got_offset_list): Remove.
6843         (class Sized_relobj::Output_sections): Redeclare from base class.
6844         (class Sized_relobj::do_for_all_local_got_entries): New function.
6845         (class Sized_relobj::write_local_symbols): Add offset parameter.
6846         (class Sized_relobj::local_symbol_offset_): Update comment.
6847         (class Sized_relobj::local_dynsym_offset_): Update comment.
6848         * options.cc (Input_arguments::add_file): Remove const.
6849         * options.h (Input_file_argument::Input_file_argument):
6850         Initialize arg_serial_ (all constructors).
6851         (Input_file_argument::set_arg_serial): New function.
6852         (Input_file_argument::arg_serial): New function.
6853         (Input_file_argument::arg_serial_): New data member.
6854         (Input_arguments::Input_arguments): Initialize file_count_.
6855         (Input_arguments::add_file): Remove const.
6856         (Input_arguments::number_of_input_files): New function.
6857         (Input_arguments::file_count_): New data member.
6858         (Command_line::number_of_input_files): Call
6859         Input_arguments::number_of_input_files.
6860         * output.cc (Output_segment_headers::Output_segment_headers):
6861         Set current size.
6862         (Output_section::Input_section::current_data_size): New function.
6863         (Output_section::Output_section): Initialize new data members.
6864         (Output_section::add_input_section): Don't do merge sections for
6865         an incremental link; allocate space from free list for an
6866         incremental update.
6867         (Output_section::add_output_section_data): Allocate space from
6868         free list for an incremental update.
6869         (Output_section::update_data_size): New function.
6870         (Output_section::set_fixed_layout): New function.
6871         (Output_section::reserve): New function.
6872         (Output_segment::set_section_addresses): Remove const.
6873         (Output_segment::set_section_list_addresses): Remove const; allocate
6874         space from free list for an incremental update.
6875         (Output_segment::set_offset): Adjust size of RELRO segment for an
6876         incremental update.
6877         * output.h (Output_data::current_data_size): Move here from
6878         child classes.
6879         (Output_data::pre_finalize_data_size): New function.
6880         (Output_data::update_data_size): New function.
6881         (Output_section_headers::update_data_size): new function.
6882         (Output_section_data_build::current_data_size): Move to Output_data.
6883         (Output_data_strtab::update_data_size): New function.
6884         (Output_section::current_data_size): Move to Output_data.
6885         (Output_section::set_fixed_layout): New function.
6886         (Output_section::has_fixed_layout): New function.
6887         (Output_section::reserve): New function.
6888         (Output_section::update_data_size): New function.
6889         (Output_section::has_fixed_layout_): New data member.
6890         (Output_section::free_list_): New data member.
6891         (Output_segment::set_section_addresses): Remove const.
6892         (Output_segment::set_section_list_addresses): Remove const.
6893         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
6894         New function.
6895         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
6896         New function.
6897         * readsyms.cc (Read_symbols::do_read_symbols): Add library
6898         parameter when calling Add_symbols constructor; store argument
6899         serial number for members of a lib group.
6900         (Add_symbols::locks): Allow case where token == NULL.
6901         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
6902         (Read_member::~Read_member): New function.
6903         (Read_member::is_runnable): New function.
6904         (Read_member::locks): New function.
6905         (Read_member::run): New function.
6906         (Check_script::~Check_script): New function.
6907         (Check_script::is_runnable): New function.
6908         (Check_script::locks): New function.
6909         (Check_script::run): New function.
6910         (Check_library::~Check_library): New function.
6911         (Check_library::is_runnable): New function.
6912         (Check_library::locks): New function.
6913         (Check_library::run): New function.
6914         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6915         (Add_symbols::library_): New data member.
6916         (class Read_member): New class.
6917         (class Check_script): New class.
6918         (class Check_library): New class.
6919         * reloc.cc (Read_relocs::is_runnable): Allow case where
6920         token == NULL.
6921         (Read_relocs::locks): Likewise.
6922         (Scan_relocs::locks): Likewise.
6923         (Relocate_task::locks): Likewise.
6924         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6925         to clear counters.
6926         (Sized_relobj::incremental_relocs_scan): Fix comment.
6927         (Sized_relobj::do_relocate): Pass output file offset to
6928         write_local_symbols.
6929         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6930         from class declaration.
6931         * script.cc (read_input_script): Allocate Script_info; pass
6932         argument serial number to report_script.
6933         * script.h (class Script_info): Move to incremental.h.
6934         * symtab.cc (Symbol_table::add_from_incrobj): New function.
6935         * symtab.h (Symbol_table::add_from_incrobj): New function.
6936         (Symbol_table::set_file_offset): New function.
6937
6938 2011-04-05  Cary Coutant  <ccoutant@google.com>
6939
6940         * incremental-dump.cc (dump_incremental_inputs): Change signature
6941         to take a Sized_incremental_binary; change caller.  Use readers
6942         in Sized_incremental_binary.
6943         * incremental.cc
6944         (Sized_incremental_binary::find_incremental_inputs_sections):
6945         Rename do_find_incremental_inputs_sections to this.
6946         (Sized_incremental_binary::setup_readers): New function.
6947         (Sized_incremental_binary::do_check_inputs): Check
6948         has_incremental_info_ flag; move setup code to setup_readers;
6949         use input readers.
6950         (Sized_incremental_binary::do_file_is_unchanged): New function.
6951         (Sized_incremental_binary::do_get_input_reader): New function.
6952         * incremental.h (class Incremental_binary): Move to end of file.
6953         (Incremental_binary::file_is_unchanged): New function.
6954         (Incremental_binary::do_file_is_unchanged): New function.
6955         (Incremental_binary::Input_reader): New class.
6956         (Incremental_binary::get_input_reader): New function.
6957         (class Sized_incremental_binary): Move to end of file.
6958         (Sized_incremental_binary::Sized_incremental_binary): Setup the
6959         input section reader classes.
6960         (Sized_incremental_binary::has_incremental_info): New function.
6961         (Sized_incremental_binary::inputs_reader): New function.
6962         (Sized_incremental_binary::symtab_reader): New function.
6963         (Sized_incremental_binary::relocs_reader): New function.
6964         (Sized_incremental_binary::got_plt_reader): New function.
6965         (Sized_incremental_binary::do_file_is_unchanged): New function.
6966         (Sized_incremental_binary::Sized_input_reader): New class.
6967         (Sized_incremental_binary::get_input_reader): New function.
6968         (Sized_incremental_binary::find_incremental_inputs_sections):
6969         Rename do_find_incremental_inputs_sections to this.
6970         (Sized_incremental_binary::setup_readers): New function.
6971         (Sized_incremental_binary::has_incremental_info_): New data member.
6972         (Sized_incremental_binary::inputs_reader_): New data member.
6973         (Sized_incremental_binary::symtab_reader_): New data member.
6974         (Sized_incremental_binary::relocs_reader_): New data member.
6975         (Sized_incremental_binary::got_plt_reader_): New data member.
6976         (Sized_incremental_binary::current_input_file_): New data member.
6977
6978 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
6979
6980         PR gold/12640
6981         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6982         violation.
6983
6984 2011-03-30  Cary Coutant  <ccoutant@google.com>
6985
6986         * archive.cc (Archive::include_member): Adjust call to report_object.
6987         (Add_archive_symbols::run): Add script_info to call to
6988         report_archive_begin.
6989         (Lib_group::include_member): Adjust call to report_object.
6990         (Add_lib_group_symbols::run): Adjust call to report_object.
6991         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6992         blocks.  Add object count for script input files.
6993         * incremental.cc (Incremental_inputs::report_archive_begin): Add
6994         script_info parameter; change all callers.
6995         (Incremental_inputs::report_object): Add script_info parameter;
6996         change all callers.
6997         (Incremental_inputs::report_script): Store backpointer to
6998         incremental info entry.
6999         (Output_section_incremental_inputs::set_final_data_size): Record
7000         additional information for scripts.
7001         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7002         * incremental.h (Incremental_script_entry::add_object): New function.
7003         (Incremental_script_entry::get_object_count): New function.
7004         (Incremental_script_entry::get_object): New function.
7005         (Incremental_script_entry::objects_): New data member; adjust
7006         constructor.
7007         (Incremental_inputs::report_archive_begin): Add script_info parameter.
7008         (Incremental_inputs::report_object): Add script_info parameter.
7009         (Incremental_inputs_reader::get_object_count): New function.
7010         (Incremental_inputs_reader::get_object_offset): New function.
7011         * options.cc (Input_arguments::add_file): Return reference to
7012         new input argument.
7013         * options.h (Input_argument::set_script_info): New function.
7014         (Input_argument::script_info): New function.
7015         (Input_argument::script_info_): New data member; adjust all
7016         constructors.
7017         (Input_file_group::add_file): Return reference to new input argument.
7018         (Input_file_lib::add_file): Likewise.
7019         (Input_arguments::add_file): Likewise.
7020         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
7021         * script.cc (Parser_closure::Parser_closure): Add script_info
7022         parameter; adjust all callers.
7023         (Parser_closure::script_info): New function.
7024         (Parser_closure::script_info_): New data member.
7025         (read_input_script): Report scripts earlier to incremental info.
7026         (script_add_file): Set script_info in Input_argument.
7027         (script_add_library): Likewise.
7028         * script.h (Script_options::Script_info): Rewrite class.
7029
7030 2011-03-29  Cary Coutant  <ccoutant@google.com>
7031
7032         * archive.cc (Library_base::should_include_member): Move
7033         method here from class Archive.
7034         (Archive::Archive): Initialize base class.
7035         (Archive::should_include_member): Move to base class.
7036         (Archive::do_for_all_unused_symbols): New function.
7037         (Add_archive_symbols::run): Remove redundant access to
7038         incremental_inputs.
7039         (Lib_group::Lib_group): Initialize base class.
7040         (Lib_group::do_filename): New function.
7041         (Lib_group::include_member): Pass pointer to Lib_group to
7042         report_object.
7043         (Lib_group::do_for_all_unused_symbols): New function.
7044         (Add_lib_group_symbols::run): Report archive information for
7045         incremental links.
7046         * archive.h (class Library_base): New base class.
7047         (class Archive): Derive from Library_base.
7048         (Archive::filename): Move to base class.
7049         (Archive::set_incremental_info): Likewise.
7050         (Archive::incremental_info): Likewise.
7051         (Archive::Should_include): Likewise.
7052         (Archive::should_include_member): Likewise.
7053         (Archive::Armap_entry): Remove.
7054         (Archive::Unused_symbol_iterator): Remove.
7055         (Archive::unused_symbols_begin): Remove.
7056         (Archive::unused_symbols_end): Remove.
7057         (Archive::do_filename): New function.
7058         (Archive::do_get_mtime): New function.
7059         (Archive::do_for_all_unused_symbols): New function.
7060         (Archive::task_): Move to base class.
7061         (Archive::incremental_info_): Likewise.
7062         (class Lib_group): Derive from Library_base.
7063         (Lib_group::do_filename): New function.
7064         (Lib_group::do_get_mtime): New function.
7065         (Lib_group::do_for_all_unused_symbols): New function.
7066         (Lib_group::task_): Move to base class.
7067         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
7068         function.
7069         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
7070         function.
7071         * incremental.cc (Incremental_inputs::report_archive_begin):
7072         Use Library_base; call library's get_mtime; add incremental inputs
7073         entry before members.
7074         (class Unused_symbol_visitor): New class.
7075         (Incremental_inputs::report_archive_end): Use Library_base; use
7076         visitor class to record unused symbols; don't add incremental inputs
7077         entry after members.
7078         (Incremental_inputs::report_object): Use Library_base.
7079         * incremental.h
7080         (Incremental_archive_entry::Incremental_archive_entry): Remove
7081         unused Archive parameter.
7082         (Incremental_inputs::report_archive_begin): Use Library_base.
7083         (Incremental_inputs::report_archive_end): Likewise.
7084         (Incremental_inputs::report_object): Likewise.
7085         * object.cc (Sized_relobj::do_for_all_global_symbols): New
7086         function.
7087         * object.h (Object::for_all_global_symbols): New function.
7088         (Object::do_for_all_global_symbols): New function.
7089         (Sized_relobj::do_for_all_global_symbols): New function.
7090         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
7091         function.
7092         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
7093         function.
7094
7095 2011-03-27  Ian Lance Taylor  <iant@google.com>
7096
7097         * archive.cc (Archive::interpret_header): Return -1 if something
7098         goes wrong.  Change callers accordingly.
7099
7100 2011-03-25  Cary Coutant  <ccoutant@google.com>
7101
7102         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
7103         * testsuite/Makefile.in: Regenerate.
7104
7105 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
7106
7107         * plugin.cc (get_view): New.
7108         (Plugin::load): Pass get_view to the plugin.
7109         (Plugin_manager::get_view): New.
7110
7111 2011-03-21  Ian Lance Taylor  <iant@google.com>
7112
7113         * testsuite/final_layout.sh: Rewrite to not use dc.
7114         * testsuite/relro_test.sh: Fail if dc is not present.
7115
7116 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
7117
7118         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
7119         Change == to -eq.
7120         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
7121         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
7122         Change == to -eq.
7123         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
7124         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
7125
7126 2011-03-14  Ian Lance Taylor  <iant@google.com>
7127
7128         * script-sections.cc (Sort_output_sections::script_compare):
7129         Rename from is_before, change return type.
7130         (Sort_output_sections::operator()): Adjust accordingly.
7131
7132 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
7133
7134         PR gold/12572
7135         * testsuite/odr_violation2.cc: Add comment to make all error line
7136         numbers double digits.
7137         * testsuite/debug_msg.sh: Adjust expected errors.
7138
7139 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
7140
7141         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
7142         but mark earlier ones as non-canonical
7143         (offset_to_iterator): Update search target and example
7144         (do_addr2line): Return extra lines in a vector*
7145         (format_file_lineno): Extract from do_addr2line
7146         (one_addr2line): Add vector* out-param
7147         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
7148         when a lineno entry appeared last for its instruction
7149         (Dwarf_line_info): Add vector* out-param
7150         * object.cc (Relocate_info): Pass NULL for the vector* out-param
7151         * symtab.cc (Odr_violation_compare): Include the lineno in the
7152         comparison again.
7153         (linenos_from_loc): New. Combine the canonical line for an
7154         address with its other lines.
7155         (True_if_intersect): New. Helper functor to make
7156         std::set_intersection a query.
7157         (detect_odr_violations): Compare sets of lines instead of just
7158         one line for each function. This became less deterministic, but
7159         has fewer false positives.
7160         * symtab.h: Declarations.
7161         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
7162         mix an optimized and non-optimized object in the same binary
7163         (odr_violation2.so): Same.
7164         * testsuite/Makefile.in: Regenerate from Makefile.am.
7165         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
7166         * testsuite/debug_msg.sh: Update line numbers and add
7167         assertions.
7168         * testsuite/odr_violation1.cc: Use OdrDerived, in a
7169         non-optimized context.
7170         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
7171         isn't inlined, and use OdrDerived in an optimized context.
7172         * testsuite/odr_header1.h: Defines OdrDerived, where
7173         optimization will change the
7174         first-instruction-in-the-destructor's file and line number.
7175         * testsuite/odr_header2.h: Defines OdrBase.
7176
7177 2011-03-09  Ian Lance Taylor  <iant@google.com>
7178
7179         * fileread.cc (File_read::clear_views): Don't delete the whole
7180         file view.
7181
7182 2011-03-08  Ian Lance Taylor  <iant@google.com>
7183
7184         PR gold/12525
7185         * fileread.cc: #include <climits>.
7186         (GOLD_IOV_MAX): Define.
7187         (File_read::read_multiple): Limit number of entries by iov_max.
7188         * fileread.h (class File_read): Always set max_readv_entries to
7189         128.
7190
7191 2011-03-07  Ian Lance Taylor  <iant@google.com>
7192
7193         PR gold/12525
7194         * options.h (class General_options): Add -dy and -dn.
7195
7196 2011-03-02  Cary Coutant  <ccoutant@google.com>
7197
7198         * testsuite/script_test_9.t: Add TLS segment.
7199
7200 2011-03-02  Simon Baldwin  <simonb@google.com>
7201
7202         * configure.ac: Add check for gnu_indirect_function support in
7203         the toolchain building binutils.
7204         * configure: Rebuild.
7205
7206 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
7207
7208         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
7209         plugin only symbols.
7210         (Symbol_table::sized_finalize_symbol) Mark symbol only present
7211         in plugin files as not needed in the symbol table.
7212
7213 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
7214
7215         * output.cc (Output_section::add_input_section): Delay fill
7216         generation for section ordering.
7217
7218 2011-02-09  Ian Lance Taylor  <iant@google.com>
7219
7220         PR gold/12316
7221         * object.h (class Sized_relobj): Remove clear_local_symbols.
7222         * reloc.cc (Sized_relobj::do_relocate): Don't call
7223         clear_local_symbols.
7224
7225 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
7226
7227         * plugin.cc (is_visible_from_outside): Return true for symbols
7228         in the -u option.
7229
7230 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
7231
7232         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
7233         filename.
7234
7235 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
7236
7237         * icf.h (is_section_foldable_candidate): Change type of parameter
7238         to std::string.
7239         * icf.cc (Icf::find_identical_sections): Change type of local variable
7240         section_name to be std::string.
7241         (is_function_ctor_or_dtor): Change type of parameter to std::string.
7242
7243 2011-01-25  Ian Lance Taylor  <iant@google.com>
7244
7245         * script.cc (script_add_extern): Rewrite to use
7246         add_symbol_reference.
7247
7248 2011-01-25  Doug Kwan  <dougkwan@google.com>
7249
7250         * icf.cc (get_section_contents): Always lock section's object.
7251
7252 2011-01-24  Ian Lance Taylor  <iant@google.com>
7253
7254         * options.h (class General_options): Accept
7255         --no-detect-odr-violations.
7256
7257 2011-01-24  Ian Lance Taylor  <iant@google.com>
7258
7259         * version.cc (version_string): Bump to 1.11.
7260
7261 2011-01-24  Ian Lance Taylor  <iant@google.com>
7262
7263         * plugin.cc (class Plugin_rescan): Define new class.
7264         (Plugin_manager::claim_file): Set any_claimed_.
7265         (Plugin_manager::save_archive): New function.
7266         (Plugin_manager::save_input_group): New function.
7267         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
7268         necessary.
7269         (Plugin_manager::new_undefined_symbol): New function.
7270         (Plugin_manager::rescan): New function.
7271         (Plugin_manager::rescannable_defines): New function.
7272         (Plugin_manager::add_input_file): Set any_added_.
7273         * plugin.h (class Plugin_manager): define new fields rescannable_,
7274         undefined_symbols_, any_claimed_, and any_added_.  Declare
7275         Plugin_rescan as friend.  Declare new functions.
7276         (Plugin_manager::Rescannable): Define type.
7277         (Plugin_manager::Rescannable_list): Define type.
7278         (Plugin_manager::Undefined_symbol_list): Define type.
7279         (Plugin_manager::Plugin_manager): Initialize new fields.
7280         * archive.cc (Archive::defines_symbol): New function.
7281         (Add_archive_symbols::run): Pass archive to plugins if any.
7282         * archive.h (class Archive): Declare defines_symbol.
7283         * readsyms.cc (Input_group::~Input_group): New function.
7284         (Finish_group::run): Pass input_group to plugins if any.
7285         * readsyms.h (class Input_group): Declare destructor.
7286         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
7287         any.
7288
7289 2011-01-10  Ian Lance Taylor  <iant@google.com>
7290
7291         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
7292         section as relro.
7293         (Layout::set_segment_offsets): Reset increase_relro before calling
7294         set_section_addresses a second time.
7295
7296 2011-01-04  Cary Coutant  <ccoutant@google.com>
7297
7298         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
7299         sections before NOBITS sections.
7300
7301 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
7302
7303         * version.cc (print_version): Update copyright to 2011.
7304
7305 2010-12-23  Cary Coutant  <ccoutant@google.com>
7306
7307         * output.h (Output_data_reloc::add_output_section): Pass OD instead
7308         of OS to this->add.  Add OD parameter to second form of the function.
7309
7310 2010-12-20  Ian Lance Taylor  <iant@google.com>
7311
7312         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
7313         second of two consecutive entries with same offset.
7314
7315 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7316
7317         * testsuite/Makefile.am (ifuncmain2static_LDADD)
7318         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
7319         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
7320         to avoid unneeded links against $(LDADD).
7321         * testsuite/Makefile.in: Regenerate.
7322
7323 2010-12-15  Ian Lance Taylor  <iant@google.com>
7324
7325         PR gold/12324
7326         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
7327         for R_X86_64_32 and R_X86_64_PC32.
7328         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
7329         ver_matching_def_pic.o.
7330         (ver_matching_def_pic.o): New target.
7331
7332 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7333
7334         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
7335         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
7336         Move definition before File_read::View member definitions.
7337         (File_read::View::~View): Initialize and hold lock before
7338         updating current_mapped_bytes.
7339
7340 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7341
7342         * dwarf_reader.cc: Remove outdated comment.
7343         * gold-threads.cc: Fix typo in error message.
7344         * archive.cc: Fix typos in comments.
7345         * archive.h: Likewise.
7346         * arm-reloc-property.cc: Likewise.
7347         * arm-reloc-property.h: Likewise.
7348         * arm-reloc.def: Likewise.
7349         * arm.cc: Likewise.
7350         * attributes.h: Likewise.
7351         * cref.cc: Likewise.
7352         * ehframe.cc: Likewise.
7353         * fileread.h: Likewise.
7354         * gold.h: Likewise.
7355         * i386.cc: Likewise.
7356         * icf.cc: Likewise.
7357         * incremental.h: Likewise.
7358         * int_encoding.cc: Likewise.
7359         * layout.h: Likewise.
7360         * main.cc: Likewise.
7361         * merge.h: Likewise.
7362         * object.cc: Likewise.
7363         * object.h: Likewise.
7364         * options.cc: Likewise.
7365         * readsyms.cc: Likewise.
7366         * reduced_debug_output.cc: Likewise.
7367         * reloc.cc: Likewise.
7368         * script-sections.cc: Likewise.
7369         * sparc.cc: Likewise.
7370         * symtab.h: Likewise.
7371         * target-reloc.h: Likewise.
7372         * target.cc: Likewise.
7373         * target.h: Likewise.
7374         * timer.cc: Likewise.
7375         * timer.h: Likewise.
7376         * x86_64.cc: Likewise.
7377
7378 2010-12-09  Cary Coutant  <ccoutant@google.com>
7379
7380         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
7381         stack.
7382         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
7383         parameter; change all callers.
7384         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
7385         * options.h (warn_execstack): New option.
7386
7387 2010-12-07  Doug Kwan  <dougkwan@google.com>
7388
7389         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
7390         like function call relocations.
7391
7392 2010-12-07  Ian Lance Taylor  <iant@google.com>
7393
7394         * archive.cc (Archive::get_elf_object_for_member): Permit
7395         punconfigured to be NULL.
7396         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
7397         (Archive::include_member): Pass NULL to get_elf_object_for_member
7398         if we searched for the archive and this is the first included
7399         object.
7400
7401 2010-12-01  Ian Lance Taylor  <iant@google.com>
7402
7403         * dwarf_reader.h (class Sized_dwarf_line_info): Add
7404         track_relocs_type_ field.
7405         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7406         Set track_relocs_type_.
7407         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
7408         contents when using RELA relocs.
7409         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
7410         reloc_map_.
7411         * reloc.cc (Track_relocs::next_addend): New function.
7412         * reloc.h (class Track_relocs): Declare next_addend.
7413
7414 2010-12-01  Ian Lance Taylor  <iant@google.com>
7415
7416         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
7417         virtual destructor.
7418
7419 2010-12-01  Ian Lance Taylor  <iant@google.com>
7420
7421         * README: Update compilers known to work and fail.
7422
7423 2010-11-23  Matthias Klose  <doko@ubuntu.com>
7424
7425         * configure.in: For --enable-gold, handle value `default' instead of
7426         `both*'.  Always install ld as ld.bfd, install as ld if gold is
7427         not the default.
7428         * configure: Regenerate.
7429
7430 2010-11-18  Doug Kwan  <dougkwan@google.com>
7431
7432         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
7433         and right_alignment to be zero.  Store result alignment only if it is
7434         greater than existing alignment.
7435
7436 2010-11-16  Cary Coutant  <ccoutant@google.com>
7437
7438         PR gold/12220
7439         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7440         Check for ".zdebug_line".
7441
7442 2010-11-16  Doug Kwan  <dougkwan@google.com>
7443             Cary Coutant  <ccoutant@google.com>
7444
7445         * output.h (Output_segment::set_section_addresses): Pass increase_relro
7446         by reference; adjust all callers.
7447         * output.cc (Output_segment::set_section_addresses): Adjust references
7448         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
7449         list is empty.
7450         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
7451         end at page boundary.
7452
7453 2010-11-16  Cary Coutant  <ccoutant@google.com>
7454
7455         PR gold/12220
7456         * layout.cc (Layout::choose_output_section): Transform names of
7457         compressed sections even when using a script with a SECTIONS clause.
7458         (Layout::output_section_name): Remove code to transform
7459         compressed debug section names.
7460         * output.cc (Output_section::add_input_section): Use uncompressed
7461         section size when tracking input sections.
7462
7463 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
7464
7465         * symtab.h (Symbol::NON_PIC_REF): Remove.
7466         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
7467         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
7468         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
7469         (Symbol::use_plt_offset): Take a flags argument and pass it
7470         directly to needs_dynamic_reloc.  Restrict check for undefined
7471         weak symbols to function calls.
7472         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
7473         (Target_arm::Scan::global): Use it.
7474         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
7475         (Target_arm::Relocate::relocate): Likewise.
7476         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
7477         parameter with an r_type parameter.  Use get_reference_flags
7478         to get the flags.
7479         (Target_arm::Relocate::relocate): Update accordingly.
7480         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
7481         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
7482         (Target_i386::Scan::global): Likewise.
7483         (Target_i386::Relocate::relocate): Likewise.
7484         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
7485         parameter with an r_type parameter.  Use get_reference_flags
7486         to get the flags.
7487         (Target_i386::Relocate::relocate): Update accordingly.
7488         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
7489         (Target_powerpc::Scan::global): Use it.
7490         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
7491         (Target_powerpc::Relocate::relocate): Likewise.
7492         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
7493         (Target_sparc::Scan::global): Use it.
7494         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
7495         (Target_sparc::Relocate::relocate): Likewise.
7496         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
7497         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
7498         (Target_x86_64::Scan::global): Likewise.
7499         (Target_x86_64::Relocate::relocate): Likewise.
7500
7501 2010-11-08  Doug Kwan  <dougkwan@google.com>
7502             Cary Coutant  <ccoutant@google.com>
7503
7504         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
7505         (Arm_exidx_merge_section::section_contents_): New data member.
7506         (Arm_input_section::Arm_input_section): Initialize original_contents_.
7507         (Arm_input_section::~Arm_input_section): De-allocate memory.
7508         (Arm_input_section::original_contents_): New data member.
7509         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
7510         in parameters instead of calling Object::section_contents without
7511         locking.
7512         (Arm_output_section::group_section): New parameter TASK.  Pass it
7513         to callees that need locking objects.
7514         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
7515         to lock EXIDX input sections.  Fix a formatting issue.  Call
7516         Arm_exidx_merged_section::build_contents to create merged section
7517         contents.
7518         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
7519         to lock object of stub table owner.
7520         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
7521         TEXT_SIZE to initialize data member TEXT_SIZE_.
7522         (Arm_exidx_input_section::addralign): Fix typo in comment.
7523         (Arm_exidx_input_section::text_size): New method.
7524         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
7525         that require locking objects.  Lock objects before scanning for stubs
7526         and updating local symbols.
7527         (Arm_input_section<big_endian>::init): Copy contents of original
7528         input section.
7529         (Arm_input_section<big_endian>::do_write): Use saved contents of
7530         original input section instead of calling Object::section_contents
7531         without locking.
7532         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
7533         size without calling Object::section_size().
7534         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
7535         for size.  Allocate a buffer for merged EXIDX entries.
7536         (Arm_exidx_merged_section::build_contents): New method.
7537         (Arm_exidx_merged_section::do_write): Move merge section contents
7538         building code to Arm_exidx_merged_section::build_contetns.  Write
7539         out contetns in buffer instead of building it on the fly.
7540         (Arm_relobj::make_exidx_input_section): Also pass text section size
7541         to Arm_exidx_input_section constructor.
7542         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
7543         (Arm_dynobj::do_read_symbols): Fix memory leak.
7544         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
7545         * target.h: (class Task): Add forward declaration.
7546         (Target::relax): Add new parameter TASK and pass it to
7547         Target::do_relax().
7548         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
7549
7550 2010-11-05  Cary Coutant  <ccoutant@google.com>
7551
7552         PR gold/10708
7553         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
7554         object when reading from the file.
7555         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
7556         second layout pass.
7557         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
7558         when reading section contents.
7559         (get_section_contents): Likewise.
7560         (icf::find_identical_sections): Likewise.
7561         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
7562         object when reading from the file.
7563         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
7564         the object when doing deferred section layout.
7565
7566 2010-11-03  Nick Clifton  <nickc@redhat.com>
7567
7568         PR gold/12001
7569         * script.h (class Symbol_assignment: name): New member.  Returns
7570         the name of the symbol.
7571         * scrfipt.cc (Script_options::is_pending_assignment): New member.
7572         Returns true if the given symbol name is on the list of
7573         assignments wating to be processed.
7574         * archive.cc (should_incldue_member): If the symbol is undefined,
7575         check to see if it is on the list of symbols pending assignment.
7576
7577 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
7578
7579         * script-sections.cc (Script_sections::find_memory_region): Check
7580         for a NULL output section pointer.
7581
7582 2010-10-29  Doug Kwan  <dougkwan@google.com>
7583
7584         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
7585         Output_section::add_relaxed_input_section.
7586         * output.cc (Output_section::add_relaxed_input_section): Add new
7587         arguments LAYOUT and NAME.  Set section order index.
7588         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7589         Copy section order index.
7590         * output.h (Output_section::add_relaxed_input_section): Add new
7591         arguments LAYOUT and NAME.
7592
7593 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7594
7595         * testsuite/Makefile.am: Move gcctestdir/ld rule to
7596         NATIVE_OR_CROSS_LINKER.
7597         * testsuite/Makefile.in: Regenerate.
7598
7599 2010-10-20  Doug Kwan  <dougkwan@google.com>
7600
7601         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
7602         without SHF_LINK_ORDER flags.
7603         * layout.cc (Layout::choose_output_section): Do not filter
7604         SHF_LINK_ORDER flag in a relocatable link.
7605
7606 2010-10-17  Cary Coutant  <ccoutant@google.com>
7607
7608         * output.h (Output_segment::set_section_addresses): Change function
7609         signature.  Update all callers.
7610         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
7611         sections.
7612         (Output_segment::set_section_addresses): Align after last TLS
7613         section.  Add padding before last relro section instead of after.
7614
7615 2010-10-17  Doug Kwan  <dougkwan@google.com>
7616
7617         * gold/arm.cc (Target_arm::got_section): Use correct order and set
7618         GOT output section to be writable.
7619
7620 2010-10-14  Cary Coutant  <ccoutant@google.com>
7621
7622         * debug.h (DEBUG_INCREMENTAL): New flag.
7623         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
7624         * gold.cc (queue_initial_tasks): Check parameters for incremental link
7625         mode.
7626         * incremental.cc (report_command_line): Ignore all forms of
7627         --incremental.
7628         * layout.cc (Layout::Layout): Check parameters for incremental link
7629         mode.
7630         * options.cc (General_options::parse_incremental): New function.
7631         (General_options::parse_no_incremental): New function.
7632         (General_options::parse_incremental_full): New function.
7633         (General_options::parse_incremental_update): New function.
7634         (General_options::incremental_mode_): New data member.
7635         (General_options::finalize): Check incremental_mode_.
7636         * options.h (General_options): Update help text for --incremental.
7637         Add --no-incremental, --incremental-full, --incremental-update.
7638         (General_options::Incremental_mode): New enum type.
7639         (General_options::incremental_mode): New function.
7640         (General_options::incremental_mode_): New data member.
7641         * parameters.cc (Parameters::incremental_mode_): New data member.
7642         (Parameters::set_options): Set incremental_mode_.
7643         (Parameters::set_incremental_full): New function.
7644         (Parameters::incremental): New function.
7645         (Parameters::incremental_update): New function.
7646         (set_parameters_incremental_full): New function.
7647         * parameters.h (Parameters::set_incremental_full): New function.
7648         (Parameters::incremental): New function.
7649         (Parameters::incremental_update): New function.
7650         (Parameters::incremental_mode_): New data member.
7651         (set_parameters_incremental_full): New function.
7652         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
7653         incremental link mode.
7654         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
7655         (Sized_relobj::do_relocate_sections): Likewise.
7656         * testsuite/Makefile.am (incremental_test): Use --incremental-full
7657         option.
7658         * testsuite/Makefile.in: Regenerate.
7659         * testsuite/incremental_test.sh: Filter all forms of --incremental.
7660
7661 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7662
7663         * script-sections.h (class Script_sections): Make
7664         Sections_elements typedef public.
7665         * script-sections.cc (class Sort_output_sections): Add elements_
7666         field.  Add constructor which sets it; change all callers.
7667         (Sort_output_sections::is_before): New function.
7668         (Sort_output_sections::operator()): Call is_before.
7669         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
7670         conditional.
7671         * testsuite/script_test_10.sh: New test. Test script section
7672         order.
7673         * testsuite/script_test_10.t: Likewise.
7674         * testsuite/script_test_10.s: Likewise.
7675         * testsuite/Makefile.am: Wrap the cross linker tests and the
7676         common tests into NATIVE_OR_CROSS_LINKER.
7677         (check_SCRIPTS): Add script_test_10.sh.
7678         (check_DATA): Add script_test_10.stdout.
7679         (script_test_10.o, script_test_10): New targets.
7680         (script_test_10.stdout): New target.
7681         * configure, testsuite/Makefile.in: Regenerate.
7682
7683 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7684
7685         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
7686         error for the deprecated relocations.
7687         (Target_arm::Scan::global): Likewise.
7688         (Target_arm::Relocate::relocate): Likewise.
7689
7690 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
7691
7692         * fileread.cc (Input_file::find_file): Initialize *found_name
7693         and *namep when using the fallback search for case 4.
7694
7695 2010-10-11  Cary Coutant  <ccoutant@google.com>
7696
7697         * options.h (class General_options): Redefine -z lazy as an alias for
7698         the negation of -z now.
7699
7700 2010-10-11  Ian Lance Taylor  <iant@google.com>
7701
7702         * resolve.cc (symbol_to_bits): Report the value of the unsupported
7703         binding.
7704
7705 2010-10-06  Nick Clifton  <nickc@redhat.com>
7706
7707         * script-sections.cc(class Memory_region): Remove
7708         current_lma_offset_ field.  Rename current_vma_offset_ to
7709         current_offset_.  Add last_section_ field.
7710         (Memory_region::get_current_vma_address): Rename to
7711         get_current_address.
7712         (Memory_region::get_current_lma_address): Delete.
7713         (Memory_region::increment_vma_offset): Rename to
7714         increment_offset.
7715         (Memory_region::increment_lma_offset): Delete.
7716         (Memory_region::attributes_compatible): New method.  Returns
7717         true if the provided section is compatible with the region.
7718         (Memory_region::get_last_section): New method.  Returns the last
7719         section to use the region.
7720         (Memory_region::set_last_section): New method.  Stores the last
7721         section to use the region.
7722         (Script_sections::block_in_region): New method.  Returns true if
7723         a block of memory is contained within a region.
7724         (Script_sections::find_memory_region): New method.  Locates a
7725         memory region to be used to set a VMA or LMA address.
7726         (Output_section_definition::set_section_addresses): Add code to
7727         check for addresses set by memory regions.
7728         (Output_segment::set_section_addresses): Remove memory region
7729         walking code.
7730         (Script_sections::create_segment): Add a warning if a header
7731         segment is created outside of any region.
7732         * script-sections.h (class Script_sections): Add prototypes for
7733         find_memory_region and block_in_region methods.
7734         * testsuite/memory_test.s: Use .long instead of .word.
7735         * testsuite/memory_test.t: Add some more output sections.
7736         * testsuite/memory_test.sh: Update expected output.
7737
7738 2010-10-02  Doug Kwan  <dougkwan@google.com>
7739
7740         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
7741         defintion to symtab.h
7742         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
7743         declaration to defintion.
7744
7745 2010-10-01  Nick Clifton  <nickc@redhat.com>
7746
7747         * expression.cc (eval): Replace dummy argument with NULL.
7748         (eval_maybe_dot): Check for a NULL result section pointer.
7749         (Symbol_expression::value): Likewise.
7750         (Dot_expression::value): Likewise.
7751         (BINARY_EXPRESSION): Likewise.
7752         (Max_expression::value): Likewise.
7753         (Min_expression::value): Likewise.
7754         (Absolute_expression::value): Likewise.
7755         (Addr_expression::value_from_output_section): Likewise.
7756         (Loaddddr_expression::value_from_output_section): Likewise.
7757         (Segment_start_expression::value): Likewise.
7758         * script-sections.cc
7759         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
7760         argument with NULL.
7761         (Sections_elememt_dot_assignment::set_section_addresses):
7762         Likewise.
7763         (Output_data_expression::do_write_to_buffer): Likewise.
7764         (Output_section_definition::finalize_symbols): Likewise.
7765         (Output_section_definition::set_section_addresses): Likewise.
7766
7767 2010-09-30  Doug Kwan  <dougkwan@google.com>
7768
7769         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
7770
7771 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
7772
7773         * target.h (Target::can_icf_inline_merge_sections): New virtual
7774         function.
7775         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7776         virtual function.
7777         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
7778         virtual function.
7779         * icf.cc (get_section_contents): Inline merge sections only when
7780         target allows it.
7781
7782 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7783
7784         * configure: Regenerate.
7785
7786 2010-09-17  Ian Lance Taylor  <iant@google.com>
7787
7788         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7789         * testsuite/Makefile.am (memory_test.o): New target.
7790         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7791         memory_test.t.
7792         * testsuite/Makefile.in: Rebuild.
7793
7794 2010-09-17  Doug Kwan  <dougkwan@google.com>
7795
7796         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7797         defintion if relocation uses GOT entries of the symbol.
7798         * testsuite/icf_safe_test.sh: Fix test.
7799         * testsuite/icf_safe_so_test.sh: Fix test.
7800
7801 2010-09-16  Cary Coutant  <ccoutant@google.com>
7802
7803         * script_sections.cc (class Memory_region): Remove "NULL" from
7804         vector initializations.
7805
7806 2010-09-15  Cary Coutant  <ccoutant@google.com>
7807
7808         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7809         Resolve forwarding symbols.
7810
7811 2010-09-15  Doug Kwan  <dougkwan@google.com>
7812
7813         * gold/testsuite/script_test_3.t: Add ARM special sections.
7814         * gold/testsuite/script_test_4.t: Same.
7815         * gold/testsuite/script_test_5.t: Same.
7816         * gold/testsuite/script_test_6.t: Same.
7817         * gold/testsuite/script_test_7.t: Same.
7818         * gold/testsuite/script_test_7.t: Same.
7819         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7820
7821 2010-09-14  Cary Coutant  <ccoutant@google.com>
7822
7823         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7824         (Target_x86_64::Relocate::relocate_tls): Replace check for
7825         saw_tls_block_reloc_ with test for executable section.
7826
7827 2010-09-12  Cary Coutant  <ccoutant@google.com>
7828
7829         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7830         position-independent executables to shared libraries need dynamic
7831         relocations.
7832         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
7833         position-independent executables.
7834         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
7835         * testsuite/Makefile.in: Regenerate.
7836
7837 2010-09-10  Nick Clifton  <nickc@redhat.com>
7838
7839         PR gold/11997
7840         * testsuite/memory_test.t: Discard any sections that are not
7841         needed.
7842
7843 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
7844
7845         PR gold/11996
7846         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
7847         "This::" to work around a bug in gcc 4.2.
7848
7849         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
7850
7851 2010-09-09  Rafael Espindola  <espindola@google.com>
7852
7853         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
7854         sections with different PF_X flags in the same segment.
7855         (Layout::find_first_load_seg): Search all segments to find the first
7856         one.
7857         * options.h (rosegment): New.
7858
7859 2010-09-08  Rafael Espindola  <espindola@google.com>
7860
7861         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
7862
7863 2010-09-08  Doug Kwan  <dougkwan@google.com>
7864
7865         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
7866         (Arm_relobj::do_relocate_sections): Add new parameter for output
7867         file to match the parent.
7868         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
7869         of local symbols instead of input values.  Update code to track
7870         changes in gold::relocate_section.
7871         * object.cc (Sized_relobj::compute_final_local_value): New methods.
7872         (Sized_relobj::compute_final_local_value_internal): New methods.
7873         (Sized_relobj::do_finalize_local_symbols): Move code from loop
7874         body into private version of Sized_relobj::compute_final_local_value.
7875         Call the inline method.
7876         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
7877         merged symbol value if there is one.
7878         (Symbol_value::has_output_value): New method defintiion.
7879         (Sized_relobj::Compute_final_local_value_status): New enum type.
7880         (Sized_relobj::compute_final_local_value): New methods.
7881         (Sized_relobj::compute_final_local_value_internal): New methods.
7882         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
7883         and arm_cortex_a8.sh.
7884         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
7885         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
7886         New tests.
7887         * Makefile.in: Regenerate.
7888         * testsuite/arm_bl_out_of_range.s: Update test.
7889         * testsuite/thumb_bl_out_of_range.s: Ditto.
7890         * testsuite/thumb_blx_out_of_range.s: Ditto.
7891         * testsuite/arm_branch_out_of_range.sh: New file.
7892         * testsuite/arm_cortex_a8.sh: Ditto.
7893         * testsuite/arm_cortex_a8_b.s: Ditto.
7894         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
7895         * testsuite/arm_cortex_a8_b_local.s: Ditto.
7896         * testsuite/arm_cortex_a8_bl.s: Ditto.
7897         * testsuite/arm_cortex_a8_blx.s: Ditto.
7898         * testsuite/arm_cortex_a8_local.s: Ditto.
7899         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
7900         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
7901
7902 2010-09-08  Rafael Espindola  <espindola@google.com>
7903
7904         * Makefile.am (memory_test.stdout): Run readelf with -W.
7905         * Makefile.in: Regenerate.
7906         * testsuite/memory_test.sh: Make the regexps accept both 32 and
7907         64 bit output.
7908
7909 2010-09-08  Rafael Espindola  <espindola@google.com>
7910
7911         * script-sections.cc (Script_sections::add_memory_region): Convert
7912         field precision to int.
7913         * script.cc (script_set_section_region, script_set_section_region):
7914         Convert field precision to int.
7915
7916 2010-09-08  Rafael Espindola  <espindola@google.com>
7917
7918         * arm.cc (do_finalize_sections): Create the __exidx_start and
7919         __exdix_end symbols even when the section is missing.
7920
7921 2010-09-08  Nick Clifton  <nickc@redhat.com>
7922
7923         * README: Remove claim that MEMORY is not supported.
7924         * expression.cc (script_exp_function_origin)
7925         (script_exp_function_length): Move from here to ...
7926         * script.cc: ... here.
7927         (script_set_section_region, script_add_memory)
7928         (script_parse_memory_attr, script_include_directive): New
7929         functions.
7930         * script-sections.cc
7931         (class Memory_region): New class.
7932         (class Output_section_definition): Add set_memory_region,
7933         set_section_vma, set_section_lma and get_section_name methods.
7934         (class Script_Sections): Add add_memory_region,
7935         find_memory_region, find_memory_region_origin,
7936         find_memory_region_length and set_memory_region methods.
7937         Have set_section_addresses method walk the list of set memory
7938         regions.
7939         Extend the print methos to display memory regions.
7940         * script-sections.h: Add prototypes for new methods.
7941         Add enum for MEMORY region attributes.
7942         * yyscript.y: Add support for parsing MEMORY regions.
7943         * script-c.h: Add prototypes for new functions.
7944         * testsuite/Makefile.am: Add test of MEMORY region functionality.
7945         * testsuite/Makefile.in: Regenerate.
7946         * testsuite/memory_test.sh: New script.
7947         * testsuite/memory_test.s: New assembler source file.
7948         * testsuite/memory_test.t: New linker script.
7949
7950 2010-08-27  Doug Kwan  <dougkwan@google.com>
7951
7952         * gold/resolve.cc (Symbol_table::should_override): Let a weak
7953         reference override an existing dynamic weak reference.
7954         * testsuite/Makefile.am: Add new test dyn_weak_ref.
7955         * testsuite/Makefile.in: Regenerate.
7956         * testsuite/dyn_weak_ref.sh: New file.
7957         * testsuite/dyn_weak_ref_1.c: Ditto.
7958         * testsuite/dyn_weak_ref_2.c: Ditto.
7959
7960 2010-08-27  Ian Lance Taylor  <iant@google.com>
7961
7962         * incremental.h (class Incremental_input_entry): Add virtual
7963         destructor.
7964
7965 2010-08-27  Ian Lance Taylor  <iant@google.com>
7966
7967         * testsuite/start_lib_test_3.c: Mark t3 as used.
7968
7969 2010-08-27  Nick Clifton  <nickc@redhat.com>
7970
7971         * options.cc (version_script): Fix small typo in previous
7972         whitespace tidyup.
7973
7974 2010-08-25  Nick Clifton  <nickc@redhat.com>
7975
7976         * archive.cc: Formatting fixes: Remove whitespace between
7977         typename and following asterisk.  Remove whitespace between
7978         function name and opening parenthesis.
7979         * archive.h: Likewise.
7980         * arm.cc: Likewise.
7981         * attributes.cc: Likewise.
7982         * attributes.h: Likewise.
7983         * common.cc: Likewise.
7984         * copy-relocs.cc: Likewise.
7985         * dirsearch.h: Likewise.
7986         * dynobj.cc: Likewise.
7987         * ehframe.cc: Likewise.
7988         * ehframe.h: Likewise.
7989         * expression.cc: Likewise.
7990         * fileread.cc: Likewise.
7991         * fileread.h: Likewise.
7992         * gc.h: Likewise.
7993         * gold-threads.cc: Likewise.
7994         * gold.cc: Likewise.
7995         * i386.cc: Likewise.
7996         * icf.h: Likewise.
7997         * incremental-dump.cc: Likewise.
7998         * incremental.cc: Likewise.
7999         * layout.cc: Likewise.
8000         * layout.h: Likewise.
8001         * main.cc: Likewise.
8002         * merge.cc: Likewise.
8003         * merge.h: Likewise.
8004         * object.cc: Likewise.
8005         * object.h: Likewise.
8006         * options.cc: Likewise.
8007         * options.h: Likewise.
8008         * output.cc: Likewise.
8009         * output.h: Likewise.
8010         * plugin.cc: Likewise.
8011         * plugin.h: Likewise.
8012         * powerpc.cc: Likewise.
8013         * reloc.cc: Likewise.
8014         * script-c.h: Likewise.
8015         * script-sections.cc: Likewise.
8016         * script.cc: Likewise.
8017         * stringpool.cc: Likewise.
8018         * symtab.cc: Likewise.
8019         * symtab.h: Likewise.
8020         * target.cc: Likewise.
8021         * timer.cc: Likewise.
8022         * timer.h: Likewise.
8023         * version.cc: Likewise.
8024         * x86_64.cc: Likewise.
8025
8026 2010-08-24  Nick Clifton  <nickc@redhat.com>
8027
8028         PR 11899
8029         * layout.cc (segment_precedes): Sort segments by their physical
8030         addresses, if they have been set.
8031
8032 2010-08-23  Cary Coutant  <ccoutant@google.com>
8033
8034         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
8035         symbols data.
8036         (Lib_group::include_member): Unlock object after deleting its
8037         symbols data.
8038         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
8039         the bug fixed here.
8040
8041 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
8042             Cary Coutant  <ccoutant@google.com>
8043
8044         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
8045         constructor, and set_blocker.
8046         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
8047         readsyms_blocker_.
8048         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
8049         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
8050         * testsuite/Makefile.am (start_lib_test): New test case.
8051         * testsuite/Makefile.in: Regenerate.
8052         * testsuite/start_lib_test_main.c: New file.
8053         * testsuite/start_lib_test_1.c: New file.
8054         * testsuite/start_lib_test_2.c: New file.
8055         * testsuite/start_lib_test_3.c: New file.
8056
8057 2010-08-19  Ian Lance Taylor  <iant@google.com>
8058
8059         * Makefile.in: Rebuild with automake 1.11.1.
8060         * aclocal.m4: Likewise.
8061         * testsuite/Makefile.in: Likewise.
8062
8063 2010-08-19  Ian Lance Taylor  <iant@google.com>
8064
8065         PR 10893
8066         * i386.cc (class Output_data_plt_i386): Update declarations.
8067         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
8068         local_ifuncs_ fields.
8069         (Target_i386::do_plt_section_for_global): New function.
8070         (Target_i386::do_plt_section_for_local): New function.
8071         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
8072         parameter; change all callers.  Initialize global_ifuncs_ and
8073         local_ifuncs_.  If doing a static link define __rel_iplt_start and
8074         __rel_iplt_end.
8075         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
8076         (Output_data_plt_i386::add_local_ifunc_entry): New function.
8077         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
8078         symbols.
8079         (Target_i386::make_plt_section): New function, broken out of
8080         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
8081         (Target_i386::make_plt_entry): Call make_plt_section.
8082         (Target_i386::make_local_ifunc_plt_entry): New function.
8083         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
8084         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
8085         R_386_IRELATIVE to switch.
8086         (Target_i386::Scan::global): Likewise.
8087         (Target_i386::Relocate::relocate): Likewise.
8088         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
8089         switch.
8090         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
8091         (Target_x86_64::do_plt_section_for_global): New function.
8092         (Target_x86_64::do_plt_section_for_local): New function.
8093         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
8094         parameter; change all callers.  If doing a static link define
8095         __rela_iplt_start and __rela_iplt_end.
8096         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
8097         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
8098         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
8099         to point to .plt.
8100         (Target_x86_64::make_local_ifunc_plt_entry): New function.
8101         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
8102         switch.
8103         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
8104         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
8105         R_X86_64_IRELATIVE to switch.
8106         (Target_x86_64::Scan::global): Likewise.
8107         (Target_x86_64::Relocate::relocate): Likewise.
8108         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
8109         switch.
8110         * target.h (class Target): Add plt_section_for_global and
8111         plt_section_for_local functions.  Add do_plt_section_for_global
8112         and do_plt_section_for_local virtual functions.
8113         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
8114         clarifying comments.
8115         (Symbol::use_plt_offset): Handle IFUNC symbol.
8116         * object.cc (Sized_relobj::Sized_relobj): Initialize
8117         local_plt_offsets_.
8118         (Sized_relobj::local_has_plt_offset): New function.
8119         (Sized_relobj::local_plt_offset): New function.
8120         (Sized_relobj::set_local_plt_offset): New function.
8121         (Sized_relobj::do_count): Handle IFUNC symbol.
8122         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
8123         a bit away from input_shndx_ field.  Add set_is_func_symbol and
8124         is_ifunc_symbol functions.
8125         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
8126         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
8127         local_plt_offsets_ field.
8128         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
8129         * output.h (class Output_section_data): Add non-const
8130         output_section function.
8131         (class Output_data_got): Update declarations.
8132         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
8133         Add use_plt_offset parameter to global and local constructors.
8134         Change all callers.  Change local_sym_index_ field to 31 bits.
8135         Change GSYM_CODE and CONSTANT_CODE accordingly.
8136         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
8137         doing a static link don't set sh_link field.
8138         (Output_data_got::Got_entry::write): Use PLT offset if
8139         appropriate.
8140         (Output_data_got::add_global_plt): New function.
8141         (Output_data_got::add_local_plt): New function.
8142         * target-reloc.h (relocate_section): Handle IFUNC symbol.
8143         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
8144         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
8145         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
8146         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
8147         IFUNC conditional.
8148         * testsuite/ifunc-sel.h: New file.
8149         * testsuite/ifuncmain1.c: New file.
8150         * testsuite/ifuncmain1vis.c: New file.
8151         * testsuite/ifuncmod1.c: New file.
8152         * testsuite/ifuncdep2.c: New file.
8153         * testsuite/ifuncmain2.c: New file.
8154         * testsuite/ifuncmain3.c: New file.
8155         * testsuite/ifuncmod3.c: New file.
8156         * testsuite/ifuncmain4.c: New file.
8157         * testsuite/ifuncmain5.c: New file.
8158         * testsuite/ifuncmod5.c: New file.
8159         * testsuite/ifuncmain6pie.c: New file.
8160         * testsuite/ifuncmod6.c: New file.
8161         * testsuite/ifuncmain7.c: New file.
8162         * configure, testsuite/Makefile.in: Rebuild.
8163
8164 2010-08-18  Ian Lance Taylor  <iant@google.com>
8165
8166         * incremental.cc
8167         (Output_section_incremental_inputs::write_input_files): Add cast
8168         to avoid signed/unsigned comparison warning.
8169         (Output_section_incremental_inputs::write_info_blocks): Likewise.
8170
8171 2010-08-12  Cary Coutant  <ccoutant@google.com>
8172
8173         * common.cc (Sort_commons::operator()): Remove unnecessary code.
8174
8175 2010-08-13  Ian Lance Taylor  <iant@google.com>
8176
8177         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
8178
8179 2010-08-12  Cary Coutant  <ccoutant@google.com>
8180             Doug Kwan  <dougkwan@google.com>
8181
8182         * resolve.cc (Symbol_table::should_override): When a weak dynamic
8183         defintion overrides non-weak undef, remember that the original undef
8184         is not weak.
8185         * symtab.cc (Symbol_table::sized_write_global): For undef without
8186         an original weak binding, set binding to global in output.
8187         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
8188         * testsuite/Makefile.in: Regenerate.
8189         * testsuite/strong_ref_weak_def.sh: New file.
8190         * testsuite/strong_ref_weak_def_1.c: Ditto.
8191         * testsuite/strong_ref_weak_def_2.c: Ditto.
8192
8193 2010-08-12  Cary Coutant  <ccoutant@google.com>
8194
8195         * testsuite/incremental_test.sh: Rewrite.
8196         * testsuite/incremental_test_1.c: Rewrite.
8197         * testsuite/incremental_test_2.c: Rewrite.
8198
8199 2010-08-12  Cary Coutant  <ccoutant@google.com>
8200
8201         * arm.cc (Target_arm::got_size): Add const.
8202         (Target_arm::got_entry_count): New function.
8203         (Target_arm::plt_entry_count): New function.
8204         (Target_arm::first_plt_entry_offset): New function.
8205         (Target_arm::plt_entry_size): New function.
8206         (Output_data_plt_arm::entry_count): New function.
8207         (Output_data_plt_arm::first_plt_entry_offset): New function.
8208         (Output_data_plt_arm::get_plt_entry_size): New function.
8209         * i386.cc (Target_i386::got_size): Add const.
8210         (Target_i386::got_entry_count): New function.
8211         (Target_i386::plt_entry_count): New function.
8212         (Target_i386::first_plt_entry_offset): New function.
8213         (Target_i386::plt_entry_size): New function.
8214         (Output_data_plt_i386::entry_count): New function.
8215         (Output_data_plt_i386::first_plt_entry_offset): New function.
8216         (Output_data_plt_i386::get_plt_entry_size): New function.
8217         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
8218         find_incremental_inputs_sections.  Dump incremental_got_plt section.
8219         * incremental.cc: Include target.h.
8220         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
8221         parameter.  Adjust all callers.  Find incremental_got_plt section.
8222         (Incremental_inputs::create_data_sections): Create incremental_got_plt
8223         section.
8224         (Output_section_incremental_inputs::set_final_data_size): Calculate
8225         size of incremental_got_plt section.
8226         (Output_section_incremental_inputs::do_write): Write the
8227         incremental_got_plt section.
8228         (Got_plt_view_info): New struct.
8229         (Local_got_offset_visitor): New class.
8230         (Global_got_offset_visitor): New class.
8231         (Global_symbol_visitor_got_plt): New class.
8232         (Output_section_incremental_inputs::write_got_plt): New function.
8233         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
8234         Add parameter.  Adjust all callers.
8235         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8236         (Incremental_inputs::got_plt_section): New function.
8237         (Incremental_inputs::got_plt_section_): New data member.
8238         (Incremental_got_plt_reader): New class.
8239         * layout.cc (Layout::create_incremental_info_sections): Add the
8240         incremental_got_plt section.
8241         * object.h (Got_offset_list::get_list): New function.
8242         (Got offset_list::for_all_got_offsets): New function.
8243         (Sized_relobj::local_got_offset_list): New function.
8244         * powerpc.cc (Target_powerpc::got_size): Add const.
8245         (Target_powerpc::got_entry_count): New function.
8246         (Target_powerpc::plt_entry_count): New function.
8247         (Target_powerpc::first_plt_entry_offset): New function.
8248         (Target_powerpc::plt_entry_size): New function.
8249         (Output_data_plt_powerpc::entry_count): New function.
8250         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
8251         (Output_data_plt_powerpc::get_plt_entry_size): New function.
8252         * sparc.cc (Target_sparc::got_size): Add const.
8253         (Target_sparc::got_entry_count): New function.
8254         (Target_sparc::plt_entry_count): New function.
8255         (Target_sparc::first_plt_entry_offset): New function.
8256         (Target_sparc::plt_entry_size): New function.
8257         (Output_data_plt_sparc::entry_count): New function.
8258         (Output_data_plt_sparc::first_plt_entry_offset): New function.
8259         (Output_data_plt_sparc::get_plt_entry_size): New function.
8260         * symtab.h (Symbol::got_offset_list): New function.
8261         (Symbol_table::for_all_symbols): New function.
8262         * target.h (Sized_target::got_entry_count): New function.
8263         (Sized_target::plt_entry_count): New function.
8264         (Sized_target::plt_entry_size): New function.
8265         * x86_64.cc (Target_x86_64::got_size): Add const.
8266         (Target_x86_64::got_entry_count): New function.
8267         (Target_x86_64::plt_entry_count): New function.
8268         (Target_x86_64::first_plt_entry_offset): New function.
8269         (Target_x86_64::plt_entry_size): New function.
8270         (Output_data_plt_x86_64::entry_count): New function.
8271         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
8272         (Output_data_plt_x86_64::get_plt_entry_size): New function.
8273
8274 2010-08-12  Cary Coutant  <ccoutant@google.com>
8275
8276         * archive.cc: Include incremental.h.
8277         (Archive::Archive): Initialize incremental_info_.
8278         (Archive::include_member): Record archive members in incremental info.
8279         (Add_archive_symbols::run): Record begin and end of an archive in
8280         incremental info.
8281         (Lib_group::include_member): Record objects in incremental info.
8282         * archive.h (Incremental_archive_entry): Forward declaration.
8283         (Archive::set_incremental_info): New member function.
8284         (Archive::incremental_info): New member function.
8285         (Archive::Unused_symbol_iterator): New class.
8286         (Archive::unused_symbols_begin): New member function.
8287         (Archive::unused_symbols_end): New member function.
8288         (Archive::incremental_info_): New data member.
8289         * incremental-dump.cc (find_input_containing_global): New function.
8290         (dump_incremental_inputs): Dump new incremental info sections.
8291         * incremental.cc: Include symtab.h.
8292         (Output_section_incremental_inputs): New class.
8293         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
8294         new incremental info sections.
8295         (Sized_incremental_binary::do_check_inputs): Likewise.
8296         (Incremental_inputs::report_archive): Remove.
8297         (Incremental_inputs::report_archive_begin): New function.
8298         (Incremental_inputs::report_archive_end): New function.
8299         (Incremental_inputs::report_object): New function.
8300         (Incremental_inputs::finalize_inputs): Remove.
8301         (Incremental_inputs::report_input_section): New function.
8302         (Incremental_inputs::report_script): Rewrite.
8303         (Incremental_inputs::finalize): Do nothing but finalize string table.
8304         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8305         (Incremental_inputs::sized_create_inputs_section_data): Remove.
8306         (Incremental_inputs::create_data_sections): New function.
8307         (Incremental_inputs::relocs_entsize): New function.
8308         (Output_section_incremental_inputs::set_final_data_size): New function.
8309         (Output_section_incremental_inputs::do_write): New function.
8310         (Output_section_incremental_inputs::write_header): New function.
8311         (Output_section_incremental_inputs::write_input_files): New function.
8312         (Output_section_incremental_inputs::write_info_blocks): New function.
8313         (Output_section_incremental_inputs::write_symtab): New function.
8314         * incremental.h (Incremental_script_entry): Forward declaration.
8315         (Incremental_object_entry): Forward declaration.
8316         (Incremental_archive_entry): Forward declaration.
8317         (Incremental_inputs): Forward declaration.
8318         (Incremental_inputs_header_data): Remove.
8319         (Incremental_inputs_header): Remove.
8320         (Incremental_inputs_header_write): Remove.
8321         (Incremental_inputs_entry_data): Remove.
8322         (Incremental_inputs_entry): Remove.
8323         (Incremental_inputs_entry_write): Remove.
8324         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
8325         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
8326         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8327         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
8328         Likewise.
8329         (Incremental_input_entry): New class.
8330         (Incremental_script_entry): New class.
8331         (Incremental_object_entry): New class.
8332         (Incremental_archive_entry): New class.
8333         (Incremental_inputs::Incremental_inputs): Initialize new data members.
8334         (Incremental_inputs::report_inputs): Remove.
8335         (Incremental_inputs::report_archive): Remove.
8336         (Incremental_inputs::report_archive_begin): New function.
8337         (Incremental_inputs::report_archive_end): New function.
8338         (Incremental_inputs::report_object): Change prototype.
8339         (Incremental_inputs::report_input_section): New function.
8340         (Incremental_inputs::report_script): Change prototype.
8341         (Incremental_inputs::get_reloc_count): New function.
8342         (Incremental_inputs::set_reloc_count): New function.
8343         (Incremental_inputs::create_data_sections): New function.
8344         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8345         (Incremental_inputs::inputs_section): New function.
8346         (Incremental_inputs::symtab_section): New function.
8347         (Incremental_inputs::relocs_section): New function.
8348         (Incremental_inputs::get_stringpool): Add const.
8349         (Incremental_inputs::command_line): Add const.
8350         (Incremental_inputs::inputs): Remove.
8351         (Incremental_inputs::command_line_key): New function.
8352         (Incremental_inputs::input_file_count): New function.
8353         (Incremental_inputs::input_files): New function.
8354         (Incremental_inputs::relocs_entsize): New function.
8355         (Incremental_inputs::sized_create_inputs_section_data): Remove.
8356         (Incremental_inputs::finalize_inputs): Remove.
8357         (Incremental_inputs::Input_info): Remove.
8358         (Incremental_inputs::lock_): Remove.
8359         (Incremental_inputs::inputs_): Change type.
8360         (Incremental_inputs::inputs_map_): Remove.
8361         (Incremental_inputs::current_object_entry_): New data member.
8362         (Incremental_inputs::inputs_section_): New data member.
8363         (Incremental_inputs::symtab_section_): New data member.
8364         (Incremental_inputs::relocs_section_): New data member.
8365         (Incremental_inputs::reloc_count_): New data member.
8366         (Incremental_inputs_reader): New class.
8367         (Incremental_symtab_reader): New class.
8368         (Incremental_relocs_reader): New class.
8369         * layout.cc (Layout::finalize): Move finalization of incremental info
8370         and creation of incremental info sections to follow finalization of
8371         symbol table.  Set offsets for postprocessing sections.
8372         (Layout::create_incremental_info_sections): Call
8373         Incremental_inputs::create_data_sections.  Add incremental symtab
8374         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
8375         sections to layout after input sections.
8376         * layout.h (struct Timespec): Forward declaration.
8377         (Layout::incremental_inputs): Add const.
8378         (Layout::create_incremental_info_sections): Add parameter.
8379         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
8380         * object.cc: Include incremental.h.
8381         (Relobj::finalize_incremental_relocs): New function.
8382         (Sized_relobj::do_layout): Record input sections in incremental info.
8383         * object.h (Object::output_section): New function.
8384         (Object::output_section_offset): Moved from Relobj.
8385         (Object::get_incremental_reloc_base): New function.
8386         (Object::get_incremental_reloc_count): New function.
8387         (Object::do_output_section): New function.
8388         (Object::do_output_section_offset): Moved from Relobj.
8389         (Object::do_get_incremental_reloc_base): New function.
8390         (Object::do_get_incremental_reloc_count): New function.
8391         (Object::Object): Initialize new data members.
8392         (Relobj::output_section): Renamed do_output_section and moved to
8393         protected.
8394         (Relobj::output_section_offset): Moved to Object.
8395         (Relobj::do_get_incremental_reloc_base): New function.
8396         (Relobj::do_get_incremental_reloc_count): New function.
8397         (Relobj::allocate_incremental_reloc_counts): New function.
8398         (Relobj::count_incremental_reloc): New function.
8399         (Relobj::finalize_incremental_relocs): New function.
8400         (Relobj::next_incremental_reloc_index): New function.
8401         (Relobj::reloc_counts_): New data member.
8402         (Relobj::reloc_bases_): New data member.
8403         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
8404         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
8405         (Sized_relobj::incremental_relocs_scan): New function.
8406         (Sized_relobj::incremental_relocs_scan_reltype): New function.
8407         (Sized_relobj::incremental_relocs_write): New function.
8408         (Sized_relobj::incremental_relocs_write_reltype): New function.
8409         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
8410         incremental link.
8411         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
8412         archives and object files elsewhere.
8413         (Add_symbols::run): Report object files here.
8414         (Finish_group::run): Report end of archive at end of group.
8415         * reloc.cc: Include layout.h, incremental.h.
8416         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
8417         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
8418         (Sized_relobj::incremental_relocs_scan): New function.
8419         (Sized_relobj::incremental_relocs_scan_reltype): New function.
8420         (Sized_relobj::do_relocate_sections): Write incremental relocations.
8421         (Sized_relobj::incremental_relocs_write): New function.
8422         (Sized_relobj::incremental_relocs_write_reltype): New function.
8423         * script.cc (read_input_script): Rewrite test for incremental link.
8424         Change call to Incremental_inputs::report_script.
8425         * symtab.h (Symbol_table::first_global_index): New function.
8426         (Symbol_table::output_count): New function.
8427
8428 2010-08-12  Doug Kwan  <dougkwan@google.com>
8429
8430         * arm.cc (Target_arm::merge_object_attributes): Check command line
8431         options --no-wchar-size-warning and --no-enum-size-warning.
8432         * options.h (General_options): Add ld-compatible options
8433         --no-enum-size-warning and --no-wchar-size-warning.
8434
8435 2010-08-04  Ian Lance Taylor  <iant@google.com>
8436
8437         * x86_64.cc (Target_x86_64::Scan::local): Use
8438         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
8439         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
8440         (Target_x86_64::Scan::global): Likewise.
8441         (Target_x86_64::Relocate::relocate): Likewise.
8442         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
8443         Likewise.
8444
8445 2010-08-03  Cary Coutant  <ccoutant@google.com>
8446
8447         * merge.cc (Output_merge_string::do_add_input_section): Count strings
8448         to reserve space in merged_strings vector. Keep total input size
8449         for stats.
8450         (Output_merge_string::do_print_merge_stats): Print total input size.
8451         * merge.h (Output_merge_string): Add input_size_ field.
8452         * stringpool.cc (Stringpool_template::string_length): Move
8453         implementations out of Stringpool_template class and place in
8454         stringpool.h.
8455         * stringpool.h (string_length): Move out of Stringpool_template.
8456
8457 2010-08-03  Ian Lance Taylor  <iant@google.com>
8458
8459         PR 11712
8460         * layout.cc (relaxation_loop_body): If address of load segment is
8461         set, adjust address to include headers if possible.
8462
8463 2010-08-03  Ian Lance Taylor  <iant@google.com>
8464
8465         * version.cc (version_string): Bump to 1.10.
8466
8467 2010-08-03  Ian Lance Taylor  <iant@google.com>
8468
8469         PR 11805
8470         * layout.h (enum Output_section_order): Define.
8471         (class Layout): Update declarations.
8472         * layout.cc (Layout::get_output_section): Add order parameter.
8473         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
8474         is_first_non_relro parameters.  Change all callers.
8475         (Layout::choose_output_section): Likewise.
8476         (Layout::add_output_section_data): Likewise.
8477         (Layout::make_output_section): Likewise.  Set order.
8478         (Layout::default_section_order): New function.
8479         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
8480         * output.cc (Output_section::Output_section): Initialize order_.
8481         Don't initialize deleted fields.
8482         (Output_segment::Output_segment): Don't initialize deleted
8483         fields.
8484         (Output_segment::add_output_section_to_load): New function
8485         replacing add_output_section.  Change all callers to call this or
8486         add_output_section_to_nonload.
8487         (Output_segment::add_output_section_to_nonload): New function.
8488         (Output_segment::remove_output_section): Rewrite.
8489         (Output_segment::add_initial_output_data): Likewise.
8490         (Output_segment::has_any_data_sections): Likewise.
8491         (Output_segment::is_first_section_relro): Likewise.
8492         (Output_segment::maximum_alignment): Likewise.
8493         (Output_segment::has_dynamic_reloc): New function replacing
8494         dynamic_reloc_count.  Change all callers.
8495         (Output_segment::has_dynamic_reloc_list): New function replacing
8496         dynamic_reloc_count_list.  Change all callers.
8497         (Output_segment::set_section_addresses): Rewrite.
8498         (Output_segment::set_offset): Rewrite.
8499         (Output_segment::find_first_and_last_list): Remove.
8500         (Output_segment::set_tls_offsets): Rewrite.
8501         (Output_segment::first_section_load_address): Likewise.
8502         (Output_segment::output_section_count): Likewise.
8503         (Output_segment::section_with_lowest_load_address): Likewise.
8504         (Output_segment::write_section_headers): Likewise.
8505         (Output_segment::print_sections_to_map): Likewise.
8506         * output.h (class Output_data): Remove dynamic_reloc_count_
8507         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
8508         (Output_data::add_dynamic_reloc): Rewrite.
8509         (Output_data::has_dynamic_reloc): New function.
8510         (Output_data::dynamic_reloc_count): Remove.
8511         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
8512         is_last_relro_, is_first_non_relro_, is_interp_,
8513         is_dynamic_linker_section_ fields.  Add order and set_order
8514         functions.  Remove is_relro_local, set_is_relro_local,
8515         is_last_relro, set_is_last_relro, is_first_non_relro,
8516         set_is_first_non_relro functions, is_interp, set_is_interp,
8517         is_dynamic_linker_section, and set_is_dynamic_linker_section
8518         functions.
8519         (class Output_segment): Change Output_data_list from std::list to
8520         std:;vector.  Add output_lists_ field.  Remove output_data_ and
8521         output_bss_ fields.  Update declarations.
8522
8523 2010-08-02  Ian Lance Taylor  <iant@google.com>
8524
8525         * arm.cc (Target_arm::gc_process_relocs): Use typename.
8526         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
8527         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
8528
8529 2010-08-02  Ian Lance Taylor  <iant@google.com>
8530
8531         PR 11855
8532         * script.cc (Script_options::Script_options): Initialize
8533         symbol_definitions_ and symbol_references_.
8534         (Script_options::add_symbol_assignment): Update
8535         symbol_definitions_ and symbol_references_.
8536         (Script_options::add_symbol_reference): New function.
8537         (script_symbol): New function.
8538         * script.h (class Script_options): Add symbol_definitions_ and
8539         symbol_references_ fields.
8540         (Script_options::referenced_const_iterator): New type.
8541         (Script_options::referenced_begin): New function.
8542         (Script_options::referenced_end): New function.
8543         (Script_options::is_referenced): New function.
8544         (Script_options::any_unreferenced): New function.
8545         * script-c.h (script_symbol): Declare.
8546         * yyscript.y (exp): Call script_symbol.
8547         * symtab.cc: Include "script.h".
8548         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
8549         Change all callers.  Check symbols referenced by scripts.
8550         (Symbol_table::add_undefined_symbols_from_command_line): Add
8551         layout parameter.  Change all callers.
8552         (Symbol_table::do_add_undefined_symbols_from_command_line):
8553         Likewise.  Break out loop body.  Check symbols referenced by
8554         scripts.
8555         (Symbol_table::add_undefined_symbol_from_command_line): New
8556         function broken out of
8557         do_add_undefined_symbols_from_command_line.
8558         * symtab.h (class Symbol_table): Update declarations.
8559         * archive.cc: Include "layout.h".
8560         (Archive::should_include_member): Add layout parameter.  Change
8561         all callers.  Check for symbol mentioned in expression.
8562         * archive.h (class Archive): Update declaration.
8563         * object.cc (Sized_relobj::do_should_include_member): Add layout
8564         parameter.
8565         * object.h (Object::should_include_member): Add layout parameter.
8566         Change all callers.
8567         (Object::do_should_include_member): Add layout parameter.
8568         (class Sized_relobj): Update declaration.
8569         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
8570         parameter.
8571         * dynobj.h (class Sized_dynobj): Update declaration.
8572         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
8573         layout parameter.
8574         * plugin.h (class Sized_pluginobj): Update declaration.
8575
8576 2010-08-02  Ian Lance Taylor  <iant@google.com>
8577
8578         PR 11866
8579         * output.cc (Output_segment::set_offset): Search for the first and
8580         last sections rather than assuming that the list is in order.
8581         (Output_segment::find_first_and_last_list): New function.
8582         * output.h (class Output_segment): Update declarations.
8583         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
8584         (relro_strip_test_SOURCES): New variable.
8585         (relro_strip_test_DEPENDENCIES): New variable.
8586         (relro_strip_test_LDFLAGS): New variable.
8587         (relro_strip_test_LDADD): New variable.
8588         (relro_strip_test.so): New target.
8589
8590 2010-08-02  Ian Lance Taylor  <iant@google.com>
8591
8592         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
8593         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
8594         (Target_i386::got_tlsdesc_section): New function.
8595         (Target_i386::got_section): Create space for GOT entries for
8596         TLSDESC relocations.
8597         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
8598         R_386_TLS_GOTDESC.
8599         (Target_i386::Scan::global): Likewise.
8600         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
8601         using TLSDESC GOT.
8602         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
8603         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
8604         (Target_x86_64::got_tlsdesc_section): New function.
8605         (Target_x86_64::got_section): Create space for GOT entries for
8606         TLSDESC relocations.
8607         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
8608         R_386_TLS_GOTDESC.
8609         (Target_x86_64::Scan::global): Likewise.
8610         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
8611         using TLSDESC GOT.
8612
8613 2010-08-02  Ian Lance Taylor  <iant@google.com>
8614
8615         * testsuite/final_layout.sh: Use dc to convert from hex to
8616         decimal.
8617
8618 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
8619
8620         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
8621         paramter to the call to gold::gc_process_relocs.
8622         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
8623         paramter to the call to gold::gc_process_relocs.
8624         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
8625         parameter to the call to gold::gc_process_relocs.
8626         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
8627         template parameter to the call to gold::gc_process_relocs.
8628         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
8629         paramter to the call to gold::gc_process_relocs.
8630         * gc.h (get_embedded_addend_size): New function.
8631         (gc_process_relocs): Save the size of the reloc for use by ICF.
8632         * icf.cc (get_section_contents): Get the addend from the text section
8633         for SHT_REL relocation sections.
8634         * icf.h (Icf::Reloc_addend_size_info): New typedef.
8635         (Icf::Reloc_info): Add new member reloc_addend_size_info.
8636         * int_encoding.h (read_from_pointer): New overloaded function.
8637         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
8638         * testsuite/icf_sht_rel_addend_test.sh: New file.
8639         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
8640         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
8641
8642 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8643
8644         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
8645         * Makefile.in: Regenerate.
8646         * testsuite/Makefile.in: Regenerate.
8647
8648 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
8649
8650         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
8651         * gold/testsuite/debug_msg.cc: Likewise.
8652         * gold/testsuite/odr_violation1.cc
8653         * gold/testsuite/odr_violation2.cc
8654
8655 2010-07-21  Cary Coutant  <ccoutant@google.com>
8656
8657         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
8658         string, and length fields.
8659         (Output_merge_string::Merged_strings_list): New type.
8660         (Output_merge_string::Merged_strings_lists): New typedef.
8661         (Output_merge_string): Replace merged_strings_ with
8662         merged_strings_lists_.
8663         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
8664         Merged_strings_list per input object and section.  Don't store pointer
8665         to the string.  Don't store length with each merged string entry.
8666         (Output_merge_string::finalize_merged_data): Loop over list of merged
8667         strings lists.  Recompute length of each merged string.
8668
8669 2010-07-15  Cary Coutant  <ccoutant@google.com>
8670
8671         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
8672         here.
8673
8674 2010-07-14  Ian Lance Taylor  <iant@google.com>
8675
8676         * descriptors.cc (Descriptors::open): Report correct name in error
8677         message.
8678
8679 2010-07-13  Doug Kwan  <dougkwan@google.com>
8680
8681         * arm.cc (Arm_input_section::Arm_input_section): For a
8682         SHT_ARM_EXIDX section, always keeps the input sections.
8683         (Arm_input_section::set_exidx_section_link): New method.
8684         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
8685         has_errors_ to false.
8686         (Arm_exidx_input_section::has_errors,
8687         Arm_exidx_input_section::set_has_errors): New methods.
8688         (Arm_exidx_input_section::has_errors_): New data member.
8689         (Arm_relobj::get_exidx_shndx_list): New method.
8690         (Arm_output_section::append_text_sections_to_list): Do not skip
8691         section without SHF_EXECINSTR.
8692         (Arm_output_section::fix_exidx_coverage): Skip input sections with
8693         errors.
8694         (Arm_relobj::make_exidx_input_section): Add new parameter for text
8695         section header.  Make error messages more verbose.  Check for
8696         a non-executable section linked to an EXIDX section.
8697         (Arm_relobj::do_read_symbols): Remove error checking, which has been
8698         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
8699         check that there is no deferred EXIDX section if we exit early.
8700         Instead of not making an EXIDX section in case of an error, make one
8701         and set the has_errors flag of it.
8702         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
8703         in a relocatable link.
8704         (Target_arm::do_relax): Look for the EXIDX output section instead of
8705         assuming that it is called .ARM.exidx.
8706         (Target_arm::fix_exidx_coverage): Add a new parameter for input
8707         section list.  Do not check for SHF_EXECINSTR section flags but
8708         skip any input section with errors.
8709         * output.cc (Output_section::Output_section): Initialize
8710         always_keeps_input_sections_ to false.
8711         (Output_section::add_input_section): Check for
8712         always_keeps_input_sections_.
8713         *  output.h (Output_section::always_keeps_input_sections,
8714         Output_section::set_always_keeps_input_sections): New methods.
8715         (Output_section::always_keeps_input_sections): New data member.
8716
8717 2010-07-13  Rafael Espindola  <espindola@google.com>
8718
8719         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
8720         * fileread.h (Input_file): Add try_extra_search_path and find_file.
8721
8722 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
8723             Ian Lance Taylor  <iant@google.com>
8724
8725         * output.h (Output_section_lookup_maps::add_merge_section):
8726         Correct check of whether value was inserted.
8727         (Output_section_lookup_maps::add_merge_input_section): Likewise.
8728         (Output_section_lookup_maps::add_relaxed_input_section):
8729         Likewise.
8730         * arm.cc (Target_arm::got_section): Remove used local os.
8731         * i386.cc (Target_i386::got_section): Likewise.
8732         * x86_64.cc (Target_x86_64::got_section): Likewise.
8733         * sparc.cc (Target_sparc::got_section): Likewise.
8734         (Target_sparc::relocate): Remove unused local have_got_offset.
8735         * powerpc.cc (Target_powerpc::relocate): Likewise.
8736
8737 2010-07-13  Ian Lance Taylor  <iant@google.com>
8738
8739         * compressed_output.cc (zlib_decompress): Fix signature in
8740         !HAVE_ZLIB_H case.
8741
8742         * archive.cc (Archive::include_member): Unlock an external member
8743         of a thin archive.  Don't bother to delete an object we know is
8744         NULL.
8745
8746 2010-07-12  Cary Coutant  <ccoutant@google.com>
8747
8748         * compressed_output.cc (zlib_decompress): New function.
8749         (get_uncompressed_size): New function.
8750         (decompress_input_section): New function.
8751         * compressed_output.h (get_uncompressed_size): New function.
8752         (decompress_input_section): New function.
8753         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
8754         Handle compressed debug sections.
8755         * layout.cc (is_compressed_debug_section): New function.
8756         (Layout::output_section_name): Map compressed section names to
8757         canonical names.
8758         * layout.h (is_compressed_debug_section): New function.
8759         (is_debug_info_section): Recognize compressed debug sections.
8760         * merge.cc: Include compressed_output.h.
8761         (Output_merge_data::do_add_input_section): Handle compressed
8762         debug sections.
8763         (Output_merge_string::do_add_input_section): Handle compressed
8764         debug sections.
8765         * object.cc: Include compressed_output.h.
8766         (Sized_relobj::Sized_relobj): Initialize new data members.
8767         (build_compressed_section_map): New function.
8768         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8769         * object.h (Object::section_is_compressed): New method.
8770         (Object::do_section_is_compressed): New method.
8771         (Sized_relobj::Compressed_section_map): New type.
8772         (Sized_relobj::do_section_is_compressed): New method.
8773         (Sized_relobj::compressed_sections_): New data member.
8774         * output.cc (Output_section::add_input_section): Handle compressed
8775         debug sections.
8776         * reloc.cc: Include compressed_output.h.
8777         (Sized_relobj::write_sections): Handle compressed debug sections.
8778
8779 2010-07-08  Cary Coutant  <ccoutant@google.com>
8780
8781         * resolve.cc (Symbol_table::resolve): Remember whether undef was
8782         weak when resolving to a dynamic def.
8783         (Symbol_table::should_override): Add adjust_dyndef flag; set it
8784         for weak undef/dynamic def cases. Adjust callers.
8785         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8786         undef_binding_weak_.
8787         (Symbol_table::sized_write_globals): Adjust symbol binding.
8788         (Symbol_table::sized_write_symbol): Add binding parameter.
8789         * symtab.h (Symbol::set_undef_binding): New method.
8790         (Symbol::is_undef_binding_weak): New method.
8791         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8792         (Symbol_table::should_override): Add new parameter.
8793         (Symbol_table::sized_write_symbol): Add new parameter.
8794
8795         * testsuite/weak_undef_file1.cc: Add new test case.
8796         * testsuite/weak_undef_file2.cc: Fix header comment.
8797         * testsuite/weak_undef_test.cc: Add new test case.
8798
8799 2010-06-29  Doug Kwan  <dougkwan@google.com>
8800
8801         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8802         Initialize USE_SYMBOL_.
8803         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8804         definition.
8805         (Arm_reloc_property::uses_symbol_): New data member declaration.
8806         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8807         uses symbol value and symbol is undefined but not weakly undefined.
8808
8809 2010-06-28  Rafael Espindola  <espindola@google.com>
8810
8811         * plugin.cc (Plugin::load): Use dlerror.
8812
8813 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
8814
8815         * symtab.cc (detect_odr_violations): When reporting an ODR
8816         violation, report an object where the symbol is defined.
8817
8818 2010-06-25  Doug Kwan  <dougkwan@google.com>
8819
8820         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8821         (Target_arm::section_may_have_icf_unsafe_pointers): New method
8822         definition.
8823         (Target_arm::Scan::local_reloc_may_be_function_pointer,
8824         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8825         target hook to detect function points.
8826         (Target_arm::Scan::possible_function_pointer_reloc): New method.
8827         * icf.h (Icf::check_section_for_function_pointers): Change type of
8828         parameter SECTION_NAME to const reference to std::string.  Use
8829         target hook to determine if section may have unsafe pointers.
8830         * target.h (Target::section_may_have_icf_unsafe_pointers): New
8831         method definition.
8832
8833 2010-06-21  Rafael Espindola  <espindola@google.com>
8834
8835         * fileread.cc (Input_file::find_fie): New
8836         (Input_file::open): Use Input_file::find_fie.
8837         * fileread.h (Input_file::find_fie): New
8838         * plugin.cc (set_extra_library_path): New.
8839         (Plugin::load): Add set_extra_library_path to the transfer vector.
8840         (Plugin_manager::set_extra_library_path): New.
8841         (Plugin_manager::add_input_file): Use the extra search path if set.
8842         (set_extra_library_path(): New.
8843         * plugin.h (Plugin_manager): Add set_extra_library_path and
8844         extra_search_path_.
8845
8846 2010-06-19  Cary Coutant  <ccoutant@google.com>
8847
8848         * layout.cc (gdb_sections): Add .debug_types.
8849         (lines_only_debug_sections): Likewise.
8850
8851 2010-06-18  Rafael Espindola  <espindola@google.com>
8852
8853         * plugin.cc (add_input_file,add_input_library)
8854         (Plugin_manager::add_input_file): Make filename arguments const.
8855         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
8856         const.
8857
8858 2010-06-16  Doug Kwan  <dougkwan@google.com>
8859
8860         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
8861         .ARM.attributes section if we have not merged any input
8862         attributes sections.
8863
8864 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8865
8866         * arm.cc: Allow combining objects with no EABI version
8867         information.
8868
8869 2010-06-15  Rafael Espindola  <espindola@google.com>
8870
8871         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
8872
8873 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8874
8875         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
8876         (struct iovec): Correct !HAVE_READV definition.
8877
8878 2010-06-10  Cary Coutant  <ccoutant@google.com>
8879
8880         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
8881         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
8882         reloc sections.
8883         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
8884
8885         PR 11683
8886         * symtab.h (Symbol::is_placeholder): New member function.
8887         * target-reloc.h (relocate_section): Check for placeholder symbols.
8888
8889         * testsuite/Makefile.am (plugin_test_8): New test.
8890         (plugin_test_9): New test.
8891         * testsuite/Makefile.in: Regenerate.
8892
8893 2010-06-09  Nick Clifton  <nickc@redhat.com>
8894
8895         * yyscript.y (input_list_element): Allow strings prefixed with
8896         the '-' character.  Treat these as libraries.
8897         * script.cc (script_add_library): New function.  Adds a library
8898         specified by "-l<name>" found in an input script.
8899         * script-c.h: Add prototype for script_add_library.
8900
8901 2010-06-07  Doug Kwan  <dougkwan@google.com>
8902
8903         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
8904         Restrict stub-group size to be within long conditional branch
8905         range when working around cortex-A8 erratum.
8906
8907 2010-06-07  Damien Diederen  <dd@crosstwine.com>
8908
8909         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
8910         #ifdef typo.
8911
8912 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
8913
8914         PR gold/11658
8915         * output.cc
8916         (Output_section::Input_section_sort_entry::compare_section_ordering):
8917         Change to return non-zero correctly.
8918         (Output_section::Input_section_sort_section_order_index_compare
8919         ::operator()): Change to fix ambiguity in comparisons.
8920
8921 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
8922
8923         * gold.h (is_wildcard_string): New function.
8924         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8925         (Layout::layout_eh_frame): Ditto.
8926         (Layout::find_section_order_index): New method.
8927         (Layout::read_layout_from_file): New method.
8928         * layout.h (Layout::find_section_order_index): New method.
8929         (Layout::read_layout_from_file): New method.
8930         (Layout::input_section_position_): New private member.
8931         (Layout::input_section_glob_): New private member.
8932         * main.cc (main): Call read_layout_from_file here.
8933         * options.h (--section-ordering-file): New option.
8934         * output.cc (Output_section::input_section_order_specified_): New
8935         member.
8936         (Output_section::Output_section): Initialize new member.
8937         (Output_section::add_input_section): Add new parameter.
8938         Keep input sections when --section-ordering-file is used.
8939         (Output_section::set_final_data_size): Sort input sections when
8940         section ordering file is specified.
8941         (Output_section::Input_section_sort_entry): Add new parameter.
8942         Check sorting type.
8943         (Output_section::Input_section_sort_entry::compare_section_ordering):
8944         New method.
8945         (Output_section::Input_section_sort_compare::operator()): Change to
8946         consider section_order_index.
8947         (Output_section::Input_section_sort_init_fini_compare::operator()):
8948         Change to consider section_order_index.
8949         (Output_section::Input_section_sort_section_order_index_compare
8950         ::operator()): New method.
8951         (Output_section::sort_attached_input_sections): Change to sort
8952         according to section order when specified.
8953         (Output_section::add_input_section<32, true>): Add new parameter.
8954         (Output_section::add_input_section<64, true>): Add new parameter.
8955         (Output_section::add_input_section<32, false>): Add new parameter.
8956         (Output_section::add_input_section<64, false>): Add new parameter.
8957         * output.h (Output_section::add_input_section): Add new parameter.
8958         (Output_section::input_section_order_specified): New
8959         method.
8960         (Output_section::set_input_section_order_specified): New method.
8961         (Input_section::Input_section): Initialize section_order_index_.
8962         (Input_section::section_order_index): New method.
8963         (Input_section::set_section_order_index): New method.
8964         (Input_section::section_order_index_): New member.
8965         (Input_section::Input_section_sort_section_order_index_compare): New
8966         struct.
8967         (Output_section::input_section_order_specified_): New member.
8968         * script-sections.cc (is_wildcard_string): Delete and move modified
8969         method to gold.h.
8970         (Output_section_element_input::Output_section_element_input): Modify
8971         call to is_wildcard_string.
8972         (Output_section_element_input::Input_section_pattern
8973         ::Input_section_pattern): Ditto.
8974         (Output_section_element_input::Output_section_element_input): Ditto.
8975         * testsuite/Makefile.am (final_layout): New test case.
8976         * testsuite/Makefile.in: Regenerate.
8977         * testsuite/final_layout.cc: New file.
8978         * testsuite/final_layout.sh: New file.
8979
8980 2010-06-01  Rafael Espindola  <espindola@google.com>
8981
8982         * plugin.cc (Plugin::load): Pass the output name to the plugin.
8983
8984 2010-06-01  Rafael Espindola  <espindola@google.com>
8985
8986         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8987         visibility of symbols.
8988
8989 2010-05-27  Doug Kwan  <dougkwan@google.com>
8990
8991         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8992         from start of output section instead of address for a local symbol
8993         in a merged or relaxed section when doing a relocatable link.
8994
8995 2010-05-26  Rafael Espindola  <espindola@google.com>
8996
8997         PR 11604
8998         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8999         adding sections the garbage collector removed.
9000         * gold/testsuite/Makefile.am: Add test.
9001         * gold/testsuite/Makefile.in: Regenerate.
9002         * gold/testsuite/plugin_test_7.sh: New.
9003         * gold/testsuite/plugin_test_7_1.c: New.
9004         * gold/testsuite/plugin_test_7_2.c: New.
9005
9006 2010-05-26  Rafael Espindola  <espindola@google.com>
9007
9008         * script-sections.cc (Output_section_definition::set_section_addresses):
9009         Check for --section-start.
9010
9011 2010-05-26  Doug Kwan  <dougkwan@google.com>
9012
9013         * arm.cc (Arm_scan_relocatable_relocs): New class.
9014         (Target_arm::relocate_special_relocatable): New method.
9015         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
9016         (Arm_relocate_functions::thumb_branch_common): Same.
9017         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
9018         instead of Default_scan_relocatable_relocs.
9019         * target-reloc.h (relocate_for_relocatable): Let target handle
9020         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
9021         * target.h (Sized_target::relocate_special_relocatable): New method.
9022
9023 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9024
9025         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
9026
9027 2010-05-23  Doug Kwan  <dougkwan@google.com>
9028
9029         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
9030         instead of a cast.
9031         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
9032         with a direct branch, not a conditional branch, to a stub.
9033         * merge.cc (Output_merge_base::record_input_section): New method
9034         defintion.
9035         (Output_merge_data::do_add_input_section): Record input section if
9036         keeps-input-sections flag is set.
9037         (Output_merge_string::do_add_input_section): Ditto.
9038         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
9039         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
9040         INPUT_SECTIONS_.
9041         (Output_merge_base::keeps_input_sections,
9042         Output_merge_base::set_keeps_input_sections,
9043         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
9044         method definitions.
9045         (Output_merge_base::Input_sections): New type declaration.
9046         (Output_merge_base::input_sections_begin,
9047         Output_merge_base::input_sections_end,
9048         Output_merge_base::do_set_keeps_input_sections): New method definitions.
9049         (Output_merge_base::bool keeps_input_sections_,
9050         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
9051         Output_merge_base::input_sections_): New data members.
9052         (Output_merge_data::do_set_keeps_input_sections): New method
9053         defintion.
9054         (Output_merge_string::do_set_keeps_input_sections): Ditto.
9055         * output.cc (Output_section::Input_section::relobj): Move method
9056         defintion from class declaration to here and handle merge sections.
9057         (Output_section::Input_section::shndx): Ditto.
9058         (Output_section::Output_section): Remove initializations of removed
9059         data members and initialize new data member LOOKUP_MAPS_.
9060         (Output_section::add_input_section): Set keeps-input-sections flag
9061         for a newly created merge output section as appropriate.  Adjust code
9062         to use Output_section_lookup_maps class.
9063         (Output_section::add_relaxed_input_section): Adjst code for lookup
9064         maps code refactoring.
9065         (Output_section::add_merge_input_section): Add a new parameter
9066         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
9067         class.  If adding input section to a newly created merge output
9068         section fails, remove the new merge section.
9069         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
9070         Adjust code for use of the Output_section_lookup_maps class.
9071         (Output_section::find_merge_section): Ditto.
9072         (Output_section::build_lookup_maps): New method defintion.
9073         (Output_section::find_relaxed_input_section): Adjust code to use
9074         Output_section_lookup_maps class.
9075         (Output_section::get_input_sections): Export merge sections.  Adjust
9076         code to use Output_section_lookup_maps class.
9077         (Output_section:::add_script_input_section): Adjust code to use
9078         Output_section_lookup_maps class.  Update lookup maps for merge
9079         sections also.
9080         (Output_section::discard_states): Use Output_section_lookup_maps.
9081         (Output_section::restore_states): Same.
9082         * output.h (Merge_section_properties): Move class defintion out of
9083         Output_section.
9084         (Output_section_lookup_maps): New class.
9085         (Output_section::Input_section::is_merge_section): New method
9086         defintion.
9087         (Output_section::Input_section::relobj): Move defintion out of class
9088         defintion.  Declare method only.
9089         (Output_section::Input_section::shndx): Ditto.
9090         (Output_section::Input_section::output_merge_base): New method defintion.
9091         (Output_section::Input_section::u2_.pomb): New union field.
9092         (Output_section::Merge_section_by_properties_map,
9093         Output_section::Output_section_data_by_input_section_map,
9094         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
9095         Remove types.
9096         (Output_section::add_merge_input_section): Add new parameter
9097         KEEPS_INPUT_SECTIONS.
9098         (Output_section::build_lookup_maps): New method declaration.
9099         (Output_section::merge_section_map_,
9100         Output_section::merge_section_by_properties_map_,
9101         Output_section::relaxed_input_section_map_,
9102         Output_section::is_relaxed_input_section_map_valid_): Remove data
9103         members.
9104         (Output_section::lookup_maps_): New data member.
9105
9106 2010-05-21  Doug Kwan  <dougkwan@google.com>
9107
9108         PR gold/11619
9109         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
9110         avoid a compilation error.
9111
9112 2010-05-19  Rafael Espindola  <espindola@google.com>
9113
9114         * script-sections.cc (Output_section_definition::allocate_to_segment):
9115         Update the phdrs_list even when the output section is NULL.
9116         * testsuite/Makefile.am: Add test.
9117         * testsuite/Makefile.in: Regenerate.
9118         * testsuite/script_test_9.cc: New.
9119         * testsuite/script_test_9.sh: New.
9120         * testsuite/script_test_9.t: New.
9121
9122 2010-05-19  Doug Kwan  <dougkwan@google.com>
9123
9124         * arm.cc (Arm_input_section::original_size): New method.
9125         (Arm_input_section::do_addralign): Add a cast.
9126         (Arm_input_section::do_output_offset): Remove static cast.
9127         (Arm_input_section::original_addralign,
9128          Arm_input_section::original_size_): Change type to uint32_t.
9129         (Arm_input_section::init): Add safe casts for section alignment
9130         and size.
9131         (Arm_input_section::set_final_data_size): Do not set address and
9132         offset of stub table.
9133         (Arm_output_section::fix_exidx_coverage): Change use of of
9134         Output_section::Simple_input_section to that of
9135         Output_section::Input_section.
9136         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
9137         except for the first pass.
9138         * output.cc (Output_section::get_input_sections): Change type of
9139         input_sections to std::list<Input_section>.
9140         (Output_section::add_script_input_section): Rename from
9141         Output_section::add_simple_input_section.  Change type of SIS
9142         parameter from Simple_input_section to Input_section.
9143         * output.h (Output_section::Simple_input_section): Remove class.
9144         (Output_section::Input_section): Change class visibility to public.
9145         (Output_section::Input_section::addralign): Use stored alignments
9146         for special input sections if set.
9147         (Output_section::Input_section::set_addralign): New method.
9148         (Output_section::get_input_sections): Change parameter type from
9149         list of Simple_input_section to list of Input_section.
9150         (Output_section::add_script_input_section): Rename from
9151         Output_section::add_simple_input_section. Change first parameter's
9152         type from Simple_input_section to Input_section and remove the
9153         second and third parameters.
9154         * script-sections.cc (Input_section::Input_section_list): Change
9155         type to list of Output_section::Input_section/
9156         (Input_section_info::Input_section_info): Change parameter type of
9157         INPUT_SECTION to Output_section::Input_section.
9158         (Input_section_info::input_section): Change return type.
9159         (Input_section_info::input_section_): Change type to
9160         Output_section::Input_section.
9161         (Output_section_element_input::set_section_addresses): Adjust code
9162         to use Output_section::Input_section instead of
9163         Output_section::Simple_input_section.  Adjust code for renaming
9164         of Output_section::add_simple_input_section.
9165         (Orphan_output_section::set_section_addresses): Ditto.
9166
9167 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9168
9169         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
9170         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
9171
9172 2010-05-18  Rafael Espindola  <espindola@google.com>
9173
9174         * options.cc (General_options::finalize): Handle -nostdlib.
9175         * options.h (nostdlib): New option.
9176         * script.cc (script_add_search_dir): Handle -nostdlib.
9177
9178 2010-05-12  Doug Kwan  <dougkwan@google.com>
9179
9180         * arm.cc (Target_arm::do_finalize_sections): Create an empty
9181         attributes section only if there no attributes section after merging.
9182         (Target_arm::merge_object_attributes): Move value of
9183         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
9184         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
9185         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
9186         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
9187         and arm_attr_merge_7.stdout.
9188         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
9189         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
9190         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
9191         arm_attr_merge_7b.o): New rules.
9192         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
9193         arm_attr_merge_7
9194         * testsuite/Makefile.in: Regenerate.
9195         * testsuite/arm_attr_merge.sh: New file.
9196         * testsuite/arm_attr_merge_[67][ab].s: Same.
9197
9198 2010-05-05  Nick Clifton  <nickc@redhat.com>
9199
9200         * po/es.po: Updated Spanish translation.
9201
9202 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
9203
9204         * Makefile.am (install-exec-local): Properly install gold as
9205         default cross linker.
9206         * Makefile.in: Regenerated.
9207
9208 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
9209             Nick Clifton  <nickc@redhat.com>
9210
9211         * configure.ac (install_as_default): Define and set to false
9212         unless --enable-gold or --enable-gold=both/gold has been
9213         specified.
9214         * configure: Regenerate.
9215
9216         * Makefile.am (install-exec-local): Install the executable as
9217         'ld.gold'.  If install_as_default is true then also install it as
9218         'ld'.
9219         * Makefile.in: Regenerated.
9220
9221 2010-04-24  Ian Lance Taylor  <iant@google.com>
9222
9223         * layout.cc (Layout::layout_reloc): In relocatable link don't
9224         combine reloc sections for grouped sections.
9225
9226 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
9227
9228         * gc.h (gc_process_relocs): Pass information on relocs pointing to
9229         sections that are not ordinary to icf.
9230         * icf.cc (get_section_contents): Handle relocation pointing to section
9231         with no object or shndx information.
9232         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
9233         * testsuite/Makefile.in: Regenerate.
9234         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
9235         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
9236
9237 2010-04-22  Ian Lance Taylor  <iant@google.com>
9238
9239         * expression.cc (Expression::Expression_eval_info): Add
9240         result_alignment_pointer field.
9241         (Expression::eval_with_dot): Add result_alignment_pointer
9242         parameter.  Change all callers.
9243         (Expression::eval_maybe_dot): Likewise.
9244         (class Binary_expression): Add alignment_pointer parameter to
9245         left_value and right_value.  Change all callers.
9246         (BINARY_EXPRESSION): Set result alignment.
9247         (class Trinary_expression): Add alignment_pointer parameter to
9248         arg2_value and arg3_value.  Change all callers.
9249         (Trinary_cond::value): Set result alignment.
9250         (Max_expression::value, Min_expression::value): Likewise.
9251         (Align_expression::value): Likewise.
9252         * script-sections.cc (class Sections_element): Add dot_alignment
9253         parameter to set_section_addresses virtual function.  Update
9254         instantiations.
9255         (class Output_section_element): Likewise.
9256         (Script_sections::create_segments): Add dot_alignment parameter.
9257         Change all callers.
9258         (Script_sections::create_segments_from_phdrs_clause): Likewise.
9259         (Script_sections::set_phdrs_clause_addresses): Likewise.
9260         * script-sections.h: Update declarations.
9261         * script.h: Update declarations.
9262         * output.h (Output_segment::set_minimum_p_align): Don't decrease
9263         min_p_align.
9264         * testsuite/script_test_3.t: Set large alignment.
9265         * testsuite/script_test_3.sh: Make sure that at least one LOAD
9266         segment has expected alignment.
9267
9268 2010-04-22  Nick Clifton  <nickc@redhat.com>
9269
9270         * po/gold.pot: Updated by the Translation project.
9271         * po/vi.po: Updated Vietnamese translation.
9272
9273 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
9274
9275         * testsuite/Makefile.am (check_PROGRAMS): Add
9276         icf_virtual_function_folding_test.
9277         * testsuite/Makefile.in: Regenerated.
9278
9279 2010-04-15  Andrew Haley  <aph@redhat.com>
9280
9281         * options.h (merge_exidx_entries): New option.
9282         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
9283         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
9284         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
9285         (Target_arm::merge_exidx_entries): New function.
9286         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
9287         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
9288         to Arm_exidx_fixup constructor.
9289         Add new arg, merge_exidx_entries.
9290         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
9291         Arm_output_section::fix_exidx_coverage.
9292
9293 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
9294
9295         * icf.cc (get_section_contents): Check for preemptible functions.
9296         Ignore addend when appropriate.
9297         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
9298         section folded.
9299         (add_from_relobj): Check for section folded.
9300         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
9301         * symtab.h (should_add_dynsym_entry): Add new parameter.
9302         * target-reloc.h (scan_relocs): Check for section folded.
9303         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
9304         Check reloc types for function pointers in shared objects.
9305         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
9306         case.
9307         (icf_preemptible_functions_test): New test case.
9308         (icf_string_merge_test): New test case.
9309         * testsuite.Makefile.in: Regenerate.
9310         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
9311         bar_glob.  Refactor code.
9312         * testsuite/icf_preemptible_functions_test.cc: New file.
9313         * testsuite/icf_preemptible_functions_test.sh: New file.
9314         * testsuite/icf_string_merge_test.cc: New file.
9315         * testsuite/icf_string_merge_test.sh: New file.
9316         * testsuite/icf_virtual_function_folding_test.cc: New file.
9317         * testsuite/icf_virtual_function_folding_test.sh: New file.
9318
9319 2010-04-14  Doug Kwan  <dougkwan@google.com>
9320
9321         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
9322         for local symbol recounting if we remove a section due to ICF.
9323         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
9324         there are no regular objects in input.
9325
9326 2010-04-13  Doug Kwan  <dougkwan@google.com>
9327
9328         * arm.cc (Arm_input_section::set_final_data_size): Compute
9329         accurate final data size instead of using current data size.
9330
9331 2010-04-09  Doug Kwan  <dougkwan@google.com>
9332
9333         * layout.cc (Layout::choose_output_section): Handle script section
9334         types.
9335         (Layout::make_output_section_for_script): Add section type parameter.
9336         Handle script section types.
9337         * layout.h (Layout::make_output_section_for_script): Add section
9338         type parameter.
9339         * output.cc (Output_section::Output_section): Initialize data member
9340         is_noload_.
9341         (Output_section::do_reset_address_and_file_offset): Do not set address
9342         to 0 if section is a NOLOAD section.
9343         * output.h (Output_section::is_noload): New method.
9344         (Output_section::set_is_noload): Ditto.
9345         (Output_section::is_noload_): New data member.
9346         * script-c.h (Script_section_type): New enum type.
9347         (struct Parser_output_section_header): Add new file section_type.
9348         * script-sections.cc (Sections_element::output_section_name): Add
9349         parameter for returning script section type.
9350         (Output_section_definition::output_section_name): Ditto.
9351         (Output_section_definition::section_type)P; New method.
9352         (Output_section_definiton::script_section_type_name): Ditto.
9353         (Output_section_definition::script_section_type_): New data member.
9354         (Output_section_definition::Output_section_definition): Initialize
9355         data member Output_section_definition::script_section_type_.
9356         (Output_section_definition::create_sections): Pass script section type
9357         to Layout::make_output_section_for_script.
9358         (Output_section_definition::output_section_name): Return script
9359         section type to caller.
9360         (Output_section_definition::set_section_address): Do not advance
9361         dot value and load address if section type is NOLOAD.  Set address
9362         of NOLOAD sections regardless of section flags.
9363         (Output_section_definition::print): Print section type if it is
9364         not SCRIPT_SECTION_TYPE_NONE.
9365         (Output_section_definition::section_type): New method.
9366         (Output_section_definition::script_section_type_name): Ditto.
9367         (Script_sections::output_section_name): Add new parameter
9368         PSECTION_TYPE for returning script section type.  Pass it to
9369         section elements.  Handle discard sections.
9370         (Sort_output_sections::operator()): Handle NOLOAD sections.
9371         * script-sections.h (Script_sections::Section_type): New enum type.
9372         (Script_sections::output_section_name): Add a new parameter for
9373         returning script section type.
9374         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
9375         INFO and NOLOAD.
9376         * yyscript.y (union): Add new field SECTION_TYPE.
9377         (COPY, DSECT, INFO, NOLOAD): New tokens.
9378         (opt_address_and_section_type): Change type to output_section_header.
9379         (section_type): New non-terminal
9380         (section_header): Handle section type.
9381         (opt_address_and_section_type): Return section type value.
9382
9383 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
9384
9385         * testsuite/plugin_common_test_1.c (foo): Add prototype.
9386         * testsuite/plugin_common_test_2.c (foo): Likewise.
9387
9388 2010-04-08  Doug Kwan  <dougkwan@google.com>
9389
9390         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
9391         Output_merge_data.
9392         * output.cc (Output_section::add_merge_input_section): Simplify
9393         code and return status of Output_merge_base::add_input_section.
9394         Update merge section map only if Output_merge_base::add_input_section
9395         returns true.
9396
9397 2010-04-07  Doug Kwan  <dougkwan@google.com>
9398
9399         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
9400         if section is marked as containing instructions but has no mapping
9401         symbols.
9402         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
9403         correct section index.
9404         (Arm_relobj::find_linked_text_section): Ditto.
9405
9406 2010-04-07  Cary Coutant  <ccoutant@google.com>
9407
9408         * archive.cc (include_member): Destroy Read_symbols_data object before
9409         releasing file.
9410         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
9411         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
9412         (Read_symbols_data::~Read_symbols_data) New destructor.
9413         (Section_relocs::Section_relocs) New constructor.
9414         (Section_relocs::~Section_relocs) New destructor.
9415         (Read_relocs_data::Read_relocs_data) New constructor.
9416         (Read_relocs_data::~Read_relocs_data) New destructor.
9417         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
9418         pointers to NULL after deleting.
9419
9420 2010-04-07  Doug Kwan  <dougkwan@google.com>
9421
9422         * arm.cc: Replace "endianity" with "endianness" in comments.
9423         (Arm_exidx_cantunwind): Ditto.
9424         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
9425         (Arm_relobj::merge_flags_and_attributes): New method.
9426         (Arm_relobj::merge_flags_and_attributes_): New data member.
9427         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
9428         (Arm_relobj::scan_sections_for_stubs): Ditto.
9429         (Arm_relobj::do_read_symbols): Check to see if we really want to
9430         merge processor-specific flags and attributes.  Exit early if
9431         an object is empty except for section names and the undefined symbol.
9432         (Target_arm::do_finalize_sections): Move check for ELF format to
9433         Arm_relobj::do_read_symbols.  Merge processor specific flags and
9434         attributes from a regular object only when we have determined that
9435         it is aapropriate.  Do not create an .ARM.attributes section in
9436         output if there is no regular input object.
9437         (Target_arm::merge_processor_specific_flags): Check
9438         --warn-mismatch before printing any error.
9439         (Target_arm::merge_object_attributes): Ditto.
9440         * gold.cc (queue_middle_tasks): Handle the case in which there is
9441         no regular object in input.
9442         * options.cc (General_options::parse_EB): New method.
9443         (General_options::parse_EL): Same.
9444         (General_options::General_options): Initialize endianness_.
9445         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
9446         New options.
9447         (General_options::Endianness): New enum.
9448         (General_options::endianness): New method.
9449         (General_options::endianness_): New data member.
9450         * parameters.cc (Parameters::set_options): Check target endianness.
9451         (Parameters::set_target_once): Ditto.
9452         (Parameters::check_target_endianness): New method.
9453         (parameters_force_valid_target): If either -EL or -EB is specified,
9454         use it to define endianness of default target.
9455         * parameters.h (Parameters::check_target_endianness): New method
9456         declaration.
9457         * target.h (class Target): Change "endianity" to "endianness"
9458         in comments.
9459
9460 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9461
9462         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
9463         * configure: Regenerate.
9464         * Makefile.in: Regenerate.
9465         * testsuite/Makefile.in: Regenerate.
9466
9467 2010-04-06  Cary Coutant  <ccoutant@google.com>
9468
9469         gcc PR lto/42757
9470         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
9471         prevailing definitions of common symbols.
9472         * testsuite/plugin_test_6.sh: New test case.
9473         * testsuite/plugin_common_test_1.c: New test case.
9474         * testsuite/plugin_common_test_2.c: New test case.
9475         * testsuite/Makefile.am (plugin_test_6): New test case.
9476         * testsuite/Makefile.in: Regenerate.
9477
9478 2010-04-06  Nick Clifton  <nickc@redhat.com>
9479
9480         * po/vi.po: New Vietnamese translation.
9481
9482 2010-03-30  Doug Kwan  <dougkwan@google.com>
9483
9484         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
9485
9486 2010-03-25  Doug Kwan  <dougkwan@google.com>
9487
9488         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
9489         to avoid a conversion warning on a 32-bit host.
9490
9491 2010-03-24  Ian Lance Taylor  <iant@google.com>
9492
9493         * testsuite/script_test_3.t: Add a TLS segment.
9494         * testsuite/Makefile.am (check_PROGRAMS): Add
9495         tls_phdrs_script_test.
9496         (tls_phdrs_script_test_SOURCES): Define.
9497         (tls_phdrs_script_test_DEPENDENCIES): Define.
9498         (tls_phdrs_script_test_LDFLAGS): Define.
9499         (tls_phdrs_script_test_LDADD): Define.
9500         * testsuite/Makefile.in: Rebuild.
9501
9502 2010-03-23  Cary Coutant  <ccoutant@google.com>
9503
9504         * fileread.cc (find_or_make_view): Fix comment.
9505
9506 2010-03-23  Ian Lance Taylor  <iant@google.com>
9507
9508         * script-sections.cc (class Orphan_section_placement): Define
9509         PLACE_TLS and PLACE_TLS_BSS.
9510         (Orphan_section_placement::Orphan_section_placement): Initialize
9511         new places.
9512         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
9513         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
9514         (tls_script_test_SOURCES): Define.
9515         (tls_script_test_DEPENDENCIES): Define.
9516         (tls_script_test_LDFLAGS): Define.
9517         (tls_script_test_LDADD): Define.
9518         * testsuite/Makefile.in: Rebuild.
9519
9520 2010-03-22  Doug Kwan  <dougkwan@google.com>
9521
9522         * arm.cc (Arm_relocate_functions::abs8,
9523         Arm_relocate_functions::abs16): Use correct check for overflow
9524         specified in the ARM ELF specs.
9525         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
9526         target of a BLX instruction specially.
9527         (Reloc_stub::stub_type_for_reloc): Ditto.
9528         (Relocate::relocate): Use symbolic names instead of numeric relocation
9529         codes to report error.
9530         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
9531         workaround.
9532         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
9533         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
9534         thumb2_blx_out_of_range.stdout
9535         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
9536         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
9537         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
9538         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
9539         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
9540         thumb2_blx_in_range, thumb2_blx_in_range.o,
9541         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
9542         thumb2_blx_out_of_range.o): New rules.
9543         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
9544         thumb2_blx_in_range and thumb2_blx_out_of_range.
9545         * testsuite/Makefile.in: Regenerate.
9546         * arm_branch_in_range.sh: Add tests for THUMB BLX.
9547         * testsuite/thumb_blx_in_range.s: New file.
9548         * testsuite/thumb_blx_out_of_range.s: New file.
9549
9550 2010-03-22  Rafael Espindola  <espindola@google.com>
9551
9552         * archive.cc (Should_include): Move to archive.h.
9553         (should_include_member): Make it a member of Archive.
9554         (Lib_group): New.
9555         (Add_lib_group_symbols): New.
9556         * archive.h: Include options.h.
9557         (Archive_member): Moved from Archive.
9558         (Should_include): Moved from archive.cc.
9559         (Lib_group): New.
9560         (Add_lib_group_symbols): New.
9561         * dynobj.cc (do_should_include_member): New.
9562         * dynobj.h (do_should_include_member): New.
9563         * gold.cc (queue_initial_tasks): Update call to queue.
9564         * main.cc (main): Print lib group stats.
9565         * object.cc (do_should_include_member): New.
9566         * object.h: Include archive.h.
9567         (Object::should_include_member): New.
9568         (Object::do_should_include_member): New.
9569         (Sized_relobj::do_should_include_member): New.
9570         * options.cc (General_options::parse_start_lib): New.
9571         (General_options::parse_end_lib): New.
9572         (Input_arguments::add_file): Handle lib groups.
9573         (Input_arguments::start_group): Check we are not in a lib.
9574         (Input_arguments::start_lib): New.
9575         (Input_arguments::end_lib): New.
9576         * options.h (General_options): Add start_lib and end_lib.
9577         (Input_argument::lib_): New.
9578         (Input_argument::lib): New.
9579         (Input_argument::is_lib): New.
9580         (Input_file_lib): New.
9581         (Input_arguments::in_lib_): New.
9582         (Input_arguments::in_lib): New.
9583         (Input_arguments::start_lib): New.
9584         (Input_arguments::end_lib_): New.
9585         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
9586         in unused members as preempted.
9587         (Sized_pluginobj::do_should_include_member): New.
9588         * plugin.h (Sized_pluginobj::do_should_include_member): New.
9589         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
9590         return the blocker.
9591         (Read_symbols::do_whole_lib_group): New.
9592         (Read_symbols::do_lib_group): New.
9593         (Read_symbols::do_read_symbols): Handle lib groups.
9594         (Read_symbols::get_name): Handle lib groups.
9595         * readsyms.h (Read_symbols): Add an archive member pointer.
9596         (Read_symbols::do_whole_lib_group): New.
9597         (Read_symbols::do_lib_group): New.
9598         (Read_symbols::member_): New.
9599         * script.cc (read_input_script): Update call to queue_soon.
9600
9601 2010-03-19  Doug Kwan  <dougkwan@google.com>
9602
9603         * arm.cc (Stub_table::Stub_table): Initialize new data members
9604         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9605         (Stub_table::add_reloc_stub): Assign stub offset and update
9606         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9607         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
9608         New data members.
9609         (Stub_table::update_data_size_and_addralign): Use
9610         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
9611         instead of going over all reloc stubs.
9612         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
9613         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9614         Stringpool_template::offset_ to size of Stringpool_char.
9615         (Stringpool_template::new_key_offset): Remove code to initialize
9616         Stringpool_template::offset_.
9617         * stringpool.h (Stringpool_template::set_no_zero_null): Set
9618         Stringpool_template::offset_ to zero.
9619
9620 2010-03-15  Doug Kwan  <dougkwan@google.com>
9621
9622         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9623         offset_.
9624         (Stringpool_template::new_key_offset): New method.
9625         (Stringpool_template::add_string): Assign offsets when adding new
9626         strings.
9627         (Stringpool_template::set_string_offsets): Do not set string offsets
9628         when not optimizing.
9629         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
9630         member size_.
9631         (Chunked_vector::clear): Clear size_.
9632         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
9633         (Chunked_vector::size): Return size_.
9634         (Chunked_vector::push_back): Use size_ to find insert position.
9635         (Chunked_vector::size_): New data member.
9636         (Stringpool_template::set_no_zero_null): Assert string set is empty.
9637         (Stringpool_template::new_key_offset): New method declaration.
9638         (Stringpool_template::offset_): New data member.
9639
9640 2010-03-15   Rafael Espindola  <espindola@google.com>
9641
9642         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
9643         Add_symbols' constructor.
9644         * readsyms.h (Add_symbols): Remove the input_group member.
9645
9646 2010-03-10  Ian Lance Taylor  <iant@google.com>
9647
9648         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
9649         target to ask whether a reference to a symbol requires a stack
9650         split.
9651         * target.h (Target::is_call_to_non_split): New function.
9652         (Target::do_is_call_to_non_split): Declare virtual function.
9653         * target.cc: Include "symtab.h".
9654         (Target::do_is_call_to_non_split): New function.
9655         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
9656
9657 2010-03-10  Cary Coutant  <ccoutant@google.com>
9658
9659         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
9660         (File_read::open[1]): Remove initial mapping of whole_file_view_.
9661         (File_read::open[2]): Add whole_file_view_ to list of views.
9662         (File_read::make_view): Remove test of whole_file_view_.
9663         (File_read::find_or_make_view): Create whole_file_view_ if
9664         necessary.
9665         (File_read::clear_views): Replace bool parameter with enum;
9666         adjust all callers.  Don't delete views with permanent data;
9667         do delete cached views and views from archives if
9668         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
9669         if clearing the corresponding view.
9670         * fileread.h (File_read::Clear_views_mode): New enum.
9671         (File_read::View::is_permanent_view): New method.
9672         (File_read::clear_views): Replace bool parameter
9673         with enum; adjust all callers.
9674         * options.h (General_options): Change keep_files_mapped option;
9675         add map_whole_files.
9676         * readsyms.cc (Add_symbols::run): Delete sd_ object before
9677         releasing the file.
9678         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
9679         the file.
9680
9681 2010-03-10  David S. Miller  <davem@davemloft.net>
9682
9683         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
9684
9685 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
9686
9687         * icf.cc (get_section_contents): Add '@' marker after processing the
9688         merge reloc.
9689
9690 2010-03-08  Doug Kwan  <dougkwan@google.com>
9691
9692         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
9693         due to a conversion warning.
9694         (Arm_relobj::update_output_local_symbol_count): Check for local
9695         symbol with unset output index.
9696
9697 2010-03-05  Ian Lance Taylor  <iant@google.com>
9698
9699         * options.h (class General_options): Add --spare-dynamic-tags.
9700         * output.cc (Output_data_dynamic::set_final_data_size): Implement
9701         --spare-dynamic-tags.
9702
9703 2010-03-05  Ian Lance Taylor  <iant@google.com>
9704
9705         * incremental.cc: Include "libiberty.h".
9706
9707 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
9708
9709         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
9710         function, is_info_ member.
9711         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
9712         (Versions::Versions): Update caller.
9713         (Versions::define_base_version): Likewise.
9714         (Versions::add_def): Likewise.
9715
9716 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
9717
9718         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
9719         (Scan::possible_function_pointer_reloc): New function.
9720         (Scan::local_reloc_may_be_function_pointer): Change to call
9721         possible_function_pointer_reloc.
9722         (Scan::global_reloc_may_be_function_pointer): Ditto.
9723         * icf.h (Icf::check_section_for_function_pointers): Change to reject
9724         relocations in ".data.rel.ro._ZTV" section.
9725         * testsuite/icf_safe_so_test.sh: Change to pass i386.
9726         * testsuite/icf_safe_so_test.cc: Ditto.
9727         * testsuite/icf_safe_test.cc: Ditto.
9728         * testsuite/icf_safe_test.sh: Ditto.
9729
9730 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9731             Ian Lance Taylor  <iant@google.com>
9732
9733         * target-reloc.h (relocate_section): Check the symbol table index
9734         for -1U before setting the local symbol index.
9735         (scan_relocatable_relocs): If copying the relocation, record that
9736         the local symbol is required.
9737         * object.h (Symbol_value::is_output_symtab_index_set): New
9738         function.
9739         (Symbol_value::may_be_discarded_from_output_symtab): New
9740         function.
9741         (Symbol_value::has_output_symtab_entry): New function.
9742         (Symbol_value::needs_output_symtab_entry): Remove.
9743         (Symbol_value::output_symtab_index): Make sure the symbol index is
9744         set.
9745         (Symbol_value::set_output_symtab_index): Make sure the symbol
9746         index is not set.  Make sure the new index is valid.
9747         (Symbol_value::set_must_have_output_symtab_entry): New function.
9748         (Symbol_value::has_output_dynsym_entry): New function.
9749         (Symbol_value::set_output_dynsym_index): Make sure the new index
9750         is valid.
9751         (Sized_relobj::set_must_have_output_symtab_entry): New function.
9752         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
9753         local symbol if permitted.
9754         (Sized_relobj::do_finalize_local_symbols): Call
9755         is_output_symtab_index_set rather than needs_output_symtab_entry.
9756         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
9757         rather than needs_output_symtab_entry.  Call
9758         has_output_dynsym_entry rather than needs_output_dynsym_entry.
9759         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
9760         is_output_symtab_index_set rather than needs_output_symtab_entry.
9761         * testsuite/discard_locals_relocatable_test.c: New file.
9762         * testsuite/discard_locals_test.sh: Test -r.
9763         * testsuite/Makefile.am (check_DATA): Add
9764         discard_locals_relocatable_test1.syms,
9765         discard_local_relocatable_test2.syms.
9766         (MOSTLYCLEANFILES): Likewise.  Also add
9767         discard_locals_relocatable_test1.lout and
9768         discard_locals_relocatable_test2.out.
9769         (discard_locals_relocatable_test1.syms): New target.
9770         (discard_locals_relocatable_test.o): New target.
9771         (discard_locals_relocatable_test1.out): New target.
9772         (discard_locals_relocatable_test2.syms): New target.
9773         (discard_locals_relocatable_test2.out): New target.
9774         (various): Add missing ../ld-new dependencies.
9775         * testsuite/Makefile.in: Rebuild.
9776
9777 2010-03-03  Nick Clifton  <nickc@redhat.com>
9778
9779         * po/fi.po: New Finnish translation.
9780
9781 2010-03-01  Doug Kwan  <dougkwan@google.com>
9782
9783         * layout.cc (Layout::Layout): Force section types of .init_array*,
9784         .preinit_array* and .fini_array* sections.
9785         * output.cc (Output_section::Input_section_sort_entry::has_priority):
9786         Fix check of return value of std::string::find.().
9787         (Output_section::Input_section_sort_compare::operator()): Remove
9788         comment about .init_array.
9789         (Output_section::Input_section_sort_init_fini_compare::operator()):
9790         New method.
9791         (Output_section::sort_attached_input_sections): Handle .init_array
9792         and .fini_array specially.
9793         * output.h (Output_section::Inut_section_sort_compare): Update
9794         comment.
9795         (Output_section::Input_section_sort_init_fini_compare): New struct.
9796
9797 2010-02-26  Doug Kwan  <dougkwan@google.com>
9798
9799         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9800         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9801         * testsuite/debug_msg.sh: Avoid matching source line number for
9802         use of global variable undef_int.
9803
9804 2010-02-26  Doug Kwan  <dougkwan@google.com>
9805
9806         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9807         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9808         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9809         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9810         * options.cc (General_options::General_options): Initialize member
9811         fix_v4bx_.
9812         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9813         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9814         and rm_no_fix_v4bx.stdout
9815         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9816         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9817         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9818         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9819         and arm_no_fix_v4bx.
9820         * Makefile.in: Regenerate.
9821         * testsuite/arm_fix_v4bx.s: New file.
9822         * testsuite/arm_fix_v4bx.sh: Ditto.
9823
9824 2010-02-24  Doug Kwan  <dougkwan@google.com>
9825
9826         * arm.cc (Target_arm::got_section): Make the .got section the first
9827         non RELRO section in the data segment.
9828         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9829         suffixes of section names.
9830
9831 2010-02-24  Doug Kwan  <dougkwan@google.com>
9832
9833         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
9834         flags and attributes merging if an input file is a binary file.
9835         * fileread.cc (Input_file::open): Record format of original file.
9836         * fileread.h (Input_file::Format): New enum type.
9837         (Input_file::Input_file): Initialize data member format_.
9838         (Input_file::format): New method definition.
9839         (Input_file::format_):: New data member.
9840
9841 2010-02-24  Doug Kwan  <dougkwan@google.com>
9842
9843         * arm.cc (Arm_output_data_got): New class.
9844         (ARM_TCB_SIZE): New constant
9845         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
9846         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
9847         If user uses a script with a SECTIONS clause, issue only a warning
9848         for a misplaced EXIDX input section.  Otherwise, issue an error.
9849         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
9850         garbage collection.
9851         (Target_arm::got_mode_index_entry): Handle static linking.
9852         (Target_arm::Scan::local): Ditto.
9853         (Target_arm::Scan::global): Ditto.
9854         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
9855         all incorrectly implemented relocations.
9856         (Target_arm::fix_exidx_coverage): Pass layout to
9857         Arm_output_section::fix_exidx_coverage.
9858         * layout.cc (Layout::section_name_mapping): Remove trailing dots
9859         from ".ARM.exidx." and ".ARM.extab.".
9860
9861 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9862
9863         * arm.cc (Target_arm::do_finalize_sections): Create attribute
9864         section if it does not already exist.
9865         * attributes.cc (Attributes_section_data::Attributes_section_data):
9866         Don't crash if size is zero.
9867
9868 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9869             Ian Lance Taylor  <iant@google.com>
9870
9871         * gold.cc (queue_middle_tasks): If no input files were opened,
9872         exit.
9873         * workqueue.h (Task_function::Task_function): Assert that there is
9874         a blocker.
9875
9876 2010-02-22  Doug Kwan  <dougkwan@google.com>
9877
9878         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
9879         * icf.cc (get_section_contents): Cast snprintf arguments to long long
9880         types to avoid warnings due to different uint64_t implementations
9881         on different hosts.
9882
9883 2010-02-21  Doug Kwan  <dougkwan@google.com>
9884
9885         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
9886         handling of the maximum backward branch offset.
9887         (Arm_relocate_functions::thumb_branch_common): Ditto.
9888         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
9889         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
9890         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
9891         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
9892         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
9893         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
9894         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
9895         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
9896         thumb_bl_out_of_range thumb_bl_out_of_range.o,
9897         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
9898         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
9899         thumb2_bl_out_of_range.o): New rules.
9900         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
9901         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
9902         thumb2_bl_out_of_range
9903         * testsuite/Makefile.in: Regenerate.
9904         * testsuite/arm_bl_in_range.s: New file.
9905         * testsuite/arm_bl_out_of_range.s: Ditto.
9906         * testsuite/arm_branch_in_range.sh: Ditto.
9907         * testsuite/arm_branch_range.t: Ditto.
9908         * testsuite/thumb2_branch_range.t: Ditto.
9909         * testsuite/thumb_bl_in_range.s: Ditto.
9910         * testsuite/thumb_bl_out_of_range.s: Ditto.
9911         * testsuite/thumb_branch_range.t: Ditto.
9912
9913 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
9914
9915         * gc.h (gc_process_relocs): Change vectors to point to the new list.
9916         Add reloc offset information.
9917         * icf.cc (get_section_contents): Change iterators to point to the new
9918         vectors. Add reloc offset information to the contents.
9919         * icf.h (Icf::Sections_reachable_info): New typedef.
9920         (Icf::Sections_reachable_list): New typedef.
9921         (Icf::Offset_info): New typedef.
9922         (Icf::Reloc_info): New struct typedef.
9923         (Icf::Reloc_info_list): New typedef.
9924         (Icf::symbol_reloc_list): Delete method.
9925         (Icf::addend_reloc_list): Delete method.
9926         (Icf::section_reloc_list): Delete method.
9927         (Icf::reloc_info_list): New method.
9928         (Icf::reloc_info_list_): New member.
9929
9930 2010-02-19  Doug Kwan  <dougkwan@google.com>
9931
9932         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9933         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9934         * arm.cc (Arm_relocation_functions): New forward declaration.
9935         (Target_arm::Target_arm): Initialize new data members
9936         got_mod_index_offset_ and tls_base_symbol_defined_.
9937         (Target_arm::Relocate::relocate_tls): New method.
9938         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9939          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9940         New methods.
9941         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9942         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
9943         (Target_arm::got_mod_index_offset_,
9944         Target_arm::tls_base_symbol_defined_): New data members.
9945         (Target_arm::Scan::local, Target::Scan::global,
9946         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
9947         relocations.
9948
9949 2010-02-18  Doug Kwan  <dougkwan@google.com>
9950
9951         * arm.cc (Arm_relobj::find_linked_text_section): New method.
9952         (Arm_relobj::make_exidx_input_section): Pass section index of linked
9953         text section as a parameter becuase some broken tools may not set
9954         the link in section header.
9955         (Target_arm::has_got_section): New method.
9956         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
9957         without any mapping symbol as data only.  Remove warning.
9958         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
9959         link in its section header, try to discover the link by inspecting the
9960         REL31 relocation at the beginning of the section.
9961         (Target_arm::Scan::check_non_pic): Report name of offending relocation
9962         in error message.
9963         (Target_arm::Scan::global): Treat any reference to the symbol
9964         _GLOBAL_OFFSET_TABLE_ as a GOT access.
9965
9966 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
9967
9968         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
9969         (Scan::global_reloc_may_be_function_pointer): New function.
9970         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9971         (Scan::global_reloc_may_be_function_pointer): New function.
9972         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9973         (Scan::global_reloc_may_be_function_pointer): New function.
9974         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9975         (Scan::global_reloc_may_be_function_pointer): New function.
9976         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9977         (Scan::global_reloc_may_be_function_pointer): New function.
9978         (Scan::possible_function_pointer_reloc): New function.
9979         (Target_x86_64::can_check_for_function_pointers): New function.
9980         * gc.h (gc_process_relocs): Scan relocation types to determine if
9981         function pointers were taken for targets that support it.
9982         * icf.cc (Icf::find_identical_sections): Include functions for
9983         folding in safe ICF whose pointer is not taken.
9984         * icf.h (Secn_fptr_taken_set): New typedef.
9985         (fptr_section_id_): New member.
9986         (section_has_function_pointers): New function.
9987         (set_section_has_function_pointers): New function.
9988         (check_section_for_function_pointers): New function.
9989         * options.h: Fix comment for safe ICF option.
9990         * target.h (can_check_for_function_pointers): New function.
9991         * testsuite/Makefile.am: Add icf_safe_so_test test case.
9992         Modify icf_safe_test for X86-64.
9993         * testsuite/Makefile.in: Regenerate.
9994         * testsuite/icf_safe_so_test.cc: New file.
9995         * testsuite/icf_safe_so_test.sh: New file.
9996         * testsuite/icf_safe_test.cc (kept_func_3): New function.
9997         (main): Change to take pointer to function kept_func_3.
9998         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9999         folding is done correctly for X86-64.
10000
10001 2010-02-12  David S. Miller  <davem@davemloft.net>
10002
10003         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
10004         is_symbolless parameter.
10005         (Output_reloc<SHT_REL>::is_symbolless): New.
10006         (Output_reloc<SHT_REL>::is_symbolless_): New.
10007         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
10008         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
10009         (Output_reloc<SHT_RELA>::is_symbolless): New.
10010         (Output_data_reloc::add_global): Handle is_symbolless.
10011         (Output_data_reloc::add_global_relative): Likewise.
10012         (Output_data_reloc::add_local): Likewise.
10013         (Output_data_reloc::add_local_relative): Likewise.
10014         (Output_data_reloc::add_symbolless_global_addend): New.
10015         (Output_data_reloc::add_symbolless_local_addend): New.
10016         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
10017         is_symbolless.
10018         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
10019         instead of ->is_relative_
10020         (Output_reloc::write): Likewise.
10021         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
10022         (Output_reloc::write_rel): Simplify.
10023
10024         * sparc.cc (Target_sparc::Scan::local): Use
10025         ->add_symbolless_local_addend as needed.
10026         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
10027         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
10028         based upon relocation offset.
10029
10030 2010-02-11  Doug Kwan  <dougkwan@google.com>
10031
10032         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
10033         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
10034         beginning of function.
10035         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
10036         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
10037         parameter is_32bit in calls to should_apply_static_reloc.
10038         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
10039         (check_DATA): Add arm_abs_global.stdout.
10040         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
10041         arm_abs_global.stdout): New rules.
10042         (MOSTLLYCLEANFILES): Add arm_abs_global
10043         * Makefile.in: Regenerate.
10044         * testsuite/arm_abs_global.s: New file.
10045         * testsuite/arm_abs_global.sh: Ditto.
10046         * testsuite/arm_abs_lib.s: Ditto.
10047
10048 2010-02-11  Ian Lance Taylor  <iant@google.com>
10049
10050         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
10051         Read_relocs task.
10052         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
10053         Allocate_commons_task first.
10054         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
10055         task, rather than symtab_lock_.
10056         (Gc_process_relocs::~Gc_process_relocs): New function.
10057         (Gc_process_relocs::is_runnable): Check this_blocker_.
10058         (Gc_process_relocs::locks): Use next_blocker_ rather than
10059         blocker_.
10060         (Scan_relocs::~Scan_relocs): New function.
10061         (Scan_relocs::is_runnable): Check this_blocker_ rather than
10062         symtab_lock_.
10063         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
10064         next_blocker_.
10065         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
10066         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
10067         constructor accordingly.
10068         (class Gc_process_relocs): Likewise.
10069         (class Scan_relocs): Likewise.
10070         * common.h (class Allocate_commons_task): Remove symtab_lock_
10071         field, and corresponding constructor parameter.
10072         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
10073         symtab_lock_.
10074         (Allocate_commons_task::locks): Likewise.
10075
10076 2010-02-11  Ian Lance Taylor  <iant@google.com>
10077
10078         * gold-threads.h (class Once): Define.
10079         (class Initialize_lock): Rewrite as child of Once.
10080         * gold-threads.cc (class Once_initialize): Define.
10081         (once_pointer_control): New static variable.
10082         (once_pointer, once_arg): New static variables.
10083         (c_run_once): New static function.
10084         (Once::Once, Once::run_once, Once::internal_run): New functions.
10085         (class Initialize_lock_once): Remove.
10086         (initialize_lock_control): Remove.
10087         (initialize_lock_pointer): Remove.
10088         (initialize_lock_once): Remove.
10089         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
10090         (Initialize_lock::initialize): Rewrite.
10091         (Initialize_lock::do_run_once): New function.
10092         * archive.cc (Archive::interpret_header): Only clear name if it is
10093         not already empty.
10094         * fileread.cc: Include "gold-threads.h"
10095         (file_counts_lock): New static variable.
10096         (file_counts_initialize_lock): Likewise.
10097         (File_read::release): Only increment counts when using --stats.
10098         Use a lock around the increment.
10099         * parameters.cc (class Set_parameters_target_once): Define.
10100         (set_parameters_target_once): New static variable.
10101         (Parameters::Parameters): Move here from parameters.h.
10102         (Parameters::set_target): Rewrite.
10103         (Parameters::set_target_once): New function.
10104         (Parameters::clear_target): Move here and rewrite.
10105         * parameters.h (class Parameters): Update declarations.  Add
10106         set_parameters_target_once_ field.
10107         (Parameters::Parameters): Move to parameters.cc.
10108         (Parameters::clear_target): Likewise.
10109         * readsyms.cc (Read_symbols::do_group): Create a Start_group
10110         task.
10111         (Start_group::~Start_group): New function.
10112         (Start_group::is_runnable): New function.
10113         (Start_group::locks, Start_group::run): New functions.
10114         (Finish_group::run): Change saw_undefined to size_t.
10115         * readsyms.h (class Start_group): Define.
10116         (class Finish_group): Change saw_undefined_ field to size_t.
10117         (Finish_group::Finish_group): Remove saw_undefined and
10118         this_blocker parameters.  Change all callers.
10119         (Finish_group::set_saw_undefined): New function.
10120         (Finish_group::set_blocker): New function.
10121         * symtab.h (class Symbol_table): Change saw_undefined to return
10122         size_t.  Change saw_undefined_ field to size_t.
10123         * target-select.cc (Set_target_once::do_run_once): New function.
10124         (Target_selector::Target_selector): Initialize set_target_once_
10125         field.  Don't initialize lock_ and initialize_lock_ fields.
10126         (Target_selector::instantiate_target): Rewrite.
10127         (Target_selector::set_target): New function.
10128         * target-select.h (class Set_target_once): Define.
10129         (class Target_selector): Update declarations.  Make
10130         Set_target_once a friend.  Remove lock_ and initialize_lock_
10131         fields.  Add set_target_once_ field.
10132
10133 2010-02-10  Ian Lance Taylor  <iant@google.com>
10134
10135         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
10136         queueing any tasks.
10137         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
10138         (queue_middle_tasks): Add all blockers before queueing any tasks.
10139         (queue_final_tasks): Likewise.
10140         * token.h (Task_token::add_blockers): New function.
10141         * object.h (Input_objects::number_of_relobjs): New function.
10142
10143 2010-02-10  Ian Lance Taylor  <iant@google.com>
10144
10145         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
10146         shared, not if not position independent.
10147         * x86_64.cc (Relocate::relocate_tls): Likewise.
10148         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
10149         (tls_pie_pic_test): New target.
10150         * testsuite/Makefile.in: Rebuild.
10151
10152         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
10153         (tls_test_main_pie.o, tls_test_pie.o): New targets.
10154         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
10155         * testsuite/Makefile.in: Rebuild.
10156
10157 2010-02-09  David S. Miller  <davem@davemloft.net>
10158
10159         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
10160         R_SPARC_RELATIVE using ->add_local_relative().
10161         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
10162
10163         * output.h (Output_data_dynamic::add_section_size): New method
10164         that takes two Output_data objects.
10165         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
10166         entry param.  Handle it in initializers.
10167         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
10168         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
10169         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
10170         arg.
10171         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
10172         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
10173         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
10174         for dynrel_includes_plt.
10175         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10176         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10177         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
10178         before .rela.plt
10179         (Target_sparc::do_finalize_sections): Update to pass true for
10180         dynrel_includes_plt.
10181         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
10182         output before .rela.plt
10183         (Target_powerpc::do_finalize_sections): Update to pass true for
10184         dynrel_includes_plt when 32-bit.
10185
10186 2010-02-08  Doug Kwan  <dougkwan@google.com>
10187
10188         * arm.cc (Arm_relobj::simple_input_section_output_address): New
10189         method.
10190         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
10191         Arm_relobj::scan_section_for_cortex_a8_stubs,
10192         Arm_relobj::do_relocation_section): Instead of calling
10193         Output_section::output_address, use faster
10194         Arm_relobj::simple_input_section_output_address.
10195
10196 2010-02-08  David S. Miller  <davem@davemloft.net>
10197
10198         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
10199         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
10200         relocation helper function.
10201
10202         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
10203         just like R_SPARC_GOT{10,13,22}.
10204         (Target_sparc::Scan::local): Likewise.
10205         (Target_sparc::Relocate:relocate): Likewise.
10206
10207 2010-02-06  Ian Lance Taylor  <iant@google.com>
10208
10209         * configure.ac: Rewrite targetobjs duplicate removal code to use
10210         only shell constructs.
10211         * configure: Rebuild.
10212
10213 2010-02-05  Doug Kwan  <dougkwan@google.com>
10214
10215         PR 11247
10216         * arm.cc (Arm_relobj::section_is_scannable): New method.
10217         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
10218         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
10219
10220 2010-02-04  Doug Kwan  <dougkwan@google.com>
10221
10222         PR 11247
10223         * arm-reloc-property.cc (cstdio): Include.
10224         * configure.ac (targetobjs): Remove duplicates.
10225         * configure: Regenerate.
10226         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
10227         big and little endian version for a given address size.
10228
10229 2010-02-03  Doug Kwan  <dougkwan@google.com>
10230
10231         * arm-reloc-property.cc
10232         (Arm_reloc_property_table::reloc_name_in_error_message): New method
10233         definition.
10234         * arm-reloc-property.h
10235         (Arm_reloc_property_table::get_implemented_static_reloc_property):
10236         New method definition.
10237         (Arm_reloc_property_table::reloc_name_in_error_message): New method
10238         declaration.
10239         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
10240         overflow to N.
10241         (GOT_PREL): Change implemented to Y.
10242         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
10243         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
10244         (Arm_relocate_functions::movw_abs_nc): Remove method.
10245         (Arm_relocate_functions::movt_abs): Ditto.
10246         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
10247         (Arm_relocate_functions::thm_movt_abs): Ditto.
10248         (Arm_relocate_functions::movw_rel_nc): Ditto.
10249         (Arm_relocate_functions::movw_rel): Ditto.
10250         (Arm_relocate_functions::movt_rel): Ditto.
10251         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
10252         (Arm_relocate_functions:thm_movw_rel): Ditto.
10253         (Arm_relocate_functions:thm_movt_rel): Ditto.
10254         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
10255         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
10256         New method definitions.
10257         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
10258         (Arm_relocation_functions::arm_grp_ldr): Ditto.
10259         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
10260         (Arm_relocation_functions::arm_grp_ldc): Ditto.
10261         (Target_arm::Relocate::relocate): Check for non-static or
10262         unimplemented relocation code and exit early.  Change calls to
10263         Target_arm::reloc_uses_thumb_bit and
10264         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
10265         instead.  Refactor code to handle similar relocations to increase
10266         code sharing.  Remove check for unsupported relocation code in switch
10267         statement.
10268         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
10269         relocation property table to find out size.  Change error message to
10270         print out the name of a relocation code instead of the numeric value.
10271         (Target_arm::scan_reloc_for_stub): Use relocation property table
10272         instead of calling Target_arm::reloc_uses_thumb_bit().
10273
10274 2010-02-02  Doug Kwan  <dougkwan@google.com>
10275
10276         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
10277         types of relaxed input section.
10278
10279 2010-02-02  Doug Kwan  <dougkwan@google.com>
10280
10281         * Makefile.am (HFILES): Add arm-reloc-property.h.
10282         (DEFFILES): New.
10283         (TARGETSOURCES): Add arm-reloc-property.cc
10284         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
10285         (libgold_a_SOURCES): $(DEFFILES)
10286         * Makefile.in: Regenerate.
10287         * arm-reloc-property.cc: New file.
10288         * arm-reloc-property.h: New file.
10289         * arm-reloc.def: New file.
10290         * arm.cc: Update comments.
10291         (arm-reloc-property.h): New included header.
10292         (arm_reloc_property_table): New global variable.
10293         (Target_arm::do_select_as_default_target): New method definition.
10294         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
10295         arm-reloc-property to targ_extra_obj.
10296         * parameters.cc (set_parameters_target): Call
10297         Target::select_as_default_target().
10298         * target.h (Target::select_as_default_target): New method definition.
10299         (Target::do_select_as_default_target): Same.
10300
10301 2010-02-01  Doug Kwan  <dougkwan@google.com>
10302
10303         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
10304         first_output_text_section_.
10305         (Arm_exidx_fixup::first_output_text_section): New method definition.
10306         (Arm_exidx_fixup::first_output_text_section_): New data member.
10307         (Arm_exidx_fixup::process_exidx_section): Record the first text
10308         output section seen.
10309         (Arm_output_section::fix_exidx_coverage): Set correct linked section
10310         and entsize in output section header.
10311
10312 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10313
10314         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
10315         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
10316         (Arm_relocate_functions::thm_alu11): New Method.
10317         (Arm_relocate_functions::thm_pc8): New Method.
10318         (Arm_relocate_functions::thm_pc12): New Method.
10319         (Target_arm::Scan::local): Handle the relocations.
10320         (Target_arm::Scan::global): Likewise.
10321         (Target_arm::Relocate::relocate): Likewise.
10322         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10323
10324 2010-01-29  Doug Kwan  <dougkwan@google.com>
10325
10326         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
10327         of relocation types as ld.
10328
10329 2010-01-29  Doug Kwan  <dougkwan@google.com>
10330
10331         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
10332         to public.
10333         (Arm_relocate_functions::thumb_branch_common): Ditto.
10334         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
10335         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
10336         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
10337         Arm_relocate_functions::jump24): Remove.
10338         (Target_arm::Relocate::relocate): Adjust code to call
10339         Arm_relocation_functions::arm_branch_common and
10340         Arm_relocation_functions::thumb_branch_common instead of their removed
10341         wrappers.  Merge switch-cases together to reduce source code size.
10342
10343 2010-01-29  Doug Kwan  <dougkwan@google.com>
10344
10345         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
10346         output_local_symbol_count_needs_update_.
10347         (Arm_relobj::output_local_symbol_count_needs_update,
10348          Arm_relobj::set_output_local_symbol_count_needs_update,
10349          Arm_relobj::update_output_local_symbol_count): New methods.
10350         (Arm_relobj::output_local_symbol_count_needs_update_): New data
10351         member.
10352         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
10353         of pointed function as in a R_ARM_PREL31 relocation.
10354         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
10355         for output local symbol count updating.
10356         (Target_arm::do_relax): Update output local symbol counts in objects
10357         if necessary.
10358         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
10359
10360 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10361
10362         * arm.cc: Added support for the ARM relocations:
10363         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
10364         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
10365         (Arm_relocate_functions::movw_rel_nc): Renamed (was
10366         movw_prel_nc).
10367         (Arm_relocate_functions::movw_rel): New method.
10368         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
10369         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
10370         thm_movw_prel_nc).
10371         (Arm_relocate_functions::thm_movw_rel): New method.
10372         (Arm_relocate_functions::thm_movt_rel): Renamed (was
10373         thm_movt_prel).
10374         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
10375         relocations.
10376         (Target_arm::Scan::global): Likewise.
10377         (Target_arm::Relocate::relocate): Likewise.
10378         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10379         Likewise.
10380
10381 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10382
10383         * arm.cc: Added support for ARM group relocations.
10384         (Target_arm::reloc_needs_sym_origin): New method.
10385         (Arm_relocate_functions::calc_grp_kn): New method.
10386         (Arm_relocate_functions::calc_grp_residual): New method.
10387         (Arm_relocate_functions::calc_grp_gn): New method.
10388         (Arm_relocate_functions::arm_grp_alu): New Method.
10389         (Arm_relocate_functions::arm_grp_ldr): New Method.
10390         (Arm_relocate_functions::arm_grp_ldrs): New Method.
10391         (Arm_relocate_functions::arm_grp_ldc): New Method.
10392         (Target_arm::Scan::local): Handle the ARM group relocations.
10393         (Target_arm::Scan::global): Likewise.
10394         (Target_arm::Relocate::relocate): Likewise.
10395         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10396         Likewise.
10397
10398 2010-01-26  Doug Kwan  <dougkwan@google.com>
10399
10400         * arm.cc (set): Include.
10401         (class Arm_exidx_fixup): Change type of last_input_section_ to const
10402         pointer type.
10403         (Arm_output_section::Text_section_list): New type.
10404         (Arm_output_section::append_text_sections_to_list): New method.
10405         (Arm_output_section::fix_exidx_coverage): Ditto.
10406         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
10407         (Arm_relobj::convert_input_section_to_relaxed_section): Use
10408         Relobj::set_section_offset() instead of
10409         Sized_relobj::invalidate_section_offset().
10410         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
10411         parameter for section headers. Ignore relocation sections for
10412         unallocated sections and EXIDX sections.
10413         (Target_arm::fix_exidx_coverage): New method.
10414         (Target_arm::output_section_address_less_than): New type.
10415         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
10416         linked text section instead of the EXIDX section.
10417         (Arm_output_section::create_stub_group): Add an assertion to check
10418         that this is not an EXIDX output section.
10419         (Arm_output_section::append_text_sections_to_list): New method.
10420         (Arm_output_section::fix_exidx_coverage): Ditto.
10421         (Arm_relobj::scan_sections_for_stubs): Adjust call to
10422         Arm_relobj::section_needs_reloc_stub_scanning.
10423         (Target_arm::do_relax): Fix EXIDX output section coverage in the
10424         first pass.
10425         (Target_arm::fix_exidx_coverage): New method.
10426         * object.h (Relobj::set_output_section): New method.
10427         (Sized_relobj::invalidate_section_offset): Remove method.
10428         (Sized_relobj::do_invalidate_section_offset): Remove method.
10429         (Sized_relobj::do_set_section_offset): Handle offset value -1.
10430
10431 2010-01-25  Doug Kwan  <dougkwan@google.com>
10432
10433         * arm.cc (Arm_exidx_merged_section::do_output_offset):
10434         Fix warning due to signed and unsigned comparison on a 32-bit host.
10435
10436 2010-01-22  Doug Kwan  <dougkwan@google.com>
10437
10438         * arm.cc (Target_arm::do_relax): Record an output section for section
10439         offset adjustment it contains any stub table that has changed.
10440         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
10441         offsets in an output section if necessary.
10442         * output.cc (Output_section::Output_section): Initialize
10443         section_offsets_need_adjustments_.
10444         (Output_section::add_input_section_for_script): Renamed to
10445         Output_section::add_simple_input_section.
10446         (Output_section::save_states): Add a comment.
10447         (Output_section::discard_states): New method defintion.
10448         (Output_section::adjust_section_offsets): Same.
10449         * output.h (Output_section::add_input_section_for_script): Renamed to
10450         Output_section::add_simple_input_section.
10451         (Output_section::discard_states): New method declaration.
10452         (Output_section::adjust_section_offsets): Same.
10453         (Output_section::section_offsets_need_adjustment,
10454         Output_section::set_section_offsets_need_adjustment): New method
10455         definitions.
10456         (Output_section::section_offsets_need_adjustment_): New data member.
10457         * script-sections.cc
10458         (Output_section_element_input::set_section_address): Adjust code for
10459         renaming of Output_section::add_input_section_for_script.
10460         (Orphan_output_section::set_section_address): Same.
10461
10462 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10463
10464         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
10465         Fix_v4bx enum values .
10466         * gold/options.h (General_options): New option definitions.
10467         (General_options::fix_v4bx): New method.
10468         (General_options::Fix_v4bx): New enum.
10469         * gold/options.cc (General_options::parse_fix_v4bx): New method.
10470         (General_options::parse_fix_v4bx_interworking): New method.
10471
10472 2010-01-22  Doug Kwan  <dougkwan@google.com>
10473
10474         * arm.cc (Arm_exidx_fixup): New class.
10475
10476 2010-01-21  Doug Kwan  <dougkwan@google.com>
10477
10478         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
10479         classes.
10480         (Arm_exidx_section_offset_map): New type.
10481
10482 2010-01-21  Doug Kwan  <dougkwan@google.com>
10483
10484         * arm.cc (Arm_exidx_input_section): New class.
10485         (Arm_relobj::exidx_input_section_by_link,
10486         Arm_relobj::exidx_input_section_by_shndx,
10487         Arm_relobj::make_exidx_input_section): New methods.
10488         (read_arm_attributes_section): Remove.
10489         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
10490         information about them.
10491         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
10492         to here.
10493
10494 2010-01-20  Doug Kwan  <dougkwan@google.com>
10495
10496         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
10497         Input_section_specifier to Section_id.
10498         (Target_arm::new_arm_input_section: Adjust code for change of key
10499         type.
10500         (Target_arm::find_arm_input_section): Ditto.
10501         * gc.h (object.h): Include for Section_id nand Section_id_hash.
10502         (Section_id): Remove.
10503         (Garbage_collection::Section_id_hash): Remove.
10504         * icf.h (object.h): Include for Section_id nand Section_id_hash.
10505         (Section_id): Remove.
10506         (Icf::Section_id_hash): Remove.
10507         * object.h (Section_id, Const_section_id, Section_id_hash,
10508         Const_section_id_hash): New type definitions.
10509         * output.cc (Output_section::add_relaxed_input_section): Change to
10510         use Const_section_id instead of Input_section_specifier as key type.
10511         (Output_section::add_merge_input_section): Ditto.
10512         (Output_section::build_relaxation_map): Change to use Section_id
10513         instead of Input_section_specifier as key type.
10514         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10515         Ditto.
10516         (Output_section::convert_input_sections_to_relaxed_sections): Change
10517         to use Const_section_id instead of Input_section_specifier as key type.
10518         (Output_section::find_merge_section): Ditto.
10519         (Output_section::find_relaxed_input_section): Ditto.
10520         * output.h (Input_section_specifier): Remove class.
10521         (Output_section::Output_section_data_by_input_section_map): Change
10522         key type to Const_section_id.
10523         (Output_section::Output_relaxed_input_section_by_input_section_map):
10524         Ditto.
10525         (Output_section::Relaxation_map): Change key type to Section_id.
10526
10527 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10528
10529         * gold/arm.cc: Added support for R_ARM_V4BX relocation
10530         (class Arm_v4bx_stub): New class.
10531         (DEF_STUBS): Updated definition to support v4_veneer_bx.
10532         (Stub_factory::make_arm_v4bx_stub): New method.
10533         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
10534         (Stub_table::empty): Handle v4bx stubs.
10535         (Stub_table::add_arm_v4bx_stub): New method.
10536         (Stub_table::find_arm_v4bx_stub): New method.
10537         (Arm_relocate_functions::v4bx): New method.
10538         (Target_arm::fix_v4bx): New method.
10539         (Target_arm::Target_arm): Handle R_ARM_V4BX.
10540         (Stub_table::relocate_stubs): Likewise.
10541         (Stub_table::do_write): Likewise.
10542         (Stub_table::update_data_size_and_addralign): Likewise.
10543         (Stub_table::finalize_stubs):  Likewise.
10544         (Target_arm::Scan::local): Likewise.
10545         (Target_arm::Scan::global): Likewise.
10546         (Target_arm::do_finalize_sections): Likewise.
10547         (Target_arm::Relocate::relocate): Likewise.
10548         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10549         Likewise.
10550         (Target_arm::scan_reloc_for_stub): Likewise.
10551         (Target_arm::scan_reloc_section_for_stubs): Likewise.
10552
10553 2010-01-19  Ian Lance Taylor  <iant@google.com>
10554
10555         * output.cc (Output_section_headers::do_sized_write): Write large
10556         segment count to sh_info field.
10557         (Output_file_header::do_sized_write): For large segment count,
10558         write PN_XNUM to e_phnum field.
10559
10560 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10561
10562         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
10563         (Arm_relocate_functions::thm_jump8): New function.
10564         (Arm_relocate_functions::thm_jump11): New function.
10565         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
10566         R_ARM_THM_JUMP11.
10567         (Target_arm::Scan::global): Likewise.
10568         (Target_arm::Relocate::relocate): Likewise.
10569         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10570         Likewise.
10571
10572 2010-01-14  Doug Kwan  <dougkwan@google.com>
10573
10574         * arm.cc (map, utility): Include headers.
10575         (Target_arm::apply_cortex_a8_workaround): New method.
10576         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
10577         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
10578         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
10579         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
10580         the --[no-]fix-cortex-a8 command line options.
10581         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
10582         (Target_arm::relocate_stub): Use addend in instruction template.
10583         * options.h (DEFINE_bool): Set the user-set flag.
10584         (General_options): Add --[no-]-fix-cortex options.
10585         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
10586         : Update fast look-up map after conversion.
10587
10588 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
10589
10590         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
10591         in the first pass of do_layout.
10592
10593 2010-01-13  Doug Kwan  <dougkwan@google.com>
10594
10595         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10596         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
10597         apparent compiler problem of not folding static constant integral
10598         data members of elfcpp::Elf_sizes<32>.
10599
10600 2010-01-13  Doug Kwan  <dougkwan@google.com>
10601
10602         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10603         Arm_relobj::section_needs_cortex_a8_stub_scanning,
10604         Arm_relobj::scan_section_for_cortex_a8_erratum,
10605         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
10606         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
10607         sections to scan for relocation stubs into a new method
10608         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
10609         relocation and Cortex-A8 stub scanning.
10610         (Target_arm::do_relax): Force stubs to be after stubbed sections
10611         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
10612         the beginning of a new relaxation pass.  Update a comment.
10613         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
10614
10615 2010-01-12  Ian Lance Taylor  <iant@google.com>
10616
10617         * target-reloc.h (visibility_error): New inline function.
10618         (relocate_section): Call visibility_error.
10619         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
10620         (MOSTLYCLEANFILES): Likewise.
10621         (protected_4_pic.o, protected_3.err): New targets.
10622         * testsuite/protected_4.cc: New file.
10623
10624 2010-01-12  Doug Kwan  <dougkwan@google.com>
10625
10626         * arm.cc (Cortex_a8_reloc): New class.
10627         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
10628         and cortex_a8_relocs_info_.
10629         (Target_arm::fix_cortex_a8): New method definition.
10630         (Target_arm::Cortex_a8_relocs_info): New type.
10631         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
10632         New data member declarations.
10633         (Target_arm::scan_reloc_for_stub): Record information about
10634         relocations for THUMB branches that might be exempted from the
10635         Cortex-A8 workaround.
10636         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
10637         at the beginning of a relaxation pass.
10638
10639 2010-01-12  Doug Kwan  <dougkwan@google.com>
10640
10641         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
10642         (Arm_relobj::Mapping_symbol_position,
10643          Arm_reloj::Mapping_symbol_position_less,
10644          Arm_relobj::Mapping_symbols_info): New types.
10645         (Target_arm::is_mapping_symbol_name): New method definition.
10646         (Arm_relobj::do_count_local_symbols): Save information about mapping
10647         symbols.
10648
10649 2010-01-11  Doug Kwan  <dougkwan@google.com>
10650
10651         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
10652         Arm_relocate_functions::thumb32_branch_upper,
10653         Arm_relocate_functions::thumb32_branch_lower,
10654         Arm_relocate_functions::thumb32_cond_branch_offset,
10655         Arm_relocate_functions::thumb32_cond_branch_upper,
10656         Arm_relocate_functions::thumb32_cond_branch_lower,
10657         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
10658         branch offset encoding.
10659         (Arm_relocate_functions::thumb_branch_common): Use new branch
10660         offset encoding methods to avoid code duplication.
10661         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
10662         (Stub_addend_reader::operator()): Use new branch encoding method
10663         to avoid code duplication.
10664
10665 2010-01-11  Doug Kwan  <dougkwan@google.com>
10666
10667         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
10668         (Target_arm::do_finalize_sections): Define special EXIDX section
10669         symbols only if referenced.
10670         * gc.h (Garbage_collection::add_reference): New method.
10671         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
10672         code duplication.
10673
10674 2010-01-11  Ian Lance Taylor  <iant@google.com>
10675
10676         * script.cc (Version_script_info::build_expression_list_lookup):
10677         Change complaing about duplicate wildcard match from error to
10678         warning.
10679
10680         * script.cc (class Lazy_demangler): Recreate--revert part of patch
10681         of 2009-12-30.
10682         (Version_script_info::Version_script_info): Initialize globs_,
10683         default_version_, default_is_global_, and exact_.  Don't
10684         initialize globals_ or locals_.
10685         (Version_script_info::build_lookup_tables): Build local symbols
10686         first.
10687         (Version_script_info::unquote): New function.
10688         (Version_script_info::add_exact_match): New function.
10689         (Version_script_info::build_expression_list_lookup): Remove lookup
10690         parameter.  Add is_global parameter.  Change all callers.  Handle
10691         wildcard pattern specially.  Unquote pattern.  Call
10692         add_exact_match.
10693         (Version_script_info::get_name_to_match): New function.
10694         (Version_script_info::get_symbol_version): New function.
10695         (Version_script_info::get_symbol_version_helper): Remove.
10696         (Version_script_info::check_unmatched_names): Call unquote.
10697         * script.h (class Version_script_info): Change get_symbol_version
10698         to be non-inline and add is_global parameter; change all callers.
10699         Rewrite symbol_is_local.  Update declarations.  Define struct
10700         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
10701         Remove globals_ and locals_ members.  Add exact_, globs_,
10702         default_version_, is_global_.
10703         (Version_script_info::Glob): Remove pattern, add expression and
10704         is_global.  Update constructor.  Change all callers.
10705         * dynobj.cc (Versions::finalize): Mark the version symbol as the
10706         default version.
10707         (Versions::symbol_section_contents): If a symbol is undefined, or
10708         defined in a dynamic object, set the version index to
10709         VER_NDX_LOCAL.
10710         * symtab.cc (Symbol_table::add_from_relobj): Don't call
10711         symbol_is_local.
10712         (Symbol_table::add_from_pluginobj): Likewise.
10713         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
10714
10715 2010-01-11  Doug Kwan  <dougkwan@google.com>
10716
10717         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
10718         (incremental_dump_LDADD): Add linking option for libintl.
10719         * Makefile.in: Regenerate.
10720
10721 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
10722
10723         PR gold/11144
10724         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
10725         instead of -Ds.
10726         * testsuite/Makefile.in: Regenerated.
10727
10728 2010-01-10  Doug Kwan  <dougkwan@google.com>
10729
10730         * options.h (DEFINE_var): Use parentheses around argument varname__
10731         in macro body to avoid any unintended subsequent substitutions.
10732
10733 2010-01-10  Ian Lance Taylor  <iant@google.com>
10734
10735         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
10736         candidates before doing symbol resolution.
10737
10738         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
10739         ODR candidates if only one is weak.
10740
10741 2010-01-08  Ian Lance Taylor  <iant@google.com>
10742
10743         * script.cc (Version_script_info::build_expression_list_lookup):
10744         Don't warn about ambiguous version, just record the ambiguity.
10745         (Version_script_info::get_symbol_version_helper): Give error if
10746         version is ambiguous.
10747
10748 2010-01-08  Doug Kwan  <dougkwan@google.com>
10749
10750         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
10751         prev_data_size_ and prev_addralign_.  Remove initializer for
10752         deleted data member has_been_changed_.
10753         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
10754         to determine if the table is empty.
10755         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
10756         Remove.
10757         (Stub_table::add_reloc_stub): Define method in class definition
10758         instead of just declaring it there.
10759         (Stub_table::add_cortex_a8_stub): New method definition.
10760         (Stub_table::update_data_size_and_addralign): Ditto.
10761         (Stub_table::finalize_stubs): Ditto.
10762         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
10763         (Stub_table::do_addralign_): Return address alignment in the
10764         (Stub_table::do_reset_address_and_file_offset): Define method in
10765         class definition instead of declaring it there.  Set current data
10766         size to be the data size of the previous pass.
10767         (Stub_table::set_final_data_size): Use current data size as the
10768         final data size.
10769         (Stub_table::relocate_stub): Change parameter type of stub from
10770         Reloc_stub pointer to Stub pointer.
10771         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10772         (Stub_table::Cortex_a8_stub_list): New typedef.
10773         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10774          Stub_table::prev_addralign_): New data member.
10775         (Arm_relobj::Arm_relobj): Initialize data member
10776         section_has_cortex_a8_workaround_.
10777         (Arm_relobj::section_has_cortex_a8_workaround,
10778          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
10779          definitions.
10780         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10781         declarations.
10782         (Target_arm::relocate_stub): Change parameter type of stub from
10783         Reloc_stub pointer to Stub pointer.
10784         (Insn_template::size, Insn_template::alignment): Handle
10785         THUMB16_SPECIAL_TYPE.
10786         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10787          Stub_table::update_data_size_and_addralign,
10788          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10789         definitions.
10790         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10791         (Stub_table::do_write): Ditto.
10792         (Target_arm::do_relax): Adjust code for changes in Stub_table.
10793
10794 2010-01-08  Ian Lance Taylor  <iant@google.com>
10795
10796         PR 11108
10797         * symtab.h (class Symbol): Remove fields is_target_special_ and
10798         has_plt_offset_.  Add field is_defined_in_discarded_section_.
10799         (Symbol::is_defined_in_discarded_section): New function.
10800         (Symbol::set_is_defined_in_discarded_section): New function.
10801         (Symbol::has_plt_offset): Rewrite.
10802         (Symbol::set_plt_offset): Verify that new offset is not -1U.
10803         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10804         Don't initialize is_target_special_ or has_plt_offset_.
10805         Initialize is_defined_in_discarded_section_.
10806         (Symbol_table::add_from_relobj): If appropriate, set
10807         is_defined_in_discarded_section.
10808         * resolve.cc (Symbol::override_base_with_special): Don't test
10809         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
10810         * target-reloc.h (relocate_section): Do special handling for
10811         symbols defined in discarded sections for global symbols as well
10812         as local symbols.
10813
10814 2010-01-08  Ian Lance Taylor  <iant@google.com>
10815
10816         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10817         the SHT_SYMTAB case.
10818
10819 2010-01-08  Ian Lance Taylor  <iant@google.com>
10820
10821         * object.cc (Sized_relobj::do_layout): Don't get confused if
10822         layout_eh_frame returns NULL.
10823
10824 2010-01-08  Ian Lance Taylor  <iant@google.com>
10825
10826         PR 11084
10827         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10828         dynamic symbol table, use the normal symbol table.
10829         (Sized_dynobj::do_read_symbols): Remove assertion about type of
10830         symbol table.
10831
10832 2010-01-08  Ian Lance Taylor  <iant@google.com>
10833
10834         PR 11072
10835         * layout.cc (Layout::include_section): Remove .gnu_debuglink
10836         sections.
10837
10838 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
10839
10840         * version.cc (print_version): Change to "Copyright 2010".
10841
10842 2010-01-08  Ian Lance Taylor  <iant@google.com>
10843
10844         PR 10287
10845         PR 11063
10846         * i386.cc (class Target_i386): Change return type of plt_section
10847         to be non-const.
10848         (class Output_data_plt_i386): Add tls_desc_rel_ field.
10849         (Output_data_plt_i386::Output_data_plt_i386): Initialize
10850         tls_desc_rel_ field.
10851         (Output_data_plt_i386::rel_tls_desc): New function.
10852         (Target_i386::rel_tls_desc_section): New function.
10853         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
10854         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
10855         R_386_TLS_DESC reloc in rel_tls_desc_section.
10856         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
10857         Define struct Tlsdesc_info.
10858         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
10859         (Target_x86_64::do_reloc_symbol_index): New function.
10860         (Target_x86_64::add_tlsdesc_info): New function.
10861         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
10862         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
10863         tlsdesc_rel_ field.
10864         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
10865         all callers.
10866         (Output_data_plt_x86_64::rela_tlsdesc): New function.
10867         (Target_x86_64::rela_tlsdesc_section): New function.
10868         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
10869         handling.
10870         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
10871         (Target_x86_64::do_reloc_addend): New function.
10872         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
10873         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
10874         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
10875         (Output_reloc::type): New function.
10876         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
10877         (Output_reloc::is_target_specific): New function.
10878         (Output_reloc::target_arg): New function.
10879         (class Output_reloc) [SHT_RELA]: Add four new constructors for
10880         absolute relocs and target specific relocs.
10881         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
10882         add_target_specific.
10883         (class Output_data_reloc) [SHT_RELA]: Likewise.
10884         * output.cc (Output_reloc::Output_reloc): Add four new versions
10885         for absolute relocs and target specific relocs.
10886         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
10887         (Output_reloc::get_symbol_index): Likewise.
10888         (Output_reloc::local_section_offset): Check that local_sym_index_
10889         is not TARGET_CODE or 0.
10890         (Output_reloc::symbol_value): Likewise.
10891         (Output_reloc::write) [SHT_RELA]: Call target for target specific
10892         reloc.
10893         * target.h (class Target): Add reloc_symbol_index and reloc_addend
10894         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
10895         functions.
10896         * layout.cc (add_target_dynamic_tags): Use output section for
10897         DT_PLTRELSZ and DT_JMPREL.
10898
10899 2010-01-07  Ian Lance Taylor  <iant@google.com>
10900
10901         PR 11061
10902         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
10903         function.
10904         (class Output_data_reloc_generic): Define.
10905         (class Output_data_reloc_base): Change base class to
10906         Output_data_reloc_generic.  Change add() method to call
10907         bump_relative_reloc_count for a relative reloc.  Remove
10908         sort_relocs_ field.
10909         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
10910         to sort_relocs().
10911         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10912         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
10913         appropriate.
10914         * layout.h (class Layout): Update declaration.
10915
10916 2010-01-07  Ian Lance Taylor  <iant@google.com>
10917
10918         * output.h (class Output_data): Add const version of
10919         output_section and do_output_section.
10920         (class Output_section_data): Add const version of
10921         do_output_section.
10922         (class Output_section): Likewise.
10923         * layout.cc (Layout::add_target_dynamic_tags): New function.
10924         * layout.h (class Layout): Update declarations.
10925         * arm.cc (Target_arm::do_finalize_sections): Use
10926         add_target_dynamic_tags.
10927         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10928         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10929         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10930         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10931
10932 2010-01-07  Ian Lance Taylor  <iant@google.com>
10933
10934         PR 11042
10935         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10936         object as needed.
10937
10938 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
10939             Ian Lance Taylor  <iant@google.com>
10940
10941         PR 11019
10942         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
10943         Xindex::read_symtab_xindex.
10944
10945 2010-01-07  Doug Kwan  <dougkwan@google.com>
10946
10947         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
10948         (Insn_template::thumb16_bcond_insn): New method declaration.
10949         (Insn_template): Fix spelling.
10950         (Stub::thumb16_special): New method declaration.
10951         (Stub::do_write): Define virtual method which was previously pure
10952         virtual.
10953         (Stub::do_thumb16_special): New method declaration.
10954         (Stub::do_fixed_endian_write): New template member.
10955         (Reloc_stub::do_write): Remove.
10956         (Reloc_stub::do_fixed_endian_write): Remove.
10957         (Cortex_a8_stub): New class definition.
10958         (Stub_factory::make_cortex_a8_stub): New method definition.
10959         (Stub_factory::Stub_factory): Add missing static storage class
10960         qualifier for elf32_arm_stub_a8_veneer_blx.
10961
10962 2010-01-07  Ian Lance Taylor  <iant@google.com>
10963
10964         PR 10980
10965         * options.h (class General_options): Add --warn-unresolved-symbols
10966         and --error-unresolved-symbols.
10967         * errors.cc (Errors::undefined_symbol): Implement
10968         --warn-unresolved-symbols.
10969
10970         * options.h (class General_options): Add -z text and -z textoff.
10971         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10972
10973 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
10974
10975         * gc.h (Garbage_collection::Cident_section_map): New typedef.
10976         (Garbage_collection::cident_sections): New function.
10977         (Garbage_collection::add_cident_section): New function.
10978         (Garbage_collection::cident_sections_): New member.
10979         (gc_process_relocs): Add references to sections whose names are C
10980         identifiers.
10981         * gold.h (cident_section_start_prefix): New constant.
10982         (cident_section_stop_prefix): New constant.
10983         (is_cident): New function.
10984         * layout.cc (Layout::define_section_symbols): Replace string constants
10985         with the newly defined constants.
10986         * object.cc (Sized_relobj::do_layout): Track sections whose names are
10987         C identifiers.
10988         * testsuite/Makefile.am: Add gc_orphan_section_test.
10989         * testsuite/Makefile.in: Regenerate.
10990         * testsuite/gc_orphan_section_test.cc: New file.
10991         * testsuite/gc_orphan_section_test.sh: New file.
10992
10993 2010-01-06  Ian Lance Taylor  <iant@google.com>
10994
10995         PR 10980
10996         * options.h (class General_options): Add --warn-shared-textrel.
10997         * layout.cc (Layout::finish_dynamic_section): Implement
10998         --warn-shared-textrel.
10999
11000         PR 10980
11001         * options.h (class General_options): Add --warn-multiple-gp.
11002
11003 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11004
11005         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
11006         $(THREADSLIB) and $(LIBDL).
11007         * Makefile.in: Rebuild.
11008
11009 2010-01-06  Ian Lance Taylor  <iant@google.com>
11010
11011         PR 10980
11012         * options.cc (General_options::parse_section_start): New function.
11013         (General_options::section_start): New function.
11014         (General_options::General_options): Initialize all members.
11015         * options.h: Include <map>
11016         (class General_options): Add --section-start.  Add section_starts_
11017         member.
11018         * layout.cc (Layout::attach_allocated_section_to_segment): If
11019         --section-start was used, set the address of the segment.  Remove
11020         local sort_sections.
11021         (Layout::relaxation_loop_body): If the address of the load segment
11022         has been set by --section-start, don't use it.
11023         * output.h (Output_segment::update_flags_for_output_section): New
11024         function.
11025         * output.cc (Output_segment::add_output_section): Call
11026         update_flags_for_output_section.
11027
11028 2010-01-05  Ian Lance Taylor  <iant@google.com>
11029
11030         PR 10980
11031         * options.h (class General_options): Add --undefined-version.
11032         * script.cc (struct Version_expression): Add was_matched_by_symbol
11033         field.
11034         (Version_script_info::matched_symbol): New function.
11035         (Version_script_info::get_symbol_version_helper): Call
11036         matched_symbol.
11037         (Version_script_info::check_unmatched_names): New function.
11038         * script.h (class Version_script_info): Update declarations.
11039         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
11040
11041         * options.h (class General_options): Use DEFINE_bool_alias for
11042         allow_multiple_definition.
11043         * resolve.cc (Symbol_table::should_override): Don't test
11044         allow_multiple_definition.
11045
11046         PR 10980
11047         * options.h (class General_options): Add --cref.
11048         * main.cc (main): Print cref table if --cref.  Don't close mapfile
11049         until after printing cref table.
11050         * cref.cc: Include "symtab.h".
11051         (class Cref_inputs): Define Cref_table_compare and Cref_table.
11052         (Cref_table_compare::operator()): New function.
11053         (Cref_inputs::gather_cref): New function.
11054         (filecol): New static const.
11055         (Cref_inputs::print_cref): New function.
11056         (Cref::print_cref): New function.
11057         * cref.h: Include <cstdio>.
11058         (class Cref): Update declarations.
11059         * mapfile.h (Mapfile::file): New function.
11060         * object.h (class Object): Define Symbols.  Declare virtual
11061         do_get_global_symbols.
11062         (Object::get_global_symbols): New function.
11063         * object.cc (Input_objects::add_object): Pass object to cref_ if
11064         --cref.
11065         (Input_objects::archive_start): Likewise.
11066         (Input_objects::archive_stop): Likewise.
11067         (Input_objects::print_cref): New function.
11068         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
11069         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
11070         --cref.
11071         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
11072         function.
11073         * plugin.h (class Sized_pluginobj): Update declarations.
11074
11075 2010-01-05  Ian Lance Taylor  <iant@google.com>
11076
11077         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
11078         to is_default_version.  Rename insdef to insdefault.
11079         (Symbol_table::add_from_relobj): Rename def to is_default_version
11080         and local to is_forced_local.
11081         (Symbol_table::add_from_pluginobj): Likewise.
11082         (Symbol_table::add_from_dynobj): Likewise.
11083         (Symbol_table::define_special_symbol): Rename insdef to
11084         insdefault.
11085
11086 2010-01-04  Ian Lance Taylor  <iant@google.com>
11087
11088         PR 10980
11089         * options.h (class General_options): Add
11090         --allow-multiple-definition and -z muldefs.
11091         * resolve.cc (Symbol_table::should_override): Don't warn about a
11092         multiple symbol definition if --allow-multiple-definition or -z
11093         muldefs.
11094
11095         PR 10980
11096         * options.h (class General_options): Add --add-needed and
11097         --copy-dt-needed-entries.  Tweak --as-needed help entry.
11098         * object.cc (Input_objects::check_dynamic_dependencies): Give an
11099         error if --copy-dt-needed-entries aka --add-needed is used and
11100         would cause a change in behaviour.
11101
11102         PR 10980
11103         * options.h (class General_options): Add -G as a short version of
11104         --shared.  Add no-op options -assert, -g, and -i.
11105
11106 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
11107
11108         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
11109         check for .text or .gnu.linkonce.t sections.
11110         * icf.cc (Icf::find_identical_sections): Ditto.
11111         Change the detection for mangled function name within the section
11112         name.
11113         * icf.h (is_section_foldable_candidate): New function.
11114
11115 2009-12-30  Ian Lance Taylor  <iant@google.com>
11116
11117         PR 10980
11118         * options.h (class General_options): Permit two dashes with
11119         --retain-symbols-file.
11120
11121 2009-12-30  Ian Lance Taylor  <iant@google.com>
11122
11123         PR 10979
11124         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
11125         don't put the file header and segment headers in the text
11126         segment.
11127
11128         PR 10979
11129         * common.cc (Sort_commons::operator()): Stabilize sort when both
11130         entries are NULL.
11131         (Symbol_table::do_allocate_commons_list): When allocating common
11132         symbols, skip a symbol which is no longer common.
11133         * symtab.h (Symbol::is_common): Test whether the symbol comes from
11134         an object before checking its type.
11135         * testsuite/common_test_2.c: New file.
11136         * testsuite/common_test_3.c: New file.
11137         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
11138         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
11139         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
11140         (common_test_2_pic.o, common_test_2.so): New targets.
11141         (common_test_3_pic.o, common_test_3.so): New targets.
11142         * testsuite/Makefile.in: Rebuild.
11143
11144         PR 10979
11145         * script.cc (read_input_script): If we see a new SECTIONS clause,
11146         and we have added an input section, give an error.
11147         * layout.h (class Layout): Add have_added_input_section function.
11148         Add have_added_input_section_ field.
11149         * layout.cc (Layout::Layout): Initialize
11150         have_added_input_section_.
11151         (Layout::layout): Set have_added_input_section_.
11152         (Layout::layout_eh_frame): Likewise.
11153
11154 2009-12-30  Ian Lance Taylor  <iant@google.com>
11155
11156         PR 10931
11157         * options.h (class General_options): Add --sort-common option.
11158         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
11159         * common.cc (Sort_common): Add sort_order parameter to
11160         constructor.  Add sort_order_ field.
11161         (Sort_commons::operator): Check sort_order_.
11162         (Symbol_table::allocate_commons): Determine the sort order.
11163         (Symbol_table::do_allocate_commons): Add sort_order parameter.
11164         Change all callers.
11165         (Symbol_table::do_allocate_commons_list): Likewise.
11166
11167 2009-12-30  Ian Lance Taylor  <iant@google.com>
11168
11169         PR 10916
11170         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
11171         symbols from this object, don't change the visibility of an
11172         undefined symbol.
11173         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
11174
11175 2009-12-30  Ian Lance Taylor  <iant@google.com>
11176
11177         PR 10861
11178         * script.h (class Version_script_info): Define Language enum.
11179         Update declarations.  Define Glob, Exact, and Lookup types.  Add
11180         new fields globals_, locals_, and is_finalized_.
11181         * script.cc: Various formatting fixes.
11182         (class Parser_closure): Change language_stack_ from a vector of
11183         std::string to one of Version_script_info::Language.  Adjust all
11184         uses accordingly.
11185         (class Lazy_demangler): Remove.
11186         (struct Version_expression): Change language from std::string to
11187         Version_script_info::Language.
11188         (Version_script_info::Version_script_info): New function.
11189         (Version_script_info::~Version_script_info): Don't call clear.
11190         (Version_script_info::finalize): New function.
11191         (Version_script_info::build_lookup_tables): New function.
11192         (Version_script_info::build_expression_list_lookup): New
11193         function.
11194         (Version_script_info::get_symbol_version_helper): Rewrite to use
11195         lookup tables.
11196         (Version_script_info::print_expression_list): Adjust to use
11197         Version_script_info::Language.
11198         (script_push_lex_into_version_mode): Check that the version script
11199         has not been finalized.
11200         (version_script_push_lang): Change language string to
11201         Version_script_info::Language.
11202         * options.cc (Command_line::version_script): New function.
11203         * options.h (class General_options): Add finalize_dynamic_list
11204         function.  Change version_script from declaration to definition.
11205         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
11206         * testsuite/version_script.map: Remove duplicate def of foo.
11207         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
11208         version_script.map.
11209         * testsuite/Makefile.in: Rebuild.
11210
11211 2009-12-30  Ian Lance Taylor  <iant@google.com>
11212
11213         PR 10843
11214         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
11215         if the input symbol index is 0, make the output symbol index 0.
11216
11217 2009-12-30  Ian Lance Taylor  <iant@google.com>
11218
11219         PR 10670
11220         * options.h (class General_options): Add -x/--discard-all.
11221         * object.cc (Sized_relobj::do_count_local_symbols): Handle
11222         --discard-all.  If the local symbol needs a dynamic entry, check
11223         that before handling --discard-locals.
11224
11225 2009-12-30  Ian Lance Taylor  <iant@google.com>
11226
11227         PR 10450
11228         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
11229         flags to PF_R.
11230         (Output_segment::add_output_section): Don't change the flags if
11231         the type is PT_TLS.
11232
11233         PR 10450
11234         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
11235         GNU hash table if they need a dynamic value.  Otherwise, don't add
11236         them if they are defined in a dynamic object or are forced local.
11237
11238 2009-12-29  Ian Lance Taylor  <iant@google.com>
11239
11240         PR 10450
11241         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
11242         .gnu.hash table for a 32-bit target.
11243
11244         PR 10450
11245         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
11246         regular and a dynamic object only needs a dynamic symbol table
11247         entry if it is externally visible.
11248
11249         PR 10450
11250         * i386.cc (class Target_i386): Initialize global_offset_table_ in
11251         constructor.  Add global_offset_table_ field.
11252         (Target_i386::got_section): Set global_offset_table_.
11253         (Target_i386::do_finalize_sections): Set global_offset_table_
11254         size.
11255         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
11256         in constructor.  Add global_offset_table_ field.
11257         (Target_x86_64::got_section): Set global_offset_table_.
11258         (Target_x86_64::do_finalize_sections): Set global_offset_table_
11259         size.
11260
11261         * layout.cc (Layout::Layout): Initialize increase_relro_.
11262         (Layout::get_output_section): Add is_relro, is_last_relro, and
11263         is_first_non_relro parameters.  Change all callers.
11264         (Layout::choose_output_section): Likewise.
11265         (Layout::add_output_section_data): Likewise.
11266         (Layout::make_output_section): Likewise.
11267         (Layout::set_segment_offsets): Clear increase_relro when using a
11268         linker script.
11269         * layout.h (class Layout): Add increase_relro method.  Add
11270         increase_relro_ field.  Update declarations.
11271         * output.cc (Output_section::Output_section): Initialize
11272         is_last_relro_ and is_first_non_relro_.
11273         (Output_segment::add_output_section): Group relro sections is
11274         do_sort is true.  Handle is_last_relro and is_first_non_relro.
11275         (Output_segment::maximum_alignment): Remove relro handling.
11276         (Output_segment::set_section_addresses): Add increase_relro
11277         parameter.  Change all callers.  Add initial alignment to align
11278         relro sections on separate page.  Remove old relro handling.
11279         (Output_segment::set_section_list_addresses): Remove in_relro
11280         parameter.  Change all callers.
11281         (Output_segment::set_offset): Add increase parameter.  Change all
11282         callers.  Remove old relro handling.
11283         * output.h (class Output_section): Add new methods: is_last_relro,
11284         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
11285         Add is_last_relro_ and is_first_non_relro_ fields.
11286         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
11287         Create separate .got.plt section.  Call increase_relro.
11288         * x86_64.cc (Target_x86_64::got_section): Likewise.
11289         * testsuite/relro_script_test.t: Add .got.plt.
11290
11291         PR 10450
11292         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
11293         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
11294         (Layout::finalize): Call set_dynamic_symbol_size.
11295         (Layout::set_dynamic_symbol_size): New function.
11296         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
11297         set_dynamic_symbol_size.
11298
11299         PR 10450
11300         * output.h (class Output_section): Add is_entsize_zero_ field.
11301         * output.cc (Output_section::Output_section): Initialize
11302         is_entsize_zero_.
11303         (Output_section::set_entsize): If two different entsizes are
11304         requested, force it to zero.
11305         (Output_section::add_input_section): Set flags for .debug_str
11306         before updating section flags.  Set entsize.
11307         (Output_section::update_flags_for_input_section): Set SHF_MERGE
11308         and SHF_STRING if all input sections have those flags.
11309
11310 2009-12-29   Rafael Espindola  <espindola@google.com>
11311
11312         * main.cc (main): Fix the sys time reporting.
11313         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
11314         reporting.
11315
11316 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
11317
11318         * options.cc (General_options::parse_version): Allow -v to exit
11319         without an error if there is nothing to link.
11320
11321 2009-12-29  Ian Lance Taylor  <iant@google.com>
11322
11323         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
11324         using a version of gcc before 4.1.
11325         * configure: Rebuild.
11326
11327 2009-12-28  Chris Demetriou  <cgd@google.com>
11328
11329         * attributes.cc (Output_attributes_section_data::do_write): Use
11330         std::vector::front rather than std::vector::data.
11331
11332 2009-12-28  Ian Lance Taylor  <iant@google.com>
11333
11334         * symtab.h (class Symbol_table): Add enum Defined.
11335         * resolve.cc (Symbol_table::should_override): Add defined
11336         parameter.  Change all callers.  Test whether object is NULL
11337         before calling a method on it.
11338         (Symbol_table::report_resolve_problem): Add defined parameter.
11339         Change all callers.
11340         (Symbol_table::should_override_with_special): Likewise.
11341         * symtab.cc (Symbol_table::define_in_output_data): Add defined
11342         parameter.  Change all callers.
11343         (Symbol_table::do_define_in_output_data): Likewise.
11344         (Symbol_table::define_in_output_segment): Likewise.
11345         (Symbol_table::do_define_in_output_segment): Likewise.
11346         (Symbol_table::define_as_constant): Likewise.
11347         (Symbol_table::do_define_as_constant): Likewise.
11348         * script.h (class Symbol_assignment): Add is_defsym parameter to
11349         constructor; change all callers.
11350         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
11351         parameter.  Change all callers.  Add is_defsym_ field.
11352         (class Parser_closure): Add parsing_defsym parameter to
11353         constructor; change all callers.  Add parsing_defsym accessor
11354         function.  Add parsing_defsym_ field.
11355
11356 2009-12-28  Ian Lance Taylor  <iant@google.com>
11357
11358         * gold.cc (queue_middle_tasks): Fix formatting.
11359         * object.cc (Relobj::is_section_name_included): Likewise.
11360
11361 2009-12-23  Ian Lance Taylor  <iant@google.com>
11362
11363         * i386.cc (Target_i386::do_calls_non_split): Recognize
11364         -fsplit-stack prologue for a function with a static chain.
11365         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
11366         -fsplit-stack prologue when using %r11.
11367
11368 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
11369
11370         * options.cc (General_options::parse_version): Make -v continue and do
11371         the link like GNU ld does.
11372
11373 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
11374
11375         * Makefile.am (CCFILES): Add timer.cc.
11376         (HFILES): Add timer.h.
11377         * configure.ac: Check for sysconf and times.
11378         * main.cc: include timer.h.
11379         (main): Use Timer instead of get_run_time.
11380         * timer.cc: New.
11381         * timer.h: New.
11382         * workqueue.cc: include timer.h.
11383         (Workqueue::find_and_run_task):
11384         Report user, sys and wall time.
11385         * Makefile.in: Regenerate.
11386         * config.in: Regenerate.
11387         * configure: Regenerate.
11388
11389 2009-12-16  Doug Kwan  <dougkwan@google.com>
11390
11391         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
11392         sections.
11393         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
11394         relaxed input sections.
11395         * output.cc (Output_section::find_relaxed_input_section): Change
11396         return type to Output_relaxed_input_section pointer.  Adjust code
11397         for new type of relaxed_input_section_map_.
11398         * output.h (Output_section::find_relaxed_input_section): Change
11399         return type to Output_relaxed_input_section pointer.
11400         (Output_section::Output_relaxed_input_section_by_input_section_map):
11401         New type.
11402         (Output_section::relaxed_input_section_map_): Change type to
11403         Output_section::Output_relaxed_input_section_by_input_section_map.
11404         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
11405         input section.
11406
11407 2009-12-15  Ian Lance Taylor  <iant@google.com>
11408
11409         * layout.cc (Layout::create_shstrtab): Only write out after input
11410         sections if we are compressing debug sections.
11411
11412 2009-12-15  Ian Lance Taylor  <iant@google.com>
11413
11414         * archive.cc (Archive::add_symbols): Only look up a symbol without
11415         a version if there is, in fact, a version.
11416
11417 2009-12-14  Ian Lance Taylor  <iant@google.com>
11418
11419         Revert -Wshadow changes, all changes from:
11420         2009-12-11  Doug Kwan  <dougkwan@google.com>
11421         2009-12-11  Nick Clifton  <nickc@redhat.com>
11422         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
11423
11424 2009-12-11  Doug Kwan  <dougkwan@google.com>
11425
11426         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
11427         due to -Wshadow.
11428         * attributes.cc (Object_attribute::size): Ditto.
11429         (Attributes_section_data::size): Ditto.
11430         (Attributes_section_data::Attributes_section_data): Ditto.
11431         (Output_attributes_section_data::do_write): Ditto.
11432         * attributes.h (Object_attribute::set_type): Ditto.
11433         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
11434
11435 2009-12-11  Nick Clifton  <nickc@redhat.com>
11436
11437         * archive.cc: Fix shadowed variable warnings.
11438         * arm.cc: Likewise.
11439         * compressed_output.cc: Likewise.
11440         * compressed_output.h: Likewise.
11441         * configure: Likewise.
11442         * dwarf_reader.cc: Likewise.
11443         * dynobj.cc: Likewise.
11444         * dynobj.h: Likewise.
11445         * ehframe.cc: Likewise.
11446         * ehframe.h: Likewise.
11447         * errors.cc: Likewise.
11448         * expression.cc: Likewise.
11449         * fileread.cc: Likewise.
11450         * fileread.h: Likewise.
11451         * freebsd.h: Likewise.
11452         * i386.cc: Likewise.
11453         * icf.cc: Likewise.
11454         * incremental.h: Likewise.
11455         * layout.cc: Likewise.
11456         * layout.h: Likewise.
11457         * mapfile.cc: Likewise.
11458         * merge.cc: Likewise.
11459         * merge.h: Likewise.
11460         * object.cc: Likewise.
11461         * object.h: Likewise.
11462         * options.h: Likewise.
11463         * output.cc: Likewise.
11464         * output.h: Likewise.
11465         * parameters.cc: Likewise.
11466         * plugin.cc: Likewise.
11467         * powerpc.cc: Likewise.
11468         * reduced_debug_output.cc: Likewise.
11469         * reduced_debug_output.h: Likewise.
11470         * reloc.cc: Likewise.
11471         * reloc.h: Likewise.
11472         * resolve.cc: Likewise.
11473         * script-sections.cc: Likewise.
11474         * script.cc: Likewise.
11475         * script.h: Likewise.
11476         * sparc.cc: Likewise.
11477         * symtab.cc: Likewise.
11478         * symtab.h: Likewise.
11479         * target-select.cc: Likewise.
11480         * target-select.h: Likewise.
11481         * token.h: Likewise.
11482         * workqueue.cc: Likewise.
11483         * workqueue.h: Likewise.
11484         * x86_64.cc: Likewise.
11485
11486 2009-12-10  Doug Kwan  <dougkwan@google.com>
11487
11488         * arm.cc (attributes.h): New include.
11489         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
11490         (Arm_relobj::~Arm_relobj): Delete object pointed by
11491         attributes_section_data_.
11492         (Arm_relobj::attributes_section_data): New method definition.
11493         (Arm_relobj::attributes_section_data_): New data member declaration.
11494         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
11495         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
11496         attributes_section_data_.
11497         (Arm_dynobj::attributes_section_data): New method definition.
11498         (Arm_dynobj::attributes_section_data_): New data member declaration.
11499         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
11500         initialization value of may_use_blx_ to false.
11501         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
11502         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
11503         object attributes to compute results instead of hard-coding.
11504         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
11505         Target_arm::get_secondary_compatible_arch,
11506         Target_arm::set_secondary_compatible_arch
11507         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11508         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
11509         New method declarations.
11510         (Target_arm::get_aeabi_object_attribute): New method definition.
11511         (Target_arm::attributes_section_data_): New data member declaration.
11512         (read_arm_attributes_section): New template definition.
11513         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
11514         (Arm_dynobj::do_read_symbols): Ditto.
11515         (Target_arm::do_finalize_sections): Merge attributes sections from
11516         input.  Check for BLX use after attributes section merging.
11517         Fix __exidx_start and __exidx_end visibility.  Create an
11518         .ARM.attributes section if necessary.
11519         (Target_arm::get_secondary_compatible_arch,
11520         Target_arm::set_secondary_compatible_arch,
11521         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11522         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
11523         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
11524         New method definitions.
11525
11526 2009-12-09  Ian Lance Taylor  <iant@google.com>
11527
11528         * plugin.cc (Plugin::load): Don't cast from void* to a function
11529         pointer.
11530
11531 2009-12-09  Ian Lance Taylor  <iant@google.com>
11532
11533         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
11534         information fields.
11535
11536 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
11537
11538         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
11539         Replace two_file_shared_1.so with two_file_shared_2.so.
11540         * testsuite/Makefile.in: Regenerated.
11541
11542 2009-12-08  Doug Kwan  <dougkwan@google.com>
11543
11544         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
11545         (HFILES): Add attributes.h and int_encoding.h.
11546         * Makefile.in: Regenerate.
11547         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
11548         function definitions to int_encoding.cc
11549         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
11550         prototypes to int_encoding.h
11551         * reduced_debug_output.cc (int_encoding.h): New include.
11552         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
11553         function definitions to int_encoding.cc
11554         (insert_into_vector, read_from_pointer): Move template definitions to
11555         int_encoding.h
11556         * attributes.cc: New file.
11557         * attributes.h: New file.
11558         * int_encoding.cc: New file.
11559         * int_encoding.h: New file.
11560
11561 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
11562
11563         PR gold/11055
11564         * incremental-dump.cc (dump_incremental_inputs): New.
11565         (main): Use dump_incremental_inputs.
11566
11567 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
11568
11569         PR gold/10893
11570         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
11571         checking elfcpp::STT_FUNC.
11572         (Target_i386::Relocate::relocate): Likewise.
11573         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
11574
11575         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
11576         symbols from shared libraries into normal FUNC symbols.
11577
11578         * symtab.h (Symbol): Add is_func and use it.
11579
11580 2009-12-05  Doug Kwan  <dougkwan@google.com>
11581
11582         * arm.cc (Target_arm::arm_info): Initialize new fields
11583         attributes_section and attributes_vendor.
11584         * i386.cc (Target_i386::i386_info): Same.
11585         * object.cc (Sized_relobj::do_layout): Skip attribute section.
11586         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
11587         fields attributes_section and attributes_vendor.
11588         * sparc.cc (Target_sparc::sparc_info): Same.
11589         * target.h (Target::attributes_section, Target::attributes_vendor,
11590         Target::is_attributes_section, Target::attribute_arg_type,
11591         Target::attributes_order): New method definitions.
11592         (Target::Target_info::attributes_section,
11593         Target::Target_info::attributes_vendor): New fields.
11594         (Target::do_attribute_arg_type, Target::do_attributes_order): New
11595         virtual method definitions.
11596         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
11597         attributes_section and attributes_vendor.
11598         * testsuite/testfile.cc (Target_test::test_target_info): Same.
11599
11600 2009-12-05  Doug Kwan  <dougkwan@google.com>
11601
11602         * arm.cc: Update comments about interworking and stub generation.
11603         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
11604         considered as non-PIC.
11605         (Arm_relocate_functions::base_abs): Fix formatting.
11606         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
11607         of function to use GOT entry address instead of offset.
11608         (Target_arm::Scan::global): Issue an error if a symbol would need a
11609         PLT does not get one because it is untyped.  Remove code to create
11610         dynamic symbols for relative branches.
11611         (Target_arm::Relocate::relocate: Use 0 instead of false since function
11612         takes unsigned integer instead of boolean.
11613
11614 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
11615
11616         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
11617         (two_file_test_LDADD): Likewise.
11618         (common_test_1_LDADD): Likewise.
11619         (exception_test_LDADD) Likewise.
11620         (weak_test_LDADD): Likewise.
11621         (many_sections_test_LDADD): Likewise.
11622         (initpri1_LDADD): Likewise.
11623         (script_test_1_LDADD): Likewise.
11624         (script_test_2_LDADD): Likewise.
11625         (justsyms_LDADD): Likewise.
11626         (binary_test_LDADD): Likewise.
11627         (large_LDADD): Likewise.
11628         * testsuite/Makefile.in: Regenerated.
11629
11630 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
11631
11632         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
11633         (Symbol_table::override_with_special): Likewise.
11634         (Symbol_table::add_from_object): Likewise.
11635
11636 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
11637
11638         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11639         Don't set the data_offset twice.
11640
11641 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
11642
11643         * testsuite/Makefile.in: Regenerate.
11644
11645 2009-12-03  Doug Kwan  <dougkwan@google.com>
11646
11647         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
11648         (Target_arm::do_finalize_sections): Add parameter for symbol table
11649         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
11650         * i386.cc (Target_i386::do_finalize_sections): Add an additional
11651         parameter for symbol table pointer.
11652         * layout.cc (Layout::finalize): Call Target::finalize_sections with
11653         an additional parameter for a pointer to symbol table.
11654         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
11655         parameter for a symbol table pointer.
11656         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
11657         * target.h (Target::finalize_sections, Target::do_finalize_sections):
11658         Ditto.
11659         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
11660         parameter for a symbol table pointer.
11661
11662 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
11663
11664         * incremental.cc (Incremental_inputs_header)
11665         (Incremental_inputs_header_write, Incremental_inputs_entry)
11666         (Incremental_inputs_entry_write): Move ...
11667         * incremental.h (Incremental_inputs_header)
11668         (Incremental_inputs_header_write, Incremental_inputs_entry)
11669         (Incremental_inputs_entry_write): here.
11670
11671 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11672
11673         * incremental.cc (make_sized_incremental_binary): Set the target.
11674         Error if it is incompatible.
11675         * output.h (Output_file): Add filename method.
11676
11677 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11678
11679         * incremental.cc (Incremental_inputs_entry): Remove unused argument
11680         from the get_* methods.
11681
11682 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11683
11684         * incremental-dump.cc (main): Check that the offeset of a script is 0.
11685         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11686         Write 0 for the data_offset of scripts.
11687
11688 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11689
11690         * testsuite/Makefile.am: Add the incremental_test.sh test.
11691         * testsuite/incremental_test.sh: New.
11692         * testsuite/incremental_test_1.c: New.
11693         * testsuite/incremental_test_2.c: New.
11694
11695 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
11696
11697         * incremental-dump.cc (main): Fix typos.
11698
11699 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
11700
11701         PR gold/11025
11702         * incremental-dump.cc (main): Use llu to print 64 bit values.
11703
11704 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
11705             H.J. Lu  <hongjiu.lu@intel.com>
11706
11707         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
11708         $(LIBDL).
11709         (incremental_dump_LDADD): Likewise.
11710         * Makefile.in: Regenerated.
11711
11712 2009-11-25  Doug Kwan  <dougkwan@google.com>
11713
11714         Revert:
11715
11716         2009-11-25  Doug Kwan  <dougkwan@google.com>
11717
11718                 * arm.cc (Target_arm::Target_arm): Move method definition
11719                 outside of class definition.  Add code to handle
11720                 --target1-rel, --target1-abs and --target2= options.
11721                 (Target_arm::get_reloc_reloc_type): Change method to be
11722                 non-static and const.
11723                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
11724                 New data member declaration.
11725                 (Target_arm::Scan::local, Target_arm::Scan::global,
11726                 Target_arm::Relocate::relocate,
11727                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11728                 Adjust call to Target_arm::get_real_reloc_type.
11729                 (Target_arm::get_real_reloc_type): Use command line options
11730                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11731                 * options.h (--target1-rel, --target1-abs, --target2): New
11732                 ARM-only options.
11733
11734 2009-11-25  Doug Kwan  <dougkwan@google.com>
11735
11736         * arm.cc (Target_arm::Target_arm): Move method definition outside of
11737         class definition.  Add code to handle --target1-rel, --target1-abs
11738         and --target2= options.
11739         (Target_arm::get_reloc_reloc_type): Change method to be non-static
11740         and const.
11741         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
11742         member declaration.
11743         (Target_arm::Scan::local, Target_arm::Scan::global,
11744         Target_arm::Relocate::relocate,
11745         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
11746         call to Target_arm::get_real_reloc_type.
11747         (Target_arm::get_real_reloc_type): Use command line options to
11748         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11749         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
11750         options.
11751
11752 2009-11-25  Doug Kwan  <dougkwan@google.com>
11753
11754         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
11755         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
11756         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
11757         formatting.
11758         (Arm_relocate_functions::thm_call): Replace body with a call to
11759         Arm_relocate_functions::thumb_branch_common.
11760         (Arm_relocate_functions::thm_jump24,
11761         Arm_relocate_functions::thm_xpc22): New method definitions.
11762         (Arm_relocate_functions::thumb_branch_common): New method definition.
11763         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
11764         operator.
11765         (Target_arm::Relocate::relocate): Adjust call to thm_call.
11766         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
11767
11768 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11769
11770         * Makefile.am: Build incremental-dump
11771         * Makefile.in: Regenerate.
11772         * incremental-dump.cc: New.
11773         * incremental.cc (Incremental_inputs_header_data,
11774         Incremental_inputs_entry_data): Move to incremental.h
11775         * incremental.h: (Incremental_inputs_header_data,
11776         Incremental_inputs_entry_data): Move from incremental.cc
11777
11778 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11779
11780         * incremental.cc (Incremental_inputs_header,
11781         Incremental_inputs_header_write, Incremental_inputs_entry,
11782         Incremental_inputs_entry_write): Add a typedef with the data type.
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): Update comment about which
11789         type has the filed descriptions.
11790
11791 2009-11-15  Doug Kwan  <dougkwan@google.com>
11792
11793         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11794         (Arm_relocate_functions::arm_branch_common): Change method defintion
11795         in class definition to a method declaration and update list of formal
11796         parameters.
11797         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11798         Arm_relocation_functions::jump24): Adjust call to
11799         Arm_relocate_functions::arm_branch_common.  Update list of formal
11800         parameters.
11801         (Arm_relocate_functions::xpc25): New method definition.
11802         (Arm_relocate_functions::arm_branch_common): Move method defintion
11803         out from class definition.  Use stubs for mode-switching and extending
11804         branch ranges.
11805         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11806         specially.  Change code to enable use of stubs in ARM branches.
11807
11808 2009-11-10  Doug Kwan  <dougkwan@google.com>
11809
11810         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11811         in method declaration.
11812         (Target_arm::relocate_stub): New method declaration.
11813         (Target_arm::default_target): Change to return a pointer instead of
11814         a const reference.
11815         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11816         Target_arm::default_target.
11817         (Arm_Relobj::do_relocate_sections): Remove options paramater in
11818         method definition.
11819         (Target_arm::relocate_section): Adjust view.
11820         (Target_arm::relocate_stub): New method definition.
11821
11822 2009-11-10  Doug Kwan  <dougkwan@google.com>
11823
11824         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11825         a format warning.
11826         * incremental.cc (open_incremental_binary): Initialized local
11827         variables to avoid warnings.
11828         * object.cc (make_elf_object): Ditto.
11829         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11830         a format warning.
11831
11832 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
11833
11834         PR gold/10930
11835         * testsuite/plugin_test.c: Include "config.h".
11836
11837 2009-11-09  Doug Kwan  <dougkwan@google.com>
11838
11839         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
11840         (arm_symbol_value): Remove.
11841         (Arm_relocate_functions::arm_branch_common,
11842         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
11843         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
11844         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
11845         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
11846         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
11847         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
11848         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
11849         Arm_relocate_functions::thm_mobw_abs_nc,
11850         Arm_relocate_functions::thm_mov_abs,
11851         Arm_relocate_functions::movw_prel_nc,
11852         Arm_relocate_functions::thm_movt_abs,
11853         Arm_relocate_functions::movt_prel,
11854         Arm_relocate_functions::thm_movw_prel_nc,
11855         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
11856         (Target_arm::Relocate::relocate): Only decompose address into two
11857         parts if relocation type uses the thumb-bit and pass the actual
11858         bit instead of a flag indicating that the thumb-bit is used.  Adjust
11859         calls to methods in Arm_relocate_functions for this change.
11860
11861 2009-11-08  Ian Lance Taylor  <iant@google.com>
11862
11863         PR 10925
11864         * reloc.cc: Instantiate
11865         Sized_relobj::initialize_input_to_output_maps and
11866         Sized_relobj:free_input_to_output_maps.
11867
11868 2009-11-06  Ian Lance Taylor  <iant@google.com>
11869
11870         PR 10876
11871         * defstd.cc (in_segment): Set only_if_ref true for "end".
11872
11873 2009-11-06  Doug Kwan  <dougkwan@google.com>
11874
11875         * arm.cc (class Reloc_stub): Correct a comment.
11876         (Target_arm::Target_arm): Initialize arm_input_section_map_.
11877         (Target_arm::scan_section_for_stubs): New method declaration.
11878         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
11879         Change methods from private to protected.
11880         (Target_arm::do_may_relax): New method definition.
11881         (Target_arm::do_relax, Target_arm::group_sections,
11882         Target_arm::scan_reloc_for_stub,
11883         Target_arm::scan_reloc_section_for_stubs): New method declarations.
11884         (Target_arm::arm_input_section_map_): New data member declaration.
11885         (Target_arm::scan_reloc_for_stub,
11886         Target_arm::scan_reloc_section_for_stubs,
11887         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
11888         Target_arm::do_relax): New method definitions.
11889
11890 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
11891
11892         * configure.ac: Check for (struct stat)::st_mtim
11893         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
11894         * config.in: Regenerate.
11895         * configure: Regenerate.
11896
11897 2009-11-05  Ian Lance Taylor  <iant@google.com>
11898
11899         PR 10910
11900         * output.cc (Output_segment::add_output_section): Add missing
11901         return statement.
11902
11903 2009-11-04  Ian Lance Taylor  <iant@google.com>
11904
11905         PR 10880
11906         * object.h (class Object): Add is_needed and set_is_needed
11907         methods.  Add is_needed_ field.  Make bool fields into bitfields.
11908         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
11909         defined in a dynamic object and referenced by a regular object,
11910         set is_needed for the dynamic object.
11911         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11912         if the file is marked with as_needed and it is not needed.
11913
11914 2009-11-04  Ian Lance Taylor  <iant@google.com>
11915
11916         PR 10887
11917         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11918         tags if data is discarded by linker script.
11919         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11920         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11921         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11922         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11923
11924 2009-11-04  Ian Lance Taylor  <iant@google.com>
11925
11926         * layout.cc (Layout::get_output_section): Add is_interp and
11927         is_dynamic_linker_section parameters.  Change all callers.
11928         (Layout::choose_output_section): Likewise.
11929         (Layout::make_output_section): Likewise.
11930         (Layout::add_output_section_data): Add is_dynamic_linker_section
11931         parameter.  Change all callers.
11932         * layout.h (class Layout): Update declarations.
11933         * output.h (class Output_section): Add is_interp, set_is_interp,
11934         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11935         Add is_interp_, is_dynamic_linker_section_ fields.  Change
11936         generate_code_fills_at_write_ to a bitfield.
11937         * output.cc (Output_section::Output_sections): Initialize new
11938         fields.
11939         (Output_segment::add_output_section): Add do_sort parameter.
11940         Change all callers.
11941
11942 2009-11-03  Ian Lance Taylor  <iant@google.com>
11943
11944         PR 10860
11945         * options.h (class General_options): Add --warn-common.
11946         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
11947         merging two common symbols.
11948         (Symbol_table::should_override): Handle --warn-common when merging
11949         a common symbol with a defined symbol.  Use report_resolve_problem
11950         for multiple definitions.
11951         (Symbol_table::report_resolve_problem): New function.
11952         * symtab.h (class Symbol_table): Declare report_resolve_problem.
11953
11954 2009-11-03  Doug Kwan  <dougkwan@google.com>
11955
11956         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
11957         stub_factory_.
11958         (Target_arm::stub_factory): New method definition.
11959         (Target_arm::new_arm_input_section,
11960         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
11961         Target_arm::reloc_uses_thumb_bit): New method declarations.
11962         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
11963         New type definitions.
11964         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
11965         member declarations.
11966         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
11967         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
11968         New method definitions.
11969
11970 2009-11-03  Ian Lance Taylor  <iant@google.com>
11971
11972         * options.h (class General_options): Add --warn_constructors.
11973
11974 2009-11-03  Ian Lance Taylor  <iant@google.com>
11975
11976         PR 10893
11977         * defstd.cc (in_section): Add entries for __rel_iplt_start,
11978         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11979
11980 2009-11-03  Ian Lance Taylor  <iant@google.com>
11981
11982         PR 10895
11983         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11984         --msgid-bugs-address.
11985         (install-pdf): New target.
11986         (install-data_yes): Look up one directory to find mkinstalldirs.
11987
11988 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
11989
11990         * po/Make-in (.po.gmo): Don't generate .gmo files in source
11991         tree.
11992
11993 2009-10-30  Doug Kwan  <dougkwan@google.com>
11994
11995         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11996
11997 2009-10-30  Doug Kwan  <dougkwan@google.com>
11998
11999         * arm.cc (Stub_addend_reader): New struct template definition
12000         and partial specializations.
12001         (Stub_addend_reader::operator()): New method definition for a
12002         partially specialized template.
12003
12004 2009-10-30  Doug Kwan  <dougkwan@google.com>
12005
12006         * arm.cc (Arm_relobj::processor_specific_flags): New method
12007         definition.
12008         (Arm_relobj::do_read_symbols): New method declaration.
12009         (Arm_relobj::processor_specific_flags_): New data member declaration.
12010         (Arm_dynobj): New class definition.
12011         (Target_arm::do_finalize_sections): Add input_objects parameter.
12012         (Target_arm::do_adjust_elf_header): New method declaration.
12013         (Target_arm::are_eabi_versions_compatible,
12014         (Target_arm::merge_processor_specific_flags): New method declaration.
12015         (Target_arm::do_make_elf_object): New overloaded method definitions
12016         and declaration.
12017         (Arm_relobj::do_read_symbols): New method definition.
12018         (Arm_dynobj::do_read_symbols): Ditto.
12019         (Target_arm::do_finalize_sections): Add input_objects parameters.
12020         Merge processor-specific flags from all input objects.
12021         (Target_arm::are_eabi_versions_compatible,
12022         Target_arm::merge_processor_specific_flags,
12023         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
12024         New method definitions.
12025         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
12026         Input_objects pointer type parameter.
12027         * layout.cc (Layout::finalize): Pass input objects to target's.
12028         finalize_sections function.
12029         * output.cc (Output_file_header::do_sized_write): Set ELF file
12030         header's processor-specific flags.
12031         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
12032         Input_objects pointer type parameter.
12033         * sparc.cc (Target_sparc::do_finalize_sections): Same.
12034         * target.h (Input_objects): New forward class declaration.
12035         (Target::processor_specific_flags,
12036         Target::are_processor_specific_flags_sect): New method definitions.
12037         (Target::finalize_sections): Add input_objects parameter.
12038         (Target::Target): Initialize processor_specific_flags_ and
12039         are_processor_specific_flags_set_.
12040         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
12041         parameter.
12042         (Target::set_processor_specific_flags): New method definition.
12043         (Target::processor_specific_flags_,
12044         Target::are_processor_specific_flags_set_): New data member
12045         declarations.
12046         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
12047         Input_objects pointer type parameter.
12048
12049 2009-10-30  Doug Kwan  <dougkwan@google.com>
12050
12051         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
12052
12053 2009-10-28  Ian Lance Taylor  <iant@google.com>
12054
12055         * object.h (class Relobj): Drop options parameter from
12056         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
12057         do_scan_relocs, do_relocate.  Change all callers.
12058         (class Sized_relobj): Drop options parameters from
12059         do_gc_process_relocs, do_scan_relocs, do_relocate,
12060         do_relocate_sections, relocate_sections, emit_relocs_scan,
12061         emit_relocs_scan_reltype.  Change all callers.
12062         (struct Relocate_info): Remove options field and all references to
12063         it.
12064         * reloc.h (class Read_relocs): Remove options constructor
12065         parameter and options_ field.  Change all callers.
12066         (class Gc_process_relocs, class Scan_relocs): Likewise.
12067         (class Relocate_task): Likewise.
12068         * target-reloc.h (scan_relocs): Remove options parameter.  Change
12069         all callers.
12070         (scan_relocatable_relocs): Likewise.
12071         * target.h (class Sized_target): Remove options parameter from
12072         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
12073         all callers.
12074         * gc.h (gc_process_relocs): Remove options parameter.  Change all
12075         callers.
12076         * arm.cc: Update functions to remove options parameters.
12077         * i386.cc: Likewise.
12078         * powerpc.cc: Likewise.
12079         * sparc.cc: Likewise.
12080         * x86_64.cc: Likewise.
12081         * testsuite/testfile.cc: Likewise.
12082
12083 2009-10-28  Doug Kwan  <dougkwan@google.com>
12084
12085         * arm.cc (Arm_relobj): New class definition.
12086         (Arm_relobj::scan_sections_for_stubs,
12087         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
12088         New method definitions.
12089
12090 2009-10-28  Cary Coutant  <ccoutant@google.com>
12091
12092         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
12093         (Plugin::cleanup_done_): New member.
12094         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
12095         (Plugin_manager::cleanup_done_): Remove.
12096         (Plugin_manager::add_input_file): Edit error message.
12097         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
12098         (Plugin_manager::cleanup): Remove use of cleanup_done_.
12099
12100 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
12101
12102         * fileread.cc: (File_read::View::~View): Use the new
12103         data_ownership_ filed.
12104         (File_read::~File_read): Dispose the new whole_file_view_.
12105         (File_read::open): Mmap the whole file if needed.
12106         (File_read::open): Use whole_file_view_ instead of contents_.
12107         (File_read::find_view): Use whole_file_view_ if applicable.
12108         (File_read::do_read): Use whole_file_view_ instead of contents_.
12109         (File_read::make_view): Use whole_file_view_ instead of contents_,
12110         update File_read::View::View call.
12111         (File_read::find_or_make_view): Update File_read::View::View
12112         call.
12113         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
12114         remove contents_
12115         (File_read::View::Data_ownership): New enum.
12116         (File_read::View::View): Replace bool mapped_ with Data_ownership
12117         argument.
12118         (File_read::View::mapped_): Remove (replaced by data_ownership_).
12119         (File_read::View::data_ownership_): New field.
12120         (File_read::contents_): Remove (replaced by whole_file_view_).
12121         (File_read::whole_file_view_): New field.
12122         * options.h (class General_options): Add --keep-files-mapped.
12123
12124 2009-10-27  Cary Coutant  <ccoutant@google.com>
12125
12126         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
12127         * testsuite/Makefile.am (plugin_test_5): New test case.
12128         * testsuite/Makefile.in: Regenerate.
12129
12130 2009-10-25  Doug Kwan  <dougkwan@google.com>
12131
12132         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
12133         from private to protected to allow access by child class.
12134         (Sized_relobj::do_relocate_sections): New method declaration.
12135         (Sized_relobj::relocate_sections): Virtualize.
12136         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
12137         Sized_relobj::relocate_sections.  Instantiate template explicitly
12138         for different target sizes and endianity.
12139
12140 2009-10-24  Doug Kwan  <dougkwan@google.com>
12141
12142         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
12143         (Arm_input_section::as_arm_input_section): New method.
12144         (Arm_output_section): New class definition.
12145         (Arm_output_section::create_stub_group,
12146         Arm_output_section::group_sections): New method definitions.
12147
12148 2009-10-22  Doug Kwan  <dougkwan@google.com>
12149
12150         * arm.cc (Arm_input_section): New class definition.
12151         (Arm_input_section::init, Arm_input_section:do_write,
12152         Arm_input_section::set_final_data_size,
12153         Arm_input_section::do_reset_address_and_file_offset): New method
12154         definitions.
12155
12156 2009-10-21  Doug Kwan  <dougkwan@google.com>
12157
12158         * arm.cc (Stub_table, Arm_input_section): New forward class
12159         declarations.
12160         (Stub_table): New class defintion.
12161         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
12162         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
12163         New method definition.
12164
12165 2009-10-21  Doug Kwan  <dougkwan@google.com>
12166
12167         * arm.cc: Update copyright comments.
12168         (Target_arm): New forward class template declaration.
12169         (Arm_address): New type.
12170         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
12171         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
12172         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
12173         constants.
12174         (Insn_template): Same.
12175         (DEF_STUBS): New macro.
12176         (Stub_type): New enum type.
12177         (Stub_template): New class definition.
12178         (Stub): Same.
12179         (Reloc_stub): Same.
12180         (Stub_factory): Same.
12181         (Target_arm::Target_arm): Initialize may_use_blx_ and
12182         should_force_pic_veneer_.
12183         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
12184         Target_arm::should_force_pic_veneer,
12185         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
12186         Target_arm::using_thumb_only, Target_arm:;default_target): New
12187         method defintions.
12188         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
12189         New data member declarations.
12190         (Insn_template::size, Insn_template::alignment): New method defintions.
12191         (Stub_template::Stub_template): New method definition.
12192         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
12193         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
12194         (Stub_factory::Stub_factory): New method definition.
12195         * gold.h (string_hash): New template.
12196         * output.h (Input_section_specifier::hash_value): Use
12197         gold::string_hash.
12198         (Input_section_specifier::string_hash): Remove.
12199         * stringpool.cc (Stringpool_template::string_hash): Use
12200         gold::string_hash.
12201
12202 2009-10-20  Doug Kwan  <dougkwan@google.com>
12203
12204         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
12205         symbols of relaxed input sections.
12206         * output.h (Output_section::find_relaxed_input_section): Make
12207         method public.
12208
12209 2009-10-16  Doug Kwan  <dougkwan@google.com>
12210
12211         * dynobj.cc (Versions::Versions): Initialize version_script_.
12212         Only insert base version symbol definition for a shared object
12213         if version script defines any version versions.
12214         (Versions::define_base_version): New method definition.
12215         (Versions::add_def): Check that base version is not needed.
12216         (Versions::add_need): Define base version lazily.
12217         * dynobj.h (Versions::define_base_version): New method declaration.
12218         (Versions::needs_base_version_): New data member declaration.
12219         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
12220         (check_DATA): Add no_version_test.stdout.
12221         (libno_version_test.so, no_version_test.o no_version_test.stdout):
12222         New make rules.
12223         * testsuite/Makefile.in: Regenerate.
12224         * testsuite/no_version_test.c: New file.
12225         * testsuite/no_version_test.sh: Ditto.
12226
12227 2009-10-16  Doug Kwan  <dougkwan@google.com>
12228
12229         * expression.cc (class Segment_start_expression): New class definition.
12230         (Segment_start_expression::value): New method definition.
12231         (script_exp_function_segment_start): Return a new
12232         Segment_start_expression.
12233         * gold/script-c.h (script_saw_segment_start_expression): New function
12234         prototype.
12235         * script-sections.cc (Script_sections::Script_sections): Initialize
12236         SAW_SEGMENT_START_EXPRESSION_ to false.
12237         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
12238         and -Tbbs options to specify section addresses if given in
12239         command line and no SEGMENT_START expression is seen in a script.
12240         * script-sections.h (Script_sections::saw_segment_start_expression,
12241         Script_sections::set_saw_segment_start_expression): New method
12242         definition.
12243         (Script_sections::saw_segment_start_expression_): New data member
12244         declaration.
12245         * script.cc (script_saw_segment_start_expression): New function.
12246         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
12247         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
12248         script_test_7.sh and script_test_8.sh.
12249         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
12250         script_test_8.stdout.
12251         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
12252         (script_test_6, script_test_6.stdout, script_test_7,
12253         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
12254         * Makefile.in: Regenerate.
12255         * testsuite/script_test_6.sh: New file.
12256         * testsuite/script_test_6.t: Same.
12257         * testsuite/script_test_7.sh: Same.
12258         * testsuite/script_test_7.t: Same.
12259         * testsuite/script_test_8.sh: Same.
12260
12261 2009-10-16  Doug Kwan  <dougkwan@google.com>
12262
12263         * output.cc (Output_segment::set_section_list_address): Cast
12264         expressions to unsigned long long type to avoid format warnings.
12265
12266 2009-10-15  Ian Lance Taylor  <iant@google.com>
12267
12268         * script.cc (Script_options::add_symbol_assignment): Always add a
12269         dot assignment to script_sections_.
12270         * script-sections.cc (Script_sections::add_dot_assignment):
12271         Initialize if necessary.
12272
12273         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
12274         program headers with no load segment if there is a linker script.
12275
12276         * layout.cc (Layout::set_segment_offsets): Align the file offset
12277         to the segment aligment for -N or -n with no load segment.
12278         * output.cc (Output_segment::add_output_section): Don't crash if
12279         the first section is a TLS section.
12280         (Output_segment::set_section_list_addresses): Print an error
12281         message if the address moves backward in a linker script.
12282         * script-sections.cc
12283         (Output_section_element_input::set_section_addresses): Don't
12284         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
12285         (Orphan_output_section::set_section_addresses): Likewise.
12286
12287 2009-10-15  Doug Kwan  <dougkwan@google.com>
12288
12289         * layout.cc (Layout::finish_dynamic_section): Generate tags
12290         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
12291         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
12292         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
12293
12294 2009-10-14  Ian Lance Taylor  <iant@google.com>
12295
12296         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
12297         fields.
12298         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
12299         data_shdr fields of relinfo.
12300         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
12301         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
12302         R_386_TLS_LDO_32, adjust based on section flags.
12303         (Target_i386::Relocate::fix_up_ldo): Remove.
12304
12305 2009-10-13  Ian Lance Taylor  <iant@google.com>
12306
12307         Add support for -pie.
12308         * options.h (class General_options): Add -pie and
12309         --pic-executable.
12310         (General_options::output_is_position_independent): Test -pie.
12311         (General_options::output_is_executable): Return true if not shared
12312         and not relocatable.
12313         (General_options::output_is_pie): Remove.
12314         * options.cc (General_options::finalize): Reject incompatible uses
12315         of -pie.
12316         * gold.cc (queue_middle_tasks): A -pie link is not static.
12317         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
12318         * symtab.cc (Symbol::final_value_is_known): Return false if
12319         output_is_position_independent.
12320         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
12321         output_is_position_independent.
12322         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
12323         output_is_position_independent.
12324         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
12325         output_is_position_independent.
12326         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
12327         two_file_pie_test.
12328         (basic_pie_test.o, basic_pie_test): New targets.
12329         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
12330         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
12331         (two_file_pie_test): New target.
12332         * testsuite/Makefile.in: Rebuild.
12333         * README: Remove note saying that -pie is not supported.
12334
12335 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
12336
12337         * options.h (class General_options): Add -init and -fini.
12338         * layout.cc (Layout::finish_dynamic_section): Emit
12339         given init and fini functions.
12340
12341 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
12342
12343         * gc.h (gc_process_relocs): Check if icf is enabled using new
12344         function.
12345         * gold.cc (queue_initial_tasks): Likewise.
12346         (queue_middle_tasks): Likewise.
12347         * object.cc (do_layout): Likewise.
12348         * symtab.cc (is_section_folded): Likewise.
12349         * main.cc (main): Likewise.
12350         * reloc.cc (Read_relocs::run): Likewise.
12351         (Sized_relobj::do_scan_relocs): Likewise.
12352         * icf.cc (is_function_ctor_or_dtor): New function.
12353         (Icf::find_identical_sections): Check if function is ctor or dtor when
12354         safe icf is chosen.
12355         * options.h (General_options::icf): Change option to be an enum.
12356         (Icf_status): New enum.
12357         (icf_enabled): New method.
12358         (icf_safe_folding): New method.
12359         (set_icf_status): New method.
12360         (icf_status_): New variable.
12361         * (options.cc) (General_options::finalize): Set icf_status_.
12362         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
12363         icf_test and icf_keep_unique_test to use the --icf enum flag.
12364         * testsuite/icf_safe_test.sh: New file.
12365         * testsuite/icf_safe_test.cc: New file.
12366
12367 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
12368
12369         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
12370         includes to gc.h and icf.h.
12371         * arm.cc: Include gc.h.
12372         * gold.cc: Likewise.
12373         * i386.cc: Likewise.
12374         * powerpc.cc: Likewise.
12375         * sparc.cc: Likewise.
12376         * x86_64.cc: Likewise.
12377         * gc.h: Include icf.h.
12378
12379 2009-10-11  Ian Lance Taylor  <iant@google.com>
12380
12381         * plugin.cc: Include "gold.h" before other header files.
12382
12383 2009-10-10  Chris Demetriou  <cgd@google.com>
12384
12385         * options.h (Input_file_argument::Input_file_type): New enum.
12386         (Input_file_argument::is_lib_): Replace with...
12387         (Input_file_argument::type_): New member.
12388         (Input_file_argument::Input_file_argument): Take Input_file_type
12389         'type' rather than boolean 'is_lib' as second argument.
12390         (Input_file_argument::is_lib): Use type_.
12391         (Input_file_argument::is_searched_file): New function.
12392         (Input_file_argument::may_need_search): Handle is_searched_file.
12393         * options.cc (General_options::parse_library): Support -l:filename.
12394         (General_options::parse_just_symbols): Update for Input_file_argument
12395         changes.
12396         (Command_line::process): Likewise.
12397         * archive.cc (Archive::get_file_and_offset): Likewise.
12398         * plugin.cc (Plugin_manager::release_input_file): Likewise.
12399         * script.cc (read_script_file, script_add_file): Likewise.
12400         * fileread.cc (Input_file::Input_file): Likewise.
12401         (Input_file::will_search_for): Handle is_searched_file.
12402         (Input_file::open): Likewise.
12403         * readsyms.cc (Read_symbols::get_name): Likewise.
12404         * testsuite/Makefile.am (searched_file_test): New test.
12405         * testsuite/Makefile.in: Regenerate.
12406         * testsuite/searched_file_test.cc: New file.
12407         * testsuite/searched_file_test_lib.cc: New file.
12408
12409 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12410             Ian Lance Taylor  <iant@google.com>
12411
12412         * descriptor.cc: Include <cstdio> and "binary-io.h".
12413         (Descriptors::open): Open the files in binary mode always.
12414         * script.cc (Lex::get_token): Treat \r as whitespace.
12415
12416 2009-10-09  Ian Lance Taylor  <iant@google.com>
12417
12418         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
12419
12420 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12421             Ian Lance Taylor  <iant@google.com>
12422
12423         * configure.ac: Check for readv function also.
12424         * fileread.cc (readv): Define if not HAVE_READV.
12425         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
12426         does not exist.
12427         * config.in: Regenerate.
12428         * configure: Regenerate.
12429
12430 2009-10-09  Doug Kwan  <dougkwan@google.com>
12431
12432         * layout.cc (Layout::make_output_section): Call target hook to make
12433         ordinary output section.
12434         (Layout::finalize): Adjust parameter list of call the
12435         Target::may_relax().
12436         * layout.h (class Layout::section_list): New method.
12437         * merge.h (Output_merge_base::entsize): Change visibility to public.
12438         (Output_merge_base::is_string, Output_merge_base::do_is_string):
12439         New methods.
12440         (Output_merge_string::do_is_string): New method.
12441         * object.cc (Sized_relobj::do_setup): renamed from
12442         Sized_relobj::set_up.
12443         * object.h (Sized_relobj::adjust_shndx,
12444         Sized_relobj::initializ_input_to_output_maps,
12445         Sized_relobj::free_input_to_output_maps): Change visibilities to
12446         protected.
12447         (Sized_relobj::setup): Virtualize.
12448         (Sized_relobj::do_setup): New method declaration.
12449         (Sized_relobj::invalidate_section_offset,
12450         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
12451         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
12452         * options.cc (parse_int): New function.
12453         * options.h (parse_int): New declaration.
12454         (DEFINE_int): New macro.
12455         (stub_group_size): New option.
12456         * output.cc (Output_section::Output_section): Initialize memebers
12457         merge_section_map_, merge_section_by_properties_map_,
12458         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
12459         (Output_section::add_input_section): Handled deferred code-fill
12460         generation and remove an old comment.
12461         (Output_section::add_relaxed_input_section): New method definition.
12462         (Output_section::add_merge_input_section): Use merge section by
12463         properties map to speed to search.  Update merge section maps
12464         as appropriate.
12465         (Output_section::build_relaxation_map): New method definition.
12466         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
12467         Same.
12468         (Output_section::relax_input_section): Renamed to
12469         Output_section::convert_input_sections_to_relaxed_sections and change
12470         interface to take a vector of pointers to relaxed sections.
12471         (Output_section::find_merge_section,
12472         Output_section::find_relaxed_input_section): New method definitions.
12473         (Output_section::is_input_address_mapped,
12474         Output_section::output_offset, Output_section::output_address):
12475         Use output section data maps to speed up searching.
12476         (Output_section::find_starting_output_address): Add comments.
12477         (Output_section::do_write,
12478         Output_section::write_to_postprocessing_buffer): Do code-fill
12479         generation as appropriate.
12480         (Output_section::get_input_sections): Invalidate relaxed input section
12481         map.
12482         (Output_section::restore_states): Adjust type of checkpoint .
12483         Invalidate relaxed input section map.
12484         * output.h (Output_merge_base): New class declaration.
12485         (Input_section_specifier): New class defintion.
12486         (class Output_relaxed_input_section) Change base class to
12487         Output_section_data_build.
12488         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
12489         base class initializer.
12490         (Output_section::add_relaxed_input_section): New method declaration.
12491         (Output_section::Input_section): Change visibility to protected.
12492         (Output_section::Input_section::relobj,
12493         Output_section::Input_section::shndx): Handle relaxed input sections.
12494         Output_section::input_sections) Change visibility to protected.  Also
12495         define overload to return a non-const pointer.
12496         (Output_section::Merge_section_properties): New class defintion.
12497         (Output_section::Merge_section_by_properties_map,
12498         Output_section::Output_section_data_by_input_section_map,
12499         Output_section::Relaxation_map): New types.
12500         (Output_section::relax_input_section): Rename method to
12501         Output_section::convert_input_sections_to_relaxed_sections and change
12502         interface to take a vector of relaxed section pointers.
12503         (Output_section::find_merge_section,
12504         Output_section::find_relaxed_input_section,
12505         Output_section::build_relaxation_map,
12506         Output_section::convert_input_sections_in_list_to_relaxed_sections):
12507         New method declarations.
12508         (Output_section::merge_section_map_
12509         Output_section::merge_section_by_properties_map_,
12510         Output_section::relaxed_input_section_map_,
12511         Output_section::is_relaxed_input_section_map_valid_,
12512         Output_section::generate_code_fills_at_write_): New data members.
12513         * script-sections.cc
12514         (Output_section_element_input::set_section_addresses): Call
12515         current_data_size and addralign methods of relaxed input sections.
12516         (Orphan_output_section::set_section_addresses): Call current_data_size
12517         and addralign methods of relaxed input sections.
12518         * symtab.cc (Symbol_table::compute_final_value): Extract template
12519         from the body of Symbol_table::sized_finalize_symbol.
12520         (Symbol_table::sized_finalized_symbol): Call
12521         Symbol_table::compute_final_value.
12522         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
12523         (Symbol_table::compute_final_value): New templated method declaration.
12524         * target.cc (Target::do_make_output_section): New method defintion.
12525         * target.h (Target::make_output_section): New method declaration.
12526         (Target::relax): Add more parameters for input objects, symbol table
12527         and layout.  Adjust call to do_relax.
12528         (Target::do_make_output_section): New method declaration.
12529         (Target::do_relax): Add parameters for input objects, symbol table
12530         and layout.
12531
12532 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12533
12534         * pread.c: Include stdio.h.
12535
12536 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12537
12538         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
12539         defined.
12540
12541 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12542
12543         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
12544         Change read_shndx type to unsigned int.
12545         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12546         int.
12547         (Sized_dwarf_line_info::read_line_mappings): Likewise.
12548         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
12549         Change read_shndx type to unsigned int.
12550         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12551         int.
12552         (Sized_dwarf_line_info::read_line_mappings): Likewise.
12553         * layout.cc (Layout::create_symtab_sections): Cast the result of
12554         local_symcount * symsize to off_t in the gold_assert.
12555
12556 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12557
12558         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
12559         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
12560         R_ARM_BASE_ABS.
12561         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
12562         (Arm_relocate_functions::thm_abs5): New function.
12563         (Arm_relocate_functions::abs12): New function.
12564         (Arm_relocate_functions::abs16): New function.
12565         (Arm_relocate_functions::base_abs): New function.
12566         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
12567         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
12568         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
12569         R_ARM_BASE_ABS.
12570         (Scan::global): Likewise.
12571         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
12572         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
12573         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
12574         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
12575         R_ARM_BASE_ABS.
12576
12577 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12578
12579         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
12580         (Arm_relocate_functions::movt_prel): New function.
12581         (Arm_relocate_functions::thm_movw_prel_nc): New function.
12582         (Arm_relocate_functions::thm_movt_prel): New function.
12583         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
12584         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
12585         (Scan::global, Relocate::relocate): Likewise.
12586         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12587
12588 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
12589
12590         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
12591         Incremental_checker.
12592         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
12593         unsigned int.
12594         (class Incremental_inputs_header): New class.
12595         (Incremental_inputs_header_writer): Edit comment.
12596         (Incremental_inputs_entry): New class.
12597         (Incremental_inputs_entry_writer): Edit comment.
12598         (Sized_incremental_binary::do_find_incremental_inputs_section):
12599         Add *strtab_shndx parameter, fill it.
12600         (Sized_incremental_binary::do_check_inputs): New method.
12601         (Incremental_checker::can_incrementally_link_output_file): Use
12602         Sized_incremental_binary::check_inputs.
12603         (Incremental_inputs::report_command_line): Save command line in
12604         command_line_.
12605         * incremental.h:
12606         (Incremental_binary::find_incremental_inputs_section): New
12607         method.
12608         (Incremental_binary::do_find_incremental_inputs_section): Add
12609         strtab_shndx parameter.
12610         (Incremental_binary::do_check_inputs): New pure virtual method.
12611         (Sized_incremental_binary::do_check_inputs): Declare.
12612         (Incremental_checker::Incremental_checker): Add incremental_inputs
12613         parameter, use it to initialize incremental_inputs_.
12614         (Incremental_checker::incremental_inputs_): New field.
12615         (Incremental_checker::command_line): New method.
12616         (Incremental_checker::inputs): New method.
12617         (Incremental_checker::command_line_): New field.
12618
12619 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
12620
12621         * incremental.cc: Include <cstdarg> and "target-select.h".
12622         (vexplain_no_incremental): New function.
12623         (explain_no_incremental): New function.
12624         (Incremental_binary::error): New method.
12625         (Sized_incremental_binary::do_find_incremental_inputs_section): New
12626         method.
12627         (make_sized_incremental_binary): New function.
12628         (open_incremental_binary): New function.
12629         (can_incrementally_link_file): Add checks if output is ELF and has
12630         inputs section.
12631         * incremental.h: Include "elfcpp_file.h" and "output.h".
12632         (Incremental_binary): New class.
12633         (Sized_incremental_binary): New class.
12634         (open_incremental_binary): Declare.
12635         * object.cc (is_elf_object): Use
12636         elfcpp::Elf_recognizer::is_elf_file.
12637         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
12638         * output.h (Output_file::filesize): New method.
12639
12640 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12641
12642         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
12643         New function.
12644         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
12645         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
12646         function.
12647         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
12648         function.
12649         (Arm_relocate_functions::movw_abs_nc): New function.
12650         (Arm_relocate_functions::movt_abs): New function.
12651         (Arm_relocate_functions::thm_movw_abs_nc): New function.
12652         (Arm_relocate_functions::thm_movt_abs): New function.
12653         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
12654         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
12655         (Scan::global): Likewise.
12656         (Relocate::relocate): Likewise.
12657         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12658
12659 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12660
12661         * arm.cc (Arm_relocate_functions::got_prel) New function.
12662         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
12663         (Relocate::relocate): Likewise.
12664         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12665
12666 2009-10-06  Ian Lance Taylor  <iant@google.com>
12667
12668         * options.h (class General_options): Define
12669         split_stack_adjust_size parameter.
12670         * object.h (class Object): Add uses_split_stack_ and
12671         has_no_split_stack_ fields.  Add uses_split_stack and
12672         has_no_split_stack accessor functions.  Declare
12673         handle_split_stack_section.
12674         (class Reloc_symbol_changes): Define.
12675         (class Sized_relobj): Define Function_offsets.  Declare
12676         split_stack_adjust, split_stack_adjust_reltype, and
12677         find_functions.
12678         * object.cc (Object::handle_split_stack_section): New function.
12679         (Sized_relobj::do_layout): Call handle_split_stack_section.
12680         * dynobj.cc (Sized_dynobj::do_layout): Call
12681         handle_split_stack_section.
12682         * reloc.cc (Sized_relobj::relocate_sections): Call
12683         split_stack_adjust for executable sections in split_stack
12684         objects.  Pass reloc_map to relocate_section.
12685         (Sized_relobj::split_stack_adjust): New function.
12686         (Sized_relobj::split_stack_adjust_reltype): New function.
12687         (Sized_relobj::find_functions): New function.
12688         * target-reloc.h: Include "object.h".
12689         (relocate_section): Add reloc_symbol_changes parameter.  Change
12690         all callers.
12691         * target.h (class Target): Add calls_non_split method.  Declare
12692         do_calls_non_split virtual method.  Declare match_view and
12693         set_view_to_nop.
12694         * target.cc: Include "elfcpp.h".
12695         (Target::do_calls_non_split): New function.
12696         (Target::match_view): New function.
12697         (Target::set_view_to_nop): New function.
12698         * gold.cc (queue_middle_tasks): Give an error if mixing
12699         split-stack and non-split-stack objects with -r.
12700         * i386.cc (Target_i386::relocate_section): Add
12701         reloc_symbol_changes parameter.
12702         (Target_i386::do_calls_non_split): New function.
12703         * x86_64.cc (Target_x86_64::relocate_section): Add
12704         reloc_symbol_changes parameter.
12705         (Target_x86_64::do_calls_non_split): New function.
12706         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
12707         parameter.
12708         * powerpc.cc (Target_powerpc::relocate_section): Add
12709         reloc_symbol_changes parameter.
12710         * sparc.cc (Target_sparc::relocate_section): Add
12711         reloc_symbol_changes parameter.
12712         * configure.ac: Call AM_CONDITIONAL for the default target.
12713         * configure: Rebuild.
12714         * testsuite/Makefile.am (TEST_AS): New variable.
12715         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
12716         (check_DATA): Add split_i386 and split_x86_64 files.
12717         (SPLIT_DEFSYMS): Define.
12718         (split_i386_[1234n].o): New targets.
12719         (split_i386_[124]): New targets.
12720         (split_i386_[1234r].stdout): New targets.
12721         (split_x86_64_[1234n].o): New targets.
12722         (split_x86_64_[124]): New targets.
12723         (split_x86_64_[1234r].stdout): New targets.
12724         (MOSTLYCLEANFILES): Add new executables.
12725         * testsuite/split_i386.sh: New file.
12726         * testsuite/split_x86_64.sh: New file.
12727         * testsuite/split_i386_1.s: New file.
12728         * testsuite/split_i386_2.s: New file.
12729         * testsuite/split_i386_3.s: New file.
12730         * testsuite/split_i386_4.s: New file.
12731         * testsuite/split_i386_n.s: New file.
12732         * testsuite/split_x86_64_1.s: New file.
12733         * testsuite/split_x86_64_2.s: New file.
12734         * testsuite/split_x86_64_3.s: New file.
12735         * testsuite/split_x86_64_4.s: New file.
12736         * testsuite/split_x86_64_n.s: New file.
12737         * testsuite/testfile.cc (Target_test): Update relocation_section
12738         function.
12739         * testsuite/Makefile.in: Rebuild.
12740
12741 2009-10-06  Ian Lance Taylor  <iant@google.com>
12742
12743         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
12744         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
12745         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
12746         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
12747         the address on ldo_addrs_.
12748         (Target_i386::Relocate::fix_up_ldo): New function.
12749
12750 2009-10-06   Rafael Espindola  <espindola@google.com>
12751
12752         * plugin.cc (add_input_library): New.
12753         (Plugin::load): Add add_input_library to tv.
12754         (Plugin_manager::add_input_file): Add the is_lib argument.
12755         (add_input_file): Update call to Plugin_manager::add_input_file.
12756         (add_input_library): New.
12757         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
12758
12759 2009-09-30  Doug Kwan  <dougkwan@google.com>
12760
12761         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
12762         symbol and call Symbol::may_need_copy_reloc to determine if
12763         a copy reloc is needed.
12764         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12765         nocopyreloc is given in command line.
12766         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12767         given in command line.
12768         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12769         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
12770         of the removed Target_i386::may_need_copy_reloc.
12771         * options.h (copyreloc): New option with default value false.
12772         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12773         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12774         instead of the removed Target_powerpc::may_need_copy_reloc.
12775         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12776         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
12777         instead of the removed Target_sparc::may_need_copy_reloc.
12778         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
12779         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
12780         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12781         instead of the removed Target_x86_64::may_need_copy_reloc.
12782
12783 2009-09-30  Ian Lance Taylor  <iant@google.com>
12784
12785         * object.h (class Object): Remove target_ field, and target,
12786         sized_target, and set_target methods.
12787         (Object::sized_target): Remove.
12788         (class Sized_relobj): Update declarations.  Remove sized_target.
12789         * object.cc (Sized_relobj::setup): Remove target parameter.
12790         Change all callers.
12791         (Input_objects::add_object): Don't do anything with the target.
12792         (make_elf_sized_object): Add punconfigured parameter.  Change all
12793         callers.  Set or test parameter target.
12794         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12795         Change all callers.
12796         * parameters.cc (Parameters::set_target): Change parameter type to
12797         be non-const.
12798         (Parameters::default_target): Remove.
12799         (set_parameters_target): Change parameter type to be non-const.
12800         (parameters_force_valid_target): New function.
12801         (parameters_clear_target): New function.
12802         * parameters.h (class Parameters): Update declarations.  Remove
12803         default_target method.  Add sized_target and clear_target
12804         methods.  Change target_ to be non-const.
12805         (set_parameters_target): Update declaration.
12806         (parameters_force_valid_target): Declare.
12807         (parameters_clear_target): Declare.
12808         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12809         as NULL if we aren't searching.
12810         (Add_symbols::run): Don't check for compatible target.
12811         * fileread.cc (Input_file::open_binary): Call
12812         parameters_force_valid_target.
12813         * gold.cc (queue_middle_tasks): Likewise.
12814         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
12815         set_target on object.
12816         * dynobj.h (class Sized_dynobj): Update declarations.
12817         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12818         make_elf_object returns NULL.
12819         (Archive::include_member): Don't check whether object target is
12820         compatible.
12821         * output.cc (Output_section::add_input_section): Get target from
12822         parameters.
12823         (Output_section::relax_input_section): Likewise.
12824         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12825         parameters.
12826         (Sized_relobj::do_scan_relocs): Likewise.
12827         (Sized_relobj::relocate_sections): Likewise.
12828         * resolve.cc (Symbol_table::resolve): Likewise.
12829         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
12830         parameter.  Change all callers.
12831         (Symbol_table::add_from_object): Get target from parameters.
12832         (Symbol_table::add_from_relobj): Don't check object target.
12833         (Symbol_table::add_from_dynobj): Likewise.
12834         (Symbol_table::define_special_symbol): Get target from
12835         parameters.
12836         * symtab.h (class Symbol_table): Update declaration.
12837         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
12838         parameter.  Change all callers.  Clear parameter target.
12839         (Binary_test): Test target here.
12840         * testsuite/object_unittest.cc (gold_testsuite): Remove
12841         target_test_pointer parameter.  Change all callers.
12842         (Object_test): Test target here.
12843
12844 2009-09-26  Ian Lance Taylor  <iant@google.com>
12845
12846         * testsuite/initpri1.c: Don't try to use constructor priorities if
12847         compiling with gcc before 4.3.
12848
12849 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
12850
12851         * testsuite/retain_symbols_file_test.sh (check_present): Change
12852         output file name to retain_symbols_file_test.stdout.
12853         (check_absent): Likewise.
12854
12855 2009-09-18  Craig Silverstein  <csilvers@google.com>
12856
12857         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
12858         * options.cc: Include <cerrno> and <fstream>.
12859         (General_options::finalize): Parse -retain-symbols-file tag.
12860         * options.h: New flag.
12861         (General_options): New method should_retain_symbol, new
12862         variable symbols_to_retain.
12863         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
12864         should_retain_symbol map.
12865         * testsuite/Makefile.am (retain_symbols_file_test): New test.
12866         * testsuite/Makefile.in: Regenerate.
12867         * testsuite/retain_symbols_file_test.sh: New file.
12868
12869 2009-09-18  Nick Clifton  <nickc@redhat.com>
12870
12871         * po/es.po: Updated Spanish translation.
12872
12873 2009-09-17  Doug Kwan  <dougkwan@google.com>
12874
12875         * debug.h (DEBUG_RELAXATION): New constant.
12876         (DEBUG_ALL): Add DEBUG_RELAXATION.
12877         (debug_string_to_enum): Add relaxation debug option.
12878         * layout.cc
12879         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
12880         Layout::Relaxation_debug_check::read_sections,
12881         Layout::Relaxation_debug_check::read_sections): New method definitions.
12882         (Layout::Layout): Initialize data members
12883         record_output_section_data_from_scrips_,
12884         script_output_section_data_list_ and relaxation_debug_check_.
12885         (Layout::save_segments, Layout::restore_segments,
12886         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12887         Layout::relaxation_loop_body): New method definitions.
12888         (Layout::finalize): Support relaxation.  Move section layout code to
12889         Layout::relaxation_loop_body.
12890         (Layout::set_asection_address_from_script): Move code for orphan
12891         section placement out.
12892         (Layout::place_orphan_sections_in_script): New method definition.
12893         * layout.h (Output_segment_headers, Output_file_header):
12894         New forward class declarations.
12895         (Layout::~Layout): Define.
12896         (Layout::new_output_section_data_from_script): New method definition.
12897         (Layout::place_orphan_sections_in_script): New method declaration.
12898         (Layout::Segment_states): New type declaration.
12899         (Layout::save_segments, Layout::restore_segments,
12900         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12901         Layout::relaxation_loop_body): New method declarations.
12902         (Layout::Output_section_data_list): New type declaration.
12903         (Layout::Relaxation_debug_check): New class definition.
12904         (Layout::record_output_section_data_from_script_,
12905         Layout::script_output_section_data_list_, Layout::segment_states_,
12906         Layout::relaxation_debug_check_): New data members.
12907         * output.cc: (Output_section_headers::do_size): New method definition.
12908         (Output_section_headers::Output_section_headers): Move size
12909         computation to Output_section_headers::do_size.
12910         (Output_segment_headers::do_size): New method definition.
12911         (Output_file_header::Output_file_header): Move size computation to
12912         Output_file_header::do_size and call it.
12913         (Output_file_header::do_size): New method definition.
12914         (Output_data_group::Output_data_group): Adjust call to
12915         Output_section_data.
12916         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12917         (Output_symtab_xindex::do_write): Add array bound check.
12918         (Output_section::Input_section::print_to_mapfile): Handle
12919         RELAXED_INPUT_SECTION_CODE.
12920         (Output_section::Output_section): Initialize data member checkpoint_.
12921         (Output_section::~Output_section): Delete checkpoint object pointed
12922         by checkpoint_.
12923         (Output_section::add_input_section): Always add an Input_section if
12924         relaxing.
12925         (Output_section::add_merge_input_section): Add assert.
12926         (Output_section::relax_input_section): New method definition.
12927         (Output_section::set_final_data_size): Set load address to zero for
12928         an unallocated section.
12929         (Output_section::do_address_and_file_offset_have_reset_values):
12930         New method definition.
12931         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12932         Handle relaxed input section.
12933         (Output_section::sort_attached_input_sections): Checkpoint input
12934         section list lazily.
12935         (Output_section::get_input_sections): Change type of input_sections to
12936         list of Simple_input_section pointers.  Checkpoint input section list
12937         lazily.  Also handle relaxed input sections.
12938         (Output_section::add_input_section_for_script): Take a reference to
12939         a Simple_input_section object instead of Relobj pointer and section
12940         index as parameter.  Handle relaxed input sections.
12941         (Output_section::save_states, Output_section::restore_states): New
12942         method definitions.
12943         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
12944         (Output_data::is_data_size_fixed): New method definition.
12945         (Output_data::reset_addresss_and_file_offset): Do not reset data size
12946         if it is fixed.
12947         (Output_data::address_and_file_offset_have_reset_values): New method
12948         definition.
12949         (Output_data::do_address_and_file_offset_have_reset_values): New method
12950         definition.
12951         (Output_data::set_data_size): Check that data size is not fixed.
12952         (Output_data::fix_data_size): New method definition.
12953         (Output_data::is_data_size_fixed_): New data member.
12954         (Output_section_headers::set_final_data_size): New method definition.
12955         (Output_section_headers::do_size): New method declaration.
12956         (Output_segment_headers::set_final_data_size): New method definition.
12957         (Output_segment_headers::do_size): New method declaration.
12958         (Output_file_header::set_final_data_size)::New method definition.
12959         (Output_file_header::do_size)::New method declaration.
12960         (Output_section_data::Output_section_data): Add new parameter
12961         is_data_size_fixed and use it to fix data size.
12962         (Output_data_const::Output_data_const): Adjust call to base class
12963         constructor and fix data size.
12964         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
12965         base class constructor and fix data size.
12966         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
12967         base class constructor and fix data size.
12968         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
12969         class constructor and fix data size.
12970         (Output_data_group::set_final_data_size): New method definition.
12971         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12972         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12973         class constructor and fix data size.
12974         (Output_relaxed_input_section): New class definition.
12975         (Output_section::Simple_input_section): New class definition.
12976         (Output_section::get_input_sections): Adjust parameter list.
12977         (Output_section::add_input_section_for_script): Same.
12978         (Output_section::save_states, Output_section::restore_states,
12979         Output_section::do_address_and_file_offset_have_reset_values,
12980         (Output_section::Input_section::Input_section): Handle
12981         RELAXED_INPUT_SECTION_CODE.  Add new overload for
12982         Output_relaxed_input_section.
12983         (Output_section::Input_section::is_input_section,
12984         Output_section::Input_section::set_output_section): Handle relaxed
12985         input section.
12986         (Output_section::Input_section::is_relaxed_input_section,
12987         Output_section::Input_section::output_section_data,
12988         Output_section::Input_section::relaxed_input_section): New method
12989         definitions.
12990         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12991         value.
12992         (Output_section::Input_section::u1_): Update comments.
12993         (Output_section::Input_section::u2_): Add new union member poris.
12994         (Output_section::Checkpoint_output_section): New classs definition.
12995         (Output_section::relax_input_section): New method declaration.
12996         (Output_section::checkpoint_): New data member.
12997         (Output_segment): Update comments.
12998         (Output_segment::Output_segment): Un-privatize copy constructor.
12999         (Output_segment::operator=): Un-privatize.
13000         * script-sections.cc (Output_section_element::Input_section_list):
13001         Change element type to Output_section::Simple_input_section.
13002         (Output_section_element_dot_assignment::set_section_addresses):
13003         Register output section data for relaxation clean up.
13004         (Output_data_exression::Output_data_expression): Adjust call to base
13005         constructor to fix data size.
13006         (Output_section_element_data::set_section_addresses): Register
13007         Output_data_expression object for relaxation clean up.
13008         (struct Input_section_info): Replace Relobj pointer and section index
13009         pair with Output_section::Simple_input_section and Convert struct to a
13010         class.
13011         (Input_section_sorter::operator()): Adjust access to
13012         Input_section_info data member to use accessors.
13013         (Output_section_element_input::set_section_addresses): Use layout
13014         parameter.  Adjust code to use Output_section::Simple_input_section
13015         and Input_secction_info classes.  Register filler for relaxation
13016         clean up.
13017         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
13018         and section index pair with Output_section::Simple_input_section
13019         class.  Adjust code accordingly.
13020         (Phdrs_element::release_segment): New method definition.
13021         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
13022         segment list.
13023         (Script_sections::release_segments): New method definition.
13024         * gold/script-sections.h (Script_sections::release_segments): New
13025         method declaration.
13026         * gold/target.h (Target::may_relax, Target::relax,
13027         Target::do_may_relax, Target::do_relax): New method definitions.
13028
13029 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13030
13031         * arm.cc (has_signed_unsigned_overflow): New function.
13032         (Arm_relocate_functions::abs8): New function.
13033         (Target_arm::Scan::local): Handle R_ARM_ABS8.
13034         (Target_arm::Scan::global): Likewise.
13035         (Target_arm::relocate::relocate): Likewise.
13036         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
13037         Likewise.
13038
13039 2009-09-16  Cary Coutant  <ccoutant@google.com>
13040
13041         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
13042         * testsuite/Makefile.in: Regenerate.
13043
13044 2009-09-11  Nick Clifton  <nickc@redhat.com>
13045
13046         * po/gold.pot: Updated by the Translation project.
13047
13048 2009-09-08  Cary Coutant  <ccoutant@google.com>
13049
13050         * output.cc (Output_file::open): Add execute permission to empty file.
13051         * testsuite/Makefile.am (permission_test): New test.
13052         * testsuite/Makefile.in: Regenerate.
13053
13054 2009-09-02  Ian Lance Taylor  <iant@google.com>
13055
13056         * output.cc (Output_file::resize): Call map_no_anonymous rather
13057         than map.
13058
13059 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
13060
13061         * gold.cc: Include "incremental.h".
13062         (queue_initial_tasks): Call Incremental_checker methods.
13063         * incremental.cc: Include "output.h".
13064         (Incremental_checker::can_incrementally_link_output_file): New
13065         method.
13066         * incremental.h (Incremental_checker): New class.
13067
13068         * output.cc (Output_file::open_for_modification): New method.
13069         (Output_file::map_anonymous): Changed return type to bool.  Record
13070         map in base_ field.
13071         (Output_file::map_no_anonymous): New method, broken out of map.
13072         (Output_file::map): Use map_no_anonymous and map_anonymous.
13073         * output.h (class Output_file): Update declarations.
13074
13075 2009-08-24  Cary Coutant  <ccoutant@google.com>
13076
13077         * options.h (Command_line::Pre_options): New class.
13078         (Command_line::pre_options): New member.
13079         * options.cc (gold::options::ready_to_register): New variable.
13080         (One_option::register_option): Do nothing if not registering options.
13081         Assert if same short option registered twice.
13082         (General_options::General_options): Turn off option registration when
13083         done constructing.
13084         (Command_line::Pre_options::Pre_options): New constructor.
13085
13086 2009-08-24  Cary Coutant  <ccoutant@google.com>
13087
13088         * options.h (General_options::no_keep_memory): Remove incorrect
13089         short option.
13090
13091 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
13092
13093         * Makefile.am (am__skiplex, am__skipyacc): New.
13094         * Makefile.in: Regenerate.
13095
13096 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
13097
13098         * Makefile.am (AM_CPPFLAGS): Renamed from ...
13099         (INCLUDES): ... this.
13100         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
13101         (AM_CPPFLAGS): Renamed from ...
13102         (INCLUDE): ... this.
13103         * Makefile.in, testsuite/Makefile.in: Regenerate.
13104
13105         * Makefile.in: Regenerate.
13106         * aclocal.m4: Likewise.
13107         * config.in: Likewise.
13108         * configure: Likewise.
13109         * testsuite/Makefile.in: Likewise.
13110
13111         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13112         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13113         * Makefile.in: Regenerate.
13114         * testsuite/Makefile.in: Regenerate.
13115
13116 2009-08-19  Cary Coutant  <ccoutant@google.com>
13117
13118         * resolve.cc (Symbol_table::resolve): Don't complain about defined
13119         symbols in shared libraries overridden by hidden or internal symbols
13120         in the main program.
13121
13122 2009-08-19  Chris Demetriou  <cgd@google.com>
13123
13124         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
13125         checking source file names in error messages.
13126
13127 2009-08-18  Doug Kwan  <dougkwan@google.com>
13128
13129         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
13130         an elcpp::Ehdr as parameter.  Adjust call to set_target.
13131         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
13132         an elfcpp::Ehdr as parameter.
13133         * object.cc (Object::set_target): Remove the version that looks up
13134         a target and sets it.
13135         (Sized_relobj::setup): Take a Target object instead of
13136         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
13137         (make_elf_sized_object): Find target and ask target to
13138         make an ELF object.
13139         * object.h: (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.
13143         * target.cc: Include dynobj.h.
13144         (Target::do_make_elf_object_implementation): New.
13145         (Target::do_make_elf_object): New.
13146         * target.h (Target::make_elf_object): New template declaration.
13147         (Target::do_make_elf_object): New method declarations.
13148         (Target::do_make_elf_object_implementation): New template declaration.
13149
13150 2009-08-14  Ian Lance Taylor  <iant@google.com>
13151
13152         * gold.h (FUNCTION_NAME): Define.
13153         (gold_unreachable): Use FUNCTION_NAME.
13154
13155 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
13156
13157         * icf.cc (Icf::find_identical_sections): Issue a warning when a
13158         symbol in the --keep-unique list is not found.
13159
13160 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
13161
13162         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
13163         been maked as --keep-unique.
13164         (Icf::unfold_section): New function.
13165         * icf.h (Icf::unfold_section): New function.
13166         * options.h (General_options::keep_unique): New option.
13167         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
13168         * testsuite/Makefile.in: Regenerate.
13169         * testsuite/icf_keep_unique_test.sh: New file.
13170         * testsuite/icf_keep_unique_test.cc: New file.
13171
13172 2009-08-12  Cary Coutant  <ccoutant@google.com>
13173
13174         PR 10471
13175         * resolve.cc (Symbol_table::resolve): Check for references from
13176         dynamic objects to hidden and internal symbols.
13177         * testsuite/Makefile.am (hidden_test.sh): New test.
13178         * testsuite/Makefile.in: Regenerate.
13179         * testsuite/hidden_test.sh: New script.
13180         * testsuite/hidden_test_1.c: New test source.
13181         * testsuite/hidden_test_main.c: New test source.
13182
13183 2009-08-11  Doug Kwan  <dougkwan@google.com>
13184
13185         * arm.cc: Update comments.
13186         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
13187         segment to locate the .ARM.exidx section if present.
13188
13189 2009-08-09  Doug Kwan  <dougkwan@google.com>
13190
13191         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
13192         patch.
13193
13194 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
13195         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
13196         compiler warnings.
13197
13198 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
13199
13200         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
13201         valid tls_segment only for non-debug-section relocations.
13202         * testsuite/Makefile.am: Add gc_tls_test.
13203         * testsuite/Makefile.in: Regenerate.
13204         * testsuite/gc_tls_test.cc: New file.
13205         * testsuite/gc_tls_test.sh: New file.
13206
13207 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
13208
13209         * icf.cc: New file.
13210         * icf.h: New file.
13211         * Makefile.am (CCFILES): Add icf.cc.
13212         (HFILES): Add icf.h
13213         * Makefile.in: Regenerate.
13214         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
13215         * gc.h (gc_process_relocs): Populate lists used by icf to contain
13216         section, symbol and addend information for the relocs.
13217         * gold.cc (queue_middle_tasks): Call identical code folding.
13218         * gold.h: Add defines for multimap.
13219         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
13220         to the call of finalize_local_symbols.
13221         * main.cc (main): Create object of class Icf.
13222         * object.cc (Sized_relobj::do_layout): Allow this function to be
13223         called twice during icf.
13224         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
13225         to sections marked as identical by icf.
13226         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
13227         when available.
13228         (Sized_relobj::do_section_entsize): New function.
13229         * object.h (Object::section_entsize): New function.
13230         (Object::do_section_entsize): New pure virtual function.
13231         (Relobj::finalize_local_symbols): Add new parameter.
13232         (Relobj::do_section_entsize): New function.
13233         * options.h (General_options::icf): New option.
13234         (General_options::icf_iterations): New option.
13235         (General_options::print_icf_sections): New option.
13236         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
13237         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
13238         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
13239         icf.
13240         * symtab.cc (Symbol_table::is_section_folded): New function.
13241         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
13242         to sections marked as identical by icf.
13243         * symtab.h (Symbol_table::set_icf): New function.
13244         (Symbol_table::icf): New function.
13245         (Symbol_table::is_section_folded): New function.
13246         (Symbol_table::icf_): New data member.
13247         * target-reloc.h (relocate_section): Ignore sections folded by icf.
13248         * testsuite/Makefile.am: Add commands to build icf_test.
13249         * testsuite/Makefile.in: Regenerate.
13250         * testsuite/icf_test.sh: New file.
13251         * testsuite/icf_test.cc: New file.
13252
13253 2009-07-24  Chris Demetriou  <cgd@google.com>
13254
13255         * layout.cc (is_compressible_debug_section): Fix incorrect
13256         comment about compressed section names.
13257
13258 2009-07-20  Ian Lance Taylor  <ian@airs.com>
13259
13260         PR 10419
13261         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
13262
13263 2009-07-16  Ian Lance Taylor  <iant@google.com>
13264
13265         PR 10400
13266         * layout.h: #include <map>.
13267         (class Kept_section): Change from struct to class.  Add accessors
13268         and setters.  Add section size to Comdat_group mapping.  Change
13269         Comdat_group to std::map.  Add is_comdat_ field.  Add
13270         linkonce_size field in union.
13271         (class Layout): Update declaration of find_or_add_kept_section.
13272         Don't declare find_kept_object.
13273         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
13274         parameter.  Add object, shndx, is_comdat, and is_group_name
13275         parameters.  Change all callers.  Adjust for new Kept_section.
13276         (Layout::find_kept_object): Remove.
13277         * object.cc (Sized_relobj::include_section_group): Update use of
13278         Kept_section.  Rename secnum to shndx.  Only record
13279         Kept_comdat_section if sections are the same size.
13280         (Sized_relobj::include_linkonce_section): Update use of
13281         Kept_section.  Only record Kept_comdat_section if sections are the
13282         same size.  Set size of linkonce section.
13283         (Sized_relobj::map_to_kept_section): Update call to
13284         get_kept_comdat_section.
13285         * object.h (class Sized_relobj): Rename fields in
13286         Kept_comdat_section to drop trailing underscores; change object
13287         field to Relobj*.  Change Kept_comdat_section_table to store
13288         struct rather than pointer.
13289         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
13290         Add kept_object and kept_shndx parameters.  Change all callers.
13291         (Sized_relobj::get_kept_comdat_section): Change return type to
13292         bool.  Add kept_object and kept_shndx parameters.  Change all
13293         callers.
13294         * plugin.cc (Pluginobj::include_comdat_group): Update call to
13295         Layout::find_or_add_kept_section.
13296
13297 2009-07-09  Ian Lance Taylor  <iant@google.com>
13298
13299         * merge.cc (Object_merge_map::initialize_input_to_output_map):
13300         Reserve space in the hash table.
13301
13302 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
13303
13304         * fileread.cc (File_read::get_mtime): New method.
13305         * fileread.h (Timespec): New structure.
13306         (File_read::get_mtime): New method.
13307         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
13308         Renamed from timestamp_nsec.
13309         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
13310         Elf_Xword.
13311         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
13312         timestamp_nsec.
13313         (Incremental_inputs::report_archive): Save mtime; style fix.
13314         (Incremental_inputs::report_obejct): Save mtime; style fix.
13315         (Incremental_inputs::report_script): Save mtime; style fix.
13316         (Incremental_inputs::finalize_inputs): Style fix.
13317         (Incremental_inputs::finalize): Style fix.
13318         (Incremental_inputs::create_input_section_data): Store inputs
13319         mtime.
13320         * incremental.h (Incremental_inputs::report_script): Add mtime
13321         argument.
13322         (Incremental_inputs::Input_info::Input_info): Intialize only one
13323         union member.
13324         (Incremental_inputs::Input_info::archive): Move to nameless
13325         union.
13326         (Incremental_inputs::Input_info::obejct): Move to nameless union.
13327         (Incremental_inputs::Input_info::script): Move to nameless union.
13328         (Incremental_inputs::mtime): New field.
13329         * script.cc (read_input_script): Pass file mtime to
13330         Incremental_input.
13331         * script.h (Script_info::inputs): Style fix.
13332
13333 2009-07-01  Ian Lance Taylor  <ian@airs.com>
13334
13335         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
13336         instead of 32.
13337
13338 2009-06-24  Ian Lance Taylor  <iant@google.com>
13339
13340         PR 10156
13341         * layout.cc (Layout::choose_output_section): If we find an
13342         existing section, update the flags.
13343         (Layout::create_notes): New function, broken out of
13344         Layout::finalize.
13345         (Layout::finalize): Don't create note sections.
13346         (Layout::create_note): Don't crash if linker script discards
13347         section.
13348         (Layout::create_gold_note): Likewise.
13349         (Layout::create_build_id): Likewise.  Don't set
13350         after_input_sections on the section.
13351         (Layout::create_executable_stack_info): Remove target parameter.
13352         Change caller.
13353         * layout.h (class Layout): Declare create_notes.  Update
13354         declaration of create_executable_stack_info.
13355         * gold.cc (queue_middle_tasks): Call create_notes.
13356         * output.cc (Output_section::update_flags_for_input_section): Move
13357         here from output.h.  If SHF_ALLOC flag is newly set, mark address
13358         invalid.
13359         * output.h (Output_data::mark_address_invalid): New function.
13360         (class Output_section): Only declare, not define,
13361         update_flags_for_input_section.  Remove set_flags.
13362
13363 2009-06-24  Ian Lance Taylor  <iant@google.com>
13364
13365         * script-sections.cc (Output_section_definition::
13366         set_section_addresses): Rename shadowing local load_address to
13367         laddr.
13368
13369 2009-06-24  Ian Lance Taylor  <iant@google.com>
13370
13371         PR 10244
13372         * reloc.cc (relocate_sections): Skip empty relocation sections.
13373
13374 2009-06-23  Ian Lance Taylor  <iant@google.com>
13375
13376         PR 10156
13377         * layout.cc (Layout::create_note): Use choose_output_section
13378         rather than make_output_section.
13379
13380 2009-06-23  Ian Lance Taylor  <iant@google.com>
13381
13382         PR 10237
13383         * options.cc (General_options::parse_V): Set printed_version_.
13384         (General_options::General_options): Initialize printed_version_.
13385         * options.h (class General_options): Add printed_version_ field.
13386         * gold.cc (queue_initial_tasks): If there are no input files,
13387         don't give a fatal error if we printed the version information.
13388         (queue_middle_tasks): If using -r with a shared object, give a
13389         fatal error rather than an ordinary error.
13390
13391 2009-06-23  Ian Lance Taylor  <iant@google.com>
13392
13393         PR 10219
13394         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
13395         (Layout::make_output_section): Set have_stabstr_section_ if we see
13396         a .stab*str section.
13397         (Layout::finalize): Call link_stabs_sections.
13398         (Layout::link_stabs_sections): New file.
13399         * layout.h (class Layout): Add have_stabstr_section_ field.
13400         Declare link_stabs_sections.
13401
13402 2009-06-23  Doug Kwan  <dougkwan@google.com>
13403
13404         * Makefile.am (libgold_a_LIBADD): New.
13405         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
13406         * Makefile.in: Regenerate.
13407         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
13408         * configure: Regenerate.
13409         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
13410         * fileread.cc: Include sys/state.h
13411         * gold.h: Declare memmem and strndup if found missing.
13412         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
13413
13414 2009-06-23  Ian Lance Taylor  <iant@google.com>
13415
13416         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
13417         * configure: Rebuild.
13418
13419 2009-06-23  Ian Lance Taylor  <iant@google.com>
13420
13421         PR 10147
13422         * object.cc (Object::section_contents): Don't try to get a view if
13423         the section has length zero.
13424         (Object::handle_gnu_warning_section): If the section is empty, use
13425         the name of the section as the warning.
13426
13427 2009-06-23  Ian Lance Taylor  <iant@google.com>
13428
13429         PR 10133
13430         * stringpool.h (class Stringpool_template): Add optimize_ field.
13431         (Stringpool_template::set_optimize): New function.
13432         * stringpool.cc (Stringpool_template::Stringpool_template):
13433         Initialize optimize_ field.
13434         (Stringpool_template::set_string_offsets): Test local optimize
13435         fild rather than parameter.
13436         * layout.cc (Layout::Layout): Call set_optimize on the section
13437         name stringpool.
13438
13439 2009-06-22  Ian Lance Taylor  <iant@google.com>
13440
13441         PR 10030
13442         * yyscript.y: Parse TARGET.
13443         * script.cc (script_set_target): New function.
13444         * script-c.h (script_set_target): Declare.
13445         * options.cc (General_options::string_to_object_format): Rename
13446         from string_to_object_format in anonymous namespace.  Change
13447         callers.
13448         * options.h (class General_options): Declare
13449         string_to_object_format.
13450
13451 2009-06-22  Ian Lance Taylor  <iant@google.com>
13452
13453         * script-sections.cc (Script_sections::create_segments): Don't put
13454         program headers in a PT_LOAD segment if -n or -N.
13455
13456 2009-06-22  Ian Lance Taylor  <iant@google.com>
13457
13458         PR 10141
13459         * options.h (class General_options): Add -z lazy and -z now.  Sort
13460         -z options into alphabetical order.
13461         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
13462
13463 2009-06-21  Ian Lance Taylor  <iant@google.com>
13464
13465         * layout.cc (Layout::make_output_section): Call
13466         Target::new_output_section.
13467         (Layout::attach_allocated_section_to_segment): Put large section
13468         sections in a separate load segment with the large segment flag
13469         set.
13470         (Layout::segment_precedes): Sort large data segments after other
13471         load segments.
13472         (align_file_offset): New static function.
13473         (Layout::set_segment_offsets): Use align_file_offset.
13474         * output.h (class Output_section): Add is_small_section_ and
13475         is_large_section_ fields.
13476         (Output_section::is_small_section): New function.
13477         (Output_section::set_is_small_section):  New function.
13478         (Output_section::is_large_section): New function.
13479         (Output_section::set_is_large_section): New function.
13480         (Output_section::is_large_data_section): New function.
13481         (class Output_segment): Add is_large_data_segment_ field.
13482         (Output_segment::is_large_data_segment): New function.
13483         (Output_segment::set_is_large_data_segment): New function.
13484         * output.cc (Output_section::Output_section): Initialize new
13485         fields.
13486         (Output_segment::Output_segment): Likewise.
13487         (Output_segment::add_output_section): Add assertion that large
13488         data sections always go in large data segments.  Force small data
13489         sections to the end of the list of data sections.  Force small BSS
13490         sections to the start of the list of BSS sections.  For large BSS
13491         sections to the end of the list of BSS sections.
13492         * symtab.h (class Symbol): Declare is_common_shndx.
13493         (Symbol::is_defined): Check Symbol::is_common_shndx.
13494         (Symbol::is_common): Likewise.
13495         (class Symbol_table): Define enum Commons_section_type.  Update
13496         declarations.  Add small_commons_ and large_commons_ fields.
13497         * symtab.cc (Symbol::is_common_shndx): New function.
13498         (Symbol_table::Symbol_table): Initialize new fields.
13499         (Symbol_table::add_from_object): Put small and large common
13500         symbols in the right list.
13501         (Symbol_table::sized_finalized_symbol): Check
13502         Symbol::is_common_shndx.
13503         (Symbol_table::sized_write_globals): Likewise.
13504         * common.cc (Symbol_table::do_allocate_commons): Allocate new
13505         common symbol lists.  Don't call do_allocate_commons_list if the
13506         list is empty.
13507         (Symbol_table::do_allocate_commons_list): Remove is_tls
13508         parameter.  Add comons_section_type parameter.  Change all
13509         callers.  Handle small and large common symbols.
13510         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
13511         Symbol::is_common_shndx.
13512         * resolve.cc (symbol_to_bits): Likewise.
13513         * target.h (Target::small_common_shndx): New function.
13514         (Target::small_common_section_flags): New function.
13515         (Target::large_common_shndx): New function.
13516         (Target::large_common_section_flags): New function.
13517         (Target::new_output_section): New function.
13518         (Target::Target_info): Add small_common_shndx, large_common_shndx,
13519         small_common_section_flags, and large_common_section_flags
13520         fields.
13521         (Target::do_new_output_section): New virtual function.
13522         * arm.cc (Target_arm::arm_info): Initialize new fields.
13523         * i386.cc (Target_i386::i386_info): Likewise.
13524         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
13525         Likewise.
13526         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
13527         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13528         (Target_x86_64::do_new_output_section): New function.
13529         * configure.ac: Define conditional MCMODEL_MEDIUM.
13530         * testsuite/Makefile.am (check_PROGRAMS): Add large.
13531         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
13532         (large_LDFLAGS): Define.
13533         * testsuite/large.c: New file.
13534         * testsuite/testfile.cc (Target_test::test_target_info):
13535         Initialize new fields.
13536         * configure, testsuite/Makefile.in: Rebuild.
13537
13538 2009-06-05  Doug Kwan  <dougkwan@google.com>
13539
13540         * Makefile.am (CCFILES): Add target.cc.
13541         * Makefile.in: Regenerate.
13542         * i386.cc (class Target_i386): Define new virtual method to
13543         override do_is_local_label_name in parent.
13544         * object.cc (Sized_relobj::do_count_local_symbols): Discard
13545         local symbols if --discard-locals or -X is given.
13546         * options.h (class General_options): Declare new options
13547         '--discard-locals' and '-X' for discarding locals.
13548         * target.h (class Target): Define new methods is_local_label_name.
13549         Declare new virtual method do_is_local_label_name.
13550         * target.cc: New file.
13551         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
13552         (check_SCRIPTS): Add discard_locals_test.sh.
13553         (check_DATA): Add discard_local_tests.syms.
13554         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
13555         (discard_local_tests.syms, discard_locals_test.o): New make rules.
13556         * testsuite/Makefile.in: Regenerate.
13557         * testsuite/discard_locals_test.c: New file.
13558         * testsuite/discard_locals_test.sh: Same.
13559
13560 2009-06-05  Doug Kwan  <dougkwan@google.com>
13561
13562         * object.cc (Sized_relobj::Sized_relobj): Initialize
13563         discarded_eh_frame_shndx_ to -1U.
13564         (Sized_relobj::do_layout): Record index of a discard .eh_frame
13565         section.
13566         (Sized_relobj::do_count_local_symbols): Skip local symbols in
13567         a discarded .eh_frame section.
13568         (Sized_relobj::do_finalize_local_symbols): Ditto.
13569         * object.h (class Sized_relobj): Declare new member
13570         discarded_eh_frame_shndx_.
13571         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
13572         (local_labels_test.o, local_labels_test): New rules.
13573         * testsuite/Makefile.in: Regenerate.
13574
13575 2009-06-04  Doug Kwan  <dougkwan@google.com>
13576
13577         * layout.cc (Layout::section_name_mapping): Add mapping for
13578         special ARM sections.
13579
13580 2009-06-03  Doug Kwan  <dougkwan@google.com>
13581
13582         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
13583         (utils::has_overflow): Same.
13584
13585 2009-06-03  Ian Lance Taylor  <iant@google.com>
13586
13587         * layout.cc (Layout::section_name_mapping): New array, replacing
13588         Layout::linkonce_mapping.
13589         (Layout::section_name_mapping_count): New variable, replacing
13590         Layout::linkonce_mapping_count.
13591         (Layout::linkonce_output_name): Remove.
13592         (Layout::output_section_name): Rewrite.
13593         * layout.h (class Layout): Rename Linkonce_mapping to
13594         Section_name_mapping, linkonce_mapping to section_name_mapping,
13595         linkonce_mapping_count to section_name_mapping_count.  Don't
13596         declare linkonce_output_name.
13597
13598 2009-06-03  Doug Kwan  <dougkwan@google.com>
13599
13600         * gold/arm.cc (namespace utils): New.
13601         (Target_arm::reloc_is_non_pic): Define new method.
13602         (class Arm_relocate_functions): New.
13603         (Target_arm::Relocate::relocate): Handle relocation types used by
13604         Android.
13605
13606 2009-06-03  Ian Lance Taylor  <iant@google.com>
13607
13608         * arm.cc (Target_arm::scan::global): Use || instead of |.
13609
13610 2009-06-02  Doug Kwan  <dougkwan@google.com>
13611
13612         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
13613         issued_non_pic_error_.
13614         (class Target_arm::Scan): Declare new method check_non_pic.
13615         Define new method symbol_needs_plt_entry.
13616         Declare new data member issued_non_pic_error_.
13617         (class Target_arm::Relocate): Declare new method
13618         should_apply_static_reloc.
13619         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
13620         (Target_arm::Scan::check_non_pic): Define new method.
13621         (Target_arm::Scan::local): Handle a small subset of reloc types used
13622         by Android.
13623         (Target_arm::Scan::local): Same.
13624         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
13625
13626 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
13627
13628         * incremental.cc (Incremental_inputs::report_command_line): Filter
13629         out --incremental-* options.
13630
13631 2009-05-29  Doug Kwan  <dougkwan@google.com>
13632
13633         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
13634         template class.
13635         (class Target_arm): Update comment.
13636         (Target_arm::Target_arm): Initialize new data members GOT_,
13637         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
13638         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
13639         and Target_arm::rel_dyn_section.
13640         Declare new_enum Target_arm::Got_type.
13641         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
13642         and DYNBSS_.
13643         Update commments for member do_dynsym_value.
13644         (Target_arm::got_size, Target_arm::plt_section,
13645         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
13646         new methods inside class defintion.
13647         (Target_arm::got_section): Define new method.
13648         (Target_arm::rel_dyn_section): Same.
13649         (Output_data_plt_arm): New template class.
13650         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
13651         (Output_data_plt_arm:do_adjust_output_section): Define new method.
13652         (Output_data_plt_arm::add_entry): Same.
13653         (Output_data_plt_arm::first_plt_entry): Define new
13654         static data member for PLT instruction template.
13655         (Output_data_plt_arm::plt_entry): Same.
13656         (Output_data_plt_arm::do_write): Define new method.
13657         (Target_arm::make_plt_entry): Same.
13658         (Target_arm::do_finalize_sections): Same.
13659         (Target_arm::do_dynsym_value): Same.
13660
13661 2009-05-28  Doug Kwan  <dougkwan@google.com>
13662
13663         * Makefile.am (TARGETSOURCES): Add arm.cc.
13664         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
13665         * Makefile.in: Regenerate.
13666         * arm.cc: New file.
13667         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
13668
13669 2009-05-26  Doug Kwan  <dougkwan@google.com>
13670
13671         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
13672         (General_options::check_excluded_libs): Strip off directories in
13673         archive name before matching like GNU ld does.
13674         * testsuite/Makefile.am (MOSTLYCLEANFILES,
13675         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
13676         (exclude_libs_test_LDFLAGS): Add linker option
13677         -Wl,--exclude-libs,libexclude_libs_test_3
13678         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
13679         an explicit archive without using -l.
13680         (alt/libexclude_libs_test_3.a): New make rule.
13681         * testsuite/Makefile.in: Regenerate.
13682         * testsuite/exclude_libs_test.c : Declare lib3_default().
13683         (main): Call it.
13684         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
13685         * exclude_libs_test_3.c: New file.
13686
13687 2009-05-26  Nick Clifton  <nickc@redhat.com>
13688
13689         * po/id.po: New Indonesian translation.
13690         * po/gold.pot: Updated template file.
13691
13692 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
13693
13694         * testsuite/Makefile.am: Add -ffunction-sections to compile
13695         gc_comdat_test files.  Add -Wl,--gc-sections to build
13696         gc_comdat_test.
13697         * testsuite/Makefile.in: Regenerate.
13698         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
13699
13700 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
13701
13702         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
13703         kept comdat section was garbage collected.
13704         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
13705         * testsuite/Makefile.in: Regenerate.
13706         * testsuite/gc_comdat_test.sh: New file.
13707         * testsuite/gc_comdat_test_1.cc: New file.
13708         * testsuite/gc_comdat_test_2.cc: New file.
13709
13710 2009-05-19  Doug Kwan  <dougkwan@google.com>
13711
13712         * archive.cc (Archive::Archive): Move constructor from archive.h
13713         to here.  Initialize no_export_.
13714         (Archive::get_elf_object_for_member): Set no_export flag of object.
13715         * archive.h (Archive::Archive): Move constructor body to
13716         archive.cc.
13717         (Archive::no_export): New method.
13718         (Archive::no_export_): New field.
13719         * object.h (Object::Object): Initialize no_export_ to false.
13720         (Object::no_export, Object::set_no_export): New methods.
13721         (Object::no_export_): New field.
13722         * options.cc (General_options::parse_exclude_libs): New method.
13723         (General_options::check_excluded_libs) Same.
13724         * options.h (exclude_libs): New option.
13725         (General_options::check_excluded_libs): New method declaration.
13726         (General_options::excluded_libs_): New field.
13727         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
13728         default or protected visibility if an object has no-export flag set.
13729         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
13730         (check_SCRIPTS): Add exclude_libs_test.sh.
13731         (check_DATA): Add exclude_libs_test.syms.
13732         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
13733         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
13734         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
13735         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
13736         (exclude_libs_test.syms, libexclude_libs_test_1.a,
13737         libexclude_libs_test_2.a): New rules.
13738         * testsuite/Makefile.in: Regenerate.
13739         * testsuite/exclude_libs_test.c: New file.
13740         * testsuite/exclude_libs_test.sh: Ditto.
13741         * testsuite/exclude_libs_test_1.c: Ditto.
13742         * testsuite/exclude_libs_test_2.c: Ditto.
13743
13744 2009-05-15  Ian Lance Taylor  <iant@google.com>
13745
13746         * configure.ac: Check for declarations for cases where libiberty.h
13747         checks HAVE_DECL_xxx.
13748         * configure, config.in: Rebuild.
13749
13750 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
13751
13752         * gold.h (Incremental_argument_list): Remove (invalid) forward
13753         declaration.
13754         * incremental.cc (Incremental_inputs::report_achive): New method.
13755         (Incremental_inputs::report_object): New method.
13756         (Incremental_inputs::report_script): New method.
13757         (Incremental_inputs::finalize_inputs): New method.
13758         (Incremental_inputs::finalize): Call finalize_inputs().
13759         (Incremental_inputs::sized_create_incremental_inputs_section_data):
13760         Create inputs entries.
13761         * incremental.h (Incremental_input_type): New enum.
13762         (Incremental_inputs::Incremental_input): Initialize new fields.
13763         (Incremental_inputs::report_inputs): New method.
13764         (Incremental_inputs::report_achive): New method.
13765         (Incremental_inputs::report_object): New method.
13766         (Incremental_inputs::report_script): New method.
13767         (Incremental_inputs::finalize_inputs): New method.
13768         (Incremental_inputs::Input_info): New struct.
13769         (Incremental_inputs::Input_info_map): New typedef.
13770         (Incremental_inputs::lock_): New field.
13771         (Incremental_inputs::Inputs_): New field.
13772         (Incremental_inputs::Inputs_map): New field.
13773         * main.cc (main): Call Incremental_input::report_inputs.
13774         * options.h (Input_argument_list): Typedef moved from
13775         Input_arguments.
13776         (Input_file_group::Files): Remove, use ::Input_argument_list.
13777         (Input_file_group::Input_argument_list): Remove, use
13778         ::Input_argument_list.
13779         * plugin.cc (Plugin_manager::add_input_file): Add error in
13780         incremental build.
13781         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13782         functions.
13783         * script.cc (read_input_script): Call
13784         Incremental_input::report_script.
13785         * script.h (Script_info): New class.
13786
13787 2009-04-27  Ian Lance Taylor  <iant@google.com>
13788
13789         * x86_64.cc (do_adjust_output_section): Set entsize to
13790         plt_entry_size.
13791
13792 2009-04-23  Elliott Hughes  <enh@google.com>
13793
13794         * output.cc (Output_file::close): After short writes, continue
13795         writing from the correct offset in the buffer being written.
13796
13797 2009-04-23  Chris Demetriou  <cgd@google.com>
13798
13799         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13800         * configure: Regenerate.
13801         * config.in: Regenerate.
13802         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13803         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13804
13805 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
13806
13807         * incremental.cc (Incremental_inputs_header_data): Renamed from
13808         Incremental_input_header_data.
13809         (Incremental_inputs_header_data::data_size): New field.
13810         (Incremental_inputs_header_data::put_input_file_count): Renamed
13811         from input_file_count.
13812         (Incremental_inputs_header_data::put_command_line_offset): Renamed
13813         from command_line_offset.
13814         (Incremental_inputs_header_data::put_reserved): Renamed from
13815         put_reserved.
13816         (Incremental_inputs_entry_data): Renamed from
13817         Incremental_input_entry_data.
13818         (Incremental_inputs_entry_data::data_size): New field.
13819         (Incremental_inputs::report_command_line): New method.
13820         (Incremental_inputs::finalize): New method.
13821         (Incremental_inputs::create_incremental_inputs_data): New method.
13822         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13823         * incremental.h: New file.
13824         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13825         (Layout::finalize): Create incremental inputs section in
13826         incremental builds.
13827         (Layout::create_incremental_info_sections): New method.
13828         * layout.h (Layout::incremental_inputs): New method.
13829         (Layout::create_incremental_info_sections): New method.
13830         (Layout::incremental_inputs_): New field.
13831         * main.cc (main): Notify Incremental_input of the command line.
13832
13833 2009-04-01  Ian Lance Taylor  <iant@google.com>
13834             Mikolaj Zalewski  <mikolajz@google.com>
13835
13836         * gold.h (reserve_unordered_map): Define, three versions, one for
13837         each version of Unordered_map.
13838         * layout.cc (Layout::Layout): Remove options parameter.  Add
13839         number_of_input_files parameter.  Don't initialize options_.
13840         Initialize number_of_input_files_ and resized_signatures_.  Move
13841         sections_are_attached_.
13842         (Layout::layout_group): Reserve space for group_signatures_.
13843         (Layout::find_or_add_kept_section): Change name parameter to be a
13844         reference.  Resize signatures_ map when it gets large enough.
13845         (Layout::layout_eh_frame): Use parameters->options() instead of
13846         this->options_.
13847         (Layout::make_output_section): Likewise.
13848         (Layout::attach_allocated_section_to_segment): Likewise.
13849         (Layout::finalize, Layout::create_executable_stack): Likewise.
13850         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
13851         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
13852         * layout.h (class Layout): Update declarations.  Remove options_
13853         field.  Add number_of_input_files_ and resized_signatures_
13854         fields.  Move sections_are_attached_ field.
13855         * main.cc (main): Pass number of input files to Layout
13856         constructor.  Don't pass options.
13857
13858 2009-03-30  Ian Lance Taylor  <iant@google.com>
13859
13860         * ffsll.c (ffsll): Correct implementation.
13861
13862 2009-03-27  Ian Lance Taylor  <iant@google.com>
13863
13864         * ffsll.c: New file.
13865         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
13866         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
13867         * ftruncate.c (ftruncate): Declare before definition.
13868         * mremap.c (mremap): Likewise.
13869         * pread.c (pread): Likewise.
13870         * configure, Makefile.in, config.in: Rebuild.
13871
13872         * mremap.c: New file.
13873         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
13874         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
13875         (mremap): Declare if HAVE_MREMAP is not defined.
13876         * configure, Makefile.in, config.in: Rebuild.
13877
13878 2009-03-27  Cary Coutant  <ccoutant@google.com>
13879
13880         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
13881         position independent.
13882         * sparc.cc (Target_sparc::check_non_pic): Likewise.
13883         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
13884
13885 2009-03-24  Cary Coutant  <ccoutant@google.com>
13886
13887         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
13888         an executable.
13889         (needs_dynamic_reloc): Likewise.
13890
13891 2009-03-24  Ian Lance Taylor  <iant@google.com>
13892
13893         * yyscript.y (file_cmd): Recognize EXTERN.
13894         (extern_name_list, extern_name_list_body): New nonterminals.
13895         * script.cc (script_add_extern): Define.
13896         * script-c.h (script_add_extern): Declare.
13897
13898 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
13899
13900         * object.cc (is_elf_object): Define.
13901         * object.h (is_elf_object): Declare.
13902         * archive.cc (Archive::get_elf_object_for_member): Call
13903         is_elf_object.
13904         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
13905
13906 2009-03-24  Elliott Hughes  <enh@google.com>
13907
13908         * output.cc (Output_file::map_anonymous): Define.
13909         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
13910         try an anonymous one.  Report the size if the mmap fails.
13911         * output.h (class Output_file): Declare map_anonymous.
13912
13913 2009-03-24  Ian Lance Taylor  <iant@google.com>
13914
13915         * target-select.cc (instantiate_target): Don't acquire the lock if
13916         the instantiated_target_ field has already been set.
13917
13918 2009-03-23  Ian Lance Taylor  <iant@google.com>
13919
13920         * gold-threads.h (class Initialize_lock): Define.
13921         * gold-threads.cc (class Initialize_lock_once): Define.
13922         (initialize_lock_control): New static variable.
13923         (initialize_lock_pointer): New static variable.
13924         (initialize_lock_once): New static function.
13925         (Initialize_lock::Initialize_lock): Define.
13926         (Initialize_lock::initialize): Define.
13927         * target-select.h: Include "gold-threads.h".
13928         (class Target_selector): Add lock_ and initialize_lock_ fields.
13929         Don't define instantiate_target, just declare it.
13930         * target-select.cc (Target_selector::Target_selector): Initialize
13931         new fields.
13932         (Target_selector::instantiate_target): Define.
13933         * descriptors.h: Include "gold-threads.h".
13934         (class Descriptors): Add initialize_lock_ field.
13935         * descriptors.cc (Descriptors::Descriptors): Initialize new
13936         field.
13937         (Descriptors::open): Use initialize_lock_ field
13938         * errors.h (class Errors): Add initialize_lock_ field.
13939         * errors.cc (Errors::Errors): Initialize new field.
13940         (Errors::initialize_lock): Use initialize_lock_ field.
13941         * powerpc.cc (class Target_selector_powerpc): Remove
13942         instantiated_target_ field.  In do_recognize call
13943         instantiate_target rather than do_instantiate_target.  In
13944         do_instantiate_target just allocate a new target.
13945         * sparc.cc (class Target_selector_sparc): Likewise.
13946
13947         * freebsd.h: New file.
13948         * i386.cc: Include "freebsd.h".
13949         (Target_i386): Derive from Target_freebsd rather than
13950         Sized_target.
13951         (Target_selector_i386): Derive from Target_selector_freebsd rather
13952         than Target_selector.
13953         * x86_64.cc: Include "freebsd.h".
13954         (Target_x86_64): Derive from Target_freebsd rather than
13955         Sized_target.
13956         (Target_selector_x86_64): Derive from Target_selector_freebsd
13957         rather than Target_selector.
13958         * target.h (class Target): Add adjust_elf_header and
13959         do_adjust_elf_header.
13960         * output.cc (Output_file_header:: do_sized_write): Call target
13961         adjust_elf_header routine.
13962         * configure.tgt: Set targ_osabi.
13963         * configure.ac: Define GOLD_DEFAULT_OSABI.
13964         * parameters.cc (Parameters::default_target): Pass
13965         GOLD_DEFAULT_OSABI to select_target.
13966         * target-select.h (class Target_selector): Make instantiate_target
13967         protected rather than private.
13968         * Makefile.am (HFILES): Add freebsd.h.
13969         * configure, Makefile.in, config.in: Rebuild.
13970
13971         * merge.cc (do_add_input_section): Correct pend value.  Change
13972         message about last entry not being null terminated from error to
13973         warning.
13974
13975 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
13976
13977         * incremental.cc: New file.
13978         * Makefile.am (CCFILES): Add incremental.cc.
13979         * Makefile.in: Rebuild.
13980
13981 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
13982
13983         * layout.cc (Layout::output_section_name): Preserve names
13984         of '.note.' sections.
13985
13986 2009-03-19  Ian Lance Taylor  <iant@google.com>
13987
13988         * descriptors.cc (Descriptors::open): Check that the options are
13989         valid before using them.
13990
13991 2009-03-18  Ian Lance Taylor  <iant@google.com>
13992
13993         * script-sections.h: Include <list>.
13994         (class Script_sections): Change Sections_elements from std::vector
13995         to std::list.  Typedef public Elements_iterator.  Add
13996         orphan_section_placement_, data_segment_align_start_, and
13997         saw_data_segment_align_ fields.  Remove data_segment_align_index_
13998         field.
13999         * script-sections.cc (class Orphan_section_placement): New class.
14000         (class Sections_element): Add virtual functions is_relro and
14001         orphan_section_init.  Remove virtual function place_orphan_here.
14002         (class Output_section_definition): Add is_relro and
14003         orphan_section_init.  Remove place_orphan_here.
14004         (class Orphan_output_section): Likewise.
14005         (Script_sections::Script_sections): Update for field changes.
14006         (Script_sections::data_segment_align): Set saw_data_segment_align_
14007         and data_segment_align_start_, not data_segment_align_index.
14008         (Script_sections::data_segment_relro_end): Check
14009         saw_data_segment_align_.  Use data_segment_align_start_ rather
14010         than data_segment_align_index_.
14011         (Script_sections::place_orphan): Rewrite to use
14012         Orphan_section_placement.
14013
14014 2009-03-17  Ian Lance Taylor  <iant@google.com>
14015
14016         * archive.cc (Archive::add_symbols): Check for a version attached
14017         to the symbol name in the archive map.
14018         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
14019         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
14020         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
14021         (ver_test_11.a): New target.
14022         * testsuite/Makefile.in: Rebuild.
14023
14024         * configure.ac: Check for chsize and posix_fallocate.  Replace
14025         ftruncate.
14026         * ftruncate.c: New file, from gnulib.
14027         * output.cc (posix_fallocate): Define dummy version if not
14028         HAVE_POSIX_FALLOCATE.
14029         (Output_file::map): Call posix_fallocate rather than lseek and
14030         write.
14031         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
14032         * configure, Makefile.in, config.in: Rebuild.
14033
14034 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
14035
14036         * layout.h (Layout::create_note): Add section_name parameter.
14037         * layout.cc (Layout::create_note): Likewise.
14038         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
14039
14040 2009-03-17  Ian Lance Taylor  <iant@google.com>
14041
14042         * descriptors.cc: Include "options.h".
14043         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
14044         (Descriptors::open): Always use O_CLOEXEC when opening a new
14045         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
14046         then set FD_CLOEXEC.
14047
14048         * sparc.cc (class Target_sparc): Add has_got_section.
14049         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
14050         make sure we have a GOT section.
14051
14052         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
14053         (Target_sparc::Scan::local): Likewise.
14054         (Target_sparc::Scan::global): Likewise.
14055         (Target_sparc::Relocate::relocate): Likewise.
14056         (Target_sparc::Relocate::relocate_tls): Likewise.
14057
14058         * symtab.cc (Symbol_table::define_default_version): New function,
14059         broken out of add_from_object.
14060         (Symbol_table::add_from_object): Call define_default_version.
14061         (Symbol_table::define_special_symbol): Add resolve_oldsym
14062         parameter.  Change all callers.  If the version for a symbol comes
14063         from a version script, resolve it with the symbol with the same
14064         name with no version.  Also add the symbol without a version if
14065         appropriate.
14066         (do_define_in_output_data): If resolving with oldsym, don't delete
14067         sym.
14068         (do_define_in_output_segment): Likewise.
14069         (do_define_as_constant): Likewise.
14070         * symtab.h (class Symbol_table): Update declarations.
14071
14072 2009-03-13  Ian Lance Taylor  <iant@google.com>
14073
14074         * readsyms.cc (Read_symbols::incompatible_warning): New function.
14075         (Read_symbols::requeue): New function.
14076         (Read_symbols::do_read_symbols): If make_elf_object fails because
14077         the target type is not configured, and the file was searched for,
14078         issue a warning and retry with the next directory.
14079         (Add_symbols::run): If the file has an incompatible format, and
14080         it was searched for, requeue the Read_symbols task.  On error,
14081         release the object.
14082         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
14083         dirindex parameter to constructor.  Change all callers.  Declare
14084         incompatible_warning and requeue.
14085         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
14086         input_argument_ and input_group_ fields.  Add them to
14087         constructor.  Change all callers.
14088         (class Read_script): Add dirindex_ field.  Add it to constructor.
14089         Change all callers.
14090         * archive.cc (Archive::setup): Remove input_objects parameter.
14091         Change all callers.
14092         (Archive::get_file_and_offset): Likewise.
14093         (Archive::read_all_symbols): Likewise.
14094         (Archive::read_symbols): Likewise.
14095         (Archive::get_elf_object_for_member): Remove input_objects
14096         parameter.  Add punconfigured parameter.  Change all callers.
14097         (Archive::add_symbols): Change return type to bool.  Check return
14098         value of include_member.
14099         (Archive::include_all_members): Likewise.
14100         (Archive::include_member): Change return type to bool.  Return
14101         false if first included object has incompatible target.  Set
14102         included_member_ field.
14103         (Add_archive_symbols::run): If add_symbols returns false, requeue
14104         Read_symbols task.
14105         * archive.h (class Archive): Add included_member_ field.
14106         Initialize it in constructor.  Add input_file and searched_for
14107         methods.  Update declarations.
14108         (class Add_archive_symbols): Add dirpath_, dirindex_, and
14109         input_argument_ fields.  Add them to constructor.  Change all
14110         callers.
14111         * script.cc: Include "target-select.h".
14112         (class Parser_closure): Add skip_on_incompatible_target_ and
14113         found_incompatible_target_ fields.  Add
14114         skip_on_incompatible_target parameter to constructor.  Change all
14115         callers.  Add methods skip_on_incompatible_target,
14116         clear_skip_on_incompatible_target, found_incompatible_target, and
14117         set_found_incompatible_target.
14118         (read_input_script): Add dirindex parameter.  Change all callers.
14119         If parser finds an incompatible target, requeue Read_symbols
14120         task.
14121         (script_set_symbol): Clear skip_on_incompatible_target in
14122         closure.
14123         (script_add_assertion, script_parse_option): Likewise.
14124         (script_start_sections, script_add_phdr): Likewise.
14125         (script_check_output_format): New function.
14126         * script.h (read_input_script): Update declaration.
14127         * script-c.h (script_check_output_format): Declare.
14128         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
14129         (ignore_cmd): Remove OUTPUT_FORMAT.
14130         * fileread.cc (Input_file::Input_file): Add explicit this.
14131         (Input_file::will_search_for): New function.
14132         (Input_file::open): Add pindex parameter.  Change all callers.
14133         * fileread.h (class Input_file): Add input_file_argument method.
14134         Declare will_search_for.  Update declarations.
14135         * object.cc (make_elf_object): Add punconfigured parameter.
14136         Change all callers.
14137         * object.h (class Object): Make input_file public.  Add
14138         searched_for method.
14139         (make_elf_object): Update declaration.
14140         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
14141         restart search.
14142         * dirsearch.h (class Dirsearch): Update declaration.
14143         * options.h (class General_options): Add --warn-search-mismatch.
14144         * parameters.cc (Parameters::is_compatible_target): New function.
14145         * parameters.h (class Parameters): Declare is_compatible_target.
14146         * workqueue.cc (Workqueue::add_blocker): New function.
14147         * workqueue.h (class Workqueue): Declare add_blocker.
14148
14149         * fileread.cc (Input_file::open): Remove options parameter.
14150         Change all callers.
14151         (Input_file::open_binary): Likewise.
14152         * script.cc (read_input_script): Likewise.
14153         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
14154         options parameter from constructor.  Change all callers.
14155         (class Read_script): Likewise.
14156         * fileread.h (class Input_file): Update declarations.
14157         * script.h (read_input_script): Update declaration.
14158
14159 2009-03-10  Nick Clifton  <nickc@redhat.com>
14160
14161         * po/es.po: New Spanish translation.
14162
14163 2009-03-06  Cary Coutant  <ccoutant@google.com>
14164
14165         * options.cc (parse_short_option): Keep dash_z from registering itself.
14166
14167 2009-03-03  Ian Lance Taylor  <iant@google.com>
14168
14169         PR 9918
14170         * target-reloc.h (relocate_section): Pass output_section to
14171         relocate.
14172         * i386.cc (Target_i386::should_apply_static_reloc): Add
14173         output_section parameter.  Change all callers.
14174         (Target_i386::Relocate::relocate): Add output_section parameter.
14175         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14176         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
14177         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
14178         * testsuite/two_file_shared.sh: New script.
14179         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
14180         (check_DATA): Add two_file_shared.dbg.
14181         (two_file_shared.dbg): New target.
14182         * testsuite/Makefile.in: Rebuild.
14183
14184 2009-03-01  Ian Lance Taylor  <iant@google.com>
14185
14186         * configure.ac: Check for byteswap.h.
14187         * configure: Rebuild.
14188         * config.in: Rebuild.
14189
14190 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
14191
14192         * layout.cc (Layout::find_or_add_kept_section): New function.
14193         (Layout::add_comdat): Removed.
14194         * layout.h (struct Kept_section): Move out of class Layout.
14195         Remove trailing underscores from field names.  Add group_sections
14196         field.  Rename group_ field to is_group.  Change all uses.
14197         (class Layout): Declare find_or_add_kept_section, not add_comdat.
14198         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
14199         comdat_groups_ field.
14200         (Sized_relobj::include_section_group): Use
14201         find_or_add_kept_section and Kept_section::group_sections.
14202         (Sized_relobj::include_linkonce_section): Likewise.
14203         * object.cc (class Sized_relobj): Don't define Comdat_group or
14204         Comdat_group_table.  Remove find_comdat_group and
14205         add_comdat_group.  Remove comdat_groups_ field.
14206         * plugin.cc (include_comdat_group): Use
14207         Layout::find_or_add_kept_section.
14208
14209 2009-02-28  Ian Lance Taylor  <iant@google.com>
14210
14211         * README: --gc-sections and map files are now supported.  Document
14212         some build requirements.
14213
14214         PR 6992
14215         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
14216         relocatable link set the value of the section symbol to zero.
14217         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
14218         relocatable link don't include the section address in the local
14219         symbol value.
14220
14221 2009-02-27  Ian Lance Taylor  <iant@google.com>
14222
14223         PR 6811
14224         * options.h (class Search_directory): Add is_system_directory.
14225         (class General_options): Declare is_in_system_directory.
14226         * options.cc (get_relative_sysroot): Make static.
14227         (get_default_sysroot): Make static.
14228         (General_optoins::is_in_system_directory): New function.
14229         * fileread.cc (Input_file::is_in_system_directory): New function.
14230         * fileread.h (class Input_file): Declare is_in_system_directory.
14231         * object.h (class Object): Add is_in_system_directory.
14232         (class Input_objects): Remove system_library_directory_ field.
14233         * object.cc (Input_objects::add_object): Don't set
14234         system_library_directory_.
14235         (input_objects::found_in_system_library_directory): Remove.
14236         * symtab.cc (Symbol_table::write_globals): Remove input_objects
14237         parameter.  Change all callers.
14238         (Symbol_table::sized_write_globals): Likewise.
14239         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
14240         Call Object::is_in_system_directory.
14241         * symtab.h (class Symbol_table): Update declarations.
14242
14243         PR 5990
14244         * descriptors.h (Open_descriptor): Add is_on_stack field.
14245         * descriptors.cc (Descriptors::open): If the descriptor is on the
14246         top of the stack, remove it.  Initialize is_on_stack field.
14247         (Descriptors::release): Only add pod to stack if it is not on the
14248         stack already.
14249         (Descriptors::close_some_descriptor): Clear stack_next and
14250         is_on_stack fields.
14251
14252         PR 7091
14253         * output.cc (Output_section::find_starting_output_address): Rename
14254         from starting_output_address; add PADDR parameter; change return
14255         type.
14256         * output.h (class Output_section): Declare
14257         find_starting_output_address instead of starting_output_address.
14258         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
14259         section symbol for which we can't find a merge section.
14260
14261         PR 9836
14262         * symtab.cc (Symbol_table::add_from_object): If the visibility is
14263         hidden or internal, force the symbol to be local.
14264         * resolve.cc (Symbol::override_visibility): Define.
14265         (Symbol::override_base): Use override_visibility.
14266         (Symbol_table::resolve): Likewise.
14267         (Symbol::override_base_with_special): Likewise.
14268         (Symbol_table::override_with_special): If the visibility is hidden
14269         or internal, force the symbol to be local.
14270         * symtab.h (class Symbol): Add set_visibility and
14271         override_visibility.
14272         * testsuite/ver_test_1.sh: New file.
14273         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
14274         (check_DATA): Add ver_test_1.syms.
14275         (ver_test_1.syms): New target.
14276         * testsuite/Makefile.in: Rebuild.
14277
14278 2009-02-25  Cary Coutant  <ccoutant@google.com>
14279
14280         * layout.cc (Layout::choose_output_section): Don't rename sections
14281         when using a linker script that has a SECTIONS clause.
14282         * Makefile.in: Regenerate.
14283
14284         * testsuite/Makefile.am (script_test_5.sh): New test case.
14285         * testsuite/Makefile.in: Regenerate.
14286         * testsuite/script_test_5.cc: New file.
14287         * testsuite/script_test_5.sh: New file.
14288         * testsuite/script_test_5.t: New file.
14289
14290 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
14291
14292         * archive.cc (Archive::include_member): Update calls to add_symbols.
14293         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
14294         the Layout argument.
14295         * dynobj.h (do_add_symbols): Add the Layout argument.
14296         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
14297         Layout argument.
14298         * object.h (Object::add_symbols): Add the Layout argument.
14299         (Object::do_add_symbols): Add the Layout argument.
14300         (Sized_relobj::do_add_symbols): Add the Layout argument.
14301         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
14302         Unify the two versions.
14303         (Add_plugin_symbols): Remove.
14304         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
14305         (Sized_pluginobj::do_add_symbols): Unify the two versions.
14306         (Add_plugin_symbols): Remove.
14307         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
14308         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
14309         (Add_symbols::run): Make it work with Pulginobj.
14310
14311 2009-02-06  Ian Lance Taylor  <iant@google.com>
14312
14313         * object.cc (Sized_relobj::do_layout): Make info message start
14314         with lower case letter.
14315
14316 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
14317
14318         * binary.cc: Fix file comment.
14319
14320         * options.h (enum Incremental_disposition): Define.
14321         (class General_options): Add new options: --incremental,
14322         --incremental_changed, --incremental_unchanged,
14323         --incremental_unknown.  Add incremental_disposition_ and
14324         implicit_incremental_ fields.
14325         (General_options::incremental_disposition): New function.
14326         (class Position_dependent_options): Add incremental_disposition
14327         option.
14328         (Position_dependent_options::copy_from_options): Set incremental
14329         dispositions.
14330         * options.cc (General_options::parse_incremental_changed): New
14331         function.
14332         (General_options::parse_incremental_unchanged): New function.
14333         (General_options::parse_incremental_unknown): New function.
14334         (General_options::General_options): Initialize new fields
14335         incremental_disposition_ and implicit_incremental_.
14336         (General_options::finalize): Check for uasge of --incremental-*
14337         without --incremental.
14338
14339 2009-02-06  Chris Demetriou  <cgd@google.com>
14340
14341         * gold.h (gold_undefined_symbol): Change to take only a Symbol
14342         pointer and to report location as the file name associated with
14343         the symbol.
14344         (gold_undefined_symbol_at_location): New function to replace the
14345         old gold_undefined_symbol functionality.
14346         * target-reloc.h (relocate_section): Update to use
14347         gold_undefined_symbol_at_location.
14348         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14349         Call gold_undefined_symbol function rather than gold_error.
14350         * errors.h (Errors::undefined_symbol): Take location as a
14351         string, rather than calculating it from a relocation.
14352         * errors.cc (Errors::fatal): Print "fatal error:" before the
14353         formatted message.
14354         (Errors::error, Errors::error_at_location): Print "error: "
14355         before the formatted message.
14356         (Errors::undefined_symbol): Take location as a string, rather
14357         than calculating it from a relocation.
14358         (gold_undefined_symbol_at_location): New function akin to
14359         old gold_undefined_symbol, calculates location from relocation.
14360         (gold_undefined_symbol): Change to take only a Symbol pointer
14361         and to report location as the file name associated with the symbol.
14362         * testsuite/debug_msg.sh: Update for changed error messages.
14363         * testsuite/undef_symbol.sh: Likewise.
14364
14365 2009-02-04  Duncan Sands  <baldrick@free.fr>
14366
14367         PR 9812
14368         * reduced_debug_output.h
14369         (Output_reduced_debug_abbrev_section::failed): Use format for
14370         gold_warning.
14371         (Output_reduced_debug_info_section::faild): Likewise.
14372
14373 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
14374
14375         * script.cc (Lazy_demangler): New class.
14376         (Version_script_info::get_symbol_version_helper): Demangle a
14377         symbol only once.
14378
14379 2009-01-29  Cary Coutant  <ccoutant@google.com>
14380
14381         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
14382         to __tls_get_addr.
14383         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14384
14385 2009-01-28  Ian Lance Taylor  <iant@google.com>
14386
14387         * version.cc (version_string): Bump to 1.9.
14388
14389         * gold.h: Include <cstring> and <stdint.h>.
14390         * version.cc: Include <cstdio>.
14391         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
14392         warning.
14393         * reduced_debug_output.cc (insert_into_vector): Rename from
14394         Insert_into_vector; change all callers.  Use Swap_unaligned to
14395         avoid aliasing issue; remove union since it is unnecessary.
14396
14397 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
14398
14399         * Makefile.am (CCFILES): Add gc.cc.
14400         (HFILES): Add gc.h.
14401         * Makefile.in: Regenerate.
14402         * gold.cc (Gc_runner): New class.
14403         (queue_initial_tasks): Call garbage collection related tasks
14404         when corresponding options are invoked.
14405         (queue_middle_gc_tasks): New function.
14406         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
14407         processed early before laying out sections during garbage collection.
14408         * gold.h (queue_middle_gc_tasks): New function.
14409         (is_prefix_of): Move from "layout.cc".
14410         * i386.cc (Target_i386::gc_process_relocs): New function.
14411         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
14412         * main.cc (main): Create object of class "Garbage_collection".
14413         * object.cc (Relobj::copy_symbols_data): New function.
14414         (Relobj::is_section_name_included): New function.
14415         (Sized_relobj::do_layout): Allow this function to be called twice
14416         during garbage collection and defer layout of section during the
14417         first call.
14418         * object.h (Relobj::get_symbols_data): New function.
14419         (Relobj::is_section_name_included): New function.
14420         (Relobj::copy_symbols_data): New function.
14421         (Relobj::set_symbols_data): New function.
14422         (Relobj::get_relocs_data): New function.
14423         (Relobj::set_relocs_data): New function.
14424         (Relobj::is_output_section_offset_invalid): New pure virtual function.
14425         (Relobj::gc_process_relocs): New function.
14426         (Relobj::do_gc_process_relocs): New pure virtual function.
14427         (Relobj::sd_): New data member.
14428         (Sized_relobj::is_output_section_offset_invalid): New function.
14429         (Sized_relobj::do_gc_process_relocs): New function.
14430         * options.h (General_options::gc_sections): Modify to not be a no-op.
14431         (General_options::print_gc_sections): New option.
14432         * plugin.cc (Plugin_finish::run): Remove function call to
14433         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
14434         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
14435         * reloc.cc (Read_relocs::run): Add task to process relocs and
14436         determine unreferenced sections when doing garbage collection.
14437         (Gc_process_relocs): New class.
14438         (Sized_relobj::do_gc_process_relocs): New function.
14439         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
14440         sections that are garbage collected.
14441         * reloc.h (Gc_process_relocs): New class.
14442         * sparc.cc (Target_sparc::gc_process_relocs): New function.
14443         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
14444         symbols whose corresponding sections are garbage collected.
14445         (Symbol_table::Symbol_table): Add new parameter for the garbage
14446         collection object.
14447         (Symbol_table::gc_mark_undef_symbols): New function.
14448         (Symbol_table::gc_mark_symbol_for_shlib): New function.
14449         (Symbol_table::gc_mark_dyn_syms): New function.
14450         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
14451         as garbage.
14452         (Symbol_table::add_from_object): Likewise.
14453         (Symbol_table::add_from_relobj): When building shared objects, do not
14454         treat externally visible symbols as garbage.
14455         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
14456         table information for static and relocatable links.
14457         * symtab.h (Symbol_table::set_gc): New function.
14458         (Symbol_table::gc): New function.
14459         (Symbol_table::gc_mark_undef_symbols): New function.
14460         (Symbol_table::gc_mark_symbol_for_shlib): New function.
14461         (Symbol_table::gc_mark_dyn_syms): New function.
14462         (Symbol_table::gc_): New data member.
14463         * target.h (Sized_target::gc_process_relocs): New pure virtual
14464         function.
14465         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
14466         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
14467
14468 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
14469
14470         * options.h (General_options::gc_sections): Define as a no-op for now.
14471         (General_options::no_keep_memory): Ditto.
14472         (General_options::Bshareable): Define.
14473         * options.cc (General_options::finalize): Honor -Bshareable.
14474
14475 2009-01-20  Andreas Schwab  <schwab@suse.de>
14476
14477         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
14478         read the value in the contents, since we don't use it.  Use the
14479         template endianness when writing.
14480         (Relocate::relocate): Use it for R_PPC_REL16_HA.
14481
14482 2009-01-19  Andreas Schwab  <schwab@suse.de>
14483
14484         * configure.tgt (powerpc64-*): Fix targ_obj.
14485
14486 2009-01-15  Ian Lance Taylor  <iant@google.com>
14487
14488         * object.cc (Sized_relobj::write_local_symbols): Don't write out
14489         local symbols when stripping all symbols.
14490
14491 2009-01-14  Cary Coutant  <ccoutant@google.com>
14492
14493         * output.cc (Output_reloc): Add explicit instantiations.
14494
14495 2009-01-14  Cary Coutant  <ccoutant@google.com>
14496
14497         * archive.cc (Archive::get_elf_object_for_member): Remove call
14498         to File_read::claim_for_plugin.
14499         * descriptors.cc (Descriptors::open): Remove reference to
14500         is_claimed.
14501         (Descriptors::claim_for_plugin): Remove.
14502         * descriptors.h (Descriptors::claim_for_plugin): Remove.
14503         (Descriptors::is_claimed): Remove.
14504         (claim_descriptor_for_plugin): Remove.
14505         * fileread.cc (File_read::claim_for_plugin): Remove.
14506         * fileread.h (File_read::claim_for_plugin): Remove.
14507         (File_read::descriptor): Reopen descriptor if necessary.
14508         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
14509         (Plugin_manager::all_symbols_read): Add task parameter. Change
14510         all callers.
14511         (Plugin_manager::get_input_file): New function.
14512         (Plugin_manager::release_input_file): New function.
14513         (Pluginobj::Pluginobj): Add filesize parameter and initialize
14514         corresponding data member.
14515         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
14516         and pass to base constructor. Change all callers.
14517         (get_input_file, release_input_file): New functions.
14518         (make_sized_plugin_object): Add filesize parameter. Change all callers.
14519         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
14520         (Plugin_manager::all_symbols_read): Add task parameter.
14521         (Plugin_manager::get_input_file): New function.
14522         (Plugin_manager::release_input_file): New function.
14523         (Plugin_manager::task_): New data member.
14524         (Pluginobj::Pluginobj): Add filesize parameter.
14525         (Pluginobj::filename): New function.
14526         (Pluginobj::descriptor): New function.
14527         (Pluginobj::filesize): New function.
14528         (Pluginobj::filesize_): New data member.
14529         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
14530         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
14531         File_read::claim_for_plugin; use Object::unlock to unlock the file.
14532
14533         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
14534         with archive libraries.
14535         * testsuite/Makefile.in: Regenerate.
14536         * testsuite/plugin_test.c (struct sym_info): New type.
14537         (get_input_file, release_input_file): New static variables.
14538         (onload): Capture new transfer vector entries.
14539         (claim_file_hook): Stop reading at end of file according to filesize.
14540         Factor out parsing of readelf output into separate function.
14541         (all_symbols_read_hook): Exercise get_input_file and release_input_file
14542         APIs and get the source file name from the symbol table.  Convert
14543         source file name to corresponding object file name.  Print info
14544         message when adding new input files.
14545         (parse_readelf_line): New function.
14546         * testsuite/plugin_test_1.sh: Add checks for new info messages.
14547         * testsuite/plugin_test_2.sh: Likewise.
14548         * testsuite/plugin_test_3.sh: Likewise.
14549         * testsuite/plugin_test_4.sh: New test case.
14550
14551 2009-01-07  Ian Lance Taylor  <iant@google.com>
14552
14553         * version.cc (version_string): Bump to 1.8.
14554
14555 2008-12-23  Cary Coutant  <ccoutant@google.com>
14556
14557         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
14558         * plugin.cc (Plugin_manager::finish): Rename as
14559         layout_deferred_objects.  Move cleanup to separate function.
14560         (Plugin_manager::cleanup): New function.
14561         (Plugin_finish::run): Call layout_deferred_objects and cleanup
14562         separately.
14563         * plugin.h (Plugin_manager::finish): Rename as
14564         layout_deferred_objects.
14565         (Plugin_manager::cleanup): New function.
14566         (Plugin_manager::cleanup_done): New field.
14567
14568 2008-12-23  Cary Coutant  <ccoutant@google.com>
14569
14570         * plugin.cc (is_visible_from_outside): New function.
14571         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
14572         so we don't return "IR only" status for exported symbols or -r links.
14573
14574         * testsuite/Makefile.am (plugin_test_3): New test case.
14575         * testsuite/Makefile.in: Regenerate.
14576         * testsuite/plugin_test_3.sh: New file.
14577
14578 2008-12-22  Cary Coutant  <ccoutant@google.com>
14579
14580         * object.cc (Sized_relobj::layout_section): New function.
14581         (Sized_relobj::do_layout): Defer layout of input sections until after
14582         plugin has provided replacement files.
14583         (Sized_relobj::do_layout_deferred_sections): New function.
14584         * object.h (Relobj::set_section_offset): Remove virtual keyword.
14585         (Relobj::layout_deferred_sections): New function.
14586         (Relobj::do_layout_deferred_sections): New function.
14587         (Sized_relobj::do_layout_deferred_sections): New function.
14588         (Sized_relobj::layout_section): New function.
14589         (Sized_relobj::Deferred_layout): New structure.
14590         (Sized_relobj::deferred_layout_): New field.
14591         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
14592         Change all callers.  Layout deferred sections.
14593         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
14594         references.
14595         (Plugin_hook::run): Move code from do_plugin_hook inline.
14596         (Plugin_hook::do_plugin_hook): Remove.
14597         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
14598         (Plugin_manager::finish): Renamed, was cleanup.
14599         (Plugin_manager::should_defer_layout): New function.
14600         (Plugin_manager::add_deferred_layout_object): New function.
14601         (Plugin_manager::Deferred_layout_list): New type.
14602         (Plugin_manager::deferred_layout_objects_): New field.
14603         (Plugin_hook::do_plugin_hook): Remove.
14604
14605 2008-12-17  Ian Lance Taylor  <iant@google.com>
14606
14607         * options.h (class General_options): Add --no case for
14608         --export-dynamic.
14609
14610 2008-12-16  Cary Coutant  <ccoutant@google.com>
14611
14612         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
14613         vector.
14614         (Plugin_manager::claim_file): Create plugin object even if
14615         plugin did not call the add_symbols callback.
14616         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
14617         asking for more symbols than were added.
14618         * testsuite/Makefile.am (plugin_test_1): Add test case with
14619         no global symbols.
14620         (empty.syms): New target.
14621         * testsuite/Makefile.in: Regenerate.
14622         * testsuite/plugin_test.c (claim_file_hook): Add new debug
14623         message. Don't call add_symbols if no globals.
14624         (all_symbols_read_hook): Don't provide replacement for empty
14625         claimed file.
14626
14627 2008-12-12  Ian Lance Taylor  <iant@google.com>
14628
14629         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
14630         r_type == 0 for a local symbol with r_sym == 0.
14631         (scan_relocatable_relocs): Pass r_sym to
14632         local_non_section_strategy.
14633         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
14634         r_sym parameter.
14635
14636         * configure.ac: Update test for TLS descriptors: they are
14637         supported as of glibc 2.9.
14638         * configure: Rebuild.
14639
14640 2008-12-11  Ian Lance Taylor  <iant@google.com>
14641
14642         PR 7091
14643         * target-reloc.h (Default_scan_relocatable_relocs): For each
14644         function, map r_type == 0 to RELOC_DISCARD.
14645
14646 2008-12-10  Cary Coutant  <ccoutant@google.com>
14647
14648         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
14649         object to override a kept COMDAT group from a plugin object.
14650
14651 2008-12-09  Ian Lance Taylor  <iant@google.com>
14652
14653         PR 7088
14654         * yyscript.y (file_cmd): Handle INPUT.
14655
14656         * testsuite/initpri1.c: Change all declarations to be full
14657         prototypes by adding void, to avoid compiler warnings.
14658
14659 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
14660
14661         * options.cc (General_options::parse_plugin_opt): New.
14662         (General_options::add_plugin): The argument now is just the filename.
14663         (General_options::add_plugin_option): New.
14664         * options.h (plugin_opt): New.
14665         (add_plugin): Change argument name.
14666         (add_plugin_option): New.
14667         * plugin.cc (Plugin::load): Don't parse the plugin option.
14668         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
14669         (Plugin::add_option): New.
14670         (Plugin::args_): Change type.
14671         (Plugin::filename_): New.
14672         (Plugin_manager::add_plugin_option): New.
14673         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
14674         * testsuite/Makefile.in: Regenerate.
14675
14676 2008-12-05  Cary Coutant  <ccoutant@google.com>
14677
14678         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
14679         Handle --strip-lto-sections option.
14680         * options.h (strip_lto_sections): New option.
14681
14682 2008-12-01  Cary Coutant  <ccoutant@google.com>
14683
14684         * plugin.cc (ld_plugin_message): Change format parameter to const.
14685         Fix mismatch between new[] and delete.
14686
14687 2008-11-14  Cary Coutant  <ccoutant@google.com>
14688
14689         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
14690         instead of -1U.
14691
14692 2008-11-05  Craig Silverstein  <csilvers@google.com>
14693
14694         * options.cc (General_options::parse_dynamic_list): New function.
14695         * options.h (General_options): New flags dynamic_list,
14696         dynamic_list_data, dynamic_list_cpp_new, and
14697         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
14698         (General_options::in_dynamic_list): New function.
14699         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
14700         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
14701         (Lex::can_continue_name): Likewise.
14702         (yylex): Likewise.
14703         (read_script_file): New parameter script_options.
14704         (read_dynamic_list): New function.
14705         (Script_options::define_dynamic_list): New function.
14706         (dynamic_list_keyword_parsecodes): New variable.
14707         (dynamic_list_keywords): New variable.
14708         * script.h (Script_options::define_dynamic_list): New function
14709         prototype.
14710         (read_dynamic_list): New function prototype.
14711         * symtab.cc (strprefix): New macro.
14712         (Symbol::should_add_dynsym_entry): Support dynamic_list,
14713         dynamic_list_data, dynamic_list_cpp_new, and
14714         dynamic_list_cpp_typeinfo.
14715         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
14716         (dynamic_list_expr): New rule.
14717         (dynamic_list_nodes): Likewise.
14718         (dynamic_list_node): Likewise.
14719         * testsuite/Makefile.am (dynamic_list): New test.
14720         * testsuite/Makefile.in: Regenerated.
14721         * testsuite/dynamic_list.t: New file.
14722         * testsuite/dynamic_list.sh: New file.
14723
14724 2008-11-05  Craig Silverstein  <csilvers@google.com>
14725
14726         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
14727         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
14728         (t11_last): Likewise.
14729         * testsuite/ver_test_6.c (main): Likewise.
14730
14731 2008-10-07  Cary Coutant  <ccoutant@google.com>
14732
14733         * options.c (General_options::finalize): Add check for -static and
14734         -shared.
14735         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
14736         is not empty.
14737
14738 2008-10-02  Cary Coutant  <ccoutant@google.com>
14739
14740         * plugin.cc (make_sized_plugin_object): Fix conditional
14741         compilation to work when not all targets are enabled.
14742
14743 2008-09-29  Cary Coutant  <ccoutant@google.com>
14744
14745         * archive.cc (Archive::get_file_and_offset): Use filename instead
14746         of name to get library path.
14747         (Archive::include_member): Unlock external member of a thin archive.
14748
14749         * testsuite/Makefile.am (TEST_AR): New variable.
14750         (thin_archive_test_1): New test.
14751         (thin_archive_test_2): New test.
14752         * testsuite/Makefile.in: Regenerate.
14753         * testsuite/thin_archive_main.cc: New file.
14754         * testsuite/thin_archive_test_1.cc: New file.
14755         * testsuite/thin_archive_test_2.cc: New file.
14756         * testsuite/thin_archive_test_3.cc: New file.
14757         * testsuite/thin_archive_test_4.cc: New file.
14758
14759 2008-09-29  Cary Coutant  <ccoutant@google.com>
14760
14761         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
14762         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
14763         instead of -1U.
14764         (Sized_relobj::do_finalize_local_symbols): Likewise.
14765         (Sized_relobj::map_to_kept_section): Likewise.
14766         * object.h (Sized_relobj::invalid_address): New constant.
14767         (Sized_relobj::do_output_section_offset): Check for invalid_address
14768         and return -1ULL.
14769         * output.cc (Output_reloc::local_section_offset): Use constant
14770         invalid_address instead of -1U.
14771         (Output_reloc::get_address): Likewise.
14772         (Output_section::output_address): Change -1U to -1ULL.
14773         * output.h (Output_reloc::invalid_address): New constant.
14774         * reloc.cc (Sized_relobj::write_sections): Use constant
14775         invalid_address instead of -1U.
14776         (Sized_relobj::relocate_sections): Likewise.
14777         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
14778         values for merge sections.
14779         * target-reloc.h (relocate_for_relocatable): Use constant
14780         invalid_address instead of -1U.
14781
14782 2008-09-19  Cary Coutant  <ccoutant@google.com>
14783
14784         Add plugin functionality for link-time optimization (LTO).
14785         * configure.ac (plugins): Add --enable-plugins option.
14786         * configure: Regenerate.
14787         * config.in: Regenerate.
14788         * Makefile.am (LIBDL): New variable.
14789         (CCFILES): Add plugin.cc.
14790         (HFILES): Add plugin.h.
14791         (ldadd_var): Add LIBDL.
14792         * Makefile.in: Regenerate.
14793
14794         * archive.cc: Include "plugin.h".
14795         (Archive::setup): Don't preread archive symbols when using a plugin.
14796         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
14797         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14798         files.
14799         (Archive::include_member): Add symbols from plugin objects.
14800         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14801         * descriptors.cc (Descriptors::open): Check for file descriptors
14802         abandoned by plugins.
14803         (Descriptors::claim_for_plugin): New function.
14804         * descriptors.h (Descriptors::claim_for_plugin): New function.
14805         (Open_descriptor::is_claimed): New field.
14806         (claim_descriptor_for_plugin): New function.
14807         * fileread.cc (File_read::claim_for_plugin): New function.
14808         * fileread.h (File_read::claim_for_plugin): New function.
14809         (File_read::descriptor): New function.
14810         * gold.cc: Include "plugin.h".
14811         (queue_initial_tasks): Add task to call plugin hooks for generating
14812         new object files.
14813         * main.cc: Include "plugin.h".
14814         (main): Load plugin libraries.
14815         * object.h (Pluginobj): Declare.
14816         (Object::pluginobj): New function.
14817         (Object::do_pluginobj): New function.
14818         (Object::set_target): New function.
14819         * options.cc: Include "plugin.h".
14820         (General_options::parse_plugin): New function.
14821         (General_options::General_options): Initialize plugins_ field.
14822         (General_options::add_plugin): New function.
14823         * options.h (Plugin_manager): Declare.
14824         (General_options): Add --plugin option.
14825         (General_options::has_plugins): New function.
14826         (General_options::plugins): New function.
14827         (General_options::add_plugin): New function.
14828         (General_options::plugins_): New field.
14829         * plugin.cc: New file.
14830         * plugin.h: New file.
14831         * readsyms.cc: Include "plugin.h".
14832         (Read_symbols::do_read_symbols): Check for archive before checking
14833         for ELF file.  Call plugin hooks to claim files.
14834         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
14835         from a real object file; force override when processing replacement
14836         files.
14837         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
14838         (Symbol::init_base_object): Likewise.
14839         (Symbol::init_base_output_data): Likewise.
14840         (Symbol::init_base_output_segment): Likewise.
14841         (Symbol::init_base_constant): Likewise.
14842         (Symbol::init_base_undefined): Likewise.
14843         (Symbol::output_section): Assert that object is not a plugin.
14844         (Symbol_table::add_from_pluginobj): New function.
14845         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
14846         undefined.
14847         (Symbol_table::sized_write_globals): Likewise.
14848         (Symbol_table::add_from_pluginobj): Instantiate template.
14849         * symtab.h (Sized_pluginobj): Declare.
14850         (Symbol::in_real_elf): New function.
14851         (Symbol::set_in_real_elf): New function.
14852         (Symbol::in_real_elf_): New field.
14853         (Symbol_table::add_from_pluginobj): New function.
14854
14855         * testsuite/Makefile.am (AM_CFLAGS): New variable.
14856         (LIBDL): New variable.
14857         (LDADD): Add LIBDL.
14858         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
14859         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
14860         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
14861         (MOSTLYCLEANFILES): Likewise.
14862         * testsuite/Makefile.in: Regenerate.
14863         * testsuite/plugin_test.c: New file.
14864         * testsuite/plugin_test_1.sh: New file.
14865         * testsuite/plugin_test_2.sh: New file.
14866
14867 2008-09-16  Ian Lance Taylor  <iant@google.com>
14868
14869         * target-reloc.h (relocate_section): Check whether a symbol is
14870         defined by the ABI before reporting an undefined symbol error.
14871         * target.h (Target::is_defined_by_abi): Make parameter const.
14872         (Target::do_is_defined_by_abi): Likewise.
14873         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
14874         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
14875         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
14876         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
14877         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
14878         * testsuite/Makefile.in: Rebuild.
14879
14880         * fileread.cc (make_view): Add casts to avoid warning.
14881
14882 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14883
14884         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
14885         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14886
14887 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14888
14889         * options.h (General_options::output_is_executable): New.
14890         (General_options::output_is_pie): New.
14891         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
14892         for shared libraries.
14893         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14894
14895 2008-09-11  Chris Demetriou  <cgd@google.com>
14896
14897         * options.h (origin): New -z option.
14898         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
14899         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
14900         in DT_FLAGS_1.
14901
14902 2008-09-05  Cary Coutant  <ccoutant@google.com>
14903
14904         * fileread.cc (File_read::make_view): Add check for attempt to map
14905         beyond end of file.
14906
14907 2008-09-05  Cary Coutant  <ccoutant@google.com>
14908
14909         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
14910         explicit instantiations.
14911
14912 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
14913
14914         PR gold/6858
14915         * options.cc (General_options::finalize): Allow undefined symbols
14916         in shlibs if linking -shared.
14917
14918         PR gold/6859
14919         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14920         symbols as not needing a dynsym entry.
14921
14922 2008-08-20  Craig Silverstein  <csilvers@google.com>
14923
14924         * fileread.cc (File_read::open): Do not lock the file unless it
14925         was successfully opened.
14926
14927 2008-08-14  Cary Coutant  <ccoutant@google.com>
14928
14929         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14930         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14931         * testsuite/tls_test.cc (struct int128): 128-bit struct
14932         for testing TLS relocs with non-zero addend.
14933         (v12): New TLS variable.
14934         (t12): New test.
14935         (t_last): Add check for v12.
14936         * testsuite/tls_test.h (t12): New function.
14937         * testsuite/tls_test_main.cc (thread_routine): Call new test.
14938
14939 2008-08-13  Ian Lance Taylor  <iant@google.com>
14940
14941         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14942         set tls_segment_ or relro_segment_.
14943         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
14944         when appropriate.
14945         * output.h (Output_section::clear_is_relro): New function.
14946         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
14947         sections specially even when output_data_ is empty.
14948         (Output_segment::maximum_alignment): When first section is relro,
14949         only force alignment for PT_LOAD segments.
14950         * script.cc (script_data_segment_align): New function.
14951         (script_data_segment_relro_end): New function.
14952         * script-c.h (script_data_segment_align): Declare.
14953         (script_data_segment_relro_end): Declare.
14954         * script-sections.h (class Script_sections): Declare
14955         data_segment_align and data_segment_relro_end.  Add fields
14956         segment_align_index_ and saw_relro_end_.
14957         * script-sections.cc (class Sections_element): Add set_is_relro
14958         virtual function.  Add new bool* parameter to place_orphan_here.
14959         Add get_output_section virtual function.
14960         (class Output_section_definition): Add set_is_relro.  Add new
14961         bool* parameter to place_orphan_here.  Add get_output_section.
14962         Add is_relro_ field.
14963         (Output_section_definition::Output_section_definition): Initialize
14964         evaluated_address_, evaluated_load_address, evaluated_addralign_,
14965         and is_relro_ fields.
14966         (Output_section_definition::place_orphan_here): Add is_relro
14967         parameter.
14968         (Output_section_definition::set_section_addresses): Set relro for
14969         output section.
14970         (Output_section_definition::alternate_constraint): Likewise.
14971         (class Orphan_output_section): Add new bool* parameter to
14972         place_orphan_here.  Add get_output_section.
14973         (Orphan_output_section::place_orphan_here): Add is_relro
14974         parameter.
14975         (Script_sections::Script_sections): Initialize
14976         data_segment_align_index_ and saw_relro_end_.
14977         (Script_sections::data_segment_align): New function.
14978         (Script_sections::data_segment_relro_end): New function.
14979         (Script_sections::place_orphan): Set or clear is_relro.
14980         (Script_sections::set_section_addresses): Force alignment of first
14981         TLS section.
14982         * yyscript.y (exp): Call script_data_segment_align and
14983         script_data_segment_relro_end.
14984         * testsuite/relro_script_test.t: New file.
14985         * testsuite/relro_test.cc (using_script): Declare.
14986         (t1, t2): Test using_script.
14987         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14988         (relro_script_test_SOURCES): Define.
14989         (relro_script_test_DEPENDENCIES): Define.
14990         (relro_script_test_LDFLAGS): Define.
14991         (relro_script_test_LDADD): Define.
14992         (relro_script_test.so): New target.
14993         * testsuite/Makefile.in: Rebuild.
14994
14995 2008-08-06  Cary Coutant <ccoutant@google.com>
14996
14997         * archive.cc (Archive::total_archives, Archive::total_members)
14998         (Archive::total_members_loaded): New variables.
14999         (Archive::setup): Add parameter.  Add option to preread
15000         archive symbols.
15001         (Archive::read_armap): Add counter.
15002         (Archive::get_file_and_offset): New function.
15003         (Archive::get_elf_object_for_member): New function.
15004         (Archive::read_all_symbols): New function.
15005         (Archive::read_symbols): New function.
15006         (Archive::add_symbols): Add counters.
15007         (Archive::include_all_members): Use armap to find members if it's
15008         already built.
15009         (Archive::include_member): Skip reading symbols if already read.
15010         Factored code into Archive::get_file_and_offset and
15011         Archive::get_elf_object_for_member.  Changed call to
15012         Mapfile::report_include_archive_member.
15013         (Archive::print_stats): New function.
15014         * archive.h: Declare Object and Read_symbols_data classes.
15015         (Archive::Archive): Add initializers for new members.
15016         (Archive::setup): Add parameter.
15017         (Archive::print_stats): New function.
15018         (Archive::total_archives, Archive::total_members)
15019         (Archive::total_members_loaded): New variables.
15020         (Archive::get_file_and_offset): New function.
15021         (Archive::get_elf_object_for_member): New function.
15022         (Archive::read_all_symbols): New function.
15023         (Archive::read_symbols): New function.
15024         (Archive::Archive_member): New class.
15025         (Archive::members_): New member.
15026         (Archive::num_members_): New member.
15027         * main.cc: Include archive.h.
15028         (main): Call Archive::print_stats.
15029         * mapfile.cc (Mapfile::report_include_archive_member): Delete
15030         archive parameter; member_name is now the fully-decorated name.
15031         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
15032         * options.h: (General_options): Add --preread-archive-symbols option.
15033         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
15034         Archive::setup.
15035
15036 2008-08-04  Ian Lance Taylor  <iant@google.com>
15037
15038         * symtab.h (Symbol::use_plt_offset): New function.
15039         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
15040         * powerpc.cc (Relocate::relocate): Likewise.
15041         * sparc.cc (Relocate::relocate): Likewise.
15042         * x86_64.cc (Relocate::relocate): Likewise.
15043         * testsuite/weak_plt.sh: New test.
15044         * testsuite/weak_plt_main.cc: New test.
15045         * testsuite/weak_plt_shared.cc: New test.
15046         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
15047         (check_PROGRAMS): Add weak_plt.
15048         (check_DATA): Add weak_plt_shared.so.
15049         (weak_plt_main_pic.o, weak_plt): New targets.
15050         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
15051         * testsuite/Makefile.in: Rebuild.
15052
15053         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
15054         gcctestdir/ld.
15055         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
15056         * testsuite/Makefile.in: Rebuild.
15057
15058 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
15059
15060         * Makefile.am (POTFILES.in): Set LC_ALL=C.
15061         * Makefile.in: Regenerate.
15062         * po/POTFILES.in: Regenerate.
15063
15064 2008-07-29  Ian Lance Taylor  <iant@google.com>
15065
15066         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
15067         symbols before other symbols.
15068         * testsuite/script_test_2.cc (test_addr): Declare.
15069         (test_addr_alias): Declare.
15070         (main): Check that test_addr and test_addr_alias have the right
15071         values.
15072         * testsuite/script_test_2.t: Define test_addr_alias and
15073         test_addr.
15074
15075 2008-07-24  Ian Lance Taylor  <iant@google.com>
15076
15077         PR 5990
15078         * descriptors.cc: New file.
15079         * descriptors.h: New file.
15080         * gold-threads.h (class Hold_optional_lock): New class.
15081         * fileread.cc: Include "descriptors.h".
15082         (File_read::~File_read): Release descriptor rather than closing
15083         it.
15084         (File_read::open) [file]: Call open_descriptor rather than open.
15085         Set is_descriptor_opened_.
15086         (File_read::open) [memory]: Assert that descriptor is not open.
15087         (File_read::reopen_descriptor): New function.
15088         (File_read::release): Release descriptor.
15089         (File_read::do_read): Make non-const.  Reopen descriptor.
15090         (File_read::read): Make non-const.
15091         (File_read::make_view): Reopen descriptor.
15092         (File_read::do_readv): Likewise.
15093         * fileread.h (class File_read): Add is_descriptor_opened_ field.
15094         Update declarations.
15095         * layout.cc: Include "descriptors.h".
15096         (Layout::create_build_id): Use open_descriptor rather than open.
15097         * output.cc: Include "descriptors.h".
15098         (Output_file::open): Use open_descriptor rather than open.
15099         * archive.cc (Archive::const_iterator): Change Archive to be
15100         non-const.
15101         (Archive::begin, Archive::end): Make non-const.
15102         (Archive::count_members): Likewise.
15103         * archive.h (class Archive): Update declarations.
15104         * object.h (Object::read): Make non-const.
15105         * Makefile.am (CCFILES): Add descriptors.cc.
15106         (HFILES): Add descriptors.h.
15107         * Makefile.in: Rebuild.
15108
15109         PR 6716
15110         * gold.h: Always include <clocale>.  Add Solaris workarounds
15111         following code in binutils/sysdep.h.
15112
15113         PR 6048
15114         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
15115         this->eh_frame_hdr_ is NULL before using it.
15116
15117         * dynobj.cc (Versions::Versions): Update comment.
15118
15119         * dynobj.cc (Versions::Versions): If there is an soname, use it as
15120         the base version name.
15121
15122         * stringpool.cc (Stringpool_template::add_with_length): Set key to
15123         array size plus one.
15124         (Stringpool_template::set_string_offsets): Subtract one from key
15125         before using it as an array index.
15126         (Stringpool_template::get_offset_with_length): Likewise.
15127         (Stringpool_template::write_to_buffer): Likewise.
15128         * stringpool.h (Stringpool_template::get_offset_from_key):
15129         Likewise.
15130
15131 2008-07-23  Ian Lance Taylor  <iant@google.com>
15132
15133         PR 6658
15134         * object.h (Merged_symbol_value::value): Do our best to handle a
15135         negative addend.
15136
15137         PR 6647
15138         * script.cc (Version_script_info::get_versions): Don't add empty
15139         version tag to return value.
15140         (Version_script_info::get_symbol_version_helper): Change return
15141         type to bool.  Add pversion parameter.  Change all callers.
15142         (script_register_vers_node): Don't require a non-NULL tag.
15143         * script.h (class Version_script_info): Update declarations.
15144         (Version_script_info::get_symbol_version): Change return type to
15145         bool.  Add version parameter.  Change all callers.
15146         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
15147         handling.  Handle an empty version from a version script.
15148         (Symbol_table::define_special_symbol): Likewise.
15149         * testsuite/ver_test_10.script: New file.
15150         * testsuite/ver_test_10.sh: New file.
15151         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
15152         (check_DATA): Add ver_test_10.syms.
15153         (ver_test_10.syms, ver_test_10.so): New target.
15154         * testsuite/Makefile.in: Rebuild.
15155
15156 2008-07-23  Simon Baldwin  <simonb@google.com>
15157
15158         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
15159         to zero for undefined symbols from dynamic libraries.
15160
15161 2008-07-23  Ian Lance Taylor  <iant@google.com>
15162
15163         * symtab.cc (Symbol_table::resolve): Remove version parameter.
15164         Change all callers.
15165         * symtab.h (class Symbol_table): Update declaration.
15166         * testsuite/ver_test_9.cc: New file.
15167         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
15168         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
15169         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
15170         (ver_test_9.so, ver_test_9.o): New targets.
15171         * testsuite/Makefile.in: Rebuild.
15172
15173 2008-07-22  Ian Lance Taylor  <iant@google.com>
15174
15175         * options.h (class General_options): Define --check-sections.
15176         * layout.cc (Layout::set_segment_offsets): Handle
15177         --check-sections.
15178
15179         * options.h (class General_options): Define -n/--nmagic and
15180         -N/--omagic.
15181         * options.cc (General_options::finalize): For -n/--nmagic or
15182         -N/--omagic, set -static.
15183         * layout.cc (Layout::attach_allocated_section_to_segment): If
15184         -N/--omagic, don't put read-only and read-write sections in
15185         different segments.
15186         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
15187         finding a read-only segment.
15188         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
15189         don't set the minimum segment alignment to the common page size,
15190         and don't set the file offset to the address modulo the page size.
15191         * script-sections.cc (Script_sections::create_segments): If
15192         -n/--omagic, don't put read-only and read-write sections in
15193         different segments.
15194
15195         * cref.cc: New file.
15196         * cref.h: New file.
15197         * options.h (class General_options): Add --print-symbol-counts.
15198         * main.cc (main): Issue defined symbol report if requested.
15199         * archive.cc (Archive::interpret_header): Make into a const member
15200         function.
15201         (Archive::add_symbols): Call Input_objects::archive_start and
15202         archive_stop.
15203         (Archive::const_iterator): Define new class.
15204         (Archive::begin, Archive::end): New functions.
15205         (Archive::include_all_members): Rewrite to use iterator.
15206         (Archive::count_members): New function.
15207         * archive.h (class Archive): Update declarations.
15208         (Archive::filename): New function.
15209         * object.cc: Include "cref.h".
15210         (Sized_relobj::Sized_relobj): Initialize defined_count_.
15211         (Sized_relobj::do_get_global_symbol_counts): New function.
15212         (Input_objects::add_object): Add object to cross-referencer.
15213         (Input_objects::archive_start): New function.
15214         (Input_objects::archive_stop): New function.
15215         (Input_objects::print_symbol_counts): New function.
15216         * object.h: Declare Cref and Archive.
15217         (Object::get_global_symbol_counts): New function.
15218         (Object::do_get_global_symbol_counts): New pure virtual function.
15219         (class Sized_relobj): Add defined_count_ field.  Update
15220         declarations.
15221         (class Input_objects): Add cref_ field.  Update constructor.
15222         Update declarations.
15223         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
15224         defined_count_.
15225         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
15226         symbol counts.
15227         (Sized_dynobj::do_get_global_symbol_counts): New function.
15228         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
15229         defined_count_.  Update declarations.  Define Symbols typedef.
15230         * symtab.cc (Symbol_table::add_from_relobj): Add defined
15231         parameter.  Change all callers.
15232         (Symbol_table::add_from_dynobj): Add sympointers and defined
15233         parameters.  Change all callers.
15234         * symtab.h (class Symbol_table): Update declarations.
15235         * Makefile.am (CCFILES): Add cref.cc.
15236         (HFILES): Add cref.h.
15237         * Makefile.in: Rebuild.
15238
15239 2008-07-22  Simon Baldwin  <simonb@google.com>
15240
15241         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
15242         to zero when writing undefined symbols.
15243
15244 2008-07-22  Ian Lance Taylor  <iant@google.com>
15245
15246         * output.cc (Output_section::add_input_section): Don't try to
15247         merge empty merge sections.
15248
15249 2008-07-21  Craig Silverstein  <csilvers@google.com>
15250
15251         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15252         Include symbol version in error message.
15253
15254 2008-07-20  Chris Demetriou  <cgd@google.com>
15255
15256         * configure.ac (gold_cv_c_random_seed): New configured variable.
15257         (RANDOM_SEED_CFLAGS): New substituted variable.
15258         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
15259         * configure: Rebuild.
15260         * Makefile.in: Likewise.
15261         * testsuite/Makefile.in: Likewise.
15262
15263 2008-07-18  Ian Lance Taylor  <iant@google.com>
15264
15265         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
15266         where we see NAME/NULL and NAME/VERSION  as separate symbols.
15267         * testsuite/ver_test_main.cc (main): Call t4.
15268         (t4, t4_2a): Define.
15269         * testsuite/ver_test_2.cc (t4_2): Define.
15270         * testsuite/ver_test_2.script: Put t4_2a in VER2.
15271         * testsuite/ver_test_4.cc (t4_2a): Define.
15272         * testsuite/ver_test_4.script: Put t4_2a in VER2.
15273         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
15274
15275 2008-07-17  Ian Lance Taylor  <iant@google.com>
15276
15277         * dynobj.cc (Versions::add_def): If we give an error about a
15278         missing version, go ahead and create the version anyhow.
15279
15280 2008-07-10  Ian Lance Taylor  <iant@google.com>
15281
15282         Handle output sections with more than 0x7fffffff bytes.
15283         * object.h (class Relobj): Change map_to_output_ to
15284         output_sections_, and just keep a section pointer.  Change all
15285         uses.  Move comdat group support to Sized_relobj.
15286         (Relobj::is_section_specially_mapped): Remove.
15287         (Relobj::output_section): Remove poff parameter.  Change all
15288         callers.
15289         (Relobj::output_section_offset): New function.
15290         (Relobj::set_section_offset): Rewrite.
15291         (Relobj::map_to_output): Remove.
15292         (Relobj::output_sections): New function.
15293         (Relobj::do_output_section_offset): New pure virtual function.
15294         (Relobj::do_set_section_offset): Likewise.
15295         (class Sized_relobj): Add section_offsets_ field.  Add comdat
15296         group support from Relobj.  Update declarations.
15297         (Sized_relobj::get_output_section_offset): New function.
15298         (Sized_relobj::do_output_section_offset): New function.
15299         (Sized_relobj::do_set_section_offset): New function.
15300         * object.cc (Relobj::output_section_address): Remove.
15301         (Sized_relobj::Sized_relobj): Initialize new fields.
15302         (Sized_relobj::include_section_group): Cast find_kept_object to
15303         Sized_relobj.
15304         (Sized_relobj::include_linkonce_section): Likewise.
15305         (Sized_relobj::do_layout): Use separate arrays for output section
15306         and output offset.
15307         (Sized_relobj::do_count_local_symbols): Change map_to_output to
15308         output_sections.
15309         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
15310         output_sections and section_offsets.
15311         (Sized_relobj::write_local_symbols): Likewise.
15312         (map_to_kept_section): Compute output address directly.
15313         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
15314         output_sections and section_offsets.
15315         (Sized_relobj::write_sections): Likewise.
15316         (Sized_relobj::relocate_sections): Likewise.
15317         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
15318         * output.h (class Output_reloc): Update declarations.  Change
15319         u2_.relobj to Sized_relobj*.
15320         (class Output_data_reloc): Change add functions to use
15321         Sized_relobj*.
15322         * output.cc (Output_reloc::Output_reloc): Change relobj to
15323         Sized_relobj*.
15324         (Output_reloc::local_section_offset): Change return type to
15325         Elf_Addr.  Use get_output_section_offset.
15326         (Output_reloc::get_address): Likewise.
15327         (Output_section::is_input_address_mapped): Don't call
15328         is_section_specially_mapped.
15329         (Output_section::output_offset): Likewise.
15330         (Output_section::output_address): Likewise.
15331         (Output_section::starting_output_address): Likewise.
15332         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
15333         parameter to Sized_relobj*.
15334         (Copy_relocs::need_copy_reloc): Likewise.
15335         (Copy_relocs::save): Likewise.
15336         * copy-relocs.h (class Copy_relocs): Update declarations.
15337         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
15338         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
15339         * target-reloc.h (relocate_for_relocatable): Change
15340         offset_in_output_section type to Elf_Addr.  Change code that uses
15341         it as well.
15342         * layout.cc (Layout::layout): Always set *off.
15343         * mapfile.cc (Mapfile::print_input_section): Use
15344         output_section_offset.
15345         * i386.cc (Target_i386::copy_reloc): Change object parameter to
15346         Sized_relobj*.
15347         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
15348         * sparc.cc (Target_sparc::copy_reloc): Likewise.
15349         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
15350
15351 2008-07-03  Ian Lance Taylor  <iant@google.com>
15352
15353         * layout.cc (Layout::include_section): Do not discard unrecognized
15354         SHT_STRTAB sections.
15355
15356 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
15357
15358         * script.cc (Lex::can_continue_name): Make '?' allowable in
15359         version-script names.
15360         * testsuite/version_script.map: Change glob pattern to use '?'
15361
15362 2008-06-30  Manish Singh  <yosh@gimp.org>
15363
15364         PR 6585
15365         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
15366         Correct typo.
15367
15368 2008-06-30  Ian Lance Taylor  <iant@google.com>
15369
15370         PR 6660
15371         PR 6682
15372         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
15373         versions]: Don't try to read the value in the contents, since we
15374         don't use it.  Use the template endianness when writing.
15375
15376 2008-06-25  Cary Coutant  <ccoutant@google.com>
15377
15378         * fileread.cc (File_read::make_view): Assert on zero-length view.
15379         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
15380         symbol table when there are no symbols to read.
15381
15382 2008-06-23  Craig Silverstein  <csilvers@google.com>
15383
15384         * version.cc (version_string): Bump to 1.7
15385
15386 2008-06-18  Craig Silverstein  <csilvers@google.com>
15387
15388         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
15389         constant 0xFFFF to type Valtype.
15390         (Powerpc_relocate_functions::rel16_ha): Likewise.
15391
15392 2008-06-17  Ian Lance Taylor  <iant@google.com>
15393
15394         * output.h (Output_section::Input_section): Initialize p2align_ to
15395         zero for Output_section_data constructors.
15396         (Output_section::Input_section::addralign): If not an input
15397         section, return the alignment of the Output_section_data.
15398         * testsuite/copy_test.cc: New file.
15399         * testsuite/copy_test_1.cc: New file.
15400         * testsuite/copy_test_2.cc: New file.
15401         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
15402         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
15403         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
15404         (copy_test_1_pic.o, copy_test_1.so): New targets.
15405         (copy_test_2_pic.o, copy_test_2.so): New targets.
15406         * testsuite/Makefile.in: Rebuild.
15407
15408         * script-sections.cc (Script_sections::place_orphan): Initialize
15409         local variable exact.
15410
15411 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
15412
15413         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
15414
15415 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
15416             David S. Miller  <davem@davemloft.net>
15417
15418         * powerpc.cc: New file.
15419         * Makefile.am (TARGETSOURCES): Add powerpc.cc
15420         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
15421         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
15422         * Makefile.in: Rebuild.
15423
15424 2008-06-09  Ian Lance Taylor  <iant@google.com>
15425
15426         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
15427         <exception>.
15428         (throwing, orig_terminate): New static variables.
15429         (terminate_handler): New static function.
15430         (t2): Set terminate handler.
15431
15432 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
15433
15434         PR 6584
15435         * binary.cc (Binary_to_elf::sized_convert): Fix .data
15436         alignment.
15437
15438 2008-05-30  Cary Coutant  <ccoutant@google.com>
15439
15440         * archive.cc (Archive::include_all_members) Correct to step
15441         over symbol table and extended name table in thin archives.
15442
15443 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
15444
15445         PR 6407
15446         * target-reloc.h (relocate_for_relocatable): Fix new_offset
15447         calculation.
15448
15449 2008-05-28  Caleb Howe  <cshowe@google.com>
15450
15451         * reduced_debug_output.cc: New file.
15452         * reduced_debug_output.h: New file.
15453         * options.h (class General_options): Add --strip-debug-non-line.
15454         * options.cc (General_options::finalize): Add strip_debug_non_line
15455         to the strip heirarchy.
15456         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
15457         fields.
15458         * layout.cc: Include "reduced_debug_output.h".
15459         (Layout::Layout): Initialize new fields.
15460         (line_only_debug_sections): New static array.
15461         (is_lines_only_debug_sections): New static inline function.
15462         (Layout::include_section): Handle --strip-debug-non-line.
15463         (Layout::make_output_section): If --strip-debug-non-line, build
15464         new output sections for .debug_abbrev and .debug_info.
15465         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
15466         gold.  Warn about possible overflow.
15467         (read_signed_LEB_128): Likewise.
15468         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
15469         (read_signed_LEB_128): Declare.
15470         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
15471         (HFILES): Add reduced_debug_output.h.
15472         * Makefile.in: Rebuild.
15473
15474 2008-05-21  Ian Lance Taylor  <iant@google.com>
15475
15476         * mapfile.cc: New file.
15477         * mapfile.h: New file.
15478         * options.h (class General_options): Add -M/--print-map and -Map.
15479         * options.cc (General_options::finalize): Make -M equivalent to
15480         -Map -.
15481         * main.cc: Include <cstdio> and "mapfile.h".
15482         (main): Open mapfile if requested.
15483         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
15484         constructor.  Change caller.
15485         (queue_initial_tasks): Add mapfile parameter.  Change caller.
15486         (queue_middle_tasks): Likewise.
15487         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
15488         declarations.
15489         * archive.cc: Include "mapfile.h".
15490         (Archive::add_symbols): Add mapfile parameter.  Change all
15491         callers.  Pass mapfile, symbol, and reason to include_member.
15492         (Archive::include_all_members): Add mapfile parameter.  Change all
15493         callers.
15494         (Archive::include_member): Add mapfile, sym, and why parameters.
15495         Change all callers.  Report inclusion to map file.
15496         * archive.h: Include "fileread.h".
15497         (class Archive): Update declarations.
15498         (Archive::file): New const method.
15499         (class Add_archive_symbols): Add mapfile_ field.  Update
15500         constructor.  Change all callers.
15501         * readsyms.h (class Read_symbols): Likewise.
15502         (class Finish_group): Likewise.
15503         (class Read_script): Likewise.
15504         * common.cc: Include "mapfile.h".
15505         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
15506         all callers.
15507         (Symbol_table::do_allocate_commons): Likewise.
15508         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
15509         symbol allocation to mapfile.
15510         * common.h (class Allocate_commons_task): Add mapfile_ field.
15511         Update constructor.  Change all callers.
15512         * symtab.h (class Symbol_table): Update declarations.
15513         * layout.cc: Include "mapfile.h".
15514         (Layout_task_runner::run): Print information to mapfile.
15515         (Layout::create_gold_note): Change Output_data_fixed_space to
15516         Output_data_zero_fill.
15517         (Layout::create_build_id): Likewise.
15518         (Layout::print_to_mapfile): New function.
15519         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
15520         constructor.  Change caller.
15521         (class Layout): Declare print_to_mapfile.
15522         * output.cc (Output_section::Input_section::print_to_mapfile): New
15523         function.
15524         (Output_section::add_input_section): If producing a map, always
15525         add to input_sections_ list.
15526         (Output_section::do_print_to_mapfile): New function.
15527         (Output_segment::print_sections_to_mapfile): New function.
15528         (Output_segment::print_section_list_to_mapfile): New function.
15529         * output.h: Include "mapfile.h".
15530         (Output_data::print_to_mapfile): New function.
15531         (Output_data::do_print_to_mapfile): New virtual function.
15532         (Output_segment_headers::do_print_to_mapfile): New function.
15533         (Output_file_header::do_print_to_mapfile): New function.
15534         (Output_data_const::do_print_to_mapfile): New function.
15535         (class Output_data_const_buffer): Add map_name_ field.  Update
15536         constructor.  Change all callers.  Add do_print_to_mapfile
15537         function.
15538         (class Output_data_fixed_space): Likewise.
15539         (class Output_data_space): Likewise.
15540         (class Output_data_zero_fill): New class.
15541         (Output_data_strtab::do_print_to_mapfile): New function.
15542         (Output_data_reloc_base::do_print_to_mapfile): New function.
15543         (Output_relocatable_relocs::do_print_to_mapfile): New function.
15544         (Output_data_group::do_print_to_mapfile): New function.
15545         (Output_data_got::do_print_to_mapfile): New function.
15546         (Output_data_dynamic::do_print_to_mapfile): New function.
15547         (Output_symtab_xindex::do_print_to_mapfile): New function.
15548         (class Output_section): Declare do_print_to_mapflie.  Declare
15549         print_to_mapfile in Input_section.
15550         (class Output_segment): Declare new functions.
15551         * object.h (Sized_relobj::symbol_count): New function.
15552         * script-sections.cc
15553         (Output_section_element_dot_assignment::set_section_addresses):
15554         Change Output_data_fixed_space to Output_data_zero_fill.
15555         (Output_data_expression::do_print_to_mapfile): New function.
15556         * script.cc (read_input_script): Add mapfile parameter.  Change
15557         all callers.
15558         * script.h (read_input_script): Update declaration.
15559         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
15560         (Eh_frame::do_print_to_mapfile): New function.
15561         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
15562         (Output_merge_string::do_print_to_mapfile): New function.
15563         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
15564         function.
15565         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
15566         function.
15567         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
15568         function.
15569         * Makefile.am (CCFILES): Add mapfile.cc.
15570         (HFILES): Add mapfile.h.
15571         * Makefile.in: Rebuild.
15572
15573 2008-05-19  Ian Lance Taylor  <iant@google.com>
15574
15575         * options.h (class General_options): Add -z relro.
15576         * layout.cc (Layout::Layout): Initialize relro_segment_.
15577         (Layout::add_output_section_data): Return the output section.
15578         (Layout::make_output_section): Rcognize relro sections and mark
15579         them appropriately.
15580         (Layout::attach_allocated_section_to_segment): Put relro sections
15581         in a PT_GNU_RELRO segment.
15582         (Layout::create_initial_dynamic_sections): Mark the .dynamic
15583         section as relro.
15584         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
15585         PT_TLS segments.
15586         (Layout::linkonce_mapping): Map d.rel.ro.local to
15587         .data.rel.ro.local.
15588         (Layout::output_section_name): Us .data.rel.ro.local for any
15589         section which begins with that.
15590         * layout.h (class Layout): Update add_output_section_data
15591         declaration.  Add relro_segment_ field.
15592         * output.cc (Output_section::Output_section): Initialize is_relro_
15593         and is_relro_local_ fields.
15594         (Output_segment::add_output_section): Group relro sections.
15595         (Output_segment::is_first_section_relro): New function.
15596         (Output_segment::maximum_alignment): If there is a relro section,
15597         align the segment to the common page size.
15598         (Output_segment::set_section_addresses): Track whether we are
15599         looking at relro sections.  If the last section is a relro
15600         section, align to the common page size.
15601         (Output_segment::set_section_list_addresses): Add in_relro
15602         parameter.  Change all callers.  Align to the page size when
15603         moving from relro to non-relro section.
15604         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
15605         segment.
15606         * output.h (class Output_section): Add is_relro_ and
15607         is_relro_local_ fields.
15608         (Output_section::is_relro): New function.
15609         (Output_section::set_is_relro): New function.
15610         (Output_section::is_relro_local): New function.
15611         (Output_section::set_is_relro_local): New function.
15612         (class Output_segment): Update declarations.
15613         * i386.cc (Target_i386::got_section): Mark .got section as relro.
15614         * sparc.cc (Target_sparc::got_section): Likewise.
15615         * x86_64.cc (Target_x86_64::got_section): Likewise.
15616         * testsuite/relro_test_main.cc: New file.
15617         * testsuite/relro_test.cc: New file.
15618         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
15619         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
15620         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
15621         (relro_test.so, relro_test_pic.o): New targets.
15622         * testsuite/Makefile.in: Rebuild.
15623
15624 2008-05-16  Ian Lance Taylor  <iant@google.com>
15625
15626         * output.cc (Output_segment::add_output_section): Remove front
15627         parameter.
15628         * output.h (class Output_segment): Remove
15629         add_initial_output_section and overloaded add_output_section.
15630         Update declaration of remaining add_output_section.
15631         * layout.cc (Layout::create_interp): Call add_output_section
15632         rather than add_initial_output_section.
15633         (Layout::finish_dynamic_section): Likewise.
15634
15635         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
15636         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
15637         know the dynamic type.
15638         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
15639         field.  Initialize it in constructor.
15640         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
15641         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
15642         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
15643         reloc.
15644
15645         * output.cc (Output_reloc::get_address): Change return type to
15646         Elf_Addr.
15647         * output.h (class Output_reloc): Update get_address declaration.
15648         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
15649         for section addresses.
15650
15651 2008-05-09  Ian Lance Taylor  <iant@google.com>
15652
15653         PR 6493
15654         * gold.cc (gold_nomem): Use return value of write.
15655
15656 2008-05-08  Ian Lance Taylor  <iant@google.com>
15657
15658         * symtab.c (Symbol::init_base_output_data): Add version
15659         parameter.  Change all callers.
15660         (Symbol::init_base_output_segment): Likewise.
15661         (Symbol::init_base_constant): Likewise.
15662         (Symbol::init_base_undefined): Likewise.
15663         (Sized_symbol::init_output_data): Likewise.
15664         (Sized_symbol::init_output_segment): Likewise.
15665         (Sized_symbol::init_constant): Likewise.
15666         (Sized_symbol::init_undefined): Likewise.
15667         (Symbol_table::do_define_in_output_data): If the new symbol has a
15668         version, mark it as the default.
15669         (Symbol_table::do_define_in_output_segment): Likewise.
15670         (Symbol_table::do_define_as_constant): Likewise.
15671         * symtab.h (class Symbol): Update declarations.
15672         (class Sized_symbol): Likewise.
15673         * resolve.cc (Symbol::override_version): New function.
15674         (Symbol::override_base): Call override_version.
15675         (Symbol::override_base_with_special): Likewise.
15676         * testsuite/ver_script_8.script: New file.
15677         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
15678         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
15679         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
15680         (ver_test_8_1.so, ver_test_8_2.so): New targets.
15681
15682 2008-05-06  Ian Lance Taylor  <iant@google.com>
15683
15684         PR 6049
15685         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
15686         functions.
15687         (class General_options): Remove existing --undefined, and add
15688         --no-undefined instead.  Add new --undefined as synonym for -u.
15689         * archive.cc (Archive::add_symbols): Check whether symbol was
15690         named with -u.
15691         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
15692         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
15693         all uses.  Add IS_UNDEFINED.  Update declarations to split
15694         different versions of init_base.  Declare init_base_undefined.
15695         (Symbol::is_defined): Handle IS_UNDEFINED.
15696         (Symbol::is_undefined): Likewise.
15697         (Symbol::is_weak_undefined): Call is_undefined.
15698         (Symbol::is_absolute): Handle IS_CONSTANT.
15699         (class Sized_symbol): Update declarations to split different
15700         versions of init.  Declare init_undefined.
15701         (class Symbol_table): Declare new functions.
15702         * symtab.cc (Symbol::init_base_object): Rename from init_base.
15703         Change all callers.
15704         (Symbol::init_base_output_data): Likewise.
15705         (Symbol::init_base_output_segment): Likewise.
15706         (Symbol::init_base_constant): Likewise.
15707         (Symbol::init_base_undefined): New function.
15708         (Sized_symbol::init_object): Rename from init.  Change all
15709         callers.
15710         (Sized_symbol::init_output_data): Likewise.
15711         (Sized_symbol::init_output_segment): Likewise.
15712         (Sized_symbol::init_constant): Likewise.
15713         (Sized_symbol::init_undefined): New function.
15714         (Symbol_table::add_undefined_symbols_from_command_line): New
15715         function.
15716         (Symbol_table::do_add_undefined_symbols_from_command_line): New
15717         function.
15718         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
15719         (Symbol::output_section): Likewise.
15720         (Symbol::set_output_section): Likewise.
15721         (Symbol_table::sized_finalize_symbol): Likewise.
15722         (Symbol_table::sized_write_globals): Likewise.
15723         * resolve.cc (Symbol_table::should_override): Likewise.
15724         (Symbol::override_base_with_special): Likewise.
15725
15726         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
15727         symbol, change it to have default visibility.
15728         * testsuite/protected_1.cc: New file.
15729         * testsuite/protected_2.cc: New file.
15730         * testsuite/protected_3.cc: New file.
15731         * testsuite/protected_main_1.cc: New file.
15732         * testsuite/protected_main_2.cc: New file.
15733         * testsuite/protected_main_3.cc: New file.
15734         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
15735         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
15736         (protected_1_LDFLAGS, protected_1_LDADD): Define.
15737         (protected_1.so): New target.
15738         (protected_1_pic.o, protected_2_pic.o): New targets.
15739         (protected_3_pic.o): New target.
15740         (check_PROGRAMS): Add protected_2.
15741         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
15742         (protected_2_LDFLAGS, protected_2_LDADD): Define.
15743         * testsuite/Makefile.in: Rebuild.
15744
15745         * options.h (DEFINE_var): Add set_user_set_##varname__.
15746         (DEFINE_bool_alias): New macro.
15747         (class General_options): Define -Bstatic using DEFINE_bool_alias
15748         rather than DEFINE_special.  Add --undefined as an alias for -z
15749         defs.
15750         * options.cc (General_options::parse_Bstatic): Remove.
15751
15752         * options.h (class General_options): Add --fatal-warnings.
15753         * main.cc (main): Implement --fatal-warnings.
15754         * errors.h (Errors::warning_count): New function.
15755
15756         * options.h (class General_options): Add -Bsymbolic-functions.
15757         * symtab.h (Symbol::is_preemptible): Check for
15758         -Bsymbolic-functions.
15759
15760 2008-05-05  Ian Lance Taylor  <iant@google.com>
15761
15762         * options.h (DEFINE_bool): For DASH_Z, create the negative option
15763         as noVARNAME rather than no-VARNAME.
15764         (class General_options): Add option -z combreloc.
15765         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15766         get_address.
15767         (Output_reloc::sort_before) [SHT_REL]: New function.
15768         (Output_reloc::sort_before) [SHT_RELA]: New function.
15769         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
15770         Sort_relocs_comparison.
15771         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15772         parameter.  Change all callers.
15773         (Output_data_reloc::Output_data_reloc) [both versions]: Add
15774         sort_relocs parameter.  Change all callers.
15775         * output.cc (Output_reloc::get_address): New function, broken out
15776         of write_rel.
15777         (Output_reloc::write_rel): Call it.
15778         (Output_reloc::compare): New function.
15779         (Output_data_reloc_base::do_write): Optionally sort relocs.
15780
15781         * configure.ac: If targ_extra_obj is set, link it in.
15782         * configure.tgt: Initialize all variables.
15783         (x86_64*): Set targ_extra_obj and targ_extra_size.
15784         * configure: Rebuild.
15785
15786         * object.cc (Sized_relobj::include_section_group): Adjust section
15787         indexes read from group data.  Build vector to pass to
15788         layout_group.
15789         * layout.cc (Layout::layout_group): Add flags and shndxes
15790         parameters.  Remove contents parameter.  Change caller.  Update
15791         explicit instantiations.
15792         * layout.h (class Layout): Update layout_group declaration.
15793         * output.cc (Output_data_group::Output_data_group): Add flags and
15794         input_shndxes parameters.  Remove contents parameter.  Change
15795         caller.
15796         (Output_data_group::do_write): Change input_sections_ to
15797         input_shndxes_.
15798         * output.h (class Output_data_group): Update constructor
15799         declaration.  Rename input_sections_ to input_shndxes_.
15800         * testsuite/many_sections_test.cc: Add template.
15801
15802 2008-04-30  Cary Coutant  <ccoutant@google.com>
15803
15804         * target-reloc.h (relocate_section): Fix dead-pointer bug.
15805
15806         * layout.cc (Layout::include_section): Refactored check for debug
15807         info section.
15808         (Layout::add_comdat): Add new parameters.  Change type
15809         of signature parameter.  Add object and shndx to signatures table.
15810         (Layout::find_kept_object): New function.
15811         * layout.h: Include <cstring>.
15812         (Layout::is_debug_info_section): New function.
15813         (Layout::add_comdat): Add new parameters.
15814         (Layout::find_kept_object): New function.
15815         (Layout::Kept_section): New struct.
15816         (Layout::Signatures): Change type of map range.
15817         * object.cc (Relobj::output_section_address): New function.
15818         (Sized_relobj::include_section_group): Add new parameters.  Change
15819         calls to Layout::add_comdat.  Change to build table of kept comdat
15820         groups and table mapping discarded sections to kept sections.
15821         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
15822         (Sized_relobj::do_layout): Change calls to include_section_group and
15823         include_linkonce_section.
15824         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15825         value to zero when section is discarded.
15826         (Sized_relobj::map_to_kept_section): New function.
15827         * object.h (Relobj::output_section_address): New function.
15828         (Relobj::Comdat_group): New type.
15829         (Relobj::find_comdat_group): New function.
15830         (Relobj::Comdat_group_table): New type.
15831         (Relobj::Kept_comdat_section): New type.
15832         (Relobj::Kept_comdat_section_table): New type.
15833         (Relobj::add_comdat_group): New function.
15834         (Relobj::set_kept_comdat_section): New function.
15835         (Relobj::get_kept_comdat_section): New function.
15836         (Relobj::comdat_groups_): New field.
15837         (Relobj::kept_comdat_sections_): New field.
15838         (Symbol_value::input_value): Update comment.
15839         (Sized_relobj::map_to_kept_section) New function.
15840         (Sized_relobj::include_linkonce_section): Add new parameter.
15841         * target-reloc.h (Comdat_behavior): New type.
15842         (get_comdat_behavior): New function.
15843         (relocate_section): Add code to map a discarded section to the
15844         corresponding kept section when applying a relocation.
15845
15846 2008-04-30  Craig Silverstein  <csilvers@google.com>
15847
15848         * dwarf_reader.cc (next_generation_count): New static var.
15849         (Addr2line_cache_entry): New struct.
15850         (addr2line_cache): New static var.
15851         (Dwarf_line_info::one_addr2line): Added caching.
15852         (Dwarf_line_info::clear_addr2line_cache): New function.
15853         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
15854         cache-size parameter.
15855         (Dwarf_line_info::one_addr2line_cache): New function.
15856         * symtab.cc (Symbol_table::detect_odr_violations): Pass
15857         new cache-size argument to one_addr2line(), and clear cache.
15858
15859 2008-04-28  Cary Coutant  <ccoutant@google.com>
15860
15861         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
15862         R_386_PC8 relocations.
15863
15864 2008-04-23  Ian Lance Taylor  <iant@google.com>
15865
15866         * object.cc (Sized_relobj::include_section_group): Check for
15867         invalid section group.
15868
15869         * object.cc (make_elf_object): Correct test for 64-bit ELF file
15870         header size.
15871
15872         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
15873         than read for file header.
15874         * archive.cc (Archive::include_member): Likewise.
15875
15876 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
15877
15878         * aclocal.m4: Regenerate.
15879         * configure: Regenerate.
15880
15881 2008-04-19  Ian Lance Taylor  <iant@google.com>
15882
15883         * version.cc (version_string): Bump to 1.6.
15884
15885         * testsuite/Makefile.am (many_sections_r_test): New target.
15886         (many_sections_r_test_SOURCES): Remove.
15887         (many_sections_r_test_DEPENDENCIES): Remove.
15888         (many_sections_r_test_LDFLAGS): Remove.
15889         (many_sections_r_test_LDADD): Remove.
15890
15891         * object.cc (Sized_relobj::do_add_symbols): Always pass
15892         local_symbol_count_ to add_from_relobj.
15893
15894         * testsuite/Makefile.am (many_sections_check.h): Only check one in
15895         every thousand variables.
15896         * testsuite/Makefile.in: Rebuild.
15897
15898         * object.cc (Xindex::initialize_symtab_xindex): New function.
15899         (Xindex::read_symtab_xindex): New function.
15900         (Xindex::sym_xindex_to_shndx): New function.
15901         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
15902         available.
15903         (Sized_relobj::do_initialize_xindex): New function.
15904         (Sized_relobj::do_read_symbols): Adjust section links.
15905         (Sized_relobj::symbol_section_and_value): Add is_ordinary
15906         parameter.  Change all callers.
15907         (Sized_relobj::include_section_group): Adjust section links and
15908         symbol section indexes.
15909         (Sized_relobj::do_layout): Adjust section links.
15910         (Sized_relobj::do_count_local_symbols): Adjust section links and
15911         symbol section indexes.
15912         (Sized_relobj::do_finalize_local_symbols): Distinguish between
15913         ordinary and special symbols.
15914         (Sized_relobj::write_local_symbols): Add symtab_xindex and
15915         dynsym_xindex parameters.  Change all callers.  Adjust section
15916         links.  Use SHN_XINDEX when needed.
15917         (Sized_relobj::get_symbol_location_info): Adjust section links.
15918         Don't get fooled by special symbols.
15919         * object.h (class Xindex): Define.
15920         (class Object): Add xindex_ parameter.  Declare virtual functoin
15921         do_initialize_xindex.
15922         (Object::adjust_sym_shndx): New function.
15923         (Object::set_xindex): New protected function.
15924         (class Symbol_value): Add is_ordinary_shndx_ field.
15925         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15926         (Symbol_value::value): Assert ordinary section.
15927         (Symbol_value::initialize_input_to_output_map): Likewise.
15928         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15929         Change all callers.
15930         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
15931         all callers.
15932         (class Sized_relobj): Update declarations.
15933         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15934         parameter.  Change all callers.
15935         (Sized_relobj::adjust_shndx): New function.
15936         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15937         field.
15938         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15939         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
15940         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
15941         (Sized_dynobj::read_dynsym_section): Adjust section links.
15942         (Sized_dynobj::read_dynamic): Likewise.
15943         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
15944         section links.
15945         (Sized_dynobj::do_initialize_xindex): New function.
15946         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
15947         do_initialize_xindex.
15948         (Sized_dynobj::adjust_shndx): New function.
15949         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
15950         dynsym_xindex_ fields.
15951         (Layout::finalize): Add a call to set_section_indexes before
15952         creating the symtab sections.
15953         (Layout::set_section_indexes): Don't do anything if the section
15954         already has a section index.
15955         (Layout::create_symtab_sections): Add shnum parameter.  Change
15956         caller.  Create .symtab_shndx section if needed.
15957         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
15958         caller.
15959         (Layout::allocated_output_section_count): New function.
15960         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
15961         needed.
15962         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
15963         fields.  Update declarations.
15964         (Layout::symtab_xindex): New function.
15965         (Layout::dynsym_xindex): New function.
15966         (class Write_symbols_task): Add layout_ field.
15967         (Write_symbols_task::Write_symbols_task): Add layout parameter.
15968         Change caller.
15969         * output.cc (Output_section_headers::Output_section_headers): Add
15970         shstrtab_section parameter.  Change all callers.
15971         (Output_section_headers::do_sized_write): Store overflow values
15972         for section count and section string table section index in
15973         section header zero.
15974         (Output_file_header::do_sized_write): Check for overflow of
15975         section count and section string table section index.
15976         (Output_symtab_xindex::do_write): New function.
15977         (Output_symtab_xindex::endian_do_write): New function.
15978         * output.h (class Output_section_headers): Add shstrtab_section_.
15979         Update declarations.
15980         (class Output_symtab_xindex): Define.
15981         (Output_section::has_out_shndx): New function.
15982         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15983         field.
15984         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15985         Change all callers.
15986         (Sized_symbol::init): Likewise.
15987         (Symbol::output_section): Check for ordinary symbol.
15988         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
15989         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
15990         callers.
15991         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15992         Change all callers.  Simplify handling of symbols from sections
15993         not included in the link.
15994         (Symbol_table::add_from_dynobj): Handle ordinary symbol
15995         distinction.
15996         (Weak_alias_sorter::operator()): Assert that symbols are
15997         ordinary.
15998         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15999         distinction.
16000         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
16001         parameters.  Change all callers.
16002         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
16003         symbol distinction.  Use SHN_XINDEX when needed.
16004         (Symbol_table::write_section_symbol): Add symtab_xindex
16005         parameter.  Change all callers.
16006         (Symbol_table::sized_write_section_symbol): Likewise.  Use
16007         SHN_XINDEX when needed.
16008         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
16009         declarations.
16010         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
16011         (Symbol::is_defined): Check is_ordinary.
16012         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
16013         (Symbol::is_absolute, Symbol::is_common): Likewise.
16014         (class Sized_symbol): Update declarations.
16015         (class Symbol_table): Update declarations.
16016         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
16017         parameters.  Change all callers.
16018         (Sized_symbol::override): Likewise.
16019         (Symbol_table::override): Likewise.
16020         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
16021         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
16022         is_ordinary, and orig_st_shndx parameters.  Change all callers.
16023         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
16024         to be in an ordinary section.
16025         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
16026         object and is_ordinary parameters.  Change all callers.
16027         (Sized_dwarf_line_info::read_relocs): Add object parameter.
16028         Change all callers.  Don't add undefined or non-ordinary symbols
16029         to reloc_map_.
16030         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
16031         Change all callers.
16032         * dwarf_reader.h (class Sized_dwarf_line_info): Update
16033         declarations.
16034         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
16035         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
16036         (Sized_relobj::relocate_sections): Likewise.
16037         * target-reloc.h (scan_relocs): Adjust section symbol index.
16038         (scan_relocatable_relocs): Likewise.
16039         * i386.cc (Scan::local): Check for ordinary symbols.
16040         * sparc.cc (Scan::local): Likewise.
16041         * x86_64.cc (Scan::local): Likewise.
16042         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
16043         to symbol_section_and_value.
16044         * testsuite/many_sections_test.cc: New file.
16045         * testsuite/Makefile.am (BUILT_SOURCES): Define.
16046         (check_PROGRAMS): Add many_sections_test.
16047         (many_sections_test_SOURCES): Define.
16048         (many_sections_test_DEPENDENCIES): Define.
16049         (many_sections_test_LDFLAGS): Define.
16050         (BUILT_SOURCES): Add many_sections_define.h.
16051         (many_sections_define.h): New target.
16052         (BUILT_SOURCES): Add many_sections_check.h.
16053         (many_sections_check.h): New target.
16054         (check_PROGRAMS): Add many_sections_r_test.
16055         (many_sections_r_test_SOURCES): Define.
16056         (many_sections_r_test_DEPENDENCIES): Define.
16057         (many_sections_r_test_LDFLAGS): Define.
16058         (many_sections_r_test_LDADD): Define.
16059         (many_sections_r_test.o): New target.
16060         * testsuite/Makefile.in: Rebuild.
16061
16062 2008-04-17  Cary Coutant  <ccoutant@google.com>
16063
16064         * errors.cc (Errors::info): New function.
16065         (gold_info): New function.
16066         * errors.h (Errors::info): New function.
16067         * gold.h (gold_info): New function.
16068         * object.cc (Input_objects::add_object): Print trace output.
16069         * options.cc (options::parse_set): New function.
16070         (General_options::parse_wrap): Deleted.
16071         (General_options::General_options): Deleted initializer.
16072         * options.h (options::String_set): New typedef.
16073         (options::parse_set): New function.
16074         (DEFINE_set): New macro.
16075         (General_options::wrap): Changed to use DEFINE_set. Changed
16076         callers of any_wrap_symbols and is_wrap_symbol.
16077         (General_options::trace, General_options::trace_symbol):
16078         New options.
16079         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
16080         (General_options::wrap_symbols_): Deleted.
16081         * symtab.cc (Symbol_table::add_from_object): Print trace output.
16082
16083 2008-04-17  David S. Miller  <davem@davemloft.net>
16084
16085         * options.cc (General_options::parse_V): New function.
16086         * options.h: Add entries for -V and -Qy.
16087
16088 2008-04-17  Ian Lance Taylor  <iant@google.com>
16089
16090         * common.cc (Symbol_table::allocate_commons): Remove options
16091         parameter.  Change caller.
16092         (Symbol_table::do_allocate_commons): Remove options parameter.
16093         Change caller.  Just call do_allocate_commons_list twice.
16094         (Symbol_table::do_allocate_commons_list): New function, broken out
16095         of do_allocate_commons.
16096         * common.h (class Allocate_commons_task): Remove options_ field.
16097         Update constructor.
16098         * symtab.cc (Symbol_table::Symbol_table): Initialize
16099         tls_commons_.
16100         (Symbol_table::add_from_object): Put TLS common symbols on
16101         tls_commons_ list.
16102         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
16103         which are IN_OUTPUT_DATA.
16104         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
16105         allocate_commons and do_allocate_commons declarations.  Declare
16106         do_allocate_commons_list.
16107         * gold.cc (queue_middle_tasks): Update creation of
16108         Allocate_commons_task to not pass options.
16109         * testsuite/Makefile.am (INCLUDES): Add -I.. .
16110         (TLS_TEST_C_FLAGS): New variable.
16111         (tls_test_c_pic.o): New target.
16112         (tls_test_shared.so): Link in tls_test_c_pic.o.
16113         (tls_test_c_pic_ie.o): New target.
16114         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
16115         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
16116         (tls_test_c.o): New target.
16117         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
16118         (tls_pic_test_LDADD): Likewise.
16119         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
16120         (tls_shared_gd_to_ie_test_LDADD): Likewise.
16121         (tls_test_c_gnu2.o): New target.
16122         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
16123         tls_test_c_gnu2.o.
16124         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
16125         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
16126         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
16127         * testsuite/tls_test.cc: Include "config.h".
16128         (t_last): Call t11_last.
16129         * testsuite/tls_test.h (t11, t11_last): Declare.
16130         * testsuite/tls_test_c.c: New file.
16131         * testsuite/tls_test_main.cc (thread_routine): Call t11.
16132         * configure.ac: Check for OpenMP support.
16133         * configure, config.in, Makefile.in: Rebuild.
16134         * testsuite/Makefile.in: Rebuild.
16135
16136 2008-04-16  Cary Coutant  <ccoutant@google.com>
16137
16138         * i386.cc (Target_i386::define_tls_base_symbol): New function.
16139         (Target_i386::tls_base_symbol_defined_): New field.
16140         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16141         (Target_i386::Scan::global): Likewise.
16142         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
16143         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
16144         (Target_x86_64::tls_base_symbol_defined_): New field.
16145         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16146         (Target_x86_64::Scan::global): Likewise.
16147
16148 2008-04-16  Cary Coutant  <ccoutant@google.com>
16149
16150         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
16151         (Symbol::needs_plt_entry): Allow weak undefined symbols.
16152         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
16153         building shared libraries.
16154         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
16155         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
16156         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
16157         * testsuite/Makefile.in: Rebuild.
16158         * testsuite/weak_undef.h: New file.
16159         * testsuite/weak_undef_file1.cc: Add extra test cases.
16160         * testsuite/weak_undef_file2.cc: Likewise.
16161         * testsuite/weak_undef_test.cc: Likewise.
16162
16163 2008-04-16  David S. Miller  <davem@davemloft.net>
16164
16165         * sparc.cc (Target_sparc::Scan): Change from struct to class.
16166         Add issued_non_pic_error_ field.  Declare check_non_pic.
16167         (Target_sparc::Scan::check_non_pic): New function.
16168         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
16169         (Target_sparc::Scan::global): Likewise.
16170
16171         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
16172         * configure: Rebuild.
16173
16174         * options.h (DEFINE_enable): New macro.
16175         (new_dtags): New enable option.
16176         (initfirst, interpose, loadfltr, nodefaultlib,
16177         nodelete, nodlopen, nodump): New -z options.
16178         * layout.cc (Layout:finish_dynamic_section): If new
16179         dtags enabled, emit DT_RUNPATH.  Also, emit a
16180         DT_FLAGS_1 containing any specified -z flags.
16181
16182 2008-04-16  Ian Lance Taylor  <iant@google.com>
16183
16184         * copy-relocs.cc: New file.
16185         * copy-relocs.h: New file.
16186         * reloc.cc: Remove Copy_relocs code.
16187         * reloc.h: Likewise.
16188         * reloc-types.h (struct Reloc_types) [both versions]: Add
16189         get_reloc_addend_noerror.
16190         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
16191         variants of add_global which take an addend which must be zero.
16192         * i386.cc: Include "copy-relocs.h".
16193         (class Target_i386): Change type of copy_relocs_ to variable,
16194         update initializer.
16195         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
16196         Change all callers.
16197         (Target_i386::do_finalize_sections): Change handling of
16198         copy_relocs_.
16199         * sparc.cc: Include "copy-relocs.h".
16200         (class Target_sparc): Change type of copy_relocs_ to variable,
16201         update initializer.
16202         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
16203         Change all callers.
16204         (Target_sparc::do_finalize_sections): Change handling of
16205         copy_relocs_.
16206         * x86_64.cc: Include "copy-relocs.h".
16207         (class Target_x86_64): Change type of copy_relocs_ to variable,
16208         update initializer.
16209         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
16210         class.  Change all callers.
16211         (Target_x86_64::do_finalize_sections): Change handling of
16212         copy_relocs_.
16213         * Makefile.am (CCFILES): Add copy-relocs.cc.
16214         (HFILES): Add copy-relocs.h.
16215
16216         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
16217
16218         * testsuite/script_test_4.sh: Permit leading zeroes.
16219
16220 2008-04-15  Ian Lance Taylor  <iant@google.com>
16221
16222         * script-sections.cc (Script_sections::create_segments): Use
16223         header_size_adjustment even when there is enough room for the
16224         headers.
16225         * testsuite/script_test_4.sh: New file.
16226         * testsuite/script_test_4.t: New file.
16227         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
16228         (check_DATA): Add script_test_4.stdout.
16229         (MOSTLYCLEANFILES): Likewise.
16230         (script_test_4): New target.
16231         (script_test_4.stdout): New target.
16232         * testsuite/Makefile.in: Rebuild.
16233
16234         * sparc.cc: Add definitions for Output_data_plt_sparc class
16235         constants.
16236
16237 2008-04-14  David S. Miller  <davem@davemloft.net>
16238
16239         * sparc.cc: New file.
16240         * Makefile.am (TARGETSOURCES): Add sparc.cc
16241         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
16242         * configure.tgt: Document targ_extra_size and
16243         targ_extra_big_endian.  Add entries for sparc-* and
16244         sparc64-*.
16245         * configure.ac: Handle targ_extra_size and
16246         targ_extra_big_endian.
16247         * Makefile.in: Rebuild.
16248         * configure: Likewise.
16249         * po/POTFILES.in: Likewise.
16250         * po/gold.pot: Likewise.
16251
16252 2008-04-14  Ian Lance Taylor  <iant@google.com>
16253
16254         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
16255         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
16256         in the name/type/flags to section mapping.  Don't call
16257         allocate_output_section.
16258         (Layout::choose_output_section): Change parameter from adjust_name
16259         to is_input_section.  Don't permit input sections after sections
16260         are attached to segments.  Don't call allocate_output_section.
16261         (Layout::layout_eh_frame): Call update_flags_for_input_section,
16262         not write_enable_output_section.
16263         (Layout::make_output_section): Don't push to
16264         unattached_section_list_ nor call attach_to_segment.  Call
16265         attach_section_to_segment if sections are attached.
16266         (Layout::attach_sections_to_segments): New function.
16267         (Layout::attach_section_to_segment): New function.
16268         (Layout::attach_allocated_section_to_segment): Rename from
16269         attach_to_segment.  Remove flags parameter.
16270         (Layout::allocate_output_section): Remove function.
16271         (Layout::write_enable_output_section): Remove function.
16272         * layout.h (class Layout): Update for above changes.  Add new
16273         field sections_are_attached_.
16274         * output.h (Output_section::update_flags_for_input_section): New
16275         function.
16276         * output.cc (Output_section::add_input_section): Call
16277         update_flags_for_input_section.
16278         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
16279
16280 2008-04-11  Cary Coutant  <ccoutant@google.com>
16281
16282         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
16283         thought unnecessary.
16284         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
16285
16286 2008-04-11  Ian Lance Taylor  <iant@google.com>
16287
16288         * output.h (class Output_section_data): Remove inline definition
16289         of set_addralign.
16290         * output.cc (Output_section_data::set_addralign): New function.
16291
16292 2008-04-11  Cary Coutant  <ccoutant@google.com>
16293
16294         Add support for TLS descriptors for i386 and x86_64.
16295         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
16296         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
16297         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
16298         GOT_TYPE_TLS_DESC.
16299         (Target_i386::got_mod_index_entry): Remove unnecessary code.
16300         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
16301         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
16302         relocations.
16303         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
16304         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
16305         Fix problem with initial-exec relocations.
16306         (Target_i386::Relocate::relocate_tls): Likewise.
16307         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
16308         relaxation.
16309         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
16310         support for section-plus-offset dynamic table entries.
16311         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
16312         (Output_data_dynamic::Dynamic_entry): Add support for
16313         section-plus-offset dynamic table entries.
16314         (Output_data_dynamic::Classification): Likewise.
16315         (Output_data_dynamic::classification_): Renamed offset_.
16316         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
16317         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
16318         (Target_x86_64::make_plt_section): New function.
16319         (Target_x86_64::reserve_tlsdesc_entries): New function.
16320         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
16321         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
16322         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
16323         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
16324         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
16325         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
16326         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
16327         add extra PLT entry for TLS descriptors.
16328         (Output_data_plt_x86_64::got_): New field.
16329         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
16330         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
16331         fields.
16332         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
16333         descriptors.
16334         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
16335         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
16336         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
16337         R_386_TLS_DESC_CALL relocations.
16338         (Target_x86_64::Scan::global): Likewise.
16339         (Target_x86_64::do_finalize_sections): Add dynamic table entries
16340         for TLS descriptors.
16341         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
16342         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
16343         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
16344         GD-to-IE relaxation.
16345         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
16346         and TLS_DESCRIPTORS.
16347         * Makefile.in: Rebuild.
16348         * configure: Rebuild.
16349         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
16350         (tls_test_shared2.so): New target.
16351         (tls_shared_gd_to_ie_test_SOURCES): New variable.
16352         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
16353         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
16354         (tls_shared_gd_to_ie_test_LDADD): New variable.
16355         (tls_shared_gnu2_gd_to_ie_test): New target.
16356         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
16357         New targets.
16358         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
16359         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
16360         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
16361         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
16362         (tls_shared_gnu2_test): New target.
16363         (tls_test_gnu2_shared.so): New target.
16364         (tls_shared_gnu2_test_SOURCES): New variable.
16365         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
16366         (tls_shared_gnu2_test_LDFLAGS): New variable.
16367         (tls_shared_gnu2_test_LDADD): New variable.
16368         * testsuite/Makefile.in: Rebuild.
16369         * testsuite/Makefile.
16370
16371 2008-04-11  Ian Lance Taylor  <iant@google.com>
16372
16373         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
16374         justsyms.t.
16375         * testsuite/Makefile.in: Rebuild.
16376
16377         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
16378         long.
16379         * testsuite/script_test_2.cc (main): Adjust test.
16380
16381 2008-04-11  David S. Miller  <davem@davemloft.net>
16382             Ian Lance Taylor  <iant@google.com>
16383
16384         * options.h (General_options): Add entries for '-Y' and
16385         '-relax'.
16386         * options.cc (General_options:finalize): If -Y was used, add those
16387         entries to the library path instead of the default "/lib" and
16388         "/usr/lib".
16389
16390 2008-04-11  David S. Miller  <davem@davemloft.net>
16391
16392         * testsuite/justsyms.t: Start at 0x100.
16393         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
16394         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
16395         long.
16396         * testsuite/script_test_2.cc: Adjust string and section length
16397         checks.
16398
16399 2008-04-09  Ian Lance Taylor  <iant@google.com>
16400
16401         PR gold/5996
16402         * script-sections.cc (Sections_element::allocate_to_segment): Add
16403         orphan parameter.
16404         (Output_section_definition::allocate_to_segment): Likewise.
16405         (Orphan_output_section::allocate_to_segment): Likewise.
16406         (Script_sections::attach_sections_using_phdrs_clause): Don't
16407         propagate non-PT_LOAD segments to orphan sections.
16408         * testsuite/Makefile.am (script_test_3.stdout): Generate using
16409         readelf rather than objdump.
16410         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
16411         .interp section and PT_INTERP segment are the same size.
16412         * testsuite/Makefile.in: Rebuild.
16413
16414         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
16415         aliases for symbols defined in the same object.
16416         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
16417         (weak_alias_test_SOURCES): New variable.
16418         (weak_alias_test_DEPENDENCIES): New variable.
16419         (weak_alias_test_LDFLAGS): New variable.
16420         (weak_alias_test_LDADD): New variable.
16421         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
16422         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
16423         (weak_alias_test_3.o): New target.
16424         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
16425         * testsuite/weak_alias_test_main.cc: New file.
16426         * testsuite/weak_alias_test_1.cc: New file.
16427         * testsuite/weak_alias_test_2.cc: New file.
16428         * testsuite/weak_alias_test_3.cc: New file.
16429
16430 2008-04-08  Ian Lance Taylor  <iant@google.com>
16431
16432         * options.h (class General_options): Add --noinhibit-exec option.
16433         * main.cc (main): Check --noinhibit-exec.
16434
16435         * options.h (class General_options): Define --wrap as a special
16436         option.  Add wrap_symbols_ field.
16437         (General_options::any_wrap_symbols): New function.
16438         (General_options::is_wrap_symbol): New function.
16439         * options.cc (General_options::parse_wrap): New function.
16440         (General_options::General_options): Initialize wrap_symbols_.
16441         * symtab.cc (Symbol_table::wrap_symbol): New function.
16442         (Symbol_table::add_from_object): Handle --wrap.
16443         * symtab.h (class Symbol_table): Declare wrap_symbol.
16444         * target.h (Target::wrap_char): New function.
16445         (Target::Target_info): Add wrap_char field.
16446         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
16447         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
16448         * testsuite/testfile.cc (Target_test::test_target_info):
16449         Likewise.
16450
16451         * errors.cc (Errors::undefined_symbol): Mention symbol version if
16452         there is one.
16453
16454         * layout.h (class Layout): Add added_eh_frame_data_ field.
16455         * layout.cc (Layout::Layout): Initialize new field.
16456         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
16457         output section until we find a section we merged successfully.
16458         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
16459         that the size be non-zero.
16460
16461         * merge.cc (Object_merge_map::get_output_offset): Remove inline
16462         qualifier.
16463
16464 2008-04-08  Craig Silverstein  <csilvers@google.com>
16465
16466         * configure.ac: Export new conditional variable HAVE_ZLIB.
16467         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
16468         on HAVE_ZLIB.
16469         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
16470         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16471
16472 2008-04-07  Ian Lance Taylor  <iant@google.com>
16473
16474         * version.cc (version_string): Set to "1.5".
16475
16476         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
16477         Add issued_non_pic_error_ field.  Declare check_non_pic.
16478         (Target_x86_64::Scan::check_non_pic): New function.
16479         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
16480         (Target_x86_64::Scan::global): Likewise.
16481
16482         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
16483         addend parameter.  Change caller.  Handle merge sections.
16484         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
16485         Address to Addend.  Don't add in the result of
16486         local_section_offset, pass down the addend and use the returned
16487         value.
16488         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
16489         Update declarations of local_section_offset and symbol_value.
16490         * testsuite/two_file_test_1.cc (t18): New function.
16491         * testsuite/two_file_test_2.cc (f18): New function.
16492         * testsuite/two_file_test_main.cc (main): Call t18.
16493         * testsuite/two_file_test.h (t18, f18): Declare.
16494
16495         * configure.ac: Don't test for objdump, c++filt, or readelf.
16496         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
16497         conditionals.
16498         (TEST_READELF): New variable.
16499         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
16500         (check_PROGRAMS): Add two_file_strip_test.
16501         (two_file_strip_test): New target.
16502         (check_PROGRAMS): Add two_file_same_shared_strip_test.
16503         (two_file_same_shared_strip_test_SOURCES): New variable.
16504         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
16505         (two_file_same_shared_strip_test_LDFLAGS): New variable.
16506         (two_file_same_shared_strip_test_LDADD): New variable.
16507         (two_file_shared_strip.so): New target.
16508         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
16509         (ver_test_5.syms, ver_test_7.syms): Likewise.
16510         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
16511         (strip_test_3.stdout): Use TEST_OBJDUMP.
16512         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16513
16514 2008-04-04  Cary Coutant  <ccoutant@google.com>
16515
16516         * symtab.h (Symbol::is_weak_undefined): New function.
16517         (Symbol::is_strong_undefined): New function.
16518         (Symbol::is_absolute): New function.
16519         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
16520         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
16521         absolute symbols.
16522         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
16523         (weak_undef_test): New target.
16524         * testsuite/Makefile.in: Rebuild.
16525         * testsuite/weak_undef_file1.cc: New file.
16526         * testsuite/weak_undef_file2.cc: New file.
16527         * testsuite/weak_undef_test.cc: New file.
16528
16529 2008-04-03  Craig Silverstein  <csilvers@google.com>
16530
16531         * compressed_output.h (class Output_compressed_section): Use
16532         unsigned buffer.
16533         * compressed_output.cc (zlib_compress): Use unsigned buffers,
16534         add zlib header.
16535         (zlib_compressed_suffix): Removed.
16536         (Output_compressed_section::set_final_data_size): Use unsigned
16537         buffers.
16538         * testsuite/Makefile.am (flagstest_compress_debug_sections):
16539         Fix linker invocation.
16540         (flagstest_o_specialfile_and_compress_debug_sections):
16541         Likewise.
16542         * testsuite/Makefile.in: Regenerated.
16543
16544 2008-04-02  David S. Miller  <davem@davemloft.net>
16545
16546         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
16547         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
16548
16549 2008-04-02  Craig Silverstein  <csilvers@google.com>
16550
16551         * TODO: New file.
16552
16553 2008-04-02  Ian Lance Taylor  <iant@google.com>
16554
16555         * fileread.cc (File_read::find_view): Add byteshift and vshifted
16556         parameters.  Update for new key type to views_.  Change all
16557         callers.
16558         (File_read::read): Adjust for byteshift in returned view.
16559         (File_read::add_view): New function, broken out of
16560         find_and_make_view.
16561         (File_read::make_view): New function, broken out of
16562         find_and_make_view.
16563         (File_read::find_or_make_view): Add offset and aligned
16564         parameters.  Rewrite accordingly.  Change all callers.
16565         (File_read::get_view): Add offset and aligned parameters.  Adjust
16566         for byteshift in return value.
16567         (File_read::get_lasting_view): Likewise.
16568         * fileread.h (class File_read): Update declarations.
16569         (class File_read::View): Add byteshift_ field.  Add byteshift to
16570         constructor.  Add byteshift method.
16571         * archive.h (Archive::clear_uncached_views): New function.
16572         (Archive::get_view): Add aligned parameter.  Change all callers.
16573         * object.h (Object::get_view): Add aligned parameter.  Change all
16574         callers.
16575         (Object::get_lasting_view): Likewise.
16576
16577         * fileread.cc (File_read::release): Don't call clear_views if
16578         there are multiple objects.
16579         * fileread.h (File_read::clear_uncached_views): New function.
16580         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
16581         on the archive.
16582
16583 2008-03-31  Cary Coutant  <ccoutant@google.com>
16584
16585         Add thin archive support.
16586         * archive.cc (Archive::armagt): New const.
16587         (Archive::setup): Remove task parameter and calls to unlock.
16588         (Archive::unlock_nested_archives): New function.
16589         (Archive::read_header): Add nested_off parameter. Change
16590         all callers.
16591         (Archive::interpret_header): Likewise.
16592         (Archive::include_all_members): Change to handle thin
16593         archives.
16594         (Archive::include_member): Likewise.
16595         * archive.h (Archive::Archive): Add new parameters and
16596         initializers.
16597         (Archive::armagt): New const.
16598         (Archive::setup): Remove task parameter.
16599         (Archive::unlock_nested_archives): New function.
16600         (Archive::read_header): Add nested_off parameter.
16601         (Archive::interpret_header): Likewise.
16602         (Archive::Nested_archive_table): New typedef.
16603         (Archive::is_thin_archive_): New field.
16604         (Archive::nested_archives_): New field.
16605         (Archive::options_): New field.
16606         (Archive::dirpath_): New field.
16607         (Archive::task_): New field.
16608         * readsyms.cc (Read_symbols::do_read_symbols): Add check
16609         for thin archives.  Pass additional parameters to
16610         Archive::Archive.  Unlock the archive file after calling
16611         Archive::setup.
16612
16613 2008-03-29  Ian Lance Taylor  <iant@google.com>
16614
16615         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
16616         version symbol to be local.
16617         * testsuite/ver_test_4.sh: New file.
16618         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
16619         (check_DATA): Add ver_test_4.syms.
16620         (ver_test_4.syms): New target.
16621         * testsuite/Makefile.in: Rebuild.
16622
16623         * output.cc
16624         (Output_section::Input_section_sort_entry::has_priority): New
16625         function.
16626         (Output_section::Input_section_sort_entry::match_file_name): New
16627         function.
16628         (Output_section::Input_section_sort_entry::match_section_name):
16629         Remove.
16630         (Output_section::Input_section_sort_entry::match_section_name_prefix):
16631         Remove.
16632         (Output_section::Input_section_sort_entry::match_section_file):
16633         Remove.
16634         (Output_section::Input_section_sort_compare::operator()): Rewrite
16635         using new Input_section_sort_entry functions.  Sort crtbegin and
16636         crtend first.  Sort sections with no priority before sections with
16637         a priority.
16638         * testsuite/initpri1.c (d3): Check j != 4.
16639         (cd5): New constructor/destructor function.
16640         (main): Check j != 2.
16641
16642         * symtab.cc (Symbol_table::add_from_object): If we don't use the
16643         new symbol when resolving, don't call set_is_default.
16644         * testsuite/ver_test_7.cc: New file.
16645         * testsuite/ver_test_7.sh: New file.
16646         * testsuite/Makefile.am (ver_test_7.so): New target.
16647         (ver_test_7.o): New target.
16648         (check_SCRIPTS): Add ver_test_7.sh.
16649         (check_DATA): Add ver_test_7.syms.
16650         (ver_test_7.syms): New target.
16651
16652 2008-03-28  Ian Lance Taylor  <iant@google.com>
16653
16654         * layout.cc (Layout::layout): If we see an input section with a
16655         name that needs sorting, set the must_sort flag for the output
16656         section.
16657         (Layout::make_output_section): If the name of the output section
16658         indicates that it might require sorting, set the may_sort flag.
16659         * output.h (Output_section::may_sort_attached_input_sections): New
16660         function.
16661         (Output_section::set_may_sort_attached_input_sections): New
16662         function.
16663         (Output_section::must_sort_attached_input_sections): New
16664         function.
16665         (Output_section::set_must_sort_attached_input_sections): New
16666         function.
16667         (class Output_section): Declare Input_section_sort_entry.  Define
16668         Input_section_sort_compare.  Declare
16669         sort_attached_input_sections.  Add new fields:
16670         may_sort_attached_input_sections_,
16671         must_sort_attached_input_sections_,
16672         attached_input_sections_are_sorted_.
16673         * output.cc (Output_section::Output_section): Initialize new
16674         fields.
16675         (Output_section::add_input_section): Add an entry to
16676         input_sections_ if may_sort or must_sort are true.
16677         (Output_section::set_final_data_size): Call
16678         sort_attached_input_sections if necessary.
16679         (Output_section::Input_section_sort_entry): Define new class.
16680         (Output_section::Input_section_sort_compare::operator()): New
16681         function.
16682         (Output_section::sort_attached_input_sections): New function.
16683         * configure.ac: Check whether the compiler supports constructor
16684         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
16685         * testsuite/initpri1.c: New file.
16686         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
16687         CONSTRUCTOR_PRIORITY.
16688         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
16689         (initpri1_LDFLAGS): New variable.
16690         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16691
16692 2008-03-27  Ian Lance Taylor  <iant@google.com>
16693
16694         * common.cc (Sort_commons::operator): Correct sorting algorithm.
16695         * testsuite/common_test_1.c: New file.
16696         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
16697         (common_test_1_SOURCES): New variable.
16698         (common_test_1_DEPENDENCIES): New variable.
16699         (common_test_1_LDFLAGS): New variable.
16700
16701         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
16702         and commons_ correctly when NAME/VERSION does not override
16703         NAME/NULL.
16704         * testsuite/ver_test_6.c: New file.
16705         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
16706         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
16707         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
16708
16709 2008-03-26  Ian Lance Taylor  <iant@google.com>
16710
16711         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
16712         of an undefined symbol from a version script.
16713         * testsuite/Makefile.am (ver_test_5.so): New target.
16714         (ver_test_5.o): New target.
16715         (check_SCRIPTS): Add ver_test_5.sh.
16716         (check_DATA): Add ver_test_5.syms.
16717         (ver_test_5.syms): New target.
16718         * testsuite/ver_test_5.cc: New file.
16719         * testsuite/ver_test_5.script: New file.
16720         * testsuite/ver_test_5.sh: New file.
16721         * Makefile.in, testsuite/Makefile.in: Rebuild.
16722
16723         PR gold/5986
16724         Fix problems building gold with gcc 4.3.0.
16725         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
16726         (gold_error_at_location, gold_warning_at_location): Use it.
16727         * configure.ac: Check whether we can compile and use a template
16728         function with a printf attribute.
16729         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
16730         when jumping over bytes.
16731         * object.cc: Instantiate Object::read_section_data.
16732         * debug.h: Include <cstring>
16733         * dwarf_reader.cc: Include <algorithm>
16734         * main.cc: Include <cstring>.
16735         * options.cc: Include <cstring>.
16736         * output.cc: Include <cstring>.
16737         * script.cc: Include <cstring>.
16738         * script.h: Include <string>.
16739         * symtab.cc: Include <cstring> and <algorithm>.
16740         * target-select.cc: Include <cstring>.
16741         * version.cc: Include <string>.
16742         * testsuite/testmain.cc: Include <cstdlib>.
16743         * configure, config.in: Rebuild.
16744
16745 2008-03-25  Ian Lance Taylor  <iant@google.com>
16746
16747         * options.cc: Include "../bfd/bfdver.h".
16748         (options::help): Print bug reporting address.
16749
16750         * version.cc (print_version): Adjust output for current value of
16751         BFD_VERSION_STRING.
16752
16753         * NEWS: New file.
16754
16755         * options.cc (options::help): Print list of supported targets.
16756         * target-select.h: Include <vector>.
16757         (class Target_selector): Make machine_, size_, and is_big_endian_
16758         fields const.  Add bfd_name_ and instantiated_target_ fields.
16759         (Target_selector::Target_selector): Add bfd_name parameter.
16760         (Target_selector::recognize): Make non-virtual, call
16761         do_recognize.
16762         (Target_selector::recognize_by_name): Make non-virtual, call
16763         do_recognize_by_name.
16764         (Target_selector::supported_names): New function.
16765         (Target_selector::bfd_name): New function.
16766         (Target_selector::do_instantiate_target): New pure virtual
16767         function.
16768         (Target_selector::do_recognize): New virtual function.
16769         (Target_selector::do_recognize_by_name): New virtual function.
16770         (Target_selector::instantiate_target): New private function.
16771         (supported_target_names): Declare.
16772         * target-select.cc (Target_selector::Target_selector): Update for
16773         new parameter and fields.
16774         (select_target_by_name): Check that the name matches before
16775         calling recognize_by_name.
16776         (supported_target_names): New function.
16777         * i386.cc (class Target_selector_i386): Update Target_selector
16778         constructor call.  Remove recognize and recognize_by_name.  Add
16779         do_instantiate_target.
16780         * x86_64.cc (class Target_selector_x86_64): Likewise.
16781         * testsuite/testfile.cc (class Target_selector_test): Update for
16782         changes to Target_selector.
16783
16784         * README: Rewrite, with some notes on unsupported features.
16785
16786 2008-03-24  Cary Coutant  <ccoutant@google.com>
16787
16788         * i386.cc (Target_i386::Got_type): New enum declaration.
16789         (Target_i386::Scan::local): Updated callers of Output_data_got
16790         member functions.
16791         (Target_i386::Scan::global): Likewise.
16792         (Target_i386::Relocate::relocate): Likewise.
16793         (Target_i386::Relocate::relocate_tls): Likewise.
16794         * object.h (Got_offset_list): New class.
16795         (Sized_relobj::local_has_got_offset): Added got_type parameter.
16796         (Sized_relobj::local_got_offset): Likewise.
16797         (Sized_relobj::set_local_got_offset): Likewise.
16798         (Sized_relobj::local_has_tls_got_offset): Removed.
16799         (Sized_relobj::local_tls_got_offset): Removed.
16800         (Sized_relobj::set_local_tls_got_offset): Removed.
16801         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16802         * output.cc (Output_data_got::add_global): Added got_type parameter.
16803         (Output_data_got::add_global_with_rel): Likewise.
16804         (Output_data_got::add_global_with_rela): Likewise.
16805         (Output_data_got::add_global_pair_with_rel): New function.
16806         (Output_data_got::add_global_pair_with_rela): New function.
16807         (Output_data_got::add_local): Added got_type parameter.
16808         (Output_data_got::add_local_with_rel): Likewise.
16809         (Output_data_got::add_local_with_rela): Likewise.
16810         (Output_data_got::add_local_pair_with_rel): New function.
16811         (Output_data_got::add_local_pair_with_rela): New function.
16812         (Output_data_got::add_global_tls): Removed.
16813         (Output_data_got::add_global_tls_with_rel): Removed.
16814         (Output_data_got::add_global_tls_with_rela): Removed.
16815         (Output_data_got::add_local_tls): Removed.
16816         (Output_data_got::add_local_tls_with_rel): Removed.
16817         (Output_data_got::add_local_tls_with_rela): Removed.
16818         * output.h (Output_data_got::add_global): Added got_type parameter.
16819         (Output_data_got::add_global_with_rel): Likewise.
16820         (Output_data_got::add_global_with_rela): Likewise.
16821         (Output_data_got::add_global_pair_with_rel): New function.
16822         (Output_data_got::add_global_pair_with_rela): New function.
16823         (Output_data_got::add_local): Added got_type parameter.
16824         (Output_data_got::add_local_with_rel): Likewise.
16825         (Output_data_got::add_local_with_rela): Likewise.
16826         (Output_data_got::add_local_pair_with_rel): New function.
16827         (Output_data_got::add_local_pair_with_rela): New function.
16828         (Output_data_got::add_global_tls): Removed.
16829         (Output_data_got::add_global_tls_with_rel): Removed.
16830         (Output_data_got::add_global_tls_with_rela): Removed.
16831         (Output_data_got::add_local_tls): Removed.
16832         (Output_data_got::add_local_tls_with_rel): Removed.
16833         (Output_data_got::add_local_tls_with_rela): Removed.
16834         * resolve.cc (Symbol::override_base_with_special): Removed
16835         reference to has_got_offset_ field.
16836         * symtab.cc (Symbol::init_fields): Replaced initialization
16837         of got_offset_ with got_offsets_.  Removed initialization
16838         of has_got_offset_
16839         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
16840         (Symbol::got_offset): Likewise.
16841         (Symbol::set_got_offset): Likewise.
16842         (Symbol::has_tls_got_offset): Removed.
16843         (Symbol::tls_got_offset): Removed.
16844         (Symbol::set_tls_got_offset): Removed.
16845         (Symbol::got_offset_): Removed.
16846         (Symbol::tls_mod_got_offset_): Removed.
16847         (Symbol::tls_pair_got_offset_): Removed.
16848         (Symbol::got_offsets_): New field.
16849         (Symbol::has_got_offset): Removed.
16850         (Symbol::has_tls_mod_got_offset): Removed.
16851         (Symbol::has_tls_pair_got_offset): Removed.
16852         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
16853         (Target_x86_64::Scan::local): Updated callers of Output_data_got
16854         member functions.
16855         (Target_x86_64::Scan::global): Likewise.
16856         (Target_x86_64::Relocate::relocate): Likewise.
16857         (Target_x86_64::Relocate::relocate_tls): Likewise.
16858
16859 2008-03-25  Ben Elliston  <bje@au.ibm.com>
16860
16861         * yyscript.y: Fix spelling error in comment.
16862
16863 2008-03-24  Ian Lance Taylor  <iant@google.com>
16864
16865         * options.h (class General_options): Define build_id option.
16866         * layout.h (class Layout): Declare write_build_id, create_note,
16867         create_build_id.  Add build_id_note_ member.
16868         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
16869         "libiberty.h", "md5.h", "sha1.h".
16870         (Layout::Layout): Initialize eh_frame_data_,
16871         eh_frame_hdr_section_, and build_id_note_.
16872         (Layout::finalize): Call create_build_id.
16873         (Layout::create_note): New function, broken out of
16874         Layout::create_gold_note.
16875         (Layout::create_gold_note): Call create_note.
16876         (Layout::create_build_id): New function.
16877         (Layout::write_build_id): New function.
16878         (Close_task_runner::run): Call write_build_id.
16879
16880         * x86_64.cc: Correct license to GPLv3.
16881
16882 2008-03-23  Ian Lance Taylor  <iant@google.com>
16883
16884         * options.cc: Include "demangle.h".
16885         (parse_optional_string): New function.
16886         (parse_long_option): Handle takes_optional_argument.
16887         (parse_short_option): Update dash_z initializer.  Handle
16888         takes_optional_argument.
16889         (General_options::General_options): Initialize do_demangle_.
16890         (General_options::finalize): Set do_demangle_.  Handle demangling
16891         style.
16892         * options.h (parse_optional_string): Declare.
16893         (struct One_option): Add optional_arg field.  Update constructor.
16894         Update call constructor calls.  Add takes_optional_argument
16895         function.
16896         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
16897         (DEFINE_optional_string): Define.
16898         (General_options::demangle): Change from DEFINE_bool to
16899         DEFINE_optional_string.
16900         (General_options::no_demangle): New function.
16901         (General_options::do_demangle): New function.
16902         (General_options::set_do_demangle): New function.
16903         (General_options::execstack_status_): Move definition to end of
16904         class definition.
16905         (General_options::static_): Likewise.
16906         (General_options::do_demangle_): New field.
16907         * object.cc (big_endian>::get_symbol_location_info): Call
16908         Options::do_demangle, not Options::demangle.
16909         * symtab.cc (demangle): Likewise.
16910
16911 2008-03-22  Ian Lance Taylor  <iant@google.com>
16912
16913         * gold.h: Include <cstddef> and <sys/types.h>
16914         * options.h: Include <cstring>.
16915
16916 2008-03-21  Ian Lance Taylor  <iant@google.com>
16917
16918         * Added source code to GNU binutils.
16919 \f
16920 Copyright (C) 2008-2015 Free Software Foundation, Inc.
16921
16922 Copying and distribution of this file, with or without modification,
16923 are permitted in any medium without royalty provided the copyright
16924 notice and this notice are preserved.
16925
16926 Local Variables:
16927 mode: change-log
16928 left-margin: 8
16929 fill-column: 74
16930 version-control: never
16931 End: