Avoid looking up Input_merge_map multiple times.
[external/binutils.git] / gold / ChangeLog
1 2015-03-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
2
3         * merge.cc (Object_merge_map::add_mapping): call
4         Object_merge_map::Input_merge_map::add_mapping.
5         (Object_merge_map::Input_merge_map::add_mapping): New.
6         (Output_merge_data::do_add_input_section): Call
7         get_or_make_input_merge_map before a loop.
8         (Output_merge_string<Char_type>::finalize_merged_data): Call
9         get_or_make_input_merge_map before a loop.
10         * merge.h (Object_merge_map): Make Input_merge_map public.
11         * object.cc (Relobj::add_merge_mapping): Use get_or_create_merge_map.
12         (Relobj::get_or_create_merge_map): New.
13         * object.h (Relobj::get_or_create_merge_map): New.
14
15 2015-03-24  Alan Modra  <amodra@gmail.com>
16
17         PR 18147
18         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
19         relocation errors for branches to strong undefined symbols.
20
21 2015-03-23  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
22
23         * merge.cc (Object_merge_map::get_input_merge_map): Make it const.
24         (Object_merge_map::is_merge_section_for): Remove.
25         (Object_merge_map::find_merge_section): New.
26         * merge.h (Object_merge_map::is_merge_section_for): Remove.
27         (Object_merge_map::find_merge_section): New.
28         (Object_merge_map::get_input_merge_map): Add a const version.
29         * object.cc (Relobj::is_merge_section_for): Remove.
30         (Relobj::find_merge_section): New.
31         * object.h (Relobj::is_merge_section_for): Remove.
32         (Relobj::find_merge_section): New.
33         * output.cc
34         (Output_section::Input_section::is_merge_section_for): Remove.
35         (Output_section::add_merge_input_section): Don't call
36         add_merge_input_section.
37         (Output_section::find_merge_section): Return const. Use
38         object->find_merge_section.
39         (Output_section::build_lookup_maps): Don't build a map for
40         merge sections.
41         (Output_section::is_input_address_mapped): Return false if
42         section is not found.
43         (Output_section::find_starting_output_address): Use
44         find_merge_section instead of is_merge_section_for.
45         (Output_section::add_script_input_section):  Don't build a map for
46         merge sections.
47         * output.h (Output_section_lookup_maps::merge_sections_by_id_): Remove.
48         (Output_section_lookup_maps::find_merge_section): Remove.
49         (Output_section_lookup_maps::add_merge_input_section) Remove.
50         (Output_section::find_merge_section): Return const.
51
52 2015-03-22  Cary Coutant  <cary@google.com>
53
54         PR gold/18106
55         * i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
56         non-SIB form of lea, with nop after the call.
57
58 2015-03-21  Cary Coutant  <cary@google.com>
59
60         PR gold/14217
61         * output.cc (Output_segment::is_first_section_relro): Don't ignore
62         .tdata section.
63         (Output_segment::set_section_addresses): Don't align size of relro
64         segment for .tbss.
65
66 2015-03-21  Cary Coutant  <cary@google.com>
67
68         PR gold/18010
69         * stringpool.cc (Stringpool_template): Don't optimize if section
70         alignment is greater than sizeof(char).
71
72 2015-03-21  Cary Coutant  <cary@google.com>
73
74         PR gold/18048
75         * script-c.h (script_include_directive): Add first_token parameter.
76         * script.cc (script_include_directive): Add first_token parameter, and
77         pass it to read_script_file.
78         * yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
79         (PARSING_MEMORY_DEF): New tokens.
80         (top): Add new productions for INCLUDE files.
81         (file_cmd): Replace file_or_sections_cmd with copy of its productions.
82         Pass PARSING_LINKER_SCRIPT to script_include_directive.
83         (section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
84         (section_cmd): Pass PARSING_SECTION_CMDS.
85         (file_or_sections_cmd): Remove.
86         (memory_def): Pass PARSING_MEMORY_DEF.
87         * testsuite/Makefile.am (memory_test_2): New test.
88         * testsuite/Makefile.in: Regenerate.
89         * testsuite/memory_test_inc.t: New script file.
90         * testsuite/memory_test_inc_1.t.src: New script file.
91         * testsuite/memory_test_inc_2.t.src: New script file.
92         * testsuite/memory_test_inc_3.t.src: New script file.
93
94 2015-03-21  Cary Coutant  <cary@google.com>
95
96         * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
97         (Sized_relobj_dwo::setup): Build compressed section map.
98         (Sized_relobj_dwo::do_decompressed_section_contents): Delete.
99         * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
100         section map.
101         * object.cc (Sized_relobj_file::Sized_relobj_file): Remove
102         compressed_sections_ field.
103         (build_compressed_section_map): Take Object instead of
104         Sized_relobj_file parameter; add decompress_if_needed parameter.
105         (Sized_relobj_file::do_find_special_sections): Store compressed
106         section map in parent Object.
107         (Sized_relobj_file::do_decompressed_section_contents): Move
108         implementation to Object::decompressed_section_contents.
109         (Sized_relobj_file::do_discard_decompressed_sections): Move
110         implementation to Object::discard_decompressed_sections.
111         * object.h (build_compressed_section_map): Declare.
112         (Object::Object): Add compressed_sections_ field.
113         (Object::section_is_compressed): Move implementation here.
114         (Object::decompressed_section_contents): De-virtualize.
115         (Object::discard_decompressed_sections): De-virtualize.
116         (Object::do_section_is_compressed): Delete.
117         (Object::do_decompressed_section_contents): Delete.
118         (Object::set_compressed_sections): New method.
119         (Object::compressed_sections): New method.
120         (Object::compressed_sections_): New data member.
121         (Compressed_section_info, Compressed_section_map): Move to top of file.
122         (Sized_relobj_file::do_section_is_compressed): Delete.
123         (Sized_relobj_file::do_decompressed_section_contents): Delete.
124         (Sized_relobj_file::do_discard_decompressed_sections): Delete.
125         (Sized_relobj_file::compressed_sections_): Move to Object class.
126
127 2015-03-21  Cary Coutant  <ccoutant@google.com>
128
129         PR gold/18152
130         * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
131         deferred objects.
132
133 2015-03-11  Cary Coutant  <ccoutant@google.com>
134
135         * options.cc (General_options::finalize): Don't allow -z relro
136         with incremental linking.
137         * testsuite/Makefile.am (incremental_test): Add -z norelro.
138         (incremental_test_2): Likewise.
139         (incremental_test_3): Likewise.
140         (incremental_test_4): Likewise.
141         (incremental_test_5): Likewise.
142         (incremental_test_6): Likewise.
143         (incremental_copy_test): Likewise.
144         (incremental_common_test_1): Likewise.
145         (incremental_comdat_test_1): Likewise.
146         * testsuite/Makefile.in: Regenerate.
147
148 2015-03-09  Cary Coutant  <ccoutant@google.com>
149
150         PR gold/14675
151         * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
152         return enum indicating whether .eh_frame section is empty, optimizable,
153         unrecognized, or an end marker. Adjust explicit instantiations.
154         * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
155         (Eh_frame::add_ehframe_input_section): Change return type.
156         * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
157         * layout.cc (Layout::layout_eh_frame): Don't add optimized sections
158         to the .eh_frame output section until we see the end marker.
159         (Layout::finalize_eh_frame_section): New.
160         * layout.h: (Layout::finalize_eh_frame_section): New.
161
162 2015-03-05  H.J. Lu  <hongjiu.lu@intel.com>
163
164         * output.cc (Relobj::initialize_input_to_output_map<size>):
165         Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
166
167 2015-03-04  Cary Coutant  <ccoutant@google.com>
168
169         * parameters.cc (Parameters::set_target_once): Call
170         Target::select_as_default_target just once from here...
171         (set_parameters_target): ...instead of from here.
172
173 2015-03-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
174
175         * ehframe.cc (Cie::set_output_offset): Pass in and use a
176         Output_section_data instead of a Merge_map.
177         (Eh_frame::Eh_frame): Don't initialize merge_map_.
178         (Eh_frame::read_cie): Use add_merge_mapping instead of
179         Merge_map::add_mapping.
180         (Eh_frame::read_fde): Ditto.
181         (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
182         (Eh_frame::do_output_offset): Use merge_output_offset istead of
183         merge_map_->get_output_offset.
184         (Eh_frame::do_is_merge_section_for): Delete.
185         * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
186         instead of a Merge_map.
187         (Cie::set_output_offset): Pass in a Output_section_data instead of a
188         Merge_map.
189         (Eh_frame::do_is_merge_section_for): Delete.
190         (Eh_frame::merge_map_): Delete.
191         * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
192         and use a Output_section_data instead of a Merge_map.
193         (Object_merge_map::add_mapping): Ditto.
194         (Object_merge_map::get_output_offset): Remove the merge_map argument.
195         (Object_merge_map::is_merge_section_for): Pass in and use a
196         Output_section_data instead of a Merge_map.
197         (Merge_map): Delete.
198         (Output_merge_base::do_output_offset): Use merge_output_offset instead
199         of merge_map_.get_output_offset.
200         (Output_merge_base::do_is_merge_section_for): Delete.
201         (Output_merge_data::do_add_input_section): Use
202         object->add_merge_mapping instead of add_mapping.
203         (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
204         * merge.h (Merge_map): Delete forward declaration.
205         (Object_merge_map::add_mapping): Pass in and use a Output_section_data
206         instead of a Merge_map.
207         (Object_merge_map::get_output_offset): Remove the merge_map argument.
208         (Object_merge_map::is_merge_section_for): Pass in and use a
209         Output_section_data instead of a Merge_map.
210         (Input_merge_map::Object_merge_map::merge_map): Replace with
211         output_data.
212         (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
213         Output_section_data instead of a Merge_map.
214         (Merge_map): Delete.
215         (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
216         (Output_merge_base::do_is_merge_section_for): Delete.
217         (Output_merge_base::add_mapping): Delete.
218         (Output_merge_base::merge_map_): Delete.
219         * object.cc (Relobj::initialize_input_to_output_map): New.
220         (Relobj::initialize_input_to_output_map): New.
221         (Relobj::merge_output_offset): New.
222         (Relobj::is_merge_section_for): New.
223         (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
224         bits.
225         * object.h (Relobj::merge_map): Delete.
226         (initialize_input_to_output_map): New.
227         (set_merge_map): Delete.
228         (add_merge_mapping): New.
229         (merge_output_offset): New.
230         (is_merge_section_for): New.
231         * output.cc (Output_section::Input_section::is_merge_section_for):
232         Use object->is_merge_section_for.
233         * output.h (Output_section_data::is_merge_section_for): Delete.
234         (Output_section_data::do_is_merge_section_for): Delete.
235         * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
236         Use object->initialize_input_to_output_map.
237         (Merged_symbol_value<size>::value_from_output_section): Use
238         object->merge_output_offset.
239
240 2015-03-02  Peter Collingbourne  <pcc@google.com>
241             Cary Coutant  <ccoutant@google.com>
242
243         * output.cc (Output_section::add_merge_input_section): Do not
244         attempt to merge sections with an entsize of 0.
245
246 2015-03-02  Khem Raj  <raj.khem@gmail.com>
247
248         * attributes.h (class Output_attributes_section_data ): Add
249         do_print_to_mapfile function.
250
251 2015-02-24  Alan Modra  <amodra@gmail.com>
252
253         PR 18010
254         * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
255         complain if value is not a multiple of four.
256         (Target_powerpc::Relocate::relocate): Correct handling of
257         R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
258
259 2015-02-21  H.J. Lu  <hongjiu.lu@intel.com>
260
261         * configure.ac (default_size): Set to 32 for x32.
262         * configure: Regenerated.
263
264 2015-02-18  Alan Modra  <amodra@gmail.com>
265
266         PR 17954
267         * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
268         visibility.
269
270 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
271
272         * gc.h (Garbage_collection::add_reference): Don't use find.
273
274 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
275
276         * object.cc (write_local_symbols): avoid std::vector copy.
277
278 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
279
280         * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
281
282 2015-02-09  Mark Wielaard  <mjw@redhat.com>
283
284         * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
285         DW_LANG_Fortran03 and DW_LANG_Fortran08.
286
287 2015-02-16  Cary Coutant  <ccoutant@google.com>
288
289         PR gold/13577
290         PR gold/16992
291         * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
292         DF_SYMBOLIC if --dynamic-list option is used.
293         * options.cc (General_options::finalize): --dynamic-list is not
294         mutually exclusive with -Bsymbolic.
295         * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
296         listed in --dynamic-list.
297         * testsuite/Makefile.am (dynamic_list_lib2.so): Add
298         -Bsymbolic-functions.
299         * testsuite/Makefile.in: Regenerate.
300
301 2015-02-16  Cary Coutant  <ccoutant@google.com>
302
303         PR gold/17971
304         * incremental.cc: Remove redundant include of "output.h".
305
306 2015-02-12  Jing Yu  <jingyu@google.com>
307
308         * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
309         TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
310         New relocation.
311         * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
312         TLSLE_MOVW_* relocations.
313         (Target_aarch64::Scan::global): Likewise.
314         (Target_aarch64::Relocate::relocate): Likewise.
315         (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
316         for new TLSLE_MOVW_* relocations.
317
318 2015-02-11  Will Newton  <will.newton@linaro.org>
319
320         PR gold/13321
321         * arm.cc (Target_arm::make_plt_section): Create an ARM
322         state mapping symbol at the start of the PLT.
323
324 2015-02-09  H.J. Lu  <hongjiu.lu@intel.com>
325
326         * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
327         Replace two_file_shared_2.so with two_file_shared_1.so.
328         * testsuite/Makefile.in: Regenerated.
329
330 2015-02-09  Alan Modra  <amodra@gmail.com>
331
332         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
333         plugin_test_thin.a and defsym_test.
334         * testsuite/Makefile.in: Regenerate.
335
336 2015-02-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
337
338         * merge.cc (do_add_input_section): Combine loop epilogue into main loop
339         body.
340
341 2015-02-04  Peter Collingbourne  <pcc@google.com>
342
343         * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
344         forwarding symbols when computing symbol resolution info for plugins.
345         * plugin.h (Plugin_manager::symtab): New method.
346         (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
347
348 2015-02-03  Cary Coutant  <ccoutant@google.com>
349             Peter Collingbourne  <pcc@google.com>
350
351         PR gold/15660
352         * archive.cc (Thin_archive_object_unlocker): New class.
353         (Archive::include_member): Unlock external members of thin archives.
354         * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
355         (plugin_test_2): Likewise.
356         (plugin_test_3): Likewise.
357         (plugin_test_4): Likewise.
358         (plugin_test_5): Likewise.
359         (plugin_test_6): Likewise.
360         (plugin_test_7): Likewise.
361         (plugin_test_8): Likewise.
362         (plugin_test_9): Likewise.
363         (plugin_test_10): Likewise.
364         (plugin_test_11): New test case.
365         * testsuite/Makefile.in: Regenerate.
366         * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
367         file to decide whether to claim file.
368         (all_symbols_read_hook): Likewise.
369         * testsuite/plugin_test_1.sh: Adjust expected output.
370         * testsuite/plugin_test_2.sh: Likewise.
371         * testsuite/plugin_test_3.sh: Likewise.
372         * testsuite/plugin_test_6.sh: Likewise.
373         * testsuite/plugin_test_tls.sh: Likewise.
374         * testsuite/plugin_test_11.sh: New testcase.
375
376 2015-02-03  Cary Coutant  <ccoutant@google.com>
377
378         * descriptors.cc (Descriptors::open): Set artificially-low limit for
379         file descriptors when debugging enabled. Add debug output.
380         (Descriptors::release): Add debug output.
381         (Descriptors::close_some_descriptor): Likewise.
382         (Descriptors::close_all): Likewise.
383         * fileread.cc (File_read::lock): Likewise.
384         (File_read::unlock): Likewise.
385
386 2015-02-02  Cary Coutant  <ccoutant@google.com>
387
388         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
389         executable output file.
390
391 2015-01-22  Han Shen  <shenhan@google.com>
392
393         * arm.cc (Target_arm::Target_arm): Add initialization for new members.
394         (Target_arm::do_plt_address_for_global): New method.
395         (Target_arm::do_plt_address_for_local): New method.
396         (Target_arm::rel_irelative_section): New method.
397         (Target_arm::make_data_plt): Add more parameters for plt ctor.
398         (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
399         (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
400         (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
401         (Target_arm::Scan::check_non_pic): Add ifunc support.
402         (Target_arm::Scan::local): Add ifunc support.
403         (Target_arm::Scan::global): Add ifunc support.
404         (Target_arm::make_plt_section): New method.
405         (Target_arm::make_plt_entry): Change to call to make_plt_section.
406         (Target_arm::make_local_ifunc_plt_entry): New method.
407         (Target_arm::got_irelative_): New member.
408         (Target_arm::rel_irelative_): New member.
409         (Target_arm::got_section): Add creation for got_irelative_.
410         (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
411         (Target_arm::Relocate::relocate): Properly set local ifunc address.
412         (Target_arm::do_dynsym_value): Properly set global ifunc address.
413         (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
414         (Output_data_plt_arm::IRelative_data): New type.
415         (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
416         (Output_data_plt_arm::add_entry): Add more parameters.
417         (Output_data_plt_arm::add_relocation): New method.
418         (Output_data_plt_arm::add_local_ifunc_entry): New method.
419         (Output_data_plt_arm::rel_irelative): New method.
420         (Output_data_plt_arm::entry_count): Modified.
421         (Output_data_plt_arm::address_for_global): New method.
422         (Output_data_plt_arm::address_for_local): New method.
423 gold/
424         (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
425         (Output_data_plt_arm::insert_irelative_data): New method.
426         (Output_data_plt_arm::irelative_rel_): New member.
427         (Output_data_plt_arm::got_): New member.
428         (Output_data_plt_arm::got_irelative_): New member.
429         (Output_data_plt_arm::irelative_count_): New member.
430         (Output_data_plt_arm::IRelative_data_vec): New typedef.
431         (Output_data_plt_arm::irelative_data_vec_): New member.
432         (Output_data_plt_arm::do_write): Write out irelative entries.
433         (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
434         more parameters to ctor.
435         (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
436         more parameters to ctor.
437         * output.h (Output_data_reloc::add_local_relative): New method.
438         * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
439
440 2015-01-29  Alan Modra  <amodra@gmail.com>
441
442         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
443         and GOT_TLSGD to LE optimization.
444
445 2015-01-28  Cary Coutant  <ccoutant@google.com>
446
447         * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
448         for undef TLS symbols.
449         (Target_x86_64::Relocate::relocate_tls): Likewise.
450         (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
451
452 2015-01-25  Cary Coutant  <ccoutant@google.com>
453
454         * output.cc (Output_segment::set_section_addresses): Fix calculation
455         of size of relro segment.
456
457 2015-01-22  Alan Modra  <amodra@gmail.com>
458
459         * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
460         condition for need of ifunc plt entry.
461         (Target_powerpc::Scan::global <got relocs>): Likewise.
462
463 2015-01-14  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
464
465         * mips.cc (reloc_high): Add r_sym.
466         (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
467         reloc_high constructor.
468         (Mips_relocate_functions::relgot16_local): Likewise.
469         (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
470         r_type to decide whether LO16 matches HI16.
471         (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
472         rello16 and relgot16_local.
473
474 2015-01-09  Cary Coutant  <ccoutant@google.com>
475
476         * layout.cc (Layout::set_segment_offsets): Don't align start of segment
477         unless alignment is larger than page size.
478
479 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
480             Cary Coutant  <ccoutant@google.com>
481
482         PR gold/17729
483         * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
484         (DEFAULT_TARGET_X32): Set for x32.
485         * x86_64.cc (cmp_insn_32): New.
486         (lea_r10_insn_32): Likewise.
487         (lea_r11_insn_32): Likewise.
488         (cmp_insn_64): Likewise.
489         (lea_r10_insn_64): Likewise.
490         (lea_r11_insn_64): Likewise.
491         (Target_x86_64<size>::do_calls_non_split): Handle x32.
492         * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
493         (check_DATA): Add split_x32 files.
494         (split_x32_[1234n].o): New targets.
495         (split_x32_[124]): New targets.
496         (split_x32_[1234r].stdout): New targets.
497         * testsuite/split_x32.sh: New file.
498         * testsuite/split_x32_1.s: Likewise.
499         * testsuite/split_x32_2.s: Likewise.
500         * testsuite/split_x32_3.s: Likewise.
501         * testsuite/split_x32_4.s: Likewise.
502         * testsuite/split_x32_n.s: Likewise.
503         * configure: Regenerated.
504         * testsuite/Makefile.in: Likewise.
505
506 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
507
508         PR gold/17809
509         * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
510         x32.
511
512 2015-01-02  Alan Modra  <amodra@gmail.com>
513
514         * version.cc (print_version): Just print current year.
515         * dwp.cc (print_version): Likewise.
516
517 2015-01-01  Alan Modra  <amodra@gmail.com>
518
519         Update year range in copyright notice of all files.
520
521 2014-12-25  Alan Modra  <amodra@gmail.com>
522
523         * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
524         new enums.
525         (Target_arm::merge_object_attributes, ): Likewise.
526
527 2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
528
529         * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
530         as hard float only when Tag_ABI_VFP_args is 1, using new enum value
531         AEABI_VFP_args_vfp to check that.
532         (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
533         value and replace hardcoded values by enum values.
534
535 2014-12-22  Cary Coutant  <ccoutant@google.com>
536
537         * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
538
539 2014-12-20  H.J. Lu  <hongjiu.lu@intel.com>
540
541         PR gold/14608
542         * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
543         to "return i * i * 3;".
544
545 2014-12-16  Cary Coutant  <ccoutant@google.com>
546
547         * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
548         (Mapfile::print_output_data): Use current_data_size() to avoid
549         assert for sections requiring postprocessing; if address is not valid,
550         print 0.
551         (Mapfile::print_output_section): Use current_data_size(); print note
552         that addresses and sizes are before compression.
553
554 2014-12-14  H.J. Lu  <hongjiu.lu@intel.com>
555
556         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
557         Cast current_group_size to unsigned long when reporting error.
558
559 2014-12-10  Jing Yu  <jingyu@google.com>
560
561         * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
562         (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
563         Update error message.
564         (Target_aarch64::do_relax): Use absolute value of option
565         stub_group_size. Replace local variable with class member
566         stub_group_size_.
567
568 2014-12-04  Alan Modra  <amodra@gmail.com>
569
570         * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
571         addend of PLTREL24 reloc when not generating a plt stub.  Make
572         max_branch_offset an "Address".
573         (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
574         (Target_powerpc::Relocate::relocate): Likewise.
575
576 2014-12-04  Alan Modra  <amodra@gmail.com>
577
578         PR 17670
579         * symtab.cc (Symbol::set_undefined): Remove assertion.
580         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
581         on symbols defined in discarded sections, instead return false.
582         Rearrange params, update all callers.
583         (Target_powerpc::Branch_info::make_stub): Don't make stubs for
584         branches to syms in discarded sections.
585         (Global_symbol_visitor_opd::operator()): Set discarded opd syms
586         undefined and flag as discarded.
587         (Target_powerpc::Relocate::relocate): Localize variable.
588
589 2014-12-03  H.J. Lu  <hongjiu.lu@intel.com>
590
591         PR gold/17675
592         * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
593         * testsuite/Makefile.in: Regenerated.
594
595 2014-12-03  Alan Modra  <amodra@gmail.com>
596
597         PR 17566
598         * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
599         when adding dynamic relocations against section symbols.
600
601 2014-12-01  Dimitry Ivanov <dimitry@google.com>
602
603         * layout.cc (Layout::finish_dynamic_section): When '-z global'
604         is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
605         * options.h (General_options): New -z option (global).
606
607 2014-12-01  Cary Coutant  <ccoutant@google.com>
608
609         PR gold/17578
610         * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
611         is given.
612         (Layout::create_executable_stack_info): Warn when -z noexecstack is
613         given but some inputs require executable stack.
614
615 2014-11-26  Cary Coutant  <ccoutant@google.com>
616
617         * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
618         .debug_str_offsets; strip .debug_gnu_pubnames and
619         .debug_gnu_pubtypes.
620         (lines_only_debug_sections): Strip all four new sections.
621
622 2014-11-26  Jing Yu  <jingyu@google.com>
623
624         * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
625         register to be x0 when to relax TLSDESC_LD64_LO12.
626
627 2014-11-26  Alan Modra  <amodra@gmail.com>
628
629         * powerpc.cc (struct Stub_table_owner): New.
630         (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
631         unsigned int vector.  Update all references.
632         (powerpc_relobj::set_stub_table): Take an unsigned int param
633         rather than a Stub_table.  Update callers.
634         (Powerpc_relobj::clear_stub_table): New function.
635         (Target_powerpc): Add relax_failed_, relax_fail_count_ and
636         stub_group_size_ vars.
637         (Target_powerpc::new_stub_table): Delete.
638         (max_branch_delta): New function, extracted from..
639         (Target_powerpc::Relocate::relocate): ..here..
640         (Target_powerpc::Branch_info::make_stub): ..and here.  Return
641         status on whether stub created successfully.
642         (Stub_control::Stub_control): Add "no_size_errors" param.  Move
643         default sizing to..
644         (Target_powerpc::do_relax): ..here.  Init stub_group_size_ and
645         reduce on relax failure.
646         (Target_powerpc::group_sections): Add "no_size_errors" param.
647         Use stub_group_size_.  Set up group info in a temp vector,
648         before building Stub_table vector.  Account for input sections
649         possibly already converted to relaxed sections.
650         (Stub_table::init): Delete.  Merge into..
651         (Stub_table::Stub_table): ..here.
652         (Stub_table::can_reach_stub): New function.
653         (Stub_table::add_plt_call_entry): Add "from" parameter and
654         return true iff stub could be reached.
655         (Stub_table::add_long_branch_entry): Similarly.  Add "r_type"
656         param too.
657         (Stub_table::clear_stubs): Add "all" param.
658
659 2014-11-26  Alan Modra  <amodra@gmail.com>
660
661         * powerpc.cc (Stub_control::set_output_and_owner): New function.
662         (Target_powerpc::group_sections): Use it.
663
664 2014-11-25  Cary Coutant  <ccoutant@google.com>
665
666         * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
667         (Binary_to_elf::write_symbol): Add st_size parameter.
668         * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
669
670 2014-11-25  Cary Coutant  <ccoutant@google.com>
671
672         PR gold/17639
673         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
674         (Sized_relobj_file::do_layout): Handle deferred sections properly
675         during GC pass 1. Don't add reloc sections to deferred list twice.
676         * object.h (Sized_relobj_file::is_deferred_layout): New function.
677         (Sized_relobj_file::is_deferred_layout_): New data member.
678
679 2014-11-21  H.J. Lu  <hongjiu.lu@intel.com>
680
681         PR gold/17619
682         * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
683         Check PC-relative offset overflow in PLT entry.
684
685 2014-11-21  Alan Modra  <amodra@gmail.com>
686
687         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
688         for undefined weaks.
689
690 2014-11-20  Alan Modra  <amodra@gmail.com>
691
692         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
693         from --stub-group-size parameter divided by 1024.
694         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
695         template parameter.  Update all uses.
696         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
697         has_stub_value.  Set for long branches.  Don't report overflow for
698         branch to undefined weak symbols.  Print info message on
699         overflowing branch to stub.
700
701 2014-11-20  Alan Modra  <amodra@gmail.com>
702
703         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
704
705 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
706
707         * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
708         entry for R_X86_64_GOTPLT64.
709         (Target_x86_64<size>::Relocate::relocate): Update comments for
710         R_X86_64_GOTPLT64.
711
712 2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>
713
714         * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
715         * plugin.h: add lock definition
716
717 2014-10-29  Han Shen  <shenhan@google.com>
718             Jing Yu   <jingyu@google.com>
719
720         * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
721         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
722         TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
723         Symbol::TLS_REF.
724         * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
725         method.
726         (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
727         (Target_aarch64::tls_ld_to_le): New method.
728         (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
729         for 64bit targets.
730         (Output_data_plt_aarch64::irelative_rel_): New data member.
731         (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
732         (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
733         (Output_data_plt_aarch64::add_relocation): New method.
734         (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
735         offset. Add got_irelative size to got size.
736         (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
737         type string with the new typename.
738         (AArch64_relocate_functions::update_adr): Replace parameter x with
739         immed.
740         (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
741         (AArch64_relocate_functions::reloc_common): New method.
742         (AArch64_relocate_funcsions::rela_general): Extract common part out
743         into reloc_common method.
744         (AArch64_relocate_functions::rela_general): Likewise.
745         (AArch64_relocate_functions::pcrela_general): Likewise.
746         (AArch64_relocate_functions::adr): New method.
747         (AArch64_relocate_functions::adrp): Calculate immed before calling
748         update_adr.
749         (AArch64_relocate_functions::adrp): Likewise.
750         (AArch64_relocate_functions::movnz): Cast x to SignedW type when
751         comparing x to 0. Calculate immed from ~x when x < 0.
752         (Target_aarch64::optimize_tls_reloc): Add new cases for
753         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
754         TLSLD_MOVW_DTPREL_G0_NC.
755         (Target_aarch64::possible_function_pointer_reloc): Implement this
756         method.
757         (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
758         comment.
759         (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
760         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
761         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
762         (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
763         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
764         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
765         (Target_aarch64::make_plt_entry): Call add_entry with two more
766         parameters.
767         (Target_aarch64::make_local_ifunc_plt_entry): New method.
768         (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
769         ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
770         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
771         (Target_aarch64::Relocate::relocate_tls): Add cases for
772         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
773         TLSLD_MOVW_DTPREL_G0_NC.
774         * testsuite/icf_safe_so_test.cc: Correct test comment.
775         * testsuite/icf_safe_test.sh: Add AArch64 arch.
776
777 2014-10-22  Alan Modra  <amodra@gmail.com>
778
779         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
780         thread_starter.
781
782 2014-10-18  Andreas Schwab  <schwab@linux-m68k.org>
783
784         * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
785
786 2014-10-17  Cary Coutant  <ccoutant@google.com>
787
788         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
789         Add "typename" keyword.
790
791 2014-10-15  Han Shen  <shenhan@google.com>
792             Jing Yu   <jingyu@google.com>
793
794         Patch for gold aarch64 backend to support relaxation.
795         * aarch64-reloc.def: Change format.
796         * aarch64.cc (class Reloc_stub): New class.
797         (class Stub_table): New class.
798         (class AArch64_relobj): New class.
799         (class AArch64_input_section): New class.
800         (class AArch64_output_section): New class.
801         (Target_aarch64::new_stub_table): New method.
802         (Target_aarch64::new_aarch64_input_section): New method.
803         (Target_aarch64::find_aarch64_input_section): New method.
804         (Target_aarch64::scan_section_for_stubs): New method.
805         (Target_aarch64::scan_reloc_section_for_stubs): New method.
806         (Target_aarch64::relocate_stub): New method.
807         (Target_aarch64::current_target): New method.
808         (Target_aarch64::do_make_elf_object): New method.
809         (Target_aarch64::do_may_relax): New method.
810         (Target_aarch64::do_relax): New method.
811         (Target_aarch64::group_sections): New method.
812         (Target_aarch64::scan_reloc_for_stub): New method.
813         (Target_aarch64::do_make_output_section): New method.
814         (Target_aarch64::stub_tables_): New data member.
815         (Target_aarch64::aarch64_input_section_map_): New data member.
816         (AArch64_relocate_functions::maybe_apply_stub): New method.
817
818 2014-09-30  Cary Coutant  <ccoutant@google.com>
819
820         PR gold/17432
821         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
822
823 2014-09-30  Kito Cheng  <kito@0xlab.org>
824
825         PR gold/13597
826         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
827         hash table before sysv-style hash table.
828
829 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
830
831         * options.h (--pic-executable): Add negative to alias to -no-pie.
832
833 2014-09-26  Cary Coutant  <ccoutant@google.com>
834
835         PR gold/16773
836         * object.cc (Sized_relobj_file): Compute value of section symbols
837         for TLS sections the same as TLS symbols.
838
839 2014-09-25  Cary Coutant  <ccoutant@google.com>
840
841         PR gold/17432
842         * resolve.cc (Symbol_table::resolve): Override common placeholder
843         symbols, but adjust sizes.
844         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
845         symbols to common lists.
846
847 2014-09-24  Alan Modra  <amodra@gmail.com>
848
849         * po/POTFILES.in: Regenerate.
850
851 2014-09-23  Taiju Tsuiki  <tzik@google.com>
852             Cary Coutant  <ccoutant@google.com>
853
854         PR gold/14860
855         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
856         on input_sections_blocker.
857         * layout.cc (Write_sections_task::locks): Unblock
858         input_sections_blocker_.
859         * layout.h (Write_sections_task::Write_sections_task): Add
860         input_sections_blocker.
861         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
862         to DEPENDENCIES.
863         * testsuite/Makefile.in: Regenerate.
864
865 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
866
867         * testsuite/Makefile.am (plugin_test_10): New test.
868         * testsuite/Makefile.in: Regenerate
869         * testsuite/plugin_common_test_2.c (c1): Align to 8.
870         * testsuite/plugin_test_10.sh: New file.
871
872 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
873
874         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
875         * resolve.cc (Symbol_table::resolve): Don't override common symbols
876         during the replacement phase.
877
878 2014-09-17  Han Shen  <shenhan@google.com>
879             Jing Yu  <jingyu@google.com>
880
881         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
882         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
883         * aarch64.cc (Target_aarch64): Add data members
884         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
885         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
886         constructor.
887         (Target_aarch64::do_reloc_symbol_index): New method.
888         (Target_aarch64::do_reloc_addend): New method.
889         (Target_aarch64::add_tlsdesc_info): New method.
890         (Target_aarch64::do_dynsym_value): New method.
891         (Target_aarch64::do_make_data_plt): Add new parameters: got,
892         got_irelative. Pass them to Output_data_plt_aarch64_standard.
893         (Target_aarch64::make_data_plt): Add new parameters: got,
894         got_irelative. Pass them to do_make_data_plt.
895         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
896         (Target_aarch64::Relocate:tls_gd_to_le): New method.
897         (Target_aarch64::Relocate:tls_ie_to_le): New method.
898         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
899         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
900         (Target_aarch64::got_tlsdesc_section): New method.
901         (Target_aarch64::make_local_ifunc_plt_entry): New method.
902         (Target_aarch64::define_tls_base_symbol): New method.
903         (Target_aarch64::reserve_tlsdesc_entries): New method.
904         (Target_aarch64::got_mod_index_entry): New method.
905         (Target_aarch64::rela_tlsdesc_section): New method.
906         (Target_aarch64::rela_irelative_section): New method.
907         (Target_aarch64::Tlsdesc_info): New struct.
908         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
909         relocations and tlsdesc relocations.
910         (Target_aarch64::optimize_tls_reloc): Implement method.
911         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
912         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
913         in constructor.
914         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
915         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
916         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
917         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
918         (Output_data_plt_aarch64::rela_tlsdesc): New method.
919         (Output_data_plt_aarch64::rela_irelative): New method.
920         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
921         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
922         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
923         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
924         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
925         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
926         (Output_data_plt_aarch64_standard): New member variables:
927         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
928         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
929         New parameter: got, got_irelative.
930         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
931         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
932         (Output_data_plt_aarch64::do_write): Replace got_address with
933         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
934         (AArch64_relocate_functions::update_movnz): New method.
935         (AArch64_relocate_functions): Correct format.
936         (AArch64_relocate_functions::movnz): New method.
937         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
938         before the switch. Add new cases to switch.
939         Check ie_to_le relaxation on tlsie relocations. Add code handling
940         tlsgd tlsdesc cases.
941         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
942         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
943         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
944         Call reloc_name_in_error_message to print unsupported reloc.
945         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
946         make_data_plt.
947         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
948         relocs. Fill in some more dynamic tags.
949         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
950         Skip call tls_get_addr when tlsgd is relaxed.
951         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
952         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
953         tlsdesc->ie relaxation.
954
955 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
956
957         * mips.cc (Target_mips_nacl): New class.
958         (Target_selector_mips_nacl): New class.
959         (target_selector_mips32): Rename from target_selector_mips32be and use
960         Target_selector_mips_nacl instead of Target_selector_mips.
961         (target_selector_mips32el): Rename from target_selector_mips32 and use
962         Target_selector_mips_nacl instead of Target_selector_mips.
963         (target_selector_mips64): Rename from target_selector_mips64be and use
964         Target_selector_mips_nacl instead of Target_selector_mips.
965         (target_selector_mips64el): Rename from target_selector_mips64 and use
966         Target_selector_mips_nacl instead of Target_selector_mips.
967         (Target_mips::mips_info): Add const attribute.
968
969 2014-09-02  Cary Coutant  <ccoutant@google.com>
970
971         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
972         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
973         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
974         (Sized_incr_dynobj::do_section_name): Likewise.
975         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
976         (Sized_incr_dynobj::do_section_name): Likewise.
977         * object.h (Object::section_name): Likewise.
978         (Object::do_section_name): Likewise.
979         (Sized_relobj_file::do_section_name): Likewise.
980         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
981         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
982
983 2014-09-02  Cary Coutant  <ccoutant@google.com>
984
985         PR gold/17005
986         * ehframe.cc (Fde::write): Add output_offset parameter.
987         (Cie::write): Likewise.
988         (Eh_frame::set_final_data_size): Account for offset within output
989         section.
990         (Eh_frame::do_sized_write): Likewise.
991         * ehframe.h (Fde::write): Add output_offset parameter.
992         (Cie::write): Likewise.
993         * output.cc (Output_section::Input_section_sort_entry): Remove
994         section_has_name_; add output_section_name parameter. Use
995         output section name for non-input sections.
996         (Output_section::Input_section_sort_entry::section_has_name): Remove.
997         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
998         (Output_section::Input_section_sort_compare): Remove logic for
999         sections without names.
1000         (Output_section::Input_section_sort_init_fini_compare): Likewise.
1001         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
1002         Likewise.
1003         (Output_section::Input_section_sort_section_name_compare): Likewise.
1004
1005 2014-08-29 Han Shen <shenhan@google.com>
1006            Jing Yu <jingyu@google.com>
1007
1008         * aarch64-reloc-property.cc
1009         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
1010         reference reloc property in the table.
1011         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
1012         3 other entries.
1013         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
1014         2 new overloaded methods.
1015         (Output_data_got_aarch64::do_write): Add code to write out
1016         static relocs.
1017         (class Output_data_got_aarch64::Static_reloc): New class to wrap
1018         static relocs.
1019         (Output_data_got_aarch64::static_relocs): New vector to
1020         hold static relocs.
1021         (Target_aarch64::TCB_SIZE): New const static memeber.
1022         (Target_aarch64::tcb_size): New method.
1023         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
1024         (Target_aarch64::Relocate::relocate_tls): New method.
1025         (Target_aarch64::Scan::local): Add code handling new reloc types.
1026         (Target_aarch64::Scan::global): Add code handling new reloc types.
1027
1028 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
1029
1030         * options.h (-no-pie): Add option.
1031
1032 2014-08-08  Jing Yu  <jingyu@google.com>
1033             Han Shen  <shenhan@google.com>
1034
1035         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
1036         (DEFFILES): add aarch64-reloc.def.
1037         (TARGETSOURCES): Add aarch64-reloc-property.cc.
1038         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
1039         * Makefile.in: Regenerate.
1040         * aarch64-reloc-property.cc: New file.
1041         * aarch64-reloc-property.h: New file.
1042         * aarch64-reloc.def: New file.
1043         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
1044         with tab to make the format consistent.
1045         (Output_data_got_aarch64::symbol_table_): New method.
1046         (Target_aarch64::do_plt_address_for_global): New method.
1047         (Target_aarch64::do_plt_address_for_local): New method.
1048         (Target_aarch64::do_select_as_default_target): New method.
1049         (Target_aarch64::do_make_data_plt): New method.
1050         (Target_aarch64::make_data_plt): New method.
1051         (Output_data_plt_aarch64::has_irelative_section): New method.
1052         (Output_data_plt_aarch64::address_for_global): New method.
1053         (Output_data_plt_aarch64::address_for_local): New method.
1054         (Output_data_plt_aarch64::irelative_rel_): New parameter.
1055         (Output_data_plt_aarch64::add_entry): Implement contents.
1056         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
1057         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
1058         the got_pov entry to plt0.
1059         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
1060         Implement contents.
1061         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
1062         (AArch64_howto): New struct.
1063         (aarch64_howto[]): New static const array.
1064         (AArch64_relocate_functions): New class.
1065         (Target_aarch64::Scan::get_reference_flags): Remove method.
1066         (Target_aarch64::Scan::local): Implement to support a few relocations.
1067         (Target_aarch64::Scan::global): Implement to support a few relocations.
1068         (Target_aarch64::make_plt_section): Implement contents.
1069         (Target_aarch64::make_plt_entry): Implement contents.
1070         (Target_aarch64::do_finalize_sections): Implement contents.
1071         (Target_aarch64::Relocate::relocate): Implement a few relocations.
1072         (Target_aarch64::relocate_section): Implement contents.
1073
1074 2014-08-06  Alan Modra  <amodra@gmail.com>
1075
1076         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
1077
1078 2014-08-06  Alan Modra  <amodra@gmail.com>
1079
1080         PR 13227
1081         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
1082
1083 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
1084
1085         * object.cc (Relobj::is_section_name_included): Add
1086         ".rodata.nptl_version" to not garbage collect this section.
1087
1088 2014-07-08  Cary Coutant  <ccoutant@google.com>
1089
1090         * expression.cc (struct Expression::Expression_eval_info): Add
1091         new fields type_pointer, vis_pointer, and nonvis_pointer.
1092         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
1093         nonvis_pointer parameters. Adjust all calls.
1094         (Symbol_expression::value): Update type, visibility, and nonvis bits
1095         in caller.
1096         * script.cc (Symbol_assignment::sized_finalize): Update type,
1097         visibility, and remaining st_other bits for new symbol.
1098         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
1099         vis_pointer, and nonvis_pointer parameters.
1100         * symtab.h (Symbol::set_type): New method.
1101
1102         * testsuite/Makefile.am (defsym_test): New test.
1103         * testsuite/Makefile.in: Regenerate.
1104         * testsuite/defsym_test.c: New file.
1105         * testsuite/defsym_test.sh: New file.
1106
1107 2014-07-08  Cary Coutant  <ccoutant@google.com>
1108
1109         PR gold/15639
1110         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
1111         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
1112         (Sized_dynobj::base_read_symbols): ...new method.
1113         * object.h (Sized_relobj_file::base_read_symbols): New method.
1114         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
1115         (Sized_relobj_file::base_read_symbols): ...new method.
1116         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
1117         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
1118         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
1119
1120 2014-07-04  Alan Modra  <amodra@gmail.com>
1121
1122         * po/POTFILES.in: Regenerate.
1123
1124 2014-07-02  Jing Yu  <jingyu@google.com>
1125
1126         * aarch64.cc: New file
1127         * Makefile.am (TARGETSOURCES): Add aarch64.cc
1128         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
1129         * Makefile.in: Regenerate.
1130         * configure.tgt: Add entries for aarch64*.
1131         * configure.ac:  Likewise.
1132         * configure: Likewise.
1133
1134 2014-06-27  Alan Modra  <amodra@gmail.com>
1135
1136         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
1137
1138 2014-06-24  Cary Coutant  <ccoutant@google.com>
1139
1140         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
1141         sections.
1142         (Dwo_file::sized_read_unit_index): Likewise.
1143
1144 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1145
1146         * mips.cc: New file.
1147         * Makefile.am (TARGETSOURCES): Add mips.cc
1148         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
1149         * configure.tgt: Add entries for mips*.
1150         * configure.ac: Likewise.
1151         * Makefile.in: Regenerate.
1152         * configure: Likewise.
1153
1154 2014-06-09  Cary Coutant  <ccoutant@google.com>
1155
1156         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
1157         unit_length is within section bounds.
1158
1159 2014-06-09  Cary Coutant  <ccoutant@google.com>
1160
1161         PR gold/16980
1162         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
1163         map.
1164
1165 2014-06-07  Alan Modra  <amodra@gmail.com>
1166
1167         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
1168
1169 2014-06-06  Cary Coutant  <ccoutant@google.com>
1170
1171         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
1172         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
1173         (Dwarf_pubnames_table::read_header): Likewise.
1174         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
1175         .debug_gnu_pubtypes.
1176
1177 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
1178
1179         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
1180         * Makefile.in, configure: Regenerate.
1181
1182 2014-06-03  Alan Modra  <amodra@gmail.com>
1183
1184         * powerpc.cc (addis_12_2): Define.
1185         (Stub_table::do_write): Support fusion on ELFv2 stubs.
1186
1187 2014-06-03  Alan Modra  <amodra@gmail.com>
1188
1189         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
1190         st_other output.
1191
1192 2014-06-02  Alan Modra  <amodra@gmail.com>
1193
1194         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
1195         Only ignore relocs on ELFv1.
1196         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
1197
1198 2014-05-30  Cary Coutant  <ccoutant@google.com>
1199
1200         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
1201         * testsuite/Makefile.in: Regenerate.
1202         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
1203
1204 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
1205
1206         PR gold/16945
1207         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
1208         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
1209
1210 2014-05-15  Alan Modra  <amodra@gmail.com>
1211
1212         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
1213         Compare FDE contents with DW_CFA_nop rather than 0.
1214
1215 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
1216
1217         * symtab.h (may_need_copy_reloc): Remove check for position independent
1218         code.
1219         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
1220         position independence before pc absolute may_need_copy_reloc call.
1221         Add check for executable output befor pc relative may_need_copy_reloc
1222         call.
1223         * i386.cc: Ditto.
1224         * arm.cc: Ditto.
1225         * sparc.cc: Ditto.
1226         * tilegx.cc: Ditto.
1227         * powerpc.cc: Add check for no position independence before
1228         may_need_copy_reloc calls.
1229         * testsuite/pie_copyrelocs_test.cc: New file.
1230         * testsuite/pie_copyrelocs_shared_test.cc: New file.
1231         * Makefile.am (pie_copyrelocs_test): New test.
1232         * Makefile.in: Regenerate.
1233
1234 2014-05-08  Martin Liška  <mliska@suse.cz>
1235
1236         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
1237
1238 2014-05-06  Cary Coutant  <ccoutant@google.com>
1239
1240         PR gold/16900
1241         * i386.cc (Output_data_got_plt_i386): New class.
1242         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
1243         parameter. Change all callers.
1244         (Output_data_plt_i386::layout_): Remove.
1245         (Output_data_plt_i386::got_plt_): Change type.
1246         (Target_i386::got_plt_): Change type. Change all references.
1247         (Target_i386::got_section): Create instance of new class.
1248         (Output_data_got_plt_i386::do_write): New function.
1249         * x86_64.cc (Output_data_got_plt_x86_64): New class.
1250         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
1251         parameter. Change all callers.
1252         (Output_data_plt_x86_64::layout_): Remove.
1253         (Output_data_plt_x86_64::got_plt_): Change type.
1254         (Target_x86_64::got_plt_): Change type. Change all references.
1255         (Target_x86_64::got_section): Create instance of new class.
1256         (Output_data_got_plt_x86_64::do_write): New function.
1257         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
1258         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
1259         class.
1260
1261 2014-05-05  Cary Coutant  <ccoutant@google.com>
1262
1263         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
1264         if we have pubnames/pubtypes.
1265
1266 2014-05-02  Cary Coutant  <ccoutant@google.com>
1267
1268         * defstd.cc (in_segment): Define __ehdr_start here...
1269         * layout.cc (Layout::finalize): ...Instead of here.  Set the
1270         output segment when known.
1271         * resolve.cc (Symbol::override_base_with_special): Remember
1272         the original binding.
1273         * symtab.cc (Symbol::set_output_segment): New function.
1274         (Symbol::set_undefined): New function.
1275         * symtab.h (Symbol::is_weak_undefined): Check original undef
1276         binding.
1277         (Symbol::is_strong_undefined): New function.
1278         (Symbol::set_output_segment): New function.
1279         (Symbol::set_undefined): New function.
1280         * target-reloc.h (is_strong_undefined): Remove.
1281         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
1282         Check for hidden undefs.
1283         (relocate_section): Call Symbol::is_strong_undefined.
1284
1285         * testsuite/Makefile.am (ehdr_start_test_1)
1286         (ehdr_start_test_2, ehdr_start_test_3)
1287         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
1288         * testsuite/Makefile.in: Regenerate.
1289         * testsuite/ehdr_start_def.cc: New source file.
1290         * testsuite/ehdr_start_test.cc: New source file.
1291         * testsuite/ehdr_start_test.t: New linker script.
1292         * testsuite/ehdr_start_test_4.sh: New shell script.
1293
1294 2014-04-23  Cary Coutant  <ccoutant@google.com>
1295
1296         PR gold/16870
1297         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
1298
1299 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1300
1301         * layout.cc (Layout::include_section): Allow a target to decide
1302         whether to include a section.
1303         * target.h (Target::should_include_section): New function.
1304         (Target::do_should_include_section): New function.
1305
1306 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1307
1308         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
1309         inline into ...
1310         (Copy_relocs::emit): ... here.
1311         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
1312         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
1313         (Copy_reloc_entry::entries_): Change from private to protected.
1314
1315 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
1316
1317         * icf.cc (get_section_contents): Replace copies of reloc
1318         vectors with const references.
1319
1320 2014-04-02  Cary Coutant  <ccoutant@google.com>
1321
1322         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
1323         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
1324         * configure: Regenerate.
1325         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
1326         -fno-use-linker-plugin.
1327         (LINK1, CXXLINK1): Add it to the link command.
1328         * testsuite/Makefile.in: Regenerate.
1329
1330 2014-03-12  Alan Modra  <amodra@gmail.com>
1331
1332         * Makefile.in: Regenerate.
1333
1334 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1335
1336         * symtab.h (Symbol::set_nonvis): New function.
1337
1338 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1339
1340         * symtab.cc (Sized_symbol<32>::init_output_data):
1341         Instantiate the template.
1342         (Sized_symbol<64>::init_output_data): Likewise.
1343
1344 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1345
1346         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
1347         adjust dynamic symbol value.
1348         * target.h (Target::adjust_dyn_symbol): New function.
1349         (Target::do_adjust_dyn_symbol): New function.
1350
1351 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1352
1353         * output.cc (Output_data_dynamic::Dynamic_entry::write):
1354         Get the value of DYNAMIC_CUSTOM dynamic entry.
1355         * output.h (Output_data_dynamic::add_custom): New function.
1356         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
1357         dynamic entry.
1358         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
1359         * target.h (Target::dynamic_tag_custom_value): New function.
1360         (Target::do_dynamic_tag_custom_value): New function.
1361
1362 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1363
1364         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
1365         dynsym indexes.
1366         * target.h (Target::has_custom_set_dynsym_indexes): New function.
1367         (Target::do_has_custom_set_dynsym_indexes): New function.
1368         (Target::set_dynsym_indexes): New function.
1369         (Target::do_set_dynsym_indexes): New function.
1370
1371 2014-03-07  Alan Modra  <amodra@gmail.com>
1372
1373         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
1374         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
1375         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
1376         (Powerpc_relocate_functions::has_overflow_bitfield,
1377         overflowed): Use the above.
1378         (Target_powerpc::Relocate::relocate): Correct overflow checking
1379         for a number of relocations.  Modify overflow test for 16-bit
1380         fields in instructions to signed/unsigned according to whether
1381         the field takes a signed or unsigned value.
1382
1383 2014-03-05  Alan Modra  <amodra@gmail.com>
1384
1385         Update copyright years.
1386
1387 2014-03-05  Alan Modra  <amodra@gmail.com>
1388
1389         * powerpc.cc (Target_powerpc::Scan::local, global): Support
1390         R_PPC64_ADDR64_LOCAL.
1391         (Target_powerpc::Relocate::relocate): Likewise.
1392
1393 2014-03-03  Alan Modra  <amodra@gmail.com>
1394
1395         * dwp.cc (print_version): Update copyright year to current.
1396
1397 2014-02-10  Alan Modra  <amodra@gmail.com>
1398
1399         * po/gold.pot: Regenerate.
1400
1401 2014-02-06  Cary Coutant  <ccoutant@google.com>
1402
1403         Fix problem where -u is ignored when a weak undef is seen.
1404
1405         * archive.cc (Library_base::should_include_member): Reorder
1406         code to check for -u option if a weak undef has already been seen.
1407         * testsuite/Makefile.am (weak_undef_test_2): New test case.
1408         * testsuite/Makefile.in: Regenerate.
1409         * testsuite/weak_undef_file3.cc: New file.
1410         * testsuite/weak_undef_file4.cc: New file.
1411         * testsuite/weak_undef_test_2.cc: New file.
1412
1413 2014-02-05  Cary Coutant  <ccoutant@google.com>
1414
1415         Fix issues with gold undefined symbol diagnostics.
1416
1417         PR binutils/15435
1418         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
1419         check to here.
1420         * target-reloc.h (is_strong_undefined): New function.
1421         (relocate_section): Move undef vtable symbol check from here.
1422         Check for is_strong_undefined.
1423
1424 2014-02-05  Cary Coutant  <ccoutant@google.com>
1425
1426         Fix problems with the --dynamic-list option.
1427
1428         PR gold/13577
1429         * options.cc (General_options::parse_dynamic_list):
1430         Set have_dynamic_list_.
1431         (General_options::General_options): Initialize have_dynamic_list_.
1432         (General_options::finalize): Turn off -Bsymbolic and
1433         -Bsymbolic-functions if --dynamic-list provided.
1434         * options.h (General_options::have_dynamic_list): New function.
1435         (General_options::have_dynamic_list_): New data member.
1436         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
1437         correctly.
1438
1439         PR gold/16530
1440         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
1441         in --dynamic-list, mark it.
1442
1443         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
1444         (dynamic_list_2): New test case.
1445         * testsuite/Makefile.in: Regenerate.
1446         * testsuite/dynamic_list_2.cc: New file.
1447         * testsuite/dynamic_list_2.t: New file.
1448         * testsuite/dynamic_list_lib1.cc: New file.
1449         * testsuite/dynamic_list_lib2.cc: New file.
1450         * testsuite/gc_dynamic_list_test.c: New file.
1451         * testsuite/gc_dynamic_list_test.sh: New file.
1452         * testsuite/gc_dynamic_list_test.t: New file.
1453
1454 2014-01-28  Cary Coutant  <ccoutant@google.com>
1455
1456         Add .gdb_index version 7 support.
1457
1458         * gold/dwarf_reader.cc: include <utility> (for make_pair).
1459         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
1460         debug sections.
1461         (Dwarf_ranges_table::read_ranges_table): Likewise.
1462         (Dwarf_pubnames_table::read_section): Check for GNU-style
1463         sections, and for compressed debug sections.
1464         (Dwarf_pubnames_table::read_header): Compute end address of table.
1465         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
1466         for end of list by offset, not by offset == 0.
1467         (Dwarf_info_reader::do_read_string_table): Check for compressed
1468         debug sections.
1469         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1470         Initialize new data members.
1471         (Dwarf_pubnames_table::next_name): return flag_byte.
1472         (Dwarf_pubnames_table::end_of_table_): New data member.
1473         (Dwarf_pubnames_table::is_gnu_style_): New data member.
1474         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
1475         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
1476         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
1477         read skeleton type unit DIEs.
1478         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
1479         (Gdb_index::do_write): Write flag_byte.
1480         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
1481         (Gdb_index::Cu_vector): Store flags along with cu indexes.
1482         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
1483         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
1484
1485 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
1486
1487         * version.cc (print_version): Update copyright year to 2014.
1488
1489 2013-12-19  Dimitry Andric  <dimitry@andric.com>
1490
1491         * stringpool.cc (Stringpool_template::reserve): Add
1492         HAVE_UNORDERED_MAP case.
1493         * stringpool.cc (Stringpool_template::print_stats): Likewise.
1494
1495 2013-12-18  Cary Coutant  <ccoutant@google.com>
1496
1497         * configure.ac: Check for <unordered_set> and <unordered_map>.
1498         * config.in: Regenerate.
1499         * configure: Regenerate.
1500         * system.h: Use <unordered_set> and <unordered_map> if available.
1501
1502 2013-12-10  Roland McGrath  <mcgrathr@google.com>
1503
1504         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
1505         with $(INSTALL_PROGRAM_ENV).
1506         * Makefile.in: Regenerate.
1507
1508 2013-11-22  Cary Coutant  <ccoutant@google.com>
1509
1510         * configure.ac: Add check for which library is needed for
1511         dlopen.
1512         * configure: Regenerate.
1513
1514 2013-11-22  Cary Coutant  <ccoutant@google.com>
1515
1516         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
1517         assembler.
1518         * testsuite/Makefile.in: Regenerate.
1519
1520 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
1521
1522         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
1523         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
1524         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
1525         (Target_x86_64<size>::Scan::local): Likewise.
1526         (Target_x86_64<size>::Scan::global): Likewise.
1527         (Target_x86_64<size>::Relocate::relocate): Likewise.
1528         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
1529         Likewise.
1530         (Target_x86_64<size>::Scan::check_non_pic(): Handle
1531         R_X86_64_PC32_BND.
1532
1533         * testsuite/Makefile.am (check_PROGRAMS): Add
1534         exception_x86_64_bnd_test.
1535         (exception_x86_64_bnd_test_SOURCES): New macro.
1536         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
1537         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
1538         (exception_x86_64_bnd_test_LDADD): Likewise.
1539         (exception_x86_64_bnd_1.o): New rule.
1540         (exception_x86_64_bnd_2.o): Likewise.
1541         * testsuite/Makefile.in: Regenerated.
1542
1543 2013-11-15  Alan Modra  <amodra@gmail.com>
1544
1545         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
1546         accessor.
1547         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
1548         Only call ppc64_local_entry_offset for 64-bit.  Restrict
1549         symval_for_branch lookup to ELFv1.
1550         (Stub_table::add_plt_call_entry): Use unsigned int off.
1551         (Output_data_glink::Address, invalid_address): New.
1552         (Output_data_glink::add_eh_frame): Move out of line.  Add
1553         support for ELFv2.
1554         (Output_data_glink::add_global_entry, find_global_entry,
1555         global_entry_address): New functions.
1556         (Output_data_glink::global_entry_stubs_, end_branch_table_,
1557         ge_size): New variables.
1558         (Output_data_glink::set_final_data_size): Add global entry
1559         stub sizing.
1560         (Output_data_glink::do_write): Write global entry stubs.
1561         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
1562         parameter.  Return true for ELFv2.  Adjust callers.
1563         (Target_powerpc::Scan::local, global): Restrict opd lookup to
1564         ELFv1.  Similarly for ifunc and dynamic relocation processing
1565         specific to ELFv1.  Recognize that symbols are defined on
1566         their plt entries for ELFv2.
1567         (Target_powerpc::symval_for_branch): Assert if called for
1568         ELFv2 or ppc32.
1569         (Target_powerpc::Relocate::relocate): Use global entry plt
1570         stub for symbol value if such exists on ELFv2.
1571         (Target_powerpc::Relocate::relocate): Don't call
1572         symval_for_branch when ELFv2.  Do adjust for local entry
1573         offset when ELFv2.
1574         (Target_powerpc::do_dynsym_value): Set symbols to global entry
1575         plt stub for ELFv2.
1576         (Target_powerpc::do_plt_address_for_global): Similarly.
1577
1578 2013-11-14  Cary Coutant  <ccoutant@google.com>
1579
1580         Revert patch -- this did not fix the problem, and there is
1581         no race there.
1582
1583         2013-11-14  Cary Coutant  <ccoutant@google.com>
1584
1585             PR gold/14860
1586             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1587             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1588             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1589             updating fde_offsets_.
1590             (Eh_frame_hdr::lock_): New data member.
1591
1592 2013-11-14  Cary Coutant  <ccoutant@google.com>
1593
1594         * dwp.cc (Dwo_file_entry): New type.
1595         (File_list): Use Dwo_file_entry.
1596         (Dwo_file::verify): New function.
1597         (Dwo_file::verify_dwo_list): New function.
1598         (Dwo_file::sized_verify_dwo_list): New function.
1599         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
1600         list.
1601         (Dwp_options): New enum type.
1602         (dwp_options): Add --verify-only.
1603         (usage): Likewise.
1604         (main): Likewise.
1605         * dwp.h (gold_info): Add declaration.
1606
1607 2013-11-14  Cary Coutant  <ccoutant@google.com>
1608
1609         PR gold/14860
1610         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1611         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1612         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1613         updating fde_offsets_.
1614         (Eh_frame_hdr::lock_): New data member.
1615
1616 2013-11-06  Cary Coutant  <ccoutant@google.com>
1617
1618         PR gold/15758
1619         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
1620         before reloc sections.
1621
1622 2013-11-04  Alan Modra  <amodra@gmail.com>
1623
1624         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
1625         (Symbol::needs_dynamic_reloc): Test new flag.
1626         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
1627         (Target_powerpc::Scan::get_reference_flags): Add target param.
1628         Return FUNC_DESC_ABI for 64-bit ELFv1.
1629         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
1630         call.
1631         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
1632         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
1633
1634 2013-10-31  Cary Coutant  <ccoutant@google.com>
1635
1636         Restore support for dwp v2 DWARF package file format.
1637
1638         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1639         tu_length parameter.  Adjust all callers.
1640         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1641         * dwp.cc: Include dwarf.h.
1642         (Section_bounds): New struct type.
1643         (Unit_set): New struct type.
1644         (Dwo_file::Dwo_file): Initialize new data member.
1645         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1646         Combine and rename to...
1647         (Dwo_file::read_unit_index): ...this.
1648         (Dwo_file::sized_read_compunit_index)
1649         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1650         (Dwo_file::sized_read_unit_index): ...this.
1651         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1652         parameters; add section_id parameter.
1653         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1654         (Dwo_file::add_unit_set): ...this.
1655         (Dwo_file::shndx_map_): Remove.
1656         (Dwo_file::sect_offsets_): New data member.
1657         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1658         (Dwp_output_file::add_section): Rename to...
1659         (Dwp_output_file::add_contribution): ...this.
1660         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1661         (Dwp_output_file::add_tu_set): Likewise.
1662         (Dwp_output_file::Contribution): New type.
1663         (Dwp_output_file::Section::contributions): New data member.
1664         (Dwp_output_file::Cu_or_tu_set): Remove.
1665         (Dwp_output_file::Section::Section): New ctor.
1666         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1667         (Dwp_output_file::Dwp_index::Section_table): New type.
1668         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1669         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1670         parameter.
1671         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1672         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1673         (Dwp_output_file::Dwp_index::section_table): New member function.
1674         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1675         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1676         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1677         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1678         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1679         (Dwp_output_file::Dwp_index::section_table_): New data member.
1680         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1681         (Dwp_output_file::add_output_section): New member function.
1682         (Dwp_output_file::write_new_section): New member function.
1683         (Dwp_output_file::write_contributions): New member function.
1684         (Dwp_output_file::section_id_map_): New data member.
1685         (class Dwo_id_info_reader): Remove.
1686         (class Unit_reader): New class.
1687         (get_dwarf_section_name): New function.
1688         (Dwo_file::read_executable): Adjust initializations of class data.
1689         (Dwo_file::read): Add support for v2 package file format.
1690         (Dwo_file::read_unit_index): Likewise.
1691         (Dwo_file::sized_read_unit_index): Likewise.
1692         (Dwo_file::copy_section): Likewise.
1693         (Dwo_file::add_unit_set): Likewise.
1694         (Dwp_output_file::add_output_section): Likewise.
1695         (Dwp_output_file::add_contribution): Likewise.
1696         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1697         for empty slot.
1698         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1699         file format.
1700         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1701         slot.
1702         (Dwp_output_file::initialize): Remove unused function.
1703         (Dwp_output_file::finalize): Add support for v2 package file format.
1704         (Dwp_output_file::write_index): Likewise.
1705         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1706         function prototype.
1707
1708 2013-10-31  Cary Coutant  <ccoutant@google.com>
1709
1710         * configure.ac: Fix check for -fmerge-constants.
1711         * configure.ac: Regenerate.
1712
1713 2013-10-30  Roland McGrath  <mcgrathr@google.com>
1714
1715         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
1716         Correct 9-byte nop sequence to match what the assembler generates.
1717
1718 2013-10-30  Alan Modra  <amodra@gmail.com>
1719
1720         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
1721         ppc64_local_entry_offset, ppc64_local_entry_offset,
1722         do_read_symbols): New functions.
1723         (Powerpc_relobj::e_flags_, st_other_): New vars.
1724         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
1725         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
1726         (Powerpc_relobj::e_flags_): New var.
1727         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
1728         and adjust for ELFv2.
1729         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
1730         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
1731         (Powerpc_dynobj::do_find_special_sections): Likewise.
1732         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
1733         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
1734         to ELFv2 local entry.
1735         (Target_powerpc::do_relax): No thread safe barriers needed for
1736         ELFv2.
1737         (Output_data_plt_powerpc::initial_plt_entry_size_,
1738         plt_entry_size): Delete.  Replace all uses with
1739         first_plt_entry_offset() and plt_entry_size().
1740         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
1741         reserved_size parm.  Update callers.
1742         (Output_data_plt_powerpc::entry_count): Update.
1743         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
1744         and use Target_powerpc::first_plt_entry_offset().
1745         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
1746         rename to plt_entry_size.
1747         (Output_data_plt_powerpc::add_ifunc_entry,
1748         add_local_ifunc_entry): Adjust reloc for ELFv2.
1749         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
1750         (glink_eh_frame_fde_64v2): New.
1751         (Stub_table::plt_call_size): Support ELFv2 sizing.
1752         (Output_data_glink::add_eh_frame): Use the new FDE.
1753         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
1754         (Stub_table::do_write): Write ELFv2 stubs and glink.
1755         (Target_powerpc::Relocate::relocate): Replaces nop after call
1756         with ld 2,24(1) and adjust local offset destination for ELFv2.
1757
1758 2013-10-30  Alan Modra  <amodra@gmail.com>
1759
1760         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
1761         (Target_powerpc::Scan::global, local): Likewise.
1762         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
1763         on all ppc64 @h and @ha relocs.
1764
1765 2013-10-14  Alan Modra  <amodra@gmail.com>
1766
1767         * output.h (Output_data_got::add_constant): Tidy.
1768         (Output_data_got::add_constant_pair): New function.
1769         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
1770         methods used so as to first call reserve_ent().
1771
1772 2013-10-11  Roland McGrath  <mcgrathr@google.com>
1773
1774         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
1775         add_got_entry and add_got_entry_pair.
1776
1777         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
1778         (HAVE_PUBNAMES): Likewise.
1779         * configure: Regenerate.
1780
1781         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
1782         * testsuite/Makefile.in: Regenerate.
1783
1784         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
1785         Remove const from declaration.
1786         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
1787         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
1788         * output.h (Output_file_header): Remove const from member target_
1789         and corresponding constructor argument.
1790         * output.cc (Output_file_header::Output_file_header): Update prototype.
1791         (Output_file_header::do_sized_write): Use this->target_ in place
1792         of parameters()->target().
1793
1794         * testsuite/undef_symbol.cc (Foo::get_a): New method.
1795
1796         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
1797         * configure: Regenerate.
1798         * Makefile.in: Regenerate.
1799         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
1800         * testsuite/merge_string_literals_2.c: Likewise.
1801         * testsuite/Makefile.am
1802         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
1803         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
1804         literal -fmerge-constants.
1805         * testsuite/Makefile.in: Regenerate.
1806
1807         * i386.cc (Target_i386): Remove unused member dynbss_.
1808         * arm.cc (Target_arm): Likewise.
1809         * powerpc.cc (Target_powerpc): Likewise.
1810         * sparc.cc (Target_sparc): Likewise.
1811         * tilegx.cc (Target_tilegx): Likewise.
1812         * x86_64.cc (Target_x86_64): Likewise.
1813         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
1814         type_signature_, type_offset_.
1815         * plugin.h (Plugin_hook): Remove unused member layout_.
1816         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
1817         mapfile_.
1818         (Read_member): Remove unused members input_objects_, symtab_,
1819         mapfile_, layout_.
1820         (Check_library): Remove unused member symtab_.
1821         * archive.h (Lib_group): Remove unused member lib_.
1822         * archive.cc (Lib_group::Lib_group): Update initializer.
1823         * incremental.h (Incremental_binary): Remove unused member target_.
1824         (Incremental_script_entry): Removed unused member script_.
1825         * layout.h (Write_symbols_task): Remove unused member input_objects_.
1826         * icf.h (Icf): Remove unused member num_tracked_relocs.
1827
1828         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1829         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1830         its only use.
1831         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1832
1833         * archive.h: Use struct rather than class for forward declaration
1834         of Read_symbols_data.
1835
1836 2013-10-07  Cary Coutant  <ccoutant@google.com>
1837
1838         PR gold/16010
1839         * testsuite/Makefile.am (icf_test): Fix dependencies.
1840         (icf_safe_test): Likewise.
1841         (icf_safe_so_test): Likewise.
1842         (large_symbol_alignment): Add empty _LDADD rule.
1843         * testsuite/Makefile.in: Regenerate.
1844
1845 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
1846
1847         PR gold/15927
1848         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1849         relocation for R_X86_64_32 on x32.
1850
1851 2013-08-27  Roland McGrath  <mcgrathr@google.com>
1852
1853         * output.cc (Output_segment::set_section_addresses): Take new
1854         Target* argument.  If target->isolate_execinstr() and the segment
1855         is executable and starts at a target->abi_pagesize() boundary,
1856         pad its end out to a target->abi_pagesize() boundary with code fill.
1857         * output.h (Output_segment::set_section_addresses): Update decl.
1858         * layout.h (Layout::check_output_data_for_reset_values): Take new
1859         argument RELAX_OUTPUTS.
1860         (Layout): New member relax_output_list_.
1861         (Layout::add_relax_output): New method.
1862         * layout.cc (Layout::Layout): Update constructor.
1863         (Layout::reset_relax_output): New method.
1864         (Layout::clean_up_after_relaxation): Call it.
1865         (Layout::prepare_for_relaxation): Update caller.
1866         (Layout::set_segment_offsets): Update callers of set_section_addresses.
1867         Call reset_relax_output before re-processing segments for
1868         isolate_execinstr case.
1869         (Layout::write_data): Handle relax_output_list_.
1870         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1871         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
1872
1873 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
1874
1875         PR binutils/15834
1876         * object.h: Fix typos.
1877
1878 2013-08-16  Roland McGrath  <mcgrathr@google.com>
1879
1880         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1881         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1882
1883 2013-08-07  Cary Coutant  <ccoutant@google.com>
1884
1885         Revert support for v2 DWP files:
1886
1887         2013-03-01  Cary Coutant  <ccoutant@google.com>
1888
1889             Add dwp support for v2 DWARF package file format.
1890             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1891             tu_length parameter.  Adjust all callers.
1892             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1893             * dwp.cc: Include dwarf.h.
1894             (Section_bounds): New struct type.
1895             (Unit_set): New struct type.
1896             (Dwo_file::Dwo_file): Initialize new data member.
1897             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1898             Combine and rename to...
1899             (Dwo_file::read_unit_index): ...this.
1900             (Dwo_file::sized_read_compunit_index)
1901             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1902             (Dwo_file::sized_read_unit_index): ...this.
1903             (Dwo_file::copy_section): Remove section_name, is_str_offsets
1904             parameters; add section_id parameter.
1905             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1906             (Dwo_file::add_unit_set): ...this.
1907             (Dwo_file::shndx_map_): Remove.
1908             (Dwo_file::sect_offsets_): New data member.
1909             (Dwp_output_file::Dwp_output_file): Initialize new data members.
1910             (Dwp_output_file::add_section): Rename to...
1911             (Dwp_output_file::add_contribution): ...this.
1912             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1913             (Dwp_output_file::add_tu_set): Likewise.
1914             (Dwp_output_file::Contribution): New type.
1915             (Dwp_output_file::Section::contributions): New data member.
1916             (Dwp_output_file::Cu_or_tu_set): Remove.
1917             (Dwp_output_file::Section::Section): New ctor.
1918             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1919             (Dwp_output_file::Dwp_index::Section_table): New type.
1920             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1921             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1922             parameter.
1923             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1924             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1925             (Dwp_output_file::Dwp_index::section_table): New member function.
1926             (Dwp_output_file::Dwp_index::section_table_end): New member function.
1927             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1928             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1929             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1930             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1931             (Dwp_output_file::Dwp_index::section_table_): New data member.
1932             (Dwp_output_file::Dwp_index::section_mask_): New data member.
1933             (Dwp_output_file::add_output_section): New member function.
1934             (Dwp_output_file::write_new_section): New member function.
1935             (Dwp_output_file::write_contributions): New member function.
1936             (Dwp_output_file::section_id_map_): New data member.
1937             (class Dwo_id_info_reader): Remove.
1938             (class Unit_reader): New class.
1939             (get_dwarf_section_name): New function.
1940             (Dwo_file::read_executable): Adjust initializations of class data.
1941             (Dwo_file::read): Add support for v2 package file format.
1942             (Dwo_file::read_unit_index): Likewise.
1943             (Dwo_file::sized_read_unit_index): Likewise.
1944             (Dwo_file::copy_section): Likewise.
1945             (Dwo_file::add_unit_set): Likewise.
1946             (Dwp_output_file::add_output_section): Likewise.
1947             (Dwp_output_file::add_contribution): Likewise.
1948             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1949             for empty slot.
1950             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1951             file format.
1952             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1953             slot.
1954             (Dwp_output_file::initialize): Remove unused function.
1955             (Dwp_output_file::finalize): Add support for v2 package file format.
1956             (Dwp_output_file::write_index): Likewise.
1957             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1958             function prototype.
1959
1960 2013-07-31  Cary Coutant  <ccoutant@google.com>
1961
1962         * object.cc (Sized_relobj::do_output_section_address): New function.
1963         (Sized_relobj): Instantiate explicitly.
1964         * object.h (Object::output_section_address): New function.
1965         (Object::do_output_section_address): New function.
1966         (Sized_relobj::do_output_section_address): New function.
1967         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1968
1969 2013-07-30  Cary Coutant  <ccoutant@google.com>
1970             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1971
1972         * parameters.cc (Parameters::entry): Return target-specific entry
1973         symbol name.
1974         * target.h (Target::entry_symbol_name): New function.
1975         (Target_info::entry_symbol_name): New data member.
1976
1977         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1978         * i386.cc (Target_i386::i386_info): Likewise.
1979         (Target_i386_nacl::i386_nacl_info): Likewise.
1980         * sparc.cc (Target_sparc::sparc_info): Likewise.
1981         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1982         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1983         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1984         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1985
1986 2013-07-22  Sterling Augustine  <saugustine@google.com>
1987
1988         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1989         Convert parameter shndx to local variable. Add parameters symtab
1990         and symtab_size.  Scan over section names.  Find relocation
1991         section corresponding to current section.  Create and initialize
1992         reloc_mapper_ and reloc_type_.
1993         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
1994         unit_length to off_t.  Initialize member unit_length_.  Fill in field
1995         cu_offset_.
1996         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1997         Initialize new fields unit_length_ and cu_offset_.
1998         (Dwarf_pubnames_table::read_section): Update prototype.
1999         (Dwarf_pubnames_table::cu_offset): New member function.
2000         (Dwarf_pubnames_table::subsection_size): Likewise.
2001         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
2002         New fields.
2003         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
2004         member functions public.
2005         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
2006         Update comment.  Rework logic.  Move repeated parts to...
2007         (Gdb_index_info_reader::read_pubtable): ...here. New function.
2008         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
2009         pubtypes_table_, and stmt_list_offset.
2010         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2011         Gdb_index::find_pubtype_offset,
2012         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
2013         (Gdb_index::pubnames_read): Update prototype and rework logic.
2014         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
2015         Forward declare.
2016         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2017         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
2018         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
2019         Gdb_index::map_pubtable_to_dies):
2020         Declare functions.
2021         (Gdb_index::pubnames_read): Update declaration.
2022         (Gdb_index::Pubname_offset_map): New type.
2023         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
2024         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
2025         Gdb_index::stmt_list_offset): Declare.
2026         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
2027         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
2028         Gdb_index::pubtypes_offset_): Remove.
2029
2030 2013-07-19  Roland McGrath  <mcgrathr@google.com>
2031
2032         * options.h (General_options): Add -Trodata-segment option.
2033         * parameters.cc (Parameters::check_rodata_segment): New function.
2034         (Parameters::set_target_once): Call it.
2035         * parameters.h (Parameters): Declare it (private member function).
2036         * layout.cc (load_seg_unusable_for_headers): New function, broken
2037         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
2038         then validate rodata segment rather than text segment.
2039         (relaxation_loop_body): Call that.
2040         (is_text_segment): New function.  Don't admit a non-executable
2041         segment if TARGET->isolate_execinstr().
2042         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
2043
2044 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
2045
2046         PR gold/15070
2047         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
2048         * nacl.h (Sniff_file::View::View): Request aligned view.
2049
2050 2013-07-11  Cary Coutant  <ccoutant@google.com>
2051
2052         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
2053         correct BRLT entry size.
2054
2055 2013-07-03  Alan Modra  <amodra@gmail.com>
2056
2057         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
2058         comment.
2059
2060 2013-07-01  Cary Coutant  <ccoutant@google.com>
2061
2062         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
2063         reloc_type_.
2064         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
2065         (Dwarf_ranges_table::lookup_reloc): New function.
2066         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
2067         reloc_type_.
2068         (Dwarf_ranges_table::lookup_reloc): New function.
2069         (Dwarf_ranges_table::reloc_type_): New data member.
2070
2071 2013-06-27  Jing Yu  <jingyu@google.com>
2072
2073         PR gold/15662
2074         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
2075         function.
2076         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
2077         (Target_powerpc::do_relax): Call the above.
2078
2079 2013-06-27  Cary Coutant  <ccoutant@google.com>
2080
2081         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
2082         on garbage collected .opd section.
2083
2084 2013-06-27  Alan Modra  <amodra@gmail.com>
2085
2086         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
2087         is non-zero.
2088         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
2089         (Target_powerpc::do_function_location): Likewise for loc->shndx.
2090
2091 2013-06-14  Cary Coutant  <ccoutant@google.com>
2092
2093         * resolve.cc (Symbol::override_base): Don't override st_type
2094         from plugin placeholder symbols.
2095         (Symbol_table::resolve): Likewise.
2096         (Symbol_table::should_override): Don't complain about TLS mismatch
2097         if the TO symbol is a plugin placeholder.
2098         * testsuite/Makefile.am (plugin_test_tls): New test.
2099         * testsuite/Makefile.in: Regenerate.
2100         * testsuite/plugin_test_tls.sh: New test script.
2101         * testsuite/two_file_test_2_tls.cc: New test source.
2102         * testsuite/two_file_test_tls.cc: New test source.
2103
2104 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2105
2106         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
2107         the maximum segment alignment is larger than the page size.
2108         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
2109         correctly aligns the symbols with large alignemnt.
2110         * testsuite/Makefile.in: Regenerate.
2111         * testsuite/large_symbol_alignment.cc: New file.
2112
2113 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2114             Sriraman Tallam  <tmsriram@google.com>
2115
2116         * options.h (sort_section): New option.
2117         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
2118         Rename from Input_section_sort_section_name_special_ordering_compare.
2119         (Input_section_sort_section_name_compare): New struct.
2120         * output.cc (Output_section::Input_section_sort_section_name_compare::
2121         operator()): New function.
2122         (Output_section::sort_attached_input_sections): Use new sort function
2123         for .text if --sort-section=name is specified.
2124         * layout.cc (Layout::make_output_section):
2125         Add sorting by name when --sort-section=name is specified.
2126         * testsuite/Makefile.am (text_section_grouping): Test option
2127         --sort-section=name.
2128         * testsuite/Makefile.in: Regenerate.
2129         * testsuite/section_sorting_name.cc: New file.
2130         * testsuite/section_sorting_name.sh: New file.
2131
2132 2013-05-21  Cary Coutant  <ccoutant@google.com>
2133
2134         * symtab.h (Symbol::is_cxx_vtable): New function.
2135         * target-reloc.h (relocate_section): Check for vtable symbol.
2136         * testsuite/Makefile.am (missing_key_func.sh): New test case.
2137         * testsuite/Makefile.in: Regenerate.
2138         * testsuite/missing_key_func.cc: New test source.
2139         * testsuite/missing_key_func.sh: New test script.
2140
2141 2013-05-21  Cary Coutant  <ccoutant@google.com>
2142
2143         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
2144         type of enclosing symbol.
2145         (Relocate_info::location): Check symbol type when describing symbol.
2146         * object.h (Symbol_location_info): Remove unused line_number;
2147         add enclosing_symbol_type.
2148         * testsuite/debug_msg.sh: Adjust expected output.
2149
2150 2013-05-13  Cary Coutant  <ccoutant@google.com>
2151
2152         * configure.ac: Export DEFAULT_TARGET.
2153         * configure: Regenerate.
2154         * Makefile.in: Regenerate.
2155         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
2156         * testsuite/Makefile.in: Regenerate.
2157         * testsuite/debug_msg.sh: Delete duplicate tests.
2158         Don't check undef_int error message match for powerpc where the
2159         source file and line number aren't available.
2160
2161 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2162
2163         * options.h (General_options): Add --rosegment-gap option.
2164         * options.cc (finalize): --rosegment-gap implies --rosegment.
2165         * layout.cc (set_segment_offsets): Let user option override
2166         target->rosegment_gap().
2167
2168 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2169
2170         * options.h (General_options): Remove leading space from help
2171         messages for -nostdlib and --rosegment.
2172
2173 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
2174
2175         PR ld/15365
2176         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
2177
2178 2013-05-03  Alan Modra  <amodra@gmail.com>
2179
2180         * merge.cc (Output_merge_string::do_add_input_section): Correct
2181         scan for number of strings.  Rename vars to avoid shadowing.
2182         Include missing terminator in input_size_.
2183
2184 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
2185
2186         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
2187         Restore empty string handling.
2188
2189 2013-05-01  Cary Coutant  <ccoutant@google.com>
2190
2191         * stringpool.cc (Stringpool_template::new_key_offset): Fix
2192         uninitialized warning.
2193
2194 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2195
2196         * output.cc (Output_section::add_merge_input_section): Allow
2197         to merge sections if the alignment is more than character size.
2198         * merge.h (Output_merge_string::Output_merge_string): Remove
2199         assert.
2200         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
2201         only not-null strings. Check the alignment of strings.
2202         * stringpool.h
2203         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
2204         alignment as the argument.
2205         (Stringpool_template<Stringpool_char>::addralign_): New class member.
2206         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
2207         Align non-zero length strings according to the addralign_.
2208         (Stringpool_template<Stringpool_char>::set_string_offsets):
2209         Updating offsets according to the given alignment.
2210         * testsuite/Makefile.am (text_section_grouping): Test if string
2211         literals are getting merged.
2212         * testsuite/Makefile.in: Regenerate.
2213         * testsuite/merge_string_literals_1.c: New file.
2214         * testsuite/merge_string_literals_2.c: Ditto.
2215         * testsuite/merge_string_literals.sh: Ditto.
2216
2217 2013-04-26  Ian Lance Taylor  <iant@google.com>
2218
2219         * target-reloc.h (relocate_section): If the reloc offset is out of
2220         range, pass VIEW as NULL to relocate.relocate.
2221         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
2222         * i386.cc (Target_i386::Relocate::relocate): Likewise.
2223         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
2224         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
2225         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
2226         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2227
2228 2013-04-26  Geoff Pike  <gpike@chromium.org>
2229
2230         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
2231         * layout.cc (Hash_task): New class.
2232         (Layout::queue_build_id_tasks): New function.
2233         (Layout::write_build_id): Handle single-thread portion of build ID
2234         computation.  (In some cases, all of it is single-threaded.)  Replace
2235         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
2236         functionality in fewer lines of code.
2237         * layout.h (Layout::queue_build_id_tasks): New function declaration.
2238         * options.h (General_options): make "--build-id" default to tree
2239         rather than sha1.  Add two new options related to --build-id=tree:
2240         --build-id-chunk-size-for-treehash and
2241         --build-id-min-file-size-for-treehash.
2242         * Makefile.am: add testing of --build-id=tree and related new options
2243         (these tests will be invoked by "make check").
2244         * Makefile.in: Regenerate.
2245
2246 2013-04-25  Alan Modra  <amodra@gmail.com>
2247
2248         * configure.tgt: Add powerpcle and powerpc64le.
2249
2250 2013-04-22  Alan Modra  <amodra@gmail.com>
2251
2252         PR gold/15355
2253         * layout.cc (Layout::segment_precedes): Allow more than one
2254         segment with the same type and flags.
2255
2256 2013-04-15  Cary Coutant  <ccoutant@google.com>
2257
2258         * layout.cc (Layout::set_relocatable_section_offsets): Don't
2259         allocate space in file for BSS sections.
2260
2261 2013-04-15  Cary Coutant  <ccoutant@google.com>
2262
2263         * script-sections.cc (Orphan_output_section): Reset address
2264         to zero after each orphaned section for relocatable links.
2265
2266 2013-04-15  Cary Coutant  <ccoutant@google.com>
2267
2268         * symtab.cc (Symbol_table::sized_write_globals): Subtract
2269         section starting address for relocatable link.
2270         * testsuite/Makefile.am (script_test_11): New test.
2271         * testsuite/Makefile.in: Regenerate.
2272         * testsuite/script_test_11.c: New source file.
2273         * testsuite/script_test_11.t: New linker script.
2274
2275 2013-04-13  Alan Modra  <amodra@gmail.com>
2276
2277         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
2278         owner when sections are not adjacent and exceed group size.
2279         (Target_powerpc::group_sections): Handle corner case.
2280         (Target_powerpc::Branch_info::make_stub): Handle case where
2281         stub table doesn't exist due to branches in non-exec sections.
2282         (Target_powerpc::Relocate::relocate): Likewise.
2283
2284 2013-04-11  Alan Modra  <amodra@gmail.com>
2285
2286         PR gold/15354
2287         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
2288         .branch_lt to match bfd ld.  Adjust comments throughout file.
2289
2290 2013-04-04  Ian Lance Taylor  <iant@google.com>
2291
2292         GCC PR c++/56840
2293         * object.cc (do_layout_deferred_sections): Handle .eh_frame
2294         sections before checking whether they are included in the link.
2295
2296 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
2297
2298         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
2299         object before calling the plugin claim_file handler.  Pass the elf
2300         object of the archive to the plugin. Delete the elf object if the
2301         plugin claims the file.
2302
2303 2013-03-21  Alan Modra  <amodra@gmail.com>
2304
2305         * layout.cc (Layout::set_segment_offsets): Accept writable .text
2306         segment when omagic.
2307
2308 2013-03-21  Alan Modra  <amodra@gmail.com>
2309
2310         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
2311         comparison warning.
2312         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
2313         uninitialized" warning.
2314
2315 2013-03-20  Alan Modra  <amodra@gmail.com>
2316
2317         * symtab.h (Symbol::clear_version): New function.
2318         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
2319         is_needed by weak references.  Clear version for symbols defined
2320         in as-needed objects that are not needed.
2321
2322 2013-03-15  Alan Modra  <amodra@gmail.com>
2323
2324         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
2325         static and public.  Add report_err param.  Return false for data refs.
2326         (Target_powerpc::rela_dyn_section): New overloaded function.
2327         (Target_powerpc::plt_, iplt_): Elucidate.
2328         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
2329         (Output_data_plt_powerpc::do_write): Don't write .iplt.
2330         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
2331         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
2332         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
2333         push_branch and make_plt_entry for ifunc syms when
2334         reloc_needs_plt_for_ifunc.
2335         (Target_powerpc::Relocate::relocate): Don't use plt entry value
2336         for ifunc unless reloc_needs_plt_for_ifunc.
2337
2338 2013-03-15  Alan Modra  <amodra@gmail.com>
2339
2340         * gc.h (gc_process_relocs): Don't look through function descriptors.
2341         * icf.cc (get_section_contents): Do so here instead.
2342
2343 2013-03-13  Alan Modra  <amodra@gmail.com>
2344
2345         * powerpc.cc (is_branch_reloc): Forward declare.
2346         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
2347         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
2348         false for 64-bit, true for 32-bit non-branch relocs.
2349         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
2350         * testsuite/Makefile.am (icf_test): Use linker map file instead of
2351         nm output.
2352         (icf_safe_test): Generate linker map file as well as nm output.
2353         (icf_safe_so_test): Likewise.
2354         * testsuite/Makefile.in: Regenerate.
2355         * testsuite/icf_test.sh: Parse linker map file to determine
2356         section folding.
2357         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
2358         * testsuite/icf_safe_so_test.sh: Likewise.
2359         (X86_32_or_ARM_specific_safe_fold): Merge into..
2360         (arch_specific_safe_fold): ..this.
2361         (X86_64_specific_safe_fold): Delete unused function.
2362
2363 2013-03-12  Alan Modra  <amodra@gmail.com>
2364
2365         * gc.h (gc_process_relocs): Look through function descriptors
2366         to determine shndx, symvalue and addend used by ICF.  Tidy
2367         variable duplication.
2368
2369 2013-03-11  Alan Modra  <amodra@gmail.com>
2370
2371         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
2372         * layout.cc (Layout_task_runner::run): ..to here.
2373         * symtab.h (struct Symbol_location): Extract from..
2374         (class Symbol_table): ..here.
2375         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
2376         * target.h (class Target): Add function_location and
2377         do_function_location functions.
2378         (class Sized_target): Add do_function_location.
2379         * object.h (class Sized_relobj_file): Move find_shdr..
2380         (class Object): ..to here.
2381         * object.cc: Likewise.  Update to suit.  Instantiate.
2382         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
2383         * powerpc.cc (class Powerpc_dynobj): New.
2384         (Target_powerpc::do_function_location): New function.
2385         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
2386         (Powerpc_dynobj::do_read_symbols): New function.
2387         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
2388
2389 2013-03-08  Ian Lance Taylor  <iant@google.com>
2390
2391         * options.cc (General_options::string_to_object_format): Accept
2392         "default".
2393
2394 2013-03-08  Alan Modra  <amodra@gmail.com>
2395
2396         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
2397         pointer to Post_fde.
2398         (struct Post_fde): Move definition to here..
2399         * ehframe.cc (struct Post_fde): ..from here.
2400         (Cie::write): Don't alloc Post_fde.
2401         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
2402
2403 2013-03-07  Alan Modra  <amodra@gmail.com>
2404
2405         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
2406         relocation referencing .LC0.
2407         * testsuite/discard_locals_test.sh: Remove FIXMEs.
2408
2409 2013-03-07  Alan Modra  <amodra@gmail.com>
2410
2411         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
2412         always_inline.  Add assembly for powerpc to avoid GOT.
2413
2414 2013-03-07  Alan Modra  <amodra@gmail.com>
2415
2416         * testsuite/script_test_10.sh: Don't test .bss section
2417         header number.
2418
2419 2013-03-06  Alan Modra  <amodra@gmail.com>
2420
2421         * powerpc.cc (class Powerpc_relobj): Move some member functions.
2422         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
2423         all callers.  Handle folded sections.
2424         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
2425         to Powerpc_relobj.
2426         (Global_symbol_visitor_opd::operator()): Likewise.
2427
2428 2013-03-04  Alan Modra  <amodra@gmail.com>
2429
2430         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
2431         * testsuite/Makefile.in: Regenerate.
2432
2433 2013-03-01  Cary Coutant  <ccoutant@google.com>
2434
2435         Add dwp support for v2 DWARF package file format.
2436         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2437         tu_length parameter.  Adjust all callers.
2438         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2439         * dwp.cc: Include dwarf.h.
2440         (Section_bounds): New struct type.
2441         (Unit_set): New struct type.
2442         (Dwo_file::Dwo_file): Initialize new data member.
2443         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2444         Combine and rename to...
2445         (Dwo_file::read_unit_index): ...this.
2446         (Dwo_file::sized_read_compunit_index)
2447         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2448         (Dwo_file::sized_read_unit_index): ...this.
2449         (Dwo_file::copy_section): Remove section_name, is_str_offsets
2450         parameters; add section_id parameter.
2451         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2452         (Dwo_file::add_unit_set): ...this.
2453         (Dwo_file::shndx_map_): Remove.
2454         (Dwo_file::sect_offsets_): New data member.
2455         (Dwp_output_file::Dwp_output_file): Initialize new data members.
2456         (Dwp_output_file::add_section): Rename to...
2457         (Dwp_output_file::add_contribution): ...this.
2458         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2459         (Dwp_output_file::add_tu_set): Likewise.
2460         (Dwp_output_file::Contribution): New type.
2461         (Dwp_output_file::Section::contributions): New data member.
2462         (Dwp_output_file::Cu_or_tu_set): Remove.
2463         (Dwp_output_file::Section::Section): New ctor.
2464         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2465         (Dwp_output_file::Dwp_index::Section_table): New type.
2466         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2467         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2468         parameter.
2469         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2470         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2471         (Dwp_output_file::Dwp_index::section_table): New member function.
2472         (Dwp_output_file::Dwp_index::section_table_end): New member function.
2473         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2474         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2475         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2476         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2477         (Dwp_output_file::Dwp_index::section_table_): New data member.
2478         (Dwp_output_file::Dwp_index::section_mask_): New data member.
2479         (Dwp_output_file::add_output_section): New member function.
2480         (Dwp_output_file::write_new_section): New member function.
2481         (Dwp_output_file::write_contributions): New member function.
2482         (Dwp_output_file::section_id_map_): New data member.
2483         (class Dwo_id_info_reader): Remove.
2484         (class Unit_reader): New class.
2485         (get_dwarf_section_name): New function.
2486         (Dwo_file::read_executable): Adjust initializations of class data.
2487         (Dwo_file::read): Add support for v2 package file format.
2488         (Dwo_file::read_unit_index): Likewise.
2489         (Dwo_file::sized_read_unit_index): Likewise.
2490         (Dwo_file::copy_section): Likewise.
2491         (Dwo_file::add_unit_set): Likewise.
2492         (Dwp_output_file::add_output_section): Likewise.
2493         (Dwp_output_file::add_contribution): Likewise.
2494         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2495         for empty slot.
2496         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2497         file format.
2498         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2499         slot.
2500         (Dwp_output_file::initialize): Remove unused function.
2501         (Dwp_output_file::finalize): Add support for v2 package file format.
2502         (Dwp_output_file::write_index): Likewise.
2503         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2504         function prototype.
2505
2506 2013-03-01  Cary Coutant  <ccoutant@google.com>
2507
2508         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
2509         function into class definition in header file.
2510         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
2511         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
2512         New function.
2513         (Dwarf_info_reader::check_buffer): Move here from .cc file.
2514
2515 2013-02-28  Alan Modra  <amodra@gmail.com>
2516
2517         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
2518         * target.cc (Target::do_plt_fde_location): New function.
2519         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
2520         accessor function, and constructor param.
2521         (struct Post_fde, Post_fdes): Declare.
2522         (Cie::write): Add post_fdes param.
2523         * ehframe.cc (Fde::write): Use plt_fde_location.
2524         (struct Post_fde): Define.
2525         (Cie::write): Stash FDEs added post merge mapping.
2526         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
2527         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
2528         (Eh_frame::do_sized_write): Arrange to write post map FDES after
2529         other FDEs.
2530         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
2531         (Target_powerpc::has_glink): New function.
2532         (Target_powerpc::do_relax): Add eh_frame info for stubs.
2533         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
2534         glink_eh_frame_fde_32, default_fde): New data.
2535         (Stub_table::eh_frame_added_): New var.
2536         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
2537         Make const.
2538         (Stub_table::add_eh_frame): New function.
2539         (Output_data_glink::add_eh_frame): New function.
2540         (Target_powerpc::make_glink_section): Call add_eh_frame.
2541
2542 2013-02-15  Ian Lance Taylor  <iant@google.com>
2543
2544         * options.h (DEFINE_uint64_alias): Define.
2545         (class General_options): Add -Ttext-segment as an alias for
2546         -Ttext.
2547
2548 2013-02-15  Alan Modra  <amodra@gmail.com>
2549
2550         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
2551         (Stub_table::do_write): ..here, two places.
2552         (Stub_table::plt_call_size): Use it here too.
2553
2554 2013-02-11  Ian Lance Taylor  <iant@google.com>
2555
2556         * descriptors.cc (Descriptors::close_all): New function.
2557         * descriptors.h (class Descriptors): Declare close_all.
2558         (close_all_descriptors): New inline function.
2559         * plugin.cc: Include "descriptors.h".
2560         (Plugin_manager::cleanup): Call close_all_descriptors.
2561
2562 2013-02-06  Alan Modra  <amodra@gmail.com>
2563
2564         * README: Update coding style link.
2565
2566 2013-01-28  Cary Coutant  <ccoutant@google.com>
2567
2568         * dwp.cc (File_list): New typedef.
2569         (Dwo_name_info_reader): New class.
2570         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
2571         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
2572         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
2573         (Dwo_file::read_executable): New function.
2574         (Dwo_file::read): Move common setup code to ...
2575         (Dwo_file::make_object): ... here.
2576         (dwp_options): Add --exec/-e.
2577         (usage): Likewise.
2578         (main): Likewise.
2579
2580 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
2581
2582         * layout.cc (Layout::layout): Check for option text_reorder.
2583         (Layout::make_output_section): Ditto.
2584         * options.h (text_reorder): New option.
2585         * output.cc (Input_section_sort_compare): Remove special ordering
2586         of section names.
2587         (Output_section::
2588          Input_section_sort_section_name_special_ordering_compare::
2589          operator()): New function.
2590         (Output_section::sort_attached_input_sections): Use new sort function
2591         for .text.
2592         * output.h (Input_section_sort_section_name_special_ordering_compare):
2593         New struct.
2594         * testsuite/Makefile.am (text_section_grouping): Test option
2595         --no-text-reorder
2596         * testsuite/Makefile.in: Regenerate.
2597         * testsuite/text_section_grouping.sh: Check order of functions without
2598         default text reordering.
2599
2600 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
2601
2602         * options.h (General_options): Change default to true for new_dtags.
2603
2604 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
2605
2606         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
2607         when enable_new_dtags is false.  Only add DT_RUNPATH when
2608         enable_new_dtags is true.
2609
2610 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
2611
2612         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
2613         used in declaration and definition consistent.
2614         (Target_powerpc::symval_for_branch): Ditto.
2615
2616 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
2617
2618         * testsuite/plugin_final_layout.cc: Fix comment.
2619
2620 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
2621
2622         * layout.cc (Layout::layout): Do not do default sorting for
2623         text sections when section ordering is specified.
2624         (make_output_section): Ditto.
2625         * testsuite/plugin_final_layout.cc: Name the function sections
2626         to catch reordering issues.
2627
2628 2013-01-15  Alan Modra  <amodra@gmail.com>
2629
2630         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
2631         plt-thread-safe.
2632
2633 2013-01-15  Alan Modra  <amodra@gmail.com>
2634
2635         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
2636         * testsuite/Makefile.in: Regenerate.
2637
2638 2013-01-14  Alan Modra  <amodra@gmail.com>
2639
2640         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
2641         * testsuite/Makefile.in: Regenerate.
2642
2643 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
2644
2645         PR bfd/14430
2646         Fix mingw gold build with plugins enabled
2647         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
2648         * configure.ac: Export DLOPEN_LIBS and add headers check.
2649         * plugin.cc: Handle non-dlfcn case.
2650         * Makefile.in: Regenerate.
2651         * config.in: Regenerate.
2652         * configure: Regenerate.
2653         * testsuite/Makefile.in: Regenerate.
2654
2655 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
2656
2657         * output.h (sort_attached_input_sections): Change to be public.
2658         * script-sections.cc
2659         (Output_section_definition::set_section_addresses): Sort
2660         attached input sections according to section order before linker
2661         script assigns section addresses.
2662         (Orphan_output_section::set_section_addresses): Sort
2663         attached input sections according to section order before linker
2664         script assigns section addresses.
2665         * Makefile.am (final_layout.sh): Use a simple linker script to
2666         check if section ordering still works.
2667         * Makefile.in: Regenerate.
2668
2669 2013-01-09  Ben Cheng  <bccheng@google.com>
2670
2671         * arm.cc (Target_arm::attributes_accept_div): New function.
2672         (Target_arm::attributes_forbid_div): New function.
2673         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
2674         attribute using the same new functions as what bfd/elf32_arm.c
2675         does.
2676
2677 2013-01-07  Cary Coutant  <ccoutant@google.com>
2678
2679         PR gold/14993
2680         * output.cc (Output_section::add_input_section): For incremental
2681         updates, don't track input sections that are allocated from patch
2682         space.
2683
2684 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
2685             Ian Lance Taylor  <iant@google.com>
2686
2687         PR gold/14897
2688         * configure.ac (--enable-ld): Removed.
2689         (install_as_default): Set to yes only for --enable-gold=default
2690         or --disable-ld.
2691         * configure: Regenerated.
2692
2693 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
2694
2695         * options.h (General_options): Add -fuse-ld= for GCC linker
2696         option compatibility.
2697
2698 2013-01-04  Cary Coutant  <ccoutant@google.com>
2699
2700         * configure.ac: Fix typo restoring CXXFLAGS.
2701         * configure: Regenerate.
2702
2703 2013-01-04  Cary Coutant  <ccoutant@google.com>
2704
2705         * testsuite/Makefile.am (CXXLINK_S): New macro.
2706         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
2707         * testsuite/Makefile.in: Regenerate.
2708
2709 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
2710
2711         * version.cc (print_version): Update copyright year to 2013.
2712
2713 2012-12-20  Ian Lance Taylor  <iant@google.com>
2714
2715         * layout.cc (Layout::special_ordering_of_input_section): New
2716         function.
2717         (Layout::layout): If input section requires special ordering, must
2718         sort input sections.
2719         (Layout::make_output_section): May sort .text input sections.
2720         (Layout::is_section_name_prefix_grouped): Remove.
2721         * layout.h (class Layout): Declare
2722         special_ordering_of_input_section.  Don't declare
2723         is_section_name_prefix_grouped.
2724         * output.cc (Output_section::add_input_section): Revert last
2725         change.
2726         (Output_section::Input_section_sort::match_file_name): Don't crash
2727         if called on output section data.
2728         (Output_section::Input_section_sort_compare): Sort based on
2729         special ordering.
2730         (Output_section::Input_section_sort_section_order_index_compare):
2731         Revert last patch.
2732         (Output_section::sort_attached_input_sections): Likewise.
2733
2734 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
2735
2736         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
2737         * layout.h (Layout::is_section_name_prefix_grouped): New function.
2738         * output.cc (Output_section::add_input_section): Check if section
2739         name contains special prefix.  Keep input sections to sort such
2740         sections.
2741         (Output_section::Input_section_sort_section_order_index_compare
2742          ::operator()): Group sections according to prefixes.
2743         (Output_section::sort_attached_input_sections): Add condition to
2744         Input_section_entry constructor call.
2745         * testsuite/Makefile.am (text_section_grouping): New test.
2746         * testsuite/Makefile.in: Regenerate.
2747         * testsuite/text_section_grouping.cc: New file.
2748         * testsuite/text_section_grouping.sh: New file.
2749
2750 2012-12-17  Nick Clifton  <nickc@redhat.com>
2751
2752         * Makefile.am: Add copyright notice.
2753         * NEWS: Likewise.
2754         * README: Likewise.
2755         * configure.ac: Likewise.
2756         * ftruncate.c: Likewise.
2757         * Makefile.in: Regenerate.
2758
2759 2012-12-14  Cary Coutant  <ccoutant@google.com>
2760
2761         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
2762         --no-as-needed flag.
2763         (exception_separate_shared_12_test): Likewise.
2764         (incremental_copy_test): Likewise.
2765         * testsuite/Makefile.in: Regenerate.
2766
2767 2012-12-14  Cary Coutant  <ccoutant@google.com>
2768
2769         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
2770         (Dwp_output_file::Dwp_index::enter_set): Add assert.
2771
2772 2012-12-12  Alan Modra  <amodra@gmail.com>
2773
2774         * powerpc.cc (class Track_tls): New.
2775         (class Relocate, class Scan): Inherit Track_tls.
2776         (Target_powerpc::Scan::local, global): Track tls optimization
2777         and avoid creating plt entry for __tls_get_addr if all uses
2778         are optimized away.
2779         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
2780
2781 2012-12-12  Alan Modra  <amodra@gmail.com>
2782
2783         * options.h (General_options): Add --toc-sort/--no-toc-sort.
2784         Replace no_toc_optimize with toc_optimize.
2785         * output.h (Output_section::input_sections): Provide non-const variant.
2786         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
2787         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
2788         accessors.
2789         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
2790         (class Sort_toc_sections): New.
2791         (Target_powerpc::do_finalize_sections): Sort toc sections.
2792         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
2793
2794 2012-12-10  Roland McGrath  <mcgrathr@google.com>
2795
2796         * testsuite/binary_unittest.cc (read_all): New function.
2797         (Sized_binary_test): Use it instead of ::read.
2798         * fileread.cc (do_read): Don't assume pread always reads the whole
2799         amount in a single call.
2800
2801 2012-12-10  Alan Modra  <amodra@gmail.com>
2802
2803         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
2804         Set EM_PPC64 or EM_PPC here.
2805         (Target_selector_powerpc::do_recognize): Delete.
2806
2807 2012-12-10  Alan Modra  <amodra@gmail.com>
2808
2809         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
2810         stub_table_.
2811         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
2812
2813 2012-12-07  Roland McGrath  <mcgrathr@google.com>
2814
2815         * testsuite/binary_unittest.cc (Sized_binary_test):
2816         Use open_descriptor rather than ::open.
2817
2818 2012-12-07  Alan Modra  <amodra@gmail.com>
2819
2820         * powerpc.cc (Stub_table::do_write): Delete redundant Address
2821         typedef and invalid_address constant.
2822         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2823         instantiate constants.
2824
2825 2012-12-06  Roland McGrath  <mcgrathr@google.com>
2826
2827         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2828         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2829         * aclocal.m4: Regenerate.
2830         * configure: Regenerate.
2831         * Makefile.in: Regenerate.
2832         * testsuite/Makefile.in: Regenerate.
2833
2834 2012-12-07  Alan Modra  <amodra@gmail.com>
2835
2836         * options.h (General_options): Add no_toc_optimize.
2837         * powerpc.cc (ok_lo_toc_insn): New function.
2838         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2839
2840 2012-12-06  Alan Modra  <amodra@gmail.com>
2841
2842         * options.h (General_options): Add plt_align, plt_static_chain,
2843         plt_thread_safe.  Update stub_group_size help text.
2844         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2845         for new plt_thread_safe_ var.
2846         (use_plt_offset): Correct comments.
2847         (Target_powerpc::do_relax): Look for thread creation symbols to
2848         determine default plt_thread_safe value.  Clear plt call stubs
2849         as well as branch stubs each iteration.
2850         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2851         insn constants.
2852         (l, hi, ha, write_insn): Move earlier.
2853         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2854         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2855         plt stubs too.
2856         (Stub_table::update_size): Adjust.
2857         (Stub_table::prev_size, set_prev_size): Delete.
2858         (Stub_table::stub_align): Let --plt-align affect result.
2859         (Stub_table::plt_call_size): Calculate sizes for various stubs.
2860         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2861         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2862         (Stub_table::do_write): Support more stub variants.
2863
2864 2012-12-04  Alan Modra  <amodra@gmail.com>
2865
2866         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2867         (Target_powerpc::do_define_standard_symbols): New function.
2868
2869 2012-12-03  Alan Modra  <amodra@gmail.com>
2870
2871         * output.h: Formatting, whitespace.
2872
2873 2012-12-03  Alan Modra  <amodra@gmail.com>
2874
2875         * layout.h (Layout::get_executable_sections): Declare.
2876         * layout.cc (Layout::get_executable_sections): New function.
2877         * arm.cc (Target_arm::group_sections): Use it.
2878         (Arm_output_section::group_sections): Delete now redundant test.
2879         * output.cc (Output_reloc::Output_reloc): Add is_relative.
2880         param to handle relative relocs.
2881         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2882         (Output_data_reloc::add_absolute): Adjust.
2883         (Output_data_reloc::add_relative): New function.
2884         (Output_data::reset_data_size): New function.
2885         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2886         (Output_section::set_addralign): New function.
2887         (Output_section::checkpoint_set_addralign): New function.
2888         (Output_section::clear_section_offsets_need_adjustment): New function.
2889         (Output_section::input_sections): Make public.
2890         * powerpc.cc (class Output_data_brlt_powerpc): New.
2891         (class Stub_table, class Stub_control): New.
2892         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
2893         stub_table_, set_stub_table, stub_table): New vectors and accessor
2894         functions.
2895         (Target_powerpc::do_may_relax, do_relax, push_branch,
2896         new_stub_table, stub_tables, brlt_section, group_sections,
2897         add_branch_lookup_table, find_branch_lookup_table,
2898         write_branch_lookup_table, make_brlt_section): New functions.
2899         (Target_powerpc::struct Sort_sections, class Branch_info): New.
2900         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
2901         branch_info_): New vars.
2902         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
2903         make call stubs here.
2904         (Output_data_glink): Remove all call stub handling from this class.
2905         (Target_powerpc::Scan::local, global): Save interesting branch
2906         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
2907         (Target_powerpc::do_finalize_sections): Only make reg save/restore
2908         functions on final link.
2909         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
2910         Handle long branch destinations too.
2911         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
2912         do_plt_address_for_local): Adjust lookup of plt call stubs.
2913
2914 2012-11-30  Alan Modra  <amodra@gmail.com>
2915
2916         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
2917         relocs against protected symbols when building 32-bit shared libs.
2918
2919 2012-11-30  Alan Modra  <amodra@gmail.com>
2920
2921         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
2922         param.  Call got_section() to make .got.  Update all callers
2923         and their callers and so on.
2924
2925 2012-11-30  Alan Modra  <amodra@gmail.com>
2926
2927         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
2928         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
2929         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
2930         value if it already exists.
2931
2932 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
2933
2934         PR gold/14858
2935         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
2936
2937 2012-11-14  Roland McGrath  <mcgrathr@google.com>
2938
2939         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
2940         than bfc instruction for data sandboxing.
2941
2942 2012-11-08  Alan Modra  <amodra@gmail.com>
2943
2944         * po/POTFILES.in: Regenerate.
2945
2946 2012-11-05  Alan Modra  <amodra@gmail.com>
2947
2948         * configure.ac: Apply 2012-09-10 change to config.in here.
2949         * configure: Regenerate.
2950
2951 2012-11-05  Alan Modra  <amodra@gmail.com>
2952
2953         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
2954         (struct Opd_ent): Use "Address" rather than "Offset".
2955         (Output_data_got_powerpc::got_base_offset): Return Valtype.
2956         (Target_powerpc::got_section): Make public.
2957         (Target_powerpc::scan_relocs): Move code setting symbols..
2958         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
2959         Create _SDA_BASE_ only when referenced.
2960
2961 2012-11-02  Roland McGrath  <mcgrathr@google.com>
2962
2963         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
2964         from last change.
2965
2966 2012-11-01  Roland McGrath  <mcgrathr@google.com>
2967
2968         * target.h (Sized_target::relocate_relocs): Use Elf_Off
2969         for offset_in_output_section parameter.
2970         (Sized_target::relocate_special_relocatable): Likewise.
2971         * arm.cc (Target_arm::relocate_relocs): Likewise.
2972         (Target_arm::relocate_special_relocatable): Likewise.
2973         * i386.cc (Target_i386::relocate_relocs): Likewise.
2974         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2975         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2976         * target-reloc.h (relocate_relocs): Likewise.
2977         * testsuite/testfile.cc (Target_test): Likewise.
2978         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2979         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2980
2981         * system.h: Move inclusion of <clocale> to after <libintl.h> in
2982         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2983
2984         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2985         parameter, which is unused in the [!F_SETFD] case.
2986
2987         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2988         SYMNDX to off_t before comparing it to this->data_size().
2989         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2990         * incremental.cc (Output_section_incremental_inputs::do_write):
2991         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2992
2993         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2994
2995 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
2996
2997         * gold.cc (Target_arm::do_adjust_elf_header): Add the
2998         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2999         in EABI_VER5.
3000
3001 2012-10-29  Cary Coutant  <ccoutant@google.com>
3002
3003         * dwp.cc (usage): Add file and exit status parameters;
3004         add --help and --version options.
3005         (print_version): New function.
3006         (main): Add --help and --version options.
3007
3008 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3009
3010         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
3011         final_layout_sequence.txt.
3012         * testsuite/Makefile.in: Regenerated.
3013
3014 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3015
3016         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
3017         COMPILE generated by automake.
3018         (LINK1): Likewise.
3019         (CXXCOMPILE1): Likewise.
3020         (CXXLINK1): Likewise.
3021         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
3022         (LINK): Likewise.
3023         (CXXCOMPILE): Likewise.
3024         (CXXLINK): Likewise.
3025         * testsuite/Makefile.in: Regenerated.
3026
3027 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3028
3029         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
3030         on bad fwrite return.
3031
3032 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3033
3034         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
3035         on val.
3036
3037 2012-10-23  Cary Coutant  <ccoutant@google.com>
3038
3039         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
3040         * testsuite/Makefile.in: Regenerate.
3041         * testsuite/dwp_test.h: New source file.
3042         * testsuite/dwp_test_1.cc: New source file.
3043         * testsuite/dwp_test_1.s: New source file.
3044         * testsuite/dwp_test_1.sh: New source file.
3045         * testsuite/dwp_test_1b.cc: New source file.
3046         * testsuite/dwp_test_1b.s: New source file.
3047         * testsuite/dwp_test_2.cc: New source file.
3048         * testsuite/dwp_test_2.s: New source file.
3049         * testsuite/dwp_test_2.sh: New source file.
3050         * testsuite/dwp_test_main.cc: New source file.
3051         * testsuite/dwp_test_main.s: New source file.
3052
3053 2012-10-23  Cary Coutant  <ccoutant@google.com>
3054
3055         * dwp.h: New header file.
3056         * dwp.cc: New source file.
3057         * gold.h: Move shared declarations to system.h.
3058         * system.h: New header file.
3059         * Makefile.am: Add dwp.
3060         * Makefile.in: Regenerate.
3061
3062 2012-10-23  Cary Coutant  <ccoutant@google.com>
3063
3064         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
3065         Dwarf_info_reader::read_from_pointer.
3066         (Dwarf_pubnames_table::read_header): Likewise.
3067         (Dwarf_pubnames_table::next_name): Likewise.
3068         (Dwarf_die::read_attributes): Likewise.
3069         (Dwarf_die::skip_attributes): Likewise.
3070         (Dwarf_info_reader::read_from_pointer): New function template.
3071         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
3072         (Dwarf_pubnames_table): Likewise.
3073         (Dwarf_info_reader::read_from_pointer): New function template.
3074         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
3075         Dwarf_pubnames_table ctor.
3076
3077 2012-10-23  Cary Coutant  <ccoutant@google.com>
3078
3079         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
3080         abbrev_shndx.
3081         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
3082         abbrev_shndx_.
3083         (Dwarf_info_reader::set_abbrev_shndx): New method.
3084         (Dwarf_info_reader::abbrev_shndx_): New data member.
3085
3086 2012-10-23  Cary Coutant  <ccoutant@google.com>
3087
3088         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
3089         from object, not parameters.
3090         (Dwarf_info_reader::parse): Likewise.
3091         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
3092         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
3093         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
3094         methods.
3095
3096 2012-10-23  Cary Coutant  <ccoutant@google.com>
3097
3098         * fileread.cc (Input_file::Input_file): New constructor.
3099         * fileread.h (class Input_file): Add new constructor.
3100
3101 2012-10-18  Alan Modra  <amodra@gmail.com>
3102
3103         PR gold/14727
3104         * object.cc (Relobj::is_section_name_included): Also match
3105         .sdata personality section.
3106
3107 2012-10-18  Alan Modra  <amodra@gmail.com>
3108
3109         * target-reloc.h (class Default_comdat_behavior): New, package up..
3110         (get_comdat_behaviour): ..this.
3111         (relocate_section): Add Relocate_comdat_behavior template arg,
3112         adjust code to suit.
3113         * arm.cc (Target_arm::relocate_section): Adjust to suit.
3114         (Target_arm::scan_reloc_section): Likewise.
3115         * i386.cc (Target_i386::relocate_section): Likewise.
3116         * sparc.cc (Target_sparc::relocate_section): Likewise.
3117         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
3118         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
3119         * powerpc.cc (class Relocate_comdat_behavior): New.
3120         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
3121         gold::relocate_section with new template arg.
3122
3123 2012-10-18  Alan Modra  <amodra@gmail.com>
3124
3125         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
3126         dynamic relocs for GOT_TPREL got entries, without symbol if
3127         resolving locally.
3128         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
3129         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
3130         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
3131
3132 2012-10-17  Alan Modra  <amodra@gmail.com>
3133
3134         PR gold/14726
3135         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
3136
3137 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
3138
3139         * layout.cc (Layout::include_section): Keep sections marked
3140         SHF_EXCLUDE when doing relocatable links.
3141
3142 2012-10-16  Alan Modra  <amodra@gmail.com>
3143
3144         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
3145         (Target_powerpc::do_finalize_sections): Call it.
3146         (Output_data_save_res): New class and supporting functions.
3147         (Target_powerpc::symval_for_branch): Only look up .opd entry for
3148         normal symbols defined in object files.
3149
3150 2012-10-12  Alan Modra  <amodra@gmail.com>
3151
3152         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
3153         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
3154         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
3155         section if scan_opd_relocs not yet called.
3156         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
3157
3158 2012-10-12  Alan Modra  <amodra@gmail.com>
3159
3160         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3161         add_local_ifunc_entry): Revert last change.
3162         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
3163
3164 2012-10-05  Alan Modra  <amodra@gmail.com>
3165
3166         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
3167         do_plt_address_for_global): New functions.
3168         (Output_data_got_powerpc::do_write): Don't segfault when linking
3169         statically.
3170         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3171         add_local_ifunc_entry): Return true on adding entry..
3172         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
3173         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
3174         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
3175         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
3176         set up symbols here.
3177         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
3178         syms here.  Do so even when no .iplt.  Don't segfault when linking
3179         statically.
3180         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
3181         new variants without reloc param.
3182         (Glink_sym_ent::Glink_sym_ent): Likewise.
3183         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
3184         reloc when refs will resolve to plt call stub.
3185         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
3186         R_PPC_PLTREL24 to resolve locally.
3187         (Target_powerpc::Scan::global): Correct ifunc handling.
3188         (Target_powerpc::Relocate::relocate): Correct local sym glink
3189         lookup.  Don't destroy "value" when we have a plt call stub,
3190         and when checking plt call validity.
3191         (Target_powerpc::do_dynsym_value): Simplify.
3192
3193 2012-10-05  Alan Modra  <amodra@gmail.com>
3194
3195         * i386.cc (Output_data_plt_i386::address_for_global,
3196         address_for_local): Add plt offset to returned value.  Adjust uses.
3197         * sparc.cc (Output_data_plt_sparc::address_for_global,
3198         address_for_local): Likewise.
3199         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
3200         address_for_local): Likewise.
3201         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
3202         address_for_local): Likewise.
3203         * target.h (Target::plt_address_for_global, plt_address_for_local):
3204         Update comment.
3205         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
3206         (Output_data_got::Got_entry::write): Nor here.
3207         * output.h: Comment fix.
3208
3209 2012-10-02  Jiong Wang  <jiwang@tilera.com>
3210
3211         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
3212         global_offset_table_ value for larget got.
3213         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
3214
3215 2012-09-29  Alan Modra  <amodra@gmail.com>
3216
3217         * powerpc.cc (Target_powerpc::iplt_): New output section.
3218         (Target_powerpc::iplt_section, make_iplt_section,
3219         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
3220         (Target_powerpc::make_plt_entry): Handle ifunc syms.
3221         Target_powerpc::plt_entry_count): Count iplt entries too.
3222         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
3223         reloc section in constructor.  New params.
3224         (Target_powerpc::make_plt_section): Create reloc section here instead.
3225         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
3226         functions.
3227         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
3228         (Output_data_glink::add_entry, find_entry): New functions to
3229         deal with local syms.
3230         (Glink_sym_ent): Add support for local syms.
3231         (Output_data_glink::do_write): Handle ifunc plt entries.
3232         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3233         (Target_powerpc::Scan::local, global): Handle ifunc syms.
3234         (Target_powerpc::Relocate::relocate): Likewise.
3235         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
3236
3237 2012-09-25  Alan Modra  <amodra@gmail.com>
3238
3239         * object.h (Sized_relobj_file::adjust_local_symbol,
3240         do_adjust_local_symbol): New functions.
3241         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
3242         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
3243         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
3244         and irregular opd entry spacing.
3245         (Powerpc_relobj::do_read_relocs): Add opd size checks.
3246         (Global_symbol_visitor_opd): New functor.
3247         (Target_powerpc::do_finalize_sections): Omit global symbols defined
3248         on deleted opd entries.
3249
3250 2012-09-15  Jiong Wang  <jiwang@tilera.com>
3251
3252         * tilegx.cc: New file.
3253         * Makefile.am (TARGETSOURCES): Add tilegx.cc
3254         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
3255         * configure.tgt: Add entries for tilegx*.
3256         * configure.ac: Likewise.
3257         * Makefile.in: Rebuild.
3258         * configure: Likewise.
3259         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
3260         tilegx.
3261
3262 2012-09-13  Alan Modra  <amodra@gmail.com>
3263
3264         * target-reloc.h (scan_relocs): Call scan.local for relocs
3265         against symbols in discarded sections.  Pass is_discarded
3266         param.
3267         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
3268         Add is_discarded param.
3269         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
3270         is_discarded to flag opd entry as discarded.  Don't emit dyn
3271         relocs on such entries.
3272         (Target_powerpc::Scan::global): Similarly detect and handle
3273         such opd entries.
3274         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
3275         opd_ent_.  Update all uses.
3276         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
3277         (Target_powerpc::relocate_section): Zero out discarded opd
3278         entry relocs.
3279
3280 2012-09-12  Ian Lance Taylor  <iant@google.com>
3281
3282         PR gold/14570
3283         * output.cc: Rename Output_data_got template parameter from size
3284         to got_size for all functions.  Compile all variants of
3285         Output_data_got.
3286         (Output_data_got::Got_entry::write): Correct use of size for
3287         symbol value.  Use local_is_tls rather than casting to
3288         Sized_relobj_file.
3289         * object.h (class Object): Add local_is_tls and do_local_is_tls.
3290         (class Sized_relobj_file): Add do_local_is_tls.
3291         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
3292
3293 2012-09-11  Alan Modra  <amodra@gmail.com>
3294
3295         PR gold/14566
3296         * layout.cc (Layout::set_segment_offsets): When using
3297         common-page-size alignment, ensure we are on a new max-page-size
3298         page.
3299         * output.cc (Output_segment::set_section_addresses): Use
3300         abi_pagesize, not common_pagesize for relro boundary.
3301         (Output_segment::set_offset): Likewise.
3302
3303 2012-09-11  Alan Modra  <amodra@gmail.com>
3304
3305         * output.h (Output_data_got::add_global_tls, add_local_tls,
3306         add_local_tls_pair): New functions.
3307         (Output_data_got::add_local_pair_with_rel): Remove second
3308         reloc param.  Expand comment.
3309         (Output_data_got::Got_entry): Rename use_plt_offset_ to
3310         use_plt_or_tls_offset_, similarly for constructor param.
3311         (Output_data_got::Got_entry::write): Add got_index param.
3312         * output.cc (Output_data_got::add_global_tls, add_local_tls,
3313         add_local_tls_pair): New functions.
3314         (Output_data_got::Got_entry::write): Handle tls symbols
3315         with use_plt_or_tls_offset_ set specially.
3316         (Output_data_got::add_local_pair_with_rel): Only one reloc.
3317         (Output_data_got::do_write): Replace iterator with index, pass
3318         index to entry write function.
3319         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
3320         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
3321         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
3322         call.
3323         * i386.cc (Target_i386::Scan::local): Likewise.
3324         * sparc.cc (Target_sparc::Scan::local): Likewise.
3325         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
3326         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
3327         do_tls_offset_for_global): New functions.
3328         (Target_powerpc::Scan::local): Correct TLS relocations and got
3329         entry values.
3330         (Target_powerpc::Scan::global): Don't emit unnecessary
3331         dynamic relocations on TLS GOT entries.
3332
3333 2012-09-10  Matthias Klose  <doko@ubuntu.com>
3334
3335         * config.in: Disable sanity check for kfreebsd.
3336
3337 2012-09-10  Sterling Augustine  <saugustine@google.com>
3338
3339         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
3340         (Gdb_index::pubtypes_read): New parameter.
3341         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
3342         to calls.
3343         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
3344         pubtypes_object_.
3345
3346 2012-09-09  Alan Modra  <amodra@gmail.com>
3347
3348         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
3349         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
3350         * gc.h (gc_process_relocs): Call target gc_add_reference.
3351         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
3352         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
3353         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
3354         unnecessary cast.
3355         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
3356         to cater for when we don't need code offset.  Update use.
3357         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
3358         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
3359         set_opd_valid): New functions.
3360         (Target_powerpc::do_gc_add_reference): New function.
3361         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
3362         stashed refs.
3363         (Target_powerpc::do_gc_mark_symbol): New function.
3364
3365 2012-09-06  Cary Coutant  <ccoutant@google.com>
3366
3367         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
3368         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
3369         (Dwarf_die::skip_attributes): Likewise.
3370         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
3371         * testsuite/gdb_index_test.cc (inline_func_1): New function.
3372         (main): Call it.
3373         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
3374
3375 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
3376
3377         * testsuite/script_test_3.t: Add .got.plt output section
3378         statement.
3379         * testsuite/script_test_4.t: Likewise.
3380
3381 2012-09-05  Alan Modra  <amodra@gmail.com>
3382
3383         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
3384         update all uses and lose "enum" when using type.
3385
3386 2012-09-05  Alan Modra  <amodra@gmail.com>
3387
3388         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
3389         * configure: Regenerate.
3390         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
3391         (plugin_final_layout.stdout): Likewise.
3392         (memory_test): Set page sizes to 0x1000.
3393         * testsuite/Makefile.in: Regenerate.
3394         * testsuite/discard_locals_test.sh: Add FIXME comment.
3395         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
3396         * testsuite/pr14265.t: Add .got output section statement.
3397         * testsuite/script_test_2.t: Likewise.
3398         * testsuite/script_test_3.t: Likewise.
3399         * testsuite/script_test_4.t: Likewise.
3400         * testsuite/script_test_5.t: Likewise.
3401         * testsuite/script_test_6.t: Likewise.
3402         * testsuite/script_test_7.t: Likewise.
3403         * testsuite/script_test_9.t: Likewise.
3404
3405 2012-09-05  Alan Modra  <amodra@gmail.com>
3406
3407         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
3408         (Powerpc_relocate_functions::Status): New typedef.
3409         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3410         (Target_powerpc::Scan::local): Handle REL64.
3411         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
3412         for REL32 and REL64.
3413         (Target_powerpc::symval_for_branch): New function, extracted from..
3414         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
3415         checks.  Report overflow errors.
3416
3417 2012-09-05  Alan Modra  <amodra@gmail.com>
3418
3419         * object.h (Sized_relobj_file::emit_relocs): Delete.
3420         (Sized_relobj_file::emit_relocs_reltype): Delete.
3421         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
3422         relocate_relocs for --emit-relocs.
3423         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
3424         * output.h: Update comment.
3425         (Output_segment::first_section): New function.
3426         (Output_segment::first_section_load_address): Use first_section.
3427         * output.cc (Output_segment::first_section): New function extracted..
3428         (Output_segment::first_section_load_address): ..from here.  Delete.
3429         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
3430         * target.h (Sized_target::relocate_for_relocatable): Likewise.
3431         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
3432         adjust call to target.h function.
3433         * i386.cc (Target_i386): Likewise.
3434         * sparc.cc (Target_sparc): Likewise.
3435         * x86_64.cc (Target_x86_64): Likewise.
3436         * powerpc.cc (Target_powerpc): Likewise.
3437         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
3438         first tls section has section symbol for optimised local dynamic
3439         output relocs.
3440         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
3441         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
3442         optimised tls code.
3443         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
3444         Rename to relocate_relocs.  Update error message.
3445
3446 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
3447
3448         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
3449         --just-symbols.
3450
3451 2012-08-31  Alan Modra  <amodra@gmail.com>
3452
3453         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
3454         (Powerpc_relobj::toc_base_offset): New stub function.
3455         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
3456         got_mod_index_offset to tlsld_got_offset.  Update all refs.
3457         (Target_powerpc::Relocate::enum skip_tls): New.
3458         (Target_powerpc::call_tls_get_addr_): New var.
3459         (Target_powerpc::is_branch_reloc): Move to file scope.
3460         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
3461         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
3462         New functions.
3463         (Target_powerpc::enum Got_type): Delete old values, add new ones.
3464         (powerpc_info): Correct common_pagesize for ppc64.
3465         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
3466         (Powerpc_relocate_functions): Add overflow check enums and functions.
3467         Add non-shift version of rela, rela_ua.  Delete all rel public
3468         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
3469         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
3470         addr16_ha3, addr14 functions.
3471         (Output_data_got_powerpc::add_constant_pair): New function.
3472         (Output_data_got_powerpc::got_base_offset): Likewise.
3473         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
3474         (instruction constants): Sort, add some more.
3475         (Output_data_glink::do_write): Add and use Address typedef.  Use
3476         object->toc_base_offset() stub for 64-bit.
3477         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
3478         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3479         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
3480         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
3481         Always treat .opd relocs as against locally defined symbol.
3482         Correct condition for RELATIVE relocs.
3483         (Target_powerpc::do_finalize_sections): Test for NULL sections.
3484         (Target_powerpc::Relocate::relocate): Use plt call stub as value
3485         for 32-bit syms with a plt entry.  Correct ppc64 toc base
3486         calculations.  Handle TLS relocs, and more.  Add overflow
3487         checking and adjust for Powerpc_relocate_functions changes.
3488         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
3489         Reinstate --emit-relocs code with FIXME.
3490
3491 2012-08-30  Alan Modra  <amodra@gmail.com>
3492
3493         * layout.cc (Layout::set_segment_offsets): Set p_align to
3494         abi_pagesize, not common_pagesize.
3495         (Layout::relaxation_loop_body): Similarly use abi_pagesize
3496         to determine whether file header can go in segment.
3497
3498 2012-08-30  Alan Modra  <amodra@gmail.com>
3499
3500         * output.h (Output_reloc::Output_reloc <output section>): Add
3501         is_relative param.  Adjust calls.
3502         (Output_reloc::add_output_section_relative): New functions.
3503         * output.cc (Output_reloc::Output_reloc <output section>): Handle
3504         is_relative.
3505         (Output_reloc::symbol_value): Handle SECTION_CODE.
3506
3507 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
3508
3509         * gold.cc (queue_middle_tasks): Call layout again when unique
3510         segments for sections is desired.
3511         * layout.cc (Layout::Layout): Initialize new members.
3512         (Layout::get_output_section_flags): New function.
3513         (Layout::choose_output_section): Call get_output_section_flags.
3514         (Layout::layout): Make output section for mapping to a unique segment.
3515         (Layout::insert_section_segment_map): New function.
3516         (Layout::attach_allocated_section_to_segment): Make unique segment for
3517         output sections marked so.
3518         (Layout::segment_precedes): Check for unique segments when sorting.
3519         * layout.h (Layout::Unique_segment_info): New struct.
3520         (Layout::Section_segment_map): New typedef.
3521         (Layout::insert_section_segment_map): New function.
3522         (Layout::get_output_section_flags): New function.
3523         (Layout::is_unique_segment_for_sections_specified): New function.
3524         (Layout::set_unique_segment_for_sections_specified): New function.
3525         (Layout::unique_segment_for_sections_specified_): New member.
3526         (Layout::section_segment_map_): New member.
3527         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
3528         Rename is_gc_pass_one to is_pass_one.
3529         Rename is_gc_pass_two to is_pass_two.
3530         Rename is_gc_or_icf to is_two_pass.
3531         Check for which pass based on whether symbols data is present.
3532         Make it two pass when unique segments for sections is desired.
3533         * output.cc (Output_section::Output_section): Initialize new
3534         members.
3535         * output.h (Output_section::is_unique_segment): New function.
3536         (Output_section::set_is_unique_segment): New function.
3537         (Output_section::is_unique_segment_): New member.
3538         (Output_section::extra_segment_flags): New function.
3539         (Output_section::set_extra_segment_flags): New function.
3540         (Output_section::extra_segment_flags_): New member.
3541         (Output_section::segment_alignment): New function.
3542         (Output_section::set_segment_alignment): New function.
3543         (Output_section::segment_alignment_): New member.
3544         (Output_segment::Output_segment): Initialize is_unique_segment_.
3545         (Output_segment::is_unique_segment): New function.
3546         (Output_segment::set_is_unique_segment): New function.
3547         (Output_segment::is_unique_segment_): New member.
3548         * plugin.cc (allow_unique_segment_for_sections): New function.
3549         (unique_segment_for_sections): New function.
3550         (Plugin::load): Add new functions to transfer vector.
3551         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
3552         * Makefile.in: Regenerate.
3553         * testsuite/plugin_final_layout.sh: Check if unique segment
3554         functionality works.
3555         * testsuite/plugin_section_order.c (onload): Check if new interfaces
3556         are available.
3557         (allow_unique_segment_for_sections): New global.
3558         (unique_segment_for_sections): New global.
3559         (claim_file_hook): Call allow_unique_segment_for_sections.
3560         (all_symbols_read_hook): Call unique_segment_for_sections.
3561
3562 2012-08-22  Cary Coutant  <ccoutant@google.com>
3563
3564         * layout.cc (Layout::include_section): Don't assert on GROUP
3565         sections with --emit-relocs.
3566
3567 2012-08-21  Cary Coutant  <ccoutant@google.com>
3568
3569         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
3570         if --export-dynamic-symbol names an undef symbol.
3571
3572 2012-08-18  Alan Modra  <amodra@gmail.com>
3573
3574         * powerpc.cc: Formatting and white space.
3575         (Powerpc_relobj): Rename got2_section_ to special_.
3576         Add opd_ent_shndx_ and opd_ent_off_ vectors.
3577         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
3578         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
3579         (Target_powerpc): Add Address typedef and invalid_address.  Use
3580         throughout.
3581         (Target_powerpc::is_branch_reloc): New function.
3582         (Powerpc_relocate_functions): Add Address typedef, use throughout.
3583         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
3584         for dst_mask, value and addend.
3585         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
3586         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
3587         (Output_data_glink::do_write): Correct toc base.  Don't try to use
3588         uint16_t for 24-bit offset.  Use get_output_section_offset and
3589         check return.
3590         (Target_powerpc::Scan::local): Handle more relocs.
3591         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
3592         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
3593         Plug in toc restoring insn after plt calls.  Translate branches
3594         to function descriptor symbols to corresponding entry point.
3595         (Target_powerpc::relocate_for_relocatable): Check return from
3596         get_output_section_offset.
3597         * symtab.h: Comment typo.
3598
3599 2012-08-14  Ian Lance Taylor  <iant@google.com>
3600
3601         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
3602         unsupported_relocal_local to call unsupported_reloc_global.
3603
3604 2012-08-14  Nick Clifton  <nickc@redhat.com>
3605
3606         PR ld/14265
3607         * script-sections.cc (Sections_element::output_section_name): Add
3608         keep return parameter.
3609         (Output_section_element::match_name): Add keep return parameter.
3610         Return the value of the keep_ member.
3611         * script-sections.h (class Output_section): Update
3612         output_section_name prototype.
3613         * layout.cc (Layout::keep_input_section): New public member
3614         function.
3615         (Layout::choose_output_section): Pass keep parameter to
3616         output_section_name.
3617         * layout.h (class Layout): Add keep_input_section.
3618         * object.cc (Sized_relobj_file::do_layout): Check for kept input
3619         sections.
3620         * testsuite/Makefile.am: Add a test.
3621         * testsuite/Makefile.in: Regenerate.
3622         * testsuite/pr14265.c: Source file for the test.
3623         * testsuite/pr14265.t: Linker script for the test.
3624         * testsuite/pr14265.sh: Shell script for the test.
3625
3626 2012-08-14  Alan Modra  <amodra@gmail.com>
3627
3628         * target.h (Target::output_section_name): New function.
3629         (Target::do_output_section_name): New function.
3630         * layout.cc (Layout::choose_output_section): Call the above.
3631         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
3632
3633 2012-08-14  Alan Modra  <amodra@gmail.com>
3634
3635         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
3636         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
3637         for replace_constant call.
3638         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
3639         (Output_data_glink::do_print_to_mapfile): New function.
3640         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
3641         (Target_powerpc::Relocate::relocate): Likewise.
3642
3643 2012-08-14  Alan Modra  <amodra@gmail.com>
3644
3645         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
3646         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
3647         (Output_data_glink::add_entry,find_entry): Remove shndx param.
3648         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
3649         all references to shndx_.  Handle special case for R_PPC_PLTREL24
3650         here.
3651         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
3652         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
3653         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
3654         here.
3655         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
3656         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
3657
3658 2012-08-12  Alan Modra  <amodra@gmail.com>
3659
3660         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
3661         (glink insn constants): Use uint32_t.
3662         (Output_data_glink::add_entry): Use insert, not [] operator.
3663
3664 2012-08-11  Alan Modra  <amodra@gmail.com>
3665
3666         * object.h (Sized_relobj_file::find_shdr): New function.
3667         (Sized_relobj_file::find_special_sections): New function.
3668         * object.cc (Sized_relobj_file::find_shdr): New function.
3669         (Sized_relobj_file::find_eh_frame): Use find_shdr.
3670         (Sized_relobj_file::find_special_sections): New function, split out..
3671         (Sized_relobj_file::do_read_symbols): ..from here.
3672         * output.h (Output_data_got::replace_constant): New function.
3673         (Output_data_got::num_entries): New function.
3674         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
3675         (Output_data_got::got_offset): Protected rather than private.
3676         (Output_data_got::replace_got_entry): New function.
3677         * output.cc (Output_data_got::replace_got_entry): New function.
3678         * powerpc.cc (class Powerpc_relobj): New.
3679         (class Powerpc_relocate_functions): Delete all psymval variants or
3680         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
3681         Implement _ha functions using corresponding _hi function.
3682         (Powerpc_relobj::find_special_sections): New function.
3683         (Target_powerpc::do_make_elf_object): New function.
3684         (class Output_data_got_powerpc): New.
3685         (class Output_data_glink): New.
3686         (class Powerpc_scan_relocatable_reloc): New.
3687         Many more changes througout file.
3688
3689 2012-08-09  Nick Clifton  <nickc@redhat.com>
3690
3691         * po/vi.po: Updated Vietnamese translation.
3692
3693 2012-08-07  Ian Lance Taylor  <iant@google.com>
3694
3695         * layout.cc (Layout::add_target_dynamic_tags): If
3696         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
3697         plt_rel.
3698
3699 2012-07-30  Nick Clifton  <nickc@redhat.com>
3700
3701         * po/gold.pot: Updated template.
3702         * po/es.po: Updated Spanish translation.
3703
3704 2012-07-18  Cary Coutant  <ccoutant@google.com>
3705
3706         PR gold/14344
3707         * configure.ac: Add check for -gpubnames support.
3708         * configure: Regenerate.
3709         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
3710         support; force -gno-pubnames.
3711         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
3712         support.
3713         (gdb_index_test_4): New test.
3714         * testsuite/Makefile.in: Regenerate.
3715         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
3716         * testsuite/gdb_index_test_2.sh: Likewise.
3717         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
3718         * testsuite/gdb_index_test_4.sh: New script.
3719         * testsuite/gdb_index_test_comm.sh: New script with common code;
3720         don't look for space after colon.
3721
3722 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
3723
3724         * gold.cc (queue_middle_tasks): Update function order only after
3725         deferred objects due to plugins are processed.
3726
3727 2012-07-11  Ian Lance Taylor  <iant@google.com>
3728
3729         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
3730         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
3731         (Target_arm::scan_reloc_for_stub): Likewise.
3732         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
3733         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
3734         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
3735         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
3736         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
3737
3738 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
3739             Ian Lance Taylor  <iant@google.com>
3740
3741         PR gold/14309
3742         * configure.ac: Test whether std::tr1::hash<off_t> works.
3743         * gold.h: Add a specialization for std::tr1::hash<off_t> if
3744         needed.
3745         * output.h (class Output_fill): Add virtual destructor.
3746         * configure, config.in: Rebuild.
3747
3748 2012-06-22  Roland McGrath  <mcgrathr@google.com>
3749
3750         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
3751
3752 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
3753
3754         * plugin.cc (Plugin::load): Handle position independent executables.
3755
3756 2012-06-06  Cary Coutant  <ccoutant@google.com>
3757
3758         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
3759         add .debug_macro.
3760         (lines_only_debug_sections): Likewise.
3761         (gdb_fast_lookup_sections): New static array.
3762         (is_gdb_debug_section): Rename formal parameter.
3763         (is_lines_only_debug_section): Likewise.
3764         (is_gdb_fast_lookup_section): New function.
3765         (Layout::include_section): Check for ".zdebug_" prefix; pass
3766         section name suffix to is_gdb_debug_section, et al.; check for
3767         fast-lookup sections when building .gdb_index.
3768         * options.h (--strip-debug-gdb): Update GDB version number.
3769
3770 2012-06-06  Cary Coutant  <ccoutant@google.com>
3771
3772         * configure.ac: Add check for fallocate.
3773         * configure: Regenerate.
3774         * config.in: Regenerate.
3775
3776         * options.h (class General_options): Add --mmap-output-file and
3777         --posix-fallocate options.
3778         * output.cc: (posix_fallocate): Remove; replace with...
3779         (gold_fallocate): New function.
3780         (Output_file::map_no_anonymous): Call gold_fallocate.
3781         (Output_file::map): Check --mmap-output-file option.
3782
3783 2012-06-05  Jing Yu  <jingyu@google.com>
3784
3785         * gold.h (textdomain): Add do {} to empty while(0).
3786         (bindtextdomain): Likewise.
3787
3788 2012-06-04  Cary Coutant  <ccoutant@google.com>
3789
3790         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
3791         has_dynsym_index.
3792
3793 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
3794
3795         * symtab.cc (Symbol_table::define_special_symbol):
3796         Initialize *poldsym to prevent uninitialized variable errors.
3797
3798 2012-05-23  Cary Coutant  <ccoutant@google.com>
3799
3800         * layout.cc (Layout::section_name_mapping): Add rules to handle
3801         exact match on .data.rel.ro.local or .data.rel.ro.
3802         (Layout::output_section_name): Check for exact matches.
3803
3804 2012-05-23  Cary Coutant  <ccoutant@google.com>
3805
3806         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
3807         more carefully.
3808
3809 2012-05-22  Cary Coutant  <ccoutant@google.com>
3810
3811         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
3812         object before exporting symbol.
3813
3814 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
3815
3816         * testsuite/tls_test.cc: Include "config.h" first.
3817         * testsuite/tls_test_c.c: Likewise.
3818
3819 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
3820             Nick Clifton  <nickc@redhat.com>
3821
3822         PR 14072
3823         * configure.in: Add check that sysdep.h has been included before
3824         any system header files.
3825         * configure: Regenerate.
3826         * config.in: Regenerate.
3827
3828 2012-05-14  Cary Coutant  <ccoutant@google.com>
3829
3830         * layout.cc (Layout::make_output_section): Mark .tdata section
3831         as RELRO.
3832         * testsuite/relro_test.cc: Add a TLS variable.
3833
3834 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
3835
3836         PR gold/14091
3837         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3838         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3839         R_X86_64_64.
3840
3841 2012-05-08  Cary Coutant  <ccoutant@google.com>
3842
3843         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3844         (lines_only_debug_sections): Likewise.
3845
3846 2012-05-02  Roland McGrath  <mcgrathr@google.com>
3847
3848         * nacl.cc: New file.
3849         * nacl.h: New file.
3850         * Makefile.am (CCFILES, HFILES): Add them.
3851         * Makefile.in: Regenerate.
3852         * i386.cc (Output_data_plt_i386_nacl): New class.
3853         (Output_data_plt_i386_nacl_exec): New class.
3854         (Output_data_plt_i386_nacl_dyn): New class.
3855         (Target_i386_nacl): New class.
3856         (Target_selector_i386_nacl): New class.
3857         (target_selector_i386): Use it instead of Target_selector_i386.
3858         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3859         (Target_x86_64_nacl): New class.
3860         (Target_selector_x86_64_nacl): New class.
3861         (target_selector_x86_64, target_selector_x32): Use it instead of
3862         Target_selector_x86_64.
3863         * arm.cc (Output_data_plt_arm_nacl): New class.
3864         (Target_arm_nacl): New class.
3865         (Target_selector_arm_nacl): New class.
3866         (target_selector_arm, target_selector_armbe): Use it instead of
3867         Target_selector_arm.
3868
3869         * target-select.cc (select_target): Take new Input_file* and off_t
3870         arguments, pass them on to recognize method of selector.
3871         * object.cc (make_elf_sized_object): Update caller.
3872         * parameters.cc (parameters_force_valid_target): Likewise.
3873         * incremental.cc (make_sized_incremental_binary): Likewise.
3874         * target-select.h: Update decl.
3875         (Target_selector::recognize): Take new Input_file* argument,
3876         pass it on to do_recognize.
3877         (Target_selector::do_recognize): Take new Input_file* argument.
3878         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3879         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3880         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3881         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3882
3883         * target.h (Target::Target_info): New members isolate_execinstr
3884         and rosegment_gap.
3885         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3886         * arm.cc (Target_arm::arm_info): Update initializer.
3887         * i386.cc (Target_i386::i386_info): Likewise.
3888         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3889         * sparc.cc (Target_sparc::sparc_info): Likewise.
3890         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3891         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3892         * layout.cc (Layout::attach_allocated_section_to_segment):
3893         Take new const Target* argument.  If target->isolate_execinstr(), act
3894         like --rosegment.
3895         (Layout::find_first_load_seg): Take new const Target* argument;
3896         if target->isolate_execinstr(), reject PF_X segments.
3897         (Layout::relaxation_loop_body): Update caller.
3898         (Layout::set_segment_offsets): If target->isolate_execinstr(),
3899         reset file offset to zero when we hit LOAD_SEG, and then do a second
3900         loop over the segments before LOAD_SEG to reassign offsets after
3901         addresses have been determined.  Handle target->rosegment_gap().
3902         (Layout::attach_section_to_segment): Take new const Target* argument;
3903         pass it to attach_allocated_section_to_segment.
3904         (Layout::make_output_section): Update caller.
3905         (Layout::attach_sections_to_segments): Take new const Target* argument;
3906         pass it to attach_section_to_segment.
3907         * gold.cc (queue_middle_tasks): Update caller.
3908         * layout.h (Layout): Update method decls with new arguments.
3909
3910         * arm.cc (Target_arm::Target_arm): Take optional argument for the
3911         Target_info pointer to use.
3912         (Target_arm::do_make_data_plt): New virtual method.
3913         (Target_arm::make_data_plt): New method that calls it.
3914         (Target_arm::make_plt_entry): Use it.
3915         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
3916         for the section alignment.
3917         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
3918         method.
3919         (Output_data_plt_arm::first_plt_entry_offset): Call it.
3920         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
3921         method.
3922         (Output_data_plt_arm::get_plt_entry_size): Call it.
3923         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
3924         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
3925         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
3926         method.
3927         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
3928         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
3929         method instead of sizeof(plt_entry).
3930         (Output_data_plt_arm::add_entry): Likewise.
3931         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
3932         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
3933         than static method.
3934         (Target_arm::plt_entry_size): Likewise.
3935         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
3936         Move to ...
3937         (Output_data_plt_arm_standard): ... here, new class.
3938         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
3939         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
3940         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
3941
3942         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3943         Take additional argument for the PLT entry size.
3944         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
3945         Use get_plt_entry_size method rather than plt_entry_size variable.
3946         (Output_data_plt_x86_64::reserve_slot): Likewise.
3947         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
3948         (Output_data_plt_x86_64::add_entry): Likewise.
3949         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
3950         (Output_data_plt_x86_64::address_for_global): Likewise.
3951         (Output_data_plt_x86_64::address_for_local): Likewise.
3952         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3953         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
3954         Make method non-static.
3955         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
3956         method.
3957         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
3958         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
3959         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
3960         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
3961         virtual method.
3962         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
3963         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
3964         virtual method.
3965         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
3966         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
3967         virtual method.
3968         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3969         (Output_data_plt_x86_64::plt_entry_size)
3970         (Output_data_plt_x86_64::first_plt_entry)
3971         (Output_data_plt_x86_64::plt_entry)
3972         (Output_data_plt_x86_64::tlsdesc_plt_entry)
3973         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3974         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3975         (Output_data_plt_x86_64_standard): ... here, new class.
3976         (Target_x86_64::Target_x86_64): Take optional argument for the
3977         Target_info pointer to use.
3978         (Target_x86_64::do_make_data_plt): New virtual method.
3979         (Target_x86_64::make_data_plt): New method to call it.
3980         (Target_x86_64::init_got_plt_for_update): Use that.
3981         Call this->plt_->add_eh_frame method here.
3982         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3983         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3984         rather than static method.
3985         (Target_x86_64::plt_entry_size): Likewise.
3986         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3987         rather than plt_entry_size variable.  Move guts of PLT filling to...
3988         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3989         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3990         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3991
3992         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3993         additional argument for the section alignment.
3994         Don't do add_eh_frame_for_plt here.
3995         (Output_data_plt_i386::first_plt_entry_offset): Make the method
3996         non-static.  Use get_plt_entry_size method rather than plt_entry_size
3997         variable.
3998         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3999         method.
4000         (Output_data_plt_i386::get_plt_entry_size): Call it.
4001         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
4002         (Output_data_plt_i386::add_eh_frame): New method to call it.
4003         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
4004         method.
4005         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
4006         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
4007         method.
4008         (Output_data_plt_i386::fill_plt_entry): New method to call it.
4009         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
4010         method instead of plt_entry_size.
4011         (Output_data_plt_i386::plt_entry_size)
4012         (Output_data_plt_i386::plt_eh_frame_fde_size)
4013         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
4014         (Output_data_plt_i386_standard): ... here, new class.
4015         (Output_data_plt_i386_exec): New class.
4016         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
4017         (Output_data_plt_i386_exec::first_plt_entry): ... here.
4018         (Output_data_plt_i386::exec_plt_entry): Move to ...
4019         (Output_data_plt_i386_exec::plt_entry): ... here.
4020         (Output_data_plt_i386_dyn): New class.
4021         (Output_data_plt_i386::first_plt_entry): Move to ...
4022         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
4023         (Output_data_plt_i386::dyn_plt_entry): Move to ...
4024         (Output_data_plt_i386_dyn::plt_entry): ... here.
4025         (Target_i386::Target_i386): Take optional argument for the Target_info
4026         pointer to use.
4027         (Target_i386::do_make_data_plt): New virtual method.
4028         (Target_i386::make_data_plt): New method to call it.
4029         (Target_i386::make_plt_section): Use that.
4030         Call this->plt_->add_eh_frame method here.
4031         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
4032         rather than plt_entry_size variable.
4033         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
4034         (Output_data_plt_i386::address_for_local): Likewise.
4035         (Output_data_plt_i386::do_write): Likewise.
4036         Move guts of PLT filling to...
4037         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
4038         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
4039         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
4040         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
4041
4042 2012-05-01  Cary Coutant  <ccoutant@google.com>
4043
4044         * dwarf_reader.cc (Dwarf_die::read_attributes)
4045         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
4046         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
4047         * reduced_debug_output.cc
4048         (Output_reduced_debug_info_section::get_die_end): Remove
4049         DW_FORM_GNU_ref_index.  Add default case.
4050
4051 2012-04-26  Mark Wielaard  <mjw@redhat.com>
4052
4053         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
4054         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
4055         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
4056         DW_AT_high_pc as offset from DW_AT_low_pc.
4057
4058         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
4059         * testsuite/Makefile.in: Regenerate.
4060         * testsuite/gdb_index_test_3.c: New test source file.
4061         * testsuite/gdb_index_test_3.sh: New test source file.
4062
4063 2012-04-25  Ian Lance Taylor  <iant@google.com>
4064
4065         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
4066         pointer.
4067         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
4068         as a class, not a struct.
4069         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
4070         (Target_arm::apply_cortex_a8_workaround): Likewise.
4071         * gc.h: Declare Reloc_types as a struct, not a class.
4072         * object.h: Declare Symbols_data as a struct.
4073         * reloc.h: Declare Read_relocs_data as a struct.
4074         * target.h: Declare Relocate_info as a struct.
4075
4076 2012-04-24  David S. Miller  <davem@davemloft.net>
4077
4078         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
4079         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
4080         and R_SPARC_WPLT30.
4081
4082 2012-04-24  Cary Coutant  <ccoutant@google.com>
4083
4084         * incremental-dump.cc (find_input_containing_global): Replace
4085         magic number with symbolic constant.
4086         (dump_incremental_inputs): Update version number.
4087         * incremental.cc (Output_section_incremental_inputs): Update version
4088         number; import symbolic constants from Incremental_inputs_reader.
4089         (Incremental_inputs::create_data_sections): Align relocations
4090         section correctly for 64-bit targets.
4091         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
4092         constants; add padding.
4093         (Output_section_incremental_inputs::write_header): Add assert for
4094         header_size.
4095         (Output_section_incremental_inputs::write_input_files): Add assert
4096         for input_entry_size.
4097         (Output_section_incremental_inputs::write_info_blocks): Add padding;
4098         add assert for object_info_size, input_section_entry_size,
4099         global_sym_entry_size.
4100         * incremental.h (Incremental_inputs_reader): Add symbolic constants
4101         for data structure sizes; use them.
4102         (Incremental_input_entry_reader): Import symbolic constants from
4103         Incremental_inputs_reader; use them.
4104
4105 2012-04-23  David S. Miller  <davem@davemloft.net>
4106
4107         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
4108         and elf_flags_set_.
4109         (Target_sparc::Target_sparc): Initialize new fields.
4110         (Target_sparc::do_make_elf_object): New function.
4111         (Target_sparc::do_adjust_elf_header): New function.
4112
4113 2012-04-23  Cary Coutant  <ccoutant@google.com>
4114
4115         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
4116         CU range table of gdb index.
4117
4118 2012-04-20  David S. Miller  <davem@davemloft.net>
4119
4120         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
4121         instead of false.
4122
4123 2012-04-16  David S. Miller  <davem@davemloft.net>
4124
4125         * sparc.cc (Target_sparc::got_address): New function.
4126         (Sparc_relocate_functions::gdop_hix22): New function.
4127         (Sparc_relocate_functions::gdop_lox10): New function.
4128         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
4129         relocs.
4130         (Target_sparc::Scan::local): Likewise if the global symbol is not
4131         preemptible and is not IFUNC.
4132         (Target_sparc::Relocate::relocate): Perform GOTDATA code
4133         transformations for local and non-preemptible non-IFUNC global
4134         symbols.
4135
4136         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
4137         writing out 64-bit part of ranges.
4138
4139         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
4140         -fpic and -fpie respectively.
4141         * Makefile.in: Regenerate.
4142
4143         * sparc.cc (class Target_sparc): Add rela_ifunc_.
4144         (Target_sparc::Target_sparc): Initialize new field.
4145         (Target_sparc::do_plt_section_for_global): New function.
4146         (Target_sparc::do_plt_section_for_local): New function.
4147         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
4148         (Target_sparc::make_plt_section): New function, broken out of
4149         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
4150         (Target_sparc::make_plt_entry): Call make_plt_section.
4151         (Target_sparc::make_local_ifunc_plt_entry): New function.
4152         (Target_sparc::rela_ifunc_section): New function.
4153         (Target_sparc::plt_section): Remove const.
4154         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
4155         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
4156         and ifunc_count_ fields.
4157         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
4158         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
4159         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
4160         (Output_data_plt_sparc::rela_ifunc): New function.
4161         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
4162         (Output_data_plt_sparc::has_ifunc_section): New function.
4163         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
4164         (Output_data_plt_sparc::address_for_global): New function.
4165         (Output_data_plt_sparc::address_for_local): New function.
4166         (Output_data_plt_sparc::plt_index_to_offset): New function.
4167         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
4168         and entry_count.
4169         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
4170         entry_count.
4171         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
4172         R_SPARC_JMP_IREL to switch.
4173         (Target_sparc::Scan::check_non_pic): Likewise.
4174         (Target_sparc::Scan::local): Handle IFUNC symbols.
4175         (Target_sparc::Scan::local): Likewise.
4176         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
4177         and plt_address_for_local.
4178         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
4179         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
4180
4181         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
4182         (class Output_data_reloc): Adjust calls to Output_reloc_type.
4183         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
4184         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
4185         global relocs too.
4186         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
4187         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
4188         calls.
4189         * sparc.cc (Target_sparc::Scan::global): Likewise.
4190         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4191
4192 2012-04-16  Cary Coutant  <ccoutant@google.com>
4193
4194         * archive.cc (Library_base::should_include_member): Check for
4195         --export-dynamic-symbol.
4196         * options.h (class General_options): Add --export-dynamic-symbol.
4197         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
4198         --export-dynamic-symbol.
4199         (Symbol_table::gc_mark_undef_symbols): Likewise.
4200         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
4201
4202 2012-04-12  David S. Miller  <davem@davemloft.net>
4203
4204         * sparc.cc (Reloc::wdisp10): New relocation method.
4205         (Reloc::h34): Likewise.
4206         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
4207         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
4208         R_SPARC_WDISP10.
4209         (Target_sparc::Scan::local): Likewise.
4210         (Target_sparc::Scan::global): Likewise.
4211         (Target_sparc::Relocate::relocate): Likewise.
4212
4213 2012-04-09  Cary Coutant  <ccoutant@google.com>
4214
4215         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
4216         low_pc == 0.
4217
4218 2012-04-06  Ian Lance Taylor  <iant@google.com>
4219
4220         * timer.cc: #include <unistd.h>.
4221
4222 2012-04-06  Roland McGrath  <mcgrathr@google.com>
4223
4224         * configure.in (AC_CHECK_HEADERS): Add locale.h.
4225         * config.in: Regenerate.
4226         * configure: Regenerate.
4227
4228 2012-04-05  Nick Clifton  <nickc@redhat.com>
4229
4230         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
4231         (AM_LC_MESSAGES): Add.
4232         * aclocal.m4: Regenerate.
4233         * config.in: Regenerate.
4234         * configure: Regenerate.
4235
4236 2012-03-21  Cary Coutant  <ccoutant@google.com>
4237
4238         * Makefile.am: Add gdb-index.cc, gdb-index.h.
4239         * Makefile.in: Regenerate.
4240         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
4241         (Sized_elf_reloc_mapper::symbol_section): New function.
4242         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
4243         (make_elf_reloc_mapper): New function.
4244         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
4245         (Dwarf_abbrev_table::do_read_abbrevs): New function.
4246         (Dwarf_abbrev_table::do_get_abbrev): New function.
4247         (Dwarf_ranges_table::read_ranges_table): New function.
4248         (Dwarf_ranges_table::read_range_list): New function.
4249         (Dwarf_pubnames_table::read_section): New function.
4250         (Dwarf_pubnames_table::read_header): New function.
4251         (Dwarf_pubnames_table::next_name): New function.
4252         (Dwarf_die::Dwarf_die): New function.
4253         (Dwarf_die::read_attributes): New function.
4254         (Dwarf_die::skip_attributes): New function.
4255         (Dwarf_die::set_name): New function.
4256         (Dwarf_die::set_linkage_name): New function.
4257         (Dwarf_die::attribute): New function.
4258         (Dwarf_die::string_attribute): New function.
4259         (Dwarf_die::int_attribute): New function.
4260         (Dwarf_die::uint_attribute): New function.
4261         (Dwarf_die::ref_attribute): New function.
4262         (Dwarf_die::child_offset): New function.
4263         (Dwarf_die::sibling_offset): New function.
4264         (Dwarf_info_reader::check_buffer): New function.
4265         (Dwarf_info_reader::parse): New function.
4266         (Dwarf_info_reader::do_parse): New function.
4267         (Dwarf_info_reader::do_read_string_table): New function.
4268         (Dwarf_info_reader::lookup_reloc): New function.
4269         (Dwarf_info_reader::get_string): New function.
4270         (Dwarf_info_reader::visit_compilation_unit): New function.
4271         (Dwarf_info_reader::visit_type_unit): New function.
4272         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
4273         Sized_elf_reloc_mapper.
4274         (Sized_dwarf_line_info::symbol_section): Remove function.
4275         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
4276         (Sized_dwarf_line_info::read_line_mappings): Remove object
4277         parameter, adjust callers.
4278         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
4279         * dwarf_reader.h: Include <sys/types.h>.
4280         (class Track_relocs): Remove forward declaration.
4281         (class Elf_reloc_mapper): New class.
4282         (class Sized_elf_reloc_mapper): New class.
4283         (class Dwarf_abbrev_table): New class.
4284         (class Dwarf_range_list): New class.
4285         (class Dwarf_ranges_table): New class.
4286         (class Dwarf_pubnames_table): New class.
4287         (class Dwarf_die): New class.
4288         (class Dwarf_info_reader): New class.
4289         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
4290         (Sized_dwarf_line_info::symbol_section): Remove member function.
4291         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
4292         base class.
4293         * gdb-index.cc: New source file.
4294         * gdb-index.h: New source file.
4295         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
4296         and .debug_types sections, call Layout::add_to_gdb_index.
4297         (Sized_relobj_incr::do_section_name): Implement.
4298         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
4299         return type; Implement.
4300         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
4301         return type.
4302         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
4303         parameter list and return type.
4304         (Sized_incr_dynobj::do_section_contents): Likewise.
4305         * layout.cc: Include gdb-index.h.
4306         (Layout::Layout): Initialize gdb_index_data_.
4307         (Layout::init_fixed_output_section): Check for .gdb_index section.
4308         (Layout::add_to_gdb_index): New function. Instantiate.
4309         * layout.h: Add forward declaration for class Gdb_index.
4310         (Layout::add_to_gdb_index): New member function.
4311         (Layout::gdb_index_data_): New data member.
4312         * main.cc: Include gdb-index.h.
4313         (main): Print statistics for gdb index.
4314         * object.cc (Object::section_contents): Move code into
4315         do_section_contents.
4316         (need_decompressed_section): Check for sections needed when building
4317         gdb index.
4318         (build_compressed_section_map): Likewise.
4319         (Sized_relobj_file::do_read_symbols): Need local symbols when building
4320         gdb index.
4321         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
4322         sections; call Layout::add_to_gdb_index.
4323         (Sized_relobj_file::do_decompressed_section_contents): Call
4324         do_section_contents directly.
4325         * object.h (Object::do_section_contents): Adjust parameter list and
4326         return type.
4327         (Object::do_decompressed_section_contents): Call do_section_contents
4328         directly.
4329         (Sized_relobj_file::do_section_contents): Adjust parameter list and
4330         return type.
4331         * options.h (class General_options): Add --gdb-index option.
4332         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
4333         list and return type.
4334         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
4335         * reloc.h (Track_relocs::checkpoint): New function.
4336         (Track_relocs::reset): New function.
4337
4338         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
4339         New test cases.
4340         * testsuite/Makefile.in: Regenerate.
4341         * testsuite/gdb_index_test.cc: New test source file.
4342         * testsuite/gdb_index_test_1.sh: New test source file.
4343         * testsuite/gdb_index_test_2.sh: New test source file.
4344
4345 2012-03-19  Doug Kwan  <dougkwan@google.com>
4346
4347         * arm.cc (Target_arm::do_define_standard_symbols): New method.
4348         (Target_arm::do_finalize_sections): Remove code which defines
4349         __exidx_start and __exidx_end.  Make symbol table parameter
4350         anonymous as it is not used.
4351         * gold.cc (queue_middle_tasks): Call target hook to define any
4352         target-specific symbols.
4353         * target.h (Target::define_standard_symbols): New method.
4354         (Target::do_define_standard_symbols): Same.
4355         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
4356         * testsuite/Makefile.in: Regenerate.
4357         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
4358         and __exidx_end.
4359         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
4360         relocations are generated for __exidx_start and __exidx_end.
4361
4362 2012-03-16  Doug Kwan  <dougkwan@google.com>
4363
4364         * testsuite/Makefile.am: Disable test initpri3b.
4365         * testsuite/Makefile.in: Regenerate.
4366
4367 2012-03-15  Doug Kwan  <dougkwan@google.com>
4368
4369         * arm.cc (Target_arm::got_section): Make .got section read-only
4370         if -z now is given.
4371
4372 2012-03-15  Ian Lance Taylor  <iant@google.com>
4373
4374         PR gold/13850
4375         * layout.cc (Layout::make_output_section): Correctly mark
4376         SHT_INIT_ARRAY, et. al., as relro.
4377
4378 2012-03-14  Doug Kwan  <dougkwan@google.com>
4379
4380         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
4381         dynamic relocations for protected symbols in shared objects.
4382
4383 2012-03-13  Ian Lance Taylor  <iant@google.com>
4384
4385         * resolve.cc (Symbol_table::resolve): When merging common symbols,
4386         keep the larger alignment.
4387
4388 2012-03-12  Cary Coutant  <ccoutant@google.com>
4389
4390         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
4391         handling of DW_LNE_define_file.
4392
4393 2012-03-12  Cary Coutant  <ccoutant@google.com>
4394
4395         * reduced_debug_output.cc
4396         (Output_reduced_debug_info_section::get_die_end): Add new FORM
4397         codes to switch.
4398
4399 2012-02-29  Cary Coutant  <ccoutant@google.com>
4400
4401         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
4402
4403 2012-02-29  Cary Coutant  <ccoutant@google.com>
4404
4405         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4406         Call Object::decompressed_section_contents.
4407         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
4408         New dtor.
4409         (Sized_dwarf_line_info::buffer_start_): New data member.
4410         * merge.cc (Output_merge_data::do_add_input_section): Call
4411         Object::decompressed_section_contents.
4412         (Output_merge_string::do_add_input_section): Likewise.
4413         * object.cc (need_decompressed_section): New function.
4414         (build_compressed_section_map): Decompress sections needed later.
4415         (Sized_relobj_file::do_decompressed_section_contents): New function.
4416         (Sized_relobj_file::do_discard_decompressed_sections): New function.
4417         * object.h (Object::decompressed_section_contents): New function.
4418         (Object::discard_decompressed_sections): New function.
4419         (Object::do_decompressed_section_contents): New function.
4420         (Object::do_discard_decompressed_sections): New function.
4421         (Compressed_section_info): New type.
4422         (Compressed_section_map): Include decompressed section contents.
4423         (Sized_relobj_file::do_decompressed_section_contents): New function.
4424         (Sized_relobj_file::do_discard_decompressed_sections): New function.
4425
4426 2012-02-16  Cary Coutant  <ccoutant@google.com>
4427
4428         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
4429         * testsuite/Makefile.in: Regenerate.
4430
4431 2012-02-14  Cary Coutant  <ccoutant@google.com>
4432
4433         * options.cc (General_options::finalize): Disallow -pie and -static.
4434
4435 2012-02-03  Doug Kwan  <dougkwan@google.com>
4436
4437         * arm.cc (Arm_relocate_functions::abs8,
4438         Arm_relocate_functions::abs16): Use
4439         Bits::has_signed_unsigned_overflow32.
4440         (Arm_relocate_functions::thm_abs8): Correct range of
4441         overflow check.
4442         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
4443         in assertions.
4444
4445 2012-02-02  Doug Kwan  <dougkwan@google.com>
4446
4447         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
4448         position independent outputs, not just shared objects.
4449
4450 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
4451
4452         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
4453         * configure: Regenerated.
4454
4455 2012-01-27  Ian Lance Taylor  <iant@google.com>
4456
4457         * reloc.h (Bits): New class with static functions, copied from
4458         namespace utils in arm.cc.
4459         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
4460         instead.
4461
4462 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4463
4464         * incremental.cc (write_info_blocks): Correct relocation offset.
4465
4466 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4467
4468         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
4469         (Relocate::tls_gd_to_le): Likewise.
4470
4471 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4472
4473         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
4474
4475 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4476
4477         * configure.ac: Check if -mcmodel=medium works.
4478         * configure: Regenerated.
4479
4480 2012-01-24  Cary Coutant  <ccoutant@google.com>
4481
4482         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
4483         definition and ...
4484         (read_unsigned_LEB_128_x): ... this new function.
4485         (read_signed_LEB_128): Replaced with inline definition and ...
4486         (read_signed_LEB_128_x): ... this new function.
4487         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
4488         (read_unsigned_LEB_128): Add inline definition.
4489         (read_signed_LEB_128_x): New function.
4490         (read_signed_LEB_128): Add inline definition.
4491         * testsuite/Makefile.am (leb128_unittest): New unit test.
4492         * testsuite/Makefile.in: Regenerate.
4493         * testsuite/leb128_unittest.cc: New unit test.
4494
4495 2012-01-23  Ian Lance Taylor  <iant@google.com>
4496
4497         PR gold/13617
4498         * i386.cc (Target_i386::do_code_fill): When using a jmp
4499         instruction, pad with nop instructions.
4500         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4501
4502 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
4503
4504         * x86_64.cc (gc_process_relocs): Add typename on types used in
4505         template.
4506         (scan_relocs): Likewise.
4507         (relocate_section): Likewise.
4508         (apply_relocation): Likewise.
4509
4510 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
4511
4512         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
4513         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
4514         under x32.
4515
4516 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
4517
4518         * x86_64.cc: Initial support for x32.
4519
4520 2012-01-03  Cary Coutant  <ccoutant@google.com>
4521
4522         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
4523         Use abstract base class for GOT.
4524         * gold/output.h (class Output_data_got_base): New abstract base class.
4525         (class Output_data_got): Derive from new base class, adjust ctors.
4526         (Output_data_got::reserve_slot): Make virtual; rename to
4527         do_reserve_slot; Adjust callers.
4528         * gold/target.h (Sized_target::init_got_plt_for_update): Return
4529         pointer to abstract base class.
4530         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
4531
4532 2011-12-18  Ian Lance Taylor  <iant@google.com>
4533
4534         * object.h (Relobj::local_symbol_value): New function.
4535         (Relobj::local_plt_offset): New function.
4536         (Relobj::local_has_got_offset): New function.
4537         (Relobj::local_got_offset): New function.
4538         (Relobj::set_local_got_offset): New function.
4539         (Relobj::do_local_symbol_value): New pure virtual function.
4540         (Relobj::do_local_plt_offset): Likewise.
4541         (Relobj::do_local_has_got_offset): Likewise.
4542         (Relobj::do_local_got_offset): Likewise.
4543         (Relobj::do_set_local_got_offset): Likewise.
4544         (Sized_relobj::do_local_has_got_offset): Rename from
4545         local_has_got_offset.
4546         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
4547         (Sized_relobj::do_set_local_got_offset): Rename from
4548         set_local_got_offset.
4549         (Sized_relobj_file::do_local_plt_offset): Rename from
4550         local_plt_offset.
4551         (Sized_relobj_file::do_local_symbol_value): New function.
4552         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
4553         local_plt_offset.
4554         * output.cc (Output_data_got::Got_entry::write): Change object to
4555         Relobj.  Use local_symbol_value.
4556         (Output_data_got::add_global_with_rel): Change rel_dyn to
4557         Output_data_reloc_generic*.  Use add_global_generic.
4558         (Output_data_got::add_global_with_rela): Remove.  Change all
4559         callers to use add_global_with_rel.
4560         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
4561         Output_data_reloc_generic*.  Use add_global_generic.
4562         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
4563         callers to use add_global_pair_with_rel.
4564         (Output_data_got::add_local): Change object to Relobj*.
4565         (Output_data_got::add_local_plt): Likewise.
4566         (Output_data_got::add_local_with_rel): Change object to Relobj*,
4567         change rel_dyn to Output_data_reloc_generic*.  Use
4568         add_local_generic.
4569         (Output_data_got::add_local_with_rela): Remove.  Change all
4570         callers to use all_local_with_rel.
4571         (Output_data_got::add_local_pair_with_rel): Change object to
4572         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
4573         add_output_section_generic.
4574         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
4575         callers to use add_local_pair_with_rel.
4576         (Output_data_got::reserve_local): Change object to Relobj*.
4577         * output.h: (class Output_data_reloc_generic): Add pure virtual
4578         declarations for add_global_generic, add_local_generic,
4579         add_output_section_generic.
4580         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
4581         functions for Output_data_reloc_generic.  Update declarations for
4582         changes listed in output.cc.
4583         (class Output_data_got): Change template parameter to got_size.
4584         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
4585         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
4586         function.
4587         (Sized_relobj_incr::do_local_plt_offset): New function.
4588         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
4589         add_global_generic.
4590
4591 2011-12-17  Cary Coutant  <ccoutant@google.com>
4592
4593         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
4594         * resolve.cc (Symbol_table::resolve): Likewise.
4595         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
4596         arrays.
4597         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4598
4599 2011-12-16  Ian Lance Taylor  <iant@google.com>
4600
4601         * output.h (Output_data_reloc_generic::add): Only call
4602         add_dynamic_reloc if this is a dynamic reloc section.
4603
4604 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
4605
4606         PR gold/13505
4607         * target-reloc.h (apply_relocation): Replace <64, false> with
4608         <size, big_endian>.
4609
4610 2011-11-25  Nick Clifton  <nickc@redhat.com>
4611
4612         * po/it.po: New Italian translation.
4613
4614 2011-11-17  Sterling Augustine  <saugustine@google.com>
4615
4616         * script.cc (script_include_directive): Implement.
4617         (read_script_file): New local variables name and search_path. Update
4618         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
4619         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
4620         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
4621
4622 2011-11-11  Sterling Augustine  <saugustine@google.com>
4623
4624         * yyscript.y (section_cmd): Add support for INCLUDE directive.
4625         (file_or_sections_cmd): Likewise.
4626
4627 2011-11-11  Doug Kwan  <dougkwan@google.com>
4628
4629         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
4630         if --just-symbols is given.
4631
4632 2011-11-10  Doug Kwan  <dougkwan@google.com>
4633
4634         PR gold/13362
4635         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
4636         when processing data relocs.
4637         * reloc.h (Relocate_functions::rel_unaligned): New method.
4638         (Relocate_functions::pcrel_unaligned): Ditto.
4639         (Relocate_functions::rel32_unaligned): Ditto.
4640         (Relocate_functions::pcrel32_unaligned): Ditto.
4641
4642 2011-11-09  Doug Kwan  <dougkwan@google.com>
4643
4644         PR gold/13362
4645         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
4646         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
4647         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
4648         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4649         (Relocate_functions::rel_unaligned): New.
4650         (Relocate_functions::rel32_unaligned): New.
4651         * target-reloc.h (relocate_for_relocatable): Add code to handle
4652         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4653         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
4654         arm_unaligned_reloc_r): New targets.
4655         * testsuite/Makefile.in: Regenerate.
4656         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
4657         linking.
4658
4659 2011-11-02  Ian Lance Taylor  <iant@google.com>
4660
4661         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
4662         NATIVE_LINKER.
4663         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
4664         * options.cc (General_options::finalize): Use library search path
4665         from configure script if specified.  If not native and no sysroot,
4666         only search TOOLLIBDIR.
4667         * options.h (Search_directory::Search_directory): Change name to
4668         const std::string&.
4669         (General_options::add_to_library_path_with_sysroot): Change arg to
4670         const std::string&.
4671         * configure, Makefile.in, config.in: Rebuild.
4672
4673 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
4674
4675         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
4676         we are working around the ARM1176 Erratum.
4677         * options.h (General_options::fix_arm1176): Add option.
4678         * testsuite/Makefile.am: Add testcases, and keep current ones
4679         working.
4680         * testsuite/Makefile.in: Regenerate.
4681         * testsuite/arm_fix_1176.s: New file.
4682         * testsuite/arm_fix_1176.sh: Likewise.
4683
4684 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
4685
4686         * arm.cc (Target_arm::Target_arm): Remove initialisation of
4687         may_use_blx_.
4688         (Target_arm::may_use_blx): Remove method.
4689         (Target_arm::set_may_use_blx): Likewise.
4690         (Target_arm::may_use_v4t_interworking): New method.
4691         (Target_arm::may_use_v5t_interworking): Likewise.
4692         (Target_arm::may_use_blx_): Remove member variable.
4693         (Arm_relocate_functions::arm_branch_common): Check for v5T
4694         interworking.
4695         (Arm_relocate_functions::thumb_branch_common): Likewise.
4696         (Reloc_stub::stub_type_for_reloc): Likewise.
4697         (Target_arm::do_finalize_sections): Correct interworking checks.
4698         * testsuite/Makefile.am: Add new tests.
4699         * testsuite/Makefile.in: Regenerate.
4700         * testsuite/arm_farcall_arm_arm.s: New test.
4701         * testsuite/arm_farcall_arm_arm.sh: Likewise.
4702         * testsuite/arm_farcall_arm_thumb.s: Likewise.
4703         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
4704         * testsuite/arm_farcall_thumb_arm.s: Likewise.
4705         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
4706         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
4707         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
4708
4709 2011-10-31  Cary Coutant  <ccoutant@google.com>
4710
4711         PR gold/13023
4712         * expression.cc (Expression::eval_with_dot): Add
4713         is_section_dot_assignment parameter.
4714         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
4715         absolute and assigning to dot within a section.
4716         * script-sections.cc
4717         (Output_section_element_assignment::set_section_addresses): Pass
4718         dot_section to set_if_absolute.
4719         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
4720         as is_section_dot_assignment flag to eval_with_dot.
4721         (Output_section_element_dot_assignment::set_section_addresses):
4722         Likewise.
4723         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
4724         parameter.  Also set value if relative to dot_section; set the
4725         symbol's output_section.
4726         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
4727         parameter.  Adjust all callers.
4728         (Expression::eval_maybe_dot): Likewise.
4729         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
4730         Adjust all callers.
4731         * testsuite/script_test_2.t: Test assignment of an absolute value
4732         to dot within an output section element.
4733
4734 2011-10-31  Cary Coutant  <ccoutant@google.com>
4735
4736         * options.h (class General_options): Add --[no-]gnu-unique options.
4737         * symtab.cc (Symbol_table::sized_write_globals): Convert
4738         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
4739
4740 2011-10-31  Cary Coutant  <ccoutant@google.com>
4741
4742         PR gold/13359
4743         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
4744         unnecessary assertion.
4745         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
4746
4747 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
4748
4749         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4750         gc_mark_symbol.
4751         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4752         gc_mark_symbol.
4753         Change to just keep the section associated with symbol.
4754         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
4755         they are externally visible and --export-dynamic is turned on.
4756         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
4757
4758 2011-10-19  Ian Lance Taylor  <iant@google.com>
4759
4760         PR gold/13163
4761         * script-sections.cc
4762         (Output_section_element_dot_assignment::needs_output_section): New
4763         function.
4764
4765 2011-10-19  Ian Lance Taylor  <iant@google.com>
4766
4767         PR gold/13204
4768         * layout.cc (Layout::segment_precedes): Don't assert failure if a
4769         --section-start option was seen.
4770         * options.h (General_options::any_section_start): New function.
4771
4772 2011-10-18  David S. Miller  <davem@davemloft.net>
4773
4774         PR binutils/13301
4775         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
4776         member to track relocation locations that have moved during TLS
4777         reloc optimizations.
4778         (Target_sparc::Relocate::Relocate): Initialize to NULL.
4779         (Target_sparc::Relocate::relocate): Adjust view down by 4
4780         bytes if it matches reloc_adjust_addr_.
4781         (Target_sparc::Relocate::relocate_tls): Always move the
4782         __tls_get_addr call delay slot instruction forward 4 bytes when
4783         performing relaxation.
4784
4785 2011-10-18  Cary Coutant  <ccoutant@google.com>
4786
4787         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
4788         (Output_file::map_no_anonymous): Check for non-zero
4789         return code from posix_fallocate.
4790
4791 2011-10-17  Cary Coutant  <ccoutant@google.com>
4792
4793         PR gold/13245
4794         * plugin.cc (is_visible_from_outside): Check for symbols
4795         referenced from dynamic objects.
4796         * resolve.cc (Symbol_table::resolve): Don't count references
4797         from dynamic objects as references from real ELF files.
4798         * testsuite/plugin_test_2.sh: Adjust expected result.
4799
4800 2011-10-17  Cary Coutant  <ccoutant@google.com>
4801
4802         * gold.cc: Include timer.h.
4803         (queue_middle_tasks): Stamp time.
4804         (queue_final_tasks): Likewise.
4805         * main.cc (main): Store timer in parameters.  Print timers
4806         for each pass.
4807         * parameters.cc (Parameters::Parameters): Initialize timer_.
4808         (Parameters::set_timer): New function.
4809         (set_parameters_timer): New function.
4810         * parameters.h (Parameters::set_timer): New function.
4811         (Parameters::timer): New function.
4812         (Parameters::timer_): New data member.
4813         (set_parameters_timer): New function.
4814         * timer.cc (Timer::stamp): New function.
4815         (Timer::get_pass_time): New function.
4816         * timer.h (Timer::stamp): New function.
4817         (Timer::get_pass_time): New function.
4818         (Timer::pass_times_): New data member.
4819
4820 2011-10-17  Cary Coutant  <ccoutant@google.com>
4821
4822         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4823         task for members of lib groups.
4824
4825 2011-10-17  Cary Coutant  <ccoutant@google.com>
4826
4827         PR gold/13288
4828         * fileread.cc (File_read::find_view): Add assert.
4829         (File_read::make_view): Move bounds check (replace with assert)...
4830         (File_read::find_or_make_view): ... to here.
4831
4832 2011-10-12  Cary Coutant  <ccoutant@google.com>
4833
4834         * output.cc (Output_file::open_base_file): Handle case where
4835         ::read returns less than requested size.
4836
4837 2011-10-10  Cary Coutant  <ccoutant@google.com>
4838
4839         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4840         Initialize defined_count_.
4841         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4842         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4843         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4844         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4845         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4846         * incremental.h (Sized_relobj_incr::defined_count_): New data
4847         member.
4848         (Sized_incr_dynobj::defined_count_): New data member.
4849         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4850         Return zeroes instead of internal error.
4851
4852 2011-10-10  Cary Coutant  <ccoutant@google.com>
4853
4854         PR gold/13249
4855         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4856         (Output_reloc::symbol_value): Return PLT offset if flag is set.
4857         * output.h (class Output_reloc): Add use_plt_offset flag.
4858         (Output_reloc::type_): Adjust size of bit field.
4859         (Output_reloc::use_plt_offset_): New bit field.
4860         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4861         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4862         flag.  Adjust all callers.
4863         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4864         creating RELATIVE relocations.
4865
4866 2011-10-10  Nick Clifton  <nickc@redhat.com>
4867
4868         * po/es.po: Updated Spanish translation.
4869         * po/fi.po: Updated Finnish translation.
4870
4871 2011-10-03   Diego Novillo  <dnovillo@google.com>
4872
4873         * options.cc (parse_uint): Fix dereference of RETVAL.
4874
4875 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
4876
4877         * layout.h (section_order_map_): New member.
4878         (get_section_order_map): New member function.
4879         * output.cc (Output_section::add_input_section): Check for patterns
4880         only when --section-ordering-file is specified.
4881         * gold.cc (queue_middle_tasks): Delay updating order of sections till
4882         output_sections have been formed.
4883         * layout.cc (Layout_Layout): Initialize section_order_map_.
4884         * plugin.cc (update_section_order): Store order in order_map. Do not
4885         update the order.
4886         * testsuite/Makefile.am: Add test case for plugin_final_layout.
4887         * testsuite/Makefile.in: Regenerate.
4888         * testsuite/plugin_section_order.c: New file.
4889         * testsuite/plugin_final_layout.cc: New file.
4890         * testsuite/plugin_final_layout.sh: New file.
4891
4892 2011-09-29  Cary Coutant  <ccoutant@google.com>
4893
4894         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4895         Check for NULL.
4896         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
4897         symbols during incremental update.
4898         (Symbol_table::add_from_dynobj): Likewise.
4899
4900 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4901             Ian Lance Taylor  <iant@google.com>
4902
4903         * symtab.cc (Symbol_table::define_special_symbol): Always
4904         canonicalize version string.
4905
4906 2011-09-26  Cary Coutant  <ccoutant@google.com>
4907
4908         * gold.cc (queue_initial_tasks): Move option checks ...
4909         * options.cc (General_options::finalize): ... to here. Disable
4910         some options; make others fatal.
4911
4912 2011-09-26  Cary Coutant  <ccoutant@google.com>
4913
4914         gcc PR lto/47247
4915         * plugin.cc (get_symbols_v2): New function.
4916         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
4917         (is_referenced_from_outside): New function.
4918         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
4919         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
4920         (get_symbols): Pass version parameter.
4921         (get_symbols_v2): New function.
4922         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
4923         parameter.
4924         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
4925         (onload): Add LDPT_GET_SYMBOLS_V2.
4926         (all_symbols_read_hook): Use get_symbols_v2; check for
4927         LDPR_PREVAILING_DEF_IRONLY_EXP.
4928         * testsuite/plugin_test_3.sh: Update expected results.
4929
4930 2011-09-23  Simon Baldwin  <simonb@google.com>
4931
4932         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
4933         configuration options.
4934         * configure: Regenerate.
4935         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
4936         * Makefile.in: Regenerate.
4937         * testsuite/Makefile.in: Regenerate.
4938
4939 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
4940
4941         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
4942
4943 2011-09-19  Cary Coutant  <ccoutant@google.com>
4944
4945         * incremental.cc (can_incremental_update): Fix typo in comment.
4946         * incremental.h (can_incremental_update): Likewise.
4947
4948 2011-09-18  Cary Coutant  <ccoutant@google.com>
4949
4950         * incremental.cc (can_incremental_update): New function.
4951         * incremental.h (can_incremental_update): New function.
4952         * layout.cc (Layout::init_fixed_output_section): Call it.
4953         (Layout::make_output_section): Don't allow patch space in .eh_frame.
4954         * object.cc (Sized_relobj_file::do_layout): Call
4955         can_incremental_update.
4956
4957 2011-09-13  Cary Coutant  <ccoutant@google.com>
4958
4959         * configure.ac: Check for glibc support for gnu_indirect_function
4960         support with static linking, setting automake conditional
4961         IFUNC_STATIC.
4962         * Makefile.in: Regenerate.
4963         * configure: Regenerate.
4964
4965         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
4966         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
4967         for IFUNC_STATIC.
4968         * testsuite/Makefile.in: Regenerate.
4969
4970 2011-09-13  Cary Coutant  <ccoutant@google.com>
4971
4972         * incremental.cc (Sized_relobj_incr::do_layout): Call
4973         report_comdat_group for kept comdat sections.
4974         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4975         * testsuite/Makefile.in: Regenerate.
4976         * testsuite/incr_comdat_test_1.cc: New source file.
4977         * testsuite/incr_comdat_test_2_v1.cc: New source file.
4978         * testsuite/incr_comdat_test_2_v2.cc: New source file.
4979         * testsuite/incr_comdat_test_2_v3.cc: New source file.
4980
4981 2011-09-13  Ian Lance Taylor  <iant@google.com>
4982
4983         * object.cc (Sized_relobj_file::do_layout): Remove unused local
4984         variable external_symbols_offset.
4985
4986 2011-09-12  Ian Lance Taylor  <iant@google.com>
4987
4988         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4989         triggered if object has no symbols.
4990
4991 2011-09-09  David S. Miller  <davem@davemloft.net>
4992
4993         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4994         (Output_fill_debug_line::do_write): Likewise.
4995
4996 2011-08-29  Cary Coutant  <ccoutant@google.com>
4997
4998         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4999         casts to match formatting specs.
5000         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
5001
5002 2011-08-26  Cary Coutant  <ccoutant@google.com>
5003
5004         * layout.cc (Free_list::allocate): Provide guarantee of minimum
5005         remaining hole size when allocating.
5006         (Layout::make_output_section): Set fill methods for debug sections.
5007         * layout.h (Free_list::Free_list_node): Move from private to
5008         public.
5009         (Free_list::set_min_hole_size): New function.
5010         (Free_list::begin, Free_list::end): New functions.
5011         (Free_list::min_hole_): New data member.
5012         * output.cc: Include dwarf.h.
5013         (Output_fill_debug_info::do_minimum_hole_size): New function.
5014         (Output_fill_debug_info::do_write): New function.
5015         (Output_fill_debug_line::do_minimum_hole_size): New function.
5016         (Output_fill_debug_line::do_write): New function.
5017         (Output_section::Output_section): Initialize new data member.
5018         (Output_section::set_final_data_size): Ensure patch space is larger
5019         than minimum hole size.
5020         (Output_section::do_write): Fill holes in debug sections.
5021         * output.h (Output_fill): New class.
5022         (Output_fill_debug_info): New class.
5023         (Output_fill_debug_line): New class.
5024         (Output_section::set_free_space_fill): New function.
5025         (Output_section::free_space_fill_): New data member.
5026         * testsuite/Makefile.am (incremental_test_3): Add
5027         --incremental-patch option.
5028         (incremental_test_4): Likewise.
5029         (incremental_test_5): Likewise.
5030         (incremental_test_6): Likewise.
5031         (incremental_copy_test): Likewise.
5032         (incremental_common_test_1): Likewise.
5033         * testsuite/Makefile.in: Regenerate.
5034
5035 2011-08-26  Nick Clifton  <nickc@redhat.com>
5036
5037         * po/es.po: Updated Spanish translation.
5038
5039 2011-08-01  Cary Coutant  <ccoutant@google.com>
5040
5041         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
5042         * gold/testsuite/Makefile.in: Regenerate.
5043         * gold/testsuite/justsyms_exec.c: New source file.
5044         * gold/testsuite/justsyms_lib.c: New source file.
5045
5046 2011-08-01  Cary Coutant  <ccoutant@google.com>
5047
5048         * layout.cc (Layout::set_segment_offsets): Don't realign text
5049         segment if -Ttext was specified.
5050         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
5051         file type.
5052         * object.h (Sized_relobj_file::e_type): New function.
5053         (Sized_relobj_file::e_type_): New data member.
5054         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
5055         base address for ET_EXEC files.
5056         * target.cc (Target::do_make_elf_object_implementation): Allow
5057         ET_EXEC files with --just-symbols option.
5058
5059 2011-07-28  Cary Coutant  <ccoutant@google.com>
5060
5061         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
5062         Add thread_number parameter.
5063         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
5064         * workqueue-threads.cc
5065         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
5066         current thread if its thread number is greater than desired thread
5067         count.
5068         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
5069         Add thread_number parameter.
5070         (Workqueue::should_cancel_thread): Likewise.
5071         (Workqueue::find_runnable_or_wait): Pass thread_number to
5072         should_cancel_thread.
5073         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
5074         parameter.
5075
5076 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
5077
5078         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
5079         only after checking if it cannot be forced local.
5080         * symtab.h (is_externally_visible): Check if the symbol is not forced
5081         local.
5082
5083 2011-07-15  Ian Lance Taylor  <iant@google.com>
5084
5085         * options.h (class General_options): Add --print-output-format.
5086         Move -EL next to -EB, for  better --help output.
5087         * target-select.cc: Include <cstdio>, "options.h", and
5088         "parameters.h".
5089         (Target_selector::do_target_bfd_name): New function.
5090         (print_output_format): New function.
5091         * target-select.h (class Target_selector): Update declarations.
5092         (Target_selector::target_bfd_name): New function.
5093         (print_output_format): Declare.
5094         * main.cc: Include "target-select.h".
5095         (main): Handle --print-output-format.
5096         * gold.cc: Include "target-select.h".
5097         (queue_initial_tasks): Handle --print-output-format when there are
5098         no input files.
5099         * parameters.cc (parameters_force_valid_target): Give a better
5100         error message if -EB/-EL does not match target.
5101         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
5102         function.
5103
5104 2011-07-15  Ian Lance Taylor  <iant@google.com>
5105
5106         * i386.cc (class Output_data_plt_i386): Add layout_ field.
5107         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
5108         (Output_data_plt_i386::do_write): Write address of .dynamic
5109         section to first entry in .got.plt section.
5110         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
5111         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5112         Initialize layout_.
5113         (Output_data_plt_x86_64::do_write): Write address of .dynamic
5114         section to first entry in .got.plt section.
5115         * layout.h (Layout::dynamic_section): New function.
5116
5117 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
5118
5119         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
5120         to claim_file call.
5121         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
5122         input_section_position_, and input_section_glob_.
5123         (read_layout_from_file): Call function section_ordering_specified.
5124         * layout.h (is_section_ordering_specified): New function.
5125         (section_ordering_specified): New function.
5126         (section_ordering_specified_): New boolean member.
5127         * main.cc(main): Call load_plugins after layout object is defined.
5128         * output.cc (Output_section::add_input_section): Use
5129         function section_ordering_specified to check if section ordering is
5130         needed.
5131         * output.cc (Output_section::add_relaxed_input_section): Use
5132         function section_ordering_specified to check if section ordering is
5133         needed.
5134         (Output_section::update_section_layout): New function.
5135         (Output_section::sort_attached_input_sections): Check if input section
5136         must be reordered.
5137         * output.h (Output_section::update_section_layout): New function.
5138         * plugin.cc (get_section_count): New function.
5139         (get_section_type): New function.
5140         (get_section_name): New function.
5141         (get_section_contents): New function.
5142         (update_section_order): New function.
5143         (allow_section_ordering): New function.
5144         (Plugin::load): Add the new interfaces to the transfer vector.
5145         (Plugin_manager::load_plugins): New parameter.
5146         (Plugin_manager::all_symbols_read): New parameter.
5147         (Plugin_manager::claim_file): New parameter. Save the elf object for
5148         unclaimed objects.
5149         (Plugin_manager::get_elf_object): New function.
5150         (Plugin_manager::get_view): Change to directly use the bool to check
5151         if get_view is called from claim_file_hook.
5152         * plugin.h (input_objects): New function
5153         (Plugin__manager::load_plugins): New parameter.
5154         (Plugin_manager::claim_file): New parameter.
5155         (Plugin_manager::get_elf_object): New function.
5156         (Plugin_manager::in_claim_file_handler): New function.
5157         (Plugin_manager::in_claim_file_handler_): New member.
5158         (layout): New function.
5159         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
5160         handler with an extra parameter. Make the elf object before calling
5161         claim_file handler.
5162         * testsuite/plugin_test.c (get_section_count): New function pointer.
5163         (get_section_type): New function pointer.
5164         (get_section_name): New function pointer.
5165         (get_section_contents): New function pointer.
5166         (update_section_order): New function pointer.
5167         (allow_section_ordering): New function pointer.
5168         (onload): Check if the new interfaces exist.
5169
5170 2011-07-13  Ian Lance Taylor  <iant@google.com>
5171
5172         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
5173         relro section.
5174         * x86_64.cc (Target_x86_64::got_section): Likewise.
5175         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
5176         (relro_now_test_SOURCES): New variable.
5177         (relro_now_test_DEPENDENCIES): New variable.
5178         (relro_now_test_LDFLAGS): New variable.
5179         (relro_now_test_LDADD): New variable.
5180         (relro_now_test.so): New target.
5181         * testsuite/Makefile.in: Rebuild.
5182
5183 2011-07-12  Ian Lance Taylor  <iant@google.com>
5184
5185         PR gold/12980
5186         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
5187         GLOB_DAT relocation rather than a RELATIVE relocation for a
5188         protected symbol when creating a shared library.
5189         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5190         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
5191         * testsuite/protected_main_1.cc (main): Test that protected
5192         function has same address.
5193
5194 2011-07-11  Ian Lance Taylor  <iant@google.com>
5195
5196         PR gold/12979
5197         * options.h (class General_options): Add -Bgroup.
5198         * options.cc (General_options::finalize): If -Bgroup is set,
5199         default to --unresolved-symbols=report-all.
5200         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
5201         * target-reloc.h (issue_undefined_symbol_error): Handle
5202         --unresolved-symbols=report-all.
5203
5204 2011-07-08  Ian Lance Taylor  <iant@google.com>
5205
5206         PR gold/11985
5207         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
5208         if linker script discards key sections.
5209         (Layout::create_dynamic_symtab): Likewise.
5210         (Layout::assign_local_dynsym_offsets): Likewise.
5211         (Layout::sized_create_version_sections): Likewise.
5212         (Layout::create_interp): Likewise.
5213         (Layout::finish_dynamic_section): Likewise.
5214         (Layout::set_dynamic_symbol_size): Likewise.
5215
5216 2011-07-08  Ian Lance Taylor  <iant@google.com>
5217
5218         PR gold/12386
5219         * options.h (class General_options): Add --unresolved-symbols.
5220         * target-reloc.h (issue_undefined_symbol_error): Check
5221         --unresolved-symbols.  Add comments.
5222
5223 2011-07-08  Ian Lance Taylor  <iant@google.com>
5224
5225         * testsuite/odr_violation2.cc (Ordering::operator()): Make
5226         expression more complex.
5227
5228 2011-07-08  Ian Lance Taylor  <iant@google.com>
5229
5230         PR gold/11317
5231         * target-reloc.h (issue_undefined_symbol_error): New inline
5232         function, broken out of relocate_section.
5233         (relocate_section): Call issue_undefined_symbol_error.
5234         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5235         there is no TLS segment if we are about to issue an undefined
5236         symbol error.
5237         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5238
5239 2011-07-08  Ian Lance Taylor  <iant@google.com>
5240
5241         PR gold/12279
5242         * resolve.cc (Symbol_table::should_override): Add fromtype
5243         parameter.  Change all callers.  Give error when linking together
5244         TLS and non-TLS symbol.
5245         (Symbol_table::should_override_with_special): Add fromtype
5246         parameter.  Change all callers.
5247         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5248         there is no TLS segment if we have reported some errors.
5249         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5250
5251 2011-07-08  Ian Lance Taylor  <iant@google.com>
5252
5253         PR gold/12372
5254         * target.h (Target::plt_address_for_global): New function.
5255         (Target::plt_address_for_local): New function.
5256         (Target::plt_section_for_global): Remove.
5257         (Target::plt_section_for_local): Remove.
5258         (Target::do_plt_address_for_global): New virtual function.
5259         (Target::do_plt_address_for_local): New virtual function.
5260         (Target::do_plt_section_for_global): Remove.
5261         (Target::do_plt_section_for_local): Remove.
5262         (Target::register_global_plt_entry): Add Symbol_table and Layout
5263         parameters.
5264         * output.cc (Output_data_got::Got_entry::write): Use
5265         plt_address_for_global and plt_address_for_local.
5266         * layout.cc (Layout::add_target_dynamic_tags): Use size and
5267         address of output section.
5268         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
5269         got_irelative_, and irelative_count_ fields.  Update
5270         declarations.
5271         (Output_data_plt_i386::has_irelative_section): New function.
5272         (Output_data_plt_i386::entry_count): Add irelative_count_.
5273         (Output_data_plt_i386::set_final_data_size): Likewise.
5274         (class Target_i386): Add got_irelative_ and rel_irelative_
5275         fields.  Update declarations.
5276         (Target_i386::Target_i386): Initialize new fields.
5277         (Target_i386::do_plt_address_for_global): New function replacing
5278         do_plt_section_for_global.
5279         (Target_i386::do_plt_address_for_local): New function replacing
5280         do_plt_section_for_local.
5281         (Target_i386::got_section): Create got_irelative_.
5282         (Target_i386::rel_irelative_section): New function.
5283         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
5284         fields.  Don't define __rel_iplt_{start,end}.
5285         (Output_data_plt_i386::add_entry): Add symtab and layout
5286         parameters.  Change all callers.  Use different PLT and GOT for
5287         IFUNC symbols.
5288         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
5289         layout parameters.  Change all callers.  Use different PLT and
5290         GOT.
5291         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
5292         (Output_data_plt_i386::rel_irelative): New function.
5293         (Output_data_plt_i386::address_for_global): New function.
5294         (Output_data_plt_i386::address_for_local): New function.
5295         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
5296         IRELATIVE GOT when changing IFUNC GOT entries.
5297         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
5298         reloc.
5299         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
5300         if we didn't create an IRELATIVE GOT.
5301         (Target_i386::Relocate::relocate): Use plt_address_for_global and
5302         plt_address_for_local.
5303         (Target_i386::do_dynsym_value): Use plt_address_for_global.
5304         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
5305         got_irelative_, and irelative_count_ fields.  Update
5306         declarations.
5307         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5308         Initialize new fields.  Remove symtab parameter.  Change all
5309         callers.
5310         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
5311         irelative_count_.
5312         (Output_data_plt_x86_64::has_irelative_section): New function.
5313         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
5314         (class Target_x86_64): Add got_irelative_ and rel_irelative_
5315         fields.  Update declarations.
5316         (Target_x86_64::Target_x86_64): Initialize new fields.
5317         (Target_x86_64::do_plt_address_for_global): New function replacing
5318         do_plt_section_for_global.
5319         (Target_x86_64::do_plt_address_for_local): New function replacing
5320         do_plt_section_for_local.
5321         (Target_x86_64::got_section): Create got_irelative_.
5322         (Target_x86_64::rela_irelative_section): New function.
5323         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
5324         all callers.  Don't create __rel_iplt_{start,end}.
5325         (Output_data_plt_x86_64::add_entry): Add symtab and layout
5326         parameters.  Change all callers.  Use different PLT and GOT for
5327         IFUNC symbols.
5328         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
5329         layout parameters.  Change all callers.  Use different PLT and
5330         GOT.
5331         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
5332         parameters.  Change all callers.  Use different PLT and GOT for
5333         IFUNC symbols.
5334         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
5335         (Output_data_plt_x86_64::rela_irelative): New function.
5336         (Output_data_plt_x86_64::address_for_global): New function.
5337         (Output_data_plt_x86_64::address_for_local): New function.
5338         (Output_data_plt_x86_64::set_final_data_size): Likewise.
5339         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
5340         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
5341         (Target_x86_64::register_global_plt_entry): Add symtab and layout
5342         parameters.
5343         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
5344         reloc.
5345         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
5346         symbols if we didn't create an IRELATIVE GOT.
5347         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
5348         plt_address_for_local.
5349         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
5350         * testsuite/ifuncvar1.c: New test file.
5351         * testsuite/ifuncvar2.c: New test file.
5352         * testsuite/ifuncvar3.c: New test file.
5353         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
5354         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
5355         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
5356         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
5357         * testsuite/Makefile.in: Rebuild.
5358
5359 2011-07-07  Cary Coutant  <ccoutant@google.com>
5360
5361         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
5362         (two_file_test_1_ndebug.o): Likewise.
5363         (two_file_test_1b_ndebug.o): Likewise.
5364         (two_file_test_2_ndebug.o): Likewise.
5365         (two_file_test_main_ndebug.o): Likewise.
5366         (incremental_test_2): Link with no-debug versions.
5367
5368 2011-07-06  Cary Coutant  <ccoutant@google.com>
5369
5370         * gold/incremental.cc
5371         (Output_section_incremental_inputs::write_info_blocks): Check for
5372         hidden and internal symbols.
5373
5374 2011-07-06  Cary Coutant  <ccoutant@google.com>
5375
5376         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
5377         Check disposition for startup file.
5378         (Incremental_inputs::report_command_line): Ignore
5379         --incremental-startup-unchanged option.
5380         * options.cc (General_options::parse_incremental_startup_unchanged):
5381         New function.
5382         (General_options::General_options): Initialize new data member.
5383         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
5384         (General_options): Add --incremental-startup-unchanged option.
5385         (General_options::incremental_startup_disposition): New function.
5386         (General_options::incremental_startup_disposition_): New data member.
5387
5388 2011-07-06  Cary Coutant  <ccoutant@google.com>
5389
5390         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
5391         input file index to Script_info ctor.
5392         (Sized_incremental_binary::do_file_has_changed): Find the
5393         command-line argument for files named in scripts.
5394         * incremental.h (Script_info::Script_info): New ctor
5395         with input file index.
5396         (Script_info::input_file_index): New function.
5397         (Script_info::input_file_index_): New data member.
5398         (Incremental_binary::get_library): Add const.
5399         (Incremental_binary::get_script_info): Add const.
5400         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
5401         * testsuite/Makefile.am (incremental_test_5): New test case.
5402         (incremental_test_6): New test case.
5403         * testsuite/Makefile.in: Regenerate.
5404
5405 2011-07-06  Cary Coutant  <ccoutant@google.com>
5406
5407         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
5408         debug output when command lines differ.
5409
5410 2011-07-06  Cary Coutant  <ccoutant@google.com>
5411
5412         * incremental.cc (Incremental_inputs::report_command_line): Ignore
5413         --incremental-patch option.
5414         * layout.cc (Free_list::allocate): Extend allocation beyond original
5415         end if enabled.
5416         (Layout::make_output_section): Mark sections that should get
5417         patch space.
5418         * options.cc (parse_percent): New function.
5419         * options.h (parse_percent): New function.
5420         (DEFINE_percent): New macro.
5421         (General_options): Add --incremental-patch option.
5422         * output.cc (Output_section::Output_section): Initialize new data
5423         members.
5424         (Output_section::add_input_section): Print section name when out
5425         of patch space.
5426         (Output_section::add_output_section_data): Likewise.
5427         (Output_section::set_final_data_size): Add patch space when
5428         doing --incremental-full.
5429         (Output_section::do_reset_address_and_file_offset): Remove patch
5430         space.
5431         (Output_segment::set_section_list_addresses): Print debug output
5432         only if --incremental-update.
5433         * output.h (Output_section::set_is_patch_space_allowed): New function.
5434         (Output_section::is_patch_space_allowed_): New data member.
5435         (Output_section::patch_space_): New data member.
5436         * parameters.cc (Parameters::incremental_full): New function.
5437         * parameters.h (Parameters::incremental_full): New function
5438         * testsuite/Makefile.am (incremental_test_2): Add test for
5439         --incremental-patch option.
5440         * testsuite/Makefile.in: Regenerate.
5441         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
5442         (t18): Remove function body.
5443
5444 2011-07-05  Doug Kwan  <dougkwan@google.com>
5445
5446         PR gold/12771
5447         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
5448         Arm_Address type for relocation result.
5449         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
5450         overflow check.
5451         (Arm_relocate_functions::abs32): Use unaligned access.
5452         (Arm_relocate_functions::rel32): Ditto.
5453         (Arm_relocate_functions::prel31): Ditto.
5454         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
5455         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
5456         static data relocations.
5457         * testsuite/Makefile.in: Regnerate.
5458         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
5459
5460 2011-07-05  Ian Lance Taylor  <iant@google.com>
5461
5462         PR gold/12392
5463         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
5464         symbols if necessary.
5465         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5466
5467 2011-07-05  Ian Lance Taylor  <iant@google.com>
5468
5469         PR gold/12952
5470         * resolve.cc (Symbol::override_base_with_special): Simply override
5471         version with special symbol version, ignoring previous version.
5472
5473 2011-07-05  Ian Lance Taylor  <iant@google.com>
5474
5475         * object.cc (Sized_relobj_file::include_section_group): Add
5476         information to comment about signature location.
5477
5478 2011-07-02  Ian Lance Taylor  <iant@google.com>
5479
5480         PR gold/12957
5481         * options.h (class General_options): Add -f and -F.
5482         * options.cc (General_options::finalize): Fatal error if -f/-F
5483         are used without -shared.
5484         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
5485
5486 2011-07-02  Ian Lance Taylor  <iant@google.com>
5487
5488         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
5489
5490 2011-07-01  Ian Lance Taylor  <iant@google.com>
5491
5492         PR gold/12525
5493         PR gold/12952
5494         * resolve.cc (Symbol::override_base_with_special): Don't override
5495         the version if the overriding symbol has a different name.
5496         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
5497         all callers.  If we give an error about an undefined version,
5498         define the base version if necessary.
5499         * dynobj.h (class Versions): Update declaration.
5500         * testsuite/weak_alias_test_5.cc: New file.
5501         * testsuite/weak_alias_test.script: New file.
5502         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
5503         and versioned_alias have the right value, and call t2.
5504         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
5505         weak_alias_test_5.so.
5506         (weak_alias_test_LDADD): Likewise.
5507         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
5508         * testsuite/Makefile.in: Rebuild.
5509
5510 2011-07-01  Ian Lance Taylor  <iant@google.com>
5511
5512         PR gold/12525
5513         * options.h (class General_options): Support -z notext.
5514         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
5515         -Wl,-z,notext.
5516         (two_file_shared_nonpic.so): Likewise.
5517         (two_file_shared_mixed.so): Likewise.
5518         (two_file_shared_mixed_1.so): Likewise.
5519         (weak_undef_lib_nonpic.so): Likewise.
5520         (alt/weak_undef_lib_nonpic.so): Likewise.
5521         (tls_test_shared_nonpic.so): Likewise.
5522         * testsuite/Makefile.in: Rebuild.
5523
5524 2011-07-01  Ian Lance Taylor  <iant@google.com>
5525
5526         PR gold/12525
5527         * configure.ac: Test whether static linking works, setting
5528         the automake conditional HAVE_STATIC.
5529         * testsuite/Makefile.am: Disable tests using -static if
5530         HAVE_STATIC is not true.
5531         * configure, testsuite/Makefile.in: Rebuild.
5532
5533 2011-07-01  Ian Lance Taylor  <iant@google.com>
5534
5535         PR gold/12525
5536         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
5537         Assert if we see DW_EH_PE_indirect.
5538         * target.h (Target::ehframe_datarel_base): New function.
5539         (Target::do_ehframe_datarel_base): New target function.
5540         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
5541         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
5542         function.
5543
5544 2011-07-01  Ian Lance Taylor  <iant@google.com>
5545
5546         PR gold/12571
5547         * options.h (class General_options): Add
5548         --ld-generated-unwind-info.
5549         * ehframe.cc (Fde::write): Add address parameter.  Change all
5550         callers.  If associated with PLT, fill in address and size.
5551         (Cie::set_output_offset): Only add merge mapping if there is an
5552         object.
5553         (Cie::write): Add address parameter.  Change all callers.
5554         (Eh_frame::add_ehframe_for_plt): New function.
5555         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
5556         input_offset_ fields into union u_, with new plt field.
5557         (Fde::Fde): Adjust for new union field.
5558         (Fde::Fde) [Output_data version]: New constructor.
5559         (Fde::add_mapping): Only add merge mapping if there is an object.
5560         (class Cie): Update declarations.
5561         (class Eh_frame): Declare add_ehframe_for_plt.
5562         * layout.cc (Layout::layout_eh_frame): Break out code into
5563         make_eh_frame_section, and call it.
5564         (Layout::make_eh_frame_section): New function.
5565         (Layout::add_eh_frame_for_plt): New function.
5566         * layout.h (class Layout): Update declarations.
5567         * merge.cc (Merge_map::add_mapping): Add assertion.
5568         * i386.cc: Include "dwarf.h".
5569         (class Output_data_plt_i386): Make first_plt_entry,
5570         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
5571         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5572         and plt_eh_frame_fde.
5573         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
5574         boundary.  Call add_eh_frame_for_plt if appropriate.
5575         * x86_64.cc: Include "dwarf.h".
5576         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
5577         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
5578         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5579         and plt_eh_frame_fde.
5580         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
5581         appropriate.
5582
5583 2011-06-29  Ian Lance Taylor  <iant@google.com>
5584
5585         PR gold/12629
5586         * object.cc (Sized_relobj_file::layout_section): Change shdr
5587         parameter to be const.
5588         (Sized_relobj_file::layout_eh_frame_section): New function, broken
5589         out of do_layout.
5590         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
5591         appropriate.  Call layout_eh_frame_section.
5592         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
5593         sections.
5594         * object.h (class Sized_relobj_file): Update declarations.
5595
5596 2011-06-29  Ian Lance Taylor  <iant@google.com>
5597
5598         PR gold/12652
5599         * script.cc (Token::integer_value): Accept trailing M/m/K/k
5600         modifier.
5601         (Lex::gather_token): Accept trailing M/m/K/k for integers.
5602
5603 2011-06-29  Ian Lance Taylor  <iant@google.com>
5604
5605         PR gold/12675
5606         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
5607         SHT_X86_64_UNWIND.
5608         * layout.cc (Layout::layout_eh_frame): Likewise.
5609
5610 2011-06-29  Ian Lance Taylor  <iant@google.com>
5611
5612         PR gold/12695
5613         * layout.cc (Layout::symtab_section_shndx): New function.
5614         * layout.h (class Layout): Declare symtab_section_shndx.
5615         * output.cc (Output_section::write_header): Call it.
5616
5617 2011-06-29  Ian Lance Taylor  <iant@google.com>
5618
5619         PR gold/12818
5620         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
5621         symbols which are not used in a relocation.
5622
5623 2011-06-28  Ian Lance Taylor  <iant@google.com>
5624
5625         PR gold/12898
5626         * layout.cc (Layout::segment_precedes): Don't crash if a linker
5627         script create indistinguishable segments.
5628         (Layout::set_segment_offsets): Use stable_sort when sorting
5629         segments.  Pass this to Compare_segments constructor.
5630         * layout.h (class Layout): Make segment_precedes non-static.
5631         (class Compare_segments): Change from struct to class.  Add
5632         layout_ field.  Add constructor.
5633         * script-sections.cc
5634         (Script_sections::attach_sections_using_phdrs_clause): Rename
5635         local orphan to is_orphan.  Don't report failure to put empty
5636         section in segment.  On attachment failure, report name of
5637         section, and attach to first PT_LOAD segment.
5638
5639 2011-06-28  Ian Lance Taylor  <iant@google.com>
5640
5641         PR gold/12934
5642         * target-select.cc (Target_selector::Target_selector): Add
5643         emulation parameter.  Change all callers.
5644         (select_target_by_bfd_name): Rename from select_target_by_name.
5645         Change all callers.
5646         (select_target_by_emulation): New function.
5647         (supported_emulation_names): New function.
5648         * target-select.h (class Target_selector): Add emulation_ field.
5649         Update declarations.
5650         (Target_selector::recognize_by_bfd_name): Rename from
5651         recognize_by_name.  Change all callers.
5652         (Target_selector::supported_bfd_names): Rename from
5653         supported_names.  Change all callers.
5654         (Target_selector::recognize_by_emulation): New function.
5655         (Target_selector::supported_emulations): New function.
5656         (Target_selector::emulation): New function.
5657         (Target_selector::do_recognize_by_bfd_name): Rename from
5658         do_recognize_by_name.  Change all callers.
5659         (Target_selector::do_supported_bfd_names): Rename from
5660         do_supported_names.  Change all callers.
5661         (Target_selector::do_recognize_by_emulation): New function.
5662         (Target_selector::do_supported_emulations): New function.
5663         (select_target_by_bfd_name): Change name in declaration.
5664         (select_target_by_emulation): Declare.
5665         (supported_emulation_names): Declare.
5666         * parameters.cc (parameters_force_valid_target): Try to find
5667         target based on emulation from -m option.
5668         * options.h (class General_options): Change doc string for -m.
5669         * options.cc (help): Print emulations.
5670         (General_options::parse_V): Likewise.
5671         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
5672         Add emulation parameter.  Change all callers.
5673
5674 2011-06-28  Ian Lance Taylor  <iant@google.com>
5675
5676         * target.h (class Target): Add osabi_ field.
5677         (Target::osabi): New function.
5678         (Target::set_osabi): New function.
5679         (Target::Target): Initialize osabi_.
5680         (Target::do_adjust_elf_header): Make pure virtual.
5681         (Sized_target::do_adjust_elf_header): Declare.
5682         * target.cc (Sized_target::do_adjust_elf_header): New function.
5683         (class Sized_target): Instantiate all versions.
5684         * freebsd.h (class Target_freebsd): Remove.
5685         (Target_selector_freebsd::do_recognize): Call set_osabi on
5686         Target.
5687         (Target_selector_freebsd::do_recognize_by_name): Likewise.
5688         (Target_selector_freebsd::set_osabi): Remove.
5689         * i386.cc (class Target_i386): Inherit from Sized_target rather
5690         than Target_freebsd.
5691         * x86_64.cc (class Target_x86_64): Likewise.
5692
5693 2011-06-28  Ian Lance Taylor  <iant@google.com>
5694
5695         * target.h (Target::can_check_for_function_pointers): Rewrite.
5696         Make non-virtual.
5697         (Target::can_icf_inline_merge_sections): Likewise.
5698         (Target::section_may_have_icf_unsafe_poineters): Likewise.
5699         (Target::Target_info): Add can_icf_inline_merge_sections field.
5700         (Target::do_can_check_for_function_pointers): New virtual
5701         function.
5702         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
5703         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
5704         from can_check_for_function_pointers, move in file.
5705         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
5706         section_may_have_icf_unsafe_poineters, move in file.
5707         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
5708         * i386.cc (Target_i386::do_can_check_for_function_pointers):
5709         Rename from can_check_for_function_pointers, move in file.
5710         (Target_i386::can_icf_inline_merge_sections): Remove.
5711         (Target_i386::i386_info): Initialize
5712         can_icf_inline_merge_sections.
5713         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
5714         Initialize can_icf_inline_merge_sections.
5715         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
5716         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
5717         Rename from can_check_for_function_pointers, move in file.
5718         (Target_x86_64::can_icf_inline_merge_sections): Remove.
5719         (Target_x86_64::x86_64_info): Initialize
5720         can_icf_inline_merge_sections.
5721         * testsuite/testfile.cc (Target_test::test_target_info):
5722         Likewise.
5723         * icf.cc (get_section_contents): Correct formatting.
5724
5725 2011-06-27  Ian Lance Taylor  <iant@google.com>
5726
5727         * symtab.cc (Symbol::versioned_name): New function.
5728         (Symbol_table::add_to_final_symtab): Use versioned_name when
5729         appropriate.
5730         (Symbol_table::sized_write_symbol): Likewise.
5731         * symtab.h (class Symbol): Declare versioned_name.
5732         * stringpool.h (class Stringpool_template): Add variant of add
5733         which takes a std::basic_string.
5734         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
5735         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
5736         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
5737         (ver_test_12.o): New target.
5738         * testsuite/Makefile.in: Rebuild.
5739
5740 2011-06-27  Doug Kwan  <dougkwan@google.com>
5741
5742         * arm.cc (Arm_relocate_functions::thm_jump8,
5743         Arm_relocate_functions::thm_jump11): Use a wider signed
5744         type to compute offset.
5745         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
5746         arm_thm_jump8.
5747         * testsuite/Makefile.in: Regenerate.
5748         * testsuite/arm_branch_in_range.sh: Check test results of
5749         arm_thm_jump11 and arm_thm_jump8.
5750         * testsuite/arm_thm_jump11.s: New test source file.
5751         * testsuite/arm_thm_jump11.t: New linker script.
5752         * testsuite/arm_thm_jump8.s: New test source file.
5753         * testsuite/arm_thm_jump8.t: New linker script.
5754
5755 2011-06-24  Ian Lance Taylor  <iant@google.com>
5756
5757         * layout.cc: Include "object.h".
5758         (ctors_sections_in_init_array): New static variable.
5759         (Layout::is_ctors_in_init_array): New function.
5760         (Layout::layout): Add entry to ctors_sections_in_init_array if
5761         appropriate.
5762         * layout.h (class Layout): Declare is_ctors_in_init_array.
5763         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
5764         is_ctors_reverse_view is set.
5765         (Sized_relobj_file::write_sections): Add layout parameter.  Change
5766         all callers.  Set is_ctors_reverse_view field of View_size.
5767         (Sized_relobj_file::reverse_words): New function.
5768         * object.h (Sized_relobj_file::View_size): Add
5769         is_ctors_reverse_view field.
5770         (class Sized_relobj_file): Update declarations.
5771         * testsuite/initpri3.c: New test.
5772         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
5773         initpri3b.
5774         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
5775         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
5776         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
5777         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
5778         * testsuite/Makefile.in: Rebuild.
5779
5780 2011-06-24  Cary Coutant  <ccoutant@google.com>
5781
5782         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
5783         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
5784         (debug_msg_cdebug.err): New targets.
5785         * testsuite/Makefile.in: Regenerate.
5786         * testsuite/debug_msg.sh: Check output of link with compressed debug.
5787         Fix checks for link with shared library.
5788
5789 2011-06-24  Doug Kwan  <dougkwan@google.com>
5790
5791         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
5792         skip empty text sections.
5793         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
5794
5795 2011-06-22  Ian Lance Taylor  <iant@google.com>
5796
5797         PR gold/12910
5798         * options.h (class General_options): Add --ctors-in-init-array.
5799         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
5800         friends as SHT_PROGBITS for merging sections.
5801         (Layout::layout): Remove special handling of .init_array and
5802         friends.  Don't sort if doing relocatable link.  Sort for .ctors
5803         and .dtors if ctors_in_init_array.
5804         (Layout::make_output_section): Force correct section types for
5805         .init_array and friends.  Don't sort if doing relocatable link,
5806         Don't sort .ctors and .dtors if ctors_in_init_array.
5807         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
5808         (Layout::output_section_name): Add relobj parameter.  Change all
5809         callers.  Handle .ctors. and .dtors. in code rather than table.
5810         Handle .ctors and .dtors if ctors_in_init_array.
5811         (Layout::match_file_name): New function, moved from output.cc.
5812         * layout.h (class Layout): Update declarations.
5813         * output.cc: Include "layout.h".
5814         (Input_section_sort_entry::get_priority): New function.
5815         (Input_section_sort_entry::match_file_name): Just call
5816         Layout::match_file_name.
5817         (Output_section::Input_section_sort_init_fini_compare::operator()):
5818         Handle .ctors and .dtors.  Sort by explicit priority rather than
5819         by name.
5820         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
5821         * testsuite/initpri2.c: New test.
5822         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5823         (check_PROGRAMS): Add initpri2.
5824         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5825         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5826         * configure, testsuite/Makefile.in: Rebuild.
5827
5828 2011-06-19  Ian Lance Taylor  <iant@google.com>
5829
5830         PR gold/12880
5831         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5832         .interp section to a PT_INTERP segment even if we have seen a
5833         --dynamic-linker option.  Don't do it if we have seen a PHDRS
5834         clause in a linker script.
5835         (Layout::finalize): Don't create a .interp section if we've
5836         already create a PT_INTERP segment.
5837         (Layout::create_interp): Always call choose_output_section (revert
5838         patch of 2011-06-17).  Don't create PT_INTERP segment.
5839         * script-sections.cc
5840         (Script_sections::create_note_and_tls_segments): Add a .interp
5841         section to a PT_INTERP segment even if we have seen a
5842         --dynamic-linker option.
5843
5844 2011-06-18  Ian Lance Taylor  <iant@google.com>
5845
5846         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5847         merely because a non-PT_LOAD segment has a dynamic reloc.
5848
5849 2011-06-18  Ian Lance Taylor  <iant@google.com>
5850
5851         * layout.cc (Layout::finish_dynamic_section): Don't create
5852         DT_FLAGS entry if not needed.
5853
5854 2011-06-18  Ian Lance Taylor  <iant@google.com>
5855
5856         PR gold/12745
5857         * layout.cc (Layout::layout_eh_frame): Correct handling of
5858         writable .eh_frame section.
5859
5860 2011-06-17  Ian Lance Taylor  <iant@google.com>
5861
5862         PR gold/12893
5863         * resolve.cc (Symbol_table::resolve): Don't give an error if a
5864         symbol is redefined with the exact same object and value.
5865
5866 2011-06-17  Ian Lance Taylor  <iant@google.com>
5867
5868         PR gold/12880
5869         * layout.h (class Layout): Add interp_segment_ field.
5870         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5871         (Layout::attach_allocated_section_to_segment): If making shared
5872         library, put .interp section in PT_INTERP segment.
5873         (Layout::finalize): Also call create_interp if -dynamic-linker
5874         option was used.
5875         (Layout::create_interp): Assert that there is no PT_INTERP
5876         segment.  If not using a SECTIONS clause, use make_output_section.
5877         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5878         * script-sections.cc
5879         (Script_sections::create_note_and_tls_segments): If making shared
5880         library, put .interp section in PT_INTERP segment.
5881
5882 2011-06-17  Ian Lance Taylor  <iant@google.com>
5883
5884         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5885         when making a shared library.
5886
5887 2011-06-17  Ian Lance Taylor  <iant@google.com>
5888
5889         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
5890         parameter.  Change all callers.  Don't issue warning about PC32
5891         against locally defined symbol.
5892
5893 2011-06-16  Ian Lance Taylor  <iant@google.com>
5894
5895         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
5896         occurs in same object.
5897
5898 2011-06-14  Alan Modra  <amodra@gmail.com>
5899
5900         * po/POTFILES.in: Regenerate.
5901
5902 2011-06-09  Ian Lance Taylor  <iant@google.com>
5903
5904         * script-sections.cc
5905         (Orphan_output_section::set_section_addresses): For a relocatable
5906         link set address to 0.
5907
5908 2011-06-09  Cary Coutant  <ccoutant@google.com>
5909
5910         PR gold/12804
5911         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
5912         used with --compress-debug-sections.
5913         * gold/object.cc (Sized_relobj_file::do_layout): Report
5914         uncompressed size of compressed input sections.
5915
5916 2011-06-08  Cary Coutant  <ccoutant@google.com>
5917
5918         PR gold/12804
5919         * testsuite/two_file_test_2_v1.cc: Change initialization of
5920         v2 to keep it in .data.
5921
5922 2011-06-07  Cary Coutant  <ccoutant@google.com>
5923
5924         * common.cc (Symbol_table::do_allocate_commons_list): Call
5925         gold_fallback.
5926         * errors.cc (Errors::fatal): Adjust call to gold_exit.
5927         (Errors::fallback): New function.
5928         (gold_fallback): New function.
5929         * errors.h (Errors::fallback): New function.
5930         * gold.cc (gold_exit): Change status parameter to enum; adjust
5931         all callers.
5932         (queue_initial_tasks): Call gold_fallback.
5933         * gold.h: Include cstdlib.
5934         (Exit_status): New enum type.
5935         (gold_exit): Change status parameter to enum.
5936         (gold_fallback): New function.
5937         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
5938         (Layout::create_symtab_sections): Likewise.
5939         (Layout::create_shdrs): Likewise.
5940         * main.cc (main): Adjust call to gold_exit.
5941         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
5942         (Output_data_got::add_got_entry_pair): Likewise.
5943         (Output_section::add_input_section): Likewise.
5944         (Output_section::add_output_section_data): Likewise.
5945         (Output_segment::set_section_list_addresses): Likewise.
5946         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
5947
5948 2011-06-07  Cary Coutant  <ccoutant@google.com>
5949
5950         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
5951         for incremental links.
5952         * output.cc (Output_segment::set_section_list_addresses): Remove
5953         FIXME and test for TLS or BSS.
5954
5955 2011-06-07  Cary Coutant  <ccoutant@google.com>
5956
5957         * testsuite/Makefile.am: Add incremental_copy_test,
5958         incremental_common_test_1.
5959         * testsuite/Makefile.in: Regenerate.
5960         * testsuite/common_test_1_v1.c: New source file.
5961         * testsuite/common_test_1_v2.c: New source file.
5962         * testsuite/copy_test_v1.cc: New source file.
5963
5964 2011-06-07  Cary Coutant  <ccoutant@google.com>
5965
5966         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
5967         update, allocate common from bss section's free list.
5968         * incremental-dump.cc (dump_incremental_inputs): Print flag for
5969         linker-defined symbols.
5970         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5971         Skip GOT and PLT entries that are no longer referenced.
5972         (Output_section_incremental_inputs::write_info_blocks): Mark
5973         linker-defined symbols.
5974         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5975         * output.cc (Output_section::allocate): New function.
5976         * output.h (Output_section::allocate): New function.
5977         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5978         linker-defined symbols.
5979         (Symbol::override_base_with_special): Copy is_predefined_ flag.
5980         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5981         (Symbol::init_base_output_data): Likewise.
5982         (Symbol::init_base_output_segment): Likewise.
5983         (Symbol::init_base_constant): Likewise.
5984         (Sized_symbol::init_output_data): Likewise.
5985         (Sized_symbol::init_output_segment): Likewise.
5986         (Sized_symbol::init_constant): Likewise.
5987         (Symbol_table::do_define_in_output_data): Likewise.
5988         (Symbol_table::do_define_in_output_segment): Likewise.
5989         (Symbol_table::do_define_as_constant): Likewise.
5990         * symtab.h (Symbol::is_predefined): New function.
5991         (Symbol::init_base_output_data): Add is_predefined parameter.
5992         (Symbol::init_base_output_segment): Likewise.
5993         (Symbol::init_base_constant): Likewise.
5994         (Symbol::is_predefined_): New data member.
5995         (Sized_symbol::init_output_data): Add is_predefined parameter.
5996         (Sized_symbol::init_output_segment): Likewise.
5997         (Sized_symbol::init_constant): Likewise.
5998         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5999
6000 2011-06-07  Cary Coutant  <ccoutant@google.com>
6001
6002         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
6003         instead of emit_copy_reloc.
6004         (Copy_relocs::emit_copy_reloc): Refactor.
6005         (Copy_relocs::make_copy_reloc): New function.
6006         (Copy_relocs::add_copy_reloc): Remove.
6007         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
6008         section.
6009         (Copy_relocs::make_copy_reloc): New function.
6010         (Copy_relocs::add_copy_reloc): Remove.
6011         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
6012         unchanged input files.
6013         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
6014         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
6015         Reserve BSS space for COPY relocations.
6016         (Sized_incremental_binary::do_emit_copy_relocs): New function.
6017         (Output_section_incremental_inputs::write_info_blocks): Record
6018         whether a symbol is copied from a shared object.
6019         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
6020         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
6021         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
6022         (Incremental_input_entry_reader::get_output_symbol_index): Add
6023         is_copy parameter.
6024         (Incremental_binary::emit_copy_relocs): New function.
6025         (Incremental_binary::do_emit_copy_relocs): New function.
6026         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6027         new data member.
6028         (Sized_incremental_binary::add_copy_reloc): New function.
6029         (Sized_incremental_binary::do_emit_copy_relocs): New function.
6030         (Sized_incremental_binary::Copy_reloc): New struct.
6031         (Sized_incremental_binary::Copy_relocs): New typedef.
6032         (Sized_incremental_binary::copy_relocs_): New data member.
6033         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
6034         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
6035         * target.h (Sized_target::emit_copy_reloc): New function.
6036         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
6037
6038 2011-06-02  Cary Coutant  <ccoutant@google.com>
6039
6040         PR gold/12163
6041         * gold/archive.cc (Archive::Archive): Initialize new data member.
6042         (Archive::include_all_members): Return if archive has already been
6043         included.
6044         * gold/archive.h (Archive::include_all_members_): New data member.
6045
6046 2011-06-02  Nick Clifton  <nickc@redhat.com>
6047
6048         * dynobj.h: Fix spelling mistake in comment.
6049         * output.cc: Likewise.
6050
6051 2011-05-31  Doug Kwan  <dougkwan@google.com>
6052             Asier Llano
6053
6054         PR gold/12826
6055         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
6056         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
6057         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
6058         redundant arm_exidx_test.so.
6059         * testsuite/Makefile.in: Regenerate.
6060         (check_SCRIPTS): Add pr12826.sh
6061         (check_DATA): Add pr12826.stdout
6062         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
6063         * testsuite/pr12826.sh: New file.
6064         * testsuite/pr12826_1.s: Ditto.
6065         * testsuite/pr12826_1.s: Ditto.
6066
6067 2011-05-30  Ian Lance Taylor  <iant@google.com>
6068
6069         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
6070         sections.
6071
6072 2011-05-29  Ian Lance Taylor  <iant@google.com>
6073
6074         PR gold/12804
6075         * testsuite/Makefile.am: Use different file name for two_file_test
6076         temporary file for each incremental test.
6077         * testsuite/Makefile.in: Rebuild.
6078
6079 2011-05-29  Ian Lance Taylor  <iant@google.com>
6080
6081         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
6082         binary input file is empty.
6083
6084 2011-05-27  Ian Lance Taylor  <iant@google.com>
6085
6086         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
6087         (ver_test_9.so): Likewise.
6088         * testsuite/Makefile.in: Rebuild.
6089
6090 2011-05-26 Cary Coutant  <ccoutant@google.com>
6091
6092         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
6093         * incremental.cc (Incremental_inputs::report_input_section): Fix
6094         comment, indentation.
6095         (Incremental_inputs::report_comdat_group): New function.
6096         (Output_section_incremental_inputs::set_final_data_size): Adjust size
6097         of data for incremental input file entry.
6098         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
6099         group count, COMDAT group signatures.
6100         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
6101         an unchanged input file.
6102         * incremental.h (Incremental_object_entry::Incremental_object_entry):
6103         Initialize new data member.
6104         (Incremental_object_entry::add_comdat_group): New function.
6105         (Incremental_object_entry::get_comdat_group_count): New function.
6106         (Incremental_object_entry::get_comdat_signature_key): New function.
6107         (Incremental_object_entry::groups_): New data member.
6108         (Incremental_inputs::report_comdat_group): New function.
6109         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
6110         data for incremental input file entry.
6111         (Incremental_input_entry_reader::get_comdat_group_count): New function.
6112         (Incremental_input_entry_reader::get_input_section): Adjust size of
6113         data for incremental input file entry.
6114         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
6115         (Incremental_input_entry_reader::get_comdat_group_signature): New
6116         function.
6117         * object.cc (Sized_relobj::include_section_group): Report kept
6118         COMDAT groups for incremental links.
6119
6120 2011-05-24  David Meyer  <pdox@google.com>
6121
6122         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
6123         with name parameter.  Add found_name parameter.
6124         * fileread.cc (Input_file::find_file): Adjust code accordingly.
6125         * dirsearch.h (class Dirsearch): Update declaration.
6126
6127 2011-05-24  Ian Lance Taylor  <iant@google.com>
6128
6129         * archive.cc (Library_base::should_include_member): Pull in object
6130         from archive if it defines the entry symbol.
6131         * parameters.cc (Parameters::entry): New function.
6132         * parameters.h (class Parameters): Declare entry.
6133         * output.h (class Output_file_header): Remove entry_ field.
6134         * output.cc (Output_file_header::Output_file_header): Remove entry
6135         parameter.  Change all callers.
6136         (Output_file_header::entry): Use parameters->entry.
6137         * gold.cc (queue_middle_tasks): Likewise.
6138         * plugin.cc (Plugin_hook::run): Likewise.
6139
6140 2011-05-24 Cary Coutant  <ccoutant@google.com>
6141
6142         * gold.cc (queue_initial_tasks): Pass incremental base filename
6143         to Output_file::open_base_file; don't print error message.
6144         * incremental-dump.cc (main): Adjust call to
6145         Output_file::open_for_modification.
6146         * incremental-dump.cc (main): Likewise.
6147         * incremental.cc (Incremental_inputs::report_command_line):
6148         Ignore --incremental-base option when comparing command lines.
6149         Ignore parameter when given as separate argument.
6150         * options.h (class General_options): Add --incremental-base.
6151         * output.cc (Output_file::Output_file):
6152         (Output_file::open_base_file): Add base_name and writable parameters;
6153         read base file into new file; print error message here.
6154         (Output_file::map_no_anonymous): Add writable parameter; adjust all
6155         callers.
6156         * output.h (Output_file::open_for_modification): Rename to...
6157         (Output_file::open_base_file): ...this; add base_name and
6158         writable parameters; adjust all callers.
6159         (Output_file::map_no_anonymous): Add writable parameter; adjust all
6160         callers.
6161         * testsuite/Makefile.am (incremental_test_4): Test
6162         --incremental-base.
6163         * testsuite/Makefile.in: Regenerate.
6164
6165 2011-05-24 Cary Coutant  <ccoutant@google.com>
6166
6167         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
6168         incremental_test_4.
6169         * testsuite/Makefile.in: Regenerate.
6170         * testsuite/two_file_test_1_v1.cc: New test source file.
6171         * testsuite/two_file_test_1b_v1.cc: New test source file.
6172         * testsuite/two_file_test_2_v1.cc: New test source file.
6173
6174 2011-05-24 Cary Coutant  <ccoutant@google.com>
6175
6176         * dynobj.h (Dynobj::do_dynobj): New function.
6177         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
6178         flag and soname for shared objects.
6179         * incremental.cc (Incremental_inputs::report_object): Make
6180         either Incremental_object_entry or Incremental_dynobj_entry; add
6181         soname to string table.
6182         (Incremental_inputs::report_input_section): Add assertion.
6183         (Output_section_incremental_inputs::set_final_data_size): Adjust
6184         type of input file entry for shared libraries; adjust size of
6185         shared library info entry.
6186         (Output_section_incremental_inputs::write_input_files): Write
6187         as_needed flag for shared libraries.
6188         (Output_section_incremental_inputs::write_info_blocks): Adjust type
6189         of input file entry for shared libraries; write soname.
6190         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
6191         soname from incremental info.
6192         * incremental.h (enum Incremental_input_flags): Add
6193         INCREMENTAL_INPUT_AS_NEEDED.
6194         (Incremental_input_entry::Incremental_input_entry): Initialize new
6195         data member.
6196         (Incremental_input_entry::set_as_needed): New function.
6197         (Incremental_input_entry::as_needed): New function.
6198         (Incremental_input_entry::do_dynobj_entry): New function.
6199         (Incremental_input_entry::as_needed_): New data member.
6200         (Incremental_object_entry::Incremental_object_entry): Don't check
6201         for shared library.
6202         (Incremental_object_entry::do_type): Likewise.
6203         (class Incremental_dynobj_entry): New class.
6204         (Incremental_input_entry_reader::as_needed): New function.
6205         (Incremental_input_entry_reader::get_soname): New function.
6206         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
6207         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
6208         size of shared library info entry.
6209         * layout.cc (Layout::finish_dynamic_section): Don't test for
6210         incremental link when adding DT_NEEDED entries.
6211         * object.h (Object::Object): Initialize new data member.
6212         (Object::dynobj): New function.
6213         (Object::set_as_needed): New function.
6214         (Object::as_needed): New function.
6215         (Object::do_dynobj): New function.
6216         (Object::as_needed_): New data member.
6217
6218 2011-05-24 Cary Coutant  <ccoutant@google.com>
6219
6220         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
6221         info; adjust display of GOT entries.
6222         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6223         vector of input objects; remove file_status_.
6224         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
6225         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
6226         got_plt reader; call target hooks to reserve GOT entries.
6227         (Output_section_incremental_inputs::set_final_data_size): Adjust size
6228         of input file info header and GOT info entry.
6229         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
6230         relocation info.
6231         (Got_plt_view_info::got_descriptor): Remove.
6232         (Got_plt_view_info::sym_index): New data member.
6233         (Got_plt_view_info::input_index): New data member.
6234         (Local_got_offset_visitor::visit): Write input file index.
6235         (Global_got_offset_visitor::visit): Write 0 for input file index.
6236         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
6237         with sym_index and input_index.
6238         (Output_section_incremental_inputs::write_got_plt): Adjust size of
6239         incremental info GOT entry; replace got_descriptor with input_index.
6240         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
6241         map from input file index to object.
6242         (Sized_relobj_incr::do_layout): Replace direct data member reference
6243         with accessor function.
6244         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
6245         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
6246         Adjust size of input file info header.
6247         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
6248         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
6249         (Incremental_input_entry_reader::get_input_section): Adjust size of
6250         input file info header.
6251         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
6252         of incremental info GOT entry.
6253         (Incremental_got_plt_reader::get_got_desc): Remove.
6254         (Incremental_got_plt_reader::get_got_symndx): New function.
6255         (Incremental_got_plt_reader::get_got_input_index): New function.
6256         (Sized_incremental_binary::Sized_incremental_binary): Remove
6257         file_status_; add input_objects_.
6258         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
6259         (Sized_incremental_binary::set_file_is_unchanged): Remove.
6260         (Sized_incremental_binary::file_is_unchanged): Remove.
6261         (Sized_incremental_binary::set_input_object): New function.
6262         (Sized_incremental_binary::input_object): New function.
6263         (Sized_incremental_binary::file_status_): Remove.
6264         (Sized_incremental_binary::input_objects_): New data member.
6265         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
6266         references.
6267         (Sized_relobj_incr::invalid_address): Move to base class.
6268         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
6269         class.
6270         (Sized_relobj_incr::do_output_section_offset): Likewise.
6271         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
6272         (Sized_relobj_incr::section_offsets_): Likewise.
6273         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
6274         function.
6275         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
6276         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
6277         with accessor function.
6278         (Sized_relobj_file::do_layout): Likewise.
6279         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
6280         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
6281         (Sized_relobj_file::compute_final_local_value): Replace refs to
6282         section_offsets_ with accessor function.
6283         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
6284         * object.h (Relobj::Relobj): Initialize new data members.
6285         (Relobj::add_dyn_reloc): New function.
6286         (Relobj::first_dyn_reloc): New function.
6287         (Relobj::dyn_reloc_count): New function.
6288         (Relobj::first_dyn_reloc_): New data member.
6289         (Relobj::dyn_reloc_count_): New data member.
6290         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
6291         references.
6292         (Sized_relobj::Address): New typedef.
6293         (Sized_relobj::invalid_address): Move here from child class.
6294         (Sized_relobj::Sized_relobj): Initialize new data members.
6295         (Sized_relobj::sized_relobj): New function.
6296         (Sized_relobj::is_output_section_offset_invalid): Move here from
6297         child class.
6298         (Sized_relobj::get_output_section_offset): Likewise.
6299         (Sized_relobj::local_has_got_offset): Likewise.
6300         (Sized_relobj::local_got_offset): Likewise.
6301         (Sized_relobj::set_local_got_offset): Likewise.
6302         (Sized_relobj::do_for_all_local_got_entries): Likewise.
6303         (Sized_relobj::clear_got_offsets): New function.
6304         (Sized_relobj::section_offsets): Move here from child class.
6305         (Sized_relobj::do_output_section_offset): Likewise.
6306         (Sized_relobj::do_set_section_offset): Likewise.
6307         (Sized_relobj::Local_got_offsets): Likewise.
6308         (Sized_relobj::local_got_offsets_): Likewise.
6309         (Sized_relobj::section_offsets_): Likewise.
6310         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
6311         references.
6312         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
6313         class.
6314         (Sized_relobj_file::sized_relobj): New function
6315         (Sized_relobj_file::local_has_got_offset): Move to base class.
6316         (Sized_relobj_file::local_got_offset): Likewise.
6317         (Sized_relobj_file::set_local_got_offset): Likewise.
6318         (Sized_relobj_file::get_output_section_offset): Likewise.
6319         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
6320         (Sized_relobj_file::do_output_section_offset): Likewise.
6321         (Sized_relobj_file::do_set_section_offset): Likewise.
6322         (Sized_relobj_file::Local_got_offsets): Likewise.
6323         (Sized_relobj_file::local_got_offsets_): Likewise.
6324         (Sized_relobj_file::section_offsets_): Likewise.
6325         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
6326         (all constructors).
6327         (set_needs_dynsym_index): Convert relobj to derived class pointer.
6328         (Output_reloc::get_symbol_index): Likewise.
6329         (Output_reloc::local_section_offset): Likewise.
6330         (Output_reloc::get_address): Likewise.
6331         (Output_reloc::symbol_value): Likewise.
6332         (Output_data_got::reserve_slot): Move to class definition.
6333         (Output_data_got::reserve_local): New function.
6334         (Output_data_got::reserve_slot_for_global): Remove.
6335         (Output_data_got::reserve_global): New function.
6336         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
6337         (all constructors, two instantiations).
6338         (Output_reloc::get_relobj): New function (two instantiations).
6339         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
6340         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
6341         (Output_data_reloc::add_global): Adjust type of relobj.
6342         (Output_data_reloc::add_global_relative): Likewise.
6343         (Output_data_reloc::add_symbolless_global_addend): Likewise.
6344         (Output_data_reloc::add_local): Likewise.
6345         (Output_data_reloc::add_local_relative): Likewise.
6346         (Output_data_reloc::add_symbolless_local_addend): Likewise.
6347         (Output_data_reloc::add_local_section): Likewise.
6348         (Output_data_reloc::add_output_section): Likewise.
6349         (Output_data_reloc::add_absolute): Likewise.
6350         (Output_data_reloc::add_target_specific): Likewise.
6351         (Output_data_got::reserve_slot): Move definition here.
6352         (Output_data_got::reserve_local): New function.
6353         (Output_data_got::reserve_global): New function.
6354         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
6355         section_offsets_ with accessor function.
6356         (Sized_relobj_file::write_sections): Likewise.
6357         (Sized_relobj_file::do_relocate_sections): Likewise.
6358         * target.h (Sized_target::reserve_local_got_entry): New function.
6359         (Sized_target::reserve_global_got_entry): New function.
6360         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
6361         (Target_x86_64::reserve_global_got_entry): New function.
6362         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
6363
6364 2011-05-23 Cary Coutant  <ccoutant@google.com>
6365
6366         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
6367         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
6368         bit when checking got_type.
6369         * incremental.cc (Sized_incremental_binary::setup_readers):
6370         Store symbol table and string table locations; initialize bit vector
6371         of file status flags.
6372         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
6373         unchanged files.
6374         (Sized_incremental_binary::do_process_got_plt): New function.
6375         (Sized_incremental_binary::get_symtab_view): Use stored locations.
6376         (Output_section_incremental_inputs::set_final_data_size): Record
6377         file index for each input file.
6378         (Output_section_incremental_inputs::write_got_plt): Store file index
6379         instead of input entry offset for each GOT entry.
6380         * incremental.h
6381         (Incremental_input_entry::Incremental_input_entry): Initialize new
6382         data member.
6383         (Incremental_input_entry::set_offset): Store file index.
6384         (Incremental_input_entry::get_file_index): New function.
6385         (Incremental_input_entry::file_index_): New data member.
6386         (Incremental_binary::process_got_plt): New function.
6387         (Incremental_binary::do_process_got_plt): New function.
6388         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6389         data members.
6390         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
6391         (Sized_incremental_binary::set_file_is_unchanged): New function.
6392         (Sized_incremental_binary::file_is_unchanged): New function.
6393         (Sized_incremental_binary::do_process_got_plt): New function.
6394         (Sized_incremental_binary::file_status_): New data member.
6395         (Sized_incremental_binary::main_symtab_loc_): New data member.
6396         (Sized_incremental_binary::main_strtab_loc_): New data member.
6397         * output.cc (Output_data_got::Got_entry::write): Add case
6398         RESERVED_CODE.
6399         (Output_data_got::add_global): Call add_got_entry.
6400         (Output_data_got::add_global_plt): Likewise.
6401         (Output_data_got::add_global_with_rel): Likewise.
6402         (Output_data_got::add_global_with_rela): Likewise.
6403         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
6404         (Output_data_got::add_global_pair_with_rela): Likewise.
6405         (Output_data_got::add_local): Call add_got_entry.
6406         (Output_data_got::add_local_plt): Likewise.
6407         (Output_data_got::add_local_with_rel): Likewise.
6408         (Output_data_got::add_local_with_rela): Likewise.
6409         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
6410         (Output_data_got::add_local_pair_with_rela): Likewise.
6411         (Output_data_got::reserve_slot): New function.
6412         (Output_data_got::reserve_slot_for_global): New function.
6413         (Output_data_got::add_got_entry): New function.
6414         (Output_data_got::add_got_entry_pair): New function.
6415         (Output_section::add_output_section_data): Edit FIXME.
6416         * output.h
6417         (Output_section_data_build::Output_section_data_build): New
6418         constructor with size parameter.
6419         (Output_data_space::Output_data_space): Likewise.
6420         (Output_data_got::Output_data_got): Initialize new data member; new
6421         constructor with size parameter.
6422         (Output_data_got::add_constant): Call add_got_entry.
6423         (Output_data_got::reserve_slot): New function.
6424         (Output_data_got::reserve_slot_for_global): New function.
6425         (class Output_data_got::Got_entry): Add RESERVED_CODE.
6426         (Output_data_got::add_got_entry): New function.
6427         (Output_data_got::add_got_entry_pair): New function.
6428         (Output_data_got::free_list_): New data member.
6429         * target.h (Sized_target::init_got_plt_for_update): New function.
6430         (Sized_target::register_global_plt_entry): New function.
6431         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
6432         Initialize new data member; call init; add constructor with PLT count.
6433         (Output_data_plt_x86_64::init): New function.
6434         (Output_data_plt_x86_64::add_relocation): New function.
6435         (Output_data_plt_x86_64::reserve_slot): New function.
6436         (Output_data_plt_x86_64::free_list_): New data member.
6437         (Target_x86_64::init_got_plt_for_update): New function.
6438         (Target_x86_64::register_global_plt_entry): New function.
6439         (Output_data_plt_x86_64::add_entry): Allocate from free list for
6440         incremental updates.
6441         (Output_data_plt_x86_64::add_relocation): New function.
6442         * testsuite/object_unittest.cc (Object_test): Set default options.
6443
6444 2011-05-16  Ian Lance Taylor  <iant@google.com>
6445
6446         * options.h (class General_options): Make -i a synonym for -r.
6447
6448 2011-05-16  Ian Lance Taylor  <iant@google.com>
6449
6450         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
6451
6452 2011-05-10 Cary Coutant  <ccoutant@google.com>
6453
6454         * object.cc (Sized_relobj::do_count_local_symbols): Check for
6455         strip_all (-s).
6456
6457 2011-05-06  Ian Lance Taylor  <iant@google.com>
6458
6459         * layout.cc (Layout::layout): If the output section flags change,
6460         update the ordering.
6461
6462 2011-04-25 Cary Coutant  <ccoutant@google.com>
6463
6464         * incremental-dump.cc (dump_incremental_inputs): Print local
6465         symbol info for each input file.
6466         * incremental.cc
6467         (Output_section_incremental_inputs::set_final_data_size): Add local
6468         symbol info to input file entries in incremental info.
6469         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6470         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
6471         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
6472         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
6473         implementation.
6474         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
6475         (Sized_incr_relobj::do_relocate): Write the local symbols.
6476         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
6477         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
6478         Adjust size of input file header.
6479         (Incremental_inputs_reader::get_local_symbol_offset): New function.
6480         (Incremental_inputs_reader::get_local_symbol_count): New function.
6481         (Incremental_inputs_reader::get_input_section): Adjust size of input
6482         file header.
6483         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
6484         (Sized_incr_relobj::This): New typedef.
6485         (Sized_incr_relobj::sym_size): New const data member.
6486         (Sized_incr_relobj::Local_symbol): New struct.
6487         (Sized_incr_relobj::do_output_local_symbol_count): New function.
6488         (Sized_incr_relobj::do_local_symbol_offset): New function.
6489         (Sized_incr_relobj::local_symbol_count_): New data member.
6490         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
6491         (Sized_incr_relobj::local_symbol_index_): New data member.
6492         (Sized_incr_relobj::local_symbol_offset_): New data member.
6493         (Sized_incr_relobj::local_dynsym_offset_): New data member.
6494         (Sized_incr_relobj::local_symbols_): New data member.
6495         * object.h (Relobj::output_local_symbol_count): New function.
6496         (Relobj::local_symbol_offset): New function.
6497         (Relobj::do_output_local_symbol_count): New function.
6498         (Relobj::do_local_symbol_offset): New function.
6499         (Sized_relobj::do_output_local_symbol_count): New function.
6500         (Sized_relobj::do_local_symbol_offset): New function.
6501
6502 2011-04-22  Vladimir Simonov  <sv@sw.ru>
6503
6504         * descriptors.cc (set_close_on_exec): New function.
6505         (Descriptors::open): Use set_close_on_exec.
6506         * output.cc (S_ISLNK): Define if not defined.
6507
6508 2011-04-22 Cary Coutant  <ccoutant@google.com>
6509
6510         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6511         global symbol map.
6512         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6513         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
6514         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
6515         relocations.
6516         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
6517         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
6518         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
6519         * incremental.h
6520         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
6521         function.
6522         (Incremental_binary::apply_incremental_relocs): New function.
6523         (Incremental_binary::do_apply_incremental_relocs): New function.
6524         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6525         data member.
6526         (Sized_incremental_binary::add_global_symbol): New function.
6527         (Sized_incremental_binary::global_symbol): New function.
6528         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6529         (Sized_incremental_binary::symbol_map_): New data member.
6530         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
6531         * target.h (Sized_target::apply_relocation): New function.
6532         * target-reloc.h (apply_relocation): New function.
6533         * x86_64.cc (Target_x86_64::apply_relocation): New function.
6534
6535 2011-04-22  Doug Kwan  <dougkwan@google.com>
6536
6537         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
6538         flag of a SHT_ARM_EXIDX section.
6539         * testsuite/Makefile.am (arm_exidx_test): New test rules.
6540         * testsuite/Makefile.in: Regenerate.
6541         * testsuite/arm_exidx_test.s: New file.
6542         * testsuite/arm_exidx_test.sh: Same.
6543
6544 2011-04-20 Cary Coutant  <ccoutant@google.com>
6545
6546         PR gold/12689
6547         * archive.h (Incremental_archive_entry::Archive_member):
6548         Initialize arg_serial_ (second constructor).
6549
6550 2011-04-17  Ian Lance Taylor  <iant@google.com>
6551
6552         * object.cc (Relocate_info::location): Simplify location string.
6553         * errors.cc (Errors::error_at_location): Don't print program
6554         name.
6555         (Errors::warning_at_location): Likewise.
6556         (Errors::undefined_symbol): Likewise.
6557         * testsuite/debug_msg.sh: Update accordingly.
6558
6559 2011-04-14 Cary Coutant  <ccoutant@google.com>
6560
6561         * gold/layout.cc (Layout::symtab_section_offset): New function.
6562         * gold/layout.h (Layout::symtab_section_offset): New function.
6563         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
6564
6565 2011-04-12  Ian Lance Taylor  <iant@google.com>
6566
6567         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
6568         with MREMAP_MAYMOVE.
6569         * output.h (class Output_file): Add map_is_allocated_ field.
6570         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
6571         not available, provide stubs.  If mremap is not available, #define
6572         it to gold_mremap.
6573         (MREMAP_MAYMOVE): Define if not defined.
6574         (Output_file::Output_file): Initialize map_is_allocated_.
6575         (Output_file::resize): Check map_is_allocated_.
6576         (Output_file::map_anonymous): If mmap fails, use malloc.
6577         (Output_file::unmap): Don't do anything for an anonymous map.
6578         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
6579         is not available, provide stubs.
6580         (File_read::View::~View): Use free rather than delete[].
6581         (File_read::make_view): Use malloc rather than new[].  If mmap
6582         fails, use malloc.
6583         (File_read::find_or_make_view): Use malloc rather than new[].
6584         * gold.h: Remove HAVE_REMAP code.
6585         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
6586         exists.  Rename mremap to gold_mremap.  If mmap is not available
6587         don't do anything.
6588         * configure, config.in: Rebuild.
6589
6590 2011-04-11  Ian Lance Taylor  <iant@google.com>
6591
6592         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
6593         initialize local variable v.
6594
6595 2011-04-11  Cary Coutant  <ccoutant@google.com>
6596
6597         * archive.cc (Archive::include_member): Adjust call to
6598         report_object.
6599         (Add_archive_symbols::run): Track argument serial numbers.
6600         (Lib_group::include_member): Likewise.
6601         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
6602         * archive.h (Incremental_archive_entry::Archive_member):
6603         Initialize arg_serial_.
6604         (Archive_member::arg_serial_): New data member.
6605         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
6606         (Sized_dynobj::do_add_symbols): Track symbols when doing an
6607         incremental link.
6608         (Sized_dynobj::do_for_all_local_got_entries): New function.
6609         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
6610         function.
6611         * fileread.cc (get_mtime): New function.
6612         * fileread.h (get_mtime): New function.
6613         * gold.cc (queue_initial_tasks): Check for incremental update.
6614         (process_incremental_input): New function.
6615         (queue_middle_tasks): Don't force valid target for incremental
6616         update.
6617         * incremental-dump.cc (find_input_containing_global): Adjust
6618         size of symbol info entry.
6619         (dump_incremental_inputs): Dump argument serial number and
6620         in_system_directory flag; bias shndx by 1; print symbol names
6621         when dumping per-file symbol lists; use new symbol info readers.
6622         * incremental.cc
6623         (Output_section_incremental_inputs:update_data_size): New function.
6624         (Sized_incremental_binary::setup_readers): Setup input readers
6625         for each input file; build maps for files added from libraries
6626         and scripts.
6627         (Sized_incremental_binary::check_input_args): New function.
6628         (Sized_incremental_binary::do_check_inputs): Build map of argument
6629         serial numbers to input arguments.
6630         (Sized_incremental_binary::do_file_has_changed): Rename
6631         do_file_is_unchanged to this; compare file modification times.
6632         (Sized_incremental_binary::do_init_layout): New function.
6633         (Sized_incremental_binary::do_reserve_layout): New function.
6634         (Sized_incremental_binary::do_get_input_reader): Remove.
6635         (Sized_incremental_binary::get_symtab_view): New function.
6636         (Incremental_checker::can_incrementally_link_output_file): Remove.
6637         (Incremental_inputs::report_command_line): Exclude --debug options.
6638         (Incremental_inputs::report_archive_begin): Add parameter; track
6639         argument serial numbers; don't put input file entry for archive
6640         before archive members.
6641         (Incremental_inputs::report_archive_end): Put input file entry
6642         for archive after archive members.
6643         (Incremental_inputs::report_object): Add parameter; track argument
6644         serial numbers and in_system_directory flag.
6645         (Incremental_inputs::report_script): Add parameter; track argument
6646         serial numbers.
6647         (Output_section_incremental_inputs::set_final_data_size): Adjust
6648         size of symbol info entry; check for forwarding symbols.
6649         (Output_section_incremental_inputs::write_input_files): Write
6650         in_system_directory flag and argument serial number.
6651         (Output_section_incremental_inputs::write_info_blocks): Map section
6652         indices between incremental info and original input file; store
6653         input section index for each symbol.
6654         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
6655         change operator() to visit().
6656         (class Global_got_offset_visitor): Likewise.
6657         (class Global_symbol_visitor_got_plt):
6658         (Output_section_incremental_inputs::write_got_plt): Use new visitor
6659         classes.
6660         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
6661         (Sized_incr_relobj::do_read_symbols): New function.
6662         (Sized_incr_relobj::do_layout): New function.
6663         (Sized_incr_relobj::do_layout_deferred_sections): New function.
6664         (Sized_incr_relobj::do_add_symbols): New function.
6665         (Sized_incr_relobj::do_should_include_member): New function.
6666         (Sized_incr_relobj::do_for_all_global_symbols): New function.
6667         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
6668         (Sized_incr_relobj::do_section_size): New function.
6669         (Sized_incr_relobj::do_section_name): New function.
6670         (Sized_incr_relobj::do_section_contents): New function.
6671         (Sized_incr_relobj::do_section_flags): New function.
6672         (Sized_incr_relobj::do_section_entsize): New function.
6673         (Sized_incr_relobj::do_section_address): New function.
6674         (Sized_incr_relobj::do_section_type): New function.
6675         (Sized_incr_relobj::do_section_link): New function.
6676         (Sized_incr_relobj::do_section_info): New function.
6677         (Sized_incr_relobj::do_section_addralign): New function.
6678         (Sized_incr_relobj::do_initialize_xindex): New function.
6679         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
6680         (Sized_incr_relobj::do_read_relocs): New function.
6681         (Sized_incr_relobj::do_gc_process_relocs): New function.
6682         (Sized_incr_relobj::do_scan_relocs): New function.
6683         (Sized_incr_relobj::do_count_local_symbols): New function.
6684         (Sized_incr_relobj::do_finalize_local_symbols): New function.
6685         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
6686         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
6687         (Sized_incr_relobj::do_relocate): New function.
6688         (Sized_incr_relobj::do_set_section_offset): New function.
6689         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
6690         (Sized_incr_dynobj::do_read_symbols): New function.
6691         (Sized_incr_dynobj::do_layout): New function.
6692         (Sized_incr_dynobj::do_add_symbols): New function.
6693         (Sized_incr_dynobj::do_should_include_member): New function.
6694         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
6695         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
6696         (Sized_incr_dynobj::do_section_size): New function.
6697         (Sized_incr_dynobj::do_section_name): New function.
6698         (Sized_incr_dynobj::do_section_contents): New function.
6699         (Sized_incr_dynobj::do_section_flags): New function.
6700         (Sized_incr_dynobj::do_section_entsize): New function.
6701         (Sized_incr_dynobj::do_section_address): New function.
6702         (Sized_incr_dynobj::do_section_type): New function.
6703         (Sized_incr_dynobj::do_section_link): New function.
6704         (Sized_incr_dynobj::do_section_info): New function.
6705         (Sized_incr_dynobj::do_section_addralign): New function.
6706         (Sized_incr_dynobj::do_initialize_xindex): New function.
6707         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
6708         (make_sized_incremental_object): New function.
6709         (Incremental_library::copy_unused_symbols): New function.
6710         (Incremental_library::do_for_all_unused_symbols): New function.
6711         * incremental.h (enum Incremental_input_flags): New type.
6712         (class Incremental_checker): Remove.
6713         (Incremental_input_entry::Incremental_input_entry): Add argument
6714         serial number.
6715         (Incremental_input_entry::arg_serial): New function.
6716         (Incremental_input_entry::set_is_in_system_directory): New function.
6717         (Incremental_input_entry::is_in_system_directory): New function.
6718         (Incremental_input_entry::arg_serial_): New data member.
6719         (Incremental_input_entry::is_in_system_directory_): New data member.
6720         (class Script_info): Move here from script.h.
6721         (Script_info::Script_info): Add filename parameter.
6722         (Script_info::filename): New function.
6723         (Script_info::filename_): New data member.
6724         (Incremental_script_entry::Incremental_script_entry): Add argument
6725         serial number.
6726         (Incremental_object_entry::Incremental_object_entry): Likewise.
6727         (Incremental_object_entry::add_input_section): Build list of input
6728         sections with map to original shndx.
6729         (Incremental_object_entry::get_input_section_index): New function.
6730         (Incremental_object_entry::shndx_): New data member.
6731         (Incremental_object_entry::name_key_): Rename; adjust all refs.
6732         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
6733         (Incremental_archive_entry::Incremental_archive_entry): Add argument
6734         serial number.
6735         (Incremental_inputs::report_archive_begin): Likewise.
6736         (Incremental_inputs::report_object): Likewise.
6737         (Incremental_inputs::report_script): Likewise.
6738         (class Incremental_global_symbol_reader): New class.
6739         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
6740         and store flags and input file type.
6741         (Incremental_input_entry_reader::arg_serial): New function.
6742         (Incremental_input_entry_reader::type): Extract type from flags.
6743         (Incremental_input_entry_reader::is_in_system_directory): New function.
6744         (Incremental_input_entry_reader::get_input_section_count): Call
6745         accessor function for type.
6746         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
6747         function for type; adjust size of global symbol entry.
6748         (Incremental_input_entry_reader::get_global_symbol_count): Call
6749         accessor function for type.
6750         (Incremental_input_entry_reader::get_object_count): Likewise.
6751         (Incremental_input_entry_reader::get_object_offset): Likewise.
6752         (Incremental_input_entry_reader::get_member_count): Likewise.
6753         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
6754         (Incremental_input_entry_reader::get_member_offset): Likewise.
6755         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
6756         (Incremental_input_entry_reader::Global_symbol_info): Remove.
6757         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
6758         (Incremental_input_entry_reader::get_global_symbol_reader): New
6759         function.
6760         (Incremental_input_entry_reader::get_output_symbol_index): New
6761         function.
6762         (Incremental_input_entry_reader::type_): Remove.
6763         (Incremental_input_entry_reader::flags_): New data member.
6764         (Incremental_inputs_reader::input_file_offset): New function.
6765         (Incremental_inputs_reader::input_file_index): New function.
6766         (Incremental_inputs_reader::input_file): Call input_file_offset.
6767         (Incremental_inputs_reader::input_file_at_offset): New function.
6768         (Incremental_relocs_reader::get_r_type): Reformat.
6769         (Incremental_relocs_reader::get_r_shndx): Reformat.
6770         (Incremental_relocs_reader::get_r_offset): Reformat.
6771         (Incremental_relocs_reader::data): New function.
6772         (Incremental_binary::Incremental_binary): Initialize new data members.
6773         (Incremental_binary::check_inputs): Add cmdline parameter.
6774         (Incremental_binary::file_is_unchanged): Remove.
6775         (Input_reader::arg_serial): New function.
6776         (Input_reader::get_unused_symbol_count): New function.
6777         (Input_reader::get_unused_symbol): New function.
6778         (Input_reader::do_arg_serial): New function.
6779         (Input_reader::do_get_unused_symbol_count): New function.
6780         (Input_reader::do_get_unused_symbol): New function.
6781         (Incremental_binary::input_file_count): New function.
6782         (Incremental_binary::get_input_reader): Change signature to use
6783         index instead of filename.
6784         (Incremental_binary::file_has_changed): New function.
6785         (Incremental_binary::get_input_argument): New function.
6786         (Incremental_binary::get_library): New function.
6787         (Incremental_binary::get_script_info): New function.
6788         (Incremental_binary::init_layout): New function.
6789         (Incremental_binary::reserve_layout): New function.
6790         (Incremental_binary::output_file): New function.
6791         (Incremental_binary::do_check_inputs): New function.
6792         (Incremental_binary::do_file_is_unchanged): Remove.
6793         (Incremental_binary::do_file_has_changed): New function.
6794         (Incremental_binary::do_init_layout): New function.
6795         (Incremental_binary::do_reserve_layout): New function.
6796         (Incremental_binary::do_input_file_count): New function.
6797         (Incremental_binary::do_get_input_reader): Change signature.
6798         (Incremental_binary::input_args_map_): New data member.
6799         (Incremental_binary::library_map_): New data member.
6800         (Incremental_binary::script_map_): New data member.
6801         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6802         new data members.
6803         (Sized_incremental_binary::output_section): New function.
6804         (Sized_incremental_binary::inputs_reader): Add const.
6805         (Sized_incremental_binary::symtab_reader): Add const.
6806         (Sized_incremental_binary::relocs_reader): Add const.
6807         (Sized_incremental_binary::got_plt_reader): Add const.
6808         (Sized_incremental_binary::get_symtab_view): New function.
6809         (Sized_incremental_binary::Inputs_reader): New typedef.
6810         (Sized_incremental_binary::Input_entry_reader): New typedef.
6811         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
6812         (Sized_incremental_binary::do_file_is_unchanged): Remove.
6813         (Sized_incremental_binary::do_file_has_changed): New function.
6814         (Sized_incremental_binary::do_init_layout): New function.
6815         (Sized_incremental_binary::do_reserve_layout): New function.
6816         (Sized_input_reader::Inputs_reader): Remove.
6817         (Sized_input_reader::Input_entry_reader): Remove.
6818         (Sized_input_reader::do_arg_serial): New function.
6819         (Sized_input_reader::do_get_unused_symbol_count): New function.
6820         (Sized_input_reader::do_get_unused_symbol): New function.
6821         (Sized_incremental_binary::do_input_file_count): New function.
6822         (Sized_incremental_binary::do_get_input_reader): Change signature;
6823         use index instead of filename.
6824         (Sized_incremental_binary::section_map_): New data member.
6825         (Sized_incremental_binary::input_entry_readers_): New data member.
6826         (class Sized_incr_relobj): New class.
6827         (class Sized_incr_dynobj): New class.
6828         (make_sized_incremental_object): New function.
6829         (class Incremental_library): New class.
6830         * layout.cc (Free_list::num_lists): New static data member.
6831         (Free_list::num_nodes): New static data member.
6832         (Free_list::num_removes): New static data member.
6833         (Free_list::num_remove_visits): New static data member.
6834         (Free_list::num_allocates): New static data member.
6835         (Free_list::num_allocate_visits): New static data member.
6836         (Free_list::init): New function.
6837         (Free_list::remove): New function.
6838         (Free_list::allocate): New function.
6839         (Free_list::dump): New function.
6840         (Free_list::print_stats): New function.
6841         (Layout_task_runner::run): Resize output file for incremental updates.
6842         (Layout::Layout): Initialize new data members.
6843         (Layout::set_incremental_base): New function.
6844         (Layout::init_fixed_output_section): New function.
6845         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6846         incremental updates.
6847         (Layout::create_gold_note): Do not create gold note section for
6848         incremental updates.
6849         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6850         for incremental updates.
6851         (Layout::set_section_offsets): For incremental updates, allocate space
6852         from free list.
6853         (Layout::create_symtab_sections): Layout with offsets relative to
6854         start of section; for incremental updates, allocate space from free
6855         list.
6856         (Layout::create_shdrs): For incremental updates, allocate space from
6857         free list.
6858         (Layout::finish_dynamic_section): For incremental updates, do not
6859         check --as-needed (fixed in subsequent patch).
6860         * layout.h (class Free_list): New class.
6861         (Layout::set_incremental_base): New function.
6862         (Layout::incremental_base): New function.
6863         (Layout::init_fixed_output_section): New function.
6864         (Layout::allocate): New function.
6865         (Layout::incremental_base_): New data member.
6866         (Layout::free_list_): New data member.
6867         * main.cc (main): Print Free_list statistics.
6868         * object.cc (Relobj::finalize_incremental_relocs): Add
6869         clear_counts parameter; clear counts only when clear_counts is set.
6870         (Sized_relobj::Sized_relobj): Initialize new base class.
6871         (Sized_relobj::do_layout): Don't report special sections.
6872         (Sized_relobj::do_for_all_local_got_entries): New function.
6873         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6874         symtab_off to all symbol table offsets.
6875         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6876         * object.h (class Got_offset_list): Move to top of file.
6877         (Object::Object): Allow case where input_file == NULL.
6878         (Object::~Object): Likewise.
6879         (Object::input_file): Assert that input_file != NULL.
6880         (Object::lock): Allow case where input_file == NULL.
6881         (Object::unlock): Likewise.
6882         (Object::is_locked): Likewise.
6883         (Object::token): Likewise.
6884         (Object::release): Likewise.
6885         (Object::is_incremental): New function.
6886         (Object::get_mtime): New function.
6887         (Object::for_all_local_got_entries): New function.
6888         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6889         (Object::set_is_in_system_directory): New function.
6890         (Object::is_in_system_directory): New function.
6891         (Object::do_is_incremental): New function.
6892         (Object::do_get_mtime): New function.
6893         (Object::do_for_all_local_got_entries): New function.
6894         (Object::is_in_system_directory_): New data member.
6895         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
6896         (class Sized_relobj_base): New class.
6897         (class Sized_relobj): Derive from Sized_relobj_base.
6898         (class Sized_relobj::Symbols): Redeclare from base class.
6899         (class Sized_relobj::local_got_offset_list): Remove.
6900         (class Sized_relobj::Output_sections): Redeclare from base class.
6901         (class Sized_relobj::do_for_all_local_got_entries): New function.
6902         (class Sized_relobj::write_local_symbols): Add offset parameter.
6903         (class Sized_relobj::local_symbol_offset_): Update comment.
6904         (class Sized_relobj::local_dynsym_offset_): Update comment.
6905         * options.cc (Input_arguments::add_file): Remove const.
6906         * options.h (Input_file_argument::Input_file_argument):
6907         Initialize arg_serial_ (all constructors).
6908         (Input_file_argument::set_arg_serial): New function.
6909         (Input_file_argument::arg_serial): New function.
6910         (Input_file_argument::arg_serial_): New data member.
6911         (Input_arguments::Input_arguments): Initialize file_count_.
6912         (Input_arguments::add_file): Remove const.
6913         (Input_arguments::number_of_input_files): New function.
6914         (Input_arguments::file_count_): New data member.
6915         (Command_line::number_of_input_files): Call
6916         Input_arguments::number_of_input_files.
6917         * output.cc (Output_segment_headers::Output_segment_headers):
6918         Set current size.
6919         (Output_section::Input_section::current_data_size): New function.
6920         (Output_section::Output_section): Initialize new data members.
6921         (Output_section::add_input_section): Don't do merge sections for
6922         an incremental link; allocate space from free list for an
6923         incremental update.
6924         (Output_section::add_output_section_data): Allocate space from
6925         free list for an incremental update.
6926         (Output_section::update_data_size): New function.
6927         (Output_section::set_fixed_layout): New function.
6928         (Output_section::reserve): New function.
6929         (Output_segment::set_section_addresses): Remove const.
6930         (Output_segment::set_section_list_addresses): Remove const; allocate
6931         space from free list for an incremental update.
6932         (Output_segment::set_offset): Adjust size of RELRO segment for an
6933         incremental update.
6934         * output.h (Output_data::current_data_size): Move here from
6935         child classes.
6936         (Output_data::pre_finalize_data_size): New function.
6937         (Output_data::update_data_size): New function.
6938         (Output_section_headers::update_data_size): new function.
6939         (Output_section_data_build::current_data_size): Move to Output_data.
6940         (Output_data_strtab::update_data_size): New function.
6941         (Output_section::current_data_size): Move to Output_data.
6942         (Output_section::set_fixed_layout): New function.
6943         (Output_section::has_fixed_layout): New function.
6944         (Output_section::reserve): New function.
6945         (Output_section::update_data_size): New function.
6946         (Output_section::has_fixed_layout_): New data member.
6947         (Output_section::free_list_): New data member.
6948         (Output_segment::set_section_addresses): Remove const.
6949         (Output_segment::set_section_list_addresses): Remove const.
6950         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
6951         New function.
6952         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
6953         New function.
6954         * readsyms.cc (Read_symbols::do_read_symbols): Add library
6955         parameter when calling Add_symbols constructor; store argument
6956         serial number for members of a lib group.
6957         (Add_symbols::locks): Allow case where token == NULL.
6958         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
6959         (Read_member::~Read_member): New function.
6960         (Read_member::is_runnable): New function.
6961         (Read_member::locks): New function.
6962         (Read_member::run): New function.
6963         (Check_script::~Check_script): New function.
6964         (Check_script::is_runnable): New function.
6965         (Check_script::locks): New function.
6966         (Check_script::run): New function.
6967         (Check_library::~Check_library): New function.
6968         (Check_library::is_runnable): New function.
6969         (Check_library::locks): New function.
6970         (Check_library::run): New function.
6971         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6972         (Add_symbols::library_): New data member.
6973         (class Read_member): New class.
6974         (class Check_script): New class.
6975         (class Check_library): New class.
6976         * reloc.cc (Read_relocs::is_runnable): Allow case where
6977         token == NULL.
6978         (Read_relocs::locks): Likewise.
6979         (Scan_relocs::locks): Likewise.
6980         (Relocate_task::locks): Likewise.
6981         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6982         to clear counters.
6983         (Sized_relobj::incremental_relocs_scan): Fix comment.
6984         (Sized_relobj::do_relocate): Pass output file offset to
6985         write_local_symbols.
6986         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6987         from class declaration.
6988         * script.cc (read_input_script): Allocate Script_info; pass
6989         argument serial number to report_script.
6990         * script.h (class Script_info): Move to incremental.h.
6991         * symtab.cc (Symbol_table::add_from_incrobj): New function.
6992         * symtab.h (Symbol_table::add_from_incrobj): New function.
6993         (Symbol_table::set_file_offset): New function.
6994
6995 2011-04-05  Cary Coutant  <ccoutant@google.com>
6996
6997         * incremental-dump.cc (dump_incremental_inputs): Change signature
6998         to take a Sized_incremental_binary; change caller.  Use readers
6999         in Sized_incremental_binary.
7000         * incremental.cc
7001         (Sized_incremental_binary::find_incremental_inputs_sections):
7002         Rename do_find_incremental_inputs_sections to this.
7003         (Sized_incremental_binary::setup_readers): New function.
7004         (Sized_incremental_binary::do_check_inputs): Check
7005         has_incremental_info_ flag; move setup code to setup_readers;
7006         use input readers.
7007         (Sized_incremental_binary::do_file_is_unchanged): New function.
7008         (Sized_incremental_binary::do_get_input_reader): New function.
7009         * incremental.h (class Incremental_binary): Move to end of file.
7010         (Incremental_binary::file_is_unchanged): New function.
7011         (Incremental_binary::do_file_is_unchanged): New function.
7012         (Incremental_binary::Input_reader): New class.
7013         (Incremental_binary::get_input_reader): New function.
7014         (class Sized_incremental_binary): Move to end of file.
7015         (Sized_incremental_binary::Sized_incremental_binary): Setup the
7016         input section reader classes.
7017         (Sized_incremental_binary::has_incremental_info): New function.
7018         (Sized_incremental_binary::inputs_reader): New function.
7019         (Sized_incremental_binary::symtab_reader): New function.
7020         (Sized_incremental_binary::relocs_reader): New function.
7021         (Sized_incremental_binary::got_plt_reader): New function.
7022         (Sized_incremental_binary::do_file_is_unchanged): New function.
7023         (Sized_incremental_binary::Sized_input_reader): New class.
7024         (Sized_incremental_binary::get_input_reader): New function.
7025         (Sized_incremental_binary::find_incremental_inputs_sections):
7026         Rename do_find_incremental_inputs_sections to this.
7027         (Sized_incremental_binary::setup_readers): New function.
7028         (Sized_incremental_binary::has_incremental_info_): New data member.
7029         (Sized_incremental_binary::inputs_reader_): New data member.
7030         (Sized_incremental_binary::symtab_reader_): New data member.
7031         (Sized_incremental_binary::relocs_reader_): New data member.
7032         (Sized_incremental_binary::got_plt_reader_): New data member.
7033         (Sized_incremental_binary::current_input_file_): New data member.
7034
7035 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
7036
7037         PR gold/12640
7038         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
7039         violation.
7040
7041 2011-03-30  Cary Coutant  <ccoutant@google.com>
7042
7043         * archive.cc (Archive::include_member): Adjust call to report_object.
7044         (Add_archive_symbols::run): Add script_info to call to
7045         report_archive_begin.
7046         (Lib_group::include_member): Adjust call to report_object.
7047         (Add_lib_group_symbols::run): Adjust call to report_object.
7048         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
7049         blocks.  Add object count for script input files.
7050         * incremental.cc (Incremental_inputs::report_archive_begin): Add
7051         script_info parameter; change all callers.
7052         (Incremental_inputs::report_object): Add script_info parameter;
7053         change all callers.
7054         (Incremental_inputs::report_script): Store backpointer to
7055         incremental info entry.
7056         (Output_section_incremental_inputs::set_final_data_size): Record
7057         additional information for scripts.
7058         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7059         * incremental.h (Incremental_script_entry::add_object): New function.
7060         (Incremental_script_entry::get_object_count): New function.
7061         (Incremental_script_entry::get_object): New function.
7062         (Incremental_script_entry::objects_): New data member; adjust
7063         constructor.
7064         (Incremental_inputs::report_archive_begin): Add script_info parameter.
7065         (Incremental_inputs::report_object): Add script_info parameter.
7066         (Incremental_inputs_reader::get_object_count): New function.
7067         (Incremental_inputs_reader::get_object_offset): New function.
7068         * options.cc (Input_arguments::add_file): Return reference to
7069         new input argument.
7070         * options.h (Input_argument::set_script_info): New function.
7071         (Input_argument::script_info): New function.
7072         (Input_argument::script_info_): New data member; adjust all
7073         constructors.
7074         (Input_file_group::add_file): Return reference to new input argument.
7075         (Input_file_lib::add_file): Likewise.
7076         (Input_arguments::add_file): Likewise.
7077         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
7078         * script.cc (Parser_closure::Parser_closure): Add script_info
7079         parameter; adjust all callers.
7080         (Parser_closure::script_info): New function.
7081         (Parser_closure::script_info_): New data member.
7082         (read_input_script): Report scripts earlier to incremental info.
7083         (script_add_file): Set script_info in Input_argument.
7084         (script_add_library): Likewise.
7085         * script.h (Script_options::Script_info): Rewrite class.
7086
7087 2011-03-29  Cary Coutant  <ccoutant@google.com>
7088
7089         * archive.cc (Library_base::should_include_member): Move
7090         method here from class Archive.
7091         (Archive::Archive): Initialize base class.
7092         (Archive::should_include_member): Move to base class.
7093         (Archive::do_for_all_unused_symbols): New function.
7094         (Add_archive_symbols::run): Remove redundant access to
7095         incremental_inputs.
7096         (Lib_group::Lib_group): Initialize base class.
7097         (Lib_group::do_filename): New function.
7098         (Lib_group::include_member): Pass pointer to Lib_group to
7099         report_object.
7100         (Lib_group::do_for_all_unused_symbols): New function.
7101         (Add_lib_group_symbols::run): Report archive information for
7102         incremental links.
7103         * archive.h (class Library_base): New base class.
7104         (class Archive): Derive from Library_base.
7105         (Archive::filename): Move to base class.
7106         (Archive::set_incremental_info): Likewise.
7107         (Archive::incremental_info): Likewise.
7108         (Archive::Should_include): Likewise.
7109         (Archive::should_include_member): Likewise.
7110         (Archive::Armap_entry): Remove.
7111         (Archive::Unused_symbol_iterator): Remove.
7112         (Archive::unused_symbols_begin): Remove.
7113         (Archive::unused_symbols_end): Remove.
7114         (Archive::do_filename): New function.
7115         (Archive::do_get_mtime): New function.
7116         (Archive::do_for_all_unused_symbols): New function.
7117         (Archive::task_): Move to base class.
7118         (Archive::incremental_info_): Likewise.
7119         (class Lib_group): Derive from Library_base.
7120         (Lib_group::do_filename): New function.
7121         (Lib_group::do_get_mtime): New function.
7122         (Lib_group::do_for_all_unused_symbols): New function.
7123         (Lib_group::task_): Move to base class.
7124         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
7125         function.
7126         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
7127         function.
7128         * incremental.cc (Incremental_inputs::report_archive_begin):
7129         Use Library_base; call library's get_mtime; add incremental inputs
7130         entry before members.
7131         (class Unused_symbol_visitor): New class.
7132         (Incremental_inputs::report_archive_end): Use Library_base; use
7133         visitor class to record unused symbols; don't add incremental inputs
7134         entry after members.
7135         (Incremental_inputs::report_object): Use Library_base.
7136         * incremental.h
7137         (Incremental_archive_entry::Incremental_archive_entry): Remove
7138         unused Archive parameter.
7139         (Incremental_inputs::report_archive_begin): Use Library_base.
7140         (Incremental_inputs::report_archive_end): Likewise.
7141         (Incremental_inputs::report_object): Likewise.
7142         * object.cc (Sized_relobj::do_for_all_global_symbols): New
7143         function.
7144         * object.h (Object::for_all_global_symbols): New function.
7145         (Object::do_for_all_global_symbols): New function.
7146         (Sized_relobj::do_for_all_global_symbols): New function.
7147         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
7148         function.
7149         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
7150         function.
7151
7152 2011-03-27  Ian Lance Taylor  <iant@google.com>
7153
7154         * archive.cc (Archive::interpret_header): Return -1 if something
7155         goes wrong.  Change callers accordingly.
7156
7157 2011-03-25  Cary Coutant  <ccoutant@google.com>
7158
7159         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
7160         * testsuite/Makefile.in: Regenerate.
7161
7162 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
7163
7164         * plugin.cc (get_view): New.
7165         (Plugin::load): Pass get_view to the plugin.
7166         (Plugin_manager::get_view): New.
7167
7168 2011-03-21  Ian Lance Taylor  <iant@google.com>
7169
7170         * testsuite/final_layout.sh: Rewrite to not use dc.
7171         * testsuite/relro_test.sh: Fail if dc is not present.
7172
7173 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
7174
7175         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
7176         Change == to -eq.
7177         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
7178         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
7179         Change == to -eq.
7180         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
7181         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
7182
7183 2011-03-14  Ian Lance Taylor  <iant@google.com>
7184
7185         * script-sections.cc (Sort_output_sections::script_compare):
7186         Rename from is_before, change return type.
7187         (Sort_output_sections::operator()): Adjust accordingly.
7188
7189 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
7190
7191         PR gold/12572
7192         * testsuite/odr_violation2.cc: Add comment to make all error line
7193         numbers double digits.
7194         * testsuite/debug_msg.sh: Adjust expected errors.
7195
7196 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
7197
7198         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
7199         but mark earlier ones as non-canonical
7200         (offset_to_iterator): Update search target and example
7201         (do_addr2line): Return extra lines in a vector*
7202         (format_file_lineno): Extract from do_addr2line
7203         (one_addr2line): Add vector* out-param
7204         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
7205         when a lineno entry appeared last for its instruction
7206         (Dwarf_line_info): Add vector* out-param
7207         * object.cc (Relocate_info): Pass NULL for the vector* out-param
7208         * symtab.cc (Odr_violation_compare): Include the lineno in the
7209         comparison again.
7210         (linenos_from_loc): New. Combine the canonical line for an
7211         address with its other lines.
7212         (True_if_intersect): New. Helper functor to make
7213         std::set_intersection a query.
7214         (detect_odr_violations): Compare sets of lines instead of just
7215         one line for each function. This became less deterministic, but
7216         has fewer false positives.
7217         * symtab.h: Declarations.
7218         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
7219         mix an optimized and non-optimized object in the same binary
7220         (odr_violation2.so): Same.
7221         * testsuite/Makefile.in: Regenerate from Makefile.am.
7222         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
7223         * testsuite/debug_msg.sh: Update line numbers and add
7224         assertions.
7225         * testsuite/odr_violation1.cc: Use OdrDerived, in a
7226         non-optimized context.
7227         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
7228         isn't inlined, and use OdrDerived in an optimized context.
7229         * testsuite/odr_header1.h: Defines OdrDerived, where
7230         optimization will change the
7231         first-instruction-in-the-destructor's file and line number.
7232         * testsuite/odr_header2.h: Defines OdrBase.
7233
7234 2011-03-09  Ian Lance Taylor  <iant@google.com>
7235
7236         * fileread.cc (File_read::clear_views): Don't delete the whole
7237         file view.
7238
7239 2011-03-08  Ian Lance Taylor  <iant@google.com>
7240
7241         PR gold/12525
7242         * fileread.cc: #include <climits>.
7243         (GOLD_IOV_MAX): Define.
7244         (File_read::read_multiple): Limit number of entries by iov_max.
7245         * fileread.h (class File_read): Always set max_readv_entries to
7246         128.
7247
7248 2011-03-07  Ian Lance Taylor  <iant@google.com>
7249
7250         PR gold/12525
7251         * options.h (class General_options): Add -dy and -dn.
7252
7253 2011-03-02  Cary Coutant  <ccoutant@google.com>
7254
7255         * testsuite/script_test_9.t: Add TLS segment.
7256
7257 2011-03-02  Simon Baldwin  <simonb@google.com>
7258
7259         * configure.ac: Add check for gnu_indirect_function support in
7260         the toolchain building binutils.
7261         * configure: Rebuild.
7262
7263 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
7264
7265         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
7266         plugin only symbols.
7267         (Symbol_table::sized_finalize_symbol) Mark symbol only present
7268         in plugin files as not needed in the symbol table.
7269
7270 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
7271
7272         * output.cc (Output_section::add_input_section): Delay fill
7273         generation for section ordering.
7274
7275 2011-02-09  Ian Lance Taylor  <iant@google.com>
7276
7277         PR gold/12316
7278         * object.h (class Sized_relobj): Remove clear_local_symbols.
7279         * reloc.cc (Sized_relobj::do_relocate): Don't call
7280         clear_local_symbols.
7281
7282 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
7283
7284         * plugin.cc (is_visible_from_outside): Return true for symbols
7285         in the -u option.
7286
7287 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
7288
7289         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
7290         filename.
7291
7292 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
7293
7294         * icf.h (is_section_foldable_candidate): Change type of parameter
7295         to std::string.
7296         * icf.cc (Icf::find_identical_sections): Change type of local variable
7297         section_name to be std::string.
7298         (is_function_ctor_or_dtor): Change type of parameter to std::string.
7299
7300 2011-01-25  Ian Lance Taylor  <iant@google.com>
7301
7302         * script.cc (script_add_extern): Rewrite to use
7303         add_symbol_reference.
7304
7305 2011-01-25  Doug Kwan  <dougkwan@google.com>
7306
7307         * icf.cc (get_section_contents): Always lock section's object.
7308
7309 2011-01-24  Ian Lance Taylor  <iant@google.com>
7310
7311         * options.h (class General_options): Accept
7312         --no-detect-odr-violations.
7313
7314 2011-01-24  Ian Lance Taylor  <iant@google.com>
7315
7316         * version.cc (version_string): Bump to 1.11.
7317
7318 2011-01-24  Ian Lance Taylor  <iant@google.com>
7319
7320         * plugin.cc (class Plugin_rescan): Define new class.
7321         (Plugin_manager::claim_file): Set any_claimed_.
7322         (Plugin_manager::save_archive): New function.
7323         (Plugin_manager::save_input_group): New function.
7324         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
7325         necessary.
7326         (Plugin_manager::new_undefined_symbol): New function.
7327         (Plugin_manager::rescan): New function.
7328         (Plugin_manager::rescannable_defines): New function.
7329         (Plugin_manager::add_input_file): Set any_added_.
7330         * plugin.h (class Plugin_manager): define new fields rescannable_,
7331         undefined_symbols_, any_claimed_, and any_added_.  Declare
7332         Plugin_rescan as friend.  Declare new functions.
7333         (Plugin_manager::Rescannable): Define type.
7334         (Plugin_manager::Rescannable_list): Define type.
7335         (Plugin_manager::Undefined_symbol_list): Define type.
7336         (Plugin_manager::Plugin_manager): Initialize new fields.
7337         * archive.cc (Archive::defines_symbol): New function.
7338         (Add_archive_symbols::run): Pass archive to plugins if any.
7339         * archive.h (class Archive): Declare defines_symbol.
7340         * readsyms.cc (Input_group::~Input_group): New function.
7341         (Finish_group::run): Pass input_group to plugins if any.
7342         * readsyms.h (class Input_group): Declare destructor.
7343         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
7344         any.
7345
7346 2011-01-10  Ian Lance Taylor  <iant@google.com>
7347
7348         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
7349         section as relro.
7350         (Layout::set_segment_offsets): Reset increase_relro before calling
7351         set_section_addresses a second time.
7352
7353 2011-01-04  Cary Coutant  <ccoutant@google.com>
7354
7355         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
7356         sections before NOBITS sections.
7357
7358 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
7359
7360         * version.cc (print_version): Update copyright to 2011.
7361
7362 2010-12-23  Cary Coutant  <ccoutant@google.com>
7363
7364         * output.h (Output_data_reloc::add_output_section): Pass OD instead
7365         of OS to this->add.  Add OD parameter to second form of the function.
7366
7367 2010-12-20  Ian Lance Taylor  <iant@google.com>
7368
7369         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
7370         second of two consecutive entries with same offset.
7371
7372 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7373
7374         * testsuite/Makefile.am (ifuncmain2static_LDADD)
7375         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
7376         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
7377         to avoid unneeded links against $(LDADD).
7378         * testsuite/Makefile.in: Regenerate.
7379
7380 2010-12-15  Ian Lance Taylor  <iant@google.com>
7381
7382         PR gold/12324
7383         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
7384         for R_X86_64_32 and R_X86_64_PC32.
7385         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
7386         ver_matching_def_pic.o.
7387         (ver_matching_def_pic.o): New target.
7388
7389 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7390
7391         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
7392         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
7393         Move definition before File_read::View member definitions.
7394         (File_read::View::~View): Initialize and hold lock before
7395         updating current_mapped_bytes.
7396
7397 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7398
7399         * dwarf_reader.cc: Remove outdated comment.
7400         * gold-threads.cc: Fix typo in error message.
7401         * archive.cc: Fix typos in comments.
7402         * archive.h: Likewise.
7403         * arm-reloc-property.cc: Likewise.
7404         * arm-reloc-property.h: Likewise.
7405         * arm-reloc.def: Likewise.
7406         * arm.cc: Likewise.
7407         * attributes.h: Likewise.
7408         * cref.cc: Likewise.
7409         * ehframe.cc: Likewise.
7410         * fileread.h: Likewise.
7411         * gold.h: Likewise.
7412         * i386.cc: Likewise.
7413         * icf.cc: Likewise.
7414         * incremental.h: Likewise.
7415         * int_encoding.cc: Likewise.
7416         * layout.h: Likewise.
7417         * main.cc: Likewise.
7418         * merge.h: Likewise.
7419         * object.cc: Likewise.
7420         * object.h: Likewise.
7421         * options.cc: Likewise.
7422         * readsyms.cc: Likewise.
7423         * reduced_debug_output.cc: Likewise.
7424         * reloc.cc: Likewise.
7425         * script-sections.cc: Likewise.
7426         * sparc.cc: Likewise.
7427         * symtab.h: Likewise.
7428         * target-reloc.h: Likewise.
7429         * target.cc: Likewise.
7430         * target.h: Likewise.
7431         * timer.cc: Likewise.
7432         * timer.h: Likewise.
7433         * x86_64.cc: Likewise.
7434
7435 2010-12-09  Cary Coutant  <ccoutant@google.com>
7436
7437         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
7438         stack.
7439         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
7440         parameter; change all callers.
7441         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
7442         * options.h (warn_execstack): New option.
7443
7444 2010-12-07  Doug Kwan  <dougkwan@google.com>
7445
7446         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
7447         like function call relocations.
7448
7449 2010-12-07  Ian Lance Taylor  <iant@google.com>
7450
7451         * archive.cc (Archive::get_elf_object_for_member): Permit
7452         punconfigured to be NULL.
7453         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
7454         (Archive::include_member): Pass NULL to get_elf_object_for_member
7455         if we searched for the archive and this is the first included
7456         object.
7457
7458 2010-12-01  Ian Lance Taylor  <iant@google.com>
7459
7460         * dwarf_reader.h (class Sized_dwarf_line_info): Add
7461         track_relocs_type_ field.
7462         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7463         Set track_relocs_type_.
7464         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
7465         contents when using RELA relocs.
7466         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
7467         reloc_map_.
7468         * reloc.cc (Track_relocs::next_addend): New function.
7469         * reloc.h (class Track_relocs): Declare next_addend.
7470
7471 2010-12-01  Ian Lance Taylor  <iant@google.com>
7472
7473         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
7474         virtual destructor.
7475
7476 2010-12-01  Ian Lance Taylor  <iant@google.com>
7477
7478         * README: Update compilers known to work and fail.
7479
7480 2010-11-23  Matthias Klose  <doko@ubuntu.com>
7481
7482         * configure.in: For --enable-gold, handle value `default' instead of
7483         `both*'.  Always install ld as ld.bfd, install as ld if gold is
7484         not the default.
7485         * configure: Regenerate.
7486
7487 2010-11-18  Doug Kwan  <dougkwan@google.com>
7488
7489         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
7490         and right_alignment to be zero.  Store result alignment only if it is
7491         greater than existing alignment.
7492
7493 2010-11-16  Cary Coutant  <ccoutant@google.com>
7494
7495         PR gold/12220
7496         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7497         Check for ".zdebug_line".
7498
7499 2010-11-16  Doug Kwan  <dougkwan@google.com>
7500             Cary Coutant  <ccoutant@google.com>
7501
7502         * output.h (Output_segment::set_section_addresses): Pass increase_relro
7503         by reference; adjust all callers.
7504         * output.cc (Output_segment::set_section_addresses): Adjust references
7505         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
7506         list is empty.
7507         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
7508         end at page boundary.
7509
7510 2010-11-16  Cary Coutant  <ccoutant@google.com>
7511
7512         PR gold/12220
7513         * layout.cc (Layout::choose_output_section): Transform names of
7514         compressed sections even when using a script with a SECTIONS clause.
7515         (Layout::output_section_name): Remove code to transform
7516         compressed debug section names.
7517         * output.cc (Output_section::add_input_section): Use uncompressed
7518         section size when tracking input sections.
7519
7520 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
7521
7522         * symtab.h (Symbol::NON_PIC_REF): Remove.
7523         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
7524         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
7525         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
7526         (Symbol::use_plt_offset): Take a flags argument and pass it
7527         directly to needs_dynamic_reloc.  Restrict check for undefined
7528         weak symbols to function calls.
7529         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
7530         (Target_arm::Scan::global): Use it.
7531         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
7532         (Target_arm::Relocate::relocate): Likewise.
7533         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
7534         parameter with an r_type parameter.  Use get_reference_flags
7535         to get the flags.
7536         (Target_arm::Relocate::relocate): Update accordingly.
7537         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
7538         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
7539         (Target_i386::Scan::global): Likewise.
7540         (Target_i386::Relocate::relocate): Likewise.
7541         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
7542         parameter with an r_type parameter.  Use get_reference_flags
7543         to get the flags.
7544         (Target_i386::Relocate::relocate): Update accordingly.
7545         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
7546         (Target_powerpc::Scan::global): Use it.
7547         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
7548         (Target_powerpc::Relocate::relocate): Likewise.
7549         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
7550         (Target_sparc::Scan::global): Use it.
7551         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
7552         (Target_sparc::Relocate::relocate): Likewise.
7553         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
7554         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
7555         (Target_x86_64::Scan::global): Likewise.
7556         (Target_x86_64::Relocate::relocate): Likewise.
7557
7558 2010-11-08  Doug Kwan  <dougkwan@google.com>
7559             Cary Coutant  <ccoutant@google.com>
7560
7561         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
7562         (Arm_exidx_merge_section::section_contents_): New data member.
7563         (Arm_input_section::Arm_input_section): Initialize original_contents_.
7564         (Arm_input_section::~Arm_input_section): De-allocate memory.
7565         (Arm_input_section::original_contents_): New data member.
7566         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
7567         in parameters instead of calling Object::section_contents without
7568         locking.
7569         (Arm_output_section::group_section): New parameter TASK.  Pass it
7570         to callees that need locking objects.
7571         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
7572         to lock EXIDX input sections.  Fix a formatting issue.  Call
7573         Arm_exidx_merged_section::build_contents to create merged section
7574         contents.
7575         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
7576         to lock object of stub table owner.
7577         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
7578         TEXT_SIZE to initialize data member TEXT_SIZE_.
7579         (Arm_exidx_input_section::addralign): Fix typo in comment.
7580         (Arm_exidx_input_section::text_size): New method.
7581         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
7582         that require locking objects.  Lock objects before scanning for stubs
7583         and updating local symbols.
7584         (Arm_input_section<big_endian>::init): Copy contents of original
7585         input section.
7586         (Arm_input_section<big_endian>::do_write): Use saved contents of
7587         original input section instead of calling Object::section_contents
7588         without locking.
7589         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
7590         size without calling Object::section_size().
7591         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
7592         for size.  Allocate a buffer for merged EXIDX entries.
7593         (Arm_exidx_merged_section::build_contents): New method.
7594         (Arm_exidx_merged_section::do_write): Move merge section contents
7595         building code to Arm_exidx_merged_section::build_contetns.  Write
7596         out contetns in buffer instead of building it on the fly.
7597         (Arm_relobj::make_exidx_input_section): Also pass text section size
7598         to Arm_exidx_input_section constructor.
7599         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
7600         (Arm_dynobj::do_read_symbols): Fix memory leak.
7601         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
7602         * target.h: (class Task): Add forward declaration.
7603         (Target::relax): Add new parameter TASK and pass it to
7604         Target::do_relax().
7605         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
7606
7607 2010-11-05  Cary Coutant  <ccoutant@google.com>
7608
7609         PR gold/10708
7610         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
7611         object when reading from the file.
7612         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
7613         second layout pass.
7614         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
7615         when reading section contents.
7616         (get_section_contents): Likewise.
7617         (icf::find_identical_sections): Likewise.
7618         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
7619         object when reading from the file.
7620         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
7621         the object when doing deferred section layout.
7622
7623 2010-11-03  Nick Clifton  <nickc@redhat.com>
7624
7625         PR gold/12001
7626         * script.h (class Symbol_assignment: name): New member.  Returns
7627         the name of the symbol.
7628         * scrfipt.cc (Script_options::is_pending_assignment): New member.
7629         Returns true if the given symbol name is on the list of
7630         assignments wating to be processed.
7631         * archive.cc (should_incldue_member): If the symbol is undefined,
7632         check to see if it is on the list of symbols pending assignment.
7633
7634 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
7635
7636         * script-sections.cc (Script_sections::find_memory_region): Check
7637         for a NULL output section pointer.
7638
7639 2010-10-29  Doug Kwan  <dougkwan@google.com>
7640
7641         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
7642         Output_section::add_relaxed_input_section.
7643         * output.cc (Output_section::add_relaxed_input_section): Add new
7644         arguments LAYOUT and NAME.  Set section order index.
7645         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7646         Copy section order index.
7647         * output.h (Output_section::add_relaxed_input_section): Add new
7648         arguments LAYOUT and NAME.
7649
7650 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7651
7652         * testsuite/Makefile.am: Move gcctestdir/ld rule to
7653         NATIVE_OR_CROSS_LINKER.
7654         * testsuite/Makefile.in: Regenerate.
7655
7656 2010-10-20  Doug Kwan  <dougkwan@google.com>
7657
7658         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
7659         without SHF_LINK_ORDER flags.
7660         * layout.cc (Layout::choose_output_section): Do not filter
7661         SHF_LINK_ORDER flag in a relocatable link.
7662
7663 2010-10-17  Cary Coutant  <ccoutant@google.com>
7664
7665         * output.h (Output_segment::set_section_addresses): Change function
7666         signature.  Update all callers.
7667         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
7668         sections.
7669         (Output_segment::set_section_addresses): Align after last TLS
7670         section.  Add padding before last relro section instead of after.
7671
7672 2010-10-17  Doug Kwan  <dougkwan@google.com>
7673
7674         * gold/arm.cc (Target_arm::got_section): Use correct order and set
7675         GOT output section to be writable.
7676
7677 2010-10-14  Cary Coutant  <ccoutant@google.com>
7678
7679         * debug.h (DEBUG_INCREMENTAL): New flag.
7680         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
7681         * gold.cc (queue_initial_tasks): Check parameters for incremental link
7682         mode.
7683         * incremental.cc (report_command_line): Ignore all forms of
7684         --incremental.
7685         * layout.cc (Layout::Layout): Check parameters for incremental link
7686         mode.
7687         * options.cc (General_options::parse_incremental): New function.
7688         (General_options::parse_no_incremental): New function.
7689         (General_options::parse_incremental_full): New function.
7690         (General_options::parse_incremental_update): New function.
7691         (General_options::incremental_mode_): New data member.
7692         (General_options::finalize): Check incremental_mode_.
7693         * options.h (General_options): Update help text for --incremental.
7694         Add --no-incremental, --incremental-full, --incremental-update.
7695         (General_options::Incremental_mode): New enum type.
7696         (General_options::incremental_mode): New function.
7697         (General_options::incremental_mode_): New data member.
7698         * parameters.cc (Parameters::incremental_mode_): New data member.
7699         (Parameters::set_options): Set incremental_mode_.
7700         (Parameters::set_incremental_full): New function.
7701         (Parameters::incremental): New function.
7702         (Parameters::incremental_update): New function.
7703         (set_parameters_incremental_full): New function.
7704         * parameters.h (Parameters::set_incremental_full): New function.
7705         (Parameters::incremental): New function.
7706         (Parameters::incremental_update): New function.
7707         (Parameters::incremental_mode_): New data member.
7708         (set_parameters_incremental_full): New function.
7709         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
7710         incremental link mode.
7711         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
7712         (Sized_relobj::do_relocate_sections): Likewise.
7713         * testsuite/Makefile.am (incremental_test): Use --incremental-full
7714         option.
7715         * testsuite/Makefile.in: Regenerate.
7716         * testsuite/incremental_test.sh: Filter all forms of --incremental.
7717
7718 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7719
7720         * script-sections.h (class Script_sections): Make
7721         Sections_elements typedef public.
7722         * script-sections.cc (class Sort_output_sections): Add elements_
7723         field.  Add constructor which sets it; change all callers.
7724         (Sort_output_sections::is_before): New function.
7725         (Sort_output_sections::operator()): Call is_before.
7726         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
7727         conditional.
7728         * testsuite/script_test_10.sh: New test. Test script section
7729         order.
7730         * testsuite/script_test_10.t: Likewise.
7731         * testsuite/script_test_10.s: Likewise.
7732         * testsuite/Makefile.am: Wrap the cross linker tests and the
7733         common tests into NATIVE_OR_CROSS_LINKER.
7734         (check_SCRIPTS): Add script_test_10.sh.
7735         (check_DATA): Add script_test_10.stdout.
7736         (script_test_10.o, script_test_10): New targets.
7737         (script_test_10.stdout): New target.
7738         * configure, testsuite/Makefile.in: Regenerate.
7739
7740 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7741
7742         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
7743         error for the deprecated relocations.
7744         (Target_arm::Scan::global): Likewise.
7745         (Target_arm::Relocate::relocate): Likewise.
7746
7747 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
7748
7749         * fileread.cc (Input_file::find_file): Initialize *found_name
7750         and *namep when using the fallback search for case 4.
7751
7752 2010-10-11  Cary Coutant  <ccoutant@google.com>
7753
7754         * options.h (class General_options): Redefine -z lazy as an alias for
7755         the negation of -z now.
7756
7757 2010-10-11  Ian Lance Taylor  <iant@google.com>
7758
7759         * resolve.cc (symbol_to_bits): Report the value of the unsupported
7760         binding.
7761
7762 2010-10-06  Nick Clifton  <nickc@redhat.com>
7763
7764         * script-sections.cc(class Memory_region): Remove
7765         current_lma_offset_ field.  Rename current_vma_offset_ to
7766         current_offset_.  Add last_section_ field.
7767         (Memory_region::get_current_vma_address): Rename to
7768         get_current_address.
7769         (Memory_region::get_current_lma_address): Delete.
7770         (Memory_region::increment_vma_offset): Rename to
7771         increment_offset.
7772         (Memory_region::increment_lma_offset): Delete.
7773         (Memory_region::attributes_compatible): New method.  Returns
7774         true if the provided section is compatible with the region.
7775         (Memory_region::get_last_section): New method.  Returns the last
7776         section to use the region.
7777         (Memory_region::set_last_section): New method.  Stores the last
7778         section to use the region.
7779         (Script_sections::block_in_region): New method.  Returns true if
7780         a block of memory is contained within a region.
7781         (Script_sections::find_memory_region): New method.  Locates a
7782         memory region to be used to set a VMA or LMA address.
7783         (Output_section_definition::set_section_addresses): Add code to
7784         check for addresses set by memory regions.
7785         (Output_segment::set_section_addresses): Remove memory region
7786         walking code.
7787         (Script_sections::create_segment): Add a warning if a header
7788         segment is created outside of any region.
7789         * script-sections.h (class Script_sections): Add prototypes for
7790         find_memory_region and block_in_region methods.
7791         * testsuite/memory_test.s: Use .long instead of .word.
7792         * testsuite/memory_test.t: Add some more output sections.
7793         * testsuite/memory_test.sh: Update expected output.
7794
7795 2010-10-02  Doug Kwan  <dougkwan@google.com>
7796
7797         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
7798         defintion to symtab.h
7799         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
7800         declaration to defintion.
7801
7802 2010-10-01  Nick Clifton  <nickc@redhat.com>
7803
7804         * expression.cc (eval): Replace dummy argument with NULL.
7805         (eval_maybe_dot): Check for a NULL result section pointer.
7806         (Symbol_expression::value): Likewise.
7807         (Dot_expression::value): Likewise.
7808         (BINARY_EXPRESSION): Likewise.
7809         (Max_expression::value): Likewise.
7810         (Min_expression::value): Likewise.
7811         (Absolute_expression::value): Likewise.
7812         (Addr_expression::value_from_output_section): Likewise.
7813         (Loaddddr_expression::value_from_output_section): Likewise.
7814         (Segment_start_expression::value): Likewise.
7815         * script-sections.cc
7816         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
7817         argument with NULL.
7818         (Sections_elememt_dot_assignment::set_section_addresses):
7819         Likewise.
7820         (Output_data_expression::do_write_to_buffer): Likewise.
7821         (Output_section_definition::finalize_symbols): Likewise.
7822         (Output_section_definition::set_section_addresses): Likewise.
7823
7824 2010-09-30  Doug Kwan  <dougkwan@google.com>
7825
7826         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
7827
7828 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
7829
7830         * target.h (Target::can_icf_inline_merge_sections): New virtual
7831         function.
7832         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7833         virtual function.
7834         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
7835         virtual function.
7836         * icf.cc (get_section_contents): Inline merge sections only when
7837         target allows it.
7838
7839 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7840
7841         * configure: Regenerate.
7842
7843 2010-09-17  Ian Lance Taylor  <iant@google.com>
7844
7845         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7846         * testsuite/Makefile.am (memory_test.o): New target.
7847         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7848         memory_test.t.
7849         * testsuite/Makefile.in: Rebuild.
7850
7851 2010-09-17  Doug Kwan  <dougkwan@google.com>
7852
7853         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7854         defintion if relocation uses GOT entries of the symbol.
7855         * testsuite/icf_safe_test.sh: Fix test.
7856         * testsuite/icf_safe_so_test.sh: Fix test.
7857
7858 2010-09-16  Cary Coutant  <ccoutant@google.com>
7859
7860         * script_sections.cc (class Memory_region): Remove "NULL" from
7861         vector initializations.
7862
7863 2010-09-15  Cary Coutant  <ccoutant@google.com>
7864
7865         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7866         Resolve forwarding symbols.
7867
7868 2010-09-15  Doug Kwan  <dougkwan@google.com>
7869
7870         * gold/testsuite/script_test_3.t: Add ARM special sections.
7871         * gold/testsuite/script_test_4.t: Same.
7872         * gold/testsuite/script_test_5.t: Same.
7873         * gold/testsuite/script_test_6.t: Same.
7874         * gold/testsuite/script_test_7.t: Same.
7875         * gold/testsuite/script_test_7.t: Same.
7876         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7877
7878 2010-09-14  Cary Coutant  <ccoutant@google.com>
7879
7880         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7881         (Target_x86_64::Relocate::relocate_tls): Replace check for
7882         saw_tls_block_reloc_ with test for executable section.
7883
7884 2010-09-12  Cary Coutant  <ccoutant@google.com>
7885
7886         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7887         position-independent executables to shared libraries need dynamic
7888         relocations.
7889         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
7890         position-independent executables.
7891         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
7892         * testsuite/Makefile.in: Regenerate.
7893
7894 2010-09-10  Nick Clifton  <nickc@redhat.com>
7895
7896         PR gold/11997
7897         * testsuite/memory_test.t: Discard any sections that are not
7898         needed.
7899
7900 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
7901
7902         PR gold/11996
7903         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
7904         "This::" to work around a bug in gcc 4.2.
7905
7906         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
7907
7908 2010-09-09  Rafael Espindola  <espindola@google.com>
7909
7910         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
7911         sections with different PF_X flags in the same segment.
7912         (Layout::find_first_load_seg): Search all segments to find the first
7913         one.
7914         * options.h (rosegment): New.
7915
7916 2010-09-08  Rafael Espindola  <espindola@google.com>
7917
7918         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
7919
7920 2010-09-08  Doug Kwan  <dougkwan@google.com>
7921
7922         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
7923         (Arm_relobj::do_relocate_sections): Add new parameter for output
7924         file to match the parent.
7925         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
7926         of local symbols instead of input values.  Update code to track
7927         changes in gold::relocate_section.
7928         * object.cc (Sized_relobj::compute_final_local_value): New methods.
7929         (Sized_relobj::compute_final_local_value_internal): New methods.
7930         (Sized_relobj::do_finalize_local_symbols): Move code from loop
7931         body into private version of Sized_relobj::compute_final_local_value.
7932         Call the inline method.
7933         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
7934         merged symbol value if there is one.
7935         (Symbol_value::has_output_value): New method defintiion.
7936         (Sized_relobj::Compute_final_local_value_status): New enum type.
7937         (Sized_relobj::compute_final_local_value): New methods.
7938         (Sized_relobj::compute_final_local_value_internal): New methods.
7939         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
7940         and arm_cortex_a8.sh.
7941         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
7942         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
7943         New tests.
7944         * Makefile.in: Regenerate.
7945         * testsuite/arm_bl_out_of_range.s: Update test.
7946         * testsuite/thumb_bl_out_of_range.s: Ditto.
7947         * testsuite/thumb_blx_out_of_range.s: Ditto.
7948         * testsuite/arm_branch_out_of_range.sh: New file.
7949         * testsuite/arm_cortex_a8.sh: Ditto.
7950         * testsuite/arm_cortex_a8_b.s: Ditto.
7951         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
7952         * testsuite/arm_cortex_a8_b_local.s: Ditto.
7953         * testsuite/arm_cortex_a8_bl.s: Ditto.
7954         * testsuite/arm_cortex_a8_blx.s: Ditto.
7955         * testsuite/arm_cortex_a8_local.s: Ditto.
7956         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
7957         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
7958
7959 2010-09-08  Rafael Espindola  <espindola@google.com>
7960
7961         * Makefile.am (memory_test.stdout): Run readelf with -W.
7962         * Makefile.in: Regenerate.
7963         * testsuite/memory_test.sh: Make the regexps accept both 32 and
7964         64 bit output.
7965
7966 2010-09-08  Rafael Espindola  <espindola@google.com>
7967
7968         * script-sections.cc (Script_sections::add_memory_region): Convert
7969         field precision to int.
7970         * script.cc (script_set_section_region, script_set_section_region):
7971         Convert field precision to int.
7972
7973 2010-09-08  Rafael Espindola  <espindola@google.com>
7974
7975         * arm.cc (do_finalize_sections): Create the __exidx_start and
7976         __exdix_end symbols even when the section is missing.
7977
7978 2010-09-08  Nick Clifton  <nickc@redhat.com>
7979
7980         * README: Remove claim that MEMORY is not supported.
7981         * expression.cc (script_exp_function_origin)
7982         (script_exp_function_length): Move from here to ...
7983         * script.cc: ... here.
7984         (script_set_section_region, script_add_memory)
7985         (script_parse_memory_attr, script_include_directive): New
7986         functions.
7987         * script-sections.cc
7988         (class Memory_region): New class.
7989         (class Output_section_definition): Add set_memory_region,
7990         set_section_vma, set_section_lma and get_section_name methods.
7991         (class Script_Sections): Add add_memory_region,
7992         find_memory_region, find_memory_region_origin,
7993         find_memory_region_length and set_memory_region methods.
7994         Have set_section_addresses method walk the list of set memory
7995         regions.
7996         Extend the print methos to display memory regions.
7997         * script-sections.h: Add prototypes for new methods.
7998         Add enum for MEMORY region attributes.
7999         * yyscript.y: Add support for parsing MEMORY regions.
8000         * script-c.h: Add prototypes for new functions.
8001         * testsuite/Makefile.am: Add test of MEMORY region functionality.
8002         * testsuite/Makefile.in: Regenerate.
8003         * testsuite/memory_test.sh: New script.
8004         * testsuite/memory_test.s: New assembler source file.
8005         * testsuite/memory_test.t: New linker script.
8006
8007 2010-08-27  Doug Kwan  <dougkwan@google.com>
8008
8009         * gold/resolve.cc (Symbol_table::should_override): Let a weak
8010         reference override an existing dynamic weak reference.
8011         * testsuite/Makefile.am: Add new test dyn_weak_ref.
8012         * testsuite/Makefile.in: Regenerate.
8013         * testsuite/dyn_weak_ref.sh: New file.
8014         * testsuite/dyn_weak_ref_1.c: Ditto.
8015         * testsuite/dyn_weak_ref_2.c: Ditto.
8016
8017 2010-08-27  Ian Lance Taylor  <iant@google.com>
8018
8019         * incremental.h (class Incremental_input_entry): Add virtual
8020         destructor.
8021
8022 2010-08-27  Ian Lance Taylor  <iant@google.com>
8023
8024         * testsuite/start_lib_test_3.c: Mark t3 as used.
8025
8026 2010-08-27  Nick Clifton  <nickc@redhat.com>
8027
8028         * options.cc (version_script): Fix small typo in previous
8029         whitespace tidyup.
8030
8031 2010-08-25  Nick Clifton  <nickc@redhat.com>
8032
8033         * archive.cc: Formatting fixes: Remove whitespace between
8034         typename and following asterisk.  Remove whitespace between
8035         function name and opening parenthesis.
8036         * archive.h: Likewise.
8037         * arm.cc: Likewise.
8038         * attributes.cc: Likewise.
8039         * attributes.h: Likewise.
8040         * common.cc: Likewise.
8041         * copy-relocs.cc: Likewise.
8042         * dirsearch.h: Likewise.
8043         * dynobj.cc: Likewise.
8044         * ehframe.cc: Likewise.
8045         * ehframe.h: Likewise.
8046         * expression.cc: Likewise.
8047         * fileread.cc: Likewise.
8048         * fileread.h: Likewise.
8049         * gc.h: Likewise.
8050         * gold-threads.cc: Likewise.
8051         * gold.cc: Likewise.
8052         * i386.cc: Likewise.
8053         * icf.h: Likewise.
8054         * incremental-dump.cc: Likewise.
8055         * incremental.cc: Likewise.
8056         * layout.cc: Likewise.
8057         * layout.h: Likewise.
8058         * main.cc: Likewise.
8059         * merge.cc: Likewise.
8060         * merge.h: Likewise.
8061         * object.cc: Likewise.
8062         * object.h: Likewise.
8063         * options.cc: Likewise.
8064         * options.h: Likewise.
8065         * output.cc: Likewise.
8066         * output.h: Likewise.
8067         * plugin.cc: Likewise.
8068         * plugin.h: Likewise.
8069         * powerpc.cc: Likewise.
8070         * reloc.cc: Likewise.
8071         * script-c.h: Likewise.
8072         * script-sections.cc: Likewise.
8073         * script.cc: Likewise.
8074         * stringpool.cc: Likewise.
8075         * symtab.cc: Likewise.
8076         * symtab.h: Likewise.
8077         * target.cc: Likewise.
8078         * timer.cc: Likewise.
8079         * timer.h: Likewise.
8080         * version.cc: Likewise.
8081         * x86_64.cc: Likewise.
8082
8083 2010-08-24  Nick Clifton  <nickc@redhat.com>
8084
8085         PR 11899
8086         * layout.cc (segment_precedes): Sort segments by their physical
8087         addresses, if they have been set.
8088
8089 2010-08-23  Cary Coutant  <ccoutant@google.com>
8090
8091         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
8092         symbols data.
8093         (Lib_group::include_member): Unlock object after deleting its
8094         symbols data.
8095         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
8096         the bug fixed here.
8097
8098 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
8099             Cary Coutant  <ccoutant@google.com>
8100
8101         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
8102         constructor, and set_blocker.
8103         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
8104         readsyms_blocker_.
8105         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
8106         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
8107         * testsuite/Makefile.am (start_lib_test): New test case.
8108         * testsuite/Makefile.in: Regenerate.
8109         * testsuite/start_lib_test_main.c: New file.
8110         * testsuite/start_lib_test_1.c: New file.
8111         * testsuite/start_lib_test_2.c: New file.
8112         * testsuite/start_lib_test_3.c: New file.
8113
8114 2010-08-19  Ian Lance Taylor  <iant@google.com>
8115
8116         * Makefile.in: Rebuild with automake 1.11.1.
8117         * aclocal.m4: Likewise.
8118         * testsuite/Makefile.in: Likewise.
8119
8120 2010-08-19  Ian Lance Taylor  <iant@google.com>
8121
8122         PR 10893
8123         * i386.cc (class Output_data_plt_i386): Update declarations.
8124         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
8125         local_ifuncs_ fields.
8126         (Target_i386::do_plt_section_for_global): New function.
8127         (Target_i386::do_plt_section_for_local): New function.
8128         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
8129         parameter; change all callers.  Initialize global_ifuncs_ and
8130         local_ifuncs_.  If doing a static link define __rel_iplt_start and
8131         __rel_iplt_end.
8132         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
8133         (Output_data_plt_i386::add_local_ifunc_entry): New function.
8134         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
8135         symbols.
8136         (Target_i386::make_plt_section): New function, broken out of
8137         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
8138         (Target_i386::make_plt_entry): Call make_plt_section.
8139         (Target_i386::make_local_ifunc_plt_entry): New function.
8140         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
8141         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
8142         R_386_IRELATIVE to switch.
8143         (Target_i386::Scan::global): Likewise.
8144         (Target_i386::Relocate::relocate): Likewise.
8145         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
8146         switch.
8147         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
8148         (Target_x86_64::do_plt_section_for_global): New function.
8149         (Target_x86_64::do_plt_section_for_local): New function.
8150         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
8151         parameter; change all callers.  If doing a static link define
8152         __rela_iplt_start and __rela_iplt_end.
8153         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
8154         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
8155         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
8156         to point to .plt.
8157         (Target_x86_64::make_local_ifunc_plt_entry): New function.
8158         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
8159         switch.
8160         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
8161         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
8162         R_X86_64_IRELATIVE to switch.
8163         (Target_x86_64::Scan::global): Likewise.
8164         (Target_x86_64::Relocate::relocate): Likewise.
8165         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
8166         switch.
8167         * target.h (class Target): Add plt_section_for_global and
8168         plt_section_for_local functions.  Add do_plt_section_for_global
8169         and do_plt_section_for_local virtual functions.
8170         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
8171         clarifying comments.
8172         (Symbol::use_plt_offset): Handle IFUNC symbol.
8173         * object.cc (Sized_relobj::Sized_relobj): Initialize
8174         local_plt_offsets_.
8175         (Sized_relobj::local_has_plt_offset): New function.
8176         (Sized_relobj::local_plt_offset): New function.
8177         (Sized_relobj::set_local_plt_offset): New function.
8178         (Sized_relobj::do_count): Handle IFUNC symbol.
8179         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
8180         a bit away from input_shndx_ field.  Add set_is_func_symbol and
8181         is_ifunc_symbol functions.
8182         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
8183         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
8184         local_plt_offsets_ field.
8185         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
8186         * output.h (class Output_section_data): Add non-const
8187         output_section function.
8188         (class Output_data_got): Update declarations.
8189         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
8190         Add use_plt_offset parameter to global and local constructors.
8191         Change all callers.  Change local_sym_index_ field to 31 bits.
8192         Change GSYM_CODE and CONSTANT_CODE accordingly.
8193         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
8194         doing a static link don't set sh_link field.
8195         (Output_data_got::Got_entry::write): Use PLT offset if
8196         appropriate.
8197         (Output_data_got::add_global_plt): New function.
8198         (Output_data_got::add_local_plt): New function.
8199         * target-reloc.h (relocate_section): Handle IFUNC symbol.
8200         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
8201         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
8202         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
8203         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
8204         IFUNC conditional.
8205         * testsuite/ifunc-sel.h: New file.
8206         * testsuite/ifuncmain1.c: New file.
8207         * testsuite/ifuncmain1vis.c: New file.
8208         * testsuite/ifuncmod1.c: New file.
8209         * testsuite/ifuncdep2.c: New file.
8210         * testsuite/ifuncmain2.c: New file.
8211         * testsuite/ifuncmain3.c: New file.
8212         * testsuite/ifuncmod3.c: New file.
8213         * testsuite/ifuncmain4.c: New file.
8214         * testsuite/ifuncmain5.c: New file.
8215         * testsuite/ifuncmod5.c: New file.
8216         * testsuite/ifuncmain6pie.c: New file.
8217         * testsuite/ifuncmod6.c: New file.
8218         * testsuite/ifuncmain7.c: New file.
8219         * configure, testsuite/Makefile.in: Rebuild.
8220
8221 2010-08-18  Ian Lance Taylor  <iant@google.com>
8222
8223         * incremental.cc
8224         (Output_section_incremental_inputs::write_input_files): Add cast
8225         to avoid signed/unsigned comparison warning.
8226         (Output_section_incremental_inputs::write_info_blocks): Likewise.
8227
8228 2010-08-12  Cary Coutant  <ccoutant@google.com>
8229
8230         * common.cc (Sort_commons::operator()): Remove unnecessary code.
8231
8232 2010-08-13  Ian Lance Taylor  <iant@google.com>
8233
8234         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
8235
8236 2010-08-12  Cary Coutant  <ccoutant@google.com>
8237             Doug Kwan  <dougkwan@google.com>
8238
8239         * resolve.cc (Symbol_table::should_override): When a weak dynamic
8240         defintion overrides non-weak undef, remember that the original undef
8241         is not weak.
8242         * symtab.cc (Symbol_table::sized_write_global): For undef without
8243         an original weak binding, set binding to global in output.
8244         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
8245         * testsuite/Makefile.in: Regenerate.
8246         * testsuite/strong_ref_weak_def.sh: New file.
8247         * testsuite/strong_ref_weak_def_1.c: Ditto.
8248         * testsuite/strong_ref_weak_def_2.c: Ditto.
8249
8250 2010-08-12  Cary Coutant  <ccoutant@google.com>
8251
8252         * testsuite/incremental_test.sh: Rewrite.
8253         * testsuite/incremental_test_1.c: Rewrite.
8254         * testsuite/incremental_test_2.c: Rewrite.
8255
8256 2010-08-12  Cary Coutant  <ccoutant@google.com>
8257
8258         * arm.cc (Target_arm::got_size): Add const.
8259         (Target_arm::got_entry_count): New function.
8260         (Target_arm::plt_entry_count): New function.
8261         (Target_arm::first_plt_entry_offset): New function.
8262         (Target_arm::plt_entry_size): New function.
8263         (Output_data_plt_arm::entry_count): New function.
8264         (Output_data_plt_arm::first_plt_entry_offset): New function.
8265         (Output_data_plt_arm::get_plt_entry_size): New function.
8266         * i386.cc (Target_i386::got_size): Add const.
8267         (Target_i386::got_entry_count): New function.
8268         (Target_i386::plt_entry_count): New function.
8269         (Target_i386::first_plt_entry_offset): New function.
8270         (Target_i386::plt_entry_size): New function.
8271         (Output_data_plt_i386::entry_count): New function.
8272         (Output_data_plt_i386::first_plt_entry_offset): New function.
8273         (Output_data_plt_i386::get_plt_entry_size): New function.
8274         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
8275         find_incremental_inputs_sections.  Dump incremental_got_plt section.
8276         * incremental.cc: Include target.h.
8277         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
8278         parameter.  Adjust all callers.  Find incremental_got_plt section.
8279         (Incremental_inputs::create_data_sections): Create incremental_got_plt
8280         section.
8281         (Output_section_incremental_inputs::set_final_data_size): Calculate
8282         size of incremental_got_plt section.
8283         (Output_section_incremental_inputs::do_write): Write the
8284         incremental_got_plt section.
8285         (Got_plt_view_info): New struct.
8286         (Local_got_offset_visitor): New class.
8287         (Global_got_offset_visitor): New class.
8288         (Global_symbol_visitor_got_plt): New class.
8289         (Output_section_incremental_inputs::write_got_plt): New function.
8290         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
8291         Add parameter.  Adjust all callers.
8292         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8293         (Incremental_inputs::got_plt_section): New function.
8294         (Incremental_inputs::got_plt_section_): New data member.
8295         (Incremental_got_plt_reader): New class.
8296         * layout.cc (Layout::create_incremental_info_sections): Add the
8297         incremental_got_plt section.
8298         * object.h (Got_offset_list::get_list): New function.
8299         (Got offset_list::for_all_got_offsets): New function.
8300         (Sized_relobj::local_got_offset_list): New function.
8301         * powerpc.cc (Target_powerpc::got_size): Add const.
8302         (Target_powerpc::got_entry_count): New function.
8303         (Target_powerpc::plt_entry_count): New function.
8304         (Target_powerpc::first_plt_entry_offset): New function.
8305         (Target_powerpc::plt_entry_size): New function.
8306         (Output_data_plt_powerpc::entry_count): New function.
8307         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
8308         (Output_data_plt_powerpc::get_plt_entry_size): New function.
8309         * sparc.cc (Target_sparc::got_size): Add const.
8310         (Target_sparc::got_entry_count): New function.
8311         (Target_sparc::plt_entry_count): New function.
8312         (Target_sparc::first_plt_entry_offset): New function.
8313         (Target_sparc::plt_entry_size): New function.
8314         (Output_data_plt_sparc::entry_count): New function.
8315         (Output_data_plt_sparc::first_plt_entry_offset): New function.
8316         (Output_data_plt_sparc::get_plt_entry_size): New function.
8317         * symtab.h (Symbol::got_offset_list): New function.
8318         (Symbol_table::for_all_symbols): New function.
8319         * target.h (Sized_target::got_entry_count): New function.
8320         (Sized_target::plt_entry_count): New function.
8321         (Sized_target::plt_entry_size): New function.
8322         * x86_64.cc (Target_x86_64::got_size): Add const.
8323         (Target_x86_64::got_entry_count): New function.
8324         (Target_x86_64::plt_entry_count): New function.
8325         (Target_x86_64::first_plt_entry_offset): New function.
8326         (Target_x86_64::plt_entry_size): New function.
8327         (Output_data_plt_x86_64::entry_count): New function.
8328         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
8329         (Output_data_plt_x86_64::get_plt_entry_size): New function.
8330
8331 2010-08-12  Cary Coutant  <ccoutant@google.com>
8332
8333         * archive.cc: Include incremental.h.
8334         (Archive::Archive): Initialize incremental_info_.
8335         (Archive::include_member): Record archive members in incremental info.
8336         (Add_archive_symbols::run): Record begin and end of an archive in
8337         incremental info.
8338         (Lib_group::include_member): Record objects in incremental info.
8339         * archive.h (Incremental_archive_entry): Forward declaration.
8340         (Archive::set_incremental_info): New member function.
8341         (Archive::incremental_info): New member function.
8342         (Archive::Unused_symbol_iterator): New class.
8343         (Archive::unused_symbols_begin): New member function.
8344         (Archive::unused_symbols_end): New member function.
8345         (Archive::incremental_info_): New data member.
8346         * incremental-dump.cc (find_input_containing_global): New function.
8347         (dump_incremental_inputs): Dump new incremental info sections.
8348         * incremental.cc: Include symtab.h.
8349         (Output_section_incremental_inputs): New class.
8350         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
8351         new incremental info sections.
8352         (Sized_incremental_binary::do_check_inputs): Likewise.
8353         (Incremental_inputs::report_archive): Remove.
8354         (Incremental_inputs::report_archive_begin): New function.
8355         (Incremental_inputs::report_archive_end): New function.
8356         (Incremental_inputs::report_object): New function.
8357         (Incremental_inputs::finalize_inputs): Remove.
8358         (Incremental_inputs::report_input_section): New function.
8359         (Incremental_inputs::report_script): Rewrite.
8360         (Incremental_inputs::finalize): Do nothing but finalize string table.
8361         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8362         (Incremental_inputs::sized_create_inputs_section_data): Remove.
8363         (Incremental_inputs::create_data_sections): New function.
8364         (Incremental_inputs::relocs_entsize): New function.
8365         (Output_section_incremental_inputs::set_final_data_size): New function.
8366         (Output_section_incremental_inputs::do_write): New function.
8367         (Output_section_incremental_inputs::write_header): New function.
8368         (Output_section_incremental_inputs::write_input_files): New function.
8369         (Output_section_incremental_inputs::write_info_blocks): New function.
8370         (Output_section_incremental_inputs::write_symtab): New function.
8371         * incremental.h (Incremental_script_entry): Forward declaration.
8372         (Incremental_object_entry): Forward declaration.
8373         (Incremental_archive_entry): Forward declaration.
8374         (Incremental_inputs): Forward declaration.
8375         (Incremental_inputs_header_data): Remove.
8376         (Incremental_inputs_header): Remove.
8377         (Incremental_inputs_header_write): Remove.
8378         (Incremental_inputs_entry_data): Remove.
8379         (Incremental_inputs_entry): Remove.
8380         (Incremental_inputs_entry_write): Remove.
8381         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
8382         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
8383         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8384         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
8385         Likewise.
8386         (Incremental_input_entry): New class.
8387         (Incremental_script_entry): New class.
8388         (Incremental_object_entry): New class.
8389         (Incremental_archive_entry): New class.
8390         (Incremental_inputs::Incremental_inputs): Initialize new data members.
8391         (Incremental_inputs::report_inputs): Remove.
8392         (Incremental_inputs::report_archive): Remove.
8393         (Incremental_inputs::report_archive_begin): New function.
8394         (Incremental_inputs::report_archive_end): New function.
8395         (Incremental_inputs::report_object): Change prototype.
8396         (Incremental_inputs::report_input_section): New function.
8397         (Incremental_inputs::report_script): Change prototype.
8398         (Incremental_inputs::get_reloc_count): New function.
8399         (Incremental_inputs::set_reloc_count): New function.
8400         (Incremental_inputs::create_data_sections): New function.
8401         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8402         (Incremental_inputs::inputs_section): New function.
8403         (Incremental_inputs::symtab_section): New function.
8404         (Incremental_inputs::relocs_section): New function.
8405         (Incremental_inputs::get_stringpool): Add const.
8406         (Incremental_inputs::command_line): Add const.
8407         (Incremental_inputs::inputs): Remove.
8408         (Incremental_inputs::command_line_key): New function.
8409         (Incremental_inputs::input_file_count): New function.
8410         (Incremental_inputs::input_files): New function.
8411         (Incremental_inputs::relocs_entsize): New function.
8412         (Incremental_inputs::sized_create_inputs_section_data): Remove.
8413         (Incremental_inputs::finalize_inputs): Remove.
8414         (Incremental_inputs::Input_info): Remove.
8415         (Incremental_inputs::lock_): Remove.
8416         (Incremental_inputs::inputs_): Change type.
8417         (Incremental_inputs::inputs_map_): Remove.
8418         (Incremental_inputs::current_object_entry_): New data member.
8419         (Incremental_inputs::inputs_section_): New data member.
8420         (Incremental_inputs::symtab_section_): New data member.
8421         (Incremental_inputs::relocs_section_): New data member.
8422         (Incremental_inputs::reloc_count_): New data member.
8423         (Incremental_inputs_reader): New class.
8424         (Incremental_symtab_reader): New class.
8425         (Incremental_relocs_reader): New class.
8426         * layout.cc (Layout::finalize): Move finalization of incremental info
8427         and creation of incremental info sections to follow finalization of
8428         symbol table.  Set offsets for postprocessing sections.
8429         (Layout::create_incremental_info_sections): Call
8430         Incremental_inputs::create_data_sections.  Add incremental symtab
8431         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
8432         sections to layout after input sections.
8433         * layout.h (struct Timespec): Forward declaration.
8434         (Layout::incremental_inputs): Add const.
8435         (Layout::create_incremental_info_sections): Add parameter.
8436         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
8437         * object.cc: Include incremental.h.
8438         (Relobj::finalize_incremental_relocs): New function.
8439         (Sized_relobj::do_layout): Record input sections in incremental info.
8440         * object.h (Object::output_section): New function.
8441         (Object::output_section_offset): Moved from Relobj.
8442         (Object::get_incremental_reloc_base): New function.
8443         (Object::get_incremental_reloc_count): New function.
8444         (Object::do_output_section): New function.
8445         (Object::do_output_section_offset): Moved from Relobj.
8446         (Object::do_get_incremental_reloc_base): New function.
8447         (Object::do_get_incremental_reloc_count): New function.
8448         (Object::Object): Initialize new data members.
8449         (Relobj::output_section): Renamed do_output_section and moved to
8450         protected.
8451         (Relobj::output_section_offset): Moved to Object.
8452         (Relobj::do_get_incremental_reloc_base): New function.
8453         (Relobj::do_get_incremental_reloc_count): New function.
8454         (Relobj::allocate_incremental_reloc_counts): New function.
8455         (Relobj::count_incremental_reloc): New function.
8456         (Relobj::finalize_incremental_relocs): New function.
8457         (Relobj::next_incremental_reloc_index): New function.
8458         (Relobj::reloc_counts_): New data member.
8459         (Relobj::reloc_bases_): New data member.
8460         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
8461         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
8462         (Sized_relobj::incremental_relocs_scan): New function.
8463         (Sized_relobj::incremental_relocs_scan_reltype): New function.
8464         (Sized_relobj::incremental_relocs_write): New function.
8465         (Sized_relobj::incremental_relocs_write_reltype): New function.
8466         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
8467         incremental link.
8468         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
8469         archives and object files elsewhere.
8470         (Add_symbols::run): Report object files here.
8471         (Finish_group::run): Report end of archive at end of group.
8472         * reloc.cc: Include layout.h, incremental.h.
8473         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
8474         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
8475         (Sized_relobj::incremental_relocs_scan): New function.
8476         (Sized_relobj::incremental_relocs_scan_reltype): New function.
8477         (Sized_relobj::do_relocate_sections): Write incremental relocations.
8478         (Sized_relobj::incremental_relocs_write): New function.
8479         (Sized_relobj::incremental_relocs_write_reltype): New function.
8480         * script.cc (read_input_script): Rewrite test for incremental link.
8481         Change call to Incremental_inputs::report_script.
8482         * symtab.h (Symbol_table::first_global_index): New function.
8483         (Symbol_table::output_count): New function.
8484
8485 2010-08-12  Doug Kwan  <dougkwan@google.com>
8486
8487         * arm.cc (Target_arm::merge_object_attributes): Check command line
8488         options --no-wchar-size-warning and --no-enum-size-warning.
8489         * options.h (General_options): Add ld-compatible options
8490         --no-enum-size-warning and --no-wchar-size-warning.
8491
8492 2010-08-04  Ian Lance Taylor  <iant@google.com>
8493
8494         * x86_64.cc (Target_x86_64::Scan::local): Use
8495         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
8496         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
8497         (Target_x86_64::Scan::global): Likewise.
8498         (Target_x86_64::Relocate::relocate): Likewise.
8499         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
8500         Likewise.
8501
8502 2010-08-03  Cary Coutant  <ccoutant@google.com>
8503
8504         * merge.cc (Output_merge_string::do_add_input_section): Count strings
8505         to reserve space in merged_strings vector. Keep total input size
8506         for stats.
8507         (Output_merge_string::do_print_merge_stats): Print total input size.
8508         * merge.h (Output_merge_string): Add input_size_ field.
8509         * stringpool.cc (Stringpool_template::string_length): Move
8510         implementations out of Stringpool_template class and place in
8511         stringpool.h.
8512         * stringpool.h (string_length): Move out of Stringpool_template.
8513
8514 2010-08-03  Ian Lance Taylor  <iant@google.com>
8515
8516         PR 11712
8517         * layout.cc (relaxation_loop_body): If address of load segment is
8518         set, adjust address to include headers if possible.
8519
8520 2010-08-03  Ian Lance Taylor  <iant@google.com>
8521
8522         * version.cc (version_string): Bump to 1.10.
8523
8524 2010-08-03  Ian Lance Taylor  <iant@google.com>
8525
8526         PR 11805
8527         * layout.h (enum Output_section_order): Define.
8528         (class Layout): Update declarations.
8529         * layout.cc (Layout::get_output_section): Add order parameter.
8530         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
8531         is_first_non_relro parameters.  Change all callers.
8532         (Layout::choose_output_section): Likewise.
8533         (Layout::add_output_section_data): Likewise.
8534         (Layout::make_output_section): Likewise.  Set order.
8535         (Layout::default_section_order): New function.
8536         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
8537         * output.cc (Output_section::Output_section): Initialize order_.
8538         Don't initialize deleted fields.
8539         (Output_segment::Output_segment): Don't initialize deleted
8540         fields.
8541         (Output_segment::add_output_section_to_load): New function
8542         replacing add_output_section.  Change all callers to call this or
8543         add_output_section_to_nonload.
8544         (Output_segment::add_output_section_to_nonload): New function.
8545         (Output_segment::remove_output_section): Rewrite.
8546         (Output_segment::add_initial_output_data): Likewise.
8547         (Output_segment::has_any_data_sections): Likewise.
8548         (Output_segment::is_first_section_relro): Likewise.
8549         (Output_segment::maximum_alignment): Likewise.
8550         (Output_segment::has_dynamic_reloc): New function replacing
8551         dynamic_reloc_count.  Change all callers.
8552         (Output_segment::has_dynamic_reloc_list): New function replacing
8553         dynamic_reloc_count_list.  Change all callers.
8554         (Output_segment::set_section_addresses): Rewrite.
8555         (Output_segment::set_offset): Rewrite.
8556         (Output_segment::find_first_and_last_list): Remove.
8557         (Output_segment::set_tls_offsets): Rewrite.
8558         (Output_segment::first_section_load_address): Likewise.
8559         (Output_segment::output_section_count): Likewise.
8560         (Output_segment::section_with_lowest_load_address): Likewise.
8561         (Output_segment::write_section_headers): Likewise.
8562         (Output_segment::print_sections_to_map): Likewise.
8563         * output.h (class Output_data): Remove dynamic_reloc_count_
8564         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
8565         (Output_data::add_dynamic_reloc): Rewrite.
8566         (Output_data::has_dynamic_reloc): New function.
8567         (Output_data::dynamic_reloc_count): Remove.
8568         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
8569         is_last_relro_, is_first_non_relro_, is_interp_,
8570         is_dynamic_linker_section_ fields.  Add order and set_order
8571         functions.  Remove is_relro_local, set_is_relro_local,
8572         is_last_relro, set_is_last_relro, is_first_non_relro,
8573         set_is_first_non_relro functions, is_interp, set_is_interp,
8574         is_dynamic_linker_section, and set_is_dynamic_linker_section
8575         functions.
8576         (class Output_segment): Change Output_data_list from std::list to
8577         std:;vector.  Add output_lists_ field.  Remove output_data_ and
8578         output_bss_ fields.  Update declarations.
8579
8580 2010-08-02  Ian Lance Taylor  <iant@google.com>
8581
8582         * arm.cc (Target_arm::gc_process_relocs): Use typename.
8583         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
8584         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
8585
8586 2010-08-02  Ian Lance Taylor  <iant@google.com>
8587
8588         PR 11855
8589         * script.cc (Script_options::Script_options): Initialize
8590         symbol_definitions_ and symbol_references_.
8591         (Script_options::add_symbol_assignment): Update
8592         symbol_definitions_ and symbol_references_.
8593         (Script_options::add_symbol_reference): New function.
8594         (script_symbol): New function.
8595         * script.h (class Script_options): Add symbol_definitions_ and
8596         symbol_references_ fields.
8597         (Script_options::referenced_const_iterator): New type.
8598         (Script_options::referenced_begin): New function.
8599         (Script_options::referenced_end): New function.
8600         (Script_options::is_referenced): New function.
8601         (Script_options::any_unreferenced): New function.
8602         * script-c.h (script_symbol): Declare.
8603         * yyscript.y (exp): Call script_symbol.
8604         * symtab.cc: Include "script.h".
8605         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
8606         Change all callers.  Check symbols referenced by scripts.
8607         (Symbol_table::add_undefined_symbols_from_command_line): Add
8608         layout parameter.  Change all callers.
8609         (Symbol_table::do_add_undefined_symbols_from_command_line):
8610         Likewise.  Break out loop body.  Check symbols referenced by
8611         scripts.
8612         (Symbol_table::add_undefined_symbol_from_command_line): New
8613         function broken out of
8614         do_add_undefined_symbols_from_command_line.
8615         * symtab.h (class Symbol_table): Update declarations.
8616         * archive.cc: Include "layout.h".
8617         (Archive::should_include_member): Add layout parameter.  Change
8618         all callers.  Check for symbol mentioned in expression.
8619         * archive.h (class Archive): Update declaration.
8620         * object.cc (Sized_relobj::do_should_include_member): Add layout
8621         parameter.
8622         * object.h (Object::should_include_member): Add layout parameter.
8623         Change all callers.
8624         (Object::do_should_include_member): Add layout parameter.
8625         (class Sized_relobj): Update declaration.
8626         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
8627         parameter.
8628         * dynobj.h (class Sized_dynobj): Update declaration.
8629         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
8630         layout parameter.
8631         * plugin.h (class Sized_pluginobj): Update declaration.
8632
8633 2010-08-02  Ian Lance Taylor  <iant@google.com>
8634
8635         PR 11866
8636         * output.cc (Output_segment::set_offset): Search for the first and
8637         last sections rather than assuming that the list is in order.
8638         (Output_segment::find_first_and_last_list): New function.
8639         * output.h (class Output_segment): Update declarations.
8640         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
8641         (relro_strip_test_SOURCES): New variable.
8642         (relro_strip_test_DEPENDENCIES): New variable.
8643         (relro_strip_test_LDFLAGS): New variable.
8644         (relro_strip_test_LDADD): New variable.
8645         (relro_strip_test.so): New target.
8646
8647 2010-08-02  Ian Lance Taylor  <iant@google.com>
8648
8649         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
8650         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
8651         (Target_i386::got_tlsdesc_section): New function.
8652         (Target_i386::got_section): Create space for GOT entries for
8653         TLSDESC relocations.
8654         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
8655         R_386_TLS_GOTDESC.
8656         (Target_i386::Scan::global): Likewise.
8657         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
8658         using TLSDESC GOT.
8659         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
8660         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
8661         (Target_x86_64::got_tlsdesc_section): New function.
8662         (Target_x86_64::got_section): Create space for GOT entries for
8663         TLSDESC relocations.
8664         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
8665         R_386_TLS_GOTDESC.
8666         (Target_x86_64::Scan::global): Likewise.
8667         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
8668         using TLSDESC GOT.
8669
8670 2010-08-02  Ian Lance Taylor  <iant@google.com>
8671
8672         * testsuite/final_layout.sh: Use dc to convert from hex to
8673         decimal.
8674
8675 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
8676
8677         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
8678         paramter to the call to gold::gc_process_relocs.
8679         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
8680         paramter to the call to gold::gc_process_relocs.
8681         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
8682         parameter to the call to gold::gc_process_relocs.
8683         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
8684         template parameter to the call to gold::gc_process_relocs.
8685         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
8686         paramter to the call to gold::gc_process_relocs.
8687         * gc.h (get_embedded_addend_size): New function.
8688         (gc_process_relocs): Save the size of the reloc for use by ICF.
8689         * icf.cc (get_section_contents): Get the addend from the text section
8690         for SHT_REL relocation sections.
8691         * icf.h (Icf::Reloc_addend_size_info): New typedef.
8692         (Icf::Reloc_info): Add new member reloc_addend_size_info.
8693         * int_encoding.h (read_from_pointer): New overloaded function.
8694         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
8695         * testsuite/icf_sht_rel_addend_test.sh: New file.
8696         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
8697         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
8698
8699 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8700
8701         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
8702         * Makefile.in: Regenerate.
8703         * testsuite/Makefile.in: Regenerate.
8704
8705 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
8706
8707         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
8708         * gold/testsuite/debug_msg.cc: Likewise.
8709         * gold/testsuite/odr_violation1.cc
8710         * gold/testsuite/odr_violation2.cc
8711
8712 2010-07-21  Cary Coutant  <ccoutant@google.com>
8713
8714         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
8715         string, and length fields.
8716         (Output_merge_string::Merged_strings_list): New type.
8717         (Output_merge_string::Merged_strings_lists): New typedef.
8718         (Output_merge_string): Replace merged_strings_ with
8719         merged_strings_lists_.
8720         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
8721         Merged_strings_list per input object and section.  Don't store pointer
8722         to the string.  Don't store length with each merged string entry.
8723         (Output_merge_string::finalize_merged_data): Loop over list of merged
8724         strings lists.  Recompute length of each merged string.
8725
8726 2010-07-15  Cary Coutant  <ccoutant@google.com>
8727
8728         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
8729         here.
8730
8731 2010-07-14  Ian Lance Taylor  <iant@google.com>
8732
8733         * descriptors.cc (Descriptors::open): Report correct name in error
8734         message.
8735
8736 2010-07-13  Doug Kwan  <dougkwan@google.com>
8737
8738         * arm.cc (Arm_input_section::Arm_input_section): For a
8739         SHT_ARM_EXIDX section, always keeps the input sections.
8740         (Arm_input_section::set_exidx_section_link): New method.
8741         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
8742         has_errors_ to false.
8743         (Arm_exidx_input_section::has_errors,
8744         Arm_exidx_input_section::set_has_errors): New methods.
8745         (Arm_exidx_input_section::has_errors_): New data member.
8746         (Arm_relobj::get_exidx_shndx_list): New method.
8747         (Arm_output_section::append_text_sections_to_list): Do not skip
8748         section without SHF_EXECINSTR.
8749         (Arm_output_section::fix_exidx_coverage): Skip input sections with
8750         errors.
8751         (Arm_relobj::make_exidx_input_section): Add new parameter for text
8752         section header.  Make error messages more verbose.  Check for
8753         a non-executable section linked to an EXIDX section.
8754         (Arm_relobj::do_read_symbols): Remove error checking, which has been
8755         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
8756         check that there is no deferred EXIDX section if we exit early.
8757         Instead of not making an EXIDX section in case of an error, make one
8758         and set the has_errors flag of it.
8759         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
8760         in a relocatable link.
8761         (Target_arm::do_relax): Look for the EXIDX output section instead of
8762         assuming that it is called .ARM.exidx.
8763         (Target_arm::fix_exidx_coverage): Add a new parameter for input
8764         section list.  Do not check for SHF_EXECINSTR section flags but
8765         skip any input section with errors.
8766         * output.cc (Output_section::Output_section): Initialize
8767         always_keeps_input_sections_ to false.
8768         (Output_section::add_input_section): Check for
8769         always_keeps_input_sections_.
8770         *  output.h (Output_section::always_keeps_input_sections,
8771         Output_section::set_always_keeps_input_sections): New methods.
8772         (Output_section::always_keeps_input_sections): New data member.
8773
8774 2010-07-13  Rafael Espindola  <espindola@google.com>
8775
8776         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
8777         * fileread.h (Input_file): Add try_extra_search_path and find_file.
8778
8779 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
8780             Ian Lance Taylor  <iant@google.com>
8781
8782         * output.h (Output_section_lookup_maps::add_merge_section):
8783         Correct check of whether value was inserted.
8784         (Output_section_lookup_maps::add_merge_input_section): Likewise.
8785         (Output_section_lookup_maps::add_relaxed_input_section):
8786         Likewise.
8787         * arm.cc (Target_arm::got_section): Remove used local os.
8788         * i386.cc (Target_i386::got_section): Likewise.
8789         * x86_64.cc (Target_x86_64::got_section): Likewise.
8790         * sparc.cc (Target_sparc::got_section): Likewise.
8791         (Target_sparc::relocate): Remove unused local have_got_offset.
8792         * powerpc.cc (Target_powerpc::relocate): Likewise.
8793
8794 2010-07-13  Ian Lance Taylor  <iant@google.com>
8795
8796         * compressed_output.cc (zlib_decompress): Fix signature in
8797         !HAVE_ZLIB_H case.
8798
8799         * archive.cc (Archive::include_member): Unlock an external member
8800         of a thin archive.  Don't bother to delete an object we know is
8801         NULL.
8802
8803 2010-07-12  Cary Coutant  <ccoutant@google.com>
8804
8805         * compressed_output.cc (zlib_decompress): New function.
8806         (get_uncompressed_size): New function.
8807         (decompress_input_section): New function.
8808         * compressed_output.h (get_uncompressed_size): New function.
8809         (decompress_input_section): New function.
8810         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
8811         Handle compressed debug sections.
8812         * layout.cc (is_compressed_debug_section): New function.
8813         (Layout::output_section_name): Map compressed section names to
8814         canonical names.
8815         * layout.h (is_compressed_debug_section): New function.
8816         (is_debug_info_section): Recognize compressed debug sections.
8817         * merge.cc: Include compressed_output.h.
8818         (Output_merge_data::do_add_input_section): Handle compressed
8819         debug sections.
8820         (Output_merge_string::do_add_input_section): Handle compressed
8821         debug sections.
8822         * object.cc: Include compressed_output.h.
8823         (Sized_relobj::Sized_relobj): Initialize new data members.
8824         (build_compressed_section_map): New function.
8825         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8826         * object.h (Object::section_is_compressed): New method.
8827         (Object::do_section_is_compressed): New method.
8828         (Sized_relobj::Compressed_section_map): New type.
8829         (Sized_relobj::do_section_is_compressed): New method.
8830         (Sized_relobj::compressed_sections_): New data member.
8831         * output.cc (Output_section::add_input_section): Handle compressed
8832         debug sections.
8833         * reloc.cc: Include compressed_output.h.
8834         (Sized_relobj::write_sections): Handle compressed debug sections.
8835
8836 2010-07-08  Cary Coutant  <ccoutant@google.com>
8837
8838         * resolve.cc (Symbol_table::resolve): Remember whether undef was
8839         weak when resolving to a dynamic def.
8840         (Symbol_table::should_override): Add adjust_dyndef flag; set it
8841         for weak undef/dynamic def cases. Adjust callers.
8842         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8843         undef_binding_weak_.
8844         (Symbol_table::sized_write_globals): Adjust symbol binding.
8845         (Symbol_table::sized_write_symbol): Add binding parameter.
8846         * symtab.h (Symbol::set_undef_binding): New method.
8847         (Symbol::is_undef_binding_weak): New method.
8848         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8849         (Symbol_table::should_override): Add new parameter.
8850         (Symbol_table::sized_write_symbol): Add new parameter.
8851
8852         * testsuite/weak_undef_file1.cc: Add new test case.
8853         * testsuite/weak_undef_file2.cc: Fix header comment.
8854         * testsuite/weak_undef_test.cc: Add new test case.
8855
8856 2010-06-29  Doug Kwan  <dougkwan@google.com>
8857
8858         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8859         Initialize USE_SYMBOL_.
8860         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8861         definition.
8862         (Arm_reloc_property::uses_symbol_): New data member declaration.
8863         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8864         uses symbol value and symbol is undefined but not weakly undefined.
8865
8866 2010-06-28  Rafael Espindola  <espindola@google.com>
8867
8868         * plugin.cc (Plugin::load): Use dlerror.
8869
8870 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
8871
8872         * symtab.cc (detect_odr_violations): When reporting an ODR
8873         violation, report an object where the symbol is defined.
8874
8875 2010-06-25  Doug Kwan  <dougkwan@google.com>
8876
8877         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8878         (Target_arm::section_may_have_icf_unsafe_pointers): New method
8879         definition.
8880         (Target_arm::Scan::local_reloc_may_be_function_pointer,
8881         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8882         target hook to detect function points.
8883         (Target_arm::Scan::possible_function_pointer_reloc): New method.
8884         * icf.h (Icf::check_section_for_function_pointers): Change type of
8885         parameter SECTION_NAME to const reference to std::string.  Use
8886         target hook to determine if section may have unsafe pointers.
8887         * target.h (Target::section_may_have_icf_unsafe_pointers): New
8888         method definition.
8889
8890 2010-06-21  Rafael Espindola  <espindola@google.com>
8891
8892         * fileread.cc (Input_file::find_fie): New
8893         (Input_file::open): Use Input_file::find_fie.
8894         * fileread.h (Input_file::find_fie): New
8895         * plugin.cc (set_extra_library_path): New.
8896         (Plugin::load): Add set_extra_library_path to the transfer vector.
8897         (Plugin_manager::set_extra_library_path): New.
8898         (Plugin_manager::add_input_file): Use the extra search path if set.
8899         (set_extra_library_path(): New.
8900         * plugin.h (Plugin_manager): Add set_extra_library_path and
8901         extra_search_path_.
8902
8903 2010-06-19  Cary Coutant  <ccoutant@google.com>
8904
8905         * layout.cc (gdb_sections): Add .debug_types.
8906         (lines_only_debug_sections): Likewise.
8907
8908 2010-06-18  Rafael Espindola  <espindola@google.com>
8909
8910         * plugin.cc (add_input_file,add_input_library)
8911         (Plugin_manager::add_input_file): Make filename arguments const.
8912         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
8913         const.
8914
8915 2010-06-16  Doug Kwan  <dougkwan@google.com>
8916
8917         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
8918         .ARM.attributes section if we have not merged any input
8919         attributes sections.
8920
8921 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8922
8923         * arm.cc: Allow combining objects with no EABI version
8924         information.
8925
8926 2010-06-15  Rafael Espindola  <espindola@google.com>
8927
8928         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
8929
8930 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8931
8932         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
8933         (struct iovec): Correct !HAVE_READV definition.
8934
8935 2010-06-10  Cary Coutant  <ccoutant@google.com>
8936
8937         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
8938         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
8939         reloc sections.
8940         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
8941
8942         PR 11683
8943         * symtab.h (Symbol::is_placeholder): New member function.
8944         * target-reloc.h (relocate_section): Check for placeholder symbols.
8945
8946         * testsuite/Makefile.am (plugin_test_8): New test.
8947         (plugin_test_9): New test.
8948         * testsuite/Makefile.in: Regenerate.
8949
8950 2010-06-09  Nick Clifton  <nickc@redhat.com>
8951
8952         * yyscript.y (input_list_element): Allow strings prefixed with
8953         the '-' character.  Treat these as libraries.
8954         * script.cc (script_add_library): New function.  Adds a library
8955         specified by "-l<name>" found in an input script.
8956         * script-c.h: Add prototype for script_add_library.
8957
8958 2010-06-07  Doug Kwan  <dougkwan@google.com>
8959
8960         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
8961         Restrict stub-group size to be within long conditional branch
8962         range when working around cortex-A8 erratum.
8963
8964 2010-06-07  Damien Diederen  <dd@crosstwine.com>
8965
8966         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
8967         #ifdef typo.
8968
8969 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
8970
8971         PR gold/11658
8972         * output.cc
8973         (Output_section::Input_section_sort_entry::compare_section_ordering):
8974         Change to return non-zero correctly.
8975         (Output_section::Input_section_sort_section_order_index_compare
8976         ::operator()): Change to fix ambiguity in comparisons.
8977
8978 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
8979
8980         * gold.h (is_wildcard_string): New function.
8981         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8982         (Layout::layout_eh_frame): Ditto.
8983         (Layout::find_section_order_index): New method.
8984         (Layout::read_layout_from_file): New method.
8985         * layout.h (Layout::find_section_order_index): New method.
8986         (Layout::read_layout_from_file): New method.
8987         (Layout::input_section_position_): New private member.
8988         (Layout::input_section_glob_): New private member.
8989         * main.cc (main): Call read_layout_from_file here.
8990         * options.h (--section-ordering-file): New option.
8991         * output.cc (Output_section::input_section_order_specified_): New
8992         member.
8993         (Output_section::Output_section): Initialize new member.
8994         (Output_section::add_input_section): Add new parameter.
8995         Keep input sections when --section-ordering-file is used.
8996         (Output_section::set_final_data_size): Sort input sections when
8997         section ordering file is specified.
8998         (Output_section::Input_section_sort_entry): Add new parameter.
8999         Check sorting type.
9000         (Output_section::Input_section_sort_entry::compare_section_ordering):
9001         New method.
9002         (Output_section::Input_section_sort_compare::operator()): Change to
9003         consider section_order_index.
9004         (Output_section::Input_section_sort_init_fini_compare::operator()):
9005         Change to consider section_order_index.
9006         (Output_section::Input_section_sort_section_order_index_compare
9007         ::operator()): New method.
9008         (Output_section::sort_attached_input_sections): Change to sort
9009         according to section order when specified.
9010         (Output_section::add_input_section<32, true>): Add new parameter.
9011         (Output_section::add_input_section<64, true>): Add new parameter.
9012         (Output_section::add_input_section<32, false>): Add new parameter.
9013         (Output_section::add_input_section<64, false>): Add new parameter.
9014         * output.h (Output_section::add_input_section): Add new parameter.
9015         (Output_section::input_section_order_specified): New
9016         method.
9017         (Output_section::set_input_section_order_specified): New method.
9018         (Input_section::Input_section): Initialize section_order_index_.
9019         (Input_section::section_order_index): New method.
9020         (Input_section::set_section_order_index): New method.
9021         (Input_section::section_order_index_): New member.
9022         (Input_section::Input_section_sort_section_order_index_compare): New
9023         struct.
9024         (Output_section::input_section_order_specified_): New member.
9025         * script-sections.cc (is_wildcard_string): Delete and move modified
9026         method to gold.h.
9027         (Output_section_element_input::Output_section_element_input): Modify
9028         call to is_wildcard_string.
9029         (Output_section_element_input::Input_section_pattern
9030         ::Input_section_pattern): Ditto.
9031         (Output_section_element_input::Output_section_element_input): Ditto.
9032         * testsuite/Makefile.am (final_layout): New test case.
9033         * testsuite/Makefile.in: Regenerate.
9034         * testsuite/final_layout.cc: New file.
9035         * testsuite/final_layout.sh: New file.
9036
9037 2010-06-01  Rafael Espindola  <espindola@google.com>
9038
9039         * plugin.cc (Plugin::load): Pass the output name to the plugin.
9040
9041 2010-06-01  Rafael Espindola  <espindola@google.com>
9042
9043         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
9044         visibility of symbols.
9045
9046 2010-05-27  Doug Kwan  <dougkwan@google.com>
9047
9048         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
9049         from start of output section instead of address for a local symbol
9050         in a merged or relaxed section when doing a relocatable link.
9051
9052 2010-05-26  Rafael Espindola  <espindola@google.com>
9053
9054         PR 11604
9055         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
9056         adding sections the garbage collector removed.
9057         * gold/testsuite/Makefile.am: Add test.
9058         * gold/testsuite/Makefile.in: Regenerate.
9059         * gold/testsuite/plugin_test_7.sh: New.
9060         * gold/testsuite/plugin_test_7_1.c: New.
9061         * gold/testsuite/plugin_test_7_2.c: New.
9062
9063 2010-05-26  Rafael Espindola  <espindola@google.com>
9064
9065         * script-sections.cc (Output_section_definition::set_section_addresses):
9066         Check for --section-start.
9067
9068 2010-05-26  Doug Kwan  <dougkwan@google.com>
9069
9070         * arm.cc (Arm_scan_relocatable_relocs): New class.
9071         (Target_arm::relocate_special_relocatable): New method.
9072         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
9073         (Arm_relocate_functions::thumb_branch_common): Same.
9074         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
9075         instead of Default_scan_relocatable_relocs.
9076         * target-reloc.h (relocate_for_relocatable): Let target handle
9077         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
9078         * target.h (Sized_target::relocate_special_relocatable): New method.
9079
9080 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9081
9082         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
9083
9084 2010-05-23  Doug Kwan  <dougkwan@google.com>
9085
9086         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
9087         instead of a cast.
9088         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
9089         with a direct branch, not a conditional branch, to a stub.
9090         * merge.cc (Output_merge_base::record_input_section): New method
9091         defintion.
9092         (Output_merge_data::do_add_input_section): Record input section if
9093         keeps-input-sections flag is set.
9094         (Output_merge_string::do_add_input_section): Ditto.
9095         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
9096         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
9097         INPUT_SECTIONS_.
9098         (Output_merge_base::keeps_input_sections,
9099         Output_merge_base::set_keeps_input_sections,
9100         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
9101         method definitions.
9102         (Output_merge_base::Input_sections): New type declaration.
9103         (Output_merge_base::input_sections_begin,
9104         Output_merge_base::input_sections_end,
9105         Output_merge_base::do_set_keeps_input_sections): New method definitions.
9106         (Output_merge_base::bool keeps_input_sections_,
9107         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
9108         Output_merge_base::input_sections_): New data members.
9109         (Output_merge_data::do_set_keeps_input_sections): New method
9110         defintion.
9111         (Output_merge_string::do_set_keeps_input_sections): Ditto.
9112         * output.cc (Output_section::Input_section::relobj): Move method
9113         defintion from class declaration to here and handle merge sections.
9114         (Output_section::Input_section::shndx): Ditto.
9115         (Output_section::Output_section): Remove initializations of removed
9116         data members and initialize new data member LOOKUP_MAPS_.
9117         (Output_section::add_input_section): Set keeps-input-sections flag
9118         for a newly created merge output section as appropriate.  Adjust code
9119         to use Output_section_lookup_maps class.
9120         (Output_section::add_relaxed_input_section): Adjst code for lookup
9121         maps code refactoring.
9122         (Output_section::add_merge_input_section): Add a new parameter
9123         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
9124         class.  If adding input section to a newly created merge output
9125         section fails, remove the new merge section.
9126         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
9127         Adjust code for use of the Output_section_lookup_maps class.
9128         (Output_section::find_merge_section): Ditto.
9129         (Output_section::build_lookup_maps): New method defintion.
9130         (Output_section::find_relaxed_input_section): Adjust code to use
9131         Output_section_lookup_maps class.
9132         (Output_section::get_input_sections): Export merge sections.  Adjust
9133         code to use Output_section_lookup_maps class.
9134         (Output_section:::add_script_input_section): Adjust code to use
9135         Output_section_lookup_maps class.  Update lookup maps for merge
9136         sections also.
9137         (Output_section::discard_states): Use Output_section_lookup_maps.
9138         (Output_section::restore_states): Same.
9139         * output.h (Merge_section_properties): Move class defintion out of
9140         Output_section.
9141         (Output_section_lookup_maps): New class.
9142         (Output_section::Input_section::is_merge_section): New method
9143         defintion.
9144         (Output_section::Input_section::relobj): Move defintion out of class
9145         defintion.  Declare method only.
9146         (Output_section::Input_section::shndx): Ditto.
9147         (Output_section::Input_section::output_merge_base): New method defintion.
9148         (Output_section::Input_section::u2_.pomb): New union field.
9149         (Output_section::Merge_section_by_properties_map,
9150         Output_section::Output_section_data_by_input_section_map,
9151         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
9152         Remove types.
9153         (Output_section::add_merge_input_section): Add new parameter
9154         KEEPS_INPUT_SECTIONS.
9155         (Output_section::build_lookup_maps): New method declaration.
9156         (Output_section::merge_section_map_,
9157         Output_section::merge_section_by_properties_map_,
9158         Output_section::relaxed_input_section_map_,
9159         Output_section::is_relaxed_input_section_map_valid_): Remove data
9160         members.
9161         (Output_section::lookup_maps_): New data member.
9162
9163 2010-05-21  Doug Kwan  <dougkwan@google.com>
9164
9165         PR gold/11619
9166         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
9167         avoid a compilation error.
9168
9169 2010-05-19  Rafael Espindola  <espindola@google.com>
9170
9171         * script-sections.cc (Output_section_definition::allocate_to_segment):
9172         Update the phdrs_list even when the output section is NULL.
9173         * testsuite/Makefile.am: Add test.
9174         * testsuite/Makefile.in: Regenerate.
9175         * testsuite/script_test_9.cc: New.
9176         * testsuite/script_test_9.sh: New.
9177         * testsuite/script_test_9.t: New.
9178
9179 2010-05-19  Doug Kwan  <dougkwan@google.com>
9180
9181         * arm.cc (Arm_input_section::original_size): New method.
9182         (Arm_input_section::do_addralign): Add a cast.
9183         (Arm_input_section::do_output_offset): Remove static cast.
9184         (Arm_input_section::original_addralign,
9185          Arm_input_section::original_size_): Change type to uint32_t.
9186         (Arm_input_section::init): Add safe casts for section alignment
9187         and size.
9188         (Arm_input_section::set_final_data_size): Do not set address and
9189         offset of stub table.
9190         (Arm_output_section::fix_exidx_coverage): Change use of of
9191         Output_section::Simple_input_section to that of
9192         Output_section::Input_section.
9193         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
9194         except for the first pass.
9195         * output.cc (Output_section::get_input_sections): Change type of
9196         input_sections to std::list<Input_section>.
9197         (Output_section::add_script_input_section): Rename from
9198         Output_section::add_simple_input_section.  Change type of SIS
9199         parameter from Simple_input_section to Input_section.
9200         * output.h (Output_section::Simple_input_section): Remove class.
9201         (Output_section::Input_section): Change class visibility to public.
9202         (Output_section::Input_section::addralign): Use stored alignments
9203         for special input sections if set.
9204         (Output_section::Input_section::set_addralign): New method.
9205         (Output_section::get_input_sections): Change parameter type from
9206         list of Simple_input_section to list of Input_section.
9207         (Output_section::add_script_input_section): Rename from
9208         Output_section::add_simple_input_section. Change first parameter's
9209         type from Simple_input_section to Input_section and remove the
9210         second and third parameters.
9211         * script-sections.cc (Input_section::Input_section_list): Change
9212         type to list of Output_section::Input_section/
9213         (Input_section_info::Input_section_info): Change parameter type of
9214         INPUT_SECTION to Output_section::Input_section.
9215         (Input_section_info::input_section): Change return type.
9216         (Input_section_info::input_section_): Change type to
9217         Output_section::Input_section.
9218         (Output_section_element_input::set_section_addresses): Adjust code
9219         to use Output_section::Input_section instead of
9220         Output_section::Simple_input_section.  Adjust code for renaming
9221         of Output_section::add_simple_input_section.
9222         (Orphan_output_section::set_section_addresses): Ditto.
9223
9224 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9225
9226         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
9227         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
9228
9229 2010-05-18  Rafael Espindola  <espindola@google.com>
9230
9231         * options.cc (General_options::finalize): Handle -nostdlib.
9232         * options.h (nostdlib): New option.
9233         * script.cc (script_add_search_dir): Handle -nostdlib.
9234
9235 2010-05-12  Doug Kwan  <dougkwan@google.com>
9236
9237         * arm.cc (Target_arm::do_finalize_sections): Create an empty
9238         attributes section only if there no attributes section after merging.
9239         (Target_arm::merge_object_attributes): Move value of
9240         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
9241         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
9242         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
9243         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
9244         and arm_attr_merge_7.stdout.
9245         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
9246         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
9247         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
9248         arm_attr_merge_7b.o): New rules.
9249         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
9250         arm_attr_merge_7
9251         * testsuite/Makefile.in: Regenerate.
9252         * testsuite/arm_attr_merge.sh: New file.
9253         * testsuite/arm_attr_merge_[67][ab].s: Same.
9254
9255 2010-05-05  Nick Clifton  <nickc@redhat.com>
9256
9257         * po/es.po: Updated Spanish translation.
9258
9259 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
9260
9261         * Makefile.am (install-exec-local): Properly install gold as
9262         default cross linker.
9263         * Makefile.in: Regenerated.
9264
9265 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
9266             Nick Clifton  <nickc@redhat.com>
9267
9268         * configure.ac (install_as_default): Define and set to false
9269         unless --enable-gold or --enable-gold=both/gold has been
9270         specified.
9271         * configure: Regenerate.
9272
9273         * Makefile.am (install-exec-local): Install the executable as
9274         'ld.gold'.  If install_as_default is true then also install it as
9275         'ld'.
9276         * Makefile.in: Regenerated.
9277
9278 2010-04-24  Ian Lance Taylor  <iant@google.com>
9279
9280         * layout.cc (Layout::layout_reloc): In relocatable link don't
9281         combine reloc sections for grouped sections.
9282
9283 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
9284
9285         * gc.h (gc_process_relocs): Pass information on relocs pointing to
9286         sections that are not ordinary to icf.
9287         * icf.cc (get_section_contents): Handle relocation pointing to section
9288         with no object or shndx information.
9289         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
9290         * testsuite/Makefile.in: Regenerate.
9291         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
9292         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
9293
9294 2010-04-22  Ian Lance Taylor  <iant@google.com>
9295
9296         * expression.cc (Expression::Expression_eval_info): Add
9297         result_alignment_pointer field.
9298         (Expression::eval_with_dot): Add result_alignment_pointer
9299         parameter.  Change all callers.
9300         (Expression::eval_maybe_dot): Likewise.
9301         (class Binary_expression): Add alignment_pointer parameter to
9302         left_value and right_value.  Change all callers.
9303         (BINARY_EXPRESSION): Set result alignment.
9304         (class Trinary_expression): Add alignment_pointer parameter to
9305         arg2_value and arg3_value.  Change all callers.
9306         (Trinary_cond::value): Set result alignment.
9307         (Max_expression::value, Min_expression::value): Likewise.
9308         (Align_expression::value): Likewise.
9309         * script-sections.cc (class Sections_element): Add dot_alignment
9310         parameter to set_section_addresses virtual function.  Update
9311         instantiations.
9312         (class Output_section_element): Likewise.
9313         (Script_sections::create_segments): Add dot_alignment parameter.
9314         Change all callers.
9315         (Script_sections::create_segments_from_phdrs_clause): Likewise.
9316         (Script_sections::set_phdrs_clause_addresses): Likewise.
9317         * script-sections.h: Update declarations.
9318         * script.h: Update declarations.
9319         * output.h (Output_segment::set_minimum_p_align): Don't decrease
9320         min_p_align.
9321         * testsuite/script_test_3.t: Set large alignment.
9322         * testsuite/script_test_3.sh: Make sure that at least one LOAD
9323         segment has expected alignment.
9324
9325 2010-04-22  Nick Clifton  <nickc@redhat.com>
9326
9327         * po/gold.pot: Updated by the Translation project.
9328         * po/vi.po: Updated Vietnamese translation.
9329
9330 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
9331
9332         * testsuite/Makefile.am (check_PROGRAMS): Add
9333         icf_virtual_function_folding_test.
9334         * testsuite/Makefile.in: Regenerated.
9335
9336 2010-04-15  Andrew Haley  <aph@redhat.com>
9337
9338         * options.h (merge_exidx_entries): New option.
9339         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
9340         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
9341         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
9342         (Target_arm::merge_exidx_entries): New function.
9343         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
9344         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
9345         to Arm_exidx_fixup constructor.
9346         Add new arg, merge_exidx_entries.
9347         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
9348         Arm_output_section::fix_exidx_coverage.
9349
9350 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
9351
9352         * icf.cc (get_section_contents): Check for preemptible functions.
9353         Ignore addend when appropriate.
9354         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
9355         section folded.
9356         (add_from_relobj): Check for section folded.
9357         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
9358         * symtab.h (should_add_dynsym_entry): Add new parameter.
9359         * target-reloc.h (scan_relocs): Check for section folded.
9360         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
9361         Check reloc types for function pointers in shared objects.
9362         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
9363         case.
9364         (icf_preemptible_functions_test): New test case.
9365         (icf_string_merge_test): New test case.
9366         * testsuite.Makefile.in: Regenerate.
9367         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
9368         bar_glob.  Refactor code.
9369         * testsuite/icf_preemptible_functions_test.cc: New file.
9370         * testsuite/icf_preemptible_functions_test.sh: New file.
9371         * testsuite/icf_string_merge_test.cc: New file.
9372         * testsuite/icf_string_merge_test.sh: New file.
9373         * testsuite/icf_virtual_function_folding_test.cc: New file.
9374         * testsuite/icf_virtual_function_folding_test.sh: New file.
9375
9376 2010-04-14  Doug Kwan  <dougkwan@google.com>
9377
9378         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
9379         for local symbol recounting if we remove a section due to ICF.
9380         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
9381         there are no regular objects in input.
9382
9383 2010-04-13  Doug Kwan  <dougkwan@google.com>
9384
9385         * arm.cc (Arm_input_section::set_final_data_size): Compute
9386         accurate final data size instead of using current data size.
9387
9388 2010-04-09  Doug Kwan  <dougkwan@google.com>
9389
9390         * layout.cc (Layout::choose_output_section): Handle script section
9391         types.
9392         (Layout::make_output_section_for_script): Add section type parameter.
9393         Handle script section types.
9394         * layout.h (Layout::make_output_section_for_script): Add section
9395         type parameter.
9396         * output.cc (Output_section::Output_section): Initialize data member
9397         is_noload_.
9398         (Output_section::do_reset_address_and_file_offset): Do not set address
9399         to 0 if section is a NOLOAD section.
9400         * output.h (Output_section::is_noload): New method.
9401         (Output_section::set_is_noload): Ditto.
9402         (Output_section::is_noload_): New data member.
9403         * script-c.h (Script_section_type): New enum type.
9404         (struct Parser_output_section_header): Add new file section_type.
9405         * script-sections.cc (Sections_element::output_section_name): Add
9406         parameter for returning script section type.
9407         (Output_section_definition::output_section_name): Ditto.
9408         (Output_section_definition::section_type)P; New method.
9409         (Output_section_definiton::script_section_type_name): Ditto.
9410         (Output_section_definition::script_section_type_): New data member.
9411         (Output_section_definition::Output_section_definition): Initialize
9412         data member Output_section_definition::script_section_type_.
9413         (Output_section_definition::create_sections): Pass script section type
9414         to Layout::make_output_section_for_script.
9415         (Output_section_definition::output_section_name): Return script
9416         section type to caller.
9417         (Output_section_definition::set_section_address): Do not advance
9418         dot value and load address if section type is NOLOAD.  Set address
9419         of NOLOAD sections regardless of section flags.
9420         (Output_section_definition::print): Print section type if it is
9421         not SCRIPT_SECTION_TYPE_NONE.
9422         (Output_section_definition::section_type): New method.
9423         (Output_section_definition::script_section_type_name): Ditto.
9424         (Script_sections::output_section_name): Add new parameter
9425         PSECTION_TYPE for returning script section type.  Pass it to
9426         section elements.  Handle discard sections.
9427         (Sort_output_sections::operator()): Handle NOLOAD sections.
9428         * script-sections.h (Script_sections::Section_type): New enum type.
9429         (Script_sections::output_section_name): Add a new parameter for
9430         returning script section type.
9431         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
9432         INFO and NOLOAD.
9433         * yyscript.y (union): Add new field SECTION_TYPE.
9434         (COPY, DSECT, INFO, NOLOAD): New tokens.
9435         (opt_address_and_section_type): Change type to output_section_header.
9436         (section_type): New non-terminal
9437         (section_header): Handle section type.
9438         (opt_address_and_section_type): Return section type value.
9439
9440 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
9441
9442         * testsuite/plugin_common_test_1.c (foo): Add prototype.
9443         * testsuite/plugin_common_test_2.c (foo): Likewise.
9444
9445 2010-04-08  Doug Kwan  <dougkwan@google.com>
9446
9447         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
9448         Output_merge_data.
9449         * output.cc (Output_section::add_merge_input_section): Simplify
9450         code and return status of Output_merge_base::add_input_section.
9451         Update merge section map only if Output_merge_base::add_input_section
9452         returns true.
9453
9454 2010-04-07  Doug Kwan  <dougkwan@google.com>
9455
9456         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
9457         if section is marked as containing instructions but has no mapping
9458         symbols.
9459         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
9460         correct section index.
9461         (Arm_relobj::find_linked_text_section): Ditto.
9462
9463 2010-04-07  Cary Coutant  <ccoutant@google.com>
9464
9465         * archive.cc (include_member): Destroy Read_symbols_data object before
9466         releasing file.
9467         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
9468         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
9469         (Read_symbols_data::~Read_symbols_data) New destructor.
9470         (Section_relocs::Section_relocs) New constructor.
9471         (Section_relocs::~Section_relocs) New destructor.
9472         (Read_relocs_data::Read_relocs_data) New constructor.
9473         (Read_relocs_data::~Read_relocs_data) New destructor.
9474         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
9475         pointers to NULL after deleting.
9476
9477 2010-04-07  Doug Kwan  <dougkwan@google.com>
9478
9479         * arm.cc: Replace "endianity" with "endianness" in comments.
9480         (Arm_exidx_cantunwind): Ditto.
9481         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
9482         (Arm_relobj::merge_flags_and_attributes): New method.
9483         (Arm_relobj::merge_flags_and_attributes_): New data member.
9484         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
9485         (Arm_relobj::scan_sections_for_stubs): Ditto.
9486         (Arm_relobj::do_read_symbols): Check to see if we really want to
9487         merge processor-specific flags and attributes.  Exit early if
9488         an object is empty except for section names and the undefined symbol.
9489         (Target_arm::do_finalize_sections): Move check for ELF format to
9490         Arm_relobj::do_read_symbols.  Merge processor specific flags and
9491         attributes from a regular object only when we have determined that
9492         it is aapropriate.  Do not create an .ARM.attributes section in
9493         output if there is no regular input object.
9494         (Target_arm::merge_processor_specific_flags): Check
9495         --warn-mismatch before printing any error.
9496         (Target_arm::merge_object_attributes): Ditto.
9497         * gold.cc (queue_middle_tasks): Handle the case in which there is
9498         no regular object in input.
9499         * options.cc (General_options::parse_EB): New method.
9500         (General_options::parse_EL): Same.
9501         (General_options::General_options): Initialize endianness_.
9502         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
9503         New options.
9504         (General_options::Endianness): New enum.
9505         (General_options::endianness): New method.
9506         (General_options::endianness_): New data member.
9507         * parameters.cc (Parameters::set_options): Check target endianness.
9508         (Parameters::set_target_once): Ditto.
9509         (Parameters::check_target_endianness): New method.
9510         (parameters_force_valid_target): If either -EL or -EB is specified,
9511         use it to define endianness of default target.
9512         * parameters.h (Parameters::check_target_endianness): New method
9513         declaration.
9514         * target.h (class Target): Change "endianity" to "endianness"
9515         in comments.
9516
9517 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9518
9519         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
9520         * configure: Regenerate.
9521         * Makefile.in: Regenerate.
9522         * testsuite/Makefile.in: Regenerate.
9523
9524 2010-04-06  Cary Coutant  <ccoutant@google.com>
9525
9526         gcc PR lto/42757
9527         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
9528         prevailing definitions of common symbols.
9529         * testsuite/plugin_test_6.sh: New test case.
9530         * testsuite/plugin_common_test_1.c: New test case.
9531         * testsuite/plugin_common_test_2.c: New test case.
9532         * testsuite/Makefile.am (plugin_test_6): New test case.
9533         * testsuite/Makefile.in: Regenerate.
9534
9535 2010-04-06  Nick Clifton  <nickc@redhat.com>
9536
9537         * po/vi.po: New Vietnamese translation.
9538
9539 2010-03-30  Doug Kwan  <dougkwan@google.com>
9540
9541         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
9542
9543 2010-03-25  Doug Kwan  <dougkwan@google.com>
9544
9545         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
9546         to avoid a conversion warning on a 32-bit host.
9547
9548 2010-03-24  Ian Lance Taylor  <iant@google.com>
9549
9550         * testsuite/script_test_3.t: Add a TLS segment.
9551         * testsuite/Makefile.am (check_PROGRAMS): Add
9552         tls_phdrs_script_test.
9553         (tls_phdrs_script_test_SOURCES): Define.
9554         (tls_phdrs_script_test_DEPENDENCIES): Define.
9555         (tls_phdrs_script_test_LDFLAGS): Define.
9556         (tls_phdrs_script_test_LDADD): Define.
9557         * testsuite/Makefile.in: Rebuild.
9558
9559 2010-03-23  Cary Coutant  <ccoutant@google.com>
9560
9561         * fileread.cc (find_or_make_view): Fix comment.
9562
9563 2010-03-23  Ian Lance Taylor  <iant@google.com>
9564
9565         * script-sections.cc (class Orphan_section_placement): Define
9566         PLACE_TLS and PLACE_TLS_BSS.
9567         (Orphan_section_placement::Orphan_section_placement): Initialize
9568         new places.
9569         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
9570         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
9571         (tls_script_test_SOURCES): Define.
9572         (tls_script_test_DEPENDENCIES): Define.
9573         (tls_script_test_LDFLAGS): Define.
9574         (tls_script_test_LDADD): Define.
9575         * testsuite/Makefile.in: Rebuild.
9576
9577 2010-03-22  Doug Kwan  <dougkwan@google.com>
9578
9579         * arm.cc (Arm_relocate_functions::abs8,
9580         Arm_relocate_functions::abs16): Use correct check for overflow
9581         specified in the ARM ELF specs.
9582         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
9583         target of a BLX instruction specially.
9584         (Reloc_stub::stub_type_for_reloc): Ditto.
9585         (Relocate::relocate): Use symbolic names instead of numeric relocation
9586         codes to report error.
9587         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
9588         workaround.
9589         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
9590         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
9591         thumb2_blx_out_of_range.stdout
9592         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
9593         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
9594         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
9595         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
9596         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
9597         thumb2_blx_in_range, thumb2_blx_in_range.o,
9598         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
9599         thumb2_blx_out_of_range.o): New rules.
9600         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
9601         thumb2_blx_in_range and thumb2_blx_out_of_range.
9602         * testsuite/Makefile.in: Regenerate.
9603         * arm_branch_in_range.sh: Add tests for THUMB BLX.
9604         * testsuite/thumb_blx_in_range.s: New file.
9605         * testsuite/thumb_blx_out_of_range.s: New file.
9606
9607 2010-03-22  Rafael Espindola  <espindola@google.com>
9608
9609         * archive.cc (Should_include): Move to archive.h.
9610         (should_include_member): Make it a member of Archive.
9611         (Lib_group): New.
9612         (Add_lib_group_symbols): New.
9613         * archive.h: Include options.h.
9614         (Archive_member): Moved from Archive.
9615         (Should_include): Moved from archive.cc.
9616         (Lib_group): New.
9617         (Add_lib_group_symbols): New.
9618         * dynobj.cc (do_should_include_member): New.
9619         * dynobj.h (do_should_include_member): New.
9620         * gold.cc (queue_initial_tasks): Update call to queue.
9621         * main.cc (main): Print lib group stats.
9622         * object.cc (do_should_include_member): New.
9623         * object.h: Include archive.h.
9624         (Object::should_include_member): New.
9625         (Object::do_should_include_member): New.
9626         (Sized_relobj::do_should_include_member): New.
9627         * options.cc (General_options::parse_start_lib): New.
9628         (General_options::parse_end_lib): New.
9629         (Input_arguments::add_file): Handle lib groups.
9630         (Input_arguments::start_group): Check we are not in a lib.
9631         (Input_arguments::start_lib): New.
9632         (Input_arguments::end_lib): New.
9633         * options.h (General_options): Add start_lib and end_lib.
9634         (Input_argument::lib_): New.
9635         (Input_argument::lib): New.
9636         (Input_argument::is_lib): New.
9637         (Input_file_lib): New.
9638         (Input_arguments::in_lib_): New.
9639         (Input_arguments::in_lib): New.
9640         (Input_arguments::start_lib): New.
9641         (Input_arguments::end_lib_): New.
9642         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
9643         in unused members as preempted.
9644         (Sized_pluginobj::do_should_include_member): New.
9645         * plugin.h (Sized_pluginobj::do_should_include_member): New.
9646         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
9647         return the blocker.
9648         (Read_symbols::do_whole_lib_group): New.
9649         (Read_symbols::do_lib_group): New.
9650         (Read_symbols::do_read_symbols): Handle lib groups.
9651         (Read_symbols::get_name): Handle lib groups.
9652         * readsyms.h (Read_symbols): Add an archive member pointer.
9653         (Read_symbols::do_whole_lib_group): New.
9654         (Read_symbols::do_lib_group): New.
9655         (Read_symbols::member_): New.
9656         * script.cc (read_input_script): Update call to queue_soon.
9657
9658 2010-03-19  Doug Kwan  <dougkwan@google.com>
9659
9660         * arm.cc (Stub_table::Stub_table): Initialize new data members
9661         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9662         (Stub_table::add_reloc_stub): Assign stub offset and update
9663         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9664         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
9665         New data members.
9666         (Stub_table::update_data_size_and_addralign): Use
9667         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
9668         instead of going over all reloc stubs.
9669         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
9670         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9671         Stringpool_template::offset_ to size of Stringpool_char.
9672         (Stringpool_template::new_key_offset): Remove code to initialize
9673         Stringpool_template::offset_.
9674         * stringpool.h (Stringpool_template::set_no_zero_null): Set
9675         Stringpool_template::offset_ to zero.
9676
9677 2010-03-15  Doug Kwan  <dougkwan@google.com>
9678
9679         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9680         offset_.
9681         (Stringpool_template::new_key_offset): New method.
9682         (Stringpool_template::add_string): Assign offsets when adding new
9683         strings.
9684         (Stringpool_template::set_string_offsets): Do not set string offsets
9685         when not optimizing.
9686         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
9687         member size_.
9688         (Chunked_vector::clear): Clear size_.
9689         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
9690         (Chunked_vector::size): Return size_.
9691         (Chunked_vector::push_back): Use size_ to find insert position.
9692         (Chunked_vector::size_): New data member.
9693         (Stringpool_template::set_no_zero_null): Assert string set is empty.
9694         (Stringpool_template::new_key_offset): New method declaration.
9695         (Stringpool_template::offset_): New data member.
9696
9697 2010-03-15   Rafael Espindola  <espindola@google.com>
9698
9699         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
9700         Add_symbols' constructor.
9701         * readsyms.h (Add_symbols): Remove the input_group member.
9702
9703 2010-03-10  Ian Lance Taylor  <iant@google.com>
9704
9705         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
9706         target to ask whether a reference to a symbol requires a stack
9707         split.
9708         * target.h (Target::is_call_to_non_split): New function.
9709         (Target::do_is_call_to_non_split): Declare virtual function.
9710         * target.cc: Include "symtab.h".
9711         (Target::do_is_call_to_non_split): New function.
9712         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
9713
9714 2010-03-10  Cary Coutant  <ccoutant@google.com>
9715
9716         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
9717         (File_read::open[1]): Remove initial mapping of whole_file_view_.
9718         (File_read::open[2]): Add whole_file_view_ to list of views.
9719         (File_read::make_view): Remove test of whole_file_view_.
9720         (File_read::find_or_make_view): Create whole_file_view_ if
9721         necessary.
9722         (File_read::clear_views): Replace bool parameter with enum;
9723         adjust all callers.  Don't delete views with permanent data;
9724         do delete cached views and views from archives if
9725         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
9726         if clearing the corresponding view.
9727         * fileread.h (File_read::Clear_views_mode): New enum.
9728         (File_read::View::is_permanent_view): New method.
9729         (File_read::clear_views): Replace bool parameter
9730         with enum; adjust all callers.
9731         * options.h (General_options): Change keep_files_mapped option;
9732         add map_whole_files.
9733         * readsyms.cc (Add_symbols::run): Delete sd_ object before
9734         releasing the file.
9735         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
9736         the file.
9737
9738 2010-03-10  David S. Miller  <davem@davemloft.net>
9739
9740         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
9741
9742 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
9743
9744         * icf.cc (get_section_contents): Add '@' marker after processing the
9745         merge reloc.
9746
9747 2010-03-08  Doug Kwan  <dougkwan@google.com>
9748
9749         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
9750         due to a conversion warning.
9751         (Arm_relobj::update_output_local_symbol_count): Check for local
9752         symbol with unset output index.
9753
9754 2010-03-05  Ian Lance Taylor  <iant@google.com>
9755
9756         * options.h (class General_options): Add --spare-dynamic-tags.
9757         * output.cc (Output_data_dynamic::set_final_data_size): Implement
9758         --spare-dynamic-tags.
9759
9760 2010-03-05  Ian Lance Taylor  <iant@google.com>
9761
9762         * incremental.cc: Include "libiberty.h".
9763
9764 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
9765
9766         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
9767         function, is_info_ member.
9768         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
9769         (Versions::Versions): Update caller.
9770         (Versions::define_base_version): Likewise.
9771         (Versions::add_def): Likewise.
9772
9773 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
9774
9775         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
9776         (Scan::possible_function_pointer_reloc): New function.
9777         (Scan::local_reloc_may_be_function_pointer): Change to call
9778         possible_function_pointer_reloc.
9779         (Scan::global_reloc_may_be_function_pointer): Ditto.
9780         * icf.h (Icf::check_section_for_function_pointers): Change to reject
9781         relocations in ".data.rel.ro._ZTV" section.
9782         * testsuite/icf_safe_so_test.sh: Change to pass i386.
9783         * testsuite/icf_safe_so_test.cc: Ditto.
9784         * testsuite/icf_safe_test.cc: Ditto.
9785         * testsuite/icf_safe_test.sh: Ditto.
9786
9787 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9788             Ian Lance Taylor  <iant@google.com>
9789
9790         * target-reloc.h (relocate_section): Check the symbol table index
9791         for -1U before setting the local symbol index.
9792         (scan_relocatable_relocs): If copying the relocation, record that
9793         the local symbol is required.
9794         * object.h (Symbol_value::is_output_symtab_index_set): New
9795         function.
9796         (Symbol_value::may_be_discarded_from_output_symtab): New
9797         function.
9798         (Symbol_value::has_output_symtab_entry): New function.
9799         (Symbol_value::needs_output_symtab_entry): Remove.
9800         (Symbol_value::output_symtab_index): Make sure the symbol index is
9801         set.
9802         (Symbol_value::set_output_symtab_index): Make sure the symbol
9803         index is not set.  Make sure the new index is valid.
9804         (Symbol_value::set_must_have_output_symtab_entry): New function.
9805         (Symbol_value::has_output_dynsym_entry): New function.
9806         (Symbol_value::set_output_dynsym_index): Make sure the new index
9807         is valid.
9808         (Sized_relobj::set_must_have_output_symtab_entry): New function.
9809         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
9810         local symbol if permitted.
9811         (Sized_relobj::do_finalize_local_symbols): Call
9812         is_output_symtab_index_set rather than needs_output_symtab_entry.
9813         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
9814         rather than needs_output_symtab_entry.  Call
9815         has_output_dynsym_entry rather than needs_output_dynsym_entry.
9816         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
9817         is_output_symtab_index_set rather than needs_output_symtab_entry.
9818         * testsuite/discard_locals_relocatable_test.c: New file.
9819         * testsuite/discard_locals_test.sh: Test -r.
9820         * testsuite/Makefile.am (check_DATA): Add
9821         discard_locals_relocatable_test1.syms,
9822         discard_local_relocatable_test2.syms.
9823         (MOSTLYCLEANFILES): Likewise.  Also add
9824         discard_locals_relocatable_test1.lout and
9825         discard_locals_relocatable_test2.out.
9826         (discard_locals_relocatable_test1.syms): New target.
9827         (discard_locals_relocatable_test.o): New target.
9828         (discard_locals_relocatable_test1.out): New target.
9829         (discard_locals_relocatable_test2.syms): New target.
9830         (discard_locals_relocatable_test2.out): New target.
9831         (various): Add missing ../ld-new dependencies.
9832         * testsuite/Makefile.in: Rebuild.
9833
9834 2010-03-03  Nick Clifton  <nickc@redhat.com>
9835
9836         * po/fi.po: New Finnish translation.
9837
9838 2010-03-01  Doug Kwan  <dougkwan@google.com>
9839
9840         * layout.cc (Layout::Layout): Force section types of .init_array*,
9841         .preinit_array* and .fini_array* sections.
9842         * output.cc (Output_section::Input_section_sort_entry::has_priority):
9843         Fix check of return value of std::string::find.().
9844         (Output_section::Input_section_sort_compare::operator()): Remove
9845         comment about .init_array.
9846         (Output_section::Input_section_sort_init_fini_compare::operator()):
9847         New method.
9848         (Output_section::sort_attached_input_sections): Handle .init_array
9849         and .fini_array specially.
9850         * output.h (Output_section::Inut_section_sort_compare): Update
9851         comment.
9852         (Output_section::Input_section_sort_init_fini_compare): New struct.
9853
9854 2010-02-26  Doug Kwan  <dougkwan@google.com>
9855
9856         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9857         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9858         * testsuite/debug_msg.sh: Avoid matching source line number for
9859         use of global variable undef_int.
9860
9861 2010-02-26  Doug Kwan  <dougkwan@google.com>
9862
9863         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9864         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9865         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9866         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9867         * options.cc (General_options::General_options): Initialize member
9868         fix_v4bx_.
9869         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9870         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9871         and rm_no_fix_v4bx.stdout
9872         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9873         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9874         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9875         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9876         and arm_no_fix_v4bx.
9877         * Makefile.in: Regenerate.
9878         * testsuite/arm_fix_v4bx.s: New file.
9879         * testsuite/arm_fix_v4bx.sh: Ditto.
9880
9881 2010-02-24  Doug Kwan  <dougkwan@google.com>
9882
9883         * arm.cc (Target_arm::got_section): Make the .got section the first
9884         non RELRO section in the data segment.
9885         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9886         suffixes of section names.
9887
9888 2010-02-24  Doug Kwan  <dougkwan@google.com>
9889
9890         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
9891         flags and attributes merging if an input file is a binary file.
9892         * fileread.cc (Input_file::open): Record format of original file.
9893         * fileread.h (Input_file::Format): New enum type.
9894         (Input_file::Input_file): Initialize data member format_.
9895         (Input_file::format): New method definition.
9896         (Input_file::format_):: New data member.
9897
9898 2010-02-24  Doug Kwan  <dougkwan@google.com>
9899
9900         * arm.cc (Arm_output_data_got): New class.
9901         (ARM_TCB_SIZE): New constant
9902         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
9903         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
9904         If user uses a script with a SECTIONS clause, issue only a warning
9905         for a misplaced EXIDX input section.  Otherwise, issue an error.
9906         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
9907         garbage collection.
9908         (Target_arm::got_mode_index_entry): Handle static linking.
9909         (Target_arm::Scan::local): Ditto.
9910         (Target_arm::Scan::global): Ditto.
9911         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
9912         all incorrectly implemented relocations.
9913         (Target_arm::fix_exidx_coverage): Pass layout to
9914         Arm_output_section::fix_exidx_coverage.
9915         * layout.cc (Layout::section_name_mapping): Remove trailing dots
9916         from ".ARM.exidx." and ".ARM.extab.".
9917
9918 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9919
9920         * arm.cc (Target_arm::do_finalize_sections): Create attribute
9921         section if it does not already exist.
9922         * attributes.cc (Attributes_section_data::Attributes_section_data):
9923         Don't crash if size is zero.
9924
9925 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9926             Ian Lance Taylor  <iant@google.com>
9927
9928         * gold.cc (queue_middle_tasks): If no input files were opened,
9929         exit.
9930         * workqueue.h (Task_function::Task_function): Assert that there is
9931         a blocker.
9932
9933 2010-02-22  Doug Kwan  <dougkwan@google.com>
9934
9935         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
9936         * icf.cc (get_section_contents): Cast snprintf arguments to long long
9937         types to avoid warnings due to different uint64_t implementations
9938         on different hosts.
9939
9940 2010-02-21  Doug Kwan  <dougkwan@google.com>
9941
9942         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
9943         handling of the maximum backward branch offset.
9944         (Arm_relocate_functions::thumb_branch_common): Ditto.
9945         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
9946         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
9947         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
9948         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
9949         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
9950         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
9951         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
9952         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
9953         thumb_bl_out_of_range thumb_bl_out_of_range.o,
9954         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
9955         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
9956         thumb2_bl_out_of_range.o): New rules.
9957         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
9958         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
9959         thumb2_bl_out_of_range
9960         * testsuite/Makefile.in: Regenerate.
9961         * testsuite/arm_bl_in_range.s: New file.
9962         * testsuite/arm_bl_out_of_range.s: Ditto.
9963         * testsuite/arm_branch_in_range.sh: Ditto.
9964         * testsuite/arm_branch_range.t: Ditto.
9965         * testsuite/thumb2_branch_range.t: Ditto.
9966         * testsuite/thumb_bl_in_range.s: Ditto.
9967         * testsuite/thumb_bl_out_of_range.s: Ditto.
9968         * testsuite/thumb_branch_range.t: Ditto.
9969
9970 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
9971
9972         * gc.h (gc_process_relocs): Change vectors to point to the new list.
9973         Add reloc offset information.
9974         * icf.cc (get_section_contents): Change iterators to point to the new
9975         vectors. Add reloc offset information to the contents.
9976         * icf.h (Icf::Sections_reachable_info): New typedef.
9977         (Icf::Sections_reachable_list): New typedef.
9978         (Icf::Offset_info): New typedef.
9979         (Icf::Reloc_info): New struct typedef.
9980         (Icf::Reloc_info_list): New typedef.
9981         (Icf::symbol_reloc_list): Delete method.
9982         (Icf::addend_reloc_list): Delete method.
9983         (Icf::section_reloc_list): Delete method.
9984         (Icf::reloc_info_list): New method.
9985         (Icf::reloc_info_list_): New member.
9986
9987 2010-02-19  Doug Kwan  <dougkwan@google.com>
9988
9989         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9990         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9991         * arm.cc (Arm_relocation_functions): New forward declaration.
9992         (Target_arm::Target_arm): Initialize new data members
9993         got_mod_index_offset_ and tls_base_symbol_defined_.
9994         (Target_arm::Relocate::relocate_tls): New method.
9995         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9996          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9997         New methods.
9998         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9999         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
10000         (Target_arm::got_mod_index_offset_,
10001         Target_arm::tls_base_symbol_defined_): New data members.
10002         (Target_arm::Scan::local, Target::Scan::global,
10003         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
10004         relocations.
10005
10006 2010-02-18  Doug Kwan  <dougkwan@google.com>
10007
10008         * arm.cc (Arm_relobj::find_linked_text_section): New method.
10009         (Arm_relobj::make_exidx_input_section): Pass section index of linked
10010         text section as a parameter becuase some broken tools may not set
10011         the link in section header.
10012         (Target_arm::has_got_section): New method.
10013         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
10014         without any mapping symbol as data only.  Remove warning.
10015         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
10016         link in its section header, try to discover the link by inspecting the
10017         REL31 relocation at the beginning of the section.
10018         (Target_arm::Scan::check_non_pic): Report name of offending relocation
10019         in error message.
10020         (Target_arm::Scan::global): Treat any reference to the symbol
10021         _GLOBAL_OFFSET_TABLE_ as a GOT access.
10022
10023 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
10024
10025         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
10026         (Scan::global_reloc_may_be_function_pointer): New function.
10027         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10028         (Scan::global_reloc_may_be_function_pointer): New function.
10029         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10030         (Scan::global_reloc_may_be_function_pointer): New function.
10031         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
10032         (Scan::global_reloc_may_be_function_pointer): New function.
10033         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
10034         (Scan::global_reloc_may_be_function_pointer): New function.
10035         (Scan::possible_function_pointer_reloc): New function.
10036         (Target_x86_64::can_check_for_function_pointers): New function.
10037         * gc.h (gc_process_relocs): Scan relocation types to determine if
10038         function pointers were taken for targets that support it.
10039         * icf.cc (Icf::find_identical_sections): Include functions for
10040         folding in safe ICF whose pointer is not taken.
10041         * icf.h (Secn_fptr_taken_set): New typedef.
10042         (fptr_section_id_): New member.
10043         (section_has_function_pointers): New function.
10044         (set_section_has_function_pointers): New function.
10045         (check_section_for_function_pointers): New function.
10046         * options.h: Fix comment for safe ICF option.
10047         * target.h (can_check_for_function_pointers): New function.
10048         * testsuite/Makefile.am: Add icf_safe_so_test test case.
10049         Modify icf_safe_test for X86-64.
10050         * testsuite/Makefile.in: Regenerate.
10051         * testsuite/icf_safe_so_test.cc: New file.
10052         * testsuite/icf_safe_so_test.sh: New file.
10053         * testsuite/icf_safe_test.cc (kept_func_3): New function.
10054         (main): Change to take pointer to function kept_func_3.
10055         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
10056         folding is done correctly for X86-64.
10057
10058 2010-02-12  David S. Miller  <davem@davemloft.net>
10059
10060         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
10061         is_symbolless parameter.
10062         (Output_reloc<SHT_REL>::is_symbolless): New.
10063         (Output_reloc<SHT_REL>::is_symbolless_): New.
10064         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
10065         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
10066         (Output_reloc<SHT_RELA>::is_symbolless): New.
10067         (Output_data_reloc::add_global): Handle is_symbolless.
10068         (Output_data_reloc::add_global_relative): Likewise.
10069         (Output_data_reloc::add_local): Likewise.
10070         (Output_data_reloc::add_local_relative): Likewise.
10071         (Output_data_reloc::add_symbolless_global_addend): New.
10072         (Output_data_reloc::add_symbolless_local_addend): New.
10073         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
10074         is_symbolless.
10075         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
10076         instead of ->is_relative_
10077         (Output_reloc::write): Likewise.
10078         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
10079         (Output_reloc::write_rel): Simplify.
10080
10081         * sparc.cc (Target_sparc::Scan::local): Use
10082         ->add_symbolless_local_addend as needed.
10083         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
10084         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
10085         based upon relocation offset.
10086
10087 2010-02-11  Doug Kwan  <dougkwan@google.com>
10088
10089         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
10090         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
10091         beginning of function.
10092         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
10093         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
10094         parameter is_32bit in calls to should_apply_static_reloc.
10095         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
10096         (check_DATA): Add arm_abs_global.stdout.
10097         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
10098         arm_abs_global.stdout): New rules.
10099         (MOSTLLYCLEANFILES): Add arm_abs_global
10100         * Makefile.in: Regenerate.
10101         * testsuite/arm_abs_global.s: New file.
10102         * testsuite/arm_abs_global.sh: Ditto.
10103         * testsuite/arm_abs_lib.s: Ditto.
10104
10105 2010-02-11  Ian Lance Taylor  <iant@google.com>
10106
10107         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
10108         Read_relocs task.
10109         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
10110         Allocate_commons_task first.
10111         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
10112         task, rather than symtab_lock_.
10113         (Gc_process_relocs::~Gc_process_relocs): New function.
10114         (Gc_process_relocs::is_runnable): Check this_blocker_.
10115         (Gc_process_relocs::locks): Use next_blocker_ rather than
10116         blocker_.
10117         (Scan_relocs::~Scan_relocs): New function.
10118         (Scan_relocs::is_runnable): Check this_blocker_ rather than
10119         symtab_lock_.
10120         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
10121         next_blocker_.
10122         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
10123         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
10124         constructor accordingly.
10125         (class Gc_process_relocs): Likewise.
10126         (class Scan_relocs): Likewise.
10127         * common.h (class Allocate_commons_task): Remove symtab_lock_
10128         field, and corresponding constructor parameter.
10129         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
10130         symtab_lock_.
10131         (Allocate_commons_task::locks): Likewise.
10132
10133 2010-02-11  Ian Lance Taylor  <iant@google.com>
10134
10135         * gold-threads.h (class Once): Define.
10136         (class Initialize_lock): Rewrite as child of Once.
10137         * gold-threads.cc (class Once_initialize): Define.
10138         (once_pointer_control): New static variable.
10139         (once_pointer, once_arg): New static variables.
10140         (c_run_once): New static function.
10141         (Once::Once, Once::run_once, Once::internal_run): New functions.
10142         (class Initialize_lock_once): Remove.
10143         (initialize_lock_control): Remove.
10144         (initialize_lock_pointer): Remove.
10145         (initialize_lock_once): Remove.
10146         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
10147         (Initialize_lock::initialize): Rewrite.
10148         (Initialize_lock::do_run_once): New function.
10149         * archive.cc (Archive::interpret_header): Only clear name if it is
10150         not already empty.
10151         * fileread.cc: Include "gold-threads.h"
10152         (file_counts_lock): New static variable.
10153         (file_counts_initialize_lock): Likewise.
10154         (File_read::release): Only increment counts when using --stats.
10155         Use a lock around the increment.
10156         * parameters.cc (class Set_parameters_target_once): Define.
10157         (set_parameters_target_once): New static variable.
10158         (Parameters::Parameters): Move here from parameters.h.
10159         (Parameters::set_target): Rewrite.
10160         (Parameters::set_target_once): New function.
10161         (Parameters::clear_target): Move here and rewrite.
10162         * parameters.h (class Parameters): Update declarations.  Add
10163         set_parameters_target_once_ field.
10164         (Parameters::Parameters): Move to parameters.cc.
10165         (Parameters::clear_target): Likewise.
10166         * readsyms.cc (Read_symbols::do_group): Create a Start_group
10167         task.
10168         (Start_group::~Start_group): New function.
10169         (Start_group::is_runnable): New function.
10170         (Start_group::locks, Start_group::run): New functions.
10171         (Finish_group::run): Change saw_undefined to size_t.
10172         * readsyms.h (class Start_group): Define.
10173         (class Finish_group): Change saw_undefined_ field to size_t.
10174         (Finish_group::Finish_group): Remove saw_undefined and
10175         this_blocker parameters.  Change all callers.
10176         (Finish_group::set_saw_undefined): New function.
10177         (Finish_group::set_blocker): New function.
10178         * symtab.h (class Symbol_table): Change saw_undefined to return
10179         size_t.  Change saw_undefined_ field to size_t.
10180         * target-select.cc (Set_target_once::do_run_once): New function.
10181         (Target_selector::Target_selector): Initialize set_target_once_
10182         field.  Don't initialize lock_ and initialize_lock_ fields.
10183         (Target_selector::instantiate_target): Rewrite.
10184         (Target_selector::set_target): New function.
10185         * target-select.h (class Set_target_once): Define.
10186         (class Target_selector): Update declarations.  Make
10187         Set_target_once a friend.  Remove lock_ and initialize_lock_
10188         fields.  Add set_target_once_ field.
10189
10190 2010-02-10  Ian Lance Taylor  <iant@google.com>
10191
10192         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
10193         queueing any tasks.
10194         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
10195         (queue_middle_tasks): Add all blockers before queueing any tasks.
10196         (queue_final_tasks): Likewise.
10197         * token.h (Task_token::add_blockers): New function.
10198         * object.h (Input_objects::number_of_relobjs): New function.
10199
10200 2010-02-10  Ian Lance Taylor  <iant@google.com>
10201
10202         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
10203         shared, not if not position independent.
10204         * x86_64.cc (Relocate::relocate_tls): Likewise.
10205         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
10206         (tls_pie_pic_test): New target.
10207         * testsuite/Makefile.in: Rebuild.
10208
10209         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
10210         (tls_test_main_pie.o, tls_test_pie.o): New targets.
10211         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
10212         * testsuite/Makefile.in: Rebuild.
10213
10214 2010-02-09  David S. Miller  <davem@davemloft.net>
10215
10216         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
10217         R_SPARC_RELATIVE using ->add_local_relative().
10218         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
10219
10220         * output.h (Output_data_dynamic::add_section_size): New method
10221         that takes two Output_data objects.
10222         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
10223         entry param.  Handle it in initializers.
10224         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
10225         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
10226         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
10227         arg.
10228         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
10229         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
10230         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
10231         for dynrel_includes_plt.
10232         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10233         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10234         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
10235         before .rela.plt
10236         (Target_sparc::do_finalize_sections): Update to pass true for
10237         dynrel_includes_plt.
10238         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
10239         output before .rela.plt
10240         (Target_powerpc::do_finalize_sections): Update to pass true for
10241         dynrel_includes_plt when 32-bit.
10242
10243 2010-02-08  Doug Kwan  <dougkwan@google.com>
10244
10245         * arm.cc (Arm_relobj::simple_input_section_output_address): New
10246         method.
10247         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
10248         Arm_relobj::scan_section_for_cortex_a8_stubs,
10249         Arm_relobj::do_relocation_section): Instead of calling
10250         Output_section::output_address, use faster
10251         Arm_relobj::simple_input_section_output_address.
10252
10253 2010-02-08  David S. Miller  <davem@davemloft.net>
10254
10255         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
10256         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
10257         relocation helper function.
10258
10259         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
10260         just like R_SPARC_GOT{10,13,22}.
10261         (Target_sparc::Scan::local): Likewise.
10262         (Target_sparc::Relocate:relocate): Likewise.
10263
10264 2010-02-06  Ian Lance Taylor  <iant@google.com>
10265
10266         * configure.ac: Rewrite targetobjs duplicate removal code to use
10267         only shell constructs.
10268         * configure: Rebuild.
10269
10270 2010-02-05  Doug Kwan  <dougkwan@google.com>
10271
10272         PR 11247
10273         * arm.cc (Arm_relobj::section_is_scannable): New method.
10274         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
10275         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
10276
10277 2010-02-04  Doug Kwan  <dougkwan@google.com>
10278
10279         PR 11247
10280         * arm-reloc-property.cc (cstdio): Include.
10281         * configure.ac (targetobjs): Remove duplicates.
10282         * configure: Regenerate.
10283         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
10284         big and little endian version for a given address size.
10285
10286 2010-02-03  Doug Kwan  <dougkwan@google.com>
10287
10288         * arm-reloc-property.cc
10289         (Arm_reloc_property_table::reloc_name_in_error_message): New method
10290         definition.
10291         * arm-reloc-property.h
10292         (Arm_reloc_property_table::get_implemented_static_reloc_property):
10293         New method definition.
10294         (Arm_reloc_property_table::reloc_name_in_error_message): New method
10295         declaration.
10296         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
10297         overflow to N.
10298         (GOT_PREL): Change implemented to Y.
10299         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
10300         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
10301         (Arm_relocate_functions::movw_abs_nc): Remove method.
10302         (Arm_relocate_functions::movt_abs): Ditto.
10303         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
10304         (Arm_relocate_functions::thm_movt_abs): Ditto.
10305         (Arm_relocate_functions::movw_rel_nc): Ditto.
10306         (Arm_relocate_functions::movw_rel): Ditto.
10307         (Arm_relocate_functions::movt_rel): Ditto.
10308         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
10309         (Arm_relocate_functions:thm_movw_rel): Ditto.
10310         (Arm_relocate_functions:thm_movt_rel): Ditto.
10311         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
10312         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
10313         New method definitions.
10314         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
10315         (Arm_relocation_functions::arm_grp_ldr): Ditto.
10316         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
10317         (Arm_relocation_functions::arm_grp_ldc): Ditto.
10318         (Target_arm::Relocate::relocate): Check for non-static or
10319         unimplemented relocation code and exit early.  Change calls to
10320         Target_arm::reloc_uses_thumb_bit and
10321         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
10322         instead.  Refactor code to handle similar relocations to increase
10323         code sharing.  Remove check for unsupported relocation code in switch
10324         statement.
10325         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
10326         relocation property table to find out size.  Change error message to
10327         print out the name of a relocation code instead of the numeric value.
10328         (Target_arm::scan_reloc_for_stub): Use relocation property table
10329         instead of calling Target_arm::reloc_uses_thumb_bit().
10330
10331 2010-02-02  Doug Kwan  <dougkwan@google.com>
10332
10333         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
10334         types of relaxed input section.
10335
10336 2010-02-02  Doug Kwan  <dougkwan@google.com>
10337
10338         * Makefile.am (HFILES): Add arm-reloc-property.h.
10339         (DEFFILES): New.
10340         (TARGETSOURCES): Add arm-reloc-property.cc
10341         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
10342         (libgold_a_SOURCES): $(DEFFILES)
10343         * Makefile.in: Regenerate.
10344         * arm-reloc-property.cc: New file.
10345         * arm-reloc-property.h: New file.
10346         * arm-reloc.def: New file.
10347         * arm.cc: Update comments.
10348         (arm-reloc-property.h): New included header.
10349         (arm_reloc_property_table): New global variable.
10350         (Target_arm::do_select_as_default_target): New method definition.
10351         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
10352         arm-reloc-property to targ_extra_obj.
10353         * parameters.cc (set_parameters_target): Call
10354         Target::select_as_default_target().
10355         * target.h (Target::select_as_default_target): New method definition.
10356         (Target::do_select_as_default_target): Same.
10357
10358 2010-02-01  Doug Kwan  <dougkwan@google.com>
10359
10360         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
10361         first_output_text_section_.
10362         (Arm_exidx_fixup::first_output_text_section): New method definition.
10363         (Arm_exidx_fixup::first_output_text_section_): New data member.
10364         (Arm_exidx_fixup::process_exidx_section): Record the first text
10365         output section seen.
10366         (Arm_output_section::fix_exidx_coverage): Set correct linked section
10367         and entsize in output section header.
10368
10369 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10370
10371         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
10372         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
10373         (Arm_relocate_functions::thm_alu11): New Method.
10374         (Arm_relocate_functions::thm_pc8): New Method.
10375         (Arm_relocate_functions::thm_pc12): New Method.
10376         (Target_arm::Scan::local): Handle the relocations.
10377         (Target_arm::Scan::global): Likewise.
10378         (Target_arm::Relocate::relocate): Likewise.
10379         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10380
10381 2010-01-29  Doug Kwan  <dougkwan@google.com>
10382
10383         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
10384         of relocation types as ld.
10385
10386 2010-01-29  Doug Kwan  <dougkwan@google.com>
10387
10388         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
10389         to public.
10390         (Arm_relocate_functions::thumb_branch_common): Ditto.
10391         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
10392         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
10393         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
10394         Arm_relocate_functions::jump24): Remove.
10395         (Target_arm::Relocate::relocate): Adjust code to call
10396         Arm_relocation_functions::arm_branch_common and
10397         Arm_relocation_functions::thumb_branch_common instead of their removed
10398         wrappers.  Merge switch-cases together to reduce source code size.
10399
10400 2010-01-29  Doug Kwan  <dougkwan@google.com>
10401
10402         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
10403         output_local_symbol_count_needs_update_.
10404         (Arm_relobj::output_local_symbol_count_needs_update,
10405          Arm_relobj::set_output_local_symbol_count_needs_update,
10406          Arm_relobj::update_output_local_symbol_count): New methods.
10407         (Arm_relobj::output_local_symbol_count_needs_update_): New data
10408         member.
10409         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
10410         of pointed function as in a R_ARM_PREL31 relocation.
10411         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
10412         for output local symbol count updating.
10413         (Target_arm::do_relax): Update output local symbol counts in objects
10414         if necessary.
10415         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
10416
10417 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10418
10419         * arm.cc: Added support for the ARM relocations:
10420         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
10421         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
10422         (Arm_relocate_functions::movw_rel_nc): Renamed (was
10423         movw_prel_nc).
10424         (Arm_relocate_functions::movw_rel): New method.
10425         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
10426         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
10427         thm_movw_prel_nc).
10428         (Arm_relocate_functions::thm_movw_rel): New method.
10429         (Arm_relocate_functions::thm_movt_rel): Renamed (was
10430         thm_movt_prel).
10431         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
10432         relocations.
10433         (Target_arm::Scan::global): Likewise.
10434         (Target_arm::Relocate::relocate): Likewise.
10435         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10436         Likewise.
10437
10438 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10439
10440         * arm.cc: Added support for ARM group relocations.
10441         (Target_arm::reloc_needs_sym_origin): New method.
10442         (Arm_relocate_functions::calc_grp_kn): New method.
10443         (Arm_relocate_functions::calc_grp_residual): New method.
10444         (Arm_relocate_functions::calc_grp_gn): New method.
10445         (Arm_relocate_functions::arm_grp_alu): New Method.
10446         (Arm_relocate_functions::arm_grp_ldr): New Method.
10447         (Arm_relocate_functions::arm_grp_ldrs): New Method.
10448         (Arm_relocate_functions::arm_grp_ldc): New Method.
10449         (Target_arm::Scan::local): Handle the ARM group relocations.
10450         (Target_arm::Scan::global): Likewise.
10451         (Target_arm::Relocate::relocate): Likewise.
10452         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10453         Likewise.
10454
10455 2010-01-26  Doug Kwan  <dougkwan@google.com>
10456
10457         * arm.cc (set): Include.
10458         (class Arm_exidx_fixup): Change type of last_input_section_ to const
10459         pointer type.
10460         (Arm_output_section::Text_section_list): New type.
10461         (Arm_output_section::append_text_sections_to_list): New method.
10462         (Arm_output_section::fix_exidx_coverage): Ditto.
10463         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
10464         (Arm_relobj::convert_input_section_to_relaxed_section): Use
10465         Relobj::set_section_offset() instead of
10466         Sized_relobj::invalidate_section_offset().
10467         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
10468         parameter for section headers. Ignore relocation sections for
10469         unallocated sections and EXIDX sections.
10470         (Target_arm::fix_exidx_coverage): New method.
10471         (Target_arm::output_section_address_less_than): New type.
10472         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
10473         linked text section instead of the EXIDX section.
10474         (Arm_output_section::create_stub_group): Add an assertion to check
10475         that this is not an EXIDX output section.
10476         (Arm_output_section::append_text_sections_to_list): New method.
10477         (Arm_output_section::fix_exidx_coverage): Ditto.
10478         (Arm_relobj::scan_sections_for_stubs): Adjust call to
10479         Arm_relobj::section_needs_reloc_stub_scanning.
10480         (Target_arm::do_relax): Fix EXIDX output section coverage in the
10481         first pass.
10482         (Target_arm::fix_exidx_coverage): New method.
10483         * object.h (Relobj::set_output_section): New method.
10484         (Sized_relobj::invalidate_section_offset): Remove method.
10485         (Sized_relobj::do_invalidate_section_offset): Remove method.
10486         (Sized_relobj::do_set_section_offset): Handle offset value -1.
10487
10488 2010-01-25  Doug Kwan  <dougkwan@google.com>
10489
10490         * arm.cc (Arm_exidx_merged_section::do_output_offset):
10491         Fix warning due to signed and unsigned comparison on a 32-bit host.
10492
10493 2010-01-22  Doug Kwan  <dougkwan@google.com>
10494
10495         * arm.cc (Target_arm::do_relax): Record an output section for section
10496         offset adjustment it contains any stub table that has changed.
10497         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
10498         offsets in an output section if necessary.
10499         * output.cc (Output_section::Output_section): Initialize
10500         section_offsets_need_adjustments_.
10501         (Output_section::add_input_section_for_script): Renamed to
10502         Output_section::add_simple_input_section.
10503         (Output_section::save_states): Add a comment.
10504         (Output_section::discard_states): New method defintion.
10505         (Output_section::adjust_section_offsets): Same.
10506         * output.h (Output_section::add_input_section_for_script): Renamed to
10507         Output_section::add_simple_input_section.
10508         (Output_section::discard_states): New method declaration.
10509         (Output_section::adjust_section_offsets): Same.
10510         (Output_section::section_offsets_need_adjustment,
10511         Output_section::set_section_offsets_need_adjustment): New method
10512         definitions.
10513         (Output_section::section_offsets_need_adjustment_): New data member.
10514         * script-sections.cc
10515         (Output_section_element_input::set_section_address): Adjust code for
10516         renaming of Output_section::add_input_section_for_script.
10517         (Orphan_output_section::set_section_address): Same.
10518
10519 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10520
10521         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
10522         Fix_v4bx enum values .
10523         * gold/options.h (General_options): New option definitions.
10524         (General_options::fix_v4bx): New method.
10525         (General_options::Fix_v4bx): New enum.
10526         * gold/options.cc (General_options::parse_fix_v4bx): New method.
10527         (General_options::parse_fix_v4bx_interworking): New method.
10528
10529 2010-01-22  Doug Kwan  <dougkwan@google.com>
10530
10531         * arm.cc (Arm_exidx_fixup): New class.
10532
10533 2010-01-21  Doug Kwan  <dougkwan@google.com>
10534
10535         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
10536         classes.
10537         (Arm_exidx_section_offset_map): New type.
10538
10539 2010-01-21  Doug Kwan  <dougkwan@google.com>
10540
10541         * arm.cc (Arm_exidx_input_section): New class.
10542         (Arm_relobj::exidx_input_section_by_link,
10543         Arm_relobj::exidx_input_section_by_shndx,
10544         Arm_relobj::make_exidx_input_section): New methods.
10545         (read_arm_attributes_section): Remove.
10546         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
10547         information about them.
10548         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
10549         to here.
10550
10551 2010-01-20  Doug Kwan  <dougkwan@google.com>
10552
10553         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
10554         Input_section_specifier to Section_id.
10555         (Target_arm::new_arm_input_section: Adjust code for change of key
10556         type.
10557         (Target_arm::find_arm_input_section): Ditto.
10558         * gc.h (object.h): Include for Section_id nand Section_id_hash.
10559         (Section_id): Remove.
10560         (Garbage_collection::Section_id_hash): Remove.
10561         * icf.h (object.h): Include for Section_id nand Section_id_hash.
10562         (Section_id): Remove.
10563         (Icf::Section_id_hash): Remove.
10564         * object.h (Section_id, Const_section_id, Section_id_hash,
10565         Const_section_id_hash): New type definitions.
10566         * output.cc (Output_section::add_relaxed_input_section): Change to
10567         use Const_section_id instead of Input_section_specifier as key type.
10568         (Output_section::add_merge_input_section): Ditto.
10569         (Output_section::build_relaxation_map): Change to use Section_id
10570         instead of Input_section_specifier as key type.
10571         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10572         Ditto.
10573         (Output_section::convert_input_sections_to_relaxed_sections): Change
10574         to use Const_section_id instead of Input_section_specifier as key type.
10575         (Output_section::find_merge_section): Ditto.
10576         (Output_section::find_relaxed_input_section): Ditto.
10577         * output.h (Input_section_specifier): Remove class.
10578         (Output_section::Output_section_data_by_input_section_map): Change
10579         key type to Const_section_id.
10580         (Output_section::Output_relaxed_input_section_by_input_section_map):
10581         Ditto.
10582         (Output_section::Relaxation_map): Change key type to Section_id.
10583
10584 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10585
10586         * gold/arm.cc: Added support for R_ARM_V4BX relocation
10587         (class Arm_v4bx_stub): New class.
10588         (DEF_STUBS): Updated definition to support v4_veneer_bx.
10589         (Stub_factory::make_arm_v4bx_stub): New method.
10590         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
10591         (Stub_table::empty): Handle v4bx stubs.
10592         (Stub_table::add_arm_v4bx_stub): New method.
10593         (Stub_table::find_arm_v4bx_stub): New method.
10594         (Arm_relocate_functions::v4bx): New method.
10595         (Target_arm::fix_v4bx): New method.
10596         (Target_arm::Target_arm): Handle R_ARM_V4BX.
10597         (Stub_table::relocate_stubs): Likewise.
10598         (Stub_table::do_write): Likewise.
10599         (Stub_table::update_data_size_and_addralign): Likewise.
10600         (Stub_table::finalize_stubs):  Likewise.
10601         (Target_arm::Scan::local): Likewise.
10602         (Target_arm::Scan::global): Likewise.
10603         (Target_arm::do_finalize_sections): Likewise.
10604         (Target_arm::Relocate::relocate): Likewise.
10605         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10606         Likewise.
10607         (Target_arm::scan_reloc_for_stub): Likewise.
10608         (Target_arm::scan_reloc_section_for_stubs): Likewise.
10609
10610 2010-01-19  Ian Lance Taylor  <iant@google.com>
10611
10612         * output.cc (Output_section_headers::do_sized_write): Write large
10613         segment count to sh_info field.
10614         (Output_file_header::do_sized_write): For large segment count,
10615         write PN_XNUM to e_phnum field.
10616
10617 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10618
10619         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
10620         (Arm_relocate_functions::thm_jump8): New function.
10621         (Arm_relocate_functions::thm_jump11): New function.
10622         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
10623         R_ARM_THM_JUMP11.
10624         (Target_arm::Scan::global): Likewise.
10625         (Target_arm::Relocate::relocate): Likewise.
10626         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10627         Likewise.
10628
10629 2010-01-14  Doug Kwan  <dougkwan@google.com>
10630
10631         * arm.cc (map, utility): Include headers.
10632         (Target_arm::apply_cortex_a8_workaround): New method.
10633         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
10634         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
10635         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
10636         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
10637         the --[no-]fix-cortex-a8 command line options.
10638         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
10639         (Target_arm::relocate_stub): Use addend in instruction template.
10640         * options.h (DEFINE_bool): Set the user-set flag.
10641         (General_options): Add --[no-]-fix-cortex options.
10642         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
10643         : Update fast look-up map after conversion.
10644
10645 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
10646
10647         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
10648         in the first pass of do_layout.
10649
10650 2010-01-13  Doug Kwan  <dougkwan@google.com>
10651
10652         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10653         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
10654         apparent compiler problem of not folding static constant integral
10655         data members of elfcpp::Elf_sizes<32>.
10656
10657 2010-01-13  Doug Kwan  <dougkwan@google.com>
10658
10659         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10660         Arm_relobj::section_needs_cortex_a8_stub_scanning,
10661         Arm_relobj::scan_section_for_cortex_a8_erratum,
10662         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
10663         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
10664         sections to scan for relocation stubs into a new method
10665         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
10666         relocation and Cortex-A8 stub scanning.
10667         (Target_arm::do_relax): Force stubs to be after stubbed sections
10668         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
10669         the beginning of a new relaxation pass.  Update a comment.
10670         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
10671
10672 2010-01-12  Ian Lance Taylor  <iant@google.com>
10673
10674         * target-reloc.h (visibility_error): New inline function.
10675         (relocate_section): Call visibility_error.
10676         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
10677         (MOSTLYCLEANFILES): Likewise.
10678         (protected_4_pic.o, protected_3.err): New targets.
10679         * testsuite/protected_4.cc: New file.
10680
10681 2010-01-12  Doug Kwan  <dougkwan@google.com>
10682
10683         * arm.cc (Cortex_a8_reloc): New class.
10684         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
10685         and cortex_a8_relocs_info_.
10686         (Target_arm::fix_cortex_a8): New method definition.
10687         (Target_arm::Cortex_a8_relocs_info): New type.
10688         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
10689         New data member declarations.
10690         (Target_arm::scan_reloc_for_stub): Record information about
10691         relocations for THUMB branches that might be exempted from the
10692         Cortex-A8 workaround.
10693         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
10694         at the beginning of a relaxation pass.
10695
10696 2010-01-12  Doug Kwan  <dougkwan@google.com>
10697
10698         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
10699         (Arm_relobj::Mapping_symbol_position,
10700          Arm_reloj::Mapping_symbol_position_less,
10701          Arm_relobj::Mapping_symbols_info): New types.
10702         (Target_arm::is_mapping_symbol_name): New method definition.
10703         (Arm_relobj::do_count_local_symbols): Save information about mapping
10704         symbols.
10705
10706 2010-01-11  Doug Kwan  <dougkwan@google.com>
10707
10708         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
10709         Arm_relocate_functions::thumb32_branch_upper,
10710         Arm_relocate_functions::thumb32_branch_lower,
10711         Arm_relocate_functions::thumb32_cond_branch_offset,
10712         Arm_relocate_functions::thumb32_cond_branch_upper,
10713         Arm_relocate_functions::thumb32_cond_branch_lower,
10714         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
10715         branch offset encoding.
10716         (Arm_relocate_functions::thumb_branch_common): Use new branch
10717         offset encoding methods to avoid code duplication.
10718         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
10719         (Stub_addend_reader::operator()): Use new branch encoding method
10720         to avoid code duplication.
10721
10722 2010-01-11  Doug Kwan  <dougkwan@google.com>
10723
10724         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
10725         (Target_arm::do_finalize_sections): Define special EXIDX section
10726         symbols only if referenced.
10727         * gc.h (Garbage_collection::add_reference): New method.
10728         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
10729         code duplication.
10730
10731 2010-01-11  Ian Lance Taylor  <iant@google.com>
10732
10733         * script.cc (Version_script_info::build_expression_list_lookup):
10734         Change complaing about duplicate wildcard match from error to
10735         warning.
10736
10737         * script.cc (class Lazy_demangler): Recreate--revert part of patch
10738         of 2009-12-30.
10739         (Version_script_info::Version_script_info): Initialize globs_,
10740         default_version_, default_is_global_, and exact_.  Don't
10741         initialize globals_ or locals_.
10742         (Version_script_info::build_lookup_tables): Build local symbols
10743         first.
10744         (Version_script_info::unquote): New function.
10745         (Version_script_info::add_exact_match): New function.
10746         (Version_script_info::build_expression_list_lookup): Remove lookup
10747         parameter.  Add is_global parameter.  Change all callers.  Handle
10748         wildcard pattern specially.  Unquote pattern.  Call
10749         add_exact_match.
10750         (Version_script_info::get_name_to_match): New function.
10751         (Version_script_info::get_symbol_version): New function.
10752         (Version_script_info::get_symbol_version_helper): Remove.
10753         (Version_script_info::check_unmatched_names): Call unquote.
10754         * script.h (class Version_script_info): Change get_symbol_version
10755         to be non-inline and add is_global parameter; change all callers.
10756         Rewrite symbol_is_local.  Update declarations.  Define struct
10757         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
10758         Remove globals_ and locals_ members.  Add exact_, globs_,
10759         default_version_, is_global_.
10760         (Version_script_info::Glob): Remove pattern, add expression and
10761         is_global.  Update constructor.  Change all callers.
10762         * dynobj.cc (Versions::finalize): Mark the version symbol as the
10763         default version.
10764         (Versions::symbol_section_contents): If a symbol is undefined, or
10765         defined in a dynamic object, set the version index to
10766         VER_NDX_LOCAL.
10767         * symtab.cc (Symbol_table::add_from_relobj): Don't call
10768         symbol_is_local.
10769         (Symbol_table::add_from_pluginobj): Likewise.
10770         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
10771
10772 2010-01-11  Doug Kwan  <dougkwan@google.com>
10773
10774         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
10775         (incremental_dump_LDADD): Add linking option for libintl.
10776         * Makefile.in: Regenerate.
10777
10778 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
10779
10780         PR gold/11144
10781         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
10782         instead of -Ds.
10783         * testsuite/Makefile.in: Regenerated.
10784
10785 2010-01-10  Doug Kwan  <dougkwan@google.com>
10786
10787         * options.h (DEFINE_var): Use parentheses around argument varname__
10788         in macro body to avoid any unintended subsequent substitutions.
10789
10790 2010-01-10  Ian Lance Taylor  <iant@google.com>
10791
10792         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
10793         candidates before doing symbol resolution.
10794
10795         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
10796         ODR candidates if only one is weak.
10797
10798 2010-01-08  Ian Lance Taylor  <iant@google.com>
10799
10800         * script.cc (Version_script_info::build_expression_list_lookup):
10801         Don't warn about ambiguous version, just record the ambiguity.
10802         (Version_script_info::get_symbol_version_helper): Give error if
10803         version is ambiguous.
10804
10805 2010-01-08  Doug Kwan  <dougkwan@google.com>
10806
10807         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
10808         prev_data_size_ and prev_addralign_.  Remove initializer for
10809         deleted data member has_been_changed_.
10810         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
10811         to determine if the table is empty.
10812         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
10813         Remove.
10814         (Stub_table::add_reloc_stub): Define method in class definition
10815         instead of just declaring it there.
10816         (Stub_table::add_cortex_a8_stub): New method definition.
10817         (Stub_table::update_data_size_and_addralign): Ditto.
10818         (Stub_table::finalize_stubs): Ditto.
10819         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
10820         (Stub_table::do_addralign_): Return address alignment in the
10821         (Stub_table::do_reset_address_and_file_offset): Define method in
10822         class definition instead of declaring it there.  Set current data
10823         size to be the data size of the previous pass.
10824         (Stub_table::set_final_data_size): Use current data size as the
10825         final data size.
10826         (Stub_table::relocate_stub): Change parameter type of stub from
10827         Reloc_stub pointer to Stub pointer.
10828         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10829         (Stub_table::Cortex_a8_stub_list): New typedef.
10830         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10831          Stub_table::prev_addralign_): New data member.
10832         (Arm_relobj::Arm_relobj): Initialize data member
10833         section_has_cortex_a8_workaround_.
10834         (Arm_relobj::section_has_cortex_a8_workaround,
10835          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
10836          definitions.
10837         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10838         declarations.
10839         (Target_arm::relocate_stub): Change parameter type of stub from
10840         Reloc_stub pointer to Stub pointer.
10841         (Insn_template::size, Insn_template::alignment): Handle
10842         THUMB16_SPECIAL_TYPE.
10843         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10844          Stub_table::update_data_size_and_addralign,
10845          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10846         definitions.
10847         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10848         (Stub_table::do_write): Ditto.
10849         (Target_arm::do_relax): Adjust code for changes in Stub_table.
10850
10851 2010-01-08  Ian Lance Taylor  <iant@google.com>
10852
10853         PR 11108
10854         * symtab.h (class Symbol): Remove fields is_target_special_ and
10855         has_plt_offset_.  Add field is_defined_in_discarded_section_.
10856         (Symbol::is_defined_in_discarded_section): New function.
10857         (Symbol::set_is_defined_in_discarded_section): New function.
10858         (Symbol::has_plt_offset): Rewrite.
10859         (Symbol::set_plt_offset): Verify that new offset is not -1U.
10860         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10861         Don't initialize is_target_special_ or has_plt_offset_.
10862         Initialize is_defined_in_discarded_section_.
10863         (Symbol_table::add_from_relobj): If appropriate, set
10864         is_defined_in_discarded_section.
10865         * resolve.cc (Symbol::override_base_with_special): Don't test
10866         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
10867         * target-reloc.h (relocate_section): Do special handling for
10868         symbols defined in discarded sections for global symbols as well
10869         as local symbols.
10870
10871 2010-01-08  Ian Lance Taylor  <iant@google.com>
10872
10873         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10874         the SHT_SYMTAB case.
10875
10876 2010-01-08  Ian Lance Taylor  <iant@google.com>
10877
10878         * object.cc (Sized_relobj::do_layout): Don't get confused if
10879         layout_eh_frame returns NULL.
10880
10881 2010-01-08  Ian Lance Taylor  <iant@google.com>
10882
10883         PR 11084
10884         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10885         dynamic symbol table, use the normal symbol table.
10886         (Sized_dynobj::do_read_symbols): Remove assertion about type of
10887         symbol table.
10888
10889 2010-01-08  Ian Lance Taylor  <iant@google.com>
10890
10891         PR 11072
10892         * layout.cc (Layout::include_section): Remove .gnu_debuglink
10893         sections.
10894
10895 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
10896
10897         * version.cc (print_version): Change to "Copyright 2010".
10898
10899 2010-01-08  Ian Lance Taylor  <iant@google.com>
10900
10901         PR 10287
10902         PR 11063
10903         * i386.cc (class Target_i386): Change return type of plt_section
10904         to be non-const.
10905         (class Output_data_plt_i386): Add tls_desc_rel_ field.
10906         (Output_data_plt_i386::Output_data_plt_i386): Initialize
10907         tls_desc_rel_ field.
10908         (Output_data_plt_i386::rel_tls_desc): New function.
10909         (Target_i386::rel_tls_desc_section): New function.
10910         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
10911         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
10912         R_386_TLS_DESC reloc in rel_tls_desc_section.
10913         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
10914         Define struct Tlsdesc_info.
10915         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
10916         (Target_x86_64::do_reloc_symbol_index): New function.
10917         (Target_x86_64::add_tlsdesc_info): New function.
10918         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
10919         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
10920         tlsdesc_rel_ field.
10921         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
10922         all callers.
10923         (Output_data_plt_x86_64::rela_tlsdesc): New function.
10924         (Target_x86_64::rela_tlsdesc_section): New function.
10925         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
10926         handling.
10927         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
10928         (Target_x86_64::do_reloc_addend): New function.
10929         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
10930         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
10931         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
10932         (Output_reloc::type): New function.
10933         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
10934         (Output_reloc::is_target_specific): New function.
10935         (Output_reloc::target_arg): New function.
10936         (class Output_reloc) [SHT_RELA]: Add four new constructors for
10937         absolute relocs and target specific relocs.
10938         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
10939         add_target_specific.
10940         (class Output_data_reloc) [SHT_RELA]: Likewise.
10941         * output.cc (Output_reloc::Output_reloc): Add four new versions
10942         for absolute relocs and target specific relocs.
10943         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
10944         (Output_reloc::get_symbol_index): Likewise.
10945         (Output_reloc::local_section_offset): Check that local_sym_index_
10946         is not TARGET_CODE or 0.
10947         (Output_reloc::symbol_value): Likewise.
10948         (Output_reloc::write) [SHT_RELA]: Call target for target specific
10949         reloc.
10950         * target.h (class Target): Add reloc_symbol_index and reloc_addend
10951         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
10952         functions.
10953         * layout.cc (add_target_dynamic_tags): Use output section for
10954         DT_PLTRELSZ and DT_JMPREL.
10955
10956 2010-01-07  Ian Lance Taylor  <iant@google.com>
10957
10958         PR 11061
10959         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
10960         function.
10961         (class Output_data_reloc_generic): Define.
10962         (class Output_data_reloc_base): Change base class to
10963         Output_data_reloc_generic.  Change add() method to call
10964         bump_relative_reloc_count for a relative reloc.  Remove
10965         sort_relocs_ field.
10966         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
10967         to sort_relocs().
10968         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10969         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
10970         appropriate.
10971         * layout.h (class Layout): Update declaration.
10972
10973 2010-01-07  Ian Lance Taylor  <iant@google.com>
10974
10975         * output.h (class Output_data): Add const version of
10976         output_section and do_output_section.
10977         (class Output_section_data): Add const version of
10978         do_output_section.
10979         (class Output_section): Likewise.
10980         * layout.cc (Layout::add_target_dynamic_tags): New function.
10981         * layout.h (class Layout): Update declarations.
10982         * arm.cc (Target_arm::do_finalize_sections): Use
10983         add_target_dynamic_tags.
10984         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10985         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10986         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10987         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10988
10989 2010-01-07  Ian Lance Taylor  <iant@google.com>
10990
10991         PR 11042
10992         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10993         object as needed.
10994
10995 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
10996             Ian Lance Taylor  <iant@google.com>
10997
10998         PR 11019
10999         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
11000         Xindex::read_symtab_xindex.
11001
11002 2010-01-07  Doug Kwan  <dougkwan@google.com>
11003
11004         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
11005         (Insn_template::thumb16_bcond_insn): New method declaration.
11006         (Insn_template): Fix spelling.
11007         (Stub::thumb16_special): New method declaration.
11008         (Stub::do_write): Define virtual method which was previously pure
11009         virtual.
11010         (Stub::do_thumb16_special): New method declaration.
11011         (Stub::do_fixed_endian_write): New template member.
11012         (Reloc_stub::do_write): Remove.
11013         (Reloc_stub::do_fixed_endian_write): Remove.
11014         (Cortex_a8_stub): New class definition.
11015         (Stub_factory::make_cortex_a8_stub): New method definition.
11016         (Stub_factory::Stub_factory): Add missing static storage class
11017         qualifier for elf32_arm_stub_a8_veneer_blx.
11018
11019 2010-01-07  Ian Lance Taylor  <iant@google.com>
11020
11021         PR 10980
11022         * options.h (class General_options): Add --warn-unresolved-symbols
11023         and --error-unresolved-symbols.
11024         * errors.cc (Errors::undefined_symbol): Implement
11025         --warn-unresolved-symbols.
11026
11027         * options.h (class General_options): Add -z text and -z textoff.
11028         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
11029
11030 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
11031
11032         * gc.h (Garbage_collection::Cident_section_map): New typedef.
11033         (Garbage_collection::cident_sections): New function.
11034         (Garbage_collection::add_cident_section): New function.
11035         (Garbage_collection::cident_sections_): New member.
11036         (gc_process_relocs): Add references to sections whose names are C
11037         identifiers.
11038         * gold.h (cident_section_start_prefix): New constant.
11039         (cident_section_stop_prefix): New constant.
11040         (is_cident): New function.
11041         * layout.cc (Layout::define_section_symbols): Replace string constants
11042         with the newly defined constants.
11043         * object.cc (Sized_relobj::do_layout): Track sections whose names are
11044         C identifiers.
11045         * testsuite/Makefile.am: Add gc_orphan_section_test.
11046         * testsuite/Makefile.in: Regenerate.
11047         * testsuite/gc_orphan_section_test.cc: New file.
11048         * testsuite/gc_orphan_section_test.sh: New file.
11049
11050 2010-01-06  Ian Lance Taylor  <iant@google.com>
11051
11052         PR 10980
11053         * options.h (class General_options): Add --warn-shared-textrel.
11054         * layout.cc (Layout::finish_dynamic_section): Implement
11055         --warn-shared-textrel.
11056
11057         PR 10980
11058         * options.h (class General_options): Add --warn-multiple-gp.
11059
11060 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11061
11062         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
11063         $(THREADSLIB) and $(LIBDL).
11064         * Makefile.in: Rebuild.
11065
11066 2010-01-06  Ian Lance Taylor  <iant@google.com>
11067
11068         PR 10980
11069         * options.cc (General_options::parse_section_start): New function.
11070         (General_options::section_start): New function.
11071         (General_options::General_options): Initialize all members.
11072         * options.h: Include <map>
11073         (class General_options): Add --section-start.  Add section_starts_
11074         member.
11075         * layout.cc (Layout::attach_allocated_section_to_segment): If
11076         --section-start was used, set the address of the segment.  Remove
11077         local sort_sections.
11078         (Layout::relaxation_loop_body): If the address of the load segment
11079         has been set by --section-start, don't use it.
11080         * output.h (Output_segment::update_flags_for_output_section): New
11081         function.
11082         * output.cc (Output_segment::add_output_section): Call
11083         update_flags_for_output_section.
11084
11085 2010-01-05  Ian Lance Taylor  <iant@google.com>
11086
11087         PR 10980
11088         * options.h (class General_options): Add --undefined-version.
11089         * script.cc (struct Version_expression): Add was_matched_by_symbol
11090         field.
11091         (Version_script_info::matched_symbol): New function.
11092         (Version_script_info::get_symbol_version_helper): Call
11093         matched_symbol.
11094         (Version_script_info::check_unmatched_names): New function.
11095         * script.h (class Version_script_info): Update declarations.
11096         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
11097
11098         * options.h (class General_options): Use DEFINE_bool_alias for
11099         allow_multiple_definition.
11100         * resolve.cc (Symbol_table::should_override): Don't test
11101         allow_multiple_definition.
11102
11103         PR 10980
11104         * options.h (class General_options): Add --cref.
11105         * main.cc (main): Print cref table if --cref.  Don't close mapfile
11106         until after printing cref table.
11107         * cref.cc: Include "symtab.h".
11108         (class Cref_inputs): Define Cref_table_compare and Cref_table.
11109         (Cref_table_compare::operator()): New function.
11110         (Cref_inputs::gather_cref): New function.
11111         (filecol): New static const.
11112         (Cref_inputs::print_cref): New function.
11113         (Cref::print_cref): New function.
11114         * cref.h: Include <cstdio>.
11115         (class Cref): Update declarations.
11116         * mapfile.h (Mapfile::file): New function.
11117         * object.h (class Object): Define Symbols.  Declare virtual
11118         do_get_global_symbols.
11119         (Object::get_global_symbols): New function.
11120         * object.cc (Input_objects::add_object): Pass object to cref_ if
11121         --cref.
11122         (Input_objects::archive_start): Likewise.
11123         (Input_objects::archive_stop): Likewise.
11124         (Input_objects::print_cref): New function.
11125         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
11126         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
11127         --cref.
11128         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
11129         function.
11130         * plugin.h (class Sized_pluginobj): Update declarations.
11131
11132 2010-01-05  Ian Lance Taylor  <iant@google.com>
11133
11134         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
11135         to is_default_version.  Rename insdef to insdefault.
11136         (Symbol_table::add_from_relobj): Rename def to is_default_version
11137         and local to is_forced_local.
11138         (Symbol_table::add_from_pluginobj): Likewise.
11139         (Symbol_table::add_from_dynobj): Likewise.
11140         (Symbol_table::define_special_symbol): Rename insdef to
11141         insdefault.
11142
11143 2010-01-04  Ian Lance Taylor  <iant@google.com>
11144
11145         PR 10980
11146         * options.h (class General_options): Add
11147         --allow-multiple-definition and -z muldefs.
11148         * resolve.cc (Symbol_table::should_override): Don't warn about a
11149         multiple symbol definition if --allow-multiple-definition or -z
11150         muldefs.
11151
11152         PR 10980
11153         * options.h (class General_options): Add --add-needed and
11154         --copy-dt-needed-entries.  Tweak --as-needed help entry.
11155         * object.cc (Input_objects::check_dynamic_dependencies): Give an
11156         error if --copy-dt-needed-entries aka --add-needed is used and
11157         would cause a change in behaviour.
11158
11159         PR 10980
11160         * options.h (class General_options): Add -G as a short version of
11161         --shared.  Add no-op options -assert, -g, and -i.
11162
11163 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
11164
11165         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
11166         check for .text or .gnu.linkonce.t sections.
11167         * icf.cc (Icf::find_identical_sections): Ditto.
11168         Change the detection for mangled function name within the section
11169         name.
11170         * icf.h (is_section_foldable_candidate): New function.
11171
11172 2009-12-30  Ian Lance Taylor  <iant@google.com>
11173
11174         PR 10980
11175         * options.h (class General_options): Permit two dashes with
11176         --retain-symbols-file.
11177
11178 2009-12-30  Ian Lance Taylor  <iant@google.com>
11179
11180         PR 10979
11181         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
11182         don't put the file header and segment headers in the text
11183         segment.
11184
11185         PR 10979
11186         * common.cc (Sort_commons::operator()): Stabilize sort when both
11187         entries are NULL.
11188         (Symbol_table::do_allocate_commons_list): When allocating common
11189         symbols, skip a symbol which is no longer common.
11190         * symtab.h (Symbol::is_common): Test whether the symbol comes from
11191         an object before checking its type.
11192         * testsuite/common_test_2.c: New file.
11193         * testsuite/common_test_3.c: New file.
11194         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
11195         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
11196         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
11197         (common_test_2_pic.o, common_test_2.so): New targets.
11198         (common_test_3_pic.o, common_test_3.so): New targets.
11199         * testsuite/Makefile.in: Rebuild.
11200
11201         PR 10979
11202         * script.cc (read_input_script): If we see a new SECTIONS clause,
11203         and we have added an input section, give an error.
11204         * layout.h (class Layout): Add have_added_input_section function.
11205         Add have_added_input_section_ field.
11206         * layout.cc (Layout::Layout): Initialize
11207         have_added_input_section_.
11208         (Layout::layout): Set have_added_input_section_.
11209         (Layout::layout_eh_frame): Likewise.
11210
11211 2009-12-30  Ian Lance Taylor  <iant@google.com>
11212
11213         PR 10931
11214         * options.h (class General_options): Add --sort-common option.
11215         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
11216         * common.cc (Sort_common): Add sort_order parameter to
11217         constructor.  Add sort_order_ field.
11218         (Sort_commons::operator): Check sort_order_.
11219         (Symbol_table::allocate_commons): Determine the sort order.
11220         (Symbol_table::do_allocate_commons): Add sort_order parameter.
11221         Change all callers.
11222         (Symbol_table::do_allocate_commons_list): Likewise.
11223
11224 2009-12-30  Ian Lance Taylor  <iant@google.com>
11225
11226         PR 10916
11227         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
11228         symbols from this object, don't change the visibility of an
11229         undefined symbol.
11230         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
11231
11232 2009-12-30  Ian Lance Taylor  <iant@google.com>
11233
11234         PR 10861
11235         * script.h (class Version_script_info): Define Language enum.
11236         Update declarations.  Define Glob, Exact, and Lookup types.  Add
11237         new fields globals_, locals_, and is_finalized_.
11238         * script.cc: Various formatting fixes.
11239         (class Parser_closure): Change language_stack_ from a vector of
11240         std::string to one of Version_script_info::Language.  Adjust all
11241         uses accordingly.
11242         (class Lazy_demangler): Remove.
11243         (struct Version_expression): Change language from std::string to
11244         Version_script_info::Language.
11245         (Version_script_info::Version_script_info): New function.
11246         (Version_script_info::~Version_script_info): Don't call clear.
11247         (Version_script_info::finalize): New function.
11248         (Version_script_info::build_lookup_tables): New function.
11249         (Version_script_info::build_expression_list_lookup): New
11250         function.
11251         (Version_script_info::get_symbol_version_helper): Rewrite to use
11252         lookup tables.
11253         (Version_script_info::print_expression_list): Adjust to use
11254         Version_script_info::Language.
11255         (script_push_lex_into_version_mode): Check that the version script
11256         has not been finalized.
11257         (version_script_push_lang): Change language string to
11258         Version_script_info::Language.
11259         * options.cc (Command_line::version_script): New function.
11260         * options.h (class General_options): Add finalize_dynamic_list
11261         function.  Change version_script from declaration to definition.
11262         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
11263         * testsuite/version_script.map: Remove duplicate def of foo.
11264         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
11265         version_script.map.
11266         * testsuite/Makefile.in: Rebuild.
11267
11268 2009-12-30  Ian Lance Taylor  <iant@google.com>
11269
11270         PR 10843
11271         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
11272         if the input symbol index is 0, make the output symbol index 0.
11273
11274 2009-12-30  Ian Lance Taylor  <iant@google.com>
11275
11276         PR 10670
11277         * options.h (class General_options): Add -x/--discard-all.
11278         * object.cc (Sized_relobj::do_count_local_symbols): Handle
11279         --discard-all.  If the local symbol needs a dynamic entry, check
11280         that before handling --discard-locals.
11281
11282 2009-12-30  Ian Lance Taylor  <iant@google.com>
11283
11284         PR 10450
11285         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
11286         flags to PF_R.
11287         (Output_segment::add_output_section): Don't change the flags if
11288         the type is PT_TLS.
11289
11290         PR 10450
11291         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
11292         GNU hash table if they need a dynamic value.  Otherwise, don't add
11293         them if they are defined in a dynamic object or are forced local.
11294
11295 2009-12-29  Ian Lance Taylor  <iant@google.com>
11296
11297         PR 10450
11298         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
11299         .gnu.hash table for a 32-bit target.
11300
11301         PR 10450
11302         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
11303         regular and a dynamic object only needs a dynamic symbol table
11304         entry if it is externally visible.
11305
11306         PR 10450
11307         * i386.cc (class Target_i386): Initialize global_offset_table_ in
11308         constructor.  Add global_offset_table_ field.
11309         (Target_i386::got_section): Set global_offset_table_.
11310         (Target_i386::do_finalize_sections): Set global_offset_table_
11311         size.
11312         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
11313         in constructor.  Add global_offset_table_ field.
11314         (Target_x86_64::got_section): Set global_offset_table_.
11315         (Target_x86_64::do_finalize_sections): Set global_offset_table_
11316         size.
11317
11318         * layout.cc (Layout::Layout): Initialize increase_relro_.
11319         (Layout::get_output_section): Add is_relro, is_last_relro, and
11320         is_first_non_relro parameters.  Change all callers.
11321         (Layout::choose_output_section): Likewise.
11322         (Layout::add_output_section_data): Likewise.
11323         (Layout::make_output_section): Likewise.
11324         (Layout::set_segment_offsets): Clear increase_relro when using a
11325         linker script.
11326         * layout.h (class Layout): Add increase_relro method.  Add
11327         increase_relro_ field.  Update declarations.
11328         * output.cc (Output_section::Output_section): Initialize
11329         is_last_relro_ and is_first_non_relro_.
11330         (Output_segment::add_output_section): Group relro sections is
11331         do_sort is true.  Handle is_last_relro and is_first_non_relro.
11332         (Output_segment::maximum_alignment): Remove relro handling.
11333         (Output_segment::set_section_addresses): Add increase_relro
11334         parameter.  Change all callers.  Add initial alignment to align
11335         relro sections on separate page.  Remove old relro handling.
11336         (Output_segment::set_section_list_addresses): Remove in_relro
11337         parameter.  Change all callers.
11338         (Output_segment::set_offset): Add increase parameter.  Change all
11339         callers.  Remove old relro handling.
11340         * output.h (class Output_section): Add new methods: is_last_relro,
11341         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
11342         Add is_last_relro_ and is_first_non_relro_ fields.
11343         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
11344         Create separate .got.plt section.  Call increase_relro.
11345         * x86_64.cc (Target_x86_64::got_section): Likewise.
11346         * testsuite/relro_script_test.t: Add .got.plt.
11347
11348         PR 10450
11349         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
11350         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
11351         (Layout::finalize): Call set_dynamic_symbol_size.
11352         (Layout::set_dynamic_symbol_size): New function.
11353         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
11354         set_dynamic_symbol_size.
11355
11356         PR 10450
11357         * output.h (class Output_section): Add is_entsize_zero_ field.
11358         * output.cc (Output_section::Output_section): Initialize
11359         is_entsize_zero_.
11360         (Output_section::set_entsize): If two different entsizes are
11361         requested, force it to zero.
11362         (Output_section::add_input_section): Set flags for .debug_str
11363         before updating section flags.  Set entsize.
11364         (Output_section::update_flags_for_input_section): Set SHF_MERGE
11365         and SHF_STRING if all input sections have those flags.
11366
11367 2009-12-29   Rafael Espindola  <espindola@google.com>
11368
11369         * main.cc (main): Fix the sys time reporting.
11370         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
11371         reporting.
11372
11373 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
11374
11375         * options.cc (General_options::parse_version): Allow -v to exit
11376         without an error if there is nothing to link.
11377
11378 2009-12-29  Ian Lance Taylor  <iant@google.com>
11379
11380         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
11381         using a version of gcc before 4.1.
11382         * configure: Rebuild.
11383
11384 2009-12-28  Chris Demetriou  <cgd@google.com>
11385
11386         * attributes.cc (Output_attributes_section_data::do_write): Use
11387         std::vector::front rather than std::vector::data.
11388
11389 2009-12-28  Ian Lance Taylor  <iant@google.com>
11390
11391         * symtab.h (class Symbol_table): Add enum Defined.
11392         * resolve.cc (Symbol_table::should_override): Add defined
11393         parameter.  Change all callers.  Test whether object is NULL
11394         before calling a method on it.
11395         (Symbol_table::report_resolve_problem): Add defined parameter.
11396         Change all callers.
11397         (Symbol_table::should_override_with_special): Likewise.
11398         * symtab.cc (Symbol_table::define_in_output_data): Add defined
11399         parameter.  Change all callers.
11400         (Symbol_table::do_define_in_output_data): Likewise.
11401         (Symbol_table::define_in_output_segment): Likewise.
11402         (Symbol_table::do_define_in_output_segment): Likewise.
11403         (Symbol_table::define_as_constant): Likewise.
11404         (Symbol_table::do_define_as_constant): Likewise.
11405         * script.h (class Symbol_assignment): Add is_defsym parameter to
11406         constructor; change all callers.
11407         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
11408         parameter.  Change all callers.  Add is_defsym_ field.
11409         (class Parser_closure): Add parsing_defsym parameter to
11410         constructor; change all callers.  Add parsing_defsym accessor
11411         function.  Add parsing_defsym_ field.
11412
11413 2009-12-28  Ian Lance Taylor  <iant@google.com>
11414
11415         * gold.cc (queue_middle_tasks): Fix formatting.
11416         * object.cc (Relobj::is_section_name_included): Likewise.
11417
11418 2009-12-23  Ian Lance Taylor  <iant@google.com>
11419
11420         * i386.cc (Target_i386::do_calls_non_split): Recognize
11421         -fsplit-stack prologue for a function with a static chain.
11422         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
11423         -fsplit-stack prologue when using %r11.
11424
11425 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
11426
11427         * options.cc (General_options::parse_version): Make -v continue and do
11428         the link like GNU ld does.
11429
11430 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
11431
11432         * Makefile.am (CCFILES): Add timer.cc.
11433         (HFILES): Add timer.h.
11434         * configure.ac: Check for sysconf and times.
11435         * main.cc: include timer.h.
11436         (main): Use Timer instead of get_run_time.
11437         * timer.cc: New.
11438         * timer.h: New.
11439         * workqueue.cc: include timer.h.
11440         (Workqueue::find_and_run_task):
11441         Report user, sys and wall time.
11442         * Makefile.in: Regenerate.
11443         * config.in: Regenerate.
11444         * configure: Regenerate.
11445
11446 2009-12-16  Doug Kwan  <dougkwan@google.com>
11447
11448         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
11449         sections.
11450         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
11451         relaxed input sections.
11452         * output.cc (Output_section::find_relaxed_input_section): Change
11453         return type to Output_relaxed_input_section pointer.  Adjust code
11454         for new type of relaxed_input_section_map_.
11455         * output.h (Output_section::find_relaxed_input_section): Change
11456         return type to Output_relaxed_input_section pointer.
11457         (Output_section::Output_relaxed_input_section_by_input_section_map):
11458         New type.
11459         (Output_section::relaxed_input_section_map_): Change type to
11460         Output_section::Output_relaxed_input_section_by_input_section_map.
11461         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
11462         input section.
11463
11464 2009-12-15  Ian Lance Taylor  <iant@google.com>
11465
11466         * layout.cc (Layout::create_shstrtab): Only write out after input
11467         sections if we are compressing debug sections.
11468
11469 2009-12-15  Ian Lance Taylor  <iant@google.com>
11470
11471         * archive.cc (Archive::add_symbols): Only look up a symbol without
11472         a version if there is, in fact, a version.
11473
11474 2009-12-14  Ian Lance Taylor  <iant@google.com>
11475
11476         Revert -Wshadow changes, all changes from:
11477         2009-12-11  Doug Kwan  <dougkwan@google.com>
11478         2009-12-11  Nick Clifton  <nickc@redhat.com>
11479         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
11480
11481 2009-12-11  Doug Kwan  <dougkwan@google.com>
11482
11483         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
11484         due to -Wshadow.
11485         * attributes.cc (Object_attribute::size): Ditto.
11486         (Attributes_section_data::size): Ditto.
11487         (Attributes_section_data::Attributes_section_data): Ditto.
11488         (Output_attributes_section_data::do_write): Ditto.
11489         * attributes.h (Object_attribute::set_type): Ditto.
11490         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
11491
11492 2009-12-11  Nick Clifton  <nickc@redhat.com>
11493
11494         * archive.cc: Fix shadowed variable warnings.
11495         * arm.cc: Likewise.
11496         * compressed_output.cc: Likewise.
11497         * compressed_output.h: Likewise.
11498         * configure: Likewise.
11499         * dwarf_reader.cc: Likewise.
11500         * dynobj.cc: Likewise.
11501         * dynobj.h: Likewise.
11502         * ehframe.cc: Likewise.
11503         * ehframe.h: Likewise.
11504         * errors.cc: Likewise.
11505         * expression.cc: Likewise.
11506         * fileread.cc: Likewise.
11507         * fileread.h: Likewise.
11508         * freebsd.h: Likewise.
11509         * i386.cc: Likewise.
11510         * icf.cc: Likewise.
11511         * incremental.h: Likewise.
11512         * layout.cc: Likewise.
11513         * layout.h: Likewise.
11514         * mapfile.cc: Likewise.
11515         * merge.cc: Likewise.
11516         * merge.h: Likewise.
11517         * object.cc: Likewise.
11518         * object.h: Likewise.
11519         * options.h: Likewise.
11520         * output.cc: Likewise.
11521         * output.h: Likewise.
11522         * parameters.cc: Likewise.
11523         * plugin.cc: Likewise.
11524         * powerpc.cc: Likewise.
11525         * reduced_debug_output.cc: Likewise.
11526         * reduced_debug_output.h: Likewise.
11527         * reloc.cc: Likewise.
11528         * reloc.h: Likewise.
11529         * resolve.cc: Likewise.
11530         * script-sections.cc: Likewise.
11531         * script.cc: Likewise.
11532         * script.h: Likewise.
11533         * sparc.cc: Likewise.
11534         * symtab.cc: Likewise.
11535         * symtab.h: Likewise.
11536         * target-select.cc: Likewise.
11537         * target-select.h: Likewise.
11538         * token.h: Likewise.
11539         * workqueue.cc: Likewise.
11540         * workqueue.h: Likewise.
11541         * x86_64.cc: Likewise.
11542
11543 2009-12-10  Doug Kwan  <dougkwan@google.com>
11544
11545         * arm.cc (attributes.h): New include.
11546         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
11547         (Arm_relobj::~Arm_relobj): Delete object pointed by
11548         attributes_section_data_.
11549         (Arm_relobj::attributes_section_data): New method definition.
11550         (Arm_relobj::attributes_section_data_): New data member declaration.
11551         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
11552         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
11553         attributes_section_data_.
11554         (Arm_dynobj::attributes_section_data): New method definition.
11555         (Arm_dynobj::attributes_section_data_): New data member declaration.
11556         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
11557         initialization value of may_use_blx_ to false.
11558         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
11559         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
11560         object attributes to compute results instead of hard-coding.
11561         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
11562         Target_arm::get_secondary_compatible_arch,
11563         Target_arm::set_secondary_compatible_arch
11564         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11565         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
11566         New method declarations.
11567         (Target_arm::get_aeabi_object_attribute): New method definition.
11568         (Target_arm::attributes_section_data_): New data member declaration.
11569         (read_arm_attributes_section): New template definition.
11570         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
11571         (Arm_dynobj::do_read_symbols): Ditto.
11572         (Target_arm::do_finalize_sections): Merge attributes sections from
11573         input.  Check for BLX use after attributes section merging.
11574         Fix __exidx_start and __exidx_end visibility.  Create an
11575         .ARM.attributes section if necessary.
11576         (Target_arm::get_secondary_compatible_arch,
11577         Target_arm::set_secondary_compatible_arch,
11578         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11579         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
11580         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
11581         New method definitions.
11582
11583 2009-12-09  Ian Lance Taylor  <iant@google.com>
11584
11585         * plugin.cc (Plugin::load): Don't cast from void* to a function
11586         pointer.
11587
11588 2009-12-09  Ian Lance Taylor  <iant@google.com>
11589
11590         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
11591         information fields.
11592
11593 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
11594
11595         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
11596         Replace two_file_shared_1.so with two_file_shared_2.so.
11597         * testsuite/Makefile.in: Regenerated.
11598
11599 2009-12-08  Doug Kwan  <dougkwan@google.com>
11600
11601         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
11602         (HFILES): Add attributes.h and int_encoding.h.
11603         * Makefile.in: Regenerate.
11604         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
11605         function definitions to int_encoding.cc
11606         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
11607         prototypes to int_encoding.h
11608         * reduced_debug_output.cc (int_encoding.h): New include.
11609         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
11610         function definitions to int_encoding.cc
11611         (insert_into_vector, read_from_pointer): Move template definitions to
11612         int_encoding.h
11613         * attributes.cc: New file.
11614         * attributes.h: New file.
11615         * int_encoding.cc: New file.
11616         * int_encoding.h: New file.
11617
11618 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
11619
11620         PR gold/11055
11621         * incremental-dump.cc (dump_incremental_inputs): New.
11622         (main): Use dump_incremental_inputs.
11623
11624 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
11625
11626         PR gold/10893
11627         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
11628         checking elfcpp::STT_FUNC.
11629         (Target_i386::Relocate::relocate): Likewise.
11630         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
11631
11632         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
11633         symbols from shared libraries into normal FUNC symbols.
11634
11635         * symtab.h (Symbol): Add is_func and use it.
11636
11637 2009-12-05  Doug Kwan  <dougkwan@google.com>
11638
11639         * arm.cc (Target_arm::arm_info): Initialize new fields
11640         attributes_section and attributes_vendor.
11641         * i386.cc (Target_i386::i386_info): Same.
11642         * object.cc (Sized_relobj::do_layout): Skip attribute section.
11643         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
11644         fields attributes_section and attributes_vendor.
11645         * sparc.cc (Target_sparc::sparc_info): Same.
11646         * target.h (Target::attributes_section, Target::attributes_vendor,
11647         Target::is_attributes_section, Target::attribute_arg_type,
11648         Target::attributes_order): New method definitions.
11649         (Target::Target_info::attributes_section,
11650         Target::Target_info::attributes_vendor): New fields.
11651         (Target::do_attribute_arg_type, Target::do_attributes_order): New
11652         virtual method definitions.
11653         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
11654         attributes_section and attributes_vendor.
11655         * testsuite/testfile.cc (Target_test::test_target_info): Same.
11656
11657 2009-12-05  Doug Kwan  <dougkwan@google.com>
11658
11659         * arm.cc: Update comments about interworking and stub generation.
11660         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
11661         considered as non-PIC.
11662         (Arm_relocate_functions::base_abs): Fix formatting.
11663         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
11664         of function to use GOT entry address instead of offset.
11665         (Target_arm::Scan::global): Issue an error if a symbol would need a
11666         PLT does not get one because it is untyped.  Remove code to create
11667         dynamic symbols for relative branches.
11668         (Target_arm::Relocate::relocate: Use 0 instead of false since function
11669         takes unsigned integer instead of boolean.
11670
11671 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
11672
11673         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
11674         (two_file_test_LDADD): Likewise.
11675         (common_test_1_LDADD): Likewise.
11676         (exception_test_LDADD) Likewise.
11677         (weak_test_LDADD): Likewise.
11678         (many_sections_test_LDADD): Likewise.
11679         (initpri1_LDADD): Likewise.
11680         (script_test_1_LDADD): Likewise.
11681         (script_test_2_LDADD): Likewise.
11682         (justsyms_LDADD): Likewise.
11683         (binary_test_LDADD): Likewise.
11684         (large_LDADD): Likewise.
11685         * testsuite/Makefile.in: Regenerated.
11686
11687 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
11688
11689         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
11690         (Symbol_table::override_with_special): Likewise.
11691         (Symbol_table::add_from_object): Likewise.
11692
11693 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
11694
11695         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11696         Don't set the data_offset twice.
11697
11698 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
11699
11700         * testsuite/Makefile.in: Regenerate.
11701
11702 2009-12-03  Doug Kwan  <dougkwan@google.com>
11703
11704         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
11705         (Target_arm::do_finalize_sections): Add parameter for symbol table
11706         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
11707         * i386.cc (Target_i386::do_finalize_sections): Add an additional
11708         parameter for symbol table pointer.
11709         * layout.cc (Layout::finalize): Call Target::finalize_sections with
11710         an additional parameter for a pointer to symbol table.
11711         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
11712         parameter for a symbol table pointer.
11713         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
11714         * target.h (Target::finalize_sections, Target::do_finalize_sections):
11715         Ditto.
11716         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
11717         parameter for a symbol table pointer.
11718
11719 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
11720
11721         * incremental.cc (Incremental_inputs_header)
11722         (Incremental_inputs_header_write, Incremental_inputs_entry)
11723         (Incremental_inputs_entry_write): Move ...
11724         * incremental.h (Incremental_inputs_header)
11725         (Incremental_inputs_header_write, Incremental_inputs_entry)
11726         (Incremental_inputs_entry_write): here.
11727
11728 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11729
11730         * incremental.cc (make_sized_incremental_binary): Set the target.
11731         Error if it is incompatible.
11732         * output.h (Output_file): Add filename method.
11733
11734 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11735
11736         * incremental.cc (Incremental_inputs_entry): Remove unused argument
11737         from the get_* methods.
11738
11739 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11740
11741         * incremental-dump.cc (main): Check that the offeset of a script is 0.
11742         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11743         Write 0 for the data_offset of scripts.
11744
11745 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11746
11747         * testsuite/Makefile.am: Add the incremental_test.sh test.
11748         * testsuite/incremental_test.sh: New.
11749         * testsuite/incremental_test_1.c: New.
11750         * testsuite/incremental_test_2.c: New.
11751
11752 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
11753
11754         * incremental-dump.cc (main): Fix typos.
11755
11756 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
11757
11758         PR gold/11025
11759         * incremental-dump.cc (main): Use llu to print 64 bit values.
11760
11761 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
11762             H.J. Lu  <hongjiu.lu@intel.com>
11763
11764         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
11765         $(LIBDL).
11766         (incremental_dump_LDADD): Likewise.
11767         * Makefile.in: Regenerated.
11768
11769 2009-11-25  Doug Kwan  <dougkwan@google.com>
11770
11771         Revert:
11772
11773         2009-11-25  Doug Kwan  <dougkwan@google.com>
11774
11775                 * arm.cc (Target_arm::Target_arm): Move method definition
11776                 outside of class definition.  Add code to handle
11777                 --target1-rel, --target1-abs and --target2= options.
11778                 (Target_arm::get_reloc_reloc_type): Change method to be
11779                 non-static and const.
11780                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
11781                 New data member declaration.
11782                 (Target_arm::Scan::local, Target_arm::Scan::global,
11783                 Target_arm::Relocate::relocate,
11784                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11785                 Adjust call to Target_arm::get_real_reloc_type.
11786                 (Target_arm::get_real_reloc_type): Use command line options
11787                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11788                 * options.h (--target1-rel, --target1-abs, --target2): New
11789                 ARM-only options.
11790
11791 2009-11-25  Doug Kwan  <dougkwan@google.com>
11792
11793         * arm.cc (Target_arm::Target_arm): Move method definition outside of
11794         class definition.  Add code to handle --target1-rel, --target1-abs
11795         and --target2= options.
11796         (Target_arm::get_reloc_reloc_type): Change method to be non-static
11797         and const.
11798         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
11799         member declaration.
11800         (Target_arm::Scan::local, Target_arm::Scan::global,
11801         Target_arm::Relocate::relocate,
11802         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
11803         call to Target_arm::get_real_reloc_type.
11804         (Target_arm::get_real_reloc_type): Use command line options to
11805         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11806         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
11807         options.
11808
11809 2009-11-25  Doug Kwan  <dougkwan@google.com>
11810
11811         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
11812         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
11813         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
11814         formatting.
11815         (Arm_relocate_functions::thm_call): Replace body with a call to
11816         Arm_relocate_functions::thumb_branch_common.
11817         (Arm_relocate_functions::thm_jump24,
11818         Arm_relocate_functions::thm_xpc22): New method definitions.
11819         (Arm_relocate_functions::thumb_branch_common): New method definition.
11820         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
11821         operator.
11822         (Target_arm::Relocate::relocate): Adjust call to thm_call.
11823         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
11824
11825 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11826
11827         * Makefile.am: Build incremental-dump
11828         * Makefile.in: Regenerate.
11829         * incremental-dump.cc: New.
11830         * incremental.cc (Incremental_inputs_header_data,
11831         Incremental_inputs_entry_data): Move to incremental.h
11832         * incremental.h: (Incremental_inputs_header_data,
11833         Incremental_inputs_entry_data): Move from incremental.cc
11834
11835 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11836
11837         * incremental.cc (Incremental_inputs_header,
11838         Incremental_inputs_header_write, Incremental_inputs_entry,
11839         Incremental_inputs_entry_write): Add a typedef with the data type.
11840
11841 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11842
11843         * incremental.cc (Incremental_inputs_header,
11844         Incremental_inputs_header_write, Incremental_inputs_entry,
11845         Incremental_inputs_entry_write): Update comment about which
11846         type has the filed descriptions.
11847
11848 2009-11-15  Doug Kwan  <dougkwan@google.com>
11849
11850         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11851         (Arm_relocate_functions::arm_branch_common): Change method defintion
11852         in class definition to a method declaration and update list of formal
11853         parameters.
11854         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11855         Arm_relocation_functions::jump24): Adjust call to
11856         Arm_relocate_functions::arm_branch_common.  Update list of formal
11857         parameters.
11858         (Arm_relocate_functions::xpc25): New method definition.
11859         (Arm_relocate_functions::arm_branch_common): Move method defintion
11860         out from class definition.  Use stubs for mode-switching and extending
11861         branch ranges.
11862         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11863         specially.  Change code to enable use of stubs in ARM branches.
11864
11865 2009-11-10  Doug Kwan  <dougkwan@google.com>
11866
11867         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11868         in method declaration.
11869         (Target_arm::relocate_stub): New method declaration.
11870         (Target_arm::default_target): Change to return a pointer instead of
11871         a const reference.
11872         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11873         Target_arm::default_target.
11874         (Arm_Relobj::do_relocate_sections): Remove options paramater in
11875         method definition.
11876         (Target_arm::relocate_section): Adjust view.
11877         (Target_arm::relocate_stub): New method definition.
11878
11879 2009-11-10  Doug Kwan  <dougkwan@google.com>
11880
11881         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11882         a format warning.
11883         * incremental.cc (open_incremental_binary): Initialized local
11884         variables to avoid warnings.
11885         * object.cc (make_elf_object): Ditto.
11886         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11887         a format warning.
11888
11889 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
11890
11891         PR gold/10930
11892         * testsuite/plugin_test.c: Include "config.h".
11893
11894 2009-11-09  Doug Kwan  <dougkwan@google.com>
11895
11896         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
11897         (arm_symbol_value): Remove.
11898         (Arm_relocate_functions::arm_branch_common,
11899         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
11900         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
11901         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
11902         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
11903         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
11904         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
11905         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
11906         Arm_relocate_functions::thm_mobw_abs_nc,
11907         Arm_relocate_functions::thm_mov_abs,
11908         Arm_relocate_functions::movw_prel_nc,
11909         Arm_relocate_functions::thm_movt_abs,
11910         Arm_relocate_functions::movt_prel,
11911         Arm_relocate_functions::thm_movw_prel_nc,
11912         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
11913         (Target_arm::Relocate::relocate): Only decompose address into two
11914         parts if relocation type uses the thumb-bit and pass the actual
11915         bit instead of a flag indicating that the thumb-bit is used.  Adjust
11916         calls to methods in Arm_relocate_functions for this change.
11917
11918 2009-11-08  Ian Lance Taylor  <iant@google.com>
11919
11920         PR 10925
11921         * reloc.cc: Instantiate
11922         Sized_relobj::initialize_input_to_output_maps and
11923         Sized_relobj:free_input_to_output_maps.
11924
11925 2009-11-06  Ian Lance Taylor  <iant@google.com>
11926
11927         PR 10876
11928         * defstd.cc (in_segment): Set only_if_ref true for "end".
11929
11930 2009-11-06  Doug Kwan  <dougkwan@google.com>
11931
11932         * arm.cc (class Reloc_stub): Correct a comment.
11933         (Target_arm::Target_arm): Initialize arm_input_section_map_.
11934         (Target_arm::scan_section_for_stubs): New method declaration.
11935         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
11936         Change methods from private to protected.
11937         (Target_arm::do_may_relax): New method definition.
11938         (Target_arm::do_relax, Target_arm::group_sections,
11939         Target_arm::scan_reloc_for_stub,
11940         Target_arm::scan_reloc_section_for_stubs): New method declarations.
11941         (Target_arm::arm_input_section_map_): New data member declaration.
11942         (Target_arm::scan_reloc_for_stub,
11943         Target_arm::scan_reloc_section_for_stubs,
11944         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
11945         Target_arm::do_relax): New method definitions.
11946
11947 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
11948
11949         * configure.ac: Check for (struct stat)::st_mtim
11950         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
11951         * config.in: Regenerate.
11952         * configure: Regenerate.
11953
11954 2009-11-05  Ian Lance Taylor  <iant@google.com>
11955
11956         PR 10910
11957         * output.cc (Output_segment::add_output_section): Add missing
11958         return statement.
11959
11960 2009-11-04  Ian Lance Taylor  <iant@google.com>
11961
11962         PR 10880
11963         * object.h (class Object): Add is_needed and set_is_needed
11964         methods.  Add is_needed_ field.  Make bool fields into bitfields.
11965         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
11966         defined in a dynamic object and referenced by a regular object,
11967         set is_needed for the dynamic object.
11968         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11969         if the file is marked with as_needed and it is not needed.
11970
11971 2009-11-04  Ian Lance Taylor  <iant@google.com>
11972
11973         PR 10887
11974         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11975         tags if data is discarded by linker script.
11976         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11977         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11978         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11979         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11980
11981 2009-11-04  Ian Lance Taylor  <iant@google.com>
11982
11983         * layout.cc (Layout::get_output_section): Add is_interp and
11984         is_dynamic_linker_section parameters.  Change all callers.
11985         (Layout::choose_output_section): Likewise.
11986         (Layout::make_output_section): Likewise.
11987         (Layout::add_output_section_data): Add is_dynamic_linker_section
11988         parameter.  Change all callers.
11989         * layout.h (class Layout): Update declarations.
11990         * output.h (class Output_section): Add is_interp, set_is_interp,
11991         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11992         Add is_interp_, is_dynamic_linker_section_ fields.  Change
11993         generate_code_fills_at_write_ to a bitfield.
11994         * output.cc (Output_section::Output_sections): Initialize new
11995         fields.
11996         (Output_segment::add_output_section): Add do_sort parameter.
11997         Change all callers.
11998
11999 2009-11-03  Ian Lance Taylor  <iant@google.com>
12000
12001         PR 10860
12002         * options.h (class General_options): Add --warn-common.
12003         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
12004         merging two common symbols.
12005         (Symbol_table::should_override): Handle --warn-common when merging
12006         a common symbol with a defined symbol.  Use report_resolve_problem
12007         for multiple definitions.
12008         (Symbol_table::report_resolve_problem): New function.
12009         * symtab.h (class Symbol_table): Declare report_resolve_problem.
12010
12011 2009-11-03  Doug Kwan  <dougkwan@google.com>
12012
12013         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
12014         stub_factory_.
12015         (Target_arm::stub_factory): New method definition.
12016         (Target_arm::new_arm_input_section,
12017         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
12018         Target_arm::reloc_uses_thumb_bit): New method declarations.
12019         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
12020         New type definitions.
12021         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
12022         member declarations.
12023         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
12024         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
12025         New method definitions.
12026
12027 2009-11-03  Ian Lance Taylor  <iant@google.com>
12028
12029         * options.h (class General_options): Add --warn_constructors.
12030
12031 2009-11-03  Ian Lance Taylor  <iant@google.com>
12032
12033         PR 10893
12034         * defstd.cc (in_section): Add entries for __rel_iplt_start,
12035         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
12036
12037 2009-11-03  Ian Lance Taylor  <iant@google.com>
12038
12039         PR 10895
12040         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
12041         --msgid-bugs-address.
12042         (install-pdf): New target.
12043         (install-data_yes): Look up one directory to find mkinstalldirs.
12044
12045 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
12046
12047         * po/Make-in (.po.gmo): Don't generate .gmo files in source
12048         tree.
12049
12050 2009-10-30  Doug Kwan  <dougkwan@google.com>
12051
12052         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
12053
12054 2009-10-30  Doug Kwan  <dougkwan@google.com>
12055
12056         * arm.cc (Stub_addend_reader): New struct template definition
12057         and partial specializations.
12058         (Stub_addend_reader::operator()): New method definition for a
12059         partially specialized template.
12060
12061 2009-10-30  Doug Kwan  <dougkwan@google.com>
12062
12063         * arm.cc (Arm_relobj::processor_specific_flags): New method
12064         definition.
12065         (Arm_relobj::do_read_symbols): New method declaration.
12066         (Arm_relobj::processor_specific_flags_): New data member declaration.
12067         (Arm_dynobj): New class definition.
12068         (Target_arm::do_finalize_sections): Add input_objects parameter.
12069         (Target_arm::do_adjust_elf_header): New method declaration.
12070         (Target_arm::are_eabi_versions_compatible,
12071         (Target_arm::merge_processor_specific_flags): New method declaration.
12072         (Target_arm::do_make_elf_object): New overloaded method definitions
12073         and declaration.
12074         (Arm_relobj::do_read_symbols): New method definition.
12075         (Arm_dynobj::do_read_symbols): Ditto.
12076         (Target_arm::do_finalize_sections): Add input_objects parameters.
12077         Merge processor-specific flags from all input objects.
12078         (Target_arm::are_eabi_versions_compatible,
12079         Target_arm::merge_processor_specific_flags,
12080         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
12081         New method definitions.
12082         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
12083         Input_objects pointer type parameter.
12084         * layout.cc (Layout::finalize): Pass input objects to target's.
12085         finalize_sections function.
12086         * output.cc (Output_file_header::do_sized_write): Set ELF file
12087         header's processor-specific flags.
12088         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
12089         Input_objects pointer type parameter.
12090         * sparc.cc (Target_sparc::do_finalize_sections): Same.
12091         * target.h (Input_objects): New forward class declaration.
12092         (Target::processor_specific_flags,
12093         Target::are_processor_specific_flags_sect): New method definitions.
12094         (Target::finalize_sections): Add input_objects parameter.
12095         (Target::Target): Initialize processor_specific_flags_ and
12096         are_processor_specific_flags_set_.
12097         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
12098         parameter.
12099         (Target::set_processor_specific_flags): New method definition.
12100         (Target::processor_specific_flags_,
12101         Target::are_processor_specific_flags_set_): New data member
12102         declarations.
12103         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
12104         Input_objects pointer type parameter.
12105
12106 2009-10-30  Doug Kwan  <dougkwan@google.com>
12107
12108         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
12109
12110 2009-10-28  Ian Lance Taylor  <iant@google.com>
12111
12112         * object.h (class Relobj): Drop options parameter from
12113         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
12114         do_scan_relocs, do_relocate.  Change all callers.
12115         (class Sized_relobj): Drop options parameters from
12116         do_gc_process_relocs, do_scan_relocs, do_relocate,
12117         do_relocate_sections, relocate_sections, emit_relocs_scan,
12118         emit_relocs_scan_reltype.  Change all callers.
12119         (struct Relocate_info): Remove options field and all references to
12120         it.
12121         * reloc.h (class Read_relocs): Remove options constructor
12122         parameter and options_ field.  Change all callers.
12123         (class Gc_process_relocs, class Scan_relocs): Likewise.
12124         (class Relocate_task): Likewise.
12125         * target-reloc.h (scan_relocs): Remove options parameter.  Change
12126         all callers.
12127         (scan_relocatable_relocs): Likewise.
12128         * target.h (class Sized_target): Remove options parameter from
12129         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
12130         all callers.
12131         * gc.h (gc_process_relocs): Remove options parameter.  Change all
12132         callers.
12133         * arm.cc: Update functions to remove options parameters.
12134         * i386.cc: Likewise.
12135         * powerpc.cc: Likewise.
12136         * sparc.cc: Likewise.
12137         * x86_64.cc: Likewise.
12138         * testsuite/testfile.cc: Likewise.
12139
12140 2009-10-28  Doug Kwan  <dougkwan@google.com>
12141
12142         * arm.cc (Arm_relobj): New class definition.
12143         (Arm_relobj::scan_sections_for_stubs,
12144         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
12145         New method definitions.
12146
12147 2009-10-28  Cary Coutant  <ccoutant@google.com>
12148
12149         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
12150         (Plugin::cleanup_done_): New member.
12151         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
12152         (Plugin_manager::cleanup_done_): Remove.
12153         (Plugin_manager::add_input_file): Edit error message.
12154         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
12155         (Plugin_manager::cleanup): Remove use of cleanup_done_.
12156
12157 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
12158
12159         * fileread.cc: (File_read::View::~View): Use the new
12160         data_ownership_ filed.
12161         (File_read::~File_read): Dispose the new whole_file_view_.
12162         (File_read::open): Mmap the whole file if needed.
12163         (File_read::open): Use whole_file_view_ instead of contents_.
12164         (File_read::find_view): Use whole_file_view_ if applicable.
12165         (File_read::do_read): Use whole_file_view_ instead of contents_.
12166         (File_read::make_view): Use whole_file_view_ instead of contents_,
12167         update File_read::View::View call.
12168         (File_read::find_or_make_view): Update File_read::View::View
12169         call.
12170         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
12171         remove contents_
12172         (File_read::View::Data_ownership): New enum.
12173         (File_read::View::View): Replace bool mapped_ with Data_ownership
12174         argument.
12175         (File_read::View::mapped_): Remove (replaced by data_ownership_).
12176         (File_read::View::data_ownership_): New field.
12177         (File_read::contents_): Remove (replaced by whole_file_view_).
12178         (File_read::whole_file_view_): New field.
12179         * options.h (class General_options): Add --keep-files-mapped.
12180
12181 2009-10-27  Cary Coutant  <ccoutant@google.com>
12182
12183         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
12184         * testsuite/Makefile.am (plugin_test_5): New test case.
12185         * testsuite/Makefile.in: Regenerate.
12186
12187 2009-10-25  Doug Kwan  <dougkwan@google.com>
12188
12189         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
12190         from private to protected to allow access by child class.
12191         (Sized_relobj::do_relocate_sections): New method declaration.
12192         (Sized_relobj::relocate_sections): Virtualize.
12193         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
12194         Sized_relobj::relocate_sections.  Instantiate template explicitly
12195         for different target sizes and endianity.
12196
12197 2009-10-24  Doug Kwan  <dougkwan@google.com>
12198
12199         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
12200         (Arm_input_section::as_arm_input_section): New method.
12201         (Arm_output_section): New class definition.
12202         (Arm_output_section::create_stub_group,
12203         Arm_output_section::group_sections): New method definitions.
12204
12205 2009-10-22  Doug Kwan  <dougkwan@google.com>
12206
12207         * arm.cc (Arm_input_section): New class definition.
12208         (Arm_input_section::init, Arm_input_section:do_write,
12209         Arm_input_section::set_final_data_size,
12210         Arm_input_section::do_reset_address_and_file_offset): New method
12211         definitions.
12212
12213 2009-10-21  Doug Kwan  <dougkwan@google.com>
12214
12215         * arm.cc (Stub_table, Arm_input_section): New forward class
12216         declarations.
12217         (Stub_table): New class defintion.
12218         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
12219         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
12220         New method definition.
12221
12222 2009-10-21  Doug Kwan  <dougkwan@google.com>
12223
12224         * arm.cc: Update copyright comments.
12225         (Target_arm): New forward class template declaration.
12226         (Arm_address): New type.
12227         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
12228         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
12229         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
12230         constants.
12231         (Insn_template): Same.
12232         (DEF_STUBS): New macro.
12233         (Stub_type): New enum type.
12234         (Stub_template): New class definition.
12235         (Stub): Same.
12236         (Reloc_stub): Same.
12237         (Stub_factory): Same.
12238         (Target_arm::Target_arm): Initialize may_use_blx_ and
12239         should_force_pic_veneer_.
12240         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
12241         Target_arm::should_force_pic_veneer,
12242         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
12243         Target_arm::using_thumb_only, Target_arm:;default_target): New
12244         method defintions.
12245         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
12246         New data member declarations.
12247         (Insn_template::size, Insn_template::alignment): New method defintions.
12248         (Stub_template::Stub_template): New method definition.
12249         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
12250         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
12251         (Stub_factory::Stub_factory): New method definition.
12252         * gold.h (string_hash): New template.
12253         * output.h (Input_section_specifier::hash_value): Use
12254         gold::string_hash.
12255         (Input_section_specifier::string_hash): Remove.
12256         * stringpool.cc (Stringpool_template::string_hash): Use
12257         gold::string_hash.
12258
12259 2009-10-20  Doug Kwan  <dougkwan@google.com>
12260
12261         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
12262         symbols of relaxed input sections.
12263         * output.h (Output_section::find_relaxed_input_section): Make
12264         method public.
12265
12266 2009-10-16  Doug Kwan  <dougkwan@google.com>
12267
12268         * dynobj.cc (Versions::Versions): Initialize version_script_.
12269         Only insert base version symbol definition for a shared object
12270         if version script defines any version versions.
12271         (Versions::define_base_version): New method definition.
12272         (Versions::add_def): Check that base version is not needed.
12273         (Versions::add_need): Define base version lazily.
12274         * dynobj.h (Versions::define_base_version): New method declaration.
12275         (Versions::needs_base_version_): New data member declaration.
12276         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
12277         (check_DATA): Add no_version_test.stdout.
12278         (libno_version_test.so, no_version_test.o no_version_test.stdout):
12279         New make rules.
12280         * testsuite/Makefile.in: Regenerate.
12281         * testsuite/no_version_test.c: New file.
12282         * testsuite/no_version_test.sh: Ditto.
12283
12284 2009-10-16  Doug Kwan  <dougkwan@google.com>
12285
12286         * expression.cc (class Segment_start_expression): New class definition.
12287         (Segment_start_expression::value): New method definition.
12288         (script_exp_function_segment_start): Return a new
12289         Segment_start_expression.
12290         * gold/script-c.h (script_saw_segment_start_expression): New function
12291         prototype.
12292         * script-sections.cc (Script_sections::Script_sections): Initialize
12293         SAW_SEGMENT_START_EXPRESSION_ to false.
12294         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
12295         and -Tbbs options to specify section addresses if given in
12296         command line and no SEGMENT_START expression is seen in a script.
12297         * script-sections.h (Script_sections::saw_segment_start_expression,
12298         Script_sections::set_saw_segment_start_expression): New method
12299         definition.
12300         (Script_sections::saw_segment_start_expression_): New data member
12301         declaration.
12302         * script.cc (script_saw_segment_start_expression): New function.
12303         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
12304         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
12305         script_test_7.sh and script_test_8.sh.
12306         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
12307         script_test_8.stdout.
12308         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
12309         (script_test_6, script_test_6.stdout, script_test_7,
12310         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
12311         * Makefile.in: Regenerate.
12312         * testsuite/script_test_6.sh: New file.
12313         * testsuite/script_test_6.t: Same.
12314         * testsuite/script_test_7.sh: Same.
12315         * testsuite/script_test_7.t: Same.
12316         * testsuite/script_test_8.sh: Same.
12317
12318 2009-10-16  Doug Kwan  <dougkwan@google.com>
12319
12320         * output.cc (Output_segment::set_section_list_address): Cast
12321         expressions to unsigned long long type to avoid format warnings.
12322
12323 2009-10-15  Ian Lance Taylor  <iant@google.com>
12324
12325         * script.cc (Script_options::add_symbol_assignment): Always add a
12326         dot assignment to script_sections_.
12327         * script-sections.cc (Script_sections::add_dot_assignment):
12328         Initialize if necessary.
12329
12330         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
12331         program headers with no load segment if there is a linker script.
12332
12333         * layout.cc (Layout::set_segment_offsets): Align the file offset
12334         to the segment aligment for -N or -n with no load segment.
12335         * output.cc (Output_segment::add_output_section): Don't crash if
12336         the first section is a TLS section.
12337         (Output_segment::set_section_list_addresses): Print an error
12338         message if the address moves backward in a linker script.
12339         * script-sections.cc
12340         (Output_section_element_input::set_section_addresses): Don't
12341         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
12342         (Orphan_output_section::set_section_addresses): Likewise.
12343
12344 2009-10-15  Doug Kwan  <dougkwan@google.com>
12345
12346         * layout.cc (Layout::finish_dynamic_section): Generate tags
12347         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
12348         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
12349         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
12350
12351 2009-10-14  Ian Lance Taylor  <iant@google.com>
12352
12353         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
12354         fields.
12355         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
12356         data_shdr fields of relinfo.
12357         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
12358         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
12359         R_386_TLS_LDO_32, adjust based on section flags.
12360         (Target_i386::Relocate::fix_up_ldo): Remove.
12361
12362 2009-10-13  Ian Lance Taylor  <iant@google.com>
12363
12364         Add support for -pie.
12365         * options.h (class General_options): Add -pie and
12366         --pic-executable.
12367         (General_options::output_is_position_independent): Test -pie.
12368         (General_options::output_is_executable): Return true if not shared
12369         and not relocatable.
12370         (General_options::output_is_pie): Remove.
12371         * options.cc (General_options::finalize): Reject incompatible uses
12372         of -pie.
12373         * gold.cc (queue_middle_tasks): A -pie link is not static.
12374         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
12375         * symtab.cc (Symbol::final_value_is_known): Return false if
12376         output_is_position_independent.
12377         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
12378         output_is_position_independent.
12379         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
12380         output_is_position_independent.
12381         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
12382         output_is_position_independent.
12383         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
12384         two_file_pie_test.
12385         (basic_pie_test.o, basic_pie_test): New targets.
12386         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
12387         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
12388         (two_file_pie_test): New target.
12389         * testsuite/Makefile.in: Rebuild.
12390         * README: Remove note saying that -pie is not supported.
12391
12392 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
12393
12394         * options.h (class General_options): Add -init and -fini.
12395         * layout.cc (Layout::finish_dynamic_section): Emit
12396         given init and fini functions.
12397
12398 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
12399
12400         * gc.h (gc_process_relocs): Check if icf is enabled using new
12401         function.
12402         * gold.cc (queue_initial_tasks): Likewise.
12403         (queue_middle_tasks): Likewise.
12404         * object.cc (do_layout): Likewise.
12405         * symtab.cc (is_section_folded): Likewise.
12406         * main.cc (main): Likewise.
12407         * reloc.cc (Read_relocs::run): Likewise.
12408         (Sized_relobj::do_scan_relocs): Likewise.
12409         * icf.cc (is_function_ctor_or_dtor): New function.
12410         (Icf::find_identical_sections): Check if function is ctor or dtor when
12411         safe icf is chosen.
12412         * options.h (General_options::icf): Change option to be an enum.
12413         (Icf_status): New enum.
12414         (icf_enabled): New method.
12415         (icf_safe_folding): New method.
12416         (set_icf_status): New method.
12417         (icf_status_): New variable.
12418         * (options.cc) (General_options::finalize): Set icf_status_.
12419         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
12420         icf_test and icf_keep_unique_test to use the --icf enum flag.
12421         * testsuite/icf_safe_test.sh: New file.
12422         * testsuite/icf_safe_test.cc: New file.
12423
12424 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
12425
12426         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
12427         includes to gc.h and icf.h.
12428         * arm.cc: Include gc.h.
12429         * gold.cc: Likewise.
12430         * i386.cc: Likewise.
12431         * powerpc.cc: Likewise.
12432         * sparc.cc: Likewise.
12433         * x86_64.cc: Likewise.
12434         * gc.h: Include icf.h.
12435
12436 2009-10-11  Ian Lance Taylor  <iant@google.com>
12437
12438         * plugin.cc: Include "gold.h" before other header files.
12439
12440 2009-10-10  Chris Demetriou  <cgd@google.com>
12441
12442         * options.h (Input_file_argument::Input_file_type): New enum.
12443         (Input_file_argument::is_lib_): Replace with...
12444         (Input_file_argument::type_): New member.
12445         (Input_file_argument::Input_file_argument): Take Input_file_type
12446         'type' rather than boolean 'is_lib' as second argument.
12447         (Input_file_argument::is_lib): Use type_.
12448         (Input_file_argument::is_searched_file): New function.
12449         (Input_file_argument::may_need_search): Handle is_searched_file.
12450         * options.cc (General_options::parse_library): Support -l:filename.
12451         (General_options::parse_just_symbols): Update for Input_file_argument
12452         changes.
12453         (Command_line::process): Likewise.
12454         * archive.cc (Archive::get_file_and_offset): Likewise.
12455         * plugin.cc (Plugin_manager::release_input_file): Likewise.
12456         * script.cc (read_script_file, script_add_file): Likewise.
12457         * fileread.cc (Input_file::Input_file): Likewise.
12458         (Input_file::will_search_for): Handle is_searched_file.
12459         (Input_file::open): Likewise.
12460         * readsyms.cc (Read_symbols::get_name): Likewise.
12461         * testsuite/Makefile.am (searched_file_test): New test.
12462         * testsuite/Makefile.in: Regenerate.
12463         * testsuite/searched_file_test.cc: New file.
12464         * testsuite/searched_file_test_lib.cc: New file.
12465
12466 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12467             Ian Lance Taylor  <iant@google.com>
12468
12469         * descriptor.cc: Include <cstdio> and "binary-io.h".
12470         (Descriptors::open): Open the files in binary mode always.
12471         * script.cc (Lex::get_token): Treat \r as whitespace.
12472
12473 2009-10-09  Ian Lance Taylor  <iant@google.com>
12474
12475         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
12476
12477 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12478             Ian Lance Taylor  <iant@google.com>
12479
12480         * configure.ac: Check for readv function also.
12481         * fileread.cc (readv): Define if not HAVE_READV.
12482         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
12483         does not exist.
12484         * config.in: Regenerate.
12485         * configure: Regenerate.
12486
12487 2009-10-09  Doug Kwan  <dougkwan@google.com>
12488
12489         * layout.cc (Layout::make_output_section): Call target hook to make
12490         ordinary output section.
12491         (Layout::finalize): Adjust parameter list of call the
12492         Target::may_relax().
12493         * layout.h (class Layout::section_list): New method.
12494         * merge.h (Output_merge_base::entsize): Change visibility to public.
12495         (Output_merge_base::is_string, Output_merge_base::do_is_string):
12496         New methods.
12497         (Output_merge_string::do_is_string): New method.
12498         * object.cc (Sized_relobj::do_setup): renamed from
12499         Sized_relobj::set_up.
12500         * object.h (Sized_relobj::adjust_shndx,
12501         Sized_relobj::initializ_input_to_output_maps,
12502         Sized_relobj::free_input_to_output_maps): Change visibilities to
12503         protected.
12504         (Sized_relobj::setup): Virtualize.
12505         (Sized_relobj::do_setup): New method declaration.
12506         (Sized_relobj::invalidate_section_offset,
12507         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
12508         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
12509         * options.cc (parse_int): New function.
12510         * options.h (parse_int): New declaration.
12511         (DEFINE_int): New macro.
12512         (stub_group_size): New option.
12513         * output.cc (Output_section::Output_section): Initialize memebers
12514         merge_section_map_, merge_section_by_properties_map_,
12515         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
12516         (Output_section::add_input_section): Handled deferred code-fill
12517         generation and remove an old comment.
12518         (Output_section::add_relaxed_input_section): New method definition.
12519         (Output_section::add_merge_input_section): Use merge section by
12520         properties map to speed to search.  Update merge section maps
12521         as appropriate.
12522         (Output_section::build_relaxation_map): New method definition.
12523         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
12524         Same.
12525         (Output_section::relax_input_section): Renamed to
12526         Output_section::convert_input_sections_to_relaxed_sections and change
12527         interface to take a vector of pointers to relaxed sections.
12528         (Output_section::find_merge_section,
12529         Output_section::find_relaxed_input_section): New method definitions.
12530         (Output_section::is_input_address_mapped,
12531         Output_section::output_offset, Output_section::output_address):
12532         Use output section data maps to speed up searching.
12533         (Output_section::find_starting_output_address): Add comments.
12534         (Output_section::do_write,
12535         Output_section::write_to_postprocessing_buffer): Do code-fill
12536         generation as appropriate.
12537         (Output_section::get_input_sections): Invalidate relaxed input section
12538         map.
12539         (Output_section::restore_states): Adjust type of checkpoint .
12540         Invalidate relaxed input section map.
12541         * output.h (Output_merge_base): New class declaration.
12542         (Input_section_specifier): New class defintion.
12543         (class Output_relaxed_input_section) Change base class to
12544         Output_section_data_build.
12545         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
12546         base class initializer.
12547         (Output_section::add_relaxed_input_section): New method declaration.
12548         (Output_section::Input_section): Change visibility to protected.
12549         (Output_section::Input_section::relobj,
12550         Output_section::Input_section::shndx): Handle relaxed input sections.
12551         Output_section::input_sections) Change visibility to protected.  Also
12552         define overload to return a non-const pointer.
12553         (Output_section::Merge_section_properties): New class defintion.
12554         (Output_section::Merge_section_by_properties_map,
12555         Output_section::Output_section_data_by_input_section_map,
12556         Output_section::Relaxation_map): New types.
12557         (Output_section::relax_input_section): Rename method to
12558         Output_section::convert_input_sections_to_relaxed_sections and change
12559         interface to take a vector of relaxed section pointers.
12560         (Output_section::find_merge_section,
12561         Output_section::find_relaxed_input_section,
12562         Output_section::build_relaxation_map,
12563         Output_section::convert_input_sections_in_list_to_relaxed_sections):
12564         New method declarations.
12565         (Output_section::merge_section_map_
12566         Output_section::merge_section_by_properties_map_,
12567         Output_section::relaxed_input_section_map_,
12568         Output_section::is_relaxed_input_section_map_valid_,
12569         Output_section::generate_code_fills_at_write_): New data members.
12570         * script-sections.cc
12571         (Output_section_element_input::set_section_addresses): Call
12572         current_data_size and addralign methods of relaxed input sections.
12573         (Orphan_output_section::set_section_addresses): Call current_data_size
12574         and addralign methods of relaxed input sections.
12575         * symtab.cc (Symbol_table::compute_final_value): Extract template
12576         from the body of Symbol_table::sized_finalize_symbol.
12577         (Symbol_table::sized_finalized_symbol): Call
12578         Symbol_table::compute_final_value.
12579         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
12580         (Symbol_table::compute_final_value): New templated method declaration.
12581         * target.cc (Target::do_make_output_section): New method defintion.
12582         * target.h (Target::make_output_section): New method declaration.
12583         (Target::relax): Add more parameters for input objects, symbol table
12584         and layout.  Adjust call to do_relax.
12585         (Target::do_make_output_section): New method declaration.
12586         (Target::do_relax): Add parameters for input objects, symbol table
12587         and layout.
12588
12589 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12590
12591         * pread.c: Include stdio.h.
12592
12593 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12594
12595         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
12596         defined.
12597
12598 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12599
12600         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
12601         Change read_shndx type to unsigned int.
12602         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12603         int.
12604         (Sized_dwarf_line_info::read_line_mappings): Likewise.
12605         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
12606         Change read_shndx type to unsigned int.
12607         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12608         int.
12609         (Sized_dwarf_line_info::read_line_mappings): Likewise.
12610         * layout.cc (Layout::create_symtab_sections): Cast the result of
12611         local_symcount * symsize to off_t in the gold_assert.
12612
12613 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12614
12615         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
12616         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
12617         R_ARM_BASE_ABS.
12618         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
12619         (Arm_relocate_functions::thm_abs5): New function.
12620         (Arm_relocate_functions::abs12): New function.
12621         (Arm_relocate_functions::abs16): New function.
12622         (Arm_relocate_functions::base_abs): New function.
12623         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
12624         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
12625         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
12626         R_ARM_BASE_ABS.
12627         (Scan::global): Likewise.
12628         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
12629         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
12630         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
12631         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
12632         R_ARM_BASE_ABS.
12633
12634 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12635
12636         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
12637         (Arm_relocate_functions::movt_prel): New function.
12638         (Arm_relocate_functions::thm_movw_prel_nc): New function.
12639         (Arm_relocate_functions::thm_movt_prel): New function.
12640         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
12641         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
12642         (Scan::global, Relocate::relocate): Likewise.
12643         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12644
12645 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
12646
12647         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
12648         Incremental_checker.
12649         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
12650         unsigned int.
12651         (class Incremental_inputs_header): New class.
12652         (Incremental_inputs_header_writer): Edit comment.
12653         (Incremental_inputs_entry): New class.
12654         (Incremental_inputs_entry_writer): Edit comment.
12655         (Sized_incremental_binary::do_find_incremental_inputs_section):
12656         Add *strtab_shndx parameter, fill it.
12657         (Sized_incremental_binary::do_check_inputs): New method.
12658         (Incremental_checker::can_incrementally_link_output_file): Use
12659         Sized_incremental_binary::check_inputs.
12660         (Incremental_inputs::report_command_line): Save command line in
12661         command_line_.
12662         * incremental.h:
12663         (Incremental_binary::find_incremental_inputs_section): New
12664         method.
12665         (Incremental_binary::do_find_incremental_inputs_section): Add
12666         strtab_shndx parameter.
12667         (Incremental_binary::do_check_inputs): New pure virtual method.
12668         (Sized_incremental_binary::do_check_inputs): Declare.
12669         (Incremental_checker::Incremental_checker): Add incremental_inputs
12670         parameter, use it to initialize incremental_inputs_.
12671         (Incremental_checker::incremental_inputs_): New field.
12672         (Incremental_checker::command_line): New method.
12673         (Incremental_checker::inputs): New method.
12674         (Incremental_checker::command_line_): New field.
12675
12676 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
12677
12678         * incremental.cc: Include <cstdarg> and "target-select.h".
12679         (vexplain_no_incremental): New function.
12680         (explain_no_incremental): New function.
12681         (Incremental_binary::error): New method.
12682         (Sized_incremental_binary::do_find_incremental_inputs_section): New
12683         method.
12684         (make_sized_incremental_binary): New function.
12685         (open_incremental_binary): New function.
12686         (can_incrementally_link_file): Add checks if output is ELF and has
12687         inputs section.
12688         * incremental.h: Include "elfcpp_file.h" and "output.h".
12689         (Incremental_binary): New class.
12690         (Sized_incremental_binary): New class.
12691         (open_incremental_binary): Declare.
12692         * object.cc (is_elf_object): Use
12693         elfcpp::Elf_recognizer::is_elf_file.
12694         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
12695         * output.h (Output_file::filesize): New method.
12696
12697 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12698
12699         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
12700         New function.
12701         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
12702         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
12703         function.
12704         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
12705         function.
12706         (Arm_relocate_functions::movw_abs_nc): New function.
12707         (Arm_relocate_functions::movt_abs): New function.
12708         (Arm_relocate_functions::thm_movw_abs_nc): New function.
12709         (Arm_relocate_functions::thm_movt_abs): New function.
12710         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
12711         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
12712         (Scan::global): Likewise.
12713         (Relocate::relocate): Likewise.
12714         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12715
12716 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12717
12718         * arm.cc (Arm_relocate_functions::got_prel) New function.
12719         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
12720         (Relocate::relocate): Likewise.
12721         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12722
12723 2009-10-06  Ian Lance Taylor  <iant@google.com>
12724
12725         * options.h (class General_options): Define
12726         split_stack_adjust_size parameter.
12727         * object.h (class Object): Add uses_split_stack_ and
12728         has_no_split_stack_ fields.  Add uses_split_stack and
12729         has_no_split_stack accessor functions.  Declare
12730         handle_split_stack_section.
12731         (class Reloc_symbol_changes): Define.
12732         (class Sized_relobj): Define Function_offsets.  Declare
12733         split_stack_adjust, split_stack_adjust_reltype, and
12734         find_functions.
12735         * object.cc (Object::handle_split_stack_section): New function.
12736         (Sized_relobj::do_layout): Call handle_split_stack_section.
12737         * dynobj.cc (Sized_dynobj::do_layout): Call
12738         handle_split_stack_section.
12739         * reloc.cc (Sized_relobj::relocate_sections): Call
12740         split_stack_adjust for executable sections in split_stack
12741         objects.  Pass reloc_map to relocate_section.
12742         (Sized_relobj::split_stack_adjust): New function.
12743         (Sized_relobj::split_stack_adjust_reltype): New function.
12744         (Sized_relobj::find_functions): New function.
12745         * target-reloc.h: Include "object.h".
12746         (relocate_section): Add reloc_symbol_changes parameter.  Change
12747         all callers.
12748         * target.h (class Target): Add calls_non_split method.  Declare
12749         do_calls_non_split virtual method.  Declare match_view and
12750         set_view_to_nop.
12751         * target.cc: Include "elfcpp.h".
12752         (Target::do_calls_non_split): New function.
12753         (Target::match_view): New function.
12754         (Target::set_view_to_nop): New function.
12755         * gold.cc (queue_middle_tasks): Give an error if mixing
12756         split-stack and non-split-stack objects with -r.
12757         * i386.cc (Target_i386::relocate_section): Add
12758         reloc_symbol_changes parameter.
12759         (Target_i386::do_calls_non_split): New function.
12760         * x86_64.cc (Target_x86_64::relocate_section): Add
12761         reloc_symbol_changes parameter.
12762         (Target_x86_64::do_calls_non_split): New function.
12763         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
12764         parameter.
12765         * powerpc.cc (Target_powerpc::relocate_section): Add
12766         reloc_symbol_changes parameter.
12767         * sparc.cc (Target_sparc::relocate_section): Add
12768         reloc_symbol_changes parameter.
12769         * configure.ac: Call AM_CONDITIONAL for the default target.
12770         * configure: Rebuild.
12771         * testsuite/Makefile.am (TEST_AS): New variable.
12772         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
12773         (check_DATA): Add split_i386 and split_x86_64 files.
12774         (SPLIT_DEFSYMS): Define.
12775         (split_i386_[1234n].o): New targets.
12776         (split_i386_[124]): New targets.
12777         (split_i386_[1234r].stdout): New targets.
12778         (split_x86_64_[1234n].o): New targets.
12779         (split_x86_64_[124]): New targets.
12780         (split_x86_64_[1234r].stdout): New targets.
12781         (MOSTLYCLEANFILES): Add new executables.
12782         * testsuite/split_i386.sh: New file.
12783         * testsuite/split_x86_64.sh: New file.
12784         * testsuite/split_i386_1.s: New file.
12785         * testsuite/split_i386_2.s: New file.
12786         * testsuite/split_i386_3.s: New file.
12787         * testsuite/split_i386_4.s: New file.
12788         * testsuite/split_i386_n.s: New file.
12789         * testsuite/split_x86_64_1.s: New file.
12790         * testsuite/split_x86_64_2.s: New file.
12791         * testsuite/split_x86_64_3.s: New file.
12792         * testsuite/split_x86_64_4.s: New file.
12793         * testsuite/split_x86_64_n.s: New file.
12794         * testsuite/testfile.cc (Target_test): Update relocation_section
12795         function.
12796         * testsuite/Makefile.in: Rebuild.
12797
12798 2009-10-06  Ian Lance Taylor  <iant@google.com>
12799
12800         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
12801         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
12802         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
12803         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
12804         the address on ldo_addrs_.
12805         (Target_i386::Relocate::fix_up_ldo): New function.
12806
12807 2009-10-06   Rafael Espindola  <espindola@google.com>
12808
12809         * plugin.cc (add_input_library): New.
12810         (Plugin::load): Add add_input_library to tv.
12811         (Plugin_manager::add_input_file): Add the is_lib argument.
12812         (add_input_file): Update call to Plugin_manager::add_input_file.
12813         (add_input_library): New.
12814         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
12815
12816 2009-09-30  Doug Kwan  <dougkwan@google.com>
12817
12818         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
12819         symbol and call Symbol::may_need_copy_reloc to determine if
12820         a copy reloc is needed.
12821         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12822         nocopyreloc is given in command line.
12823         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12824         given in command line.
12825         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12826         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
12827         of the removed Target_i386::may_need_copy_reloc.
12828         * options.h (copyreloc): New option with default value false.
12829         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12830         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12831         instead of the removed Target_powerpc::may_need_copy_reloc.
12832         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12833         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
12834         instead of the removed Target_sparc::may_need_copy_reloc.
12835         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
12836         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
12837         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12838         instead of the removed Target_x86_64::may_need_copy_reloc.
12839
12840 2009-09-30  Ian Lance Taylor  <iant@google.com>
12841
12842         * object.h (class Object): Remove target_ field, and target,
12843         sized_target, and set_target methods.
12844         (Object::sized_target): Remove.
12845         (class Sized_relobj): Update declarations.  Remove sized_target.
12846         * object.cc (Sized_relobj::setup): Remove target parameter.
12847         Change all callers.
12848         (Input_objects::add_object): Don't do anything with the target.
12849         (make_elf_sized_object): Add punconfigured parameter.  Change all
12850         callers.  Set or test parameter target.
12851         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12852         Change all callers.
12853         * parameters.cc (Parameters::set_target): Change parameter type to
12854         be non-const.
12855         (Parameters::default_target): Remove.
12856         (set_parameters_target): Change parameter type to be non-const.
12857         (parameters_force_valid_target): New function.
12858         (parameters_clear_target): New function.
12859         * parameters.h (class Parameters): Update declarations.  Remove
12860         default_target method.  Add sized_target and clear_target
12861         methods.  Change target_ to be non-const.
12862         (set_parameters_target): Update declaration.
12863         (parameters_force_valid_target): Declare.
12864         (parameters_clear_target): Declare.
12865         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12866         as NULL if we aren't searching.
12867         (Add_symbols::run): Don't check for compatible target.
12868         * fileread.cc (Input_file::open_binary): Call
12869         parameters_force_valid_target.
12870         * gold.cc (queue_middle_tasks): Likewise.
12871         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
12872         set_target on object.
12873         * dynobj.h (class Sized_dynobj): Update declarations.
12874         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12875         make_elf_object returns NULL.
12876         (Archive::include_member): Don't check whether object target is
12877         compatible.
12878         * output.cc (Output_section::add_input_section): Get target from
12879         parameters.
12880         (Output_section::relax_input_section): Likewise.
12881         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12882         parameters.
12883         (Sized_relobj::do_scan_relocs): Likewise.
12884         (Sized_relobj::relocate_sections): Likewise.
12885         * resolve.cc (Symbol_table::resolve): Likewise.
12886         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
12887         parameter.  Change all callers.
12888         (Symbol_table::add_from_object): Get target from parameters.
12889         (Symbol_table::add_from_relobj): Don't check object target.
12890         (Symbol_table::add_from_dynobj): Likewise.
12891         (Symbol_table::define_special_symbol): Get target from
12892         parameters.
12893         * symtab.h (class Symbol_table): Update declaration.
12894         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
12895         parameter.  Change all callers.  Clear parameter target.
12896         (Binary_test): Test target here.
12897         * testsuite/object_unittest.cc (gold_testsuite): Remove
12898         target_test_pointer parameter.  Change all callers.
12899         (Object_test): Test target here.
12900
12901 2009-09-26  Ian Lance Taylor  <iant@google.com>
12902
12903         * testsuite/initpri1.c: Don't try to use constructor priorities if
12904         compiling with gcc before 4.3.
12905
12906 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
12907
12908         * testsuite/retain_symbols_file_test.sh (check_present): Change
12909         output file name to retain_symbols_file_test.stdout.
12910         (check_absent): Likewise.
12911
12912 2009-09-18  Craig Silverstein  <csilvers@google.com>
12913
12914         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
12915         * options.cc: Include <cerrno> and <fstream>.
12916         (General_options::finalize): Parse -retain-symbols-file tag.
12917         * options.h: New flag.
12918         (General_options): New method should_retain_symbol, new
12919         variable symbols_to_retain.
12920         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
12921         should_retain_symbol map.
12922         * testsuite/Makefile.am (retain_symbols_file_test): New test.
12923         * testsuite/Makefile.in: Regenerate.
12924         * testsuite/retain_symbols_file_test.sh: New file.
12925
12926 2009-09-18  Nick Clifton  <nickc@redhat.com>
12927
12928         * po/es.po: Updated Spanish translation.
12929
12930 2009-09-17  Doug Kwan  <dougkwan@google.com>
12931
12932         * debug.h (DEBUG_RELAXATION): New constant.
12933         (DEBUG_ALL): Add DEBUG_RELAXATION.
12934         (debug_string_to_enum): Add relaxation debug option.
12935         * layout.cc
12936         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
12937         Layout::Relaxation_debug_check::read_sections,
12938         Layout::Relaxation_debug_check::read_sections): New method definitions.
12939         (Layout::Layout): Initialize data members
12940         record_output_section_data_from_scrips_,
12941         script_output_section_data_list_ and relaxation_debug_check_.
12942         (Layout::save_segments, Layout::restore_segments,
12943         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12944         Layout::relaxation_loop_body): New method definitions.
12945         (Layout::finalize): Support relaxation.  Move section layout code to
12946         Layout::relaxation_loop_body.
12947         (Layout::set_asection_address_from_script): Move code for orphan
12948         section placement out.
12949         (Layout::place_orphan_sections_in_script): New method definition.
12950         * layout.h (Output_segment_headers, Output_file_header):
12951         New forward class declarations.
12952         (Layout::~Layout): Define.
12953         (Layout::new_output_section_data_from_script): New method definition.
12954         (Layout::place_orphan_sections_in_script): New method declaration.
12955         (Layout::Segment_states): New type declaration.
12956         (Layout::save_segments, Layout::restore_segments,
12957         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12958         Layout::relaxation_loop_body): New method declarations.
12959         (Layout::Output_section_data_list): New type declaration.
12960         (Layout::Relaxation_debug_check): New class definition.
12961         (Layout::record_output_section_data_from_script_,
12962         Layout::script_output_section_data_list_, Layout::segment_states_,
12963         Layout::relaxation_debug_check_): New data members.
12964         * output.cc: (Output_section_headers::do_size): New method definition.
12965         (Output_section_headers::Output_section_headers): Move size
12966         computation to Output_section_headers::do_size.
12967         (Output_segment_headers::do_size): New method definition.
12968         (Output_file_header::Output_file_header): Move size computation to
12969         Output_file_header::do_size and call it.
12970         (Output_file_header::do_size): New method definition.
12971         (Output_data_group::Output_data_group): Adjust call to
12972         Output_section_data.
12973         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12974         (Output_symtab_xindex::do_write): Add array bound check.
12975         (Output_section::Input_section::print_to_mapfile): Handle
12976         RELAXED_INPUT_SECTION_CODE.
12977         (Output_section::Output_section): Initialize data member checkpoint_.
12978         (Output_section::~Output_section): Delete checkpoint object pointed
12979         by checkpoint_.
12980         (Output_section::add_input_section): Always add an Input_section if
12981         relaxing.
12982         (Output_section::add_merge_input_section): Add assert.
12983         (Output_section::relax_input_section): New method definition.
12984         (Output_section::set_final_data_size): Set load address to zero for
12985         an unallocated section.
12986         (Output_section::do_address_and_file_offset_have_reset_values):
12987         New method definition.
12988         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12989         Handle relaxed input section.
12990         (Output_section::sort_attached_input_sections): Checkpoint input
12991         section list lazily.
12992         (Output_section::get_input_sections): Change type of input_sections to
12993         list of Simple_input_section pointers.  Checkpoint input section list
12994         lazily.  Also handle relaxed input sections.
12995         (Output_section::add_input_section_for_script): Take a reference to
12996         a Simple_input_section object instead of Relobj pointer and section
12997         index as parameter.  Handle relaxed input sections.
12998         (Output_section::save_states, Output_section::restore_states): New
12999         method definitions.
13000         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
13001         (Output_data::is_data_size_fixed): New method definition.
13002         (Output_data::reset_addresss_and_file_offset): Do not reset data size
13003         if it is fixed.
13004         (Output_data::address_and_file_offset_have_reset_values): New method
13005         definition.
13006         (Output_data::do_address_and_file_offset_have_reset_values): New method
13007         definition.
13008         (Output_data::set_data_size): Check that data size is not fixed.
13009         (Output_data::fix_data_size): New method definition.
13010         (Output_data::is_data_size_fixed_): New data member.
13011         (Output_section_headers::set_final_data_size): New method definition.
13012         (Output_section_headers::do_size): New method declaration.
13013         (Output_segment_headers::set_final_data_size): New method definition.
13014         (Output_segment_headers::do_size): New method declaration.
13015         (Output_file_header::set_final_data_size)::New method definition.
13016         (Output_file_header::do_size)::New method declaration.
13017         (Output_section_data::Output_section_data): Add new parameter
13018         is_data_size_fixed and use it to fix data size.
13019         (Output_data_const::Output_data_const): Adjust call to base class
13020         constructor and fix data size.
13021         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
13022         base class constructor and fix data size.
13023         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
13024         base class constructor and fix data size.
13025         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
13026         class constructor and fix data size.
13027         (Output_data_group::set_final_data_size): New method definition.
13028         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
13029         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
13030         class constructor and fix data size.
13031         (Output_relaxed_input_section): New class definition.
13032         (Output_section::Simple_input_section): New class definition.
13033         (Output_section::get_input_sections): Adjust parameter list.
13034         (Output_section::add_input_section_for_script): Same.
13035         (Output_section::save_states, Output_section::restore_states,
13036         Output_section::do_address_and_file_offset_have_reset_values,
13037         (Output_section::Input_section::Input_section): Handle
13038         RELAXED_INPUT_SECTION_CODE.  Add new overload for
13039         Output_relaxed_input_section.
13040         (Output_section::Input_section::is_input_section,
13041         Output_section::Input_section::set_output_section): Handle relaxed
13042         input section.
13043         (Output_section::Input_section::is_relaxed_input_section,
13044         Output_section::Input_section::output_section_data,
13045         Output_section::Input_section::relaxed_input_section): New method
13046         definitions.
13047         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
13048         value.
13049         (Output_section::Input_section::u1_): Update comments.
13050         (Output_section::Input_section::u2_): Add new union member poris.
13051         (Output_section::Checkpoint_output_section): New classs definition.
13052         (Output_section::relax_input_section): New method declaration.
13053         (Output_section::checkpoint_): New data member.
13054         (Output_segment): Update comments.
13055         (Output_segment::Output_segment): Un-privatize copy constructor.
13056         (Output_segment::operator=): Un-privatize.
13057         * script-sections.cc (Output_section_element::Input_section_list):
13058         Change element type to Output_section::Simple_input_section.
13059         (Output_section_element_dot_assignment::set_section_addresses):
13060         Register output section data for relaxation clean up.
13061         (Output_data_exression::Output_data_expression): Adjust call to base
13062         constructor to fix data size.
13063         (Output_section_element_data::set_section_addresses): Register
13064         Output_data_expression object for relaxation clean up.
13065         (struct Input_section_info): Replace Relobj pointer and section index
13066         pair with Output_section::Simple_input_section and Convert struct to a
13067         class.
13068         (Input_section_sorter::operator()): Adjust access to
13069         Input_section_info data member to use accessors.
13070         (Output_section_element_input::set_section_addresses): Use layout
13071         parameter.  Adjust code to use Output_section::Simple_input_section
13072         and Input_secction_info classes.  Register filler for relaxation
13073         clean up.
13074         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
13075         and section index pair with Output_section::Simple_input_section
13076         class.  Adjust code accordingly.
13077         (Phdrs_element::release_segment): New method definition.
13078         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
13079         segment list.
13080         (Script_sections::release_segments): New method definition.
13081         * gold/script-sections.h (Script_sections::release_segments): New
13082         method declaration.
13083         * gold/target.h (Target::may_relax, Target::relax,
13084         Target::do_may_relax, Target::do_relax): New method definitions.
13085
13086 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13087
13088         * arm.cc (has_signed_unsigned_overflow): New function.
13089         (Arm_relocate_functions::abs8): New function.
13090         (Target_arm::Scan::local): Handle R_ARM_ABS8.
13091         (Target_arm::Scan::global): Likewise.
13092         (Target_arm::relocate::relocate): Likewise.
13093         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
13094         Likewise.
13095
13096 2009-09-16  Cary Coutant  <ccoutant@google.com>
13097
13098         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
13099         * testsuite/Makefile.in: Regenerate.
13100
13101 2009-09-11  Nick Clifton  <nickc@redhat.com>
13102
13103         * po/gold.pot: Updated by the Translation project.
13104
13105 2009-09-08  Cary Coutant  <ccoutant@google.com>
13106
13107         * output.cc (Output_file::open): Add execute permission to empty file.
13108         * testsuite/Makefile.am (permission_test): New test.
13109         * testsuite/Makefile.in: Regenerate.
13110
13111 2009-09-02  Ian Lance Taylor  <iant@google.com>
13112
13113         * output.cc (Output_file::resize): Call map_no_anonymous rather
13114         than map.
13115
13116 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
13117
13118         * gold.cc: Include "incremental.h".
13119         (queue_initial_tasks): Call Incremental_checker methods.
13120         * incremental.cc: Include "output.h".
13121         (Incremental_checker::can_incrementally_link_output_file): New
13122         method.
13123         * incremental.h (Incremental_checker): New class.
13124
13125         * output.cc (Output_file::open_for_modification): New method.
13126         (Output_file::map_anonymous): Changed return type to bool.  Record
13127         map in base_ field.
13128         (Output_file::map_no_anonymous): New method, broken out of map.
13129         (Output_file::map): Use map_no_anonymous and map_anonymous.
13130         * output.h (class Output_file): Update declarations.
13131
13132 2009-08-24  Cary Coutant  <ccoutant@google.com>
13133
13134         * options.h (Command_line::Pre_options): New class.
13135         (Command_line::pre_options): New member.
13136         * options.cc (gold::options::ready_to_register): New variable.
13137         (One_option::register_option): Do nothing if not registering options.
13138         Assert if same short option registered twice.
13139         (General_options::General_options): Turn off option registration when
13140         done constructing.
13141         (Command_line::Pre_options::Pre_options): New constructor.
13142
13143 2009-08-24  Cary Coutant  <ccoutant@google.com>
13144
13145         * options.h (General_options::no_keep_memory): Remove incorrect
13146         short option.
13147
13148 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
13149
13150         * Makefile.am (am__skiplex, am__skipyacc): New.
13151         * Makefile.in: Regenerate.
13152
13153 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
13154
13155         * Makefile.am (AM_CPPFLAGS): Renamed from ...
13156         (INCLUDES): ... this.
13157         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
13158         (AM_CPPFLAGS): Renamed from ...
13159         (INCLUDE): ... this.
13160         * Makefile.in, testsuite/Makefile.in: Regenerate.
13161
13162         * Makefile.in: Regenerate.
13163         * aclocal.m4: Likewise.
13164         * config.in: Likewise.
13165         * configure: Likewise.
13166         * testsuite/Makefile.in: Likewise.
13167
13168         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13169         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13170         * Makefile.in: Regenerate.
13171         * testsuite/Makefile.in: Regenerate.
13172
13173 2009-08-19  Cary Coutant  <ccoutant@google.com>
13174
13175         * resolve.cc (Symbol_table::resolve): Don't complain about defined
13176         symbols in shared libraries overridden by hidden or internal symbols
13177         in the main program.
13178
13179 2009-08-19  Chris Demetriou  <cgd@google.com>
13180
13181         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
13182         checking source file names in error messages.
13183
13184 2009-08-18  Doug Kwan  <dougkwan@google.com>
13185
13186         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
13187         an elcpp::Ehdr as parameter.  Adjust call to set_target.
13188         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
13189         an elfcpp::Ehdr as parameter.
13190         * object.cc (Object::set_target): Remove the version that looks up
13191         a target and sets it.
13192         (Sized_relobj::setup): Take a Target object instead of
13193         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
13194         (make_elf_sized_object): Find target and ask target to
13195         make an ELF object.
13196         * object.h: (Object::set_target): Remove the version that looks up
13197         a target and sets it.
13198         (Sized_relobj::setup): Take a Target object instead of
13199         an elfcpp:Ehdr as parameter.
13200         * target.cc: Include dynobj.h.
13201         (Target::do_make_elf_object_implementation): New.
13202         (Target::do_make_elf_object): New.
13203         * target.h (Target::make_elf_object): New template declaration.
13204         (Target::do_make_elf_object): New method declarations.
13205         (Target::do_make_elf_object_implementation): New template declaration.
13206
13207 2009-08-14  Ian Lance Taylor  <iant@google.com>
13208
13209         * gold.h (FUNCTION_NAME): Define.
13210         (gold_unreachable): Use FUNCTION_NAME.
13211
13212 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
13213
13214         * icf.cc (Icf::find_identical_sections): Issue a warning when a
13215         symbol in the --keep-unique list is not found.
13216
13217 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
13218
13219         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
13220         been maked as --keep-unique.
13221         (Icf::unfold_section): New function.
13222         * icf.h (Icf::unfold_section): New function.
13223         * options.h (General_options::keep_unique): New option.
13224         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
13225         * testsuite/Makefile.in: Regenerate.
13226         * testsuite/icf_keep_unique_test.sh: New file.
13227         * testsuite/icf_keep_unique_test.cc: New file.
13228
13229 2009-08-12  Cary Coutant  <ccoutant@google.com>
13230
13231         PR 10471
13232         * resolve.cc (Symbol_table::resolve): Check for references from
13233         dynamic objects to hidden and internal symbols.
13234         * testsuite/Makefile.am (hidden_test.sh): New test.
13235         * testsuite/Makefile.in: Regenerate.
13236         * testsuite/hidden_test.sh: New script.
13237         * testsuite/hidden_test_1.c: New test source.
13238         * testsuite/hidden_test_main.c: New test source.
13239
13240 2009-08-11  Doug Kwan  <dougkwan@google.com>
13241
13242         * arm.cc: Update comments.
13243         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
13244         segment to locate the .ARM.exidx section if present.
13245
13246 2009-08-09  Doug Kwan  <dougkwan@google.com>
13247
13248         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
13249         patch.
13250
13251 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
13252         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
13253         compiler warnings.
13254
13255 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
13256
13257         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
13258         valid tls_segment only for non-debug-section relocations.
13259         * testsuite/Makefile.am: Add gc_tls_test.
13260         * testsuite/Makefile.in: Regenerate.
13261         * testsuite/gc_tls_test.cc: New file.
13262         * testsuite/gc_tls_test.sh: New file.
13263
13264 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
13265
13266         * icf.cc: New file.
13267         * icf.h: New file.
13268         * Makefile.am (CCFILES): Add icf.cc.
13269         (HFILES): Add icf.h
13270         * Makefile.in: Regenerate.
13271         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
13272         * gc.h (gc_process_relocs): Populate lists used by icf to contain
13273         section, symbol and addend information for the relocs.
13274         * gold.cc (queue_middle_tasks): Call identical code folding.
13275         * gold.h: Add defines for multimap.
13276         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
13277         to the call of finalize_local_symbols.
13278         * main.cc (main): Create object of class Icf.
13279         * object.cc (Sized_relobj::do_layout): Allow this function to be
13280         called twice during icf.
13281         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
13282         to sections marked as identical by icf.
13283         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
13284         when available.
13285         (Sized_relobj::do_section_entsize): New function.
13286         * object.h (Object::section_entsize): New function.
13287         (Object::do_section_entsize): New pure virtual function.
13288         (Relobj::finalize_local_symbols): Add new parameter.
13289         (Relobj::do_section_entsize): New function.
13290         * options.h (General_options::icf): New option.
13291         (General_options::icf_iterations): New option.
13292         (General_options::print_icf_sections): New option.
13293         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
13294         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
13295         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
13296         icf.
13297         * symtab.cc (Symbol_table::is_section_folded): New function.
13298         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
13299         to sections marked as identical by icf.
13300         * symtab.h (Symbol_table::set_icf): New function.
13301         (Symbol_table::icf): New function.
13302         (Symbol_table::is_section_folded): New function.
13303         (Symbol_table::icf_): New data member.
13304         * target-reloc.h (relocate_section): Ignore sections folded by icf.
13305         * testsuite/Makefile.am: Add commands to build icf_test.
13306         * testsuite/Makefile.in: Regenerate.
13307         * testsuite/icf_test.sh: New file.
13308         * testsuite/icf_test.cc: New file.
13309
13310 2009-07-24  Chris Demetriou  <cgd@google.com>
13311
13312         * layout.cc (is_compressible_debug_section): Fix incorrect
13313         comment about compressed section names.
13314
13315 2009-07-20  Ian Lance Taylor  <ian@airs.com>
13316
13317         PR 10419
13318         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
13319
13320 2009-07-16  Ian Lance Taylor  <iant@google.com>
13321
13322         PR 10400
13323         * layout.h: #include <map>.
13324         (class Kept_section): Change from struct to class.  Add accessors
13325         and setters.  Add section size to Comdat_group mapping.  Change
13326         Comdat_group to std::map.  Add is_comdat_ field.  Add
13327         linkonce_size field in union.
13328         (class Layout): Update declaration of find_or_add_kept_section.
13329         Don't declare find_kept_object.
13330         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
13331         parameter.  Add object, shndx, is_comdat, and is_group_name
13332         parameters.  Change all callers.  Adjust for new Kept_section.
13333         (Layout::find_kept_object): Remove.
13334         * object.cc (Sized_relobj::include_section_group): Update use of
13335         Kept_section.  Rename secnum to shndx.  Only record
13336         Kept_comdat_section if sections are the same size.
13337         (Sized_relobj::include_linkonce_section): Update use of
13338         Kept_section.  Only record Kept_comdat_section if sections are the
13339         same size.  Set size of linkonce section.
13340         (Sized_relobj::map_to_kept_section): Update call to
13341         get_kept_comdat_section.
13342         * object.h (class Sized_relobj): Rename fields in
13343         Kept_comdat_section to drop trailing underscores; change object
13344         field to Relobj*.  Change Kept_comdat_section_table to store
13345         struct rather than pointer.
13346         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
13347         Add kept_object and kept_shndx parameters.  Change all callers.
13348         (Sized_relobj::get_kept_comdat_section): Change return type to
13349         bool.  Add kept_object and kept_shndx parameters.  Change all
13350         callers.
13351         * plugin.cc (Pluginobj::include_comdat_group): Update call to
13352         Layout::find_or_add_kept_section.
13353
13354 2009-07-09  Ian Lance Taylor  <iant@google.com>
13355
13356         * merge.cc (Object_merge_map::initialize_input_to_output_map):
13357         Reserve space in the hash table.
13358
13359 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
13360
13361         * fileread.cc (File_read::get_mtime): New method.
13362         * fileread.h (Timespec): New structure.
13363         (File_read::get_mtime): New method.
13364         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
13365         Renamed from timestamp_nsec.
13366         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
13367         Elf_Xword.
13368         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
13369         timestamp_nsec.
13370         (Incremental_inputs::report_archive): Save mtime; style fix.
13371         (Incremental_inputs::report_obejct): Save mtime; style fix.
13372         (Incremental_inputs::report_script): Save mtime; style fix.
13373         (Incremental_inputs::finalize_inputs): Style fix.
13374         (Incremental_inputs::finalize): Style fix.
13375         (Incremental_inputs::create_input_section_data): Store inputs
13376         mtime.
13377         * incremental.h (Incremental_inputs::report_script): Add mtime
13378         argument.
13379         (Incremental_inputs::Input_info::Input_info): Intialize only one
13380         union member.
13381         (Incremental_inputs::Input_info::archive): Move to nameless
13382         union.
13383         (Incremental_inputs::Input_info::obejct): Move to nameless union.
13384         (Incremental_inputs::Input_info::script): Move to nameless union.
13385         (Incremental_inputs::mtime): New field.
13386         * script.cc (read_input_script): Pass file mtime to
13387         Incremental_input.
13388         * script.h (Script_info::inputs): Style fix.
13389
13390 2009-07-01  Ian Lance Taylor  <ian@airs.com>
13391
13392         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
13393         instead of 32.
13394
13395 2009-06-24  Ian Lance Taylor  <iant@google.com>
13396
13397         PR 10156
13398         * layout.cc (Layout::choose_output_section): If we find an
13399         existing section, update the flags.
13400         (Layout::create_notes): New function, broken out of
13401         Layout::finalize.
13402         (Layout::finalize): Don't create note sections.
13403         (Layout::create_note): Don't crash if linker script discards
13404         section.
13405         (Layout::create_gold_note): Likewise.
13406         (Layout::create_build_id): Likewise.  Don't set
13407         after_input_sections on the section.
13408         (Layout::create_executable_stack_info): Remove target parameter.
13409         Change caller.
13410         * layout.h (class Layout): Declare create_notes.  Update
13411         declaration of create_executable_stack_info.
13412         * gold.cc (queue_middle_tasks): Call create_notes.
13413         * output.cc (Output_section::update_flags_for_input_section): Move
13414         here from output.h.  If SHF_ALLOC flag is newly set, mark address
13415         invalid.
13416         * output.h (Output_data::mark_address_invalid): New function.
13417         (class Output_section): Only declare, not define,
13418         update_flags_for_input_section.  Remove set_flags.
13419
13420 2009-06-24  Ian Lance Taylor  <iant@google.com>
13421
13422         * script-sections.cc (Output_section_definition::
13423         set_section_addresses): Rename shadowing local load_address to
13424         laddr.
13425
13426 2009-06-24  Ian Lance Taylor  <iant@google.com>
13427
13428         PR 10244
13429         * reloc.cc (relocate_sections): Skip empty relocation sections.
13430
13431 2009-06-23  Ian Lance Taylor  <iant@google.com>
13432
13433         PR 10156
13434         * layout.cc (Layout::create_note): Use choose_output_section
13435         rather than make_output_section.
13436
13437 2009-06-23  Ian Lance Taylor  <iant@google.com>
13438
13439         PR 10237
13440         * options.cc (General_options::parse_V): Set printed_version_.
13441         (General_options::General_options): Initialize printed_version_.
13442         * options.h (class General_options): Add printed_version_ field.
13443         * gold.cc (queue_initial_tasks): If there are no input files,
13444         don't give a fatal error if we printed the version information.
13445         (queue_middle_tasks): If using -r with a shared object, give a
13446         fatal error rather than an ordinary error.
13447
13448 2009-06-23  Ian Lance Taylor  <iant@google.com>
13449
13450         PR 10219
13451         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
13452         (Layout::make_output_section): Set have_stabstr_section_ if we see
13453         a .stab*str section.
13454         (Layout::finalize): Call link_stabs_sections.
13455         (Layout::link_stabs_sections): New file.
13456         * layout.h (class Layout): Add have_stabstr_section_ field.
13457         Declare link_stabs_sections.
13458
13459 2009-06-23  Doug Kwan  <dougkwan@google.com>
13460
13461         * Makefile.am (libgold_a_LIBADD): New.
13462         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
13463         * Makefile.in: Regenerate.
13464         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
13465         * configure: Regenerate.
13466         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
13467         * fileread.cc: Include sys/state.h
13468         * gold.h: Declare memmem and strndup if found missing.
13469         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
13470
13471 2009-06-23  Ian Lance Taylor  <iant@google.com>
13472
13473         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
13474         * configure: Rebuild.
13475
13476 2009-06-23  Ian Lance Taylor  <iant@google.com>
13477
13478         PR 10147
13479         * object.cc (Object::section_contents): Don't try to get a view if
13480         the section has length zero.
13481         (Object::handle_gnu_warning_section): If the section is empty, use
13482         the name of the section as the warning.
13483
13484 2009-06-23  Ian Lance Taylor  <iant@google.com>
13485
13486         PR 10133
13487         * stringpool.h (class Stringpool_template): Add optimize_ field.
13488         (Stringpool_template::set_optimize): New function.
13489         * stringpool.cc (Stringpool_template::Stringpool_template):
13490         Initialize optimize_ field.
13491         (Stringpool_template::set_string_offsets): Test local optimize
13492         fild rather than parameter.
13493         * layout.cc (Layout::Layout): Call set_optimize on the section
13494         name stringpool.
13495
13496 2009-06-22  Ian Lance Taylor  <iant@google.com>
13497
13498         PR 10030
13499         * yyscript.y: Parse TARGET.
13500         * script.cc (script_set_target): New function.
13501         * script-c.h (script_set_target): Declare.
13502         * options.cc (General_options::string_to_object_format): Rename
13503         from string_to_object_format in anonymous namespace.  Change
13504         callers.
13505         * options.h (class General_options): Declare
13506         string_to_object_format.
13507
13508 2009-06-22  Ian Lance Taylor  <iant@google.com>
13509
13510         * script-sections.cc (Script_sections::create_segments): Don't put
13511         program headers in a PT_LOAD segment if -n or -N.
13512
13513 2009-06-22  Ian Lance Taylor  <iant@google.com>
13514
13515         PR 10141
13516         * options.h (class General_options): Add -z lazy and -z now.  Sort
13517         -z options into alphabetical order.
13518         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
13519
13520 2009-06-21  Ian Lance Taylor  <iant@google.com>
13521
13522         * layout.cc (Layout::make_output_section): Call
13523         Target::new_output_section.
13524         (Layout::attach_allocated_section_to_segment): Put large section
13525         sections in a separate load segment with the large segment flag
13526         set.
13527         (Layout::segment_precedes): Sort large data segments after other
13528         load segments.
13529         (align_file_offset): New static function.
13530         (Layout::set_segment_offsets): Use align_file_offset.
13531         * output.h (class Output_section): Add is_small_section_ and
13532         is_large_section_ fields.
13533         (Output_section::is_small_section): New function.
13534         (Output_section::set_is_small_section):  New function.
13535         (Output_section::is_large_section): New function.
13536         (Output_section::set_is_large_section): New function.
13537         (Output_section::is_large_data_section): New function.
13538         (class Output_segment): Add is_large_data_segment_ field.
13539         (Output_segment::is_large_data_segment): New function.
13540         (Output_segment::set_is_large_data_segment): New function.
13541         * output.cc (Output_section::Output_section): Initialize new
13542         fields.
13543         (Output_segment::Output_segment): Likewise.
13544         (Output_segment::add_output_section): Add assertion that large
13545         data sections always go in large data segments.  Force small data
13546         sections to the end of the list of data sections.  Force small BSS
13547         sections to the start of the list of BSS sections.  For large BSS
13548         sections to the end of the list of BSS sections.
13549         * symtab.h (class Symbol): Declare is_common_shndx.
13550         (Symbol::is_defined): Check Symbol::is_common_shndx.
13551         (Symbol::is_common): Likewise.
13552         (class Symbol_table): Define enum Commons_section_type.  Update
13553         declarations.  Add small_commons_ and large_commons_ fields.
13554         * symtab.cc (Symbol::is_common_shndx): New function.
13555         (Symbol_table::Symbol_table): Initialize new fields.
13556         (Symbol_table::add_from_object): Put small and large common
13557         symbols in the right list.
13558         (Symbol_table::sized_finalized_symbol): Check
13559         Symbol::is_common_shndx.
13560         (Symbol_table::sized_write_globals): Likewise.
13561         * common.cc (Symbol_table::do_allocate_commons): Allocate new
13562         common symbol lists.  Don't call do_allocate_commons_list if the
13563         list is empty.
13564         (Symbol_table::do_allocate_commons_list): Remove is_tls
13565         parameter.  Add comons_section_type parameter.  Change all
13566         callers.  Handle small and large common symbols.
13567         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
13568         Symbol::is_common_shndx.
13569         * resolve.cc (symbol_to_bits): Likewise.
13570         * target.h (Target::small_common_shndx): New function.
13571         (Target::small_common_section_flags): New function.
13572         (Target::large_common_shndx): New function.
13573         (Target::large_common_section_flags): New function.
13574         (Target::new_output_section): New function.
13575         (Target::Target_info): Add small_common_shndx, large_common_shndx,
13576         small_common_section_flags, and large_common_section_flags
13577         fields.
13578         (Target::do_new_output_section): New virtual function.
13579         * arm.cc (Target_arm::arm_info): Initialize new fields.
13580         * i386.cc (Target_i386::i386_info): Likewise.
13581         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
13582         Likewise.
13583         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
13584         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13585         (Target_x86_64::do_new_output_section): New function.
13586         * configure.ac: Define conditional MCMODEL_MEDIUM.
13587         * testsuite/Makefile.am (check_PROGRAMS): Add large.
13588         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
13589         (large_LDFLAGS): Define.
13590         * testsuite/large.c: New file.
13591         * testsuite/testfile.cc (Target_test::test_target_info):
13592         Initialize new fields.
13593         * configure, testsuite/Makefile.in: Rebuild.
13594
13595 2009-06-05  Doug Kwan  <dougkwan@google.com>
13596
13597         * Makefile.am (CCFILES): Add target.cc.
13598         * Makefile.in: Regenerate.
13599         * i386.cc (class Target_i386): Define new virtual method to
13600         override do_is_local_label_name in parent.
13601         * object.cc (Sized_relobj::do_count_local_symbols): Discard
13602         local symbols if --discard-locals or -X is given.
13603         * options.h (class General_options): Declare new options
13604         '--discard-locals' and '-X' for discarding locals.
13605         * target.h (class Target): Define new methods is_local_label_name.
13606         Declare new virtual method do_is_local_label_name.
13607         * target.cc: New file.
13608         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
13609         (check_SCRIPTS): Add discard_locals_test.sh.
13610         (check_DATA): Add discard_local_tests.syms.
13611         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
13612         (discard_local_tests.syms, discard_locals_test.o): New make rules.
13613         * testsuite/Makefile.in: Regenerate.
13614         * testsuite/discard_locals_test.c: New file.
13615         * testsuite/discard_locals_test.sh: Same.
13616
13617 2009-06-05  Doug Kwan  <dougkwan@google.com>
13618
13619         * object.cc (Sized_relobj::Sized_relobj): Initialize
13620         discarded_eh_frame_shndx_ to -1U.
13621         (Sized_relobj::do_layout): Record index of a discard .eh_frame
13622         section.
13623         (Sized_relobj::do_count_local_symbols): Skip local symbols in
13624         a discarded .eh_frame section.
13625         (Sized_relobj::do_finalize_local_symbols): Ditto.
13626         * object.h (class Sized_relobj): Declare new member
13627         discarded_eh_frame_shndx_.
13628         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
13629         (local_labels_test.o, local_labels_test): New rules.
13630         * testsuite/Makefile.in: Regenerate.
13631
13632 2009-06-04  Doug Kwan  <dougkwan@google.com>
13633
13634         * layout.cc (Layout::section_name_mapping): Add mapping for
13635         special ARM sections.
13636
13637 2009-06-03  Doug Kwan  <dougkwan@google.com>
13638
13639         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
13640         (utils::has_overflow): Same.
13641
13642 2009-06-03  Ian Lance Taylor  <iant@google.com>
13643
13644         * layout.cc (Layout::section_name_mapping): New array, replacing
13645         Layout::linkonce_mapping.
13646         (Layout::section_name_mapping_count): New variable, replacing
13647         Layout::linkonce_mapping_count.
13648         (Layout::linkonce_output_name): Remove.
13649         (Layout::output_section_name): Rewrite.
13650         * layout.h (class Layout): Rename Linkonce_mapping to
13651         Section_name_mapping, linkonce_mapping to section_name_mapping,
13652         linkonce_mapping_count to section_name_mapping_count.  Don't
13653         declare linkonce_output_name.
13654
13655 2009-06-03  Doug Kwan  <dougkwan@google.com>
13656
13657         * gold/arm.cc (namespace utils): New.
13658         (Target_arm::reloc_is_non_pic): Define new method.
13659         (class Arm_relocate_functions): New.
13660         (Target_arm::Relocate::relocate): Handle relocation types used by
13661         Android.
13662
13663 2009-06-03  Ian Lance Taylor  <iant@google.com>
13664
13665         * arm.cc (Target_arm::scan::global): Use || instead of |.
13666
13667 2009-06-02  Doug Kwan  <dougkwan@google.com>
13668
13669         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
13670         issued_non_pic_error_.
13671         (class Target_arm::Scan): Declare new method check_non_pic.
13672         Define new method symbol_needs_plt_entry.
13673         Declare new data member issued_non_pic_error_.
13674         (class Target_arm::Relocate): Declare new method
13675         should_apply_static_reloc.
13676         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
13677         (Target_arm::Scan::check_non_pic): Define new method.
13678         (Target_arm::Scan::local): Handle a small subset of reloc types used
13679         by Android.
13680         (Target_arm::Scan::local): Same.
13681         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
13682
13683 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
13684
13685         * incremental.cc (Incremental_inputs::report_command_line): Filter
13686         out --incremental-* options.
13687
13688 2009-05-29  Doug Kwan  <dougkwan@google.com>
13689
13690         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
13691         template class.
13692         (class Target_arm): Update comment.
13693         (Target_arm::Target_arm): Initialize new data members GOT_,
13694         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
13695         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
13696         and Target_arm::rel_dyn_section.
13697         Declare new_enum Target_arm::Got_type.
13698         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
13699         and DYNBSS_.
13700         Update commments for member do_dynsym_value.
13701         (Target_arm::got_size, Target_arm::plt_section,
13702         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
13703         new methods inside class defintion.
13704         (Target_arm::got_section): Define new method.
13705         (Target_arm::rel_dyn_section): Same.
13706         (Output_data_plt_arm): New template class.
13707         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
13708         (Output_data_plt_arm:do_adjust_output_section): Define new method.
13709         (Output_data_plt_arm::add_entry): Same.
13710         (Output_data_plt_arm::first_plt_entry): Define new
13711         static data member for PLT instruction template.
13712         (Output_data_plt_arm::plt_entry): Same.
13713         (Output_data_plt_arm::do_write): Define new method.
13714         (Target_arm::make_plt_entry): Same.
13715         (Target_arm::do_finalize_sections): Same.
13716         (Target_arm::do_dynsym_value): Same.
13717
13718 2009-05-28  Doug Kwan  <dougkwan@google.com>
13719
13720         * Makefile.am (TARGETSOURCES): Add arm.cc.
13721         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
13722         * Makefile.in: Regenerate.
13723         * arm.cc: New file.
13724         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
13725
13726 2009-05-26  Doug Kwan  <dougkwan@google.com>
13727
13728         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
13729         (General_options::check_excluded_libs): Strip off directories in
13730         archive name before matching like GNU ld does.
13731         * testsuite/Makefile.am (MOSTLYCLEANFILES,
13732         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
13733         (exclude_libs_test_LDFLAGS): Add linker option
13734         -Wl,--exclude-libs,libexclude_libs_test_3
13735         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
13736         an explicit archive without using -l.
13737         (alt/libexclude_libs_test_3.a): New make rule.
13738         * testsuite/Makefile.in: Regenerate.
13739         * testsuite/exclude_libs_test.c : Declare lib3_default().
13740         (main): Call it.
13741         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
13742         * exclude_libs_test_3.c: New file.
13743
13744 2009-05-26  Nick Clifton  <nickc@redhat.com>
13745
13746         * po/id.po: New Indonesian translation.
13747         * po/gold.pot: Updated template file.
13748
13749 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
13750
13751         * testsuite/Makefile.am: Add -ffunction-sections to compile
13752         gc_comdat_test files.  Add -Wl,--gc-sections to build
13753         gc_comdat_test.
13754         * testsuite/Makefile.in: Regenerate.
13755         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
13756
13757 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
13758
13759         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
13760         kept comdat section was garbage collected.
13761         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
13762         * testsuite/Makefile.in: Regenerate.
13763         * testsuite/gc_comdat_test.sh: New file.
13764         * testsuite/gc_comdat_test_1.cc: New file.
13765         * testsuite/gc_comdat_test_2.cc: New file.
13766
13767 2009-05-19  Doug Kwan  <dougkwan@google.com>
13768
13769         * archive.cc (Archive::Archive): Move constructor from archive.h
13770         to here.  Initialize no_export_.
13771         (Archive::get_elf_object_for_member): Set no_export flag of object.
13772         * archive.h (Archive::Archive): Move constructor body to
13773         archive.cc.
13774         (Archive::no_export): New method.
13775         (Archive::no_export_): New field.
13776         * object.h (Object::Object): Initialize no_export_ to false.
13777         (Object::no_export, Object::set_no_export): New methods.
13778         (Object::no_export_): New field.
13779         * options.cc (General_options::parse_exclude_libs): New method.
13780         (General_options::check_excluded_libs) Same.
13781         * options.h (exclude_libs): New option.
13782         (General_options::check_excluded_libs): New method declaration.
13783         (General_options::excluded_libs_): New field.
13784         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
13785         default or protected visibility if an object has no-export flag set.
13786         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
13787         (check_SCRIPTS): Add exclude_libs_test.sh.
13788         (check_DATA): Add exclude_libs_test.syms.
13789         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
13790         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
13791         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
13792         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
13793         (exclude_libs_test.syms, libexclude_libs_test_1.a,
13794         libexclude_libs_test_2.a): New rules.
13795         * testsuite/Makefile.in: Regenerate.
13796         * testsuite/exclude_libs_test.c: New file.
13797         * testsuite/exclude_libs_test.sh: Ditto.
13798         * testsuite/exclude_libs_test_1.c: Ditto.
13799         * testsuite/exclude_libs_test_2.c: Ditto.
13800
13801 2009-05-15  Ian Lance Taylor  <iant@google.com>
13802
13803         * configure.ac: Check for declarations for cases where libiberty.h
13804         checks HAVE_DECL_xxx.
13805         * configure, config.in: Rebuild.
13806
13807 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
13808
13809         * gold.h (Incremental_argument_list): Remove (invalid) forward
13810         declaration.
13811         * incremental.cc (Incremental_inputs::report_achive): New method.
13812         (Incremental_inputs::report_object): New method.
13813         (Incremental_inputs::report_script): New method.
13814         (Incremental_inputs::finalize_inputs): New method.
13815         (Incremental_inputs::finalize): Call finalize_inputs().
13816         (Incremental_inputs::sized_create_incremental_inputs_section_data):
13817         Create inputs entries.
13818         * incremental.h (Incremental_input_type): New enum.
13819         (Incremental_inputs::Incremental_input): Initialize new fields.
13820         (Incremental_inputs::report_inputs): New method.
13821         (Incremental_inputs::report_achive): New method.
13822         (Incremental_inputs::report_object): New method.
13823         (Incremental_inputs::report_script): New method.
13824         (Incremental_inputs::finalize_inputs): New method.
13825         (Incremental_inputs::Input_info): New struct.
13826         (Incremental_inputs::Input_info_map): New typedef.
13827         (Incremental_inputs::lock_): New field.
13828         (Incremental_inputs::Inputs_): New field.
13829         (Incremental_inputs::Inputs_map): New field.
13830         * main.cc (main): Call Incremental_input::report_inputs.
13831         * options.h (Input_argument_list): Typedef moved from
13832         Input_arguments.
13833         (Input_file_group::Files): Remove, use ::Input_argument_list.
13834         (Input_file_group::Input_argument_list): Remove, use
13835         ::Input_argument_list.
13836         * plugin.cc (Plugin_manager::add_input_file): Add error in
13837         incremental build.
13838         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13839         functions.
13840         * script.cc (read_input_script): Call
13841         Incremental_input::report_script.
13842         * script.h (Script_info): New class.
13843
13844 2009-04-27  Ian Lance Taylor  <iant@google.com>
13845
13846         * x86_64.cc (do_adjust_output_section): Set entsize to
13847         plt_entry_size.
13848
13849 2009-04-23  Elliott Hughes  <enh@google.com>
13850
13851         * output.cc (Output_file::close): After short writes, continue
13852         writing from the correct offset in the buffer being written.
13853
13854 2009-04-23  Chris Demetriou  <cgd@google.com>
13855
13856         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13857         * configure: Regenerate.
13858         * config.in: Regenerate.
13859         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13860         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13861
13862 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
13863
13864         * incremental.cc (Incremental_inputs_header_data): Renamed from
13865         Incremental_input_header_data.
13866         (Incremental_inputs_header_data::data_size): New field.
13867         (Incremental_inputs_header_data::put_input_file_count): Renamed
13868         from input_file_count.
13869         (Incremental_inputs_header_data::put_command_line_offset): Renamed
13870         from command_line_offset.
13871         (Incremental_inputs_header_data::put_reserved): Renamed from
13872         put_reserved.
13873         (Incremental_inputs_entry_data): Renamed from
13874         Incremental_input_entry_data.
13875         (Incremental_inputs_entry_data::data_size): New field.
13876         (Incremental_inputs::report_command_line): New method.
13877         (Incremental_inputs::finalize): New method.
13878         (Incremental_inputs::create_incremental_inputs_data): New method.
13879         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13880         * incremental.h: New file.
13881         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13882         (Layout::finalize): Create incremental inputs section in
13883         incremental builds.
13884         (Layout::create_incremental_info_sections): New method.
13885         * layout.h (Layout::incremental_inputs): New method.
13886         (Layout::create_incremental_info_sections): New method.
13887         (Layout::incremental_inputs_): New field.
13888         * main.cc (main): Notify Incremental_input of the command line.
13889
13890 2009-04-01  Ian Lance Taylor  <iant@google.com>
13891             Mikolaj Zalewski  <mikolajz@google.com>
13892
13893         * gold.h (reserve_unordered_map): Define, three versions, one for
13894         each version of Unordered_map.
13895         * layout.cc (Layout::Layout): Remove options parameter.  Add
13896         number_of_input_files parameter.  Don't initialize options_.
13897         Initialize number_of_input_files_ and resized_signatures_.  Move
13898         sections_are_attached_.
13899         (Layout::layout_group): Reserve space for group_signatures_.
13900         (Layout::find_or_add_kept_section): Change name parameter to be a
13901         reference.  Resize signatures_ map when it gets large enough.
13902         (Layout::layout_eh_frame): Use parameters->options() instead of
13903         this->options_.
13904         (Layout::make_output_section): Likewise.
13905         (Layout::attach_allocated_section_to_segment): Likewise.
13906         (Layout::finalize, Layout::create_executable_stack): Likewise.
13907         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
13908         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
13909         * layout.h (class Layout): Update declarations.  Remove options_
13910         field.  Add number_of_input_files_ and resized_signatures_
13911         fields.  Move sections_are_attached_ field.
13912         * main.cc (main): Pass number of input files to Layout
13913         constructor.  Don't pass options.
13914
13915 2009-03-30  Ian Lance Taylor  <iant@google.com>
13916
13917         * ffsll.c (ffsll): Correct implementation.
13918
13919 2009-03-27  Ian Lance Taylor  <iant@google.com>
13920
13921         * ffsll.c: New file.
13922         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
13923         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
13924         * ftruncate.c (ftruncate): Declare before definition.
13925         * mremap.c (mremap): Likewise.
13926         * pread.c (pread): Likewise.
13927         * configure, Makefile.in, config.in: Rebuild.
13928
13929         * mremap.c: New file.
13930         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
13931         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
13932         (mremap): Declare if HAVE_MREMAP is not defined.
13933         * configure, Makefile.in, config.in: Rebuild.
13934
13935 2009-03-27  Cary Coutant  <ccoutant@google.com>
13936
13937         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
13938         position independent.
13939         * sparc.cc (Target_sparc::check_non_pic): Likewise.
13940         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
13941
13942 2009-03-24  Cary Coutant  <ccoutant@google.com>
13943
13944         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
13945         an executable.
13946         (needs_dynamic_reloc): Likewise.
13947
13948 2009-03-24  Ian Lance Taylor  <iant@google.com>
13949
13950         * yyscript.y (file_cmd): Recognize EXTERN.
13951         (extern_name_list, extern_name_list_body): New nonterminals.
13952         * script.cc (script_add_extern): Define.
13953         * script-c.h (script_add_extern): Declare.
13954
13955 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
13956
13957         * object.cc (is_elf_object): Define.
13958         * object.h (is_elf_object): Declare.
13959         * archive.cc (Archive::get_elf_object_for_member): Call
13960         is_elf_object.
13961         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
13962
13963 2009-03-24  Elliott Hughes  <enh@google.com>
13964
13965         * output.cc (Output_file::map_anonymous): Define.
13966         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
13967         try an anonymous one.  Report the size if the mmap fails.
13968         * output.h (class Output_file): Declare map_anonymous.
13969
13970 2009-03-24  Ian Lance Taylor  <iant@google.com>
13971
13972         * target-select.cc (instantiate_target): Don't acquire the lock if
13973         the instantiated_target_ field has already been set.
13974
13975 2009-03-23  Ian Lance Taylor  <iant@google.com>
13976
13977         * gold-threads.h (class Initialize_lock): Define.
13978         * gold-threads.cc (class Initialize_lock_once): Define.
13979         (initialize_lock_control): New static variable.
13980         (initialize_lock_pointer): New static variable.
13981         (initialize_lock_once): New static function.
13982         (Initialize_lock::Initialize_lock): Define.
13983         (Initialize_lock::initialize): Define.
13984         * target-select.h: Include "gold-threads.h".
13985         (class Target_selector): Add lock_ and initialize_lock_ fields.
13986         Don't define instantiate_target, just declare it.
13987         * target-select.cc (Target_selector::Target_selector): Initialize
13988         new fields.
13989         (Target_selector::instantiate_target): Define.
13990         * descriptors.h: Include "gold-threads.h".
13991         (class Descriptors): Add initialize_lock_ field.
13992         * descriptors.cc (Descriptors::Descriptors): Initialize new
13993         field.
13994         (Descriptors::open): Use initialize_lock_ field
13995         * errors.h (class Errors): Add initialize_lock_ field.
13996         * errors.cc (Errors::Errors): Initialize new field.
13997         (Errors::initialize_lock): Use initialize_lock_ field.
13998         * powerpc.cc (class Target_selector_powerpc): Remove
13999         instantiated_target_ field.  In do_recognize call
14000         instantiate_target rather than do_instantiate_target.  In
14001         do_instantiate_target just allocate a new target.
14002         * sparc.cc (class Target_selector_sparc): Likewise.
14003
14004         * freebsd.h: New file.
14005         * i386.cc: Include "freebsd.h".
14006         (Target_i386): Derive from Target_freebsd rather than
14007         Sized_target.
14008         (Target_selector_i386): Derive from Target_selector_freebsd rather
14009         than Target_selector.
14010         * x86_64.cc: Include "freebsd.h".
14011         (Target_x86_64): Derive from Target_freebsd rather than
14012         Sized_target.
14013         (Target_selector_x86_64): Derive from Target_selector_freebsd
14014         rather than Target_selector.
14015         * target.h (class Target): Add adjust_elf_header and
14016         do_adjust_elf_header.
14017         * output.cc (Output_file_header:: do_sized_write): Call target
14018         adjust_elf_header routine.
14019         * configure.tgt: Set targ_osabi.
14020         * configure.ac: Define GOLD_DEFAULT_OSABI.
14021         * parameters.cc (Parameters::default_target): Pass
14022         GOLD_DEFAULT_OSABI to select_target.
14023         * target-select.h (class Target_selector): Make instantiate_target
14024         protected rather than private.
14025         * Makefile.am (HFILES): Add freebsd.h.
14026         * configure, Makefile.in, config.in: Rebuild.
14027
14028         * merge.cc (do_add_input_section): Correct pend value.  Change
14029         message about last entry not being null terminated from error to
14030         warning.
14031
14032 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
14033
14034         * incremental.cc: New file.
14035         * Makefile.am (CCFILES): Add incremental.cc.
14036         * Makefile.in: Rebuild.
14037
14038 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
14039
14040         * layout.cc (Layout::output_section_name): Preserve names
14041         of '.note.' sections.
14042
14043 2009-03-19  Ian Lance Taylor  <iant@google.com>
14044
14045         * descriptors.cc (Descriptors::open): Check that the options are
14046         valid before using them.
14047
14048 2009-03-18  Ian Lance Taylor  <iant@google.com>
14049
14050         * script-sections.h: Include <list>.
14051         (class Script_sections): Change Sections_elements from std::vector
14052         to std::list.  Typedef public Elements_iterator.  Add
14053         orphan_section_placement_, data_segment_align_start_, and
14054         saw_data_segment_align_ fields.  Remove data_segment_align_index_
14055         field.
14056         * script-sections.cc (class Orphan_section_placement): New class.
14057         (class Sections_element): Add virtual functions is_relro and
14058         orphan_section_init.  Remove virtual function place_orphan_here.
14059         (class Output_section_definition): Add is_relro and
14060         orphan_section_init.  Remove place_orphan_here.
14061         (class Orphan_output_section): Likewise.
14062         (Script_sections::Script_sections): Update for field changes.
14063         (Script_sections::data_segment_align): Set saw_data_segment_align_
14064         and data_segment_align_start_, not data_segment_align_index.
14065         (Script_sections::data_segment_relro_end): Check
14066         saw_data_segment_align_.  Use data_segment_align_start_ rather
14067         than data_segment_align_index_.
14068         (Script_sections::place_orphan): Rewrite to use
14069         Orphan_section_placement.
14070
14071 2009-03-17  Ian Lance Taylor  <iant@google.com>
14072
14073         * archive.cc (Archive::add_symbols): Check for a version attached
14074         to the symbol name in the archive map.
14075         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
14076         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
14077         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
14078         (ver_test_11.a): New target.
14079         * testsuite/Makefile.in: Rebuild.
14080
14081         * configure.ac: Check for chsize and posix_fallocate.  Replace
14082         ftruncate.
14083         * ftruncate.c: New file, from gnulib.
14084         * output.cc (posix_fallocate): Define dummy version if not
14085         HAVE_POSIX_FALLOCATE.
14086         (Output_file::map): Call posix_fallocate rather than lseek and
14087         write.
14088         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
14089         * configure, Makefile.in, config.in: Rebuild.
14090
14091 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
14092
14093         * layout.h (Layout::create_note): Add section_name parameter.
14094         * layout.cc (Layout::create_note): Likewise.
14095         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
14096
14097 2009-03-17  Ian Lance Taylor  <iant@google.com>
14098
14099         * descriptors.cc: Include "options.h".
14100         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
14101         (Descriptors::open): Always use O_CLOEXEC when opening a new
14102         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
14103         then set FD_CLOEXEC.
14104
14105         * sparc.cc (class Target_sparc): Add has_got_section.
14106         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
14107         make sure we have a GOT section.
14108
14109         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
14110         (Target_sparc::Scan::local): Likewise.
14111         (Target_sparc::Scan::global): Likewise.
14112         (Target_sparc::Relocate::relocate): Likewise.
14113         (Target_sparc::Relocate::relocate_tls): Likewise.
14114
14115         * symtab.cc (Symbol_table::define_default_version): New function,
14116         broken out of add_from_object.
14117         (Symbol_table::add_from_object): Call define_default_version.
14118         (Symbol_table::define_special_symbol): Add resolve_oldsym
14119         parameter.  Change all callers.  If the version for a symbol comes
14120         from a version script, resolve it with the symbol with the same
14121         name with no version.  Also add the symbol without a version if
14122         appropriate.
14123         (do_define_in_output_data): If resolving with oldsym, don't delete
14124         sym.
14125         (do_define_in_output_segment): Likewise.
14126         (do_define_as_constant): Likewise.
14127         * symtab.h (class Symbol_table): Update declarations.
14128
14129 2009-03-13  Ian Lance Taylor  <iant@google.com>
14130
14131         * readsyms.cc (Read_symbols::incompatible_warning): New function.
14132         (Read_symbols::requeue): New function.
14133         (Read_symbols::do_read_symbols): If make_elf_object fails because
14134         the target type is not configured, and the file was searched for,
14135         issue a warning and retry with the next directory.
14136         (Add_symbols::run): If the file has an incompatible format, and
14137         it was searched for, requeue the Read_symbols task.  On error,
14138         release the object.
14139         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
14140         dirindex parameter to constructor.  Change all callers.  Declare
14141         incompatible_warning and requeue.
14142         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
14143         input_argument_ and input_group_ fields.  Add them to
14144         constructor.  Change all callers.
14145         (class Read_script): Add dirindex_ field.  Add it to constructor.
14146         Change all callers.
14147         * archive.cc (Archive::setup): Remove input_objects parameter.
14148         Change all callers.
14149         (Archive::get_file_and_offset): Likewise.
14150         (Archive::read_all_symbols): Likewise.
14151         (Archive::read_symbols): Likewise.
14152         (Archive::get_elf_object_for_member): Remove input_objects
14153         parameter.  Add punconfigured parameter.  Change all callers.
14154         (Archive::add_symbols): Change return type to bool.  Check return
14155         value of include_member.
14156         (Archive::include_all_members): Likewise.
14157         (Archive::include_member): Change return type to bool.  Return
14158         false if first included object has incompatible target.  Set
14159         included_member_ field.
14160         (Add_archive_symbols::run): If add_symbols returns false, requeue
14161         Read_symbols task.
14162         * archive.h (class Archive): Add included_member_ field.
14163         Initialize it in constructor.  Add input_file and searched_for
14164         methods.  Update declarations.
14165         (class Add_archive_symbols): Add dirpath_, dirindex_, and
14166         input_argument_ fields.  Add them to constructor.  Change all
14167         callers.
14168         * script.cc: Include "target-select.h".
14169         (class Parser_closure): Add skip_on_incompatible_target_ and
14170         found_incompatible_target_ fields.  Add
14171         skip_on_incompatible_target parameter to constructor.  Change all
14172         callers.  Add methods skip_on_incompatible_target,
14173         clear_skip_on_incompatible_target, found_incompatible_target, and
14174         set_found_incompatible_target.
14175         (read_input_script): Add dirindex parameter.  Change all callers.
14176         If parser finds an incompatible target, requeue Read_symbols
14177         task.
14178         (script_set_symbol): Clear skip_on_incompatible_target in
14179         closure.
14180         (script_add_assertion, script_parse_option): Likewise.
14181         (script_start_sections, script_add_phdr): Likewise.
14182         (script_check_output_format): New function.
14183         * script.h (read_input_script): Update declaration.
14184         * script-c.h (script_check_output_format): Declare.
14185         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
14186         (ignore_cmd): Remove OUTPUT_FORMAT.
14187         * fileread.cc (Input_file::Input_file): Add explicit this.
14188         (Input_file::will_search_for): New function.
14189         (Input_file::open): Add pindex parameter.  Change all callers.
14190         * fileread.h (class Input_file): Add input_file_argument method.
14191         Declare will_search_for.  Update declarations.
14192         * object.cc (make_elf_object): Add punconfigured parameter.
14193         Change all callers.
14194         * object.h (class Object): Make input_file public.  Add
14195         searched_for method.
14196         (make_elf_object): Update declaration.
14197         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
14198         restart search.
14199         * dirsearch.h (class Dirsearch): Update declaration.
14200         * options.h (class General_options): Add --warn-search-mismatch.
14201         * parameters.cc (Parameters::is_compatible_target): New function.
14202         * parameters.h (class Parameters): Declare is_compatible_target.
14203         * workqueue.cc (Workqueue::add_blocker): New function.
14204         * workqueue.h (class Workqueue): Declare add_blocker.
14205
14206         * fileread.cc (Input_file::open): Remove options parameter.
14207         Change all callers.
14208         (Input_file::open_binary): Likewise.
14209         * script.cc (read_input_script): Likewise.
14210         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
14211         options parameter from constructor.  Change all callers.
14212         (class Read_script): Likewise.
14213         * fileread.h (class Input_file): Update declarations.
14214         * script.h (read_input_script): Update declaration.
14215
14216 2009-03-10  Nick Clifton  <nickc@redhat.com>
14217
14218         * po/es.po: New Spanish translation.
14219
14220 2009-03-06  Cary Coutant  <ccoutant@google.com>
14221
14222         * options.cc (parse_short_option): Keep dash_z from registering itself.
14223
14224 2009-03-03  Ian Lance Taylor  <iant@google.com>
14225
14226         PR 9918
14227         * target-reloc.h (relocate_section): Pass output_section to
14228         relocate.
14229         * i386.cc (Target_i386::should_apply_static_reloc): Add
14230         output_section parameter.  Change all callers.
14231         (Target_i386::Relocate::relocate): Add output_section parameter.
14232         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14233         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
14234         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
14235         * testsuite/two_file_shared.sh: New script.
14236         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
14237         (check_DATA): Add two_file_shared.dbg.
14238         (two_file_shared.dbg): New target.
14239         * testsuite/Makefile.in: Rebuild.
14240
14241 2009-03-01  Ian Lance Taylor  <iant@google.com>
14242
14243         * configure.ac: Check for byteswap.h.
14244         * configure: Rebuild.
14245         * config.in: Rebuild.
14246
14247 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
14248
14249         * layout.cc (Layout::find_or_add_kept_section): New function.
14250         (Layout::add_comdat): Removed.
14251         * layout.h (struct Kept_section): Move out of class Layout.
14252         Remove trailing underscores from field names.  Add group_sections
14253         field.  Rename group_ field to is_group.  Change all uses.
14254         (class Layout): Declare find_or_add_kept_section, not add_comdat.
14255         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
14256         comdat_groups_ field.
14257         (Sized_relobj::include_section_group): Use
14258         find_or_add_kept_section and Kept_section::group_sections.
14259         (Sized_relobj::include_linkonce_section): Likewise.
14260         * object.cc (class Sized_relobj): Don't define Comdat_group or
14261         Comdat_group_table.  Remove find_comdat_group and
14262         add_comdat_group.  Remove comdat_groups_ field.
14263         * plugin.cc (include_comdat_group): Use
14264         Layout::find_or_add_kept_section.
14265
14266 2009-02-28  Ian Lance Taylor  <iant@google.com>
14267
14268         * README: --gc-sections and map files are now supported.  Document
14269         some build requirements.
14270
14271         PR 6992
14272         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
14273         relocatable link set the value of the section symbol to zero.
14274         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
14275         relocatable link don't include the section address in the local
14276         symbol value.
14277
14278 2009-02-27  Ian Lance Taylor  <iant@google.com>
14279
14280         PR 6811
14281         * options.h (class Search_directory): Add is_system_directory.
14282         (class General_options): Declare is_in_system_directory.
14283         * options.cc (get_relative_sysroot): Make static.
14284         (get_default_sysroot): Make static.
14285         (General_optoins::is_in_system_directory): New function.
14286         * fileread.cc (Input_file::is_in_system_directory): New function.
14287         * fileread.h (class Input_file): Declare is_in_system_directory.
14288         * object.h (class Object): Add is_in_system_directory.
14289         (class Input_objects): Remove system_library_directory_ field.
14290         * object.cc (Input_objects::add_object): Don't set
14291         system_library_directory_.
14292         (input_objects::found_in_system_library_directory): Remove.
14293         * symtab.cc (Symbol_table::write_globals): Remove input_objects
14294         parameter.  Change all callers.
14295         (Symbol_table::sized_write_globals): Likewise.
14296         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
14297         Call Object::is_in_system_directory.
14298         * symtab.h (class Symbol_table): Update declarations.
14299
14300         PR 5990
14301         * descriptors.h (Open_descriptor): Add is_on_stack field.
14302         * descriptors.cc (Descriptors::open): If the descriptor is on the
14303         top of the stack, remove it.  Initialize is_on_stack field.
14304         (Descriptors::release): Only add pod to stack if it is not on the
14305         stack already.
14306         (Descriptors::close_some_descriptor): Clear stack_next and
14307         is_on_stack fields.
14308
14309         PR 7091
14310         * output.cc (Output_section::find_starting_output_address): Rename
14311         from starting_output_address; add PADDR parameter; change return
14312         type.
14313         * output.h (class Output_section): Declare
14314         find_starting_output_address instead of starting_output_address.
14315         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
14316         section symbol for which we can't find a merge section.
14317
14318         PR 9836
14319         * symtab.cc (Symbol_table::add_from_object): If the visibility is
14320         hidden or internal, force the symbol to be local.
14321         * resolve.cc (Symbol::override_visibility): Define.
14322         (Symbol::override_base): Use override_visibility.
14323         (Symbol_table::resolve): Likewise.
14324         (Symbol::override_base_with_special): Likewise.
14325         (Symbol_table::override_with_special): If the visibility is hidden
14326         or internal, force the symbol to be local.
14327         * symtab.h (class Symbol): Add set_visibility and
14328         override_visibility.
14329         * testsuite/ver_test_1.sh: New file.
14330         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
14331         (check_DATA): Add ver_test_1.syms.
14332         (ver_test_1.syms): New target.
14333         * testsuite/Makefile.in: Rebuild.
14334
14335 2009-02-25  Cary Coutant  <ccoutant@google.com>
14336
14337         * layout.cc (Layout::choose_output_section): Don't rename sections
14338         when using a linker script that has a SECTIONS clause.
14339         * Makefile.in: Regenerate.
14340
14341         * testsuite/Makefile.am (script_test_5.sh): New test case.
14342         * testsuite/Makefile.in: Regenerate.
14343         * testsuite/script_test_5.cc: New file.
14344         * testsuite/script_test_5.sh: New file.
14345         * testsuite/script_test_5.t: New file.
14346
14347 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
14348
14349         * archive.cc (Archive::include_member): Update calls to add_symbols.
14350         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
14351         the Layout argument.
14352         * dynobj.h (do_add_symbols): Add the Layout argument.
14353         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
14354         Layout argument.
14355         * object.h (Object::add_symbols): Add the Layout argument.
14356         (Object::do_add_symbols): Add the Layout argument.
14357         (Sized_relobj::do_add_symbols): Add the Layout argument.
14358         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
14359         Unify the two versions.
14360         (Add_plugin_symbols): Remove.
14361         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
14362         (Sized_pluginobj::do_add_symbols): Unify the two versions.
14363         (Add_plugin_symbols): Remove.
14364         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
14365         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
14366         (Add_symbols::run): Make it work with Pulginobj.
14367
14368 2009-02-06  Ian Lance Taylor  <iant@google.com>
14369
14370         * object.cc (Sized_relobj::do_layout): Make info message start
14371         with lower case letter.
14372
14373 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
14374
14375         * binary.cc: Fix file comment.
14376
14377         * options.h (enum Incremental_disposition): Define.
14378         (class General_options): Add new options: --incremental,
14379         --incremental_changed, --incremental_unchanged,
14380         --incremental_unknown.  Add incremental_disposition_ and
14381         implicit_incremental_ fields.
14382         (General_options::incremental_disposition): New function.
14383         (class Position_dependent_options): Add incremental_disposition
14384         option.
14385         (Position_dependent_options::copy_from_options): Set incremental
14386         dispositions.
14387         * options.cc (General_options::parse_incremental_changed): New
14388         function.
14389         (General_options::parse_incremental_unchanged): New function.
14390         (General_options::parse_incremental_unknown): New function.
14391         (General_options::General_options): Initialize new fields
14392         incremental_disposition_ and implicit_incremental_.
14393         (General_options::finalize): Check for uasge of --incremental-*
14394         without --incremental.
14395
14396 2009-02-06  Chris Demetriou  <cgd@google.com>
14397
14398         * gold.h (gold_undefined_symbol): Change to take only a Symbol
14399         pointer and to report location as the file name associated with
14400         the symbol.
14401         (gold_undefined_symbol_at_location): New function to replace the
14402         old gold_undefined_symbol functionality.
14403         * target-reloc.h (relocate_section): Update to use
14404         gold_undefined_symbol_at_location.
14405         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14406         Call gold_undefined_symbol function rather than gold_error.
14407         * errors.h (Errors::undefined_symbol): Take location as a
14408         string, rather than calculating it from a relocation.
14409         * errors.cc (Errors::fatal): Print "fatal error:" before the
14410         formatted message.
14411         (Errors::error, Errors::error_at_location): Print "error: "
14412         before the formatted message.
14413         (Errors::undefined_symbol): Take location as a string, rather
14414         than calculating it from a relocation.
14415         (gold_undefined_symbol_at_location): New function akin to
14416         old gold_undefined_symbol, calculates location from relocation.
14417         (gold_undefined_symbol): Change to take only a Symbol pointer
14418         and to report location as the file name associated with the symbol.
14419         * testsuite/debug_msg.sh: Update for changed error messages.
14420         * testsuite/undef_symbol.sh: Likewise.
14421
14422 2009-02-04  Duncan Sands  <baldrick@free.fr>
14423
14424         PR 9812
14425         * reduced_debug_output.h
14426         (Output_reduced_debug_abbrev_section::failed): Use format for
14427         gold_warning.
14428         (Output_reduced_debug_info_section::faild): Likewise.
14429
14430 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
14431
14432         * script.cc (Lazy_demangler): New class.
14433         (Version_script_info::get_symbol_version_helper): Demangle a
14434         symbol only once.
14435
14436 2009-01-29  Cary Coutant  <ccoutant@google.com>
14437
14438         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
14439         to __tls_get_addr.
14440         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14441
14442 2009-01-28  Ian Lance Taylor  <iant@google.com>
14443
14444         * version.cc (version_string): Bump to 1.9.
14445
14446         * gold.h: Include <cstring> and <stdint.h>.
14447         * version.cc: Include <cstdio>.
14448         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
14449         warning.
14450         * reduced_debug_output.cc (insert_into_vector): Rename from
14451         Insert_into_vector; change all callers.  Use Swap_unaligned to
14452         avoid aliasing issue; remove union since it is unnecessary.
14453
14454 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
14455
14456         * Makefile.am (CCFILES): Add gc.cc.
14457         (HFILES): Add gc.h.
14458         * Makefile.in: Regenerate.
14459         * gold.cc (Gc_runner): New class.
14460         (queue_initial_tasks): Call garbage collection related tasks
14461         when corresponding options are invoked.
14462         (queue_middle_gc_tasks): New function.
14463         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
14464         processed early before laying out sections during garbage collection.
14465         * gold.h (queue_middle_gc_tasks): New function.
14466         (is_prefix_of): Move from "layout.cc".
14467         * i386.cc (Target_i386::gc_process_relocs): New function.
14468         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
14469         * main.cc (main): Create object of class "Garbage_collection".
14470         * object.cc (Relobj::copy_symbols_data): New function.
14471         (Relobj::is_section_name_included): New function.
14472         (Sized_relobj::do_layout): Allow this function to be called twice
14473         during garbage collection and defer layout of section during the
14474         first call.
14475         * object.h (Relobj::get_symbols_data): New function.
14476         (Relobj::is_section_name_included): New function.
14477         (Relobj::copy_symbols_data): New function.
14478         (Relobj::set_symbols_data): New function.
14479         (Relobj::get_relocs_data): New function.
14480         (Relobj::set_relocs_data): New function.
14481         (Relobj::is_output_section_offset_invalid): New pure virtual function.
14482         (Relobj::gc_process_relocs): New function.
14483         (Relobj::do_gc_process_relocs): New pure virtual function.
14484         (Relobj::sd_): New data member.
14485         (Sized_relobj::is_output_section_offset_invalid): New function.
14486         (Sized_relobj::do_gc_process_relocs): New function.
14487         * options.h (General_options::gc_sections): Modify to not be a no-op.
14488         (General_options::print_gc_sections): New option.
14489         * plugin.cc (Plugin_finish::run): Remove function call to
14490         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
14491         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
14492         * reloc.cc (Read_relocs::run): Add task to process relocs and
14493         determine unreferenced sections when doing garbage collection.
14494         (Gc_process_relocs): New class.
14495         (Sized_relobj::do_gc_process_relocs): New function.
14496         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
14497         sections that are garbage collected.
14498         * reloc.h (Gc_process_relocs): New class.
14499         * sparc.cc (Target_sparc::gc_process_relocs): New function.
14500         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
14501         symbols whose corresponding sections are garbage collected.
14502         (Symbol_table::Symbol_table): Add new parameter for the garbage
14503         collection object.
14504         (Symbol_table::gc_mark_undef_symbols): New function.
14505         (Symbol_table::gc_mark_symbol_for_shlib): New function.
14506         (Symbol_table::gc_mark_dyn_syms): New function.
14507         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
14508         as garbage.
14509         (Symbol_table::add_from_object): Likewise.
14510         (Symbol_table::add_from_relobj): When building shared objects, do not
14511         treat externally visible symbols as garbage.
14512         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
14513         table information for static and relocatable links.
14514         * symtab.h (Symbol_table::set_gc): New function.
14515         (Symbol_table::gc): New function.
14516         (Symbol_table::gc_mark_undef_symbols): New function.
14517         (Symbol_table::gc_mark_symbol_for_shlib): New function.
14518         (Symbol_table::gc_mark_dyn_syms): New function.
14519         (Symbol_table::gc_): New data member.
14520         * target.h (Sized_target::gc_process_relocs): New pure virtual
14521         function.
14522         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
14523         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
14524
14525 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
14526
14527         * options.h (General_options::gc_sections): Define as a no-op for now.
14528         (General_options::no_keep_memory): Ditto.
14529         (General_options::Bshareable): Define.
14530         * options.cc (General_options::finalize): Honor -Bshareable.
14531
14532 2009-01-20  Andreas Schwab  <schwab@suse.de>
14533
14534         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
14535         read the value in the contents, since we don't use it.  Use the
14536         template endianness when writing.
14537         (Relocate::relocate): Use it for R_PPC_REL16_HA.
14538
14539 2009-01-19  Andreas Schwab  <schwab@suse.de>
14540
14541         * configure.tgt (powerpc64-*): Fix targ_obj.
14542
14543 2009-01-15  Ian Lance Taylor  <iant@google.com>
14544
14545         * object.cc (Sized_relobj::write_local_symbols): Don't write out
14546         local symbols when stripping all symbols.
14547
14548 2009-01-14  Cary Coutant  <ccoutant@google.com>
14549
14550         * output.cc (Output_reloc): Add explicit instantiations.
14551
14552 2009-01-14  Cary Coutant  <ccoutant@google.com>
14553
14554         * archive.cc (Archive::get_elf_object_for_member): Remove call
14555         to File_read::claim_for_plugin.
14556         * descriptors.cc (Descriptors::open): Remove reference to
14557         is_claimed.
14558         (Descriptors::claim_for_plugin): Remove.
14559         * descriptors.h (Descriptors::claim_for_plugin): Remove.
14560         (Descriptors::is_claimed): Remove.
14561         (claim_descriptor_for_plugin): Remove.
14562         * fileread.cc (File_read::claim_for_plugin): Remove.
14563         * fileread.h (File_read::claim_for_plugin): Remove.
14564         (File_read::descriptor): Reopen descriptor if necessary.
14565         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
14566         (Plugin_manager::all_symbols_read): Add task parameter. Change
14567         all callers.
14568         (Plugin_manager::get_input_file): New function.
14569         (Plugin_manager::release_input_file): New function.
14570         (Pluginobj::Pluginobj): Add filesize parameter and initialize
14571         corresponding data member.
14572         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
14573         and pass to base constructor. Change all callers.
14574         (get_input_file, release_input_file): New functions.
14575         (make_sized_plugin_object): Add filesize parameter. Change all callers.
14576         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
14577         (Plugin_manager::all_symbols_read): Add task parameter.
14578         (Plugin_manager::get_input_file): New function.
14579         (Plugin_manager::release_input_file): New function.
14580         (Plugin_manager::task_): New data member.
14581         (Pluginobj::Pluginobj): Add filesize parameter.
14582         (Pluginobj::filename): New function.
14583         (Pluginobj::descriptor): New function.
14584         (Pluginobj::filesize): New function.
14585         (Pluginobj::filesize_): New data member.
14586         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
14587         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
14588         File_read::claim_for_plugin; use Object::unlock to unlock the file.
14589
14590         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
14591         with archive libraries.
14592         * testsuite/Makefile.in: Regenerate.
14593         * testsuite/plugin_test.c (struct sym_info): New type.
14594         (get_input_file, release_input_file): New static variables.
14595         (onload): Capture new transfer vector entries.
14596         (claim_file_hook): Stop reading at end of file according to filesize.
14597         Factor out parsing of readelf output into separate function.
14598         (all_symbols_read_hook): Exercise get_input_file and release_input_file
14599         APIs and get the source file name from the symbol table.  Convert
14600         source file name to corresponding object file name.  Print info
14601         message when adding new input files.
14602         (parse_readelf_line): New function.
14603         * testsuite/plugin_test_1.sh: Add checks for new info messages.
14604         * testsuite/plugin_test_2.sh: Likewise.
14605         * testsuite/plugin_test_3.sh: Likewise.
14606         * testsuite/plugin_test_4.sh: New test case.
14607
14608 2009-01-07  Ian Lance Taylor  <iant@google.com>
14609
14610         * version.cc (version_string): Bump to 1.8.
14611
14612 2008-12-23  Cary Coutant  <ccoutant@google.com>
14613
14614         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
14615         * plugin.cc (Plugin_manager::finish): Rename as
14616         layout_deferred_objects.  Move cleanup to separate function.
14617         (Plugin_manager::cleanup): New function.
14618         (Plugin_finish::run): Call layout_deferred_objects and cleanup
14619         separately.
14620         * plugin.h (Plugin_manager::finish): Rename as
14621         layout_deferred_objects.
14622         (Plugin_manager::cleanup): New function.
14623         (Plugin_manager::cleanup_done): New field.
14624
14625 2008-12-23  Cary Coutant  <ccoutant@google.com>
14626
14627         * plugin.cc (is_visible_from_outside): New function.
14628         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
14629         so we don't return "IR only" status for exported symbols or -r links.
14630
14631         * testsuite/Makefile.am (plugin_test_3): New test case.
14632         * testsuite/Makefile.in: Regenerate.
14633         * testsuite/plugin_test_3.sh: New file.
14634
14635 2008-12-22  Cary Coutant  <ccoutant@google.com>
14636
14637         * object.cc (Sized_relobj::layout_section): New function.
14638         (Sized_relobj::do_layout): Defer layout of input sections until after
14639         plugin has provided replacement files.
14640         (Sized_relobj::do_layout_deferred_sections): New function.
14641         * object.h (Relobj::set_section_offset): Remove virtual keyword.
14642         (Relobj::layout_deferred_sections): New function.
14643         (Relobj::do_layout_deferred_sections): New function.
14644         (Sized_relobj::do_layout_deferred_sections): New function.
14645         (Sized_relobj::layout_section): New function.
14646         (Sized_relobj::Deferred_layout): New structure.
14647         (Sized_relobj::deferred_layout_): New field.
14648         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
14649         Change all callers.  Layout deferred sections.
14650         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
14651         references.
14652         (Plugin_hook::run): Move code from do_plugin_hook inline.
14653         (Plugin_hook::do_plugin_hook): Remove.
14654         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
14655         (Plugin_manager::finish): Renamed, was cleanup.
14656         (Plugin_manager::should_defer_layout): New function.
14657         (Plugin_manager::add_deferred_layout_object): New function.
14658         (Plugin_manager::Deferred_layout_list): New type.
14659         (Plugin_manager::deferred_layout_objects_): New field.
14660         (Plugin_hook::do_plugin_hook): Remove.
14661
14662 2008-12-17  Ian Lance Taylor  <iant@google.com>
14663
14664         * options.h (class General_options): Add --no case for
14665         --export-dynamic.
14666
14667 2008-12-16  Cary Coutant  <ccoutant@google.com>
14668
14669         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
14670         vector.
14671         (Plugin_manager::claim_file): Create plugin object even if
14672         plugin did not call the add_symbols callback.
14673         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
14674         asking for more symbols than were added.
14675         * testsuite/Makefile.am (plugin_test_1): Add test case with
14676         no global symbols.
14677         (empty.syms): New target.
14678         * testsuite/Makefile.in: Regenerate.
14679         * testsuite/plugin_test.c (claim_file_hook): Add new debug
14680         message. Don't call add_symbols if no globals.
14681         (all_symbols_read_hook): Don't provide replacement for empty
14682         claimed file.
14683
14684 2008-12-12  Ian Lance Taylor  <iant@google.com>
14685
14686         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
14687         r_type == 0 for a local symbol with r_sym == 0.
14688         (scan_relocatable_relocs): Pass r_sym to
14689         local_non_section_strategy.
14690         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
14691         r_sym parameter.
14692
14693         * configure.ac: Update test for TLS descriptors: they are
14694         supported as of glibc 2.9.
14695         * configure: Rebuild.
14696
14697 2008-12-11  Ian Lance Taylor  <iant@google.com>
14698
14699         PR 7091
14700         * target-reloc.h (Default_scan_relocatable_relocs): For each
14701         function, map r_type == 0 to RELOC_DISCARD.
14702
14703 2008-12-10  Cary Coutant  <ccoutant@google.com>
14704
14705         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
14706         object to override a kept COMDAT group from a plugin object.
14707
14708 2008-12-09  Ian Lance Taylor  <iant@google.com>
14709
14710         PR 7088
14711         * yyscript.y (file_cmd): Handle INPUT.
14712
14713         * testsuite/initpri1.c: Change all declarations to be full
14714         prototypes by adding void, to avoid compiler warnings.
14715
14716 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
14717
14718         * options.cc (General_options::parse_plugin_opt): New.
14719         (General_options::add_plugin): The argument now is just the filename.
14720         (General_options::add_plugin_option): New.
14721         * options.h (plugin_opt): New.
14722         (add_plugin): Change argument name.
14723         (add_plugin_option): New.
14724         * plugin.cc (Plugin::load): Don't parse the plugin option.
14725         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
14726         (Plugin::add_option): New.
14727         (Plugin::args_): Change type.
14728         (Plugin::filename_): New.
14729         (Plugin_manager::add_plugin_option): New.
14730         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
14731         * testsuite/Makefile.in: Regenerate.
14732
14733 2008-12-05  Cary Coutant  <ccoutant@google.com>
14734
14735         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
14736         Handle --strip-lto-sections option.
14737         * options.h (strip_lto_sections): New option.
14738
14739 2008-12-01  Cary Coutant  <ccoutant@google.com>
14740
14741         * plugin.cc (ld_plugin_message): Change format parameter to const.
14742         Fix mismatch between new[] and delete.
14743
14744 2008-11-14  Cary Coutant  <ccoutant@google.com>
14745
14746         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
14747         instead of -1U.
14748
14749 2008-11-05  Craig Silverstein  <csilvers@google.com>
14750
14751         * options.cc (General_options::parse_dynamic_list): New function.
14752         * options.h (General_options): New flags dynamic_list,
14753         dynamic_list_data, dynamic_list_cpp_new, and
14754         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
14755         (General_options::in_dynamic_list): New function.
14756         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
14757         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
14758         (Lex::can_continue_name): Likewise.
14759         (yylex): Likewise.
14760         (read_script_file): New parameter script_options.
14761         (read_dynamic_list): New function.
14762         (Script_options::define_dynamic_list): New function.
14763         (dynamic_list_keyword_parsecodes): New variable.
14764         (dynamic_list_keywords): New variable.
14765         * script.h (Script_options::define_dynamic_list): New function
14766         prototype.
14767         (read_dynamic_list): New function prototype.
14768         * symtab.cc (strprefix): New macro.
14769         (Symbol::should_add_dynsym_entry): Support dynamic_list,
14770         dynamic_list_data, dynamic_list_cpp_new, and
14771         dynamic_list_cpp_typeinfo.
14772         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
14773         (dynamic_list_expr): New rule.
14774         (dynamic_list_nodes): Likewise.
14775         (dynamic_list_node): Likewise.
14776         * testsuite/Makefile.am (dynamic_list): New test.
14777         * testsuite/Makefile.in: Regenerated.
14778         * testsuite/dynamic_list.t: New file.
14779         * testsuite/dynamic_list.sh: New file.
14780
14781 2008-11-05  Craig Silverstein  <csilvers@google.com>
14782
14783         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
14784         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
14785         (t11_last): Likewise.
14786         * testsuite/ver_test_6.c (main): Likewise.
14787
14788 2008-10-07  Cary Coutant  <ccoutant@google.com>
14789
14790         * options.c (General_options::finalize): Add check for -static and
14791         -shared.
14792         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
14793         is not empty.
14794
14795 2008-10-02  Cary Coutant  <ccoutant@google.com>
14796
14797         * plugin.cc (make_sized_plugin_object): Fix conditional
14798         compilation to work when not all targets are enabled.
14799
14800 2008-09-29  Cary Coutant  <ccoutant@google.com>
14801
14802         * archive.cc (Archive::get_file_and_offset): Use filename instead
14803         of name to get library path.
14804         (Archive::include_member): Unlock external member of a thin archive.
14805
14806         * testsuite/Makefile.am (TEST_AR): New variable.
14807         (thin_archive_test_1): New test.
14808         (thin_archive_test_2): New test.
14809         * testsuite/Makefile.in: Regenerate.
14810         * testsuite/thin_archive_main.cc: New file.
14811         * testsuite/thin_archive_test_1.cc: New file.
14812         * testsuite/thin_archive_test_2.cc: New file.
14813         * testsuite/thin_archive_test_3.cc: New file.
14814         * testsuite/thin_archive_test_4.cc: New file.
14815
14816 2008-09-29  Cary Coutant  <ccoutant@google.com>
14817
14818         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
14819         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
14820         instead of -1U.
14821         (Sized_relobj::do_finalize_local_symbols): Likewise.
14822         (Sized_relobj::map_to_kept_section): Likewise.
14823         * object.h (Sized_relobj::invalid_address): New constant.
14824         (Sized_relobj::do_output_section_offset): Check for invalid_address
14825         and return -1ULL.
14826         * output.cc (Output_reloc::local_section_offset): Use constant
14827         invalid_address instead of -1U.
14828         (Output_reloc::get_address): Likewise.
14829         (Output_section::output_address): Change -1U to -1ULL.
14830         * output.h (Output_reloc::invalid_address): New constant.
14831         * reloc.cc (Sized_relobj::write_sections): Use constant
14832         invalid_address instead of -1U.
14833         (Sized_relobj::relocate_sections): Likewise.
14834         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
14835         values for merge sections.
14836         * target-reloc.h (relocate_for_relocatable): Use constant
14837         invalid_address instead of -1U.
14838
14839 2008-09-19  Cary Coutant  <ccoutant@google.com>
14840
14841         Add plugin functionality for link-time optimization (LTO).
14842         * configure.ac (plugins): Add --enable-plugins option.
14843         * configure: Regenerate.
14844         * config.in: Regenerate.
14845         * Makefile.am (LIBDL): New variable.
14846         (CCFILES): Add plugin.cc.
14847         (HFILES): Add plugin.h.
14848         (ldadd_var): Add LIBDL.
14849         * Makefile.in: Regenerate.
14850
14851         * archive.cc: Include "plugin.h".
14852         (Archive::setup): Don't preread archive symbols when using a plugin.
14853         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
14854         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14855         files.
14856         (Archive::include_member): Add symbols from plugin objects.
14857         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14858         * descriptors.cc (Descriptors::open): Check for file descriptors
14859         abandoned by plugins.
14860         (Descriptors::claim_for_plugin): New function.
14861         * descriptors.h (Descriptors::claim_for_plugin): New function.
14862         (Open_descriptor::is_claimed): New field.
14863         (claim_descriptor_for_plugin): New function.
14864         * fileread.cc (File_read::claim_for_plugin): New function.
14865         * fileread.h (File_read::claim_for_plugin): New function.
14866         (File_read::descriptor): New function.
14867         * gold.cc: Include "plugin.h".
14868         (queue_initial_tasks): Add task to call plugin hooks for generating
14869         new object files.
14870         * main.cc: Include "plugin.h".
14871         (main): Load plugin libraries.
14872         * object.h (Pluginobj): Declare.
14873         (Object::pluginobj): New function.
14874         (Object::do_pluginobj): New function.
14875         (Object::set_target): New function.
14876         * options.cc: Include "plugin.h".
14877         (General_options::parse_plugin): New function.
14878         (General_options::General_options): Initialize plugins_ field.
14879         (General_options::add_plugin): New function.
14880         * options.h (Plugin_manager): Declare.
14881         (General_options): Add --plugin option.
14882         (General_options::has_plugins): New function.
14883         (General_options::plugins): New function.
14884         (General_options::add_plugin): New function.
14885         (General_options::plugins_): New field.
14886         * plugin.cc: New file.
14887         * plugin.h: New file.
14888         * readsyms.cc: Include "plugin.h".
14889         (Read_symbols::do_read_symbols): Check for archive before checking
14890         for ELF file.  Call plugin hooks to claim files.
14891         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
14892         from a real object file; force override when processing replacement
14893         files.
14894         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
14895         (Symbol::init_base_object): Likewise.
14896         (Symbol::init_base_output_data): Likewise.
14897         (Symbol::init_base_output_segment): Likewise.
14898         (Symbol::init_base_constant): Likewise.
14899         (Symbol::init_base_undefined): Likewise.
14900         (Symbol::output_section): Assert that object is not a plugin.
14901         (Symbol_table::add_from_pluginobj): New function.
14902         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
14903         undefined.
14904         (Symbol_table::sized_write_globals): Likewise.
14905         (Symbol_table::add_from_pluginobj): Instantiate template.
14906         * symtab.h (Sized_pluginobj): Declare.
14907         (Symbol::in_real_elf): New function.
14908         (Symbol::set_in_real_elf): New function.
14909         (Symbol::in_real_elf_): New field.
14910         (Symbol_table::add_from_pluginobj): New function.
14911
14912         * testsuite/Makefile.am (AM_CFLAGS): New variable.
14913         (LIBDL): New variable.
14914         (LDADD): Add LIBDL.
14915         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
14916         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
14917         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
14918         (MOSTLYCLEANFILES): Likewise.
14919         * testsuite/Makefile.in: Regenerate.
14920         * testsuite/plugin_test.c: New file.
14921         * testsuite/plugin_test_1.sh: New file.
14922         * testsuite/plugin_test_2.sh: New file.
14923
14924 2008-09-16  Ian Lance Taylor  <iant@google.com>
14925
14926         * target-reloc.h (relocate_section): Check whether a symbol is
14927         defined by the ABI before reporting an undefined symbol error.
14928         * target.h (Target::is_defined_by_abi): Make parameter const.
14929         (Target::do_is_defined_by_abi): Likewise.
14930         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
14931         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
14932         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
14933         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
14934         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
14935         * testsuite/Makefile.in: Rebuild.
14936
14937         * fileread.cc (make_view): Add casts to avoid warning.
14938
14939 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14940
14941         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
14942         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14943
14944 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14945
14946         * options.h (General_options::output_is_executable): New.
14947         (General_options::output_is_pie): New.
14948         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
14949         for shared libraries.
14950         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14951
14952 2008-09-11  Chris Demetriou  <cgd@google.com>
14953
14954         * options.h (origin): New -z option.
14955         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
14956         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
14957         in DT_FLAGS_1.
14958
14959 2008-09-05  Cary Coutant  <ccoutant@google.com>
14960
14961         * fileread.cc (File_read::make_view): Add check for attempt to map
14962         beyond end of file.
14963
14964 2008-09-05  Cary Coutant  <ccoutant@google.com>
14965
14966         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
14967         explicit instantiations.
14968
14969 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
14970
14971         PR gold/6858
14972         * options.cc (General_options::finalize): Allow undefined symbols
14973         in shlibs if linking -shared.
14974
14975         PR gold/6859
14976         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14977         symbols as not needing a dynsym entry.
14978
14979 2008-08-20  Craig Silverstein  <csilvers@google.com>
14980
14981         * fileread.cc (File_read::open): Do not lock the file unless it
14982         was successfully opened.
14983
14984 2008-08-14  Cary Coutant  <ccoutant@google.com>
14985
14986         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14987         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14988         * testsuite/tls_test.cc (struct int128): 128-bit struct
14989         for testing TLS relocs with non-zero addend.
14990         (v12): New TLS variable.
14991         (t12): New test.
14992         (t_last): Add check for v12.
14993         * testsuite/tls_test.h (t12): New function.
14994         * testsuite/tls_test_main.cc (thread_routine): Call new test.
14995
14996 2008-08-13  Ian Lance Taylor  <iant@google.com>
14997
14998         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14999         set tls_segment_ or relro_segment_.
15000         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
15001         when appropriate.
15002         * output.h (Output_section::clear_is_relro): New function.
15003         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
15004         sections specially even when output_data_ is empty.
15005         (Output_segment::maximum_alignment): When first section is relro,
15006         only force alignment for PT_LOAD segments.
15007         * script.cc (script_data_segment_align): New function.
15008         (script_data_segment_relro_end): New function.
15009         * script-c.h (script_data_segment_align): Declare.
15010         (script_data_segment_relro_end): Declare.
15011         * script-sections.h (class Script_sections): Declare
15012         data_segment_align and data_segment_relro_end.  Add fields
15013         segment_align_index_ and saw_relro_end_.
15014         * script-sections.cc (class Sections_element): Add set_is_relro
15015         virtual function.  Add new bool* parameter to place_orphan_here.
15016         Add get_output_section virtual function.
15017         (class Output_section_definition): Add set_is_relro.  Add new
15018         bool* parameter to place_orphan_here.  Add get_output_section.
15019         Add is_relro_ field.
15020         (Output_section_definition::Output_section_definition): Initialize
15021         evaluated_address_, evaluated_load_address, evaluated_addralign_,
15022         and is_relro_ fields.
15023         (Output_section_definition::place_orphan_here): Add is_relro
15024         parameter.
15025         (Output_section_definition::set_section_addresses): Set relro for
15026         output section.
15027         (Output_section_definition::alternate_constraint): Likewise.
15028         (class Orphan_output_section): Add new bool* parameter to
15029         place_orphan_here.  Add get_output_section.
15030         (Orphan_output_section::place_orphan_here): Add is_relro
15031         parameter.
15032         (Script_sections::Script_sections): Initialize
15033         data_segment_align_index_ and saw_relro_end_.
15034         (Script_sections::data_segment_align): New function.
15035         (Script_sections::data_segment_relro_end): New function.
15036         (Script_sections::place_orphan): Set or clear is_relro.
15037         (Script_sections::set_section_addresses): Force alignment of first
15038         TLS section.
15039         * yyscript.y (exp): Call script_data_segment_align and
15040         script_data_segment_relro_end.
15041         * testsuite/relro_script_test.t: New file.
15042         * testsuite/relro_test.cc (using_script): Declare.
15043         (t1, t2): Test using_script.
15044         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
15045         (relro_script_test_SOURCES): Define.
15046         (relro_script_test_DEPENDENCIES): Define.
15047         (relro_script_test_LDFLAGS): Define.
15048         (relro_script_test_LDADD): Define.
15049         (relro_script_test.so): New target.
15050         * testsuite/Makefile.in: Rebuild.
15051
15052 2008-08-06  Cary Coutant <ccoutant@google.com>
15053
15054         * archive.cc (Archive::total_archives, Archive::total_members)
15055         (Archive::total_members_loaded): New variables.
15056         (Archive::setup): Add parameter.  Add option to preread
15057         archive symbols.
15058         (Archive::read_armap): Add counter.
15059         (Archive::get_file_and_offset): New function.
15060         (Archive::get_elf_object_for_member): New function.
15061         (Archive::read_all_symbols): New function.
15062         (Archive::read_symbols): New function.
15063         (Archive::add_symbols): Add counters.
15064         (Archive::include_all_members): Use armap to find members if it's
15065         already built.
15066         (Archive::include_member): Skip reading symbols if already read.
15067         Factored code into Archive::get_file_and_offset and
15068         Archive::get_elf_object_for_member.  Changed call to
15069         Mapfile::report_include_archive_member.
15070         (Archive::print_stats): New function.
15071         * archive.h: Declare Object and Read_symbols_data classes.
15072         (Archive::Archive): Add initializers for new members.
15073         (Archive::setup): Add parameter.
15074         (Archive::print_stats): New function.
15075         (Archive::total_archives, Archive::total_members)
15076         (Archive::total_members_loaded): New variables.
15077         (Archive::get_file_and_offset): New function.
15078         (Archive::get_elf_object_for_member): New function.
15079         (Archive::read_all_symbols): New function.
15080         (Archive::read_symbols): New function.
15081         (Archive::Archive_member): New class.
15082         (Archive::members_): New member.
15083         (Archive::num_members_): New member.
15084         * main.cc: Include archive.h.
15085         (main): Call Archive::print_stats.
15086         * mapfile.cc (Mapfile::report_include_archive_member): Delete
15087         archive parameter; member_name is now the fully-decorated name.
15088         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
15089         * options.h: (General_options): Add --preread-archive-symbols option.
15090         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
15091         Archive::setup.
15092
15093 2008-08-04  Ian Lance Taylor  <iant@google.com>
15094
15095         * symtab.h (Symbol::use_plt_offset): New function.
15096         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
15097         * powerpc.cc (Relocate::relocate): Likewise.
15098         * sparc.cc (Relocate::relocate): Likewise.
15099         * x86_64.cc (Relocate::relocate): Likewise.
15100         * testsuite/weak_plt.sh: New test.
15101         * testsuite/weak_plt_main.cc: New test.
15102         * testsuite/weak_plt_shared.cc: New test.
15103         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
15104         (check_PROGRAMS): Add weak_plt.
15105         (check_DATA): Add weak_plt_shared.so.
15106         (weak_plt_main_pic.o, weak_plt): New targets.
15107         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
15108         * testsuite/Makefile.in: Rebuild.
15109
15110         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
15111         gcctestdir/ld.
15112         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
15113         * testsuite/Makefile.in: Rebuild.
15114
15115 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
15116
15117         * Makefile.am (POTFILES.in): Set LC_ALL=C.
15118         * Makefile.in: Regenerate.
15119         * po/POTFILES.in: Regenerate.
15120
15121 2008-07-29  Ian Lance Taylor  <iant@google.com>
15122
15123         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
15124         symbols before other symbols.
15125         * testsuite/script_test_2.cc (test_addr): Declare.
15126         (test_addr_alias): Declare.
15127         (main): Check that test_addr and test_addr_alias have the right
15128         values.
15129         * testsuite/script_test_2.t: Define test_addr_alias and
15130         test_addr.
15131
15132 2008-07-24  Ian Lance Taylor  <iant@google.com>
15133
15134         PR 5990
15135         * descriptors.cc: New file.
15136         * descriptors.h: New file.
15137         * gold-threads.h (class Hold_optional_lock): New class.
15138         * fileread.cc: Include "descriptors.h".
15139         (File_read::~File_read): Release descriptor rather than closing
15140         it.
15141         (File_read::open) [file]: Call open_descriptor rather than open.
15142         Set is_descriptor_opened_.
15143         (File_read::open) [memory]: Assert that descriptor is not open.
15144         (File_read::reopen_descriptor): New function.
15145         (File_read::release): Release descriptor.
15146         (File_read::do_read): Make non-const.  Reopen descriptor.
15147         (File_read::read): Make non-const.
15148         (File_read::make_view): Reopen descriptor.
15149         (File_read::do_readv): Likewise.
15150         * fileread.h (class File_read): Add is_descriptor_opened_ field.
15151         Update declarations.
15152         * layout.cc: Include "descriptors.h".
15153         (Layout::create_build_id): Use open_descriptor rather than open.
15154         * output.cc: Include "descriptors.h".
15155         (Output_file::open): Use open_descriptor rather than open.
15156         * archive.cc (Archive::const_iterator): Change Archive to be
15157         non-const.
15158         (Archive::begin, Archive::end): Make non-const.
15159         (Archive::count_members): Likewise.
15160         * archive.h (class Archive): Update declarations.
15161         * object.h (Object::read): Make non-const.
15162         * Makefile.am (CCFILES): Add descriptors.cc.
15163         (HFILES): Add descriptors.h.
15164         * Makefile.in: Rebuild.
15165
15166         PR 6716
15167         * gold.h: Always include <clocale>.  Add Solaris workarounds
15168         following code in binutils/sysdep.h.
15169
15170         PR 6048
15171         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
15172         this->eh_frame_hdr_ is NULL before using it.
15173
15174         * dynobj.cc (Versions::Versions): Update comment.
15175
15176         * dynobj.cc (Versions::Versions): If there is an soname, use it as
15177         the base version name.
15178
15179         * stringpool.cc (Stringpool_template::add_with_length): Set key to
15180         array size plus one.
15181         (Stringpool_template::set_string_offsets): Subtract one from key
15182         before using it as an array index.
15183         (Stringpool_template::get_offset_with_length): Likewise.
15184         (Stringpool_template::write_to_buffer): Likewise.
15185         * stringpool.h (Stringpool_template::get_offset_from_key):
15186         Likewise.
15187
15188 2008-07-23  Ian Lance Taylor  <iant@google.com>
15189
15190         PR 6658
15191         * object.h (Merged_symbol_value::value): Do our best to handle a
15192         negative addend.
15193
15194         PR 6647
15195         * script.cc (Version_script_info::get_versions): Don't add empty
15196         version tag to return value.
15197         (Version_script_info::get_symbol_version_helper): Change return
15198         type to bool.  Add pversion parameter.  Change all callers.
15199         (script_register_vers_node): Don't require a non-NULL tag.
15200         * script.h (class Version_script_info): Update declarations.
15201         (Version_script_info::get_symbol_version): Change return type to
15202         bool.  Add version parameter.  Change all callers.
15203         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
15204         handling.  Handle an empty version from a version script.
15205         (Symbol_table::define_special_symbol): Likewise.
15206         * testsuite/ver_test_10.script: New file.
15207         * testsuite/ver_test_10.sh: New file.
15208         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
15209         (check_DATA): Add ver_test_10.syms.
15210         (ver_test_10.syms, ver_test_10.so): New target.
15211         * testsuite/Makefile.in: Rebuild.
15212
15213 2008-07-23  Simon Baldwin  <simonb@google.com>
15214
15215         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
15216         to zero for undefined symbols from dynamic libraries.
15217
15218 2008-07-23  Ian Lance Taylor  <iant@google.com>
15219
15220         * symtab.cc (Symbol_table::resolve): Remove version parameter.
15221         Change all callers.
15222         * symtab.h (class Symbol_table): Update declaration.
15223         * testsuite/ver_test_9.cc: New file.
15224         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
15225         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
15226         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
15227         (ver_test_9.so, ver_test_9.o): New targets.
15228         * testsuite/Makefile.in: Rebuild.
15229
15230 2008-07-22  Ian Lance Taylor  <iant@google.com>
15231
15232         * options.h (class General_options): Define --check-sections.
15233         * layout.cc (Layout::set_segment_offsets): Handle
15234         --check-sections.
15235
15236         * options.h (class General_options): Define -n/--nmagic and
15237         -N/--omagic.
15238         * options.cc (General_options::finalize): For -n/--nmagic or
15239         -N/--omagic, set -static.
15240         * layout.cc (Layout::attach_allocated_section_to_segment): If
15241         -N/--omagic, don't put read-only and read-write sections in
15242         different segments.
15243         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
15244         finding a read-only segment.
15245         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
15246         don't set the minimum segment alignment to the common page size,
15247         and don't set the file offset to the address modulo the page size.
15248         * script-sections.cc (Script_sections::create_segments): If
15249         -n/--omagic, don't put read-only and read-write sections in
15250         different segments.
15251
15252         * cref.cc: New file.
15253         * cref.h: New file.
15254         * options.h (class General_options): Add --print-symbol-counts.
15255         * main.cc (main): Issue defined symbol report if requested.
15256         * archive.cc (Archive::interpret_header): Make into a const member
15257         function.
15258         (Archive::add_symbols): Call Input_objects::archive_start and
15259         archive_stop.
15260         (Archive::const_iterator): Define new class.
15261         (Archive::begin, Archive::end): New functions.
15262         (Archive::include_all_members): Rewrite to use iterator.
15263         (Archive::count_members): New function.
15264         * archive.h (class Archive): Update declarations.
15265         (Archive::filename): New function.
15266         * object.cc: Include "cref.h".
15267         (Sized_relobj::Sized_relobj): Initialize defined_count_.
15268         (Sized_relobj::do_get_global_symbol_counts): New function.
15269         (Input_objects::add_object): Add object to cross-referencer.
15270         (Input_objects::archive_start): New function.
15271         (Input_objects::archive_stop): New function.
15272         (Input_objects::print_symbol_counts): New function.
15273         * object.h: Declare Cref and Archive.
15274         (Object::get_global_symbol_counts): New function.
15275         (Object::do_get_global_symbol_counts): New pure virtual function.
15276         (class Sized_relobj): Add defined_count_ field.  Update
15277         declarations.
15278         (class Input_objects): Add cref_ field.  Update constructor.
15279         Update declarations.
15280         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
15281         defined_count_.
15282         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
15283         symbol counts.
15284         (Sized_dynobj::do_get_global_symbol_counts): New function.
15285         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
15286         defined_count_.  Update declarations.  Define Symbols typedef.
15287         * symtab.cc (Symbol_table::add_from_relobj): Add defined
15288         parameter.  Change all callers.
15289         (Symbol_table::add_from_dynobj): Add sympointers and defined
15290         parameters.  Change all callers.
15291         * symtab.h (class Symbol_table): Update declarations.
15292         * Makefile.am (CCFILES): Add cref.cc.
15293         (HFILES): Add cref.h.
15294         * Makefile.in: Rebuild.
15295
15296 2008-07-22  Simon Baldwin  <simonb@google.com>
15297
15298         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
15299         to zero when writing undefined symbols.
15300
15301 2008-07-22  Ian Lance Taylor  <iant@google.com>
15302
15303         * output.cc (Output_section::add_input_section): Don't try to
15304         merge empty merge sections.
15305
15306 2008-07-21  Craig Silverstein  <csilvers@google.com>
15307
15308         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15309         Include symbol version in error message.
15310
15311 2008-07-20  Chris Demetriou  <cgd@google.com>
15312
15313         * configure.ac (gold_cv_c_random_seed): New configured variable.
15314         (RANDOM_SEED_CFLAGS): New substituted variable.
15315         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
15316         * configure: Rebuild.
15317         * Makefile.in: Likewise.
15318         * testsuite/Makefile.in: Likewise.
15319
15320 2008-07-18  Ian Lance Taylor  <iant@google.com>
15321
15322         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
15323         where we see NAME/NULL and NAME/VERSION  as separate symbols.
15324         * testsuite/ver_test_main.cc (main): Call t4.
15325         (t4, t4_2a): Define.
15326         * testsuite/ver_test_2.cc (t4_2): Define.
15327         * testsuite/ver_test_2.script: Put t4_2a in VER2.
15328         * testsuite/ver_test_4.cc (t4_2a): Define.
15329         * testsuite/ver_test_4.script: Put t4_2a in VER2.
15330         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
15331
15332 2008-07-17  Ian Lance Taylor  <iant@google.com>
15333
15334         * dynobj.cc (Versions::add_def): If we give an error about a
15335         missing version, go ahead and create the version anyhow.
15336
15337 2008-07-10  Ian Lance Taylor  <iant@google.com>
15338
15339         Handle output sections with more than 0x7fffffff bytes.
15340         * object.h (class Relobj): Change map_to_output_ to
15341         output_sections_, and just keep a section pointer.  Change all
15342         uses.  Move comdat group support to Sized_relobj.
15343         (Relobj::is_section_specially_mapped): Remove.
15344         (Relobj::output_section): Remove poff parameter.  Change all
15345         callers.
15346         (Relobj::output_section_offset): New function.
15347         (Relobj::set_section_offset): Rewrite.
15348         (Relobj::map_to_output): Remove.
15349         (Relobj::output_sections): New function.
15350         (Relobj::do_output_section_offset): New pure virtual function.
15351         (Relobj::do_set_section_offset): Likewise.
15352         (class Sized_relobj): Add section_offsets_ field.  Add comdat
15353         group support from Relobj.  Update declarations.
15354         (Sized_relobj::get_output_section_offset): New function.
15355         (Sized_relobj::do_output_section_offset): New function.
15356         (Sized_relobj::do_set_section_offset): New function.
15357         * object.cc (Relobj::output_section_address): Remove.
15358         (Sized_relobj::Sized_relobj): Initialize new fields.
15359         (Sized_relobj::include_section_group): Cast find_kept_object to
15360         Sized_relobj.
15361         (Sized_relobj::include_linkonce_section): Likewise.
15362         (Sized_relobj::do_layout): Use separate arrays for output section
15363         and output offset.
15364         (Sized_relobj::do_count_local_symbols): Change map_to_output to
15365         output_sections.
15366         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
15367         output_sections and section_offsets.
15368         (Sized_relobj::write_local_symbols): Likewise.
15369         (map_to_kept_section): Compute output address directly.
15370         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
15371         output_sections and section_offsets.
15372         (Sized_relobj::write_sections): Likewise.
15373         (Sized_relobj::relocate_sections): Likewise.
15374         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
15375         * output.h (class Output_reloc): Update declarations.  Change
15376         u2_.relobj to Sized_relobj*.
15377         (class Output_data_reloc): Change add functions to use
15378         Sized_relobj*.
15379         * output.cc (Output_reloc::Output_reloc): Change relobj to
15380         Sized_relobj*.
15381         (Output_reloc::local_section_offset): Change return type to
15382         Elf_Addr.  Use get_output_section_offset.
15383         (Output_reloc::get_address): Likewise.
15384         (Output_section::is_input_address_mapped): Don't call
15385         is_section_specially_mapped.
15386         (Output_section::output_offset): Likewise.
15387         (Output_section::output_address): Likewise.
15388         (Output_section::starting_output_address): Likewise.
15389         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
15390         parameter to Sized_relobj*.
15391         (Copy_relocs::need_copy_reloc): Likewise.
15392         (Copy_relocs::save): Likewise.
15393         * copy-relocs.h (class Copy_relocs): Update declarations.
15394         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
15395         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
15396         * target-reloc.h (relocate_for_relocatable): Change
15397         offset_in_output_section type to Elf_Addr.  Change code that uses
15398         it as well.
15399         * layout.cc (Layout::layout): Always set *off.
15400         * mapfile.cc (Mapfile::print_input_section): Use
15401         output_section_offset.
15402         * i386.cc (Target_i386::copy_reloc): Change object parameter to
15403         Sized_relobj*.
15404         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
15405         * sparc.cc (Target_sparc::copy_reloc): Likewise.
15406         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
15407
15408 2008-07-03  Ian Lance Taylor  <iant@google.com>
15409
15410         * layout.cc (Layout::include_section): Do not discard unrecognized
15411         SHT_STRTAB sections.
15412
15413 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
15414
15415         * script.cc (Lex::can_continue_name): Make '?' allowable in
15416         version-script names.
15417         * testsuite/version_script.map: Change glob pattern to use '?'
15418
15419 2008-06-30  Manish Singh  <yosh@gimp.org>
15420
15421         PR 6585
15422         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
15423         Correct typo.
15424
15425 2008-06-30  Ian Lance Taylor  <iant@google.com>
15426
15427         PR 6660
15428         PR 6682
15429         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
15430         versions]: Don't try to read the value in the contents, since we
15431         don't use it.  Use the template endianness when writing.
15432
15433 2008-06-25  Cary Coutant  <ccoutant@google.com>
15434
15435         * fileread.cc (File_read::make_view): Assert on zero-length view.
15436         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
15437         symbol table when there are no symbols to read.
15438
15439 2008-06-23  Craig Silverstein  <csilvers@google.com>
15440
15441         * version.cc (version_string): Bump to 1.7
15442
15443 2008-06-18  Craig Silverstein  <csilvers@google.com>
15444
15445         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
15446         constant 0xFFFF to type Valtype.
15447         (Powerpc_relocate_functions::rel16_ha): Likewise.
15448
15449 2008-06-17  Ian Lance Taylor  <iant@google.com>
15450
15451         * output.h (Output_section::Input_section): Initialize p2align_ to
15452         zero for Output_section_data constructors.
15453         (Output_section::Input_section::addralign): If not an input
15454         section, return the alignment of the Output_section_data.
15455         * testsuite/copy_test.cc: New file.
15456         * testsuite/copy_test_1.cc: New file.
15457         * testsuite/copy_test_2.cc: New file.
15458         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
15459         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
15460         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
15461         (copy_test_1_pic.o, copy_test_1.so): New targets.
15462         (copy_test_2_pic.o, copy_test_2.so): New targets.
15463         * testsuite/Makefile.in: Rebuild.
15464
15465         * script-sections.cc (Script_sections::place_orphan): Initialize
15466         local variable exact.
15467
15468 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
15469
15470         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
15471
15472 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
15473             David S. Miller  <davem@davemloft.net>
15474
15475         * powerpc.cc: New file.
15476         * Makefile.am (TARGETSOURCES): Add powerpc.cc
15477         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
15478         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
15479         * Makefile.in: Rebuild.
15480
15481 2008-06-09  Ian Lance Taylor  <iant@google.com>
15482
15483         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
15484         <exception>.
15485         (throwing, orig_terminate): New static variables.
15486         (terminate_handler): New static function.
15487         (t2): Set terminate handler.
15488
15489 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
15490
15491         PR 6584
15492         * binary.cc (Binary_to_elf::sized_convert): Fix .data
15493         alignment.
15494
15495 2008-05-30  Cary Coutant  <ccoutant@google.com>
15496
15497         * archive.cc (Archive::include_all_members) Correct to step
15498         over symbol table and extended name table in thin archives.
15499
15500 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
15501
15502         PR 6407
15503         * target-reloc.h (relocate_for_relocatable): Fix new_offset
15504         calculation.
15505
15506 2008-05-28  Caleb Howe  <cshowe@google.com>
15507
15508         * reduced_debug_output.cc: New file.
15509         * reduced_debug_output.h: New file.
15510         * options.h (class General_options): Add --strip-debug-non-line.
15511         * options.cc (General_options::finalize): Add strip_debug_non_line
15512         to the strip heirarchy.
15513         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
15514         fields.
15515         * layout.cc: Include "reduced_debug_output.h".
15516         (Layout::Layout): Initialize new fields.
15517         (line_only_debug_sections): New static array.
15518         (is_lines_only_debug_sections): New static inline function.
15519         (Layout::include_section): Handle --strip-debug-non-line.
15520         (Layout::make_output_section): If --strip-debug-non-line, build
15521         new output sections for .debug_abbrev and .debug_info.
15522         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
15523         gold.  Warn about possible overflow.
15524         (read_signed_LEB_128): Likewise.
15525         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
15526         (read_signed_LEB_128): Declare.
15527         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
15528         (HFILES): Add reduced_debug_output.h.
15529         * Makefile.in: Rebuild.
15530
15531 2008-05-21  Ian Lance Taylor  <iant@google.com>
15532
15533         * mapfile.cc: New file.
15534         * mapfile.h: New file.
15535         * options.h (class General_options): Add -M/--print-map and -Map.
15536         * options.cc (General_options::finalize): Make -M equivalent to
15537         -Map -.
15538         * main.cc: Include <cstdio> and "mapfile.h".
15539         (main): Open mapfile if requested.
15540         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
15541         constructor.  Change caller.
15542         (queue_initial_tasks): Add mapfile parameter.  Change caller.
15543         (queue_middle_tasks): Likewise.
15544         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
15545         declarations.
15546         * archive.cc: Include "mapfile.h".
15547         (Archive::add_symbols): Add mapfile parameter.  Change all
15548         callers.  Pass mapfile, symbol, and reason to include_member.
15549         (Archive::include_all_members): Add mapfile parameter.  Change all
15550         callers.
15551         (Archive::include_member): Add mapfile, sym, and why parameters.
15552         Change all callers.  Report inclusion to map file.
15553         * archive.h: Include "fileread.h".
15554         (class Archive): Update declarations.
15555         (Archive::file): New const method.
15556         (class Add_archive_symbols): Add mapfile_ field.  Update
15557         constructor.  Change all callers.
15558         * readsyms.h (class Read_symbols): Likewise.
15559         (class Finish_group): Likewise.
15560         (class Read_script): Likewise.
15561         * common.cc: Include "mapfile.h".
15562         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
15563         all callers.
15564         (Symbol_table::do_allocate_commons): Likewise.
15565         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
15566         symbol allocation to mapfile.
15567         * common.h (class Allocate_commons_task): Add mapfile_ field.
15568         Update constructor.  Change all callers.
15569         * symtab.h (class Symbol_table): Update declarations.
15570         * layout.cc: Include "mapfile.h".
15571         (Layout_task_runner::run): Print information to mapfile.
15572         (Layout::create_gold_note): Change Output_data_fixed_space to
15573         Output_data_zero_fill.
15574         (Layout::create_build_id): Likewise.
15575         (Layout::print_to_mapfile): New function.
15576         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
15577         constructor.  Change caller.
15578         (class Layout): Declare print_to_mapfile.
15579         * output.cc (Output_section::Input_section::print_to_mapfile): New
15580         function.
15581         (Output_section::add_input_section): If producing a map, always
15582         add to input_sections_ list.
15583         (Output_section::do_print_to_mapfile): New function.
15584         (Output_segment::print_sections_to_mapfile): New function.
15585         (Output_segment::print_section_list_to_mapfile): New function.
15586         * output.h: Include "mapfile.h".
15587         (Output_data::print_to_mapfile): New function.
15588         (Output_data::do_print_to_mapfile): New virtual function.
15589         (Output_segment_headers::do_print_to_mapfile): New function.
15590         (Output_file_header::do_print_to_mapfile): New function.
15591         (Output_data_const::do_print_to_mapfile): New function.
15592         (class Output_data_const_buffer): Add map_name_ field.  Update
15593         constructor.  Change all callers.  Add do_print_to_mapfile
15594         function.
15595         (class Output_data_fixed_space): Likewise.
15596         (class Output_data_space): Likewise.
15597         (class Output_data_zero_fill): New class.
15598         (Output_data_strtab::do_print_to_mapfile): New function.
15599         (Output_data_reloc_base::do_print_to_mapfile): New function.
15600         (Output_relocatable_relocs::do_print_to_mapfile): New function.
15601         (Output_data_group::do_print_to_mapfile): New function.
15602         (Output_data_got::do_print_to_mapfile): New function.
15603         (Output_data_dynamic::do_print_to_mapfile): New function.
15604         (Output_symtab_xindex::do_print_to_mapfile): New function.
15605         (class Output_section): Declare do_print_to_mapflie.  Declare
15606         print_to_mapfile in Input_section.
15607         (class Output_segment): Declare new functions.
15608         * object.h (Sized_relobj::symbol_count): New function.
15609         * script-sections.cc
15610         (Output_section_element_dot_assignment::set_section_addresses):
15611         Change Output_data_fixed_space to Output_data_zero_fill.
15612         (Output_data_expression::do_print_to_mapfile): New function.
15613         * script.cc (read_input_script): Add mapfile parameter.  Change
15614         all callers.
15615         * script.h (read_input_script): Update declaration.
15616         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
15617         (Eh_frame::do_print_to_mapfile): New function.
15618         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
15619         (Output_merge_string::do_print_to_mapfile): New function.
15620         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
15621         function.
15622         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
15623         function.
15624         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
15625         function.
15626         * Makefile.am (CCFILES): Add mapfile.cc.
15627         (HFILES): Add mapfile.h.
15628         * Makefile.in: Rebuild.
15629
15630 2008-05-19  Ian Lance Taylor  <iant@google.com>
15631
15632         * options.h (class General_options): Add -z relro.
15633         * layout.cc (Layout::Layout): Initialize relro_segment_.
15634         (Layout::add_output_section_data): Return the output section.
15635         (Layout::make_output_section): Rcognize relro sections and mark
15636         them appropriately.
15637         (Layout::attach_allocated_section_to_segment): Put relro sections
15638         in a PT_GNU_RELRO segment.
15639         (Layout::create_initial_dynamic_sections): Mark the .dynamic
15640         section as relro.
15641         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
15642         PT_TLS segments.
15643         (Layout::linkonce_mapping): Map d.rel.ro.local to
15644         .data.rel.ro.local.
15645         (Layout::output_section_name): Us .data.rel.ro.local for any
15646         section which begins with that.
15647         * layout.h (class Layout): Update add_output_section_data
15648         declaration.  Add relro_segment_ field.
15649         * output.cc (Output_section::Output_section): Initialize is_relro_
15650         and is_relro_local_ fields.
15651         (Output_segment::add_output_section): Group relro sections.
15652         (Output_segment::is_first_section_relro): New function.
15653         (Output_segment::maximum_alignment): If there is a relro section,
15654         align the segment to the common page size.
15655         (Output_segment::set_section_addresses): Track whether we are
15656         looking at relro sections.  If the last section is a relro
15657         section, align to the common page size.
15658         (Output_segment::set_section_list_addresses): Add in_relro
15659         parameter.  Change all callers.  Align to the page size when
15660         moving from relro to non-relro section.
15661         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
15662         segment.
15663         * output.h (class Output_section): Add is_relro_ and
15664         is_relro_local_ fields.
15665         (Output_section::is_relro): New function.
15666         (Output_section::set_is_relro): New function.
15667         (Output_section::is_relro_local): New function.
15668         (Output_section::set_is_relro_local): New function.
15669         (class Output_segment): Update declarations.
15670         * i386.cc (Target_i386::got_section): Mark .got section as relro.
15671         * sparc.cc (Target_sparc::got_section): Likewise.
15672         * x86_64.cc (Target_x86_64::got_section): Likewise.
15673         * testsuite/relro_test_main.cc: New file.
15674         * testsuite/relro_test.cc: New file.
15675         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
15676         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
15677         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
15678         (relro_test.so, relro_test_pic.o): New targets.
15679         * testsuite/Makefile.in: Rebuild.
15680
15681 2008-05-16  Ian Lance Taylor  <iant@google.com>
15682
15683         * output.cc (Output_segment::add_output_section): Remove front
15684         parameter.
15685         * output.h (class Output_segment): Remove
15686         add_initial_output_section and overloaded add_output_section.
15687         Update declaration of remaining add_output_section.
15688         * layout.cc (Layout::create_interp): Call add_output_section
15689         rather than add_initial_output_section.
15690         (Layout::finish_dynamic_section): Likewise.
15691
15692         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
15693         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
15694         know the dynamic type.
15695         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
15696         field.  Initialize it in constructor.
15697         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
15698         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
15699         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
15700         reloc.
15701
15702         * output.cc (Output_reloc::get_address): Change return type to
15703         Elf_Addr.
15704         * output.h (class Output_reloc): Update get_address declaration.
15705         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
15706         for section addresses.
15707
15708 2008-05-09  Ian Lance Taylor  <iant@google.com>
15709
15710         PR 6493
15711         * gold.cc (gold_nomem): Use return value of write.
15712
15713 2008-05-08  Ian Lance Taylor  <iant@google.com>
15714
15715         * symtab.c (Symbol::init_base_output_data): Add version
15716         parameter.  Change all callers.
15717         (Symbol::init_base_output_segment): Likewise.
15718         (Symbol::init_base_constant): Likewise.
15719         (Symbol::init_base_undefined): Likewise.
15720         (Sized_symbol::init_output_data): Likewise.
15721         (Sized_symbol::init_output_segment): Likewise.
15722         (Sized_symbol::init_constant): Likewise.
15723         (Sized_symbol::init_undefined): Likewise.
15724         (Symbol_table::do_define_in_output_data): If the new symbol has a
15725         version, mark it as the default.
15726         (Symbol_table::do_define_in_output_segment): Likewise.
15727         (Symbol_table::do_define_as_constant): Likewise.
15728         * symtab.h (class Symbol): Update declarations.
15729         (class Sized_symbol): Likewise.
15730         * resolve.cc (Symbol::override_version): New function.
15731         (Symbol::override_base): Call override_version.
15732         (Symbol::override_base_with_special): Likewise.
15733         * testsuite/ver_script_8.script: New file.
15734         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
15735         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
15736         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
15737         (ver_test_8_1.so, ver_test_8_2.so): New targets.
15738
15739 2008-05-06  Ian Lance Taylor  <iant@google.com>
15740
15741         PR 6049
15742         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
15743         functions.
15744         (class General_options): Remove existing --undefined, and add
15745         --no-undefined instead.  Add new --undefined as synonym for -u.
15746         * archive.cc (Archive::add_symbols): Check whether symbol was
15747         named with -u.
15748         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
15749         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
15750         all uses.  Add IS_UNDEFINED.  Update declarations to split
15751         different versions of init_base.  Declare init_base_undefined.
15752         (Symbol::is_defined): Handle IS_UNDEFINED.
15753         (Symbol::is_undefined): Likewise.
15754         (Symbol::is_weak_undefined): Call is_undefined.
15755         (Symbol::is_absolute): Handle IS_CONSTANT.
15756         (class Sized_symbol): Update declarations to split different
15757         versions of init.  Declare init_undefined.
15758         (class Symbol_table): Declare new functions.
15759         * symtab.cc (Symbol::init_base_object): Rename from init_base.
15760         Change all callers.
15761         (Symbol::init_base_output_data): Likewise.
15762         (Symbol::init_base_output_segment): Likewise.
15763         (Symbol::init_base_constant): Likewise.
15764         (Symbol::init_base_undefined): New function.
15765         (Sized_symbol::init_object): Rename from init.  Change all
15766         callers.
15767         (Sized_symbol::init_output_data): Likewise.
15768         (Sized_symbol::init_output_segment): Likewise.
15769         (Sized_symbol::init_constant): Likewise.
15770         (Sized_symbol::init_undefined): New function.
15771         (Symbol_table::add_undefined_symbols_from_command_line): New
15772         function.
15773         (Symbol_table::do_add_undefined_symbols_from_command_line): New
15774         function.
15775         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
15776         (Symbol::output_section): Likewise.
15777         (Symbol::set_output_section): Likewise.
15778         (Symbol_table::sized_finalize_symbol): Likewise.
15779         (Symbol_table::sized_write_globals): Likewise.
15780         * resolve.cc (Symbol_table::should_override): Likewise.
15781         (Symbol::override_base_with_special): Likewise.
15782
15783         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
15784         symbol, change it to have default visibility.
15785         * testsuite/protected_1.cc: New file.
15786         * testsuite/protected_2.cc: New file.
15787         * testsuite/protected_3.cc: New file.
15788         * testsuite/protected_main_1.cc: New file.
15789         * testsuite/protected_main_2.cc: New file.
15790         * testsuite/protected_main_3.cc: New file.
15791         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
15792         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
15793         (protected_1_LDFLAGS, protected_1_LDADD): Define.
15794         (protected_1.so): New target.
15795         (protected_1_pic.o, protected_2_pic.o): New targets.
15796         (protected_3_pic.o): New target.
15797         (check_PROGRAMS): Add protected_2.
15798         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
15799         (protected_2_LDFLAGS, protected_2_LDADD): Define.
15800         * testsuite/Makefile.in: Rebuild.
15801
15802         * options.h (DEFINE_var): Add set_user_set_##varname__.
15803         (DEFINE_bool_alias): New macro.
15804         (class General_options): Define -Bstatic using DEFINE_bool_alias
15805         rather than DEFINE_special.  Add --undefined as an alias for -z
15806         defs.
15807         * options.cc (General_options::parse_Bstatic): Remove.
15808
15809         * options.h (class General_options): Add --fatal-warnings.
15810         * main.cc (main): Implement --fatal-warnings.
15811         * errors.h (Errors::warning_count): New function.
15812
15813         * options.h (class General_options): Add -Bsymbolic-functions.
15814         * symtab.h (Symbol::is_preemptible): Check for
15815         -Bsymbolic-functions.
15816
15817 2008-05-05  Ian Lance Taylor  <iant@google.com>
15818
15819         * options.h (DEFINE_bool): For DASH_Z, create the negative option
15820         as noVARNAME rather than no-VARNAME.
15821         (class General_options): Add option -z combreloc.
15822         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15823         get_address.
15824         (Output_reloc::sort_before) [SHT_REL]: New function.
15825         (Output_reloc::sort_before) [SHT_RELA]: New function.
15826         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
15827         Sort_relocs_comparison.
15828         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15829         parameter.  Change all callers.
15830         (Output_data_reloc::Output_data_reloc) [both versions]: Add
15831         sort_relocs parameter.  Change all callers.
15832         * output.cc (Output_reloc::get_address): New function, broken out
15833         of write_rel.
15834         (Output_reloc::write_rel): Call it.
15835         (Output_reloc::compare): New function.
15836         (Output_data_reloc_base::do_write): Optionally sort relocs.
15837
15838         * configure.ac: If targ_extra_obj is set, link it in.
15839         * configure.tgt: Initialize all variables.
15840         (x86_64*): Set targ_extra_obj and targ_extra_size.
15841         * configure: Rebuild.
15842
15843         * object.cc (Sized_relobj::include_section_group): Adjust section
15844         indexes read from group data.  Build vector to pass to
15845         layout_group.
15846         * layout.cc (Layout::layout_group): Add flags and shndxes
15847         parameters.  Remove contents parameter.  Change caller.  Update
15848         explicit instantiations.
15849         * layout.h (class Layout): Update layout_group declaration.
15850         * output.cc (Output_data_group::Output_data_group): Add flags and
15851         input_shndxes parameters.  Remove contents parameter.  Change
15852         caller.
15853         (Output_data_group::do_write): Change input_sections_ to
15854         input_shndxes_.
15855         * output.h (class Output_data_group): Update constructor
15856         declaration.  Rename input_sections_ to input_shndxes_.
15857         * testsuite/many_sections_test.cc: Add template.
15858
15859 2008-04-30  Cary Coutant  <ccoutant@google.com>
15860
15861         * target-reloc.h (relocate_section): Fix dead-pointer bug.
15862
15863         * layout.cc (Layout::include_section): Refactored check for debug
15864         info section.
15865         (Layout::add_comdat): Add new parameters.  Change type
15866         of signature parameter.  Add object and shndx to signatures table.
15867         (Layout::find_kept_object): New function.
15868         * layout.h: Include <cstring>.
15869         (Layout::is_debug_info_section): New function.
15870         (Layout::add_comdat): Add new parameters.
15871         (Layout::find_kept_object): New function.
15872         (Layout::Kept_section): New struct.
15873         (Layout::Signatures): Change type of map range.
15874         * object.cc (Relobj::output_section_address): New function.
15875         (Sized_relobj::include_section_group): Add new parameters.  Change
15876         calls to Layout::add_comdat.  Change to build table of kept comdat
15877         groups and table mapping discarded sections to kept sections.
15878         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
15879         (Sized_relobj::do_layout): Change calls to include_section_group and
15880         include_linkonce_section.
15881         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15882         value to zero when section is discarded.
15883         (Sized_relobj::map_to_kept_section): New function.
15884         * object.h (Relobj::output_section_address): New function.
15885         (Relobj::Comdat_group): New type.
15886         (Relobj::find_comdat_group): New function.
15887         (Relobj::Comdat_group_table): New type.
15888         (Relobj::Kept_comdat_section): New type.
15889         (Relobj::Kept_comdat_section_table): New type.
15890         (Relobj::add_comdat_group): New function.
15891         (Relobj::set_kept_comdat_section): New function.
15892         (Relobj::get_kept_comdat_section): New function.
15893         (Relobj::comdat_groups_): New field.
15894         (Relobj::kept_comdat_sections_): New field.
15895         (Symbol_value::input_value): Update comment.
15896         (Sized_relobj::map_to_kept_section) New function.
15897         (Sized_relobj::include_linkonce_section): Add new parameter.
15898         * target-reloc.h (Comdat_behavior): New type.
15899         (get_comdat_behavior): New function.
15900         (relocate_section): Add code to map a discarded section to the
15901         corresponding kept section when applying a relocation.
15902
15903 2008-04-30  Craig Silverstein  <csilvers@google.com>
15904
15905         * dwarf_reader.cc (next_generation_count): New static var.
15906         (Addr2line_cache_entry): New struct.
15907         (addr2line_cache): New static var.
15908         (Dwarf_line_info::one_addr2line): Added caching.
15909         (Dwarf_line_info::clear_addr2line_cache): New function.
15910         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
15911         cache-size parameter.
15912         (Dwarf_line_info::one_addr2line_cache): New function.
15913         * symtab.cc (Symbol_table::detect_odr_violations): Pass
15914         new cache-size argument to one_addr2line(), and clear cache.
15915
15916 2008-04-28  Cary Coutant  <ccoutant@google.com>
15917
15918         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
15919         R_386_PC8 relocations.
15920
15921 2008-04-23  Ian Lance Taylor  <iant@google.com>
15922
15923         * object.cc (Sized_relobj::include_section_group): Check for
15924         invalid section group.
15925
15926         * object.cc (make_elf_object): Correct test for 64-bit ELF file
15927         header size.
15928
15929         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
15930         than read for file header.
15931         * archive.cc (Archive::include_member): Likewise.
15932
15933 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
15934
15935         * aclocal.m4: Regenerate.
15936         * configure: Regenerate.
15937
15938 2008-04-19  Ian Lance Taylor  <iant@google.com>
15939
15940         * version.cc (version_string): Bump to 1.6.
15941
15942         * testsuite/Makefile.am (many_sections_r_test): New target.
15943         (many_sections_r_test_SOURCES): Remove.
15944         (many_sections_r_test_DEPENDENCIES): Remove.
15945         (many_sections_r_test_LDFLAGS): Remove.
15946         (many_sections_r_test_LDADD): Remove.
15947
15948         * object.cc (Sized_relobj::do_add_symbols): Always pass
15949         local_symbol_count_ to add_from_relobj.
15950
15951         * testsuite/Makefile.am (many_sections_check.h): Only check one in
15952         every thousand variables.
15953         * testsuite/Makefile.in: Rebuild.
15954
15955         * object.cc (Xindex::initialize_symtab_xindex): New function.
15956         (Xindex::read_symtab_xindex): New function.
15957         (Xindex::sym_xindex_to_shndx): New function.
15958         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
15959         available.
15960         (Sized_relobj::do_initialize_xindex): New function.
15961         (Sized_relobj::do_read_symbols): Adjust section links.
15962         (Sized_relobj::symbol_section_and_value): Add is_ordinary
15963         parameter.  Change all callers.
15964         (Sized_relobj::include_section_group): Adjust section links and
15965         symbol section indexes.
15966         (Sized_relobj::do_layout): Adjust section links.
15967         (Sized_relobj::do_count_local_symbols): Adjust section links and
15968         symbol section indexes.
15969         (Sized_relobj::do_finalize_local_symbols): Distinguish between
15970         ordinary and special symbols.
15971         (Sized_relobj::write_local_symbols): Add symtab_xindex and
15972         dynsym_xindex parameters.  Change all callers.  Adjust section
15973         links.  Use SHN_XINDEX when needed.
15974         (Sized_relobj::get_symbol_location_info): Adjust section links.
15975         Don't get fooled by special symbols.
15976         * object.h (class Xindex): Define.
15977         (class Object): Add xindex_ parameter.  Declare virtual functoin
15978         do_initialize_xindex.
15979         (Object::adjust_sym_shndx): New function.
15980         (Object::set_xindex): New protected function.
15981         (class Symbol_value): Add is_ordinary_shndx_ field.
15982         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15983         (Symbol_value::value): Assert ordinary section.
15984         (Symbol_value::initialize_input_to_output_map): Likewise.
15985         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15986         Change all callers.
15987         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
15988         all callers.
15989         (class Sized_relobj): Update declarations.
15990         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15991         parameter.  Change all callers.
15992         (Sized_relobj::adjust_shndx): New function.
15993         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15994         field.
15995         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15996         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
15997         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
15998         (Sized_dynobj::read_dynsym_section): Adjust section links.
15999         (Sized_dynobj::read_dynamic): Likewise.
16000         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
16001         section links.
16002         (Sized_dynobj::do_initialize_xindex): New function.
16003         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
16004         do_initialize_xindex.
16005         (Sized_dynobj::adjust_shndx): New function.
16006         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
16007         dynsym_xindex_ fields.
16008         (Layout::finalize): Add a call to set_section_indexes before
16009         creating the symtab sections.
16010         (Layout::set_section_indexes): Don't do anything if the section
16011         already has a section index.
16012         (Layout::create_symtab_sections): Add shnum parameter.  Change
16013         caller.  Create .symtab_shndx section if needed.
16014         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
16015         caller.
16016         (Layout::allocated_output_section_count): New function.
16017         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
16018         needed.
16019         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
16020         fields.  Update declarations.
16021         (Layout::symtab_xindex): New function.
16022         (Layout::dynsym_xindex): New function.
16023         (class Write_symbols_task): Add layout_ field.
16024         (Write_symbols_task::Write_symbols_task): Add layout parameter.
16025         Change caller.
16026         * output.cc (Output_section_headers::Output_section_headers): Add
16027         shstrtab_section parameter.  Change all callers.
16028         (Output_section_headers::do_sized_write): Store overflow values
16029         for section count and section string table section index in
16030         section header zero.
16031         (Output_file_header::do_sized_write): Check for overflow of
16032         section count and section string table section index.
16033         (Output_symtab_xindex::do_write): New function.
16034         (Output_symtab_xindex::endian_do_write): New function.
16035         * output.h (class Output_section_headers): Add shstrtab_section_.
16036         Update declarations.
16037         (class Output_symtab_xindex): Define.
16038         (Output_section::has_out_shndx): New function.
16039         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
16040         field.
16041         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
16042         Change all callers.
16043         (Sized_symbol::init): Likewise.
16044         (Symbol::output_section): Check for ordinary symbol.
16045         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
16046         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
16047         callers.
16048         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
16049         Change all callers.  Simplify handling of symbols from sections
16050         not included in the link.
16051         (Symbol_table::add_from_dynobj): Handle ordinary symbol
16052         distinction.
16053         (Weak_alias_sorter::operator()): Assert that symbols are
16054         ordinary.
16055         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
16056         distinction.
16057         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
16058         parameters.  Change all callers.
16059         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
16060         symbol distinction.  Use SHN_XINDEX when needed.
16061         (Symbol_table::write_section_symbol): Add symtab_xindex
16062         parameter.  Change all callers.
16063         (Symbol_table::sized_write_section_symbol): Likewise.  Use
16064         SHN_XINDEX when needed.
16065         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
16066         declarations.
16067         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
16068         (Symbol::is_defined): Check is_ordinary.
16069         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
16070         (Symbol::is_absolute, Symbol::is_common): Likewise.
16071         (class Sized_symbol): Update declarations.
16072         (class Symbol_table): Update declarations.
16073         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
16074         parameters.  Change all callers.
16075         (Sized_symbol::override): Likewise.
16076         (Symbol_table::override): Likewise.
16077         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
16078         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
16079         is_ordinary, and orig_st_shndx parameters.  Change all callers.
16080         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
16081         to be in an ordinary section.
16082         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
16083         object and is_ordinary parameters.  Change all callers.
16084         (Sized_dwarf_line_info::read_relocs): Add object parameter.
16085         Change all callers.  Don't add undefined or non-ordinary symbols
16086         to reloc_map_.
16087         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
16088         Change all callers.
16089         * dwarf_reader.h (class Sized_dwarf_line_info): Update
16090         declarations.
16091         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
16092         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
16093         (Sized_relobj::relocate_sections): Likewise.
16094         * target-reloc.h (scan_relocs): Adjust section symbol index.
16095         (scan_relocatable_relocs): Likewise.
16096         * i386.cc (Scan::local): Check for ordinary symbols.
16097         * sparc.cc (Scan::local): Likewise.
16098         * x86_64.cc (Scan::local): Likewise.
16099         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
16100         to symbol_section_and_value.
16101         * testsuite/many_sections_test.cc: New file.
16102         * testsuite/Makefile.am (BUILT_SOURCES): Define.
16103         (check_PROGRAMS): Add many_sections_test.
16104         (many_sections_test_SOURCES): Define.
16105         (many_sections_test_DEPENDENCIES): Define.
16106         (many_sections_test_LDFLAGS): Define.
16107         (BUILT_SOURCES): Add many_sections_define.h.
16108         (many_sections_define.h): New target.
16109         (BUILT_SOURCES): Add many_sections_check.h.
16110         (many_sections_check.h): New target.
16111         (check_PROGRAMS): Add many_sections_r_test.
16112         (many_sections_r_test_SOURCES): Define.
16113         (many_sections_r_test_DEPENDENCIES): Define.
16114         (many_sections_r_test_LDFLAGS): Define.
16115         (many_sections_r_test_LDADD): Define.
16116         (many_sections_r_test.o): New target.
16117         * testsuite/Makefile.in: Rebuild.
16118
16119 2008-04-17  Cary Coutant  <ccoutant@google.com>
16120
16121         * errors.cc (Errors::info): New function.
16122         (gold_info): New function.
16123         * errors.h (Errors::info): New function.
16124         * gold.h (gold_info): New function.
16125         * object.cc (Input_objects::add_object): Print trace output.
16126         * options.cc (options::parse_set): New function.
16127         (General_options::parse_wrap): Deleted.
16128         (General_options::General_options): Deleted initializer.
16129         * options.h (options::String_set): New typedef.
16130         (options::parse_set): New function.
16131         (DEFINE_set): New macro.
16132         (General_options::wrap): Changed to use DEFINE_set. Changed
16133         callers of any_wrap_symbols and is_wrap_symbol.
16134         (General_options::trace, General_options::trace_symbol):
16135         New options.
16136         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
16137         (General_options::wrap_symbols_): Deleted.
16138         * symtab.cc (Symbol_table::add_from_object): Print trace output.
16139
16140 2008-04-17  David S. Miller  <davem@davemloft.net>
16141
16142         * options.cc (General_options::parse_V): New function.
16143         * options.h: Add entries for -V and -Qy.
16144
16145 2008-04-17  Ian Lance Taylor  <iant@google.com>
16146
16147         * common.cc (Symbol_table::allocate_commons): Remove options
16148         parameter.  Change caller.
16149         (Symbol_table::do_allocate_commons): Remove options parameter.
16150         Change caller.  Just call do_allocate_commons_list twice.
16151         (Symbol_table::do_allocate_commons_list): New function, broken out
16152         of do_allocate_commons.
16153         * common.h (class Allocate_commons_task): Remove options_ field.
16154         Update constructor.
16155         * symtab.cc (Symbol_table::Symbol_table): Initialize
16156         tls_commons_.
16157         (Symbol_table::add_from_object): Put TLS common symbols on
16158         tls_commons_ list.
16159         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
16160         which are IN_OUTPUT_DATA.
16161         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
16162         allocate_commons and do_allocate_commons declarations.  Declare
16163         do_allocate_commons_list.
16164         * gold.cc (queue_middle_tasks): Update creation of
16165         Allocate_commons_task to not pass options.
16166         * testsuite/Makefile.am (INCLUDES): Add -I.. .
16167         (TLS_TEST_C_FLAGS): New variable.
16168         (tls_test_c_pic.o): New target.
16169         (tls_test_shared.so): Link in tls_test_c_pic.o.
16170         (tls_test_c_pic_ie.o): New target.
16171         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
16172         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
16173         (tls_test_c.o): New target.
16174         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
16175         (tls_pic_test_LDADD): Likewise.
16176         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
16177         (tls_shared_gd_to_ie_test_LDADD): Likewise.
16178         (tls_test_c_gnu2.o): New target.
16179         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
16180         tls_test_c_gnu2.o.
16181         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
16182         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
16183         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
16184         * testsuite/tls_test.cc: Include "config.h".
16185         (t_last): Call t11_last.
16186         * testsuite/tls_test.h (t11, t11_last): Declare.
16187         * testsuite/tls_test_c.c: New file.
16188         * testsuite/tls_test_main.cc (thread_routine): Call t11.
16189         * configure.ac: Check for OpenMP support.
16190         * configure, config.in, Makefile.in: Rebuild.
16191         * testsuite/Makefile.in: Rebuild.
16192
16193 2008-04-16  Cary Coutant  <ccoutant@google.com>
16194
16195         * i386.cc (Target_i386::define_tls_base_symbol): New function.
16196         (Target_i386::tls_base_symbol_defined_): New field.
16197         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16198         (Target_i386::Scan::global): Likewise.
16199         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
16200         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
16201         (Target_x86_64::tls_base_symbol_defined_): New field.
16202         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16203         (Target_x86_64::Scan::global): Likewise.
16204
16205 2008-04-16  Cary Coutant  <ccoutant@google.com>
16206
16207         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
16208         (Symbol::needs_plt_entry): Allow weak undefined symbols.
16209         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
16210         building shared libraries.
16211         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
16212         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
16213         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
16214         * testsuite/Makefile.in: Rebuild.
16215         * testsuite/weak_undef.h: New file.
16216         * testsuite/weak_undef_file1.cc: Add extra test cases.
16217         * testsuite/weak_undef_file2.cc: Likewise.
16218         * testsuite/weak_undef_test.cc: Likewise.
16219
16220 2008-04-16  David S. Miller  <davem@davemloft.net>
16221
16222         * sparc.cc (Target_sparc::Scan): Change from struct to class.
16223         Add issued_non_pic_error_ field.  Declare check_non_pic.
16224         (Target_sparc::Scan::check_non_pic): New function.
16225         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
16226         (Target_sparc::Scan::global): Likewise.
16227
16228         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
16229         * configure: Rebuild.
16230
16231         * options.h (DEFINE_enable): New macro.
16232         (new_dtags): New enable option.
16233         (initfirst, interpose, loadfltr, nodefaultlib,
16234         nodelete, nodlopen, nodump): New -z options.
16235         * layout.cc (Layout:finish_dynamic_section): If new
16236         dtags enabled, emit DT_RUNPATH.  Also, emit a
16237         DT_FLAGS_1 containing any specified -z flags.
16238
16239 2008-04-16  Ian Lance Taylor  <iant@google.com>
16240
16241         * copy-relocs.cc: New file.
16242         * copy-relocs.h: New file.
16243         * reloc.cc: Remove Copy_relocs code.
16244         * reloc.h: Likewise.
16245         * reloc-types.h (struct Reloc_types) [both versions]: Add
16246         get_reloc_addend_noerror.
16247         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
16248         variants of add_global which take an addend which must be zero.
16249         * i386.cc: Include "copy-relocs.h".
16250         (class Target_i386): Change type of copy_relocs_ to variable,
16251         update initializer.
16252         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
16253         Change all callers.
16254         (Target_i386::do_finalize_sections): Change handling of
16255         copy_relocs_.
16256         * sparc.cc: Include "copy-relocs.h".
16257         (class Target_sparc): Change type of copy_relocs_ to variable,
16258         update initializer.
16259         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
16260         Change all callers.
16261         (Target_sparc::do_finalize_sections): Change handling of
16262         copy_relocs_.
16263         * x86_64.cc: Include "copy-relocs.h".
16264         (class Target_x86_64): Change type of copy_relocs_ to variable,
16265         update initializer.
16266         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
16267         class.  Change all callers.
16268         (Target_x86_64::do_finalize_sections): Change handling of
16269         copy_relocs_.
16270         * Makefile.am (CCFILES): Add copy-relocs.cc.
16271         (HFILES): Add copy-relocs.h.
16272
16273         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
16274
16275         * testsuite/script_test_4.sh: Permit leading zeroes.
16276
16277 2008-04-15  Ian Lance Taylor  <iant@google.com>
16278
16279         * script-sections.cc (Script_sections::create_segments): Use
16280         header_size_adjustment even when there is enough room for the
16281         headers.
16282         * testsuite/script_test_4.sh: New file.
16283         * testsuite/script_test_4.t: New file.
16284         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
16285         (check_DATA): Add script_test_4.stdout.
16286         (MOSTLYCLEANFILES): Likewise.
16287         (script_test_4): New target.
16288         (script_test_4.stdout): New target.
16289         * testsuite/Makefile.in: Rebuild.
16290
16291         * sparc.cc: Add definitions for Output_data_plt_sparc class
16292         constants.
16293
16294 2008-04-14  David S. Miller  <davem@davemloft.net>
16295
16296         * sparc.cc: New file.
16297         * Makefile.am (TARGETSOURCES): Add sparc.cc
16298         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
16299         * configure.tgt: Document targ_extra_size and
16300         targ_extra_big_endian.  Add entries for sparc-* and
16301         sparc64-*.
16302         * configure.ac: Handle targ_extra_size and
16303         targ_extra_big_endian.
16304         * Makefile.in: Rebuild.
16305         * configure: Likewise.
16306         * po/POTFILES.in: Likewise.
16307         * po/gold.pot: Likewise.
16308
16309 2008-04-14  Ian Lance Taylor  <iant@google.com>
16310
16311         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
16312         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
16313         in the name/type/flags to section mapping.  Don't call
16314         allocate_output_section.
16315         (Layout::choose_output_section): Change parameter from adjust_name
16316         to is_input_section.  Don't permit input sections after sections
16317         are attached to segments.  Don't call allocate_output_section.
16318         (Layout::layout_eh_frame): Call update_flags_for_input_section,
16319         not write_enable_output_section.
16320         (Layout::make_output_section): Don't push to
16321         unattached_section_list_ nor call attach_to_segment.  Call
16322         attach_section_to_segment if sections are attached.
16323         (Layout::attach_sections_to_segments): New function.
16324         (Layout::attach_section_to_segment): New function.
16325         (Layout::attach_allocated_section_to_segment): Rename from
16326         attach_to_segment.  Remove flags parameter.
16327         (Layout::allocate_output_section): Remove function.
16328         (Layout::write_enable_output_section): Remove function.
16329         * layout.h (class Layout): Update for above changes.  Add new
16330         field sections_are_attached_.
16331         * output.h (Output_section::update_flags_for_input_section): New
16332         function.
16333         * output.cc (Output_section::add_input_section): Call
16334         update_flags_for_input_section.
16335         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
16336
16337 2008-04-11  Cary Coutant  <ccoutant@google.com>
16338
16339         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
16340         thought unnecessary.
16341         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
16342
16343 2008-04-11  Ian Lance Taylor  <iant@google.com>
16344
16345         * output.h (class Output_section_data): Remove inline definition
16346         of set_addralign.
16347         * output.cc (Output_section_data::set_addralign): New function.
16348
16349 2008-04-11  Cary Coutant  <ccoutant@google.com>
16350
16351         Add support for TLS descriptors for i386 and x86_64.
16352         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
16353         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
16354         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
16355         GOT_TYPE_TLS_DESC.
16356         (Target_i386::got_mod_index_entry): Remove unnecessary code.
16357         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
16358         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
16359         relocations.
16360         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
16361         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
16362         Fix problem with initial-exec relocations.
16363         (Target_i386::Relocate::relocate_tls): Likewise.
16364         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
16365         relaxation.
16366         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
16367         support for section-plus-offset dynamic table entries.
16368         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
16369         (Output_data_dynamic::Dynamic_entry): Add support for
16370         section-plus-offset dynamic table entries.
16371         (Output_data_dynamic::Classification): Likewise.
16372         (Output_data_dynamic::classification_): Renamed offset_.
16373         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
16374         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
16375         (Target_x86_64::make_plt_section): New function.
16376         (Target_x86_64::reserve_tlsdesc_entries): New function.
16377         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
16378         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
16379         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
16380         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
16381         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
16382         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
16383         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
16384         add extra PLT entry for TLS descriptors.
16385         (Output_data_plt_x86_64::got_): New field.
16386         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
16387         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
16388         fields.
16389         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
16390         descriptors.
16391         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
16392         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
16393         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
16394         R_386_TLS_DESC_CALL relocations.
16395         (Target_x86_64::Scan::global): Likewise.
16396         (Target_x86_64::do_finalize_sections): Add dynamic table entries
16397         for TLS descriptors.
16398         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
16399         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
16400         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
16401         GD-to-IE relaxation.
16402         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
16403         and TLS_DESCRIPTORS.
16404         * Makefile.in: Rebuild.
16405         * configure: Rebuild.
16406         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
16407         (tls_test_shared2.so): New target.
16408         (tls_shared_gd_to_ie_test_SOURCES): New variable.
16409         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
16410         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
16411         (tls_shared_gd_to_ie_test_LDADD): New variable.
16412         (tls_shared_gnu2_gd_to_ie_test): New target.
16413         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
16414         New targets.
16415         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
16416         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
16417         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
16418         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
16419         (tls_shared_gnu2_test): New target.
16420         (tls_test_gnu2_shared.so): New target.
16421         (tls_shared_gnu2_test_SOURCES): New variable.
16422         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
16423         (tls_shared_gnu2_test_LDFLAGS): New variable.
16424         (tls_shared_gnu2_test_LDADD): New variable.
16425         * testsuite/Makefile.in: Rebuild.
16426         * testsuite/Makefile.
16427
16428 2008-04-11  Ian Lance Taylor  <iant@google.com>
16429
16430         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
16431         justsyms.t.
16432         * testsuite/Makefile.in: Rebuild.
16433
16434         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
16435         long.
16436         * testsuite/script_test_2.cc (main): Adjust test.
16437
16438 2008-04-11  David S. Miller  <davem@davemloft.net>
16439             Ian Lance Taylor  <iant@google.com>
16440
16441         * options.h (General_options): Add entries for '-Y' and
16442         '-relax'.
16443         * options.cc (General_options:finalize): If -Y was used, add those
16444         entries to the library path instead of the default "/lib" and
16445         "/usr/lib".
16446
16447 2008-04-11  David S. Miller  <davem@davemloft.net>
16448
16449         * testsuite/justsyms.t: Start at 0x100.
16450         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
16451         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
16452         long.
16453         * testsuite/script_test_2.cc: Adjust string and section length
16454         checks.
16455
16456 2008-04-09  Ian Lance Taylor  <iant@google.com>
16457
16458         PR gold/5996
16459         * script-sections.cc (Sections_element::allocate_to_segment): Add
16460         orphan parameter.
16461         (Output_section_definition::allocate_to_segment): Likewise.
16462         (Orphan_output_section::allocate_to_segment): Likewise.
16463         (Script_sections::attach_sections_using_phdrs_clause): Don't
16464         propagate non-PT_LOAD segments to orphan sections.
16465         * testsuite/Makefile.am (script_test_3.stdout): Generate using
16466         readelf rather than objdump.
16467         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
16468         .interp section and PT_INTERP segment are the same size.
16469         * testsuite/Makefile.in: Rebuild.
16470
16471         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
16472         aliases for symbols defined in the same object.
16473         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
16474         (weak_alias_test_SOURCES): New variable.
16475         (weak_alias_test_DEPENDENCIES): New variable.
16476         (weak_alias_test_LDFLAGS): New variable.
16477         (weak_alias_test_LDADD): New variable.
16478         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
16479         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
16480         (weak_alias_test_3.o): New target.
16481         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
16482         * testsuite/weak_alias_test_main.cc: New file.
16483         * testsuite/weak_alias_test_1.cc: New file.
16484         * testsuite/weak_alias_test_2.cc: New file.
16485         * testsuite/weak_alias_test_3.cc: New file.
16486
16487 2008-04-08  Ian Lance Taylor  <iant@google.com>
16488
16489         * options.h (class General_options): Add --noinhibit-exec option.
16490         * main.cc (main): Check --noinhibit-exec.
16491
16492         * options.h (class General_options): Define --wrap as a special
16493         option.  Add wrap_symbols_ field.
16494         (General_options::any_wrap_symbols): New function.
16495         (General_options::is_wrap_symbol): New function.
16496         * options.cc (General_options::parse_wrap): New function.
16497         (General_options::General_options): Initialize wrap_symbols_.
16498         * symtab.cc (Symbol_table::wrap_symbol): New function.
16499         (Symbol_table::add_from_object): Handle --wrap.
16500         * symtab.h (class Symbol_table): Declare wrap_symbol.
16501         * target.h (Target::wrap_char): New function.
16502         (Target::Target_info): Add wrap_char field.
16503         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
16504         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
16505         * testsuite/testfile.cc (Target_test::test_target_info):
16506         Likewise.
16507
16508         * errors.cc (Errors::undefined_symbol): Mention symbol version if
16509         there is one.
16510
16511         * layout.h (class Layout): Add added_eh_frame_data_ field.
16512         * layout.cc (Layout::Layout): Initialize new field.
16513         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
16514         output section until we find a section we merged successfully.
16515         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
16516         that the size be non-zero.
16517
16518         * merge.cc (Object_merge_map::get_output_offset): Remove inline
16519         qualifier.
16520
16521 2008-04-08  Craig Silverstein  <csilvers@google.com>
16522
16523         * configure.ac: Export new conditional variable HAVE_ZLIB.
16524         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
16525         on HAVE_ZLIB.
16526         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
16527         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16528
16529 2008-04-07  Ian Lance Taylor  <iant@google.com>
16530
16531         * version.cc (version_string): Set to "1.5".
16532
16533         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
16534         Add issued_non_pic_error_ field.  Declare check_non_pic.
16535         (Target_x86_64::Scan::check_non_pic): New function.
16536         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
16537         (Target_x86_64::Scan::global): Likewise.
16538
16539         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
16540         addend parameter.  Change caller.  Handle merge sections.
16541         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
16542         Address to Addend.  Don't add in the result of
16543         local_section_offset, pass down the addend and use the returned
16544         value.
16545         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
16546         Update declarations of local_section_offset and symbol_value.
16547         * testsuite/two_file_test_1.cc (t18): New function.
16548         * testsuite/two_file_test_2.cc (f18): New function.
16549         * testsuite/two_file_test_main.cc (main): Call t18.
16550         * testsuite/two_file_test.h (t18, f18): Declare.
16551
16552         * configure.ac: Don't test for objdump, c++filt, or readelf.
16553         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
16554         conditionals.
16555         (TEST_READELF): New variable.
16556         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
16557         (check_PROGRAMS): Add two_file_strip_test.
16558         (two_file_strip_test): New target.
16559         (check_PROGRAMS): Add two_file_same_shared_strip_test.
16560         (two_file_same_shared_strip_test_SOURCES): New variable.
16561         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
16562         (two_file_same_shared_strip_test_LDFLAGS): New variable.
16563         (two_file_same_shared_strip_test_LDADD): New variable.
16564         (two_file_shared_strip.so): New target.
16565         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
16566         (ver_test_5.syms, ver_test_7.syms): Likewise.
16567         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
16568         (strip_test_3.stdout): Use TEST_OBJDUMP.
16569         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16570
16571 2008-04-04  Cary Coutant  <ccoutant@google.com>
16572
16573         * symtab.h (Symbol::is_weak_undefined): New function.
16574         (Symbol::is_strong_undefined): New function.
16575         (Symbol::is_absolute): New function.
16576         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
16577         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
16578         absolute symbols.
16579         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
16580         (weak_undef_test): New target.
16581         * testsuite/Makefile.in: Rebuild.
16582         * testsuite/weak_undef_file1.cc: New file.
16583         * testsuite/weak_undef_file2.cc: New file.
16584         * testsuite/weak_undef_test.cc: New file.
16585
16586 2008-04-03  Craig Silverstein  <csilvers@google.com>
16587
16588         * compressed_output.h (class Output_compressed_section): Use
16589         unsigned buffer.
16590         * compressed_output.cc (zlib_compress): Use unsigned buffers,
16591         add zlib header.
16592         (zlib_compressed_suffix): Removed.
16593         (Output_compressed_section::set_final_data_size): Use unsigned
16594         buffers.
16595         * testsuite/Makefile.am (flagstest_compress_debug_sections):
16596         Fix linker invocation.
16597         (flagstest_o_specialfile_and_compress_debug_sections):
16598         Likewise.
16599         * testsuite/Makefile.in: Regenerated.
16600
16601 2008-04-02  David S. Miller  <davem@davemloft.net>
16602
16603         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
16604         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
16605
16606 2008-04-02  Craig Silverstein  <csilvers@google.com>
16607
16608         * TODO: New file.
16609
16610 2008-04-02  Ian Lance Taylor  <iant@google.com>
16611
16612         * fileread.cc (File_read::find_view): Add byteshift and vshifted
16613         parameters.  Update for new key type to views_.  Change all
16614         callers.
16615         (File_read::read): Adjust for byteshift in returned view.
16616         (File_read::add_view): New function, broken out of
16617         find_and_make_view.
16618         (File_read::make_view): New function, broken out of
16619         find_and_make_view.
16620         (File_read::find_or_make_view): Add offset and aligned
16621         parameters.  Rewrite accordingly.  Change all callers.
16622         (File_read::get_view): Add offset and aligned parameters.  Adjust
16623         for byteshift in return value.
16624         (File_read::get_lasting_view): Likewise.
16625         * fileread.h (class File_read): Update declarations.
16626         (class File_read::View): Add byteshift_ field.  Add byteshift to
16627         constructor.  Add byteshift method.
16628         * archive.h (Archive::clear_uncached_views): New function.
16629         (Archive::get_view): Add aligned parameter.  Change all callers.
16630         * object.h (Object::get_view): Add aligned parameter.  Change all
16631         callers.
16632         (Object::get_lasting_view): Likewise.
16633
16634         * fileread.cc (File_read::release): Don't call clear_views if
16635         there are multiple objects.
16636         * fileread.h (File_read::clear_uncached_views): New function.
16637         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
16638         on the archive.
16639
16640 2008-03-31  Cary Coutant  <ccoutant@google.com>
16641
16642         Add thin archive support.
16643         * archive.cc (Archive::armagt): New const.
16644         (Archive::setup): Remove task parameter and calls to unlock.
16645         (Archive::unlock_nested_archives): New function.
16646         (Archive::read_header): Add nested_off parameter. Change
16647         all callers.
16648         (Archive::interpret_header): Likewise.
16649         (Archive::include_all_members): Change to handle thin
16650         archives.
16651         (Archive::include_member): Likewise.
16652         * archive.h (Archive::Archive): Add new parameters and
16653         initializers.
16654         (Archive::armagt): New const.
16655         (Archive::setup): Remove task parameter.
16656         (Archive::unlock_nested_archives): New function.
16657         (Archive::read_header): Add nested_off parameter.
16658         (Archive::interpret_header): Likewise.
16659         (Archive::Nested_archive_table): New typedef.
16660         (Archive::is_thin_archive_): New field.
16661         (Archive::nested_archives_): New field.
16662         (Archive::options_): New field.
16663         (Archive::dirpath_): New field.
16664         (Archive::task_): New field.
16665         * readsyms.cc (Read_symbols::do_read_symbols): Add check
16666         for thin archives.  Pass additional parameters to
16667         Archive::Archive.  Unlock the archive file after calling
16668         Archive::setup.
16669
16670 2008-03-29  Ian Lance Taylor  <iant@google.com>
16671
16672         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
16673         version symbol to be local.
16674         * testsuite/ver_test_4.sh: New file.
16675         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
16676         (check_DATA): Add ver_test_4.syms.
16677         (ver_test_4.syms): New target.
16678         * testsuite/Makefile.in: Rebuild.
16679
16680         * output.cc
16681         (Output_section::Input_section_sort_entry::has_priority): New
16682         function.
16683         (Output_section::Input_section_sort_entry::match_file_name): New
16684         function.
16685         (Output_section::Input_section_sort_entry::match_section_name):
16686         Remove.
16687         (Output_section::Input_section_sort_entry::match_section_name_prefix):
16688         Remove.
16689         (Output_section::Input_section_sort_entry::match_section_file):
16690         Remove.
16691         (Output_section::Input_section_sort_compare::operator()): Rewrite
16692         using new Input_section_sort_entry functions.  Sort crtbegin and
16693         crtend first.  Sort sections with no priority before sections with
16694         a priority.
16695         * testsuite/initpri1.c (d3): Check j != 4.
16696         (cd5): New constructor/destructor function.
16697         (main): Check j != 2.
16698
16699         * symtab.cc (Symbol_table::add_from_object): If we don't use the
16700         new symbol when resolving, don't call set_is_default.
16701         * testsuite/ver_test_7.cc: New file.
16702         * testsuite/ver_test_7.sh: New file.
16703         * testsuite/Makefile.am (ver_test_7.so): New target.
16704         (ver_test_7.o): New target.
16705         (check_SCRIPTS): Add ver_test_7.sh.
16706         (check_DATA): Add ver_test_7.syms.
16707         (ver_test_7.syms): New target.
16708
16709 2008-03-28  Ian Lance Taylor  <iant@google.com>
16710
16711         * layout.cc (Layout::layout): If we see an input section with a
16712         name that needs sorting, set the must_sort flag for the output
16713         section.
16714         (Layout::make_output_section): If the name of the output section
16715         indicates that it might require sorting, set the may_sort flag.
16716         * output.h (Output_section::may_sort_attached_input_sections): New
16717         function.
16718         (Output_section::set_may_sort_attached_input_sections): New
16719         function.
16720         (Output_section::must_sort_attached_input_sections): New
16721         function.
16722         (Output_section::set_must_sort_attached_input_sections): New
16723         function.
16724         (class Output_section): Declare Input_section_sort_entry.  Define
16725         Input_section_sort_compare.  Declare
16726         sort_attached_input_sections.  Add new fields:
16727         may_sort_attached_input_sections_,
16728         must_sort_attached_input_sections_,
16729         attached_input_sections_are_sorted_.
16730         * output.cc (Output_section::Output_section): Initialize new
16731         fields.
16732         (Output_section::add_input_section): Add an entry to
16733         input_sections_ if may_sort or must_sort are true.
16734         (Output_section::set_final_data_size): Call
16735         sort_attached_input_sections if necessary.
16736         (Output_section::Input_section_sort_entry): Define new class.
16737         (Output_section::Input_section_sort_compare::operator()): New
16738         function.
16739         (Output_section::sort_attached_input_sections): New function.
16740         * configure.ac: Check whether the compiler supports constructor
16741         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
16742         * testsuite/initpri1.c: New file.
16743         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
16744         CONSTRUCTOR_PRIORITY.
16745         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
16746         (initpri1_LDFLAGS): New variable.
16747         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16748
16749 2008-03-27  Ian Lance Taylor  <iant@google.com>
16750
16751         * common.cc (Sort_commons::operator): Correct sorting algorithm.
16752         * testsuite/common_test_1.c: New file.
16753         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
16754         (common_test_1_SOURCES): New variable.
16755         (common_test_1_DEPENDENCIES): New variable.
16756         (common_test_1_LDFLAGS): New variable.
16757
16758         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
16759         and commons_ correctly when NAME/VERSION does not override
16760         NAME/NULL.
16761         * testsuite/ver_test_6.c: New file.
16762         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
16763         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
16764         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
16765
16766 2008-03-26  Ian Lance Taylor  <iant@google.com>
16767
16768         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
16769         of an undefined symbol from a version script.
16770         * testsuite/Makefile.am (ver_test_5.so): New target.
16771         (ver_test_5.o): New target.
16772         (check_SCRIPTS): Add ver_test_5.sh.
16773         (check_DATA): Add ver_test_5.syms.
16774         (ver_test_5.syms): New target.
16775         * testsuite/ver_test_5.cc: New file.
16776         * testsuite/ver_test_5.script: New file.
16777         * testsuite/ver_test_5.sh: New file.
16778         * Makefile.in, testsuite/Makefile.in: Rebuild.
16779
16780         PR gold/5986
16781         Fix problems building gold with gcc 4.3.0.
16782         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
16783         (gold_error_at_location, gold_warning_at_location): Use it.
16784         * configure.ac: Check whether we can compile and use a template
16785         function with a printf attribute.
16786         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
16787         when jumping over bytes.
16788         * object.cc: Instantiate Object::read_section_data.
16789         * debug.h: Include <cstring>
16790         * dwarf_reader.cc: Include <algorithm>
16791         * main.cc: Include <cstring>.
16792         * options.cc: Include <cstring>.
16793         * output.cc: Include <cstring>.
16794         * script.cc: Include <cstring>.
16795         * script.h: Include <string>.
16796         * symtab.cc: Include <cstring> and <algorithm>.
16797         * target-select.cc: Include <cstring>.
16798         * version.cc: Include <string>.
16799         * testsuite/testmain.cc: Include <cstdlib>.
16800         * configure, config.in: Rebuild.
16801
16802 2008-03-25  Ian Lance Taylor  <iant@google.com>
16803
16804         * options.cc: Include "../bfd/bfdver.h".
16805         (options::help): Print bug reporting address.
16806
16807         * version.cc (print_version): Adjust output for current value of
16808         BFD_VERSION_STRING.
16809
16810         * NEWS: New file.
16811
16812         * options.cc (options::help): Print list of supported targets.
16813         * target-select.h: Include <vector>.
16814         (class Target_selector): Make machine_, size_, and is_big_endian_
16815         fields const.  Add bfd_name_ and instantiated_target_ fields.
16816         (Target_selector::Target_selector): Add bfd_name parameter.
16817         (Target_selector::recognize): Make non-virtual, call
16818         do_recognize.
16819         (Target_selector::recognize_by_name): Make non-virtual, call
16820         do_recognize_by_name.
16821         (Target_selector::supported_names): New function.
16822         (Target_selector::bfd_name): New function.
16823         (Target_selector::do_instantiate_target): New pure virtual
16824         function.
16825         (Target_selector::do_recognize): New virtual function.
16826         (Target_selector::do_recognize_by_name): New virtual function.
16827         (Target_selector::instantiate_target): New private function.
16828         (supported_target_names): Declare.
16829         * target-select.cc (Target_selector::Target_selector): Update for
16830         new parameter and fields.
16831         (select_target_by_name): Check that the name matches before
16832         calling recognize_by_name.
16833         (supported_target_names): New function.
16834         * i386.cc (class Target_selector_i386): Update Target_selector
16835         constructor call.  Remove recognize and recognize_by_name.  Add
16836         do_instantiate_target.
16837         * x86_64.cc (class Target_selector_x86_64): Likewise.
16838         * testsuite/testfile.cc (class Target_selector_test): Update for
16839         changes to Target_selector.
16840
16841         * README: Rewrite, with some notes on unsupported features.
16842
16843 2008-03-24  Cary Coutant  <ccoutant@google.com>
16844
16845         * i386.cc (Target_i386::Got_type): New enum declaration.
16846         (Target_i386::Scan::local): Updated callers of Output_data_got
16847         member functions.
16848         (Target_i386::Scan::global): Likewise.
16849         (Target_i386::Relocate::relocate): Likewise.
16850         (Target_i386::Relocate::relocate_tls): Likewise.
16851         * object.h (Got_offset_list): New class.
16852         (Sized_relobj::local_has_got_offset): Added got_type parameter.
16853         (Sized_relobj::local_got_offset): Likewise.
16854         (Sized_relobj::set_local_got_offset): Likewise.
16855         (Sized_relobj::local_has_tls_got_offset): Removed.
16856         (Sized_relobj::local_tls_got_offset): Removed.
16857         (Sized_relobj::set_local_tls_got_offset): Removed.
16858         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16859         * output.cc (Output_data_got::add_global): Added got_type parameter.
16860         (Output_data_got::add_global_with_rel): Likewise.
16861         (Output_data_got::add_global_with_rela): Likewise.
16862         (Output_data_got::add_global_pair_with_rel): New function.
16863         (Output_data_got::add_global_pair_with_rela): New function.
16864         (Output_data_got::add_local): Added got_type parameter.
16865         (Output_data_got::add_local_with_rel): Likewise.
16866         (Output_data_got::add_local_with_rela): Likewise.
16867         (Output_data_got::add_local_pair_with_rel): New function.
16868         (Output_data_got::add_local_pair_with_rela): New function.
16869         (Output_data_got::add_global_tls): Removed.
16870         (Output_data_got::add_global_tls_with_rel): Removed.
16871         (Output_data_got::add_global_tls_with_rela): Removed.
16872         (Output_data_got::add_local_tls): Removed.
16873         (Output_data_got::add_local_tls_with_rel): Removed.
16874         (Output_data_got::add_local_tls_with_rela): Removed.
16875         * output.h (Output_data_got::add_global): Added got_type parameter.
16876         (Output_data_got::add_global_with_rel): Likewise.
16877         (Output_data_got::add_global_with_rela): Likewise.
16878         (Output_data_got::add_global_pair_with_rel): New function.
16879         (Output_data_got::add_global_pair_with_rela): New function.
16880         (Output_data_got::add_local): Added got_type parameter.
16881         (Output_data_got::add_local_with_rel): Likewise.
16882         (Output_data_got::add_local_with_rela): Likewise.
16883         (Output_data_got::add_local_pair_with_rel): New function.
16884         (Output_data_got::add_local_pair_with_rela): New function.
16885         (Output_data_got::add_global_tls): Removed.
16886         (Output_data_got::add_global_tls_with_rel): Removed.
16887         (Output_data_got::add_global_tls_with_rela): Removed.
16888         (Output_data_got::add_local_tls): Removed.
16889         (Output_data_got::add_local_tls_with_rel): Removed.
16890         (Output_data_got::add_local_tls_with_rela): Removed.
16891         * resolve.cc (Symbol::override_base_with_special): Removed
16892         reference to has_got_offset_ field.
16893         * symtab.cc (Symbol::init_fields): Replaced initialization
16894         of got_offset_ with got_offsets_.  Removed initialization
16895         of has_got_offset_
16896         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
16897         (Symbol::got_offset): Likewise.
16898         (Symbol::set_got_offset): Likewise.
16899         (Symbol::has_tls_got_offset): Removed.
16900         (Symbol::tls_got_offset): Removed.
16901         (Symbol::set_tls_got_offset): Removed.
16902         (Symbol::got_offset_): Removed.
16903         (Symbol::tls_mod_got_offset_): Removed.
16904         (Symbol::tls_pair_got_offset_): Removed.
16905         (Symbol::got_offsets_): New field.
16906         (Symbol::has_got_offset): Removed.
16907         (Symbol::has_tls_mod_got_offset): Removed.
16908         (Symbol::has_tls_pair_got_offset): Removed.
16909         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
16910         (Target_x86_64::Scan::local): Updated callers of Output_data_got
16911         member functions.
16912         (Target_x86_64::Scan::global): Likewise.
16913         (Target_x86_64::Relocate::relocate): Likewise.
16914         (Target_x86_64::Relocate::relocate_tls): Likewise.
16915
16916 2008-03-25  Ben Elliston  <bje@au.ibm.com>
16917
16918         * yyscript.y: Fix spelling error in comment.
16919
16920 2008-03-24  Ian Lance Taylor  <iant@google.com>
16921
16922         * options.h (class General_options): Define build_id option.
16923         * layout.h (class Layout): Declare write_build_id, create_note,
16924         create_build_id.  Add build_id_note_ member.
16925         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
16926         "libiberty.h", "md5.h", "sha1.h".
16927         (Layout::Layout): Initialize eh_frame_data_,
16928         eh_frame_hdr_section_, and build_id_note_.
16929         (Layout::finalize): Call create_build_id.
16930         (Layout::create_note): New function, broken out of
16931         Layout::create_gold_note.
16932         (Layout::create_gold_note): Call create_note.
16933         (Layout::create_build_id): New function.
16934         (Layout::write_build_id): New function.
16935         (Close_task_runner::run): Call write_build_id.
16936
16937         * x86_64.cc: Correct license to GPLv3.
16938
16939 2008-03-23  Ian Lance Taylor  <iant@google.com>
16940
16941         * options.cc: Include "demangle.h".
16942         (parse_optional_string): New function.
16943         (parse_long_option): Handle takes_optional_argument.
16944         (parse_short_option): Update dash_z initializer.  Handle
16945         takes_optional_argument.
16946         (General_options::General_options): Initialize do_demangle_.
16947         (General_options::finalize): Set do_demangle_.  Handle demangling
16948         style.
16949         * options.h (parse_optional_string): Declare.
16950         (struct One_option): Add optional_arg field.  Update constructor.
16951         Update call constructor calls.  Add takes_optional_argument
16952         function.
16953         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
16954         (DEFINE_optional_string): Define.
16955         (General_options::demangle): Change from DEFINE_bool to
16956         DEFINE_optional_string.
16957         (General_options::no_demangle): New function.
16958         (General_options::do_demangle): New function.
16959         (General_options::set_do_demangle): New function.
16960         (General_options::execstack_status_): Move definition to end of
16961         class definition.
16962         (General_options::static_): Likewise.
16963         (General_options::do_demangle_): New field.
16964         * object.cc (big_endian>::get_symbol_location_info): Call
16965         Options::do_demangle, not Options::demangle.
16966         * symtab.cc (demangle): Likewise.
16967
16968 2008-03-22  Ian Lance Taylor  <iant@google.com>
16969
16970         * gold.h: Include <cstddef> and <sys/types.h>
16971         * options.h: Include <cstring>.
16972
16973 2008-03-21  Ian Lance Taylor  <iant@google.com>
16974
16975         * Added source code to GNU binutils.
16976 \f
16977 Copyright (C) 2008-2015 Free Software Foundation, Inc.
16978
16979 Copying and distribution of this file, with or without modification,
16980 are permitted in any medium without royalty provided the copyright
16981 notice and this notice are preserved.
16982
16983 Local Variables:
16984 mode: change-log
16985 left-margin: 8
16986 fill-column: 74
16987 version-control: never
16988 End: