e736d3310431e40edc0e08ce6caf8c94dc1ad1da
[external/binutils.git] / gold / ChangeLog
1 2015-04-20  Ian Coolidge  <icoolidge@google.com>
2
3         * symtab.cc (Symbol::should_add_dynsym_entry): Return true for
4         GNU_UNIQUE.
5
6 2015-04-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
7
8         * gc.cc (Garbage_collection::do_transitive_closure): Use back and
9         push_back.
10         * gc.h (Garbage_collection): Use a std::vector instead of a std::queue.
11         * object.cc (Sized_relobj_file::do_layout): Use push_back.
12         * powerpc.cc (process_gc_mark): Use push_back.
13         (Target_powerpc::do_gc_mark_symbol): Use push_back.
14         * symtab.cc (Symbol_table::gc_mark_symbol): Use push_back.
15
16 2015-04/16  Han Shen  <shenhan@google.com>
17
18     * aarch64.cc (AArch64_insn_utilities): New utility class.
19     (AArch64_relobj::Mapping_symbol_position): New struct.
20     (AArch64_relobj::Mapping_symbol_info): New typedef.
21     (AArch64_relobj::do_count_local_symbols): New function overriding
22     parent's implementation.
23     (AArch64_relobj::mapping_symbol_info_): New member
24     (AArch64_relobj::scan_erratum_843419): New method.
25     (Target_aarch64::scan_erratum_843419_span): New method.
26     (Target_aarch64::is_erratum_843419_sequence): New method.
27     * options.h (fix_cortex_a53): New option.
28
29 2015-04-09  Cary Coutant  <ccoutant@google.com>
30
31         * symtab.cc (Symbol::final_value_is_known): Check for TLS symbol
32         in a PIE link.
33         * testsuite/Makefile.am (tls_pie_test.sh): New test.
34         * testsuite/Makefile.in: Regenerate.
35         * testsuite/tls_pie_test.sh: New.
36
37 2015-04-09  Cary Coutant  <ccoutant@google.com>
38
39         * debug.h (DEBUG_LOCATION): New.
40         (DEBUG_ALL): Include DEBUG_LOCATION.
41         (debug_string_to_enum): Add DEBUG_LOCATION.
42         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug
43         output to print correct context.
44         (Sized_dwarf_line_info::do_addr2line): Add debug output. Return
45         up to 4 more locations at the beginning of the function.
46         * symtab.cc (Symbol_table::detect_odr_violations): Get canonical
47         result before sorting list of line numbers.
48         * testsuite/debug_msg.sh: Allow range of line numbers for
49         canonical results on optimized code.
50
51 2015-04-07  HC Yen <hc.yen@mediatek.com>
52
53         Add AArch32 support for gold linker.
54         gold/
55         * arm.cc: Add V8 arch combine table.
56
57 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
58
59         * aarch64.cc (do_reloc_addend): Fix signature to match the parent one.
60
61 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
62
63         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a call
64         to find by using the return value of insert.
65
66 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
67
68         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a copy
69         constructor call.
70
71 2015-04-06  Ilya Tocar  <ilya.tocar@intel.com>
72
73         PR gold/17641
74         * x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
75         (Target_x86_64::Scan::local): Don't create GOT entry, when we
76         can convert mov to lea.
77         (Target_x86_64::Scan::global): Ditto.
78         (Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
79         %reg to lea foo(%rip), %reg if possible.
80         * testsuite/Makefile.am (x86_64_mov_to_lea): New test.
81         * testsuite/x86_64_mov_to_lea1.s: New.
82         * testsuite/x86_64_mov_to_lea2.s: Ditto.
83         * testsuite/x86_64_mov_to_lea3.s: Ditto.
84         * testsuite/x86_64_mov_to_lea4.s: Ditto.
85         * testsuite/x86_64_mov_to_lea.sh: Ditto.
86
87 2015-04-02  H.J. Lu  <hongjiu.lu@intel.com>
88
89         * configure: Regenerated.
90
91 2015-04-01  Ilya Tocar  <ilya.tocar@intel.com>
92
93         PR gold/17640
94         * i386.cc (Target_i386::can_convert_mov_to_lea): New.
95         (Target_i386::Scan::local): Don't create GOT entry, when we
96         can convert GOT to GOTOFF.
97         (Target_i386::Scan::global): Ditto.
98         (Target_i386::Relocate::relocate): Convert  mov foo@GOT(%reg), %reg to
99         lea foo@GOTOFF(%reg), %reg if possible.
100         * testsuite/Makefile.am (i386_mov_to_lea): New test.
101         * testsuite/i386_mov_to_lea1.s: New.
102         * testsuite/i386_mov_to_lea2.s: Ditto.
103         * testsuite/i386_mov_to_lea3.s: Ditto.
104         * testsuite/i386_mov_to_lea4.s: Ditto.
105         * testsuite/i386_mov_to_lea5.s: Ditto.
106         * testsuite/i386_mov_to_lea.sh: Ditto.
107
108 2015-04-01  H.J. Lu  <hongjiu.lu@intel.com>
109
110         * Makefile.am (ZLIB): New.
111         (ZLIBINC): Likewise.
112         (AM_CFLAGS): Add $(ZLIBINC).
113         (AM_CXXFLAGS): Likewise.
114         (ldadd_varldadd_var): Add $(ZLIB).
115         (incremental_dump_LDADD): Likewise.
116         (dwp_LDADD): Likewise.
117         * compressed_output.cc: Don't check HAVE_ZLIB_H to include
118         <zlib.h>.
119         (zlib_compress): Don't check HAVE_ZLIB_H.
120         (zlib_decompress): Likewise.
121         * options.h (compress_debug_sections): Likewise.
122         * configure.ac (AM_CONDITIONAL): Removed.
123         * testsuite/Makefile.am (ZLIB): New.
124         (LDADD): Add $(ZLIB).
125         Don't check HAVE_ZLIB.
126         * Makefile.in: Regenerated.
127         * config.in: Likewise.
128         * configure: Likewise.
129         * testsuite/Makefile.in: Likewise.
130
131 2015-03-30  Jing Yu  <jingyu@google.com>
132
133         * aarch64-reloc.def: New TLSLD_ADD_DTPREL_HI12,
134         TLSLD_ADD_DTPREL_LO12_NC.
135         * aarch64.cc (Target_aarch64::define_tls_base_symbol): Always let
136         _TLS_MODULE_BASE_ point to the start of tls segment.
137         (Target_aarch64::optimize_tls_reloc): Add cases for
138         R_AARCH64_TLSLD_ADD_DTPREL_HI12 and
139         R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
140         (Target_aarch64::Scan::local): Likewise.
141         (Target_aarch64::Scan::global): Likewise.
142         (Target_aarch64::Relocate::relocate): Likewise.
143         (Target_aarch64::Relocate::relocate_tls): Likewise. And remove
144         subtracting tls segment size from symbol value for TLSLD_*_DTPREL
145         relocations.
146
147 2015-03-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
148
149         * merge.cc (Object_merge_map::add_mapping): call
150         Object_merge_map::Input_merge_map::add_mapping.
151         (Object_merge_map::Input_merge_map::add_mapping): New.
152         (Output_merge_data::do_add_input_section): Call
153         get_or_make_input_merge_map before a loop.
154         (Output_merge_string<Char_type>::finalize_merged_data): Call
155         get_or_make_input_merge_map before a loop.
156         * merge.h (Object_merge_map): Make Input_merge_map public.
157         * object.cc (Relobj::add_merge_mapping): Use get_or_create_merge_map.
158         (Relobj::get_or_create_merge_map): New.
159         * object.h (Relobj::get_or_create_merge_map): New.
160
161 2015-03-24  Alan Modra  <amodra@gmail.com>
162
163         PR 18147
164         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
165         relocation errors for branches to strong undefined symbols.
166
167 2015-03-23  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
168
169         * merge.cc (Object_merge_map::get_input_merge_map): Make it const.
170         (Object_merge_map::is_merge_section_for): Remove.
171         (Object_merge_map::find_merge_section): New.
172         * merge.h (Object_merge_map::is_merge_section_for): Remove.
173         (Object_merge_map::find_merge_section): New.
174         (Object_merge_map::get_input_merge_map): Add a const version.
175         * object.cc (Relobj::is_merge_section_for): Remove.
176         (Relobj::find_merge_section): New.
177         * object.h (Relobj::is_merge_section_for): Remove.
178         (Relobj::find_merge_section): New.
179         * output.cc
180         (Output_section::Input_section::is_merge_section_for): Remove.
181         (Output_section::add_merge_input_section): Don't call
182         add_merge_input_section.
183         (Output_section::find_merge_section): Return const. Use
184         object->find_merge_section.
185         (Output_section::build_lookup_maps): Don't build a map for
186         merge sections.
187         (Output_section::is_input_address_mapped): Return false if
188         section is not found.
189         (Output_section::find_starting_output_address): Use
190         find_merge_section instead of is_merge_section_for.
191         (Output_section::add_script_input_section):  Don't build a map for
192         merge sections.
193         * output.h (Output_section_lookup_maps::merge_sections_by_id_): Remove.
194         (Output_section_lookup_maps::find_merge_section): Remove.
195         (Output_section_lookup_maps::add_merge_input_section) Remove.
196         (Output_section::find_merge_section): Return const.
197
198 2015-03-22  Cary Coutant  <cary@google.com>
199
200         PR gold/18106
201         * i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
202         non-SIB form of lea, with nop after the call.
203
204 2015-03-21  Cary Coutant  <cary@google.com>
205
206         PR gold/14217
207         * output.cc (Output_segment::is_first_section_relro): Don't ignore
208         .tdata section.
209         (Output_segment::set_section_addresses): Don't align size of relro
210         segment for .tbss.
211
212 2015-03-21  Cary Coutant  <cary@google.com>
213
214         PR gold/18010
215         * stringpool.cc (Stringpool_template): Don't optimize if section
216         alignment is greater than sizeof(char).
217
218 2015-03-21  Cary Coutant  <cary@google.com>
219
220         PR gold/18048
221         * script-c.h (script_include_directive): Add first_token parameter.
222         * script.cc (script_include_directive): Add first_token parameter, and
223         pass it to read_script_file.
224         * yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
225         (PARSING_MEMORY_DEF): New tokens.
226         (top): Add new productions for INCLUDE files.
227         (file_cmd): Replace file_or_sections_cmd with copy of its productions.
228         Pass PARSING_LINKER_SCRIPT to script_include_directive.
229         (section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
230         (section_cmd): Pass PARSING_SECTION_CMDS.
231         (file_or_sections_cmd): Remove.
232         (memory_def): Pass PARSING_MEMORY_DEF.
233         * testsuite/Makefile.am (memory_test_2): New test.
234         * testsuite/Makefile.in: Regenerate.
235         * testsuite/memory_test_inc.t: New script file.
236         * testsuite/memory_test_inc_1.t.src: New script file.
237         * testsuite/memory_test_inc_2.t.src: New script file.
238         * testsuite/memory_test_inc_3.t.src: New script file.
239
240 2015-03-21  Cary Coutant  <cary@google.com>
241
242         * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
243         (Sized_relobj_dwo::setup): Build compressed section map.
244         (Sized_relobj_dwo::do_decompressed_section_contents): Delete.
245         * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
246         section map.
247         * object.cc (Sized_relobj_file::Sized_relobj_file): Remove
248         compressed_sections_ field.
249         (build_compressed_section_map): Take Object instead of
250         Sized_relobj_file parameter; add decompress_if_needed parameter.
251         (Sized_relobj_file::do_find_special_sections): Store compressed
252         section map in parent Object.
253         (Sized_relobj_file::do_decompressed_section_contents): Move
254         implementation to Object::decompressed_section_contents.
255         (Sized_relobj_file::do_discard_decompressed_sections): Move
256         implementation to Object::discard_decompressed_sections.
257         * object.h (build_compressed_section_map): Declare.
258         (Object::Object): Add compressed_sections_ field.
259         (Object::section_is_compressed): Move implementation here.
260         (Object::decompressed_section_contents): De-virtualize.
261         (Object::discard_decompressed_sections): De-virtualize.
262         (Object::do_section_is_compressed): Delete.
263         (Object::do_decompressed_section_contents): Delete.
264         (Object::set_compressed_sections): New method.
265         (Object::compressed_sections): New method.
266         (Object::compressed_sections_): New data member.
267         (Compressed_section_info, Compressed_section_map): Move to top of file.
268         (Sized_relobj_file::do_section_is_compressed): Delete.
269         (Sized_relobj_file::do_decompressed_section_contents): Delete.
270         (Sized_relobj_file::do_discard_decompressed_sections): Delete.
271         (Sized_relobj_file::compressed_sections_): Move to Object class.
272
273 2015-03-21  Cary Coutant  <ccoutant@google.com>
274
275         PR gold/18152
276         * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
277         deferred objects.
278
279 2015-03-11  Cary Coutant  <ccoutant@google.com>
280
281         * options.cc (General_options::finalize): Don't allow -z relro
282         with incremental linking.
283         * testsuite/Makefile.am (incremental_test): Add -z norelro.
284         (incremental_test_2): Likewise.
285         (incremental_test_3): Likewise.
286         (incremental_test_4): Likewise.
287         (incremental_test_5): Likewise.
288         (incremental_test_6): Likewise.
289         (incremental_copy_test): Likewise.
290         (incremental_common_test_1): Likewise.
291         (incremental_comdat_test_1): Likewise.
292         * testsuite/Makefile.in: Regenerate.
293
294 2015-03-09  Cary Coutant  <ccoutant@google.com>
295
296         PR gold/14675
297         * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
298         return enum indicating whether .eh_frame section is empty, optimizable,
299         unrecognized, or an end marker. Adjust explicit instantiations.
300         * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
301         (Eh_frame::add_ehframe_input_section): Change return type.
302         * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
303         * layout.cc (Layout::layout_eh_frame): Don't add optimized sections
304         to the .eh_frame output section until we see the end marker.
305         (Layout::finalize_eh_frame_section): New.
306         * layout.h: (Layout::finalize_eh_frame_section): New.
307
308 2015-03-05  H.J. Lu  <hongjiu.lu@intel.com>
309
310         * output.cc (Relobj::initialize_input_to_output_map<size>):
311         Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
312
313 2015-03-04  Cary Coutant  <ccoutant@google.com>
314
315         * parameters.cc (Parameters::set_target_once): Call
316         Target::select_as_default_target just once from here...
317         (set_parameters_target): ...instead of from here.
318
319 2015-03-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
320
321         * ehframe.cc (Cie::set_output_offset): Pass in and use a
322         Output_section_data instead of a Merge_map.
323         (Eh_frame::Eh_frame): Don't initialize merge_map_.
324         (Eh_frame::read_cie): Use add_merge_mapping instead of
325         Merge_map::add_mapping.
326         (Eh_frame::read_fde): Ditto.
327         (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
328         (Eh_frame::do_output_offset): Use merge_output_offset istead of
329         merge_map_->get_output_offset.
330         (Eh_frame::do_is_merge_section_for): Delete.
331         * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
332         instead of a Merge_map.
333         (Cie::set_output_offset): Pass in a Output_section_data instead of a
334         Merge_map.
335         (Eh_frame::do_is_merge_section_for): Delete.
336         (Eh_frame::merge_map_): Delete.
337         * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
338         and use a Output_section_data instead of a Merge_map.
339         (Object_merge_map::add_mapping): Ditto.
340         (Object_merge_map::get_output_offset): Remove the merge_map argument.
341         (Object_merge_map::is_merge_section_for): Pass in and use a
342         Output_section_data instead of a Merge_map.
343         (Merge_map): Delete.
344         (Output_merge_base::do_output_offset): Use merge_output_offset instead
345         of merge_map_.get_output_offset.
346         (Output_merge_base::do_is_merge_section_for): Delete.
347         (Output_merge_data::do_add_input_section): Use
348         object->add_merge_mapping instead of add_mapping.
349         (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
350         * merge.h (Merge_map): Delete forward declaration.
351         (Object_merge_map::add_mapping): Pass in and use a Output_section_data
352         instead of a Merge_map.
353         (Object_merge_map::get_output_offset): Remove the merge_map argument.
354         (Object_merge_map::is_merge_section_for): Pass in and use a
355         Output_section_data instead of a Merge_map.
356         (Input_merge_map::Object_merge_map::merge_map): Replace with
357         output_data.
358         (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
359         Output_section_data instead of a Merge_map.
360         (Merge_map): Delete.
361         (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
362         (Output_merge_base::do_is_merge_section_for): Delete.
363         (Output_merge_base::add_mapping): Delete.
364         (Output_merge_base::merge_map_): Delete.
365         * object.cc (Relobj::initialize_input_to_output_map): New.
366         (Relobj::initialize_input_to_output_map): New.
367         (Relobj::merge_output_offset): New.
368         (Relobj::is_merge_section_for): New.
369         (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
370         bits.
371         * object.h (Relobj::merge_map): Delete.
372         (initialize_input_to_output_map): New.
373         (set_merge_map): Delete.
374         (add_merge_mapping): New.
375         (merge_output_offset): New.
376         (is_merge_section_for): New.
377         * output.cc (Output_section::Input_section::is_merge_section_for):
378         Use object->is_merge_section_for.
379         * output.h (Output_section_data::is_merge_section_for): Delete.
380         (Output_section_data::do_is_merge_section_for): Delete.
381         * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
382         Use object->initialize_input_to_output_map.
383         (Merged_symbol_value<size>::value_from_output_section): Use
384         object->merge_output_offset.
385
386 2015-03-02  Peter Collingbourne  <pcc@google.com>
387             Cary Coutant  <ccoutant@google.com>
388
389         * output.cc (Output_section::add_merge_input_section): Do not
390         attempt to merge sections with an entsize of 0.
391
392 2015-03-02  Khem Raj  <raj.khem@gmail.com>
393
394         * attributes.h (class Output_attributes_section_data ): Add
395         do_print_to_mapfile function.
396
397 2015-02-24  Alan Modra  <amodra@gmail.com>
398
399         PR 18010
400         * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
401         complain if value is not a multiple of four.
402         (Target_powerpc::Relocate::relocate): Correct handling of
403         R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
404
405 2015-02-21  H.J. Lu  <hongjiu.lu@intel.com>
406
407         * configure.ac (default_size): Set to 32 for x32.
408         * configure: Regenerated.
409
410 2015-02-18  Alan Modra  <amodra@gmail.com>
411
412         PR 17954
413         * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
414         visibility.
415
416 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
417
418         * gc.h (Garbage_collection::add_reference): Don't use find.
419
420 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
421
422         * object.cc (write_local_symbols): avoid std::vector copy.
423
424 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
425
426         * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
427
428 2015-02-09  Mark Wielaard  <mjw@redhat.com>
429
430         * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
431         DW_LANG_Fortran03 and DW_LANG_Fortran08.
432
433 2015-02-16  Cary Coutant  <ccoutant@google.com>
434
435         PR gold/13577
436         PR gold/16992
437         * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
438         DF_SYMBOLIC if --dynamic-list option is used.
439         * options.cc (General_options::finalize): --dynamic-list is not
440         mutually exclusive with -Bsymbolic.
441         * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
442         listed in --dynamic-list.
443         * testsuite/Makefile.am (dynamic_list_lib2.so): Add
444         -Bsymbolic-functions.
445         * testsuite/Makefile.in: Regenerate.
446
447 2015-02-16  Cary Coutant  <ccoutant@google.com>
448
449         PR gold/17971
450         * incremental.cc: Remove redundant include of "output.h".
451
452 2015-02-12  Jing Yu  <jingyu@google.com>
453
454         * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
455         TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
456         New relocation.
457         * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
458         TLSLE_MOVW_* relocations.
459         (Target_aarch64::Scan::global): Likewise.
460         (Target_aarch64::Relocate::relocate): Likewise.
461         (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
462         for new TLSLE_MOVW_* relocations.
463
464 2015-02-11  Will Newton  <will.newton@linaro.org>
465
466         PR gold/13321
467         * arm.cc (Target_arm::make_plt_section): Create an ARM
468         state mapping symbol at the start of the PLT.
469
470 2015-02-09  H.J. Lu  <hongjiu.lu@intel.com>
471
472         * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
473         Replace two_file_shared_2.so with two_file_shared_1.so.
474         * testsuite/Makefile.in: Regenerated.
475
476 2015-02-09  Alan Modra  <amodra@gmail.com>
477
478         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
479         plugin_test_thin.a and defsym_test.
480         * testsuite/Makefile.in: Regenerate.
481
482 2015-02-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
483
484         * merge.cc (do_add_input_section): Combine loop epilogue into main loop
485         body.
486
487 2015-02-04  Peter Collingbourne  <pcc@google.com>
488
489         * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
490         forwarding symbols when computing symbol resolution info for plugins.
491         * plugin.h (Plugin_manager::symtab): New method.
492         (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
493
494 2015-02-03  Cary Coutant  <ccoutant@google.com>
495             Peter Collingbourne  <pcc@google.com>
496
497         PR gold/15660
498         * archive.cc (Thin_archive_object_unlocker): New class.
499         (Archive::include_member): Unlock external members of thin archives.
500         * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
501         (plugin_test_2): Likewise.
502         (plugin_test_3): Likewise.
503         (plugin_test_4): Likewise.
504         (plugin_test_5): Likewise.
505         (plugin_test_6): Likewise.
506         (plugin_test_7): Likewise.
507         (plugin_test_8): Likewise.
508         (plugin_test_9): Likewise.
509         (plugin_test_10): Likewise.
510         (plugin_test_11): New test case.
511         * testsuite/Makefile.in: Regenerate.
512         * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
513         file to decide whether to claim file.
514         (all_symbols_read_hook): Likewise.
515         * testsuite/plugin_test_1.sh: Adjust expected output.
516         * testsuite/plugin_test_2.sh: Likewise.
517         * testsuite/plugin_test_3.sh: Likewise.
518         * testsuite/plugin_test_6.sh: Likewise.
519         * testsuite/plugin_test_tls.sh: Likewise.
520         * testsuite/plugin_test_11.sh: New testcase.
521
522 2015-02-03  Cary Coutant  <ccoutant@google.com>
523
524         * descriptors.cc (Descriptors::open): Set artificially-low limit for
525         file descriptors when debugging enabled. Add debug output.
526         (Descriptors::release): Add debug output.
527         (Descriptors::close_some_descriptor): Likewise.
528         (Descriptors::close_all): Likewise.
529         * fileread.cc (File_read::lock): Likewise.
530         (File_read::unlock): Likewise.
531
532 2015-02-02  Cary Coutant  <ccoutant@google.com>
533
534         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
535         executable output file.
536
537 2015-01-22  Han Shen  <shenhan@google.com>
538
539         * arm.cc (Target_arm::Target_arm): Add initialization for new members.
540         (Target_arm::do_plt_address_for_global): New method.
541         (Target_arm::do_plt_address_for_local): New method.
542         (Target_arm::rel_irelative_section): New method.
543         (Target_arm::make_data_plt): Add more parameters for plt ctor.
544         (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
545         (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
546         (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
547         (Target_arm::Scan::check_non_pic): Add ifunc support.
548         (Target_arm::Scan::local): Add ifunc support.
549         (Target_arm::Scan::global): Add ifunc support.
550         (Target_arm::make_plt_section): New method.
551         (Target_arm::make_plt_entry): Change to call to make_plt_section.
552         (Target_arm::make_local_ifunc_plt_entry): New method.
553         (Target_arm::got_irelative_): New member.
554         (Target_arm::rel_irelative_): New member.
555         (Target_arm::got_section): Add creation for got_irelative_.
556         (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
557         (Target_arm::Relocate::relocate): Properly set local ifunc address.
558         (Target_arm::do_dynsym_value): Properly set global ifunc address.
559         (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
560         (Output_data_plt_arm::IRelative_data): New type.
561         (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
562         (Output_data_plt_arm::add_entry): Add more parameters.
563         (Output_data_plt_arm::add_relocation): New method.
564         (Output_data_plt_arm::add_local_ifunc_entry): New method.
565         (Output_data_plt_arm::rel_irelative): New method.
566         (Output_data_plt_arm::entry_count): Modified.
567         (Output_data_plt_arm::address_for_global): New method.
568         (Output_data_plt_arm::address_for_local): New method.
569 gold/
570         (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
571         (Output_data_plt_arm::insert_irelative_data): New method.
572         (Output_data_plt_arm::irelative_rel_): New member.
573         (Output_data_plt_arm::got_): New member.
574         (Output_data_plt_arm::got_irelative_): New member.
575         (Output_data_plt_arm::irelative_count_): New member.
576         (Output_data_plt_arm::IRelative_data_vec): New typedef.
577         (Output_data_plt_arm::irelative_data_vec_): New member.
578         (Output_data_plt_arm::do_write): Write out irelative entries.
579         (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
580         more parameters to ctor.
581         (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
582         more parameters to ctor.
583         * output.h (Output_data_reloc::add_local_relative): New method.
584         * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
585
586 2015-01-29  Alan Modra  <amodra@gmail.com>
587
588         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
589         and GOT_TLSGD to LE optimization.
590
591 2015-01-28  Cary Coutant  <ccoutant@google.com>
592
593         * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
594         for undef TLS symbols.
595         (Target_x86_64::Relocate::relocate_tls): Likewise.
596         (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
597
598 2015-01-25  Cary Coutant  <ccoutant@google.com>
599
600         * output.cc (Output_segment::set_section_addresses): Fix calculation
601         of size of relro segment.
602
603 2015-01-22  Alan Modra  <amodra@gmail.com>
604
605         * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
606         condition for need of ifunc plt entry.
607         (Target_powerpc::Scan::global <got relocs>): Likewise.
608
609 2015-01-14  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
610
611         * mips.cc (reloc_high): Add r_sym.
612         (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
613         reloc_high constructor.
614         (Mips_relocate_functions::relgot16_local): Likewise.
615         (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
616         r_type to decide whether LO16 matches HI16.
617         (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
618         rello16 and relgot16_local.
619
620 2015-01-09  Cary Coutant  <ccoutant@google.com>
621
622         * layout.cc (Layout::set_segment_offsets): Don't align start of segment
623         unless alignment is larger than page size.
624
625 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
626             Cary Coutant  <ccoutant@google.com>
627
628         PR gold/17729
629         * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
630         (DEFAULT_TARGET_X32): Set for x32.
631         * x86_64.cc (cmp_insn_32): New.
632         (lea_r10_insn_32): Likewise.
633         (lea_r11_insn_32): Likewise.
634         (cmp_insn_64): Likewise.
635         (lea_r10_insn_64): Likewise.
636         (lea_r11_insn_64): Likewise.
637         (Target_x86_64<size>::do_calls_non_split): Handle x32.
638         * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
639         (check_DATA): Add split_x32 files.
640         (split_x32_[1234n].o): New targets.
641         (split_x32_[124]): New targets.
642         (split_x32_[1234r].stdout): New targets.
643         * testsuite/split_x32.sh: New file.
644         * testsuite/split_x32_1.s: Likewise.
645         * testsuite/split_x32_2.s: Likewise.
646         * testsuite/split_x32_3.s: Likewise.
647         * testsuite/split_x32_4.s: Likewise.
648         * testsuite/split_x32_n.s: Likewise.
649         * configure: Regenerated.
650         * testsuite/Makefile.in: Likewise.
651
652 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
653
654         PR gold/17809
655         * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
656         x32.
657
658 2015-01-02  Alan Modra  <amodra@gmail.com>
659
660         * version.cc (print_version): Just print current year.
661         * dwp.cc (print_version): Likewise.
662
663 2015-01-01  Alan Modra  <amodra@gmail.com>
664
665         Update year range in copyright notice of all files.
666
667 2014-12-25  Alan Modra  <amodra@gmail.com>
668
669         * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
670         new enums.
671         (Target_arm::merge_object_attributes, ): Likewise.
672
673 2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
674
675         * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
676         as hard float only when Tag_ABI_VFP_args is 1, using new enum value
677         AEABI_VFP_args_vfp to check that.
678         (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
679         value and replace hardcoded values by enum values.
680
681 2014-12-22  Cary Coutant  <ccoutant@google.com>
682
683         * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
684
685 2014-12-20  H.J. Lu  <hongjiu.lu@intel.com>
686
687         PR gold/14608
688         * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
689         to "return i * i * 3;".
690
691 2014-12-16  Cary Coutant  <ccoutant@google.com>
692
693         * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
694         (Mapfile::print_output_data): Use current_data_size() to avoid
695         assert for sections requiring postprocessing; if address is not valid,
696         print 0.
697         (Mapfile::print_output_section): Use current_data_size(); print note
698         that addresses and sizes are before compression.
699
700 2014-12-14  H.J. Lu  <hongjiu.lu@intel.com>
701
702         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
703         Cast current_group_size to unsigned long when reporting error.
704
705 2014-12-10  Jing Yu  <jingyu@google.com>
706
707         * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
708         (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
709         Update error message.
710         (Target_aarch64::do_relax): Use absolute value of option
711         stub_group_size. Replace local variable with class member
712         stub_group_size_.
713
714 2014-12-04  Alan Modra  <amodra@gmail.com>
715
716         * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
717         addend of PLTREL24 reloc when not generating a plt stub.  Make
718         max_branch_offset an "Address".
719         (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
720         (Target_powerpc::Relocate::relocate): Likewise.
721
722 2014-12-04  Alan Modra  <amodra@gmail.com>
723
724         PR 17670
725         * symtab.cc (Symbol::set_undefined): Remove assertion.
726         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
727         on symbols defined in discarded sections, instead return false.
728         Rearrange params, update all callers.
729         (Target_powerpc::Branch_info::make_stub): Don't make stubs for
730         branches to syms in discarded sections.
731         (Global_symbol_visitor_opd::operator()): Set discarded opd syms
732         undefined and flag as discarded.
733         (Target_powerpc::Relocate::relocate): Localize variable.
734
735 2014-12-03  H.J. Lu  <hongjiu.lu@intel.com>
736
737         PR gold/17675
738         * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
739         * testsuite/Makefile.in: Regenerated.
740
741 2014-12-03  Alan Modra  <amodra@gmail.com>
742
743         PR 17566
744         * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
745         when adding dynamic relocations against section symbols.
746
747 2014-12-01  Dimitry Ivanov <dimitry@google.com>
748
749         * layout.cc (Layout::finish_dynamic_section): When '-z global'
750         is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
751         * options.h (General_options): New -z option (global).
752
753 2014-12-01  Cary Coutant  <ccoutant@google.com>
754
755         PR gold/17578
756         * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
757         is given.
758         (Layout::create_executable_stack_info): Warn when -z noexecstack is
759         given but some inputs require executable stack.
760
761 2014-11-26  Cary Coutant  <ccoutant@google.com>
762
763         * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
764         .debug_str_offsets; strip .debug_gnu_pubnames and
765         .debug_gnu_pubtypes.
766         (lines_only_debug_sections): Strip all four new sections.
767
768 2014-11-26  Jing Yu  <jingyu@google.com>
769
770         * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
771         register to be x0 when to relax TLSDESC_LD64_LO12.
772
773 2014-11-26  Alan Modra  <amodra@gmail.com>
774
775         * powerpc.cc (struct Stub_table_owner): New.
776         (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
777         unsigned int vector.  Update all references.
778         (powerpc_relobj::set_stub_table): Take an unsigned int param
779         rather than a Stub_table.  Update callers.
780         (Powerpc_relobj::clear_stub_table): New function.
781         (Target_powerpc): Add relax_failed_, relax_fail_count_ and
782         stub_group_size_ vars.
783         (Target_powerpc::new_stub_table): Delete.
784         (max_branch_delta): New function, extracted from..
785         (Target_powerpc::Relocate::relocate): ..here..
786         (Target_powerpc::Branch_info::make_stub): ..and here.  Return
787         status on whether stub created successfully.
788         (Stub_control::Stub_control): Add "no_size_errors" param.  Move
789         default sizing to..
790         (Target_powerpc::do_relax): ..here.  Init stub_group_size_ and
791         reduce on relax failure.
792         (Target_powerpc::group_sections): Add "no_size_errors" param.
793         Use stub_group_size_.  Set up group info in a temp vector,
794         before building Stub_table vector.  Account for input sections
795         possibly already converted to relaxed sections.
796         (Stub_table::init): Delete.  Merge into..
797         (Stub_table::Stub_table): ..here.
798         (Stub_table::can_reach_stub): New function.
799         (Stub_table::add_plt_call_entry): Add "from" parameter and
800         return true iff stub could be reached.
801         (Stub_table::add_long_branch_entry): Similarly.  Add "r_type"
802         param too.
803         (Stub_table::clear_stubs): Add "all" param.
804
805 2014-11-26  Alan Modra  <amodra@gmail.com>
806
807         * powerpc.cc (Stub_control::set_output_and_owner): New function.
808         (Target_powerpc::group_sections): Use it.
809
810 2014-11-25  Cary Coutant  <ccoutant@google.com>
811
812         * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
813         (Binary_to_elf::write_symbol): Add st_size parameter.
814         * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
815
816 2014-11-25  Cary Coutant  <ccoutant@google.com>
817
818         PR gold/17639
819         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
820         (Sized_relobj_file::do_layout): Handle deferred sections properly
821         during GC pass 1. Don't add reloc sections to deferred list twice.
822         * object.h (Sized_relobj_file::is_deferred_layout): New function.
823         (Sized_relobj_file::is_deferred_layout_): New data member.
824
825 2014-11-21  H.J. Lu  <hongjiu.lu@intel.com>
826
827         PR gold/17619
828         * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
829         Check PC-relative offset overflow in PLT entry.
830
831 2014-11-21  Alan Modra  <amodra@gmail.com>
832
833         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
834         for undefined weaks.
835
836 2014-11-20  Alan Modra  <amodra@gmail.com>
837
838         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
839         from --stub-group-size parameter divided by 1024.
840         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
841         template parameter.  Update all uses.
842         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
843         has_stub_value.  Set for long branches.  Don't report overflow for
844         branch to undefined weak symbols.  Print info message on
845         overflowing branch to stub.
846
847 2014-11-20  Alan Modra  <amodra@gmail.com>
848
849         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
850
851 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
852
853         * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
854         entry for R_X86_64_GOTPLT64.
855         (Target_x86_64<size>::Relocate::relocate): Update comments for
856         R_X86_64_GOTPLT64.
857
858 2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>
859
860         * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
861         * plugin.h: add lock definition
862
863 2014-10-29  Han Shen  <shenhan@google.com>
864             Jing Yu   <jingyu@google.com>
865
866         * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
867         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
868         TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
869         Symbol::TLS_REF.
870         * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
871         method.
872         (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
873         (Target_aarch64::tls_ld_to_le): New method.
874         (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
875         for 64bit targets.
876         (Output_data_plt_aarch64::irelative_rel_): New data member.
877         (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
878         (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
879         (Output_data_plt_aarch64::add_relocation): New method.
880         (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
881         offset. Add got_irelative size to got size.
882         (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
883         type string with the new typename.
884         (AArch64_relocate_functions::update_adr): Replace parameter x with
885         immed.
886         (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
887         (AArch64_relocate_functions::reloc_common): New method.
888         (AArch64_relocate_funcsions::rela_general): Extract common part out
889         into reloc_common method.
890         (AArch64_relocate_functions::rela_general): Likewise.
891         (AArch64_relocate_functions::pcrela_general): Likewise.
892         (AArch64_relocate_functions::adr): New method.
893         (AArch64_relocate_functions::adrp): Calculate immed before calling
894         update_adr.
895         (AArch64_relocate_functions::adrp): Likewise.
896         (AArch64_relocate_functions::movnz): Cast x to SignedW type when
897         comparing x to 0. Calculate immed from ~x when x < 0.
898         (Target_aarch64::optimize_tls_reloc): Add new cases for
899         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
900         TLSLD_MOVW_DTPREL_G0_NC.
901         (Target_aarch64::possible_function_pointer_reloc): Implement this
902         method.
903         (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
904         comment.
905         (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
906         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
907         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
908         (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
909         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
910         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
911         (Target_aarch64::make_plt_entry): Call add_entry with two more
912         parameters.
913         (Target_aarch64::make_local_ifunc_plt_entry): New method.
914         (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
915         ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
916         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
917         (Target_aarch64::Relocate::relocate_tls): Add cases for
918         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
919         TLSLD_MOVW_DTPREL_G0_NC.
920         * testsuite/icf_safe_so_test.cc: Correct test comment.
921         * testsuite/icf_safe_test.sh: Add AArch64 arch.
922
923 2014-10-22  Alan Modra  <amodra@gmail.com>
924
925         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
926         thread_starter.
927
928 2014-10-18  Andreas Schwab  <schwab@linux-m68k.org>
929
930         * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
931
932 2014-10-17  Cary Coutant  <ccoutant@google.com>
933
934         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
935         Add "typename" keyword.
936
937 2014-10-15  Han Shen  <shenhan@google.com>
938             Jing Yu   <jingyu@google.com>
939
940         Patch for gold aarch64 backend to support relaxation.
941         * aarch64-reloc.def: Change format.
942         * aarch64.cc (class Reloc_stub): New class.
943         (class Stub_table): New class.
944         (class AArch64_relobj): New class.
945         (class AArch64_input_section): New class.
946         (class AArch64_output_section): New class.
947         (Target_aarch64::new_stub_table): New method.
948         (Target_aarch64::new_aarch64_input_section): New method.
949         (Target_aarch64::find_aarch64_input_section): New method.
950         (Target_aarch64::scan_section_for_stubs): New method.
951         (Target_aarch64::scan_reloc_section_for_stubs): New method.
952         (Target_aarch64::relocate_stub): New method.
953         (Target_aarch64::current_target): New method.
954         (Target_aarch64::do_make_elf_object): New method.
955         (Target_aarch64::do_may_relax): New method.
956         (Target_aarch64::do_relax): New method.
957         (Target_aarch64::group_sections): New method.
958         (Target_aarch64::scan_reloc_for_stub): New method.
959         (Target_aarch64::do_make_output_section): New method.
960         (Target_aarch64::stub_tables_): New data member.
961         (Target_aarch64::aarch64_input_section_map_): New data member.
962         (AArch64_relocate_functions::maybe_apply_stub): New method.
963
964 2014-09-30  Cary Coutant  <ccoutant@google.com>
965
966         PR gold/17432
967         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
968
969 2014-09-30  Kito Cheng  <kito@0xlab.org>
970
971         PR gold/13597
972         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
973         hash table before sysv-style hash table.
974
975 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
976
977         * options.h (--pic-executable): Add negative to alias to -no-pie.
978
979 2014-09-26  Cary Coutant  <ccoutant@google.com>
980
981         PR gold/16773
982         * object.cc (Sized_relobj_file): Compute value of section symbols
983         for TLS sections the same as TLS symbols.
984
985 2014-09-25  Cary Coutant  <ccoutant@google.com>
986
987         PR gold/17432
988         * resolve.cc (Symbol_table::resolve): Override common placeholder
989         symbols, but adjust sizes.
990         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
991         symbols to common lists.
992
993 2014-09-24  Alan Modra  <amodra@gmail.com>
994
995         * po/POTFILES.in: Regenerate.
996
997 2014-09-23  Taiju Tsuiki  <tzik@google.com>
998             Cary Coutant  <ccoutant@google.com>
999
1000         PR gold/14860
1001         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
1002         on input_sections_blocker.
1003         * layout.cc (Write_sections_task::locks): Unblock
1004         input_sections_blocker_.
1005         * layout.h (Write_sections_task::Write_sections_task): Add
1006         input_sections_blocker.
1007         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
1008         to DEPENDENCIES.
1009         * testsuite/Makefile.in: Regenerate.
1010
1011 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1012
1013         * testsuite/Makefile.am (plugin_test_10): New test.
1014         * testsuite/Makefile.in: Regenerate
1015         * testsuite/plugin_common_test_2.c (c1): Align to 8.
1016         * testsuite/plugin_test_10.sh: New file.
1017
1018 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1019
1020         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
1021         * resolve.cc (Symbol_table::resolve): Don't override common symbols
1022         during the replacement phase.
1023
1024 2014-09-17  Han Shen  <shenhan@google.com>
1025             Jing Yu  <jingyu@google.com>
1026
1027         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
1028         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
1029         * aarch64.cc (Target_aarch64): Add data members
1030         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
1031         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
1032         constructor.
1033         (Target_aarch64::do_reloc_symbol_index): New method.
1034         (Target_aarch64::do_reloc_addend): New method.
1035         (Target_aarch64::add_tlsdesc_info): New method.
1036         (Target_aarch64::do_dynsym_value): New method.
1037         (Target_aarch64::do_make_data_plt): Add new parameters: got,
1038         got_irelative. Pass them to Output_data_plt_aarch64_standard.
1039         (Target_aarch64::make_data_plt): Add new parameters: got,
1040         got_irelative. Pass them to do_make_data_plt.
1041         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
1042         (Target_aarch64::Relocate:tls_gd_to_le): New method.
1043         (Target_aarch64::Relocate:tls_ie_to_le): New method.
1044         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
1045         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
1046         (Target_aarch64::got_tlsdesc_section): New method.
1047         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1048         (Target_aarch64::define_tls_base_symbol): New method.
1049         (Target_aarch64::reserve_tlsdesc_entries): New method.
1050         (Target_aarch64::got_mod_index_entry): New method.
1051         (Target_aarch64::rela_tlsdesc_section): New method.
1052         (Target_aarch64::rela_irelative_section): New method.
1053         (Target_aarch64::Tlsdesc_info): New struct.
1054         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
1055         relocations and tlsdesc relocations.
1056         (Target_aarch64::optimize_tls_reloc): Implement method.
1057         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
1058         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
1059         in constructor.
1060         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
1061         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
1062         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
1063         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
1064         (Output_data_plt_aarch64::rela_tlsdesc): New method.
1065         (Output_data_plt_aarch64::rela_irelative): New method.
1066         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
1067         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
1068         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
1069         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
1070         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
1071         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
1072         (Output_data_plt_aarch64_standard): New member variables:
1073         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
1074         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
1075         New parameter: got, got_irelative.
1076         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
1077         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
1078         (Output_data_plt_aarch64::do_write): Replace got_address with
1079         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
1080         (AArch64_relocate_functions::update_movnz): New method.
1081         (AArch64_relocate_functions): Correct format.
1082         (AArch64_relocate_functions::movnz): New method.
1083         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
1084         before the switch. Add new cases to switch.
1085         Check ie_to_le relaxation on tlsie relocations. Add code handling
1086         tlsgd tlsdesc cases.
1087         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
1088         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
1089         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
1090         Call reloc_name_in_error_message to print unsupported reloc.
1091         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
1092         make_data_plt.
1093         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
1094         relocs. Fill in some more dynamic tags.
1095         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
1096         Skip call tls_get_addr when tlsgd is relaxed.
1097         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
1098         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
1099         tlsdesc->ie relaxation.
1100
1101 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1102
1103         * mips.cc (Target_mips_nacl): New class.
1104         (Target_selector_mips_nacl): New class.
1105         (target_selector_mips32): Rename from target_selector_mips32be and use
1106         Target_selector_mips_nacl instead of Target_selector_mips.
1107         (target_selector_mips32el): Rename from target_selector_mips32 and use
1108         Target_selector_mips_nacl instead of Target_selector_mips.
1109         (target_selector_mips64): Rename from target_selector_mips64be and use
1110         Target_selector_mips_nacl instead of Target_selector_mips.
1111         (target_selector_mips64el): Rename from target_selector_mips64 and use
1112         Target_selector_mips_nacl instead of Target_selector_mips.
1113         (Target_mips::mips_info): Add const attribute.
1114
1115 2014-09-02  Cary Coutant  <ccoutant@google.com>
1116
1117         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
1118         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
1119         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
1120         (Sized_incr_dynobj::do_section_name): Likewise.
1121         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
1122         (Sized_incr_dynobj::do_section_name): Likewise.
1123         * object.h (Object::section_name): Likewise.
1124         (Object::do_section_name): Likewise.
1125         (Sized_relobj_file::do_section_name): Likewise.
1126         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
1127         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
1128
1129 2014-09-02  Cary Coutant  <ccoutant@google.com>
1130
1131         PR gold/17005
1132         * ehframe.cc (Fde::write): Add output_offset parameter.
1133         (Cie::write): Likewise.
1134         (Eh_frame::set_final_data_size): Account for offset within output
1135         section.
1136         (Eh_frame::do_sized_write): Likewise.
1137         * ehframe.h (Fde::write): Add output_offset parameter.
1138         (Cie::write): Likewise.
1139         * output.cc (Output_section::Input_section_sort_entry): Remove
1140         section_has_name_; add output_section_name parameter. Use
1141         output section name for non-input sections.
1142         (Output_section::Input_section_sort_entry::section_has_name): Remove.
1143         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
1144         (Output_section::Input_section_sort_compare): Remove logic for
1145         sections without names.
1146         (Output_section::Input_section_sort_init_fini_compare): Likewise.
1147         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
1148         Likewise.
1149         (Output_section::Input_section_sort_section_name_compare): Likewise.
1150
1151 2014-08-29 Han Shen <shenhan@google.com>
1152            Jing Yu <jingyu@google.com>
1153
1154         * aarch64-reloc-property.cc
1155         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
1156         reference reloc property in the table.
1157         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
1158         3 other entries.
1159         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
1160         2 new overloaded methods.
1161         (Output_data_got_aarch64::do_write): Add code to write out
1162         static relocs.
1163         (class Output_data_got_aarch64::Static_reloc): New class to wrap
1164         static relocs.
1165         (Output_data_got_aarch64::static_relocs): New vector to
1166         hold static relocs.
1167         (Target_aarch64::TCB_SIZE): New const static memeber.
1168         (Target_aarch64::tcb_size): New method.
1169         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
1170         (Target_aarch64::Relocate::relocate_tls): New method.
1171         (Target_aarch64::Scan::local): Add code handling new reloc types.
1172         (Target_aarch64::Scan::global): Add code handling new reloc types.
1173
1174 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
1175
1176         * options.h (-no-pie): Add option.
1177
1178 2014-08-08  Jing Yu  <jingyu@google.com>
1179             Han Shen  <shenhan@google.com>
1180
1181         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
1182         (DEFFILES): add aarch64-reloc.def.
1183         (TARGETSOURCES): Add aarch64-reloc-property.cc.
1184         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
1185         * Makefile.in: Regenerate.
1186         * aarch64-reloc-property.cc: New file.
1187         * aarch64-reloc-property.h: New file.
1188         * aarch64-reloc.def: New file.
1189         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
1190         with tab to make the format consistent.
1191         (Output_data_got_aarch64::symbol_table_): New method.
1192         (Target_aarch64::do_plt_address_for_global): New method.
1193         (Target_aarch64::do_plt_address_for_local): New method.
1194         (Target_aarch64::do_select_as_default_target): New method.
1195         (Target_aarch64::do_make_data_plt): New method.
1196         (Target_aarch64::make_data_plt): New method.
1197         (Output_data_plt_aarch64::has_irelative_section): New method.
1198         (Output_data_plt_aarch64::address_for_global): New method.
1199         (Output_data_plt_aarch64::address_for_local): New method.
1200         (Output_data_plt_aarch64::irelative_rel_): New parameter.
1201         (Output_data_plt_aarch64::add_entry): Implement contents.
1202         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
1203         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
1204         the got_pov entry to plt0.
1205         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
1206         Implement contents.
1207         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
1208         (AArch64_howto): New struct.
1209         (aarch64_howto[]): New static const array.
1210         (AArch64_relocate_functions): New class.
1211         (Target_aarch64::Scan::get_reference_flags): Remove method.
1212         (Target_aarch64::Scan::local): Implement to support a few relocations.
1213         (Target_aarch64::Scan::global): Implement to support a few relocations.
1214         (Target_aarch64::make_plt_section): Implement contents.
1215         (Target_aarch64::make_plt_entry): Implement contents.
1216         (Target_aarch64::do_finalize_sections): Implement contents.
1217         (Target_aarch64::Relocate::relocate): Implement a few relocations.
1218         (Target_aarch64::relocate_section): Implement contents.
1219
1220 2014-08-06  Alan Modra  <amodra@gmail.com>
1221
1222         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
1223
1224 2014-08-06  Alan Modra  <amodra@gmail.com>
1225
1226         PR 13227
1227         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
1228
1229 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
1230
1231         * object.cc (Relobj::is_section_name_included): Add
1232         ".rodata.nptl_version" to not garbage collect this section.
1233
1234 2014-07-08  Cary Coutant  <ccoutant@google.com>
1235
1236         * expression.cc (struct Expression::Expression_eval_info): Add
1237         new fields type_pointer, vis_pointer, and nonvis_pointer.
1238         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
1239         nonvis_pointer parameters. Adjust all calls.
1240         (Symbol_expression::value): Update type, visibility, and nonvis bits
1241         in caller.
1242         * script.cc (Symbol_assignment::sized_finalize): Update type,
1243         visibility, and remaining st_other bits for new symbol.
1244         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
1245         vis_pointer, and nonvis_pointer parameters.
1246         * symtab.h (Symbol::set_type): New method.
1247
1248         * testsuite/Makefile.am (defsym_test): New test.
1249         * testsuite/Makefile.in: Regenerate.
1250         * testsuite/defsym_test.c: New file.
1251         * testsuite/defsym_test.sh: New file.
1252
1253 2014-07-08  Cary Coutant  <ccoutant@google.com>
1254
1255         PR gold/15639
1256         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
1257         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
1258         (Sized_dynobj::base_read_symbols): ...new method.
1259         * object.h (Sized_relobj_file::base_read_symbols): New method.
1260         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
1261         (Sized_relobj_file::base_read_symbols): ...new method.
1262         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
1263         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
1264         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
1265
1266 2014-07-04  Alan Modra  <amodra@gmail.com>
1267
1268         * po/POTFILES.in: Regenerate.
1269
1270 2014-07-02  Jing Yu  <jingyu@google.com>
1271
1272         * aarch64.cc: New file
1273         * Makefile.am (TARGETSOURCES): Add aarch64.cc
1274         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
1275         * Makefile.in: Regenerate.
1276         * configure.tgt: Add entries for aarch64*.
1277         * configure.ac:  Likewise.
1278         * configure: Likewise.
1279
1280 2014-06-27  Alan Modra  <amodra@gmail.com>
1281
1282         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
1283
1284 2014-06-24  Cary Coutant  <ccoutant@google.com>
1285
1286         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
1287         sections.
1288         (Dwo_file::sized_read_unit_index): Likewise.
1289
1290 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1291
1292         * mips.cc: New file.
1293         * Makefile.am (TARGETSOURCES): Add mips.cc
1294         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
1295         * configure.tgt: Add entries for mips*.
1296         * configure.ac: Likewise.
1297         * Makefile.in: Regenerate.
1298         * configure: Likewise.
1299
1300 2014-06-09  Cary Coutant  <ccoutant@google.com>
1301
1302         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
1303         unit_length is within section bounds.
1304
1305 2014-06-09  Cary Coutant  <ccoutant@google.com>
1306
1307         PR gold/16980
1308         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
1309         map.
1310
1311 2014-06-07  Alan Modra  <amodra@gmail.com>
1312
1313         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
1314
1315 2014-06-06  Cary Coutant  <ccoutant@google.com>
1316
1317         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
1318         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
1319         (Dwarf_pubnames_table::read_header): Likewise.
1320         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
1321         .debug_gnu_pubtypes.
1322
1323 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
1324
1325         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
1326         * Makefile.in, configure: Regenerate.
1327
1328 2014-06-03  Alan Modra  <amodra@gmail.com>
1329
1330         * powerpc.cc (addis_12_2): Define.
1331         (Stub_table::do_write): Support fusion on ELFv2 stubs.
1332
1333 2014-06-03  Alan Modra  <amodra@gmail.com>
1334
1335         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
1336         st_other output.
1337
1338 2014-06-02  Alan Modra  <amodra@gmail.com>
1339
1340         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
1341         Only ignore relocs on ELFv1.
1342         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
1343
1344 2014-05-30  Cary Coutant  <ccoutant@google.com>
1345
1346         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
1347         * testsuite/Makefile.in: Regenerate.
1348         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
1349
1350 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
1351
1352         PR gold/16945
1353         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
1354         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
1355
1356 2014-05-15  Alan Modra  <amodra@gmail.com>
1357
1358         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
1359         Compare FDE contents with DW_CFA_nop rather than 0.
1360
1361 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
1362
1363         * symtab.h (may_need_copy_reloc): Remove check for position independent
1364         code.
1365         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
1366         position independence before pc absolute may_need_copy_reloc call.
1367         Add check for executable output befor pc relative may_need_copy_reloc
1368         call.
1369         * i386.cc: Ditto.
1370         * arm.cc: Ditto.
1371         * sparc.cc: Ditto.
1372         * tilegx.cc: Ditto.
1373         * powerpc.cc: Add check for no position independence before
1374         may_need_copy_reloc calls.
1375         * testsuite/pie_copyrelocs_test.cc: New file.
1376         * testsuite/pie_copyrelocs_shared_test.cc: New file.
1377         * Makefile.am (pie_copyrelocs_test): New test.
1378         * Makefile.in: Regenerate.
1379
1380 2014-05-08  Martin Liška  <mliska@suse.cz>
1381
1382         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
1383
1384 2014-05-06  Cary Coutant  <ccoutant@google.com>
1385
1386         PR gold/16900
1387         * i386.cc (Output_data_got_plt_i386): New class.
1388         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
1389         parameter. Change all callers.
1390         (Output_data_plt_i386::layout_): Remove.
1391         (Output_data_plt_i386::got_plt_): Change type.
1392         (Target_i386::got_plt_): Change type. Change all references.
1393         (Target_i386::got_section): Create instance of new class.
1394         (Output_data_got_plt_i386::do_write): New function.
1395         * x86_64.cc (Output_data_got_plt_x86_64): New class.
1396         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
1397         parameter. Change all callers.
1398         (Output_data_plt_x86_64::layout_): Remove.
1399         (Output_data_plt_x86_64::got_plt_): Change type.
1400         (Target_x86_64::got_plt_): Change type. Change all references.
1401         (Target_x86_64::got_section): Create instance of new class.
1402         (Output_data_got_plt_x86_64::do_write): New function.
1403         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
1404         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
1405         class.
1406
1407 2014-05-05  Cary Coutant  <ccoutant@google.com>
1408
1409         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
1410         if we have pubnames/pubtypes.
1411
1412 2014-05-02  Cary Coutant  <ccoutant@google.com>
1413
1414         * defstd.cc (in_segment): Define __ehdr_start here...
1415         * layout.cc (Layout::finalize): ...Instead of here.  Set the
1416         output segment when known.
1417         * resolve.cc (Symbol::override_base_with_special): Remember
1418         the original binding.
1419         * symtab.cc (Symbol::set_output_segment): New function.
1420         (Symbol::set_undefined): New function.
1421         * symtab.h (Symbol::is_weak_undefined): Check original undef
1422         binding.
1423         (Symbol::is_strong_undefined): New function.
1424         (Symbol::set_output_segment): New function.
1425         (Symbol::set_undefined): New function.
1426         * target-reloc.h (is_strong_undefined): Remove.
1427         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
1428         Check for hidden undefs.
1429         (relocate_section): Call Symbol::is_strong_undefined.
1430
1431         * testsuite/Makefile.am (ehdr_start_test_1)
1432         (ehdr_start_test_2, ehdr_start_test_3)
1433         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
1434         * testsuite/Makefile.in: Regenerate.
1435         * testsuite/ehdr_start_def.cc: New source file.
1436         * testsuite/ehdr_start_test.cc: New source file.
1437         * testsuite/ehdr_start_test.t: New linker script.
1438         * testsuite/ehdr_start_test_4.sh: New shell script.
1439
1440 2014-04-23  Cary Coutant  <ccoutant@google.com>
1441
1442         PR gold/16870
1443         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
1444
1445 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1446
1447         * layout.cc (Layout::include_section): Allow a target to decide
1448         whether to include a section.
1449         * target.h (Target::should_include_section): New function.
1450         (Target::do_should_include_section): New function.
1451
1452 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1453
1454         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
1455         inline into ...
1456         (Copy_relocs::emit): ... here.
1457         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
1458         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
1459         (Copy_reloc_entry::entries_): Change from private to protected.
1460
1461 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
1462
1463         * icf.cc (get_section_contents): Replace copies of reloc
1464         vectors with const references.
1465
1466 2014-04-02  Cary Coutant  <ccoutant@google.com>
1467
1468         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
1469         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
1470         * configure: Regenerate.
1471         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
1472         -fno-use-linker-plugin.
1473         (LINK1, CXXLINK1): Add it to the link command.
1474         * testsuite/Makefile.in: Regenerate.
1475
1476 2014-03-12  Alan Modra  <amodra@gmail.com>
1477
1478         * Makefile.in: Regenerate.
1479
1480 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1481
1482         * symtab.h (Symbol::set_nonvis): New function.
1483
1484 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1485
1486         * symtab.cc (Sized_symbol<32>::init_output_data):
1487         Instantiate the template.
1488         (Sized_symbol<64>::init_output_data): Likewise.
1489
1490 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1491
1492         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
1493         adjust dynamic symbol value.
1494         * target.h (Target::adjust_dyn_symbol): New function.
1495         (Target::do_adjust_dyn_symbol): New function.
1496
1497 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1498
1499         * output.cc (Output_data_dynamic::Dynamic_entry::write):
1500         Get the value of DYNAMIC_CUSTOM dynamic entry.
1501         * output.h (Output_data_dynamic::add_custom): New function.
1502         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
1503         dynamic entry.
1504         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
1505         * target.h (Target::dynamic_tag_custom_value): New function.
1506         (Target::do_dynamic_tag_custom_value): New function.
1507
1508 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1509
1510         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
1511         dynsym indexes.
1512         * target.h (Target::has_custom_set_dynsym_indexes): New function.
1513         (Target::do_has_custom_set_dynsym_indexes): New function.
1514         (Target::set_dynsym_indexes): New function.
1515         (Target::do_set_dynsym_indexes): New function.
1516
1517 2014-03-07  Alan Modra  <amodra@gmail.com>
1518
1519         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
1520         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
1521         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
1522         (Powerpc_relocate_functions::has_overflow_bitfield,
1523         overflowed): Use the above.
1524         (Target_powerpc::Relocate::relocate): Correct overflow checking
1525         for a number of relocations.  Modify overflow test for 16-bit
1526         fields in instructions to signed/unsigned according to whether
1527         the field takes a signed or unsigned value.
1528
1529 2014-03-05  Alan Modra  <amodra@gmail.com>
1530
1531         Update copyright years.
1532
1533 2014-03-05  Alan Modra  <amodra@gmail.com>
1534
1535         * powerpc.cc (Target_powerpc::Scan::local, global): Support
1536         R_PPC64_ADDR64_LOCAL.
1537         (Target_powerpc::Relocate::relocate): Likewise.
1538
1539 2014-03-03  Alan Modra  <amodra@gmail.com>
1540
1541         * dwp.cc (print_version): Update copyright year to current.
1542
1543 2014-02-10  Alan Modra  <amodra@gmail.com>
1544
1545         * po/gold.pot: Regenerate.
1546
1547 2014-02-06  Cary Coutant  <ccoutant@google.com>
1548
1549         Fix problem where -u is ignored when a weak undef is seen.
1550
1551         * archive.cc (Library_base::should_include_member): Reorder
1552         code to check for -u option if a weak undef has already been seen.
1553         * testsuite/Makefile.am (weak_undef_test_2): New test case.
1554         * testsuite/Makefile.in: Regenerate.
1555         * testsuite/weak_undef_file3.cc: New file.
1556         * testsuite/weak_undef_file4.cc: New file.
1557         * testsuite/weak_undef_test_2.cc: New file.
1558
1559 2014-02-05  Cary Coutant  <ccoutant@google.com>
1560
1561         Fix issues with gold undefined symbol diagnostics.
1562
1563         PR binutils/15435
1564         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
1565         check to here.
1566         * target-reloc.h (is_strong_undefined): New function.
1567         (relocate_section): Move undef vtable symbol check from here.
1568         Check for is_strong_undefined.
1569
1570 2014-02-05  Cary Coutant  <ccoutant@google.com>
1571
1572         Fix problems with the --dynamic-list option.
1573
1574         PR gold/13577
1575         * options.cc (General_options::parse_dynamic_list):
1576         Set have_dynamic_list_.
1577         (General_options::General_options): Initialize have_dynamic_list_.
1578         (General_options::finalize): Turn off -Bsymbolic and
1579         -Bsymbolic-functions if --dynamic-list provided.
1580         * options.h (General_options::have_dynamic_list): New function.
1581         (General_options::have_dynamic_list_): New data member.
1582         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
1583         correctly.
1584
1585         PR gold/16530
1586         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
1587         in --dynamic-list, mark it.
1588
1589         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
1590         (dynamic_list_2): New test case.
1591         * testsuite/Makefile.in: Regenerate.
1592         * testsuite/dynamic_list_2.cc: New file.
1593         * testsuite/dynamic_list_2.t: New file.
1594         * testsuite/dynamic_list_lib1.cc: New file.
1595         * testsuite/dynamic_list_lib2.cc: New file.
1596         * testsuite/gc_dynamic_list_test.c: New file.
1597         * testsuite/gc_dynamic_list_test.sh: New file.
1598         * testsuite/gc_dynamic_list_test.t: New file.
1599
1600 2014-01-28  Cary Coutant  <ccoutant@google.com>
1601
1602         Add .gdb_index version 7 support.
1603
1604         * gold/dwarf_reader.cc: include <utility> (for make_pair).
1605         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
1606         debug sections.
1607         (Dwarf_ranges_table::read_ranges_table): Likewise.
1608         (Dwarf_pubnames_table::read_section): Check for GNU-style
1609         sections, and for compressed debug sections.
1610         (Dwarf_pubnames_table::read_header): Compute end address of table.
1611         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
1612         for end of list by offset, not by offset == 0.
1613         (Dwarf_info_reader::do_read_string_table): Check for compressed
1614         debug sections.
1615         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1616         Initialize new data members.
1617         (Dwarf_pubnames_table::next_name): return flag_byte.
1618         (Dwarf_pubnames_table::end_of_table_): New data member.
1619         (Dwarf_pubnames_table::is_gnu_style_): New data member.
1620         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
1621         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
1622         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
1623         read skeleton type unit DIEs.
1624         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
1625         (Gdb_index::do_write): Write flag_byte.
1626         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
1627         (Gdb_index::Cu_vector): Store flags along with cu indexes.
1628         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
1629         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
1630
1631 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
1632
1633         * version.cc (print_version): Update copyright year to 2014.
1634
1635 2013-12-19  Dimitry Andric  <dimitry@andric.com>
1636
1637         * stringpool.cc (Stringpool_template::reserve): Add
1638         HAVE_UNORDERED_MAP case.
1639         * stringpool.cc (Stringpool_template::print_stats): Likewise.
1640
1641 2013-12-18  Cary Coutant  <ccoutant@google.com>
1642
1643         * configure.ac: Check for <unordered_set> and <unordered_map>.
1644         * config.in: Regenerate.
1645         * configure: Regenerate.
1646         * system.h: Use <unordered_set> and <unordered_map> if available.
1647
1648 2013-12-10  Roland McGrath  <mcgrathr@google.com>
1649
1650         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
1651         with $(INSTALL_PROGRAM_ENV).
1652         * Makefile.in: Regenerate.
1653
1654 2013-11-22  Cary Coutant  <ccoutant@google.com>
1655
1656         * configure.ac: Add check for which library is needed for
1657         dlopen.
1658         * configure: Regenerate.
1659
1660 2013-11-22  Cary Coutant  <ccoutant@google.com>
1661
1662         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
1663         assembler.
1664         * testsuite/Makefile.in: Regenerate.
1665
1666 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
1667
1668         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
1669         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
1670         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
1671         (Target_x86_64<size>::Scan::local): Likewise.
1672         (Target_x86_64<size>::Scan::global): Likewise.
1673         (Target_x86_64<size>::Relocate::relocate): Likewise.
1674         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
1675         Likewise.
1676         (Target_x86_64<size>::Scan::check_non_pic(): Handle
1677         R_X86_64_PC32_BND.
1678
1679         * testsuite/Makefile.am (check_PROGRAMS): Add
1680         exception_x86_64_bnd_test.
1681         (exception_x86_64_bnd_test_SOURCES): New macro.
1682         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
1683         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
1684         (exception_x86_64_bnd_test_LDADD): Likewise.
1685         (exception_x86_64_bnd_1.o): New rule.
1686         (exception_x86_64_bnd_2.o): Likewise.
1687         * testsuite/Makefile.in: Regenerated.
1688
1689 2013-11-15  Alan Modra  <amodra@gmail.com>
1690
1691         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
1692         accessor.
1693         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
1694         Only call ppc64_local_entry_offset for 64-bit.  Restrict
1695         symval_for_branch lookup to ELFv1.
1696         (Stub_table::add_plt_call_entry): Use unsigned int off.
1697         (Output_data_glink::Address, invalid_address): New.
1698         (Output_data_glink::add_eh_frame): Move out of line.  Add
1699         support for ELFv2.
1700         (Output_data_glink::add_global_entry, find_global_entry,
1701         global_entry_address): New functions.
1702         (Output_data_glink::global_entry_stubs_, end_branch_table_,
1703         ge_size): New variables.
1704         (Output_data_glink::set_final_data_size): Add global entry
1705         stub sizing.
1706         (Output_data_glink::do_write): Write global entry stubs.
1707         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
1708         parameter.  Return true for ELFv2.  Adjust callers.
1709         (Target_powerpc::Scan::local, global): Restrict opd lookup to
1710         ELFv1.  Similarly for ifunc and dynamic relocation processing
1711         specific to ELFv1.  Recognize that symbols are defined on
1712         their plt entries for ELFv2.
1713         (Target_powerpc::symval_for_branch): Assert if called for
1714         ELFv2 or ppc32.
1715         (Target_powerpc::Relocate::relocate): Use global entry plt
1716         stub for symbol value if such exists on ELFv2.
1717         (Target_powerpc::Relocate::relocate): Don't call
1718         symval_for_branch when ELFv2.  Do adjust for local entry
1719         offset when ELFv2.
1720         (Target_powerpc::do_dynsym_value): Set symbols to global entry
1721         plt stub for ELFv2.
1722         (Target_powerpc::do_plt_address_for_global): Similarly.
1723
1724 2013-11-14  Cary Coutant  <ccoutant@google.com>
1725
1726         Revert patch -- this did not fix the problem, and there is
1727         no race there.
1728
1729         2013-11-14  Cary Coutant  <ccoutant@google.com>
1730
1731             PR gold/14860
1732             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1733             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1734             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1735             updating fde_offsets_.
1736             (Eh_frame_hdr::lock_): New data member.
1737
1738 2013-11-14  Cary Coutant  <ccoutant@google.com>
1739
1740         * dwp.cc (Dwo_file_entry): New type.
1741         (File_list): Use Dwo_file_entry.
1742         (Dwo_file::verify): New function.
1743         (Dwo_file::verify_dwo_list): New function.
1744         (Dwo_file::sized_verify_dwo_list): New function.
1745         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
1746         list.
1747         (Dwp_options): New enum type.
1748         (dwp_options): Add --verify-only.
1749         (usage): Likewise.
1750         (main): Likewise.
1751         * dwp.h (gold_info): Add declaration.
1752
1753 2013-11-14  Cary Coutant  <ccoutant@google.com>
1754
1755         PR gold/14860
1756         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1757         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1758         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1759         updating fde_offsets_.
1760         (Eh_frame_hdr::lock_): New data member.
1761
1762 2013-11-06  Cary Coutant  <ccoutant@google.com>
1763
1764         PR gold/15758
1765         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
1766         before reloc sections.
1767
1768 2013-11-04  Alan Modra  <amodra@gmail.com>
1769
1770         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
1771         (Symbol::needs_dynamic_reloc): Test new flag.
1772         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
1773         (Target_powerpc::Scan::get_reference_flags): Add target param.
1774         Return FUNC_DESC_ABI for 64-bit ELFv1.
1775         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
1776         call.
1777         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
1778         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
1779
1780 2013-10-31  Cary Coutant  <ccoutant@google.com>
1781
1782         Restore support for dwp v2 DWARF package file format.
1783
1784         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1785         tu_length parameter.  Adjust all callers.
1786         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1787         * dwp.cc: Include dwarf.h.
1788         (Section_bounds): New struct type.
1789         (Unit_set): New struct type.
1790         (Dwo_file::Dwo_file): Initialize new data member.
1791         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1792         Combine and rename to...
1793         (Dwo_file::read_unit_index): ...this.
1794         (Dwo_file::sized_read_compunit_index)
1795         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1796         (Dwo_file::sized_read_unit_index): ...this.
1797         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1798         parameters; add section_id parameter.
1799         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1800         (Dwo_file::add_unit_set): ...this.
1801         (Dwo_file::shndx_map_): Remove.
1802         (Dwo_file::sect_offsets_): New data member.
1803         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1804         (Dwp_output_file::add_section): Rename to...
1805         (Dwp_output_file::add_contribution): ...this.
1806         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1807         (Dwp_output_file::add_tu_set): Likewise.
1808         (Dwp_output_file::Contribution): New type.
1809         (Dwp_output_file::Section::contributions): New data member.
1810         (Dwp_output_file::Cu_or_tu_set): Remove.
1811         (Dwp_output_file::Section::Section): New ctor.
1812         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1813         (Dwp_output_file::Dwp_index::Section_table): New type.
1814         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1815         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1816         parameter.
1817         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1818         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1819         (Dwp_output_file::Dwp_index::section_table): New member function.
1820         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1821         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1822         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1823         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1824         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1825         (Dwp_output_file::Dwp_index::section_table_): New data member.
1826         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1827         (Dwp_output_file::add_output_section): New member function.
1828         (Dwp_output_file::write_new_section): New member function.
1829         (Dwp_output_file::write_contributions): New member function.
1830         (Dwp_output_file::section_id_map_): New data member.
1831         (class Dwo_id_info_reader): Remove.
1832         (class Unit_reader): New class.
1833         (get_dwarf_section_name): New function.
1834         (Dwo_file::read_executable): Adjust initializations of class data.
1835         (Dwo_file::read): Add support for v2 package file format.
1836         (Dwo_file::read_unit_index): Likewise.
1837         (Dwo_file::sized_read_unit_index): Likewise.
1838         (Dwo_file::copy_section): Likewise.
1839         (Dwo_file::add_unit_set): Likewise.
1840         (Dwp_output_file::add_output_section): Likewise.
1841         (Dwp_output_file::add_contribution): Likewise.
1842         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1843         for empty slot.
1844         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1845         file format.
1846         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1847         slot.
1848         (Dwp_output_file::initialize): Remove unused function.
1849         (Dwp_output_file::finalize): Add support for v2 package file format.
1850         (Dwp_output_file::write_index): Likewise.
1851         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1852         function prototype.
1853
1854 2013-10-31  Cary Coutant  <ccoutant@google.com>
1855
1856         * configure.ac: Fix check for -fmerge-constants.
1857         * configure.ac: Regenerate.
1858
1859 2013-10-30  Roland McGrath  <mcgrathr@google.com>
1860
1861         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
1862         Correct 9-byte nop sequence to match what the assembler generates.
1863
1864 2013-10-30  Alan Modra  <amodra@gmail.com>
1865
1866         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
1867         ppc64_local_entry_offset, ppc64_local_entry_offset,
1868         do_read_symbols): New functions.
1869         (Powerpc_relobj::e_flags_, st_other_): New vars.
1870         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
1871         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
1872         (Powerpc_relobj::e_flags_): New var.
1873         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
1874         and adjust for ELFv2.
1875         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
1876         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
1877         (Powerpc_dynobj::do_find_special_sections): Likewise.
1878         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
1879         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
1880         to ELFv2 local entry.
1881         (Target_powerpc::do_relax): No thread safe barriers needed for
1882         ELFv2.
1883         (Output_data_plt_powerpc::initial_plt_entry_size_,
1884         plt_entry_size): Delete.  Replace all uses with
1885         first_plt_entry_offset() and plt_entry_size().
1886         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
1887         reserved_size parm.  Update callers.
1888         (Output_data_plt_powerpc::entry_count): Update.
1889         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
1890         and use Target_powerpc::first_plt_entry_offset().
1891         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
1892         rename to plt_entry_size.
1893         (Output_data_plt_powerpc::add_ifunc_entry,
1894         add_local_ifunc_entry): Adjust reloc for ELFv2.
1895         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
1896         (glink_eh_frame_fde_64v2): New.
1897         (Stub_table::plt_call_size): Support ELFv2 sizing.
1898         (Output_data_glink::add_eh_frame): Use the new FDE.
1899         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
1900         (Stub_table::do_write): Write ELFv2 stubs and glink.
1901         (Target_powerpc::Relocate::relocate): Replaces nop after call
1902         with ld 2,24(1) and adjust local offset destination for ELFv2.
1903
1904 2013-10-30  Alan Modra  <amodra@gmail.com>
1905
1906         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
1907         (Target_powerpc::Scan::global, local): Likewise.
1908         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
1909         on all ppc64 @h and @ha relocs.
1910
1911 2013-10-14  Alan Modra  <amodra@gmail.com>
1912
1913         * output.h (Output_data_got::add_constant): Tidy.
1914         (Output_data_got::add_constant_pair): New function.
1915         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
1916         methods used so as to first call reserve_ent().
1917
1918 2013-10-11  Roland McGrath  <mcgrathr@google.com>
1919
1920         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
1921         add_got_entry and add_got_entry_pair.
1922
1923         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
1924         (HAVE_PUBNAMES): Likewise.
1925         * configure: Regenerate.
1926
1927         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
1928         * testsuite/Makefile.in: Regenerate.
1929
1930         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
1931         Remove const from declaration.
1932         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
1933         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
1934         * output.h (Output_file_header): Remove const from member target_
1935         and corresponding constructor argument.
1936         * output.cc (Output_file_header::Output_file_header): Update prototype.
1937         (Output_file_header::do_sized_write): Use this->target_ in place
1938         of parameters()->target().
1939
1940         * testsuite/undef_symbol.cc (Foo::get_a): New method.
1941
1942         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
1943         * configure: Regenerate.
1944         * Makefile.in: Regenerate.
1945         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
1946         * testsuite/merge_string_literals_2.c: Likewise.
1947         * testsuite/Makefile.am
1948         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
1949         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
1950         literal -fmerge-constants.
1951         * testsuite/Makefile.in: Regenerate.
1952
1953         * i386.cc (Target_i386): Remove unused member dynbss_.
1954         * arm.cc (Target_arm): Likewise.
1955         * powerpc.cc (Target_powerpc): Likewise.
1956         * sparc.cc (Target_sparc): Likewise.
1957         * tilegx.cc (Target_tilegx): Likewise.
1958         * x86_64.cc (Target_x86_64): Likewise.
1959         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
1960         type_signature_, type_offset_.
1961         * plugin.h (Plugin_hook): Remove unused member layout_.
1962         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
1963         mapfile_.
1964         (Read_member): Remove unused members input_objects_, symtab_,
1965         mapfile_, layout_.
1966         (Check_library): Remove unused member symtab_.
1967         * archive.h (Lib_group): Remove unused member lib_.
1968         * archive.cc (Lib_group::Lib_group): Update initializer.
1969         * incremental.h (Incremental_binary): Remove unused member target_.
1970         (Incremental_script_entry): Removed unused member script_.
1971         * layout.h (Write_symbols_task): Remove unused member input_objects_.
1972         * icf.h (Icf): Remove unused member num_tracked_relocs.
1973
1974         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1975         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1976         its only use.
1977         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1978
1979         * archive.h: Use struct rather than class for forward declaration
1980         of Read_symbols_data.
1981
1982 2013-10-07  Cary Coutant  <ccoutant@google.com>
1983
1984         PR gold/16010
1985         * testsuite/Makefile.am (icf_test): Fix dependencies.
1986         (icf_safe_test): Likewise.
1987         (icf_safe_so_test): Likewise.
1988         (large_symbol_alignment): Add empty _LDADD rule.
1989         * testsuite/Makefile.in: Regenerate.
1990
1991 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
1992
1993         PR gold/15927
1994         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1995         relocation for R_X86_64_32 on x32.
1996
1997 2013-08-27  Roland McGrath  <mcgrathr@google.com>
1998
1999         * output.cc (Output_segment::set_section_addresses): Take new
2000         Target* argument.  If target->isolate_execinstr() and the segment
2001         is executable and starts at a target->abi_pagesize() boundary,
2002         pad its end out to a target->abi_pagesize() boundary with code fill.
2003         * output.h (Output_segment::set_section_addresses): Update decl.
2004         * layout.h (Layout::check_output_data_for_reset_values): Take new
2005         argument RELAX_OUTPUTS.
2006         (Layout): New member relax_output_list_.
2007         (Layout::add_relax_output): New method.
2008         * layout.cc (Layout::Layout): Update constructor.
2009         (Layout::reset_relax_output): New method.
2010         (Layout::clean_up_after_relaxation): Call it.
2011         (Layout::prepare_for_relaxation): Update caller.
2012         (Layout::set_segment_offsets): Update callers of set_section_addresses.
2013         Call reset_relax_output before re-processing segments for
2014         isolate_execinstr case.
2015         (Layout::write_data): Handle relax_output_list_.
2016         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
2017         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
2018
2019 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
2020
2021         PR binutils/15834
2022         * object.h: Fix typos.
2023
2024 2013-08-16  Roland McGrath  <mcgrathr@google.com>
2025
2026         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
2027         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
2028
2029 2013-08-07  Cary Coutant  <ccoutant@google.com>
2030
2031         Revert support for v2 DWP files:
2032
2033         2013-03-01  Cary Coutant  <ccoutant@google.com>
2034
2035             Add dwp support for v2 DWARF package file format.
2036             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2037             tu_length parameter.  Adjust all callers.
2038             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2039             * dwp.cc: Include dwarf.h.
2040             (Section_bounds): New struct type.
2041             (Unit_set): New struct type.
2042             (Dwo_file::Dwo_file): Initialize new data member.
2043             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2044             Combine and rename to...
2045             (Dwo_file::read_unit_index): ...this.
2046             (Dwo_file::sized_read_compunit_index)
2047             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2048             (Dwo_file::sized_read_unit_index): ...this.
2049             (Dwo_file::copy_section): Remove section_name, is_str_offsets
2050             parameters; add section_id parameter.
2051             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2052             (Dwo_file::add_unit_set): ...this.
2053             (Dwo_file::shndx_map_): Remove.
2054             (Dwo_file::sect_offsets_): New data member.
2055             (Dwp_output_file::Dwp_output_file): Initialize new data members.
2056             (Dwp_output_file::add_section): Rename to...
2057             (Dwp_output_file::add_contribution): ...this.
2058             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2059             (Dwp_output_file::add_tu_set): Likewise.
2060             (Dwp_output_file::Contribution): New type.
2061             (Dwp_output_file::Section::contributions): New data member.
2062             (Dwp_output_file::Cu_or_tu_set): Remove.
2063             (Dwp_output_file::Section::Section): New ctor.
2064             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2065             (Dwp_output_file::Dwp_index::Section_table): New type.
2066             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2067             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2068             parameter.
2069             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2070             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2071             (Dwp_output_file::Dwp_index::section_table): New member function.
2072             (Dwp_output_file::Dwp_index::section_table_end): New member function.
2073             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2074             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2075             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2076             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2077             (Dwp_output_file::Dwp_index::section_table_): New data member.
2078             (Dwp_output_file::Dwp_index::section_mask_): New data member.
2079             (Dwp_output_file::add_output_section): New member function.
2080             (Dwp_output_file::write_new_section): New member function.
2081             (Dwp_output_file::write_contributions): New member function.
2082             (Dwp_output_file::section_id_map_): New data member.
2083             (class Dwo_id_info_reader): Remove.
2084             (class Unit_reader): New class.
2085             (get_dwarf_section_name): New function.
2086             (Dwo_file::read_executable): Adjust initializations of class data.
2087             (Dwo_file::read): Add support for v2 package file format.
2088             (Dwo_file::read_unit_index): Likewise.
2089             (Dwo_file::sized_read_unit_index): Likewise.
2090             (Dwo_file::copy_section): Likewise.
2091             (Dwo_file::add_unit_set): Likewise.
2092             (Dwp_output_file::add_output_section): Likewise.
2093             (Dwp_output_file::add_contribution): Likewise.
2094             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2095             for empty slot.
2096             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2097             file format.
2098             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2099             slot.
2100             (Dwp_output_file::initialize): Remove unused function.
2101             (Dwp_output_file::finalize): Add support for v2 package file format.
2102             (Dwp_output_file::write_index): Likewise.
2103             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2104             function prototype.
2105
2106 2013-07-31  Cary Coutant  <ccoutant@google.com>
2107
2108         * object.cc (Sized_relobj::do_output_section_address): New function.
2109         (Sized_relobj): Instantiate explicitly.
2110         * object.h (Object::output_section_address): New function.
2111         (Object::do_output_section_address): New function.
2112         (Sized_relobj::do_output_section_address): New function.
2113         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
2114
2115 2013-07-30  Cary Coutant  <ccoutant@google.com>
2116             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2117
2118         * parameters.cc (Parameters::entry): Return target-specific entry
2119         symbol name.
2120         * target.h (Target::entry_symbol_name): New function.
2121         (Target_info::entry_symbol_name): New data member.
2122
2123         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
2124         * i386.cc (Target_i386::i386_info): Likewise.
2125         (Target_i386_nacl::i386_nacl_info): Likewise.
2126         * sparc.cc (Target_sparc::sparc_info): Likewise.
2127         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
2128         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
2129         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
2130         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2131
2132 2013-07-22  Sterling Augustine  <saugustine@google.com>
2133
2134         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
2135         Convert parameter shndx to local variable. Add parameters symtab
2136         and symtab_size.  Scan over section names.  Find relocation
2137         section corresponding to current section.  Create and initialize
2138         reloc_mapper_ and reloc_type_.
2139         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
2140         unit_length to off_t.  Initialize member unit_length_.  Fill in field
2141         cu_offset_.
2142         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2143         Initialize new fields unit_length_ and cu_offset_.
2144         (Dwarf_pubnames_table::read_section): Update prototype.
2145         (Dwarf_pubnames_table::cu_offset): New member function.
2146         (Dwarf_pubnames_table::subsection_size): Likewise.
2147         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
2148         New fields.
2149         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
2150         member functions public.
2151         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
2152         Update comment.  Rework logic.  Move repeated parts to...
2153         (Gdb_index_info_reader::read_pubtable): ...here. New function.
2154         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
2155         pubtypes_table_, and stmt_list_offset.
2156         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2157         Gdb_index::find_pubtype_offset,
2158         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
2159         (Gdb_index::pubnames_read): Update prototype and rework logic.
2160         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
2161         Forward declare.
2162         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2163         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
2164         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
2165         Gdb_index::map_pubtable_to_dies):
2166         Declare functions.
2167         (Gdb_index::pubnames_read): Update declaration.
2168         (Gdb_index::Pubname_offset_map): New type.
2169         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
2170         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
2171         Gdb_index::stmt_list_offset): Declare.
2172         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
2173         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
2174         Gdb_index::pubtypes_offset_): Remove.
2175
2176 2013-07-19  Roland McGrath  <mcgrathr@google.com>
2177
2178         * options.h (General_options): Add -Trodata-segment option.
2179         * parameters.cc (Parameters::check_rodata_segment): New function.
2180         (Parameters::set_target_once): Call it.
2181         * parameters.h (Parameters): Declare it (private member function).
2182         * layout.cc (load_seg_unusable_for_headers): New function, broken
2183         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
2184         then validate rodata segment rather than text segment.
2185         (relaxation_loop_body): Call that.
2186         (is_text_segment): New function.  Don't admit a non-executable
2187         segment if TARGET->isolate_execinstr().
2188         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
2189
2190 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
2191
2192         PR gold/15070
2193         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
2194         * nacl.h (Sniff_file::View::View): Request aligned view.
2195
2196 2013-07-11  Cary Coutant  <ccoutant@google.com>
2197
2198         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
2199         correct BRLT entry size.
2200
2201 2013-07-03  Alan Modra  <amodra@gmail.com>
2202
2203         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
2204         comment.
2205
2206 2013-07-01  Cary Coutant  <ccoutant@google.com>
2207
2208         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
2209         reloc_type_.
2210         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
2211         (Dwarf_ranges_table::lookup_reloc): New function.
2212         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
2213         reloc_type_.
2214         (Dwarf_ranges_table::lookup_reloc): New function.
2215         (Dwarf_ranges_table::reloc_type_): New data member.
2216
2217 2013-06-27  Jing Yu  <jingyu@google.com>
2218
2219         PR gold/15662
2220         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
2221         function.
2222         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
2223         (Target_powerpc::do_relax): Call the above.
2224
2225 2013-06-27  Cary Coutant  <ccoutant@google.com>
2226
2227         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
2228         on garbage collected .opd section.
2229
2230 2013-06-27  Alan Modra  <amodra@gmail.com>
2231
2232         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
2233         is non-zero.
2234         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
2235         (Target_powerpc::do_function_location): Likewise for loc->shndx.
2236
2237 2013-06-14  Cary Coutant  <ccoutant@google.com>
2238
2239         * resolve.cc (Symbol::override_base): Don't override st_type
2240         from plugin placeholder symbols.
2241         (Symbol_table::resolve): Likewise.
2242         (Symbol_table::should_override): Don't complain about TLS mismatch
2243         if the TO symbol is a plugin placeholder.
2244         * testsuite/Makefile.am (plugin_test_tls): New test.
2245         * testsuite/Makefile.in: Regenerate.
2246         * testsuite/plugin_test_tls.sh: New test script.
2247         * testsuite/two_file_test_2_tls.cc: New test source.
2248         * testsuite/two_file_test_tls.cc: New test source.
2249
2250 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2251
2252         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
2253         the maximum segment alignment is larger than the page size.
2254         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
2255         correctly aligns the symbols with large alignemnt.
2256         * testsuite/Makefile.in: Regenerate.
2257         * testsuite/large_symbol_alignment.cc: New file.
2258
2259 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2260             Sriraman Tallam  <tmsriram@google.com>
2261
2262         * options.h (sort_section): New option.
2263         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
2264         Rename from Input_section_sort_section_name_special_ordering_compare.
2265         (Input_section_sort_section_name_compare): New struct.
2266         * output.cc (Output_section::Input_section_sort_section_name_compare::
2267         operator()): New function.
2268         (Output_section::sort_attached_input_sections): Use new sort function
2269         for .text if --sort-section=name is specified.
2270         * layout.cc (Layout::make_output_section):
2271         Add sorting by name when --sort-section=name is specified.
2272         * testsuite/Makefile.am (text_section_grouping): Test option
2273         --sort-section=name.
2274         * testsuite/Makefile.in: Regenerate.
2275         * testsuite/section_sorting_name.cc: New file.
2276         * testsuite/section_sorting_name.sh: New file.
2277
2278 2013-05-21  Cary Coutant  <ccoutant@google.com>
2279
2280         * symtab.h (Symbol::is_cxx_vtable): New function.
2281         * target-reloc.h (relocate_section): Check for vtable symbol.
2282         * testsuite/Makefile.am (missing_key_func.sh): New test case.
2283         * testsuite/Makefile.in: Regenerate.
2284         * testsuite/missing_key_func.cc: New test source.
2285         * testsuite/missing_key_func.sh: New test script.
2286
2287 2013-05-21  Cary Coutant  <ccoutant@google.com>
2288
2289         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
2290         type of enclosing symbol.
2291         (Relocate_info::location): Check symbol type when describing symbol.
2292         * object.h (Symbol_location_info): Remove unused line_number;
2293         add enclosing_symbol_type.
2294         * testsuite/debug_msg.sh: Adjust expected output.
2295
2296 2013-05-13  Cary Coutant  <ccoutant@google.com>
2297
2298         * configure.ac: Export DEFAULT_TARGET.
2299         * configure: Regenerate.
2300         * Makefile.in: Regenerate.
2301         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
2302         * testsuite/Makefile.in: Regenerate.
2303         * testsuite/debug_msg.sh: Delete duplicate tests.
2304         Don't check undef_int error message match for powerpc where the
2305         source file and line number aren't available.
2306
2307 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2308
2309         * options.h (General_options): Add --rosegment-gap option.
2310         * options.cc (finalize): --rosegment-gap implies --rosegment.
2311         * layout.cc (set_segment_offsets): Let user option override
2312         target->rosegment_gap().
2313
2314 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2315
2316         * options.h (General_options): Remove leading space from help
2317         messages for -nostdlib and --rosegment.
2318
2319 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
2320
2321         PR ld/15365
2322         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
2323
2324 2013-05-03  Alan Modra  <amodra@gmail.com>
2325
2326         * merge.cc (Output_merge_string::do_add_input_section): Correct
2327         scan for number of strings.  Rename vars to avoid shadowing.
2328         Include missing terminator in input_size_.
2329
2330 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
2331
2332         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
2333         Restore empty string handling.
2334
2335 2013-05-01  Cary Coutant  <ccoutant@google.com>
2336
2337         * stringpool.cc (Stringpool_template::new_key_offset): Fix
2338         uninitialized warning.
2339
2340 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2341
2342         * output.cc (Output_section::add_merge_input_section): Allow
2343         to merge sections if the alignment is more than character size.
2344         * merge.h (Output_merge_string::Output_merge_string): Remove
2345         assert.
2346         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
2347         only not-null strings. Check the alignment of strings.
2348         * stringpool.h
2349         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
2350         alignment as the argument.
2351         (Stringpool_template<Stringpool_char>::addralign_): New class member.
2352         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
2353         Align non-zero length strings according to the addralign_.
2354         (Stringpool_template<Stringpool_char>::set_string_offsets):
2355         Updating offsets according to the given alignment.
2356         * testsuite/Makefile.am (text_section_grouping): Test if string
2357         literals are getting merged.
2358         * testsuite/Makefile.in: Regenerate.
2359         * testsuite/merge_string_literals_1.c: New file.
2360         * testsuite/merge_string_literals_2.c: Ditto.
2361         * testsuite/merge_string_literals.sh: Ditto.
2362
2363 2013-04-26  Ian Lance Taylor  <iant@google.com>
2364
2365         * target-reloc.h (relocate_section): If the reloc offset is out of
2366         range, pass VIEW as NULL to relocate.relocate.
2367         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
2368         * i386.cc (Target_i386::Relocate::relocate): Likewise.
2369         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
2370         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
2371         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
2372         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2373
2374 2013-04-26  Geoff Pike  <gpike@chromium.org>
2375
2376         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
2377         * layout.cc (Hash_task): New class.
2378         (Layout::queue_build_id_tasks): New function.
2379         (Layout::write_build_id): Handle single-thread portion of build ID
2380         computation.  (In some cases, all of it is single-threaded.)  Replace
2381         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
2382         functionality in fewer lines of code.
2383         * layout.h (Layout::queue_build_id_tasks): New function declaration.
2384         * options.h (General_options): make "--build-id" default to tree
2385         rather than sha1.  Add two new options related to --build-id=tree:
2386         --build-id-chunk-size-for-treehash and
2387         --build-id-min-file-size-for-treehash.
2388         * Makefile.am: add testing of --build-id=tree and related new options
2389         (these tests will be invoked by "make check").
2390         * Makefile.in: Regenerate.
2391
2392 2013-04-25  Alan Modra  <amodra@gmail.com>
2393
2394         * configure.tgt: Add powerpcle and powerpc64le.
2395
2396 2013-04-22  Alan Modra  <amodra@gmail.com>
2397
2398         PR gold/15355
2399         * layout.cc (Layout::segment_precedes): Allow more than one
2400         segment with the same type and flags.
2401
2402 2013-04-15  Cary Coutant  <ccoutant@google.com>
2403
2404         * layout.cc (Layout::set_relocatable_section_offsets): Don't
2405         allocate space in file for BSS sections.
2406
2407 2013-04-15  Cary Coutant  <ccoutant@google.com>
2408
2409         * script-sections.cc (Orphan_output_section): Reset address
2410         to zero after each orphaned section for relocatable links.
2411
2412 2013-04-15  Cary Coutant  <ccoutant@google.com>
2413
2414         * symtab.cc (Symbol_table::sized_write_globals): Subtract
2415         section starting address for relocatable link.
2416         * testsuite/Makefile.am (script_test_11): New test.
2417         * testsuite/Makefile.in: Regenerate.
2418         * testsuite/script_test_11.c: New source file.
2419         * testsuite/script_test_11.t: New linker script.
2420
2421 2013-04-13  Alan Modra  <amodra@gmail.com>
2422
2423         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
2424         owner when sections are not adjacent and exceed group size.
2425         (Target_powerpc::group_sections): Handle corner case.
2426         (Target_powerpc::Branch_info::make_stub): Handle case where
2427         stub table doesn't exist due to branches in non-exec sections.
2428         (Target_powerpc::Relocate::relocate): Likewise.
2429
2430 2013-04-11  Alan Modra  <amodra@gmail.com>
2431
2432         PR gold/15354
2433         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
2434         .branch_lt to match bfd ld.  Adjust comments throughout file.
2435
2436 2013-04-04  Ian Lance Taylor  <iant@google.com>
2437
2438         GCC PR c++/56840
2439         * object.cc (do_layout_deferred_sections): Handle .eh_frame
2440         sections before checking whether they are included in the link.
2441
2442 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
2443
2444         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
2445         object before calling the plugin claim_file handler.  Pass the elf
2446         object of the archive to the plugin. Delete the elf object if the
2447         plugin claims the file.
2448
2449 2013-03-21  Alan Modra  <amodra@gmail.com>
2450
2451         * layout.cc (Layout::set_segment_offsets): Accept writable .text
2452         segment when omagic.
2453
2454 2013-03-21  Alan Modra  <amodra@gmail.com>
2455
2456         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
2457         comparison warning.
2458         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
2459         uninitialized" warning.
2460
2461 2013-03-20  Alan Modra  <amodra@gmail.com>
2462
2463         * symtab.h (Symbol::clear_version): New function.
2464         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
2465         is_needed by weak references.  Clear version for symbols defined
2466         in as-needed objects that are not needed.
2467
2468 2013-03-15  Alan Modra  <amodra@gmail.com>
2469
2470         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
2471         static and public.  Add report_err param.  Return false for data refs.
2472         (Target_powerpc::rela_dyn_section): New overloaded function.
2473         (Target_powerpc::plt_, iplt_): Elucidate.
2474         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
2475         (Output_data_plt_powerpc::do_write): Don't write .iplt.
2476         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
2477         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
2478         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
2479         push_branch and make_plt_entry for ifunc syms when
2480         reloc_needs_plt_for_ifunc.
2481         (Target_powerpc::Relocate::relocate): Don't use plt entry value
2482         for ifunc unless reloc_needs_plt_for_ifunc.
2483
2484 2013-03-15  Alan Modra  <amodra@gmail.com>
2485
2486         * gc.h (gc_process_relocs): Don't look through function descriptors.
2487         * icf.cc (get_section_contents): Do so here instead.
2488
2489 2013-03-13  Alan Modra  <amodra@gmail.com>
2490
2491         * powerpc.cc (is_branch_reloc): Forward declare.
2492         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
2493         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
2494         false for 64-bit, true for 32-bit non-branch relocs.
2495         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
2496         * testsuite/Makefile.am (icf_test): Use linker map file instead of
2497         nm output.
2498         (icf_safe_test): Generate linker map file as well as nm output.
2499         (icf_safe_so_test): Likewise.
2500         * testsuite/Makefile.in: Regenerate.
2501         * testsuite/icf_test.sh: Parse linker map file to determine
2502         section folding.
2503         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
2504         * testsuite/icf_safe_so_test.sh: Likewise.
2505         (X86_32_or_ARM_specific_safe_fold): Merge into..
2506         (arch_specific_safe_fold): ..this.
2507         (X86_64_specific_safe_fold): Delete unused function.
2508
2509 2013-03-12  Alan Modra  <amodra@gmail.com>
2510
2511         * gc.h (gc_process_relocs): Look through function descriptors
2512         to determine shndx, symvalue and addend used by ICF.  Tidy
2513         variable duplication.
2514
2515 2013-03-11  Alan Modra  <amodra@gmail.com>
2516
2517         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
2518         * layout.cc (Layout_task_runner::run): ..to here.
2519         * symtab.h (struct Symbol_location): Extract from..
2520         (class Symbol_table): ..here.
2521         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
2522         * target.h (class Target): Add function_location and
2523         do_function_location functions.
2524         (class Sized_target): Add do_function_location.
2525         * object.h (class Sized_relobj_file): Move find_shdr..
2526         (class Object): ..to here.
2527         * object.cc: Likewise.  Update to suit.  Instantiate.
2528         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
2529         * powerpc.cc (class Powerpc_dynobj): New.
2530         (Target_powerpc::do_function_location): New function.
2531         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
2532         (Powerpc_dynobj::do_read_symbols): New function.
2533         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
2534
2535 2013-03-08  Ian Lance Taylor  <iant@google.com>
2536
2537         * options.cc (General_options::string_to_object_format): Accept
2538         "default".
2539
2540 2013-03-08  Alan Modra  <amodra@gmail.com>
2541
2542         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
2543         pointer to Post_fde.
2544         (struct Post_fde): Move definition to here..
2545         * ehframe.cc (struct Post_fde): ..from here.
2546         (Cie::write): Don't alloc Post_fde.
2547         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
2548
2549 2013-03-07  Alan Modra  <amodra@gmail.com>
2550
2551         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
2552         relocation referencing .LC0.
2553         * testsuite/discard_locals_test.sh: Remove FIXMEs.
2554
2555 2013-03-07  Alan Modra  <amodra@gmail.com>
2556
2557         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
2558         always_inline.  Add assembly for powerpc to avoid GOT.
2559
2560 2013-03-07  Alan Modra  <amodra@gmail.com>
2561
2562         * testsuite/script_test_10.sh: Don't test .bss section
2563         header number.
2564
2565 2013-03-06  Alan Modra  <amodra@gmail.com>
2566
2567         * powerpc.cc (class Powerpc_relobj): Move some member functions.
2568         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
2569         all callers.  Handle folded sections.
2570         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
2571         to Powerpc_relobj.
2572         (Global_symbol_visitor_opd::operator()): Likewise.
2573
2574 2013-03-04  Alan Modra  <amodra@gmail.com>
2575
2576         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
2577         * testsuite/Makefile.in: Regenerate.
2578
2579 2013-03-01  Cary Coutant  <ccoutant@google.com>
2580
2581         Add dwp support for v2 DWARF package file format.
2582         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2583         tu_length parameter.  Adjust all callers.
2584         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2585         * dwp.cc: Include dwarf.h.
2586         (Section_bounds): New struct type.
2587         (Unit_set): New struct type.
2588         (Dwo_file::Dwo_file): Initialize new data member.
2589         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2590         Combine and rename to...
2591         (Dwo_file::read_unit_index): ...this.
2592         (Dwo_file::sized_read_compunit_index)
2593         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2594         (Dwo_file::sized_read_unit_index): ...this.
2595         (Dwo_file::copy_section): Remove section_name, is_str_offsets
2596         parameters; add section_id parameter.
2597         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2598         (Dwo_file::add_unit_set): ...this.
2599         (Dwo_file::shndx_map_): Remove.
2600         (Dwo_file::sect_offsets_): New data member.
2601         (Dwp_output_file::Dwp_output_file): Initialize new data members.
2602         (Dwp_output_file::add_section): Rename to...
2603         (Dwp_output_file::add_contribution): ...this.
2604         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2605         (Dwp_output_file::add_tu_set): Likewise.
2606         (Dwp_output_file::Contribution): New type.
2607         (Dwp_output_file::Section::contributions): New data member.
2608         (Dwp_output_file::Cu_or_tu_set): Remove.
2609         (Dwp_output_file::Section::Section): New ctor.
2610         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2611         (Dwp_output_file::Dwp_index::Section_table): New type.
2612         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2613         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2614         parameter.
2615         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2616         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2617         (Dwp_output_file::Dwp_index::section_table): New member function.
2618         (Dwp_output_file::Dwp_index::section_table_end): New member function.
2619         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2620         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2621         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2622         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2623         (Dwp_output_file::Dwp_index::section_table_): New data member.
2624         (Dwp_output_file::Dwp_index::section_mask_): New data member.
2625         (Dwp_output_file::add_output_section): New member function.
2626         (Dwp_output_file::write_new_section): New member function.
2627         (Dwp_output_file::write_contributions): New member function.
2628         (Dwp_output_file::section_id_map_): New data member.
2629         (class Dwo_id_info_reader): Remove.
2630         (class Unit_reader): New class.
2631         (get_dwarf_section_name): New function.
2632         (Dwo_file::read_executable): Adjust initializations of class data.
2633         (Dwo_file::read): Add support for v2 package file format.
2634         (Dwo_file::read_unit_index): Likewise.
2635         (Dwo_file::sized_read_unit_index): Likewise.
2636         (Dwo_file::copy_section): Likewise.
2637         (Dwo_file::add_unit_set): Likewise.
2638         (Dwp_output_file::add_output_section): Likewise.
2639         (Dwp_output_file::add_contribution): Likewise.
2640         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2641         for empty slot.
2642         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2643         file format.
2644         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2645         slot.
2646         (Dwp_output_file::initialize): Remove unused function.
2647         (Dwp_output_file::finalize): Add support for v2 package file format.
2648         (Dwp_output_file::write_index): Likewise.
2649         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2650         function prototype.
2651
2652 2013-03-01  Cary Coutant  <ccoutant@google.com>
2653
2654         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
2655         function into class definition in header file.
2656         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
2657         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
2658         New function.
2659         (Dwarf_info_reader::check_buffer): Move here from .cc file.
2660
2661 2013-02-28  Alan Modra  <amodra@gmail.com>
2662
2663         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
2664         * target.cc (Target::do_plt_fde_location): New function.
2665         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
2666         accessor function, and constructor param.
2667         (struct Post_fde, Post_fdes): Declare.
2668         (Cie::write): Add post_fdes param.
2669         * ehframe.cc (Fde::write): Use plt_fde_location.
2670         (struct Post_fde): Define.
2671         (Cie::write): Stash FDEs added post merge mapping.
2672         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
2673         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
2674         (Eh_frame::do_sized_write): Arrange to write post map FDES after
2675         other FDEs.
2676         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
2677         (Target_powerpc::has_glink): New function.
2678         (Target_powerpc::do_relax): Add eh_frame info for stubs.
2679         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
2680         glink_eh_frame_fde_32, default_fde): New data.
2681         (Stub_table::eh_frame_added_): New var.
2682         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
2683         Make const.
2684         (Stub_table::add_eh_frame): New function.
2685         (Output_data_glink::add_eh_frame): New function.
2686         (Target_powerpc::make_glink_section): Call add_eh_frame.
2687
2688 2013-02-15  Ian Lance Taylor  <iant@google.com>
2689
2690         * options.h (DEFINE_uint64_alias): Define.
2691         (class General_options): Add -Ttext-segment as an alias for
2692         -Ttext.
2693
2694 2013-02-15  Alan Modra  <amodra@gmail.com>
2695
2696         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
2697         (Stub_table::do_write): ..here, two places.
2698         (Stub_table::plt_call_size): Use it here too.
2699
2700 2013-02-11  Ian Lance Taylor  <iant@google.com>
2701
2702         * descriptors.cc (Descriptors::close_all): New function.
2703         * descriptors.h (class Descriptors): Declare close_all.
2704         (close_all_descriptors): New inline function.
2705         * plugin.cc: Include "descriptors.h".
2706         (Plugin_manager::cleanup): Call close_all_descriptors.
2707
2708 2013-02-06  Alan Modra  <amodra@gmail.com>
2709
2710         * README: Update coding style link.
2711
2712 2013-01-28  Cary Coutant  <ccoutant@google.com>
2713
2714         * dwp.cc (File_list): New typedef.
2715         (Dwo_name_info_reader): New class.
2716         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
2717         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
2718         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
2719         (Dwo_file::read_executable): New function.
2720         (Dwo_file::read): Move common setup code to ...
2721         (Dwo_file::make_object): ... here.
2722         (dwp_options): Add --exec/-e.
2723         (usage): Likewise.
2724         (main): Likewise.
2725
2726 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
2727
2728         * layout.cc (Layout::layout): Check for option text_reorder.
2729         (Layout::make_output_section): Ditto.
2730         * options.h (text_reorder): New option.
2731         * output.cc (Input_section_sort_compare): Remove special ordering
2732         of section names.
2733         (Output_section::
2734          Input_section_sort_section_name_special_ordering_compare::
2735          operator()): New function.
2736         (Output_section::sort_attached_input_sections): Use new sort function
2737         for .text.
2738         * output.h (Input_section_sort_section_name_special_ordering_compare):
2739         New struct.
2740         * testsuite/Makefile.am (text_section_grouping): Test option
2741         --no-text-reorder
2742         * testsuite/Makefile.in: Regenerate.
2743         * testsuite/text_section_grouping.sh: Check order of functions without
2744         default text reordering.
2745
2746 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
2747
2748         * options.h (General_options): Change default to true for new_dtags.
2749
2750 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
2751
2752         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
2753         when enable_new_dtags is false.  Only add DT_RUNPATH when
2754         enable_new_dtags is true.
2755
2756 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
2757
2758         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
2759         used in declaration and definition consistent.
2760         (Target_powerpc::symval_for_branch): Ditto.
2761
2762 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
2763
2764         * testsuite/plugin_final_layout.cc: Fix comment.
2765
2766 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
2767
2768         * layout.cc (Layout::layout): Do not do default sorting for
2769         text sections when section ordering is specified.
2770         (make_output_section): Ditto.
2771         * testsuite/plugin_final_layout.cc: Name the function sections
2772         to catch reordering issues.
2773
2774 2013-01-15  Alan Modra  <amodra@gmail.com>
2775
2776         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
2777         plt-thread-safe.
2778
2779 2013-01-15  Alan Modra  <amodra@gmail.com>
2780
2781         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
2782         * testsuite/Makefile.in: Regenerate.
2783
2784 2013-01-14  Alan Modra  <amodra@gmail.com>
2785
2786         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
2787         * testsuite/Makefile.in: Regenerate.
2788
2789 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
2790
2791         PR bfd/14430
2792         Fix mingw gold build with plugins enabled
2793         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
2794         * configure.ac: Export DLOPEN_LIBS and add headers check.
2795         * plugin.cc: Handle non-dlfcn case.
2796         * Makefile.in: Regenerate.
2797         * config.in: Regenerate.
2798         * configure: Regenerate.
2799         * testsuite/Makefile.in: Regenerate.
2800
2801 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
2802
2803         * output.h (sort_attached_input_sections): Change to be public.
2804         * script-sections.cc
2805         (Output_section_definition::set_section_addresses): Sort
2806         attached input sections according to section order before linker
2807         script assigns section addresses.
2808         (Orphan_output_section::set_section_addresses): Sort
2809         attached input sections according to section order before linker
2810         script assigns section addresses.
2811         * Makefile.am (final_layout.sh): Use a simple linker script to
2812         check if section ordering still works.
2813         * Makefile.in: Regenerate.
2814
2815 2013-01-09  Ben Cheng  <bccheng@google.com>
2816
2817         * arm.cc (Target_arm::attributes_accept_div): New function.
2818         (Target_arm::attributes_forbid_div): New function.
2819         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
2820         attribute using the same new functions as what bfd/elf32_arm.c
2821         does.
2822
2823 2013-01-07  Cary Coutant  <ccoutant@google.com>
2824
2825         PR gold/14993
2826         * output.cc (Output_section::add_input_section): For incremental
2827         updates, don't track input sections that are allocated from patch
2828         space.
2829
2830 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
2831             Ian Lance Taylor  <iant@google.com>
2832
2833         PR gold/14897
2834         * configure.ac (--enable-ld): Removed.
2835         (install_as_default): Set to yes only for --enable-gold=default
2836         or --disable-ld.
2837         * configure: Regenerated.
2838
2839 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
2840
2841         * options.h (General_options): Add -fuse-ld= for GCC linker
2842         option compatibility.
2843
2844 2013-01-04  Cary Coutant  <ccoutant@google.com>
2845
2846         * configure.ac: Fix typo restoring CXXFLAGS.
2847         * configure: Regenerate.
2848
2849 2013-01-04  Cary Coutant  <ccoutant@google.com>
2850
2851         * testsuite/Makefile.am (CXXLINK_S): New macro.
2852         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
2853         * testsuite/Makefile.in: Regenerate.
2854
2855 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
2856
2857         * version.cc (print_version): Update copyright year to 2013.
2858
2859 2012-12-20  Ian Lance Taylor  <iant@google.com>
2860
2861         * layout.cc (Layout::special_ordering_of_input_section): New
2862         function.
2863         (Layout::layout): If input section requires special ordering, must
2864         sort input sections.
2865         (Layout::make_output_section): May sort .text input sections.
2866         (Layout::is_section_name_prefix_grouped): Remove.
2867         * layout.h (class Layout): Declare
2868         special_ordering_of_input_section.  Don't declare
2869         is_section_name_prefix_grouped.
2870         * output.cc (Output_section::add_input_section): Revert last
2871         change.
2872         (Output_section::Input_section_sort::match_file_name): Don't crash
2873         if called on output section data.
2874         (Output_section::Input_section_sort_compare): Sort based on
2875         special ordering.
2876         (Output_section::Input_section_sort_section_order_index_compare):
2877         Revert last patch.
2878         (Output_section::sort_attached_input_sections): Likewise.
2879
2880 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
2881
2882         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
2883         * layout.h (Layout::is_section_name_prefix_grouped): New function.
2884         * output.cc (Output_section::add_input_section): Check if section
2885         name contains special prefix.  Keep input sections to sort such
2886         sections.
2887         (Output_section::Input_section_sort_section_order_index_compare
2888          ::operator()): Group sections according to prefixes.
2889         (Output_section::sort_attached_input_sections): Add condition to
2890         Input_section_entry constructor call.
2891         * testsuite/Makefile.am (text_section_grouping): New test.
2892         * testsuite/Makefile.in: Regenerate.
2893         * testsuite/text_section_grouping.cc: New file.
2894         * testsuite/text_section_grouping.sh: New file.
2895
2896 2012-12-17  Nick Clifton  <nickc@redhat.com>
2897
2898         * Makefile.am: Add copyright notice.
2899         * NEWS: Likewise.
2900         * README: Likewise.
2901         * configure.ac: Likewise.
2902         * ftruncate.c: Likewise.
2903         * Makefile.in: Regenerate.
2904
2905 2012-12-14  Cary Coutant  <ccoutant@google.com>
2906
2907         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
2908         --no-as-needed flag.
2909         (exception_separate_shared_12_test): Likewise.
2910         (incremental_copy_test): Likewise.
2911         * testsuite/Makefile.in: Regenerate.
2912
2913 2012-12-14  Cary Coutant  <ccoutant@google.com>
2914
2915         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
2916         (Dwp_output_file::Dwp_index::enter_set): Add assert.
2917
2918 2012-12-12  Alan Modra  <amodra@gmail.com>
2919
2920         * powerpc.cc (class Track_tls): New.
2921         (class Relocate, class Scan): Inherit Track_tls.
2922         (Target_powerpc::Scan::local, global): Track tls optimization
2923         and avoid creating plt entry for __tls_get_addr if all uses
2924         are optimized away.
2925         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
2926
2927 2012-12-12  Alan Modra  <amodra@gmail.com>
2928
2929         * options.h (General_options): Add --toc-sort/--no-toc-sort.
2930         Replace no_toc_optimize with toc_optimize.
2931         * output.h (Output_section::input_sections): Provide non-const variant.
2932         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
2933         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
2934         accessors.
2935         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
2936         (class Sort_toc_sections): New.
2937         (Target_powerpc::do_finalize_sections): Sort toc sections.
2938         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
2939
2940 2012-12-10  Roland McGrath  <mcgrathr@google.com>
2941
2942         * testsuite/binary_unittest.cc (read_all): New function.
2943         (Sized_binary_test): Use it instead of ::read.
2944         * fileread.cc (do_read): Don't assume pread always reads the whole
2945         amount in a single call.
2946
2947 2012-12-10  Alan Modra  <amodra@gmail.com>
2948
2949         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
2950         Set EM_PPC64 or EM_PPC here.
2951         (Target_selector_powerpc::do_recognize): Delete.
2952
2953 2012-12-10  Alan Modra  <amodra@gmail.com>
2954
2955         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
2956         stub_table_.
2957         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
2958
2959 2012-12-07  Roland McGrath  <mcgrathr@google.com>
2960
2961         * testsuite/binary_unittest.cc (Sized_binary_test):
2962         Use open_descriptor rather than ::open.
2963
2964 2012-12-07  Alan Modra  <amodra@gmail.com>
2965
2966         * powerpc.cc (Stub_table::do_write): Delete redundant Address
2967         typedef and invalid_address constant.
2968         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2969         instantiate constants.
2970
2971 2012-12-06  Roland McGrath  <mcgrathr@google.com>
2972
2973         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2974         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2975         * aclocal.m4: Regenerate.
2976         * configure: Regenerate.
2977         * Makefile.in: Regenerate.
2978         * testsuite/Makefile.in: Regenerate.
2979
2980 2012-12-07  Alan Modra  <amodra@gmail.com>
2981
2982         * options.h (General_options): Add no_toc_optimize.
2983         * powerpc.cc (ok_lo_toc_insn): New function.
2984         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2985
2986 2012-12-06  Alan Modra  <amodra@gmail.com>
2987
2988         * options.h (General_options): Add plt_align, plt_static_chain,
2989         plt_thread_safe.  Update stub_group_size help text.
2990         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2991         for new plt_thread_safe_ var.
2992         (use_plt_offset): Correct comments.
2993         (Target_powerpc::do_relax): Look for thread creation symbols to
2994         determine default plt_thread_safe value.  Clear plt call stubs
2995         as well as branch stubs each iteration.
2996         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2997         insn constants.
2998         (l, hi, ha, write_insn): Move earlier.
2999         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
3000         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
3001         plt stubs too.
3002         (Stub_table::update_size): Adjust.
3003         (Stub_table::prev_size, set_prev_size): Delete.
3004         (Stub_table::stub_align): Let --plt-align affect result.
3005         (Stub_table::plt_call_size): Calculate sizes for various stubs.
3006         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
3007         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
3008         (Stub_table::do_write): Support more stub variants.
3009
3010 2012-12-04  Alan Modra  <amodra@gmail.com>
3011
3012         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
3013         (Target_powerpc::do_define_standard_symbols): New function.
3014
3015 2012-12-03  Alan Modra  <amodra@gmail.com>
3016
3017         * output.h: Formatting, whitespace.
3018
3019 2012-12-03  Alan Modra  <amodra@gmail.com>
3020
3021         * layout.h (Layout::get_executable_sections): Declare.
3022         * layout.cc (Layout::get_executable_sections): New function.
3023         * arm.cc (Target_arm::group_sections): Use it.
3024         (Arm_output_section::group_sections): Delete now redundant test.
3025         * output.cc (Output_reloc::Output_reloc): Add is_relative.
3026         param to handle relative relocs.
3027         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
3028         (Output_data_reloc::add_absolute): Adjust.
3029         (Output_data_reloc::add_relative): New function.
3030         (Output_data::reset_data_size): New function.
3031         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
3032         (Output_section::set_addralign): New function.
3033         (Output_section::checkpoint_set_addralign): New function.
3034         (Output_section::clear_section_offsets_need_adjustment): New function.
3035         (Output_section::input_sections): Make public.
3036         * powerpc.cc (class Output_data_brlt_powerpc): New.
3037         (class Stub_table, class Stub_control): New.
3038         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
3039         stub_table_, set_stub_table, stub_table): New vectors and accessor
3040         functions.
3041         (Target_powerpc::do_may_relax, do_relax, push_branch,
3042         new_stub_table, stub_tables, brlt_section, group_sections,
3043         add_branch_lookup_table, find_branch_lookup_table,
3044         write_branch_lookup_table, make_brlt_section): New functions.
3045         (Target_powerpc::struct Sort_sections, class Branch_info): New.
3046         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
3047         branch_info_): New vars.
3048         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
3049         make call stubs here.
3050         (Output_data_glink): Remove all call stub handling from this class.
3051         (Target_powerpc::Scan::local, global): Save interesting branch
3052         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
3053         (Target_powerpc::do_finalize_sections): Only make reg save/restore
3054         functions on final link.
3055         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
3056         Handle long branch destinations too.
3057         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
3058         do_plt_address_for_local): Adjust lookup of plt call stubs.
3059
3060 2012-11-30  Alan Modra  <amodra@gmail.com>
3061
3062         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
3063         relocs against protected symbols when building 32-bit shared libs.
3064
3065 2012-11-30  Alan Modra  <amodra@gmail.com>
3066
3067         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
3068         param.  Call got_section() to make .got.  Update all callers
3069         and their callers and so on.
3070
3071 2012-11-30  Alan Modra  <amodra@gmail.com>
3072
3073         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
3074         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
3075         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
3076         value if it already exists.
3077
3078 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
3079
3080         PR gold/14858
3081         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
3082
3083 2012-11-14  Roland McGrath  <mcgrathr@google.com>
3084
3085         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
3086         than bfc instruction for data sandboxing.
3087
3088 2012-11-08  Alan Modra  <amodra@gmail.com>
3089
3090         * po/POTFILES.in: Regenerate.
3091
3092 2012-11-05  Alan Modra  <amodra@gmail.com>
3093
3094         * configure.ac: Apply 2012-09-10 change to config.in here.
3095         * configure: Regenerate.
3096
3097 2012-11-05  Alan Modra  <amodra@gmail.com>
3098
3099         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
3100         (struct Opd_ent): Use "Address" rather than "Offset".
3101         (Output_data_got_powerpc::got_base_offset): Return Valtype.
3102         (Target_powerpc::got_section): Make public.
3103         (Target_powerpc::scan_relocs): Move code setting symbols..
3104         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
3105         Create _SDA_BASE_ only when referenced.
3106
3107 2012-11-02  Roland McGrath  <mcgrathr@google.com>
3108
3109         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
3110         from last change.
3111
3112 2012-11-01  Roland McGrath  <mcgrathr@google.com>
3113
3114         * target.h (Sized_target::relocate_relocs): Use Elf_Off
3115         for offset_in_output_section parameter.
3116         (Sized_target::relocate_special_relocatable): Likewise.
3117         * arm.cc (Target_arm::relocate_relocs): Likewise.
3118         (Target_arm::relocate_special_relocatable): Likewise.
3119         * i386.cc (Target_i386::relocate_relocs): Likewise.
3120         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
3121         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
3122         * target-reloc.h (relocate_relocs): Likewise.
3123         * testsuite/testfile.cc (Target_test): Likewise.
3124         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
3125         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
3126
3127         * system.h: Move inclusion of <clocale> to after <libintl.h> in
3128         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
3129
3130         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
3131         parameter, which is unused in the [!F_SETFD] case.
3132
3133         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
3134         SYMNDX to off_t before comparing it to this->data_size().
3135         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
3136         * incremental.cc (Output_section_incremental_inputs::do_write):
3137         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
3138
3139         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
3140
3141 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
3142
3143         * gold.cc (Target_arm::do_adjust_elf_header): Add the
3144         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
3145         in EABI_VER5.
3146
3147 2012-10-29  Cary Coutant  <ccoutant@google.com>
3148
3149         * dwp.cc (usage): Add file and exit status parameters;
3150         add --help and --version options.
3151         (print_version): New function.
3152         (main): Add --help and --version options.
3153
3154 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3155
3156         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
3157         final_layout_sequence.txt.
3158         * testsuite/Makefile.in: Regenerated.
3159
3160 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3161
3162         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
3163         COMPILE generated by automake.
3164         (LINK1): Likewise.
3165         (CXXCOMPILE1): Likewise.
3166         (CXXLINK1): Likewise.
3167         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
3168         (LINK): Likewise.
3169         (CXXCOMPILE): Likewise.
3170         (CXXLINK): Likewise.
3171         * testsuite/Makefile.in: Regenerated.
3172
3173 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3174
3175         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
3176         on bad fwrite return.
3177
3178 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3179
3180         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
3181         on val.
3182
3183 2012-10-23  Cary Coutant  <ccoutant@google.com>
3184
3185         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
3186         * testsuite/Makefile.in: Regenerate.
3187         * testsuite/dwp_test.h: New source file.
3188         * testsuite/dwp_test_1.cc: New source file.
3189         * testsuite/dwp_test_1.s: New source file.
3190         * testsuite/dwp_test_1.sh: New source file.
3191         * testsuite/dwp_test_1b.cc: New source file.
3192         * testsuite/dwp_test_1b.s: New source file.
3193         * testsuite/dwp_test_2.cc: New source file.
3194         * testsuite/dwp_test_2.s: New source file.
3195         * testsuite/dwp_test_2.sh: New source file.
3196         * testsuite/dwp_test_main.cc: New source file.
3197         * testsuite/dwp_test_main.s: New source file.
3198
3199 2012-10-23  Cary Coutant  <ccoutant@google.com>
3200
3201         * dwp.h: New header file.
3202         * dwp.cc: New source file.
3203         * gold.h: Move shared declarations to system.h.
3204         * system.h: New header file.
3205         * Makefile.am: Add dwp.
3206         * Makefile.in: Regenerate.
3207
3208 2012-10-23  Cary Coutant  <ccoutant@google.com>
3209
3210         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
3211         Dwarf_info_reader::read_from_pointer.
3212         (Dwarf_pubnames_table::read_header): Likewise.
3213         (Dwarf_pubnames_table::next_name): Likewise.
3214         (Dwarf_die::read_attributes): Likewise.
3215         (Dwarf_die::skip_attributes): Likewise.
3216         (Dwarf_info_reader::read_from_pointer): New function template.
3217         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
3218         (Dwarf_pubnames_table): Likewise.
3219         (Dwarf_info_reader::read_from_pointer): New function template.
3220         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
3221         Dwarf_pubnames_table ctor.
3222
3223 2012-10-23  Cary Coutant  <ccoutant@google.com>
3224
3225         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
3226         abbrev_shndx.
3227         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
3228         abbrev_shndx_.
3229         (Dwarf_info_reader::set_abbrev_shndx): New method.
3230         (Dwarf_info_reader::abbrev_shndx_): New data member.
3231
3232 2012-10-23  Cary Coutant  <ccoutant@google.com>
3233
3234         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
3235         from object, not parameters.
3236         (Dwarf_info_reader::parse): Likewise.
3237         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
3238         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
3239         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
3240         methods.
3241
3242 2012-10-23  Cary Coutant  <ccoutant@google.com>
3243
3244         * fileread.cc (Input_file::Input_file): New constructor.
3245         * fileread.h (class Input_file): Add new constructor.
3246
3247 2012-10-18  Alan Modra  <amodra@gmail.com>
3248
3249         PR gold/14727
3250         * object.cc (Relobj::is_section_name_included): Also match
3251         .sdata personality section.
3252
3253 2012-10-18  Alan Modra  <amodra@gmail.com>
3254
3255         * target-reloc.h (class Default_comdat_behavior): New, package up..
3256         (get_comdat_behaviour): ..this.
3257         (relocate_section): Add Relocate_comdat_behavior template arg,
3258         adjust code to suit.
3259         * arm.cc (Target_arm::relocate_section): Adjust to suit.
3260         (Target_arm::scan_reloc_section): Likewise.
3261         * i386.cc (Target_i386::relocate_section): Likewise.
3262         * sparc.cc (Target_sparc::relocate_section): Likewise.
3263         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
3264         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
3265         * powerpc.cc (class Relocate_comdat_behavior): New.
3266         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
3267         gold::relocate_section with new template arg.
3268
3269 2012-10-18  Alan Modra  <amodra@gmail.com>
3270
3271         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
3272         dynamic relocs for GOT_TPREL got entries, without symbol if
3273         resolving locally.
3274         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
3275         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
3276         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
3277
3278 2012-10-17  Alan Modra  <amodra@gmail.com>
3279
3280         PR gold/14726
3281         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
3282
3283 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
3284
3285         * layout.cc (Layout::include_section): Keep sections marked
3286         SHF_EXCLUDE when doing relocatable links.
3287
3288 2012-10-16  Alan Modra  <amodra@gmail.com>
3289
3290         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
3291         (Target_powerpc::do_finalize_sections): Call it.
3292         (Output_data_save_res): New class and supporting functions.
3293         (Target_powerpc::symval_for_branch): Only look up .opd entry for
3294         normal symbols defined in object files.
3295
3296 2012-10-12  Alan Modra  <amodra@gmail.com>
3297
3298         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
3299         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
3300         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
3301         section if scan_opd_relocs not yet called.
3302         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
3303
3304 2012-10-12  Alan Modra  <amodra@gmail.com>
3305
3306         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3307         add_local_ifunc_entry): Revert last change.
3308         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
3309
3310 2012-10-05  Alan Modra  <amodra@gmail.com>
3311
3312         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
3313         do_plt_address_for_global): New functions.
3314         (Output_data_got_powerpc::do_write): Don't segfault when linking
3315         statically.
3316         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3317         add_local_ifunc_entry): Return true on adding entry..
3318         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
3319         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
3320         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
3321         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
3322         set up symbols here.
3323         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
3324         syms here.  Do so even when no .iplt.  Don't segfault when linking
3325         statically.
3326         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
3327         new variants without reloc param.
3328         (Glink_sym_ent::Glink_sym_ent): Likewise.
3329         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
3330         reloc when refs will resolve to plt call stub.
3331         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
3332         R_PPC_PLTREL24 to resolve locally.
3333         (Target_powerpc::Scan::global): Correct ifunc handling.
3334         (Target_powerpc::Relocate::relocate): Correct local sym glink
3335         lookup.  Don't destroy "value" when we have a plt call stub,
3336         and when checking plt call validity.
3337         (Target_powerpc::do_dynsym_value): Simplify.
3338
3339 2012-10-05  Alan Modra  <amodra@gmail.com>
3340
3341         * i386.cc (Output_data_plt_i386::address_for_global,
3342         address_for_local): Add plt offset to returned value.  Adjust uses.
3343         * sparc.cc (Output_data_plt_sparc::address_for_global,
3344         address_for_local): Likewise.
3345         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
3346         address_for_local): Likewise.
3347         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
3348         address_for_local): Likewise.
3349         * target.h (Target::plt_address_for_global, plt_address_for_local):
3350         Update comment.
3351         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
3352         (Output_data_got::Got_entry::write): Nor here.
3353         * output.h: Comment fix.
3354
3355 2012-10-02  Jiong Wang  <jiwang@tilera.com>
3356
3357         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
3358         global_offset_table_ value for larget got.
3359         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
3360
3361 2012-09-29  Alan Modra  <amodra@gmail.com>
3362
3363         * powerpc.cc (Target_powerpc::iplt_): New output section.
3364         (Target_powerpc::iplt_section, make_iplt_section,
3365         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
3366         (Target_powerpc::make_plt_entry): Handle ifunc syms.
3367         Target_powerpc::plt_entry_count): Count iplt entries too.
3368         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
3369         reloc section in constructor.  New params.
3370         (Target_powerpc::make_plt_section): Create reloc section here instead.
3371         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
3372         functions.
3373         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
3374         (Output_data_glink::add_entry, find_entry): New functions to
3375         deal with local syms.
3376         (Glink_sym_ent): Add support for local syms.
3377         (Output_data_glink::do_write): Handle ifunc plt entries.
3378         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3379         (Target_powerpc::Scan::local, global): Handle ifunc syms.
3380         (Target_powerpc::Relocate::relocate): Likewise.
3381         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
3382
3383 2012-09-25  Alan Modra  <amodra@gmail.com>
3384
3385         * object.h (Sized_relobj_file::adjust_local_symbol,
3386         do_adjust_local_symbol): New functions.
3387         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
3388         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
3389         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
3390         and irregular opd entry spacing.
3391         (Powerpc_relobj::do_read_relocs): Add opd size checks.
3392         (Global_symbol_visitor_opd): New functor.
3393         (Target_powerpc::do_finalize_sections): Omit global symbols defined
3394         on deleted opd entries.
3395
3396 2012-09-15  Jiong Wang  <jiwang@tilera.com>
3397
3398         * tilegx.cc: New file.
3399         * Makefile.am (TARGETSOURCES): Add tilegx.cc
3400         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
3401         * configure.tgt: Add entries for tilegx*.
3402         * configure.ac: Likewise.
3403         * Makefile.in: Rebuild.
3404         * configure: Likewise.
3405         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
3406         tilegx.
3407
3408 2012-09-13  Alan Modra  <amodra@gmail.com>
3409
3410         * target-reloc.h (scan_relocs): Call scan.local for relocs
3411         against symbols in discarded sections.  Pass is_discarded
3412         param.
3413         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
3414         Add is_discarded param.
3415         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
3416         is_discarded to flag opd entry as discarded.  Don't emit dyn
3417         relocs on such entries.
3418         (Target_powerpc::Scan::global): Similarly detect and handle
3419         such opd entries.
3420         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
3421         opd_ent_.  Update all uses.
3422         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
3423         (Target_powerpc::relocate_section): Zero out discarded opd
3424         entry relocs.
3425
3426 2012-09-12  Ian Lance Taylor  <iant@google.com>
3427
3428         PR gold/14570
3429         * output.cc: Rename Output_data_got template parameter from size
3430         to got_size for all functions.  Compile all variants of
3431         Output_data_got.
3432         (Output_data_got::Got_entry::write): Correct use of size for
3433         symbol value.  Use local_is_tls rather than casting to
3434         Sized_relobj_file.
3435         * object.h (class Object): Add local_is_tls and do_local_is_tls.
3436         (class Sized_relobj_file): Add do_local_is_tls.
3437         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
3438
3439 2012-09-11  Alan Modra  <amodra@gmail.com>
3440
3441         PR gold/14566
3442         * layout.cc (Layout::set_segment_offsets): When using
3443         common-page-size alignment, ensure we are on a new max-page-size
3444         page.
3445         * output.cc (Output_segment::set_section_addresses): Use
3446         abi_pagesize, not common_pagesize for relro boundary.
3447         (Output_segment::set_offset): Likewise.
3448
3449 2012-09-11  Alan Modra  <amodra@gmail.com>
3450
3451         * output.h (Output_data_got::add_global_tls, add_local_tls,
3452         add_local_tls_pair): New functions.
3453         (Output_data_got::add_local_pair_with_rel): Remove second
3454         reloc param.  Expand comment.
3455         (Output_data_got::Got_entry): Rename use_plt_offset_ to
3456         use_plt_or_tls_offset_, similarly for constructor param.
3457         (Output_data_got::Got_entry::write): Add got_index param.
3458         * output.cc (Output_data_got::add_global_tls, add_local_tls,
3459         add_local_tls_pair): New functions.
3460         (Output_data_got::Got_entry::write): Handle tls symbols
3461         with use_plt_or_tls_offset_ set specially.
3462         (Output_data_got::add_local_pair_with_rel): Only one reloc.
3463         (Output_data_got::do_write): Replace iterator with index, pass
3464         index to entry write function.
3465         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
3466         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
3467         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
3468         call.
3469         * i386.cc (Target_i386::Scan::local): Likewise.
3470         * sparc.cc (Target_sparc::Scan::local): Likewise.
3471         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
3472         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
3473         do_tls_offset_for_global): New functions.
3474         (Target_powerpc::Scan::local): Correct TLS relocations and got
3475         entry values.
3476         (Target_powerpc::Scan::global): Don't emit unnecessary
3477         dynamic relocations on TLS GOT entries.
3478
3479 2012-09-10  Matthias Klose  <doko@ubuntu.com>
3480
3481         * config.in: Disable sanity check for kfreebsd.
3482
3483 2012-09-10  Sterling Augustine  <saugustine@google.com>
3484
3485         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
3486         (Gdb_index::pubtypes_read): New parameter.
3487         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
3488         to calls.
3489         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
3490         pubtypes_object_.
3491
3492 2012-09-09  Alan Modra  <amodra@gmail.com>
3493
3494         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
3495         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
3496         * gc.h (gc_process_relocs): Call target gc_add_reference.
3497         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
3498         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
3499         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
3500         unnecessary cast.
3501         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
3502         to cater for when we don't need code offset.  Update use.
3503         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
3504         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
3505         set_opd_valid): New functions.
3506         (Target_powerpc::do_gc_add_reference): New function.
3507         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
3508         stashed refs.
3509         (Target_powerpc::do_gc_mark_symbol): New function.
3510
3511 2012-09-06  Cary Coutant  <ccoutant@google.com>
3512
3513         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
3514         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
3515         (Dwarf_die::skip_attributes): Likewise.
3516         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
3517         * testsuite/gdb_index_test.cc (inline_func_1): New function.
3518         (main): Call it.
3519         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
3520
3521 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
3522
3523         * testsuite/script_test_3.t: Add .got.plt output section
3524         statement.
3525         * testsuite/script_test_4.t: Likewise.
3526
3527 2012-09-05  Alan Modra  <amodra@gmail.com>
3528
3529         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
3530         update all uses and lose "enum" when using type.
3531
3532 2012-09-05  Alan Modra  <amodra@gmail.com>
3533
3534         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
3535         * configure: Regenerate.
3536         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
3537         (plugin_final_layout.stdout): Likewise.
3538         (memory_test): Set page sizes to 0x1000.
3539         * testsuite/Makefile.in: Regenerate.
3540         * testsuite/discard_locals_test.sh: Add FIXME comment.
3541         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
3542         * testsuite/pr14265.t: Add .got output section statement.
3543         * testsuite/script_test_2.t: Likewise.
3544         * testsuite/script_test_3.t: Likewise.
3545         * testsuite/script_test_4.t: Likewise.
3546         * testsuite/script_test_5.t: Likewise.
3547         * testsuite/script_test_6.t: Likewise.
3548         * testsuite/script_test_7.t: Likewise.
3549         * testsuite/script_test_9.t: Likewise.
3550
3551 2012-09-05  Alan Modra  <amodra@gmail.com>
3552
3553         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
3554         (Powerpc_relocate_functions::Status): New typedef.
3555         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3556         (Target_powerpc::Scan::local): Handle REL64.
3557         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
3558         for REL32 and REL64.
3559         (Target_powerpc::symval_for_branch): New function, extracted from..
3560         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
3561         checks.  Report overflow errors.
3562
3563 2012-09-05  Alan Modra  <amodra@gmail.com>
3564
3565         * object.h (Sized_relobj_file::emit_relocs): Delete.
3566         (Sized_relobj_file::emit_relocs_reltype): Delete.
3567         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
3568         relocate_relocs for --emit-relocs.
3569         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
3570         * output.h: Update comment.
3571         (Output_segment::first_section): New function.
3572         (Output_segment::first_section_load_address): Use first_section.
3573         * output.cc (Output_segment::first_section): New function extracted..
3574         (Output_segment::first_section_load_address): ..from here.  Delete.
3575         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
3576         * target.h (Sized_target::relocate_for_relocatable): Likewise.
3577         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
3578         adjust call to target.h function.
3579         * i386.cc (Target_i386): Likewise.
3580         * sparc.cc (Target_sparc): Likewise.
3581         * x86_64.cc (Target_x86_64): Likewise.
3582         * powerpc.cc (Target_powerpc): Likewise.
3583         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
3584         first tls section has section symbol for optimised local dynamic
3585         output relocs.
3586         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
3587         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
3588         optimised tls code.
3589         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
3590         Rename to relocate_relocs.  Update error message.
3591
3592 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
3593
3594         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
3595         --just-symbols.
3596
3597 2012-08-31  Alan Modra  <amodra@gmail.com>
3598
3599         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
3600         (Powerpc_relobj::toc_base_offset): New stub function.
3601         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
3602         got_mod_index_offset to tlsld_got_offset.  Update all refs.
3603         (Target_powerpc::Relocate::enum skip_tls): New.
3604         (Target_powerpc::call_tls_get_addr_): New var.
3605         (Target_powerpc::is_branch_reloc): Move to file scope.
3606         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
3607         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
3608         New functions.
3609         (Target_powerpc::enum Got_type): Delete old values, add new ones.
3610         (powerpc_info): Correct common_pagesize for ppc64.
3611         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
3612         (Powerpc_relocate_functions): Add overflow check enums and functions.
3613         Add non-shift version of rela, rela_ua.  Delete all rel public
3614         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
3615         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
3616         addr16_ha3, addr14 functions.
3617         (Output_data_got_powerpc::add_constant_pair): New function.
3618         (Output_data_got_powerpc::got_base_offset): Likewise.
3619         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
3620         (instruction constants): Sort, add some more.
3621         (Output_data_glink::do_write): Add and use Address typedef.  Use
3622         object->toc_base_offset() stub for 64-bit.
3623         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
3624         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3625         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
3626         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
3627         Always treat .opd relocs as against locally defined symbol.
3628         Correct condition for RELATIVE relocs.
3629         (Target_powerpc::do_finalize_sections): Test for NULL sections.
3630         (Target_powerpc::Relocate::relocate): Use plt call stub as value
3631         for 32-bit syms with a plt entry.  Correct ppc64 toc base
3632         calculations.  Handle TLS relocs, and more.  Add overflow
3633         checking and adjust for Powerpc_relocate_functions changes.
3634         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
3635         Reinstate --emit-relocs code with FIXME.
3636
3637 2012-08-30  Alan Modra  <amodra@gmail.com>
3638
3639         * layout.cc (Layout::set_segment_offsets): Set p_align to
3640         abi_pagesize, not common_pagesize.
3641         (Layout::relaxation_loop_body): Similarly use abi_pagesize
3642         to determine whether file header can go in segment.
3643
3644 2012-08-30  Alan Modra  <amodra@gmail.com>
3645
3646         * output.h (Output_reloc::Output_reloc <output section>): Add
3647         is_relative param.  Adjust calls.
3648         (Output_reloc::add_output_section_relative): New functions.
3649         * output.cc (Output_reloc::Output_reloc <output section>): Handle
3650         is_relative.
3651         (Output_reloc::symbol_value): Handle SECTION_CODE.
3652
3653 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
3654
3655         * gold.cc (queue_middle_tasks): Call layout again when unique
3656         segments for sections is desired.
3657         * layout.cc (Layout::Layout): Initialize new members.
3658         (Layout::get_output_section_flags): New function.
3659         (Layout::choose_output_section): Call get_output_section_flags.
3660         (Layout::layout): Make output section for mapping to a unique segment.
3661         (Layout::insert_section_segment_map): New function.
3662         (Layout::attach_allocated_section_to_segment): Make unique segment for
3663         output sections marked so.
3664         (Layout::segment_precedes): Check for unique segments when sorting.
3665         * layout.h (Layout::Unique_segment_info): New struct.
3666         (Layout::Section_segment_map): New typedef.
3667         (Layout::insert_section_segment_map): New function.
3668         (Layout::get_output_section_flags): New function.
3669         (Layout::is_unique_segment_for_sections_specified): New function.
3670         (Layout::set_unique_segment_for_sections_specified): New function.
3671         (Layout::unique_segment_for_sections_specified_): New member.
3672         (Layout::section_segment_map_): New member.
3673         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
3674         Rename is_gc_pass_one to is_pass_one.
3675         Rename is_gc_pass_two to is_pass_two.
3676         Rename is_gc_or_icf to is_two_pass.
3677         Check for which pass based on whether symbols data is present.
3678         Make it two pass when unique segments for sections is desired.
3679         * output.cc (Output_section::Output_section): Initialize new
3680         members.
3681         * output.h (Output_section::is_unique_segment): New function.
3682         (Output_section::set_is_unique_segment): New function.
3683         (Output_section::is_unique_segment_): New member.
3684         (Output_section::extra_segment_flags): New function.
3685         (Output_section::set_extra_segment_flags): New function.
3686         (Output_section::extra_segment_flags_): New member.
3687         (Output_section::segment_alignment): New function.
3688         (Output_section::set_segment_alignment): New function.
3689         (Output_section::segment_alignment_): New member.
3690         (Output_segment::Output_segment): Initialize is_unique_segment_.
3691         (Output_segment::is_unique_segment): New function.
3692         (Output_segment::set_is_unique_segment): New function.
3693         (Output_segment::is_unique_segment_): New member.
3694         * plugin.cc (allow_unique_segment_for_sections): New function.
3695         (unique_segment_for_sections): New function.
3696         (Plugin::load): Add new functions to transfer vector.
3697         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
3698         * Makefile.in: Regenerate.
3699         * testsuite/plugin_final_layout.sh: Check if unique segment
3700         functionality works.
3701         * testsuite/plugin_section_order.c (onload): Check if new interfaces
3702         are available.
3703         (allow_unique_segment_for_sections): New global.
3704         (unique_segment_for_sections): New global.
3705         (claim_file_hook): Call allow_unique_segment_for_sections.
3706         (all_symbols_read_hook): Call unique_segment_for_sections.
3707
3708 2012-08-22  Cary Coutant  <ccoutant@google.com>
3709
3710         * layout.cc (Layout::include_section): Don't assert on GROUP
3711         sections with --emit-relocs.
3712
3713 2012-08-21  Cary Coutant  <ccoutant@google.com>
3714
3715         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
3716         if --export-dynamic-symbol names an undef symbol.
3717
3718 2012-08-18  Alan Modra  <amodra@gmail.com>
3719
3720         * powerpc.cc: Formatting and white space.
3721         (Powerpc_relobj): Rename got2_section_ to special_.
3722         Add opd_ent_shndx_ and opd_ent_off_ vectors.
3723         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
3724         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
3725         (Target_powerpc): Add Address typedef and invalid_address.  Use
3726         throughout.
3727         (Target_powerpc::is_branch_reloc): New function.
3728         (Powerpc_relocate_functions): Add Address typedef, use throughout.
3729         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
3730         for dst_mask, value and addend.
3731         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
3732         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
3733         (Output_data_glink::do_write): Correct toc base.  Don't try to use
3734         uint16_t for 24-bit offset.  Use get_output_section_offset and
3735         check return.
3736         (Target_powerpc::Scan::local): Handle more relocs.
3737         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
3738         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
3739         Plug in toc restoring insn after plt calls.  Translate branches
3740         to function descriptor symbols to corresponding entry point.
3741         (Target_powerpc::relocate_for_relocatable): Check return from
3742         get_output_section_offset.
3743         * symtab.h: Comment typo.
3744
3745 2012-08-14  Ian Lance Taylor  <iant@google.com>
3746
3747         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
3748         unsupported_relocal_local to call unsupported_reloc_global.
3749
3750 2012-08-14  Nick Clifton  <nickc@redhat.com>
3751
3752         PR ld/14265
3753         * script-sections.cc (Sections_element::output_section_name): Add
3754         keep return parameter.
3755         (Output_section_element::match_name): Add keep return parameter.
3756         Return the value of the keep_ member.
3757         * script-sections.h (class Output_section): Update
3758         output_section_name prototype.
3759         * layout.cc (Layout::keep_input_section): New public member
3760         function.
3761         (Layout::choose_output_section): Pass keep parameter to
3762         output_section_name.
3763         * layout.h (class Layout): Add keep_input_section.
3764         * object.cc (Sized_relobj_file::do_layout): Check for kept input
3765         sections.
3766         * testsuite/Makefile.am: Add a test.
3767         * testsuite/Makefile.in: Regenerate.
3768         * testsuite/pr14265.c: Source file for the test.
3769         * testsuite/pr14265.t: Linker script for the test.
3770         * testsuite/pr14265.sh: Shell script for the test.
3771
3772 2012-08-14  Alan Modra  <amodra@gmail.com>
3773
3774         * target.h (Target::output_section_name): New function.
3775         (Target::do_output_section_name): New function.
3776         * layout.cc (Layout::choose_output_section): Call the above.
3777         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
3778
3779 2012-08-14  Alan Modra  <amodra@gmail.com>
3780
3781         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
3782         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
3783         for replace_constant call.
3784         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
3785         (Output_data_glink::do_print_to_mapfile): New function.
3786         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
3787         (Target_powerpc::Relocate::relocate): Likewise.
3788
3789 2012-08-14  Alan Modra  <amodra@gmail.com>
3790
3791         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
3792         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
3793         (Output_data_glink::add_entry,find_entry): Remove shndx param.
3794         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
3795         all references to shndx_.  Handle special case for R_PPC_PLTREL24
3796         here.
3797         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
3798         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
3799         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
3800         here.
3801         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
3802         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
3803
3804 2012-08-12  Alan Modra  <amodra@gmail.com>
3805
3806         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
3807         (glink insn constants): Use uint32_t.
3808         (Output_data_glink::add_entry): Use insert, not [] operator.
3809
3810 2012-08-11  Alan Modra  <amodra@gmail.com>
3811
3812         * object.h (Sized_relobj_file::find_shdr): New function.
3813         (Sized_relobj_file::find_special_sections): New function.
3814         * object.cc (Sized_relobj_file::find_shdr): New function.
3815         (Sized_relobj_file::find_eh_frame): Use find_shdr.
3816         (Sized_relobj_file::find_special_sections): New function, split out..
3817         (Sized_relobj_file::do_read_symbols): ..from here.
3818         * output.h (Output_data_got::replace_constant): New function.
3819         (Output_data_got::num_entries): New function.
3820         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
3821         (Output_data_got::got_offset): Protected rather than private.
3822         (Output_data_got::replace_got_entry): New function.
3823         * output.cc (Output_data_got::replace_got_entry): New function.
3824         * powerpc.cc (class Powerpc_relobj): New.
3825         (class Powerpc_relocate_functions): Delete all psymval variants or
3826         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
3827         Implement _ha functions using corresponding _hi function.
3828         (Powerpc_relobj::find_special_sections): New function.
3829         (Target_powerpc::do_make_elf_object): New function.
3830         (class Output_data_got_powerpc): New.
3831         (class Output_data_glink): New.
3832         (class Powerpc_scan_relocatable_reloc): New.
3833         Many more changes througout file.
3834
3835 2012-08-09  Nick Clifton  <nickc@redhat.com>
3836
3837         * po/vi.po: Updated Vietnamese translation.
3838
3839 2012-08-07  Ian Lance Taylor  <iant@google.com>
3840
3841         * layout.cc (Layout::add_target_dynamic_tags): If
3842         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
3843         plt_rel.
3844
3845 2012-07-30  Nick Clifton  <nickc@redhat.com>
3846
3847         * po/gold.pot: Updated template.
3848         * po/es.po: Updated Spanish translation.
3849
3850 2012-07-18  Cary Coutant  <ccoutant@google.com>
3851
3852         PR gold/14344
3853         * configure.ac: Add check for -gpubnames support.
3854         * configure: Regenerate.
3855         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
3856         support; force -gno-pubnames.
3857         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
3858         support.
3859         (gdb_index_test_4): New test.
3860         * testsuite/Makefile.in: Regenerate.
3861         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
3862         * testsuite/gdb_index_test_2.sh: Likewise.
3863         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
3864         * testsuite/gdb_index_test_4.sh: New script.
3865         * testsuite/gdb_index_test_comm.sh: New script with common code;
3866         don't look for space after colon.
3867
3868 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
3869
3870         * gold.cc (queue_middle_tasks): Update function order only after
3871         deferred objects due to plugins are processed.
3872
3873 2012-07-11  Ian Lance Taylor  <iant@google.com>
3874
3875         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
3876         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
3877         (Target_arm::scan_reloc_for_stub): Likewise.
3878         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
3879         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
3880         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
3881         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
3882         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
3883
3884 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
3885             Ian Lance Taylor  <iant@google.com>
3886
3887         PR gold/14309
3888         * configure.ac: Test whether std::tr1::hash<off_t> works.
3889         * gold.h: Add a specialization for std::tr1::hash<off_t> if
3890         needed.
3891         * output.h (class Output_fill): Add virtual destructor.
3892         * configure, config.in: Rebuild.
3893
3894 2012-06-22  Roland McGrath  <mcgrathr@google.com>
3895
3896         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
3897
3898 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
3899
3900         * plugin.cc (Plugin::load): Handle position independent executables.
3901
3902 2012-06-06  Cary Coutant  <ccoutant@google.com>
3903
3904         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
3905         add .debug_macro.
3906         (lines_only_debug_sections): Likewise.
3907         (gdb_fast_lookup_sections): New static array.
3908         (is_gdb_debug_section): Rename formal parameter.
3909         (is_lines_only_debug_section): Likewise.
3910         (is_gdb_fast_lookup_section): New function.
3911         (Layout::include_section): Check for ".zdebug_" prefix; pass
3912         section name suffix to is_gdb_debug_section, et al.; check for
3913         fast-lookup sections when building .gdb_index.
3914         * options.h (--strip-debug-gdb): Update GDB version number.
3915
3916 2012-06-06  Cary Coutant  <ccoutant@google.com>
3917
3918         * configure.ac: Add check for fallocate.
3919         * configure: Regenerate.
3920         * config.in: Regenerate.
3921
3922         * options.h (class General_options): Add --mmap-output-file and
3923         --posix-fallocate options.
3924         * output.cc: (posix_fallocate): Remove; replace with...
3925         (gold_fallocate): New function.
3926         (Output_file::map_no_anonymous): Call gold_fallocate.
3927         (Output_file::map): Check --mmap-output-file option.
3928
3929 2012-06-05  Jing Yu  <jingyu@google.com>
3930
3931         * gold.h (textdomain): Add do {} to empty while(0).
3932         (bindtextdomain): Likewise.
3933
3934 2012-06-04  Cary Coutant  <ccoutant@google.com>
3935
3936         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
3937         has_dynsym_index.
3938
3939 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
3940
3941         * symtab.cc (Symbol_table::define_special_symbol):
3942         Initialize *poldsym to prevent uninitialized variable errors.
3943
3944 2012-05-23  Cary Coutant  <ccoutant@google.com>
3945
3946         * layout.cc (Layout::section_name_mapping): Add rules to handle
3947         exact match on .data.rel.ro.local or .data.rel.ro.
3948         (Layout::output_section_name): Check for exact matches.
3949
3950 2012-05-23  Cary Coutant  <ccoutant@google.com>
3951
3952         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
3953         more carefully.
3954
3955 2012-05-22  Cary Coutant  <ccoutant@google.com>
3956
3957         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
3958         object before exporting symbol.
3959
3960 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
3961
3962         * testsuite/tls_test.cc: Include "config.h" first.
3963         * testsuite/tls_test_c.c: Likewise.
3964
3965 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
3966             Nick Clifton  <nickc@redhat.com>
3967
3968         PR 14072
3969         * configure.in: Add check that sysdep.h has been included before
3970         any system header files.
3971         * configure: Regenerate.
3972         * config.in: Regenerate.
3973
3974 2012-05-14  Cary Coutant  <ccoutant@google.com>
3975
3976         * layout.cc (Layout::make_output_section): Mark .tdata section
3977         as RELRO.
3978         * testsuite/relro_test.cc: Add a TLS variable.
3979
3980 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
3981
3982         PR gold/14091
3983         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3984         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3985         R_X86_64_64.
3986
3987 2012-05-08  Cary Coutant  <ccoutant@google.com>
3988
3989         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3990         (lines_only_debug_sections): Likewise.
3991
3992 2012-05-02  Roland McGrath  <mcgrathr@google.com>
3993
3994         * nacl.cc: New file.
3995         * nacl.h: New file.
3996         * Makefile.am (CCFILES, HFILES): Add them.
3997         * Makefile.in: Regenerate.
3998         * i386.cc (Output_data_plt_i386_nacl): New class.
3999         (Output_data_plt_i386_nacl_exec): New class.
4000         (Output_data_plt_i386_nacl_dyn): New class.
4001         (Target_i386_nacl): New class.
4002         (Target_selector_i386_nacl): New class.
4003         (target_selector_i386): Use it instead of Target_selector_i386.
4004         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
4005         (Target_x86_64_nacl): New class.
4006         (Target_selector_x86_64_nacl): New class.
4007         (target_selector_x86_64, target_selector_x32): Use it instead of
4008         Target_selector_x86_64.
4009         * arm.cc (Output_data_plt_arm_nacl): New class.
4010         (Target_arm_nacl): New class.
4011         (Target_selector_arm_nacl): New class.
4012         (target_selector_arm, target_selector_armbe): Use it instead of
4013         Target_selector_arm.
4014
4015         * target-select.cc (select_target): Take new Input_file* and off_t
4016         arguments, pass them on to recognize method of selector.
4017         * object.cc (make_elf_sized_object): Update caller.
4018         * parameters.cc (parameters_force_valid_target): Likewise.
4019         * incremental.cc (make_sized_incremental_binary): Likewise.
4020         * target-select.h: Update decl.
4021         (Target_selector::recognize): Take new Input_file* argument,
4022         pass it on to do_recognize.
4023         (Target_selector::do_recognize): Take new Input_file* argument.
4024         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
4025         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
4026         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
4027         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
4028
4029         * target.h (Target::Target_info): New members isolate_execinstr
4030         and rosegment_gap.
4031         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
4032         * arm.cc (Target_arm::arm_info): Update initializer.
4033         * i386.cc (Target_i386::i386_info): Likewise.
4034         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
4035         * sparc.cc (Target_sparc::sparc_info): Likewise.
4036         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4037         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
4038         * layout.cc (Layout::attach_allocated_section_to_segment):
4039         Take new const Target* argument.  If target->isolate_execinstr(), act
4040         like --rosegment.
4041         (Layout::find_first_load_seg): Take new const Target* argument;
4042         if target->isolate_execinstr(), reject PF_X segments.
4043         (Layout::relaxation_loop_body): Update caller.
4044         (Layout::set_segment_offsets): If target->isolate_execinstr(),
4045         reset file offset to zero when we hit LOAD_SEG, and then do a second
4046         loop over the segments before LOAD_SEG to reassign offsets after
4047         addresses have been determined.  Handle target->rosegment_gap().
4048         (Layout::attach_section_to_segment): Take new const Target* argument;
4049         pass it to attach_allocated_section_to_segment.
4050         (Layout::make_output_section): Update caller.
4051         (Layout::attach_sections_to_segments): Take new const Target* argument;
4052         pass it to attach_section_to_segment.
4053         * gold.cc (queue_middle_tasks): Update caller.
4054         * layout.h (Layout): Update method decls with new arguments.
4055
4056         * arm.cc (Target_arm::Target_arm): Take optional argument for the
4057         Target_info pointer to use.
4058         (Target_arm::do_make_data_plt): New virtual method.
4059         (Target_arm::make_data_plt): New method that calls it.
4060         (Target_arm::make_plt_entry): Use it.
4061         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
4062         for the section alignment.
4063         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
4064         method.
4065         (Output_data_plt_arm::first_plt_entry_offset): Call it.
4066         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
4067         method.
4068         (Output_data_plt_arm::get_plt_entry_size): Call it.
4069         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
4070         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
4071         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
4072         method.
4073         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
4074         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
4075         method instead of sizeof(plt_entry).
4076         (Output_data_plt_arm::add_entry): Likewise.
4077         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
4078         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
4079         than static method.
4080         (Target_arm::plt_entry_size): Likewise.
4081         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
4082         Move to ...
4083         (Output_data_plt_arm_standard): ... here, new class.
4084         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
4085         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
4086         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
4087
4088         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4089         Take additional argument for the PLT entry size.
4090         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
4091         Use get_plt_entry_size method rather than plt_entry_size variable.
4092         (Output_data_plt_x86_64::reserve_slot): Likewise.
4093         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
4094         (Output_data_plt_x86_64::add_entry): Likewise.
4095         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
4096         (Output_data_plt_x86_64::address_for_global): Likewise.
4097         (Output_data_plt_x86_64::address_for_local): Likewise.
4098         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4099         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
4100         Make method non-static.
4101         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
4102         method.
4103         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
4104         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
4105         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
4106         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
4107         virtual method.
4108         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
4109         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
4110         virtual method.
4111         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
4112         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
4113         virtual method.
4114         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
4115         (Output_data_plt_x86_64::plt_entry_size)
4116         (Output_data_plt_x86_64::first_plt_entry)
4117         (Output_data_plt_x86_64::plt_entry)
4118         (Output_data_plt_x86_64::tlsdesc_plt_entry)
4119         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
4120         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
4121         (Output_data_plt_x86_64_standard): ... here, new class.
4122         (Target_x86_64::Target_x86_64): Take optional argument for the
4123         Target_info pointer to use.
4124         (Target_x86_64::do_make_data_plt): New virtual method.
4125         (Target_x86_64::make_data_plt): New method to call it.
4126         (Target_x86_64::init_got_plt_for_update): Use that.
4127         Call this->plt_->add_eh_frame method here.
4128         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
4129         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
4130         rather than static method.
4131         (Target_x86_64::plt_entry_size): Likewise.
4132         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
4133         rather than plt_entry_size variable.  Move guts of PLT filling to...
4134         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
4135         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
4136         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
4137
4138         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
4139         additional argument for the section alignment.
4140         Don't do add_eh_frame_for_plt here.
4141         (Output_data_plt_i386::first_plt_entry_offset): Make the method
4142         non-static.  Use get_plt_entry_size method rather than plt_entry_size
4143         variable.
4144         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
4145         method.
4146         (Output_data_plt_i386::get_plt_entry_size): Call it.
4147         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
4148         (Output_data_plt_i386::add_eh_frame): New method to call it.
4149         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
4150         method.
4151         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
4152         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
4153         method.
4154         (Output_data_plt_i386::fill_plt_entry): New method to call it.
4155         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
4156         method instead of plt_entry_size.
4157         (Output_data_plt_i386::plt_entry_size)
4158         (Output_data_plt_i386::plt_eh_frame_fde_size)
4159         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
4160         (Output_data_plt_i386_standard): ... here, new class.
4161         (Output_data_plt_i386_exec): New class.
4162         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
4163         (Output_data_plt_i386_exec::first_plt_entry): ... here.
4164         (Output_data_plt_i386::exec_plt_entry): Move to ...
4165         (Output_data_plt_i386_exec::plt_entry): ... here.
4166         (Output_data_plt_i386_dyn): New class.
4167         (Output_data_plt_i386::first_plt_entry): Move to ...
4168         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
4169         (Output_data_plt_i386::dyn_plt_entry): Move to ...
4170         (Output_data_plt_i386_dyn::plt_entry): ... here.
4171         (Target_i386::Target_i386): Take optional argument for the Target_info
4172         pointer to use.
4173         (Target_i386::do_make_data_plt): New virtual method.
4174         (Target_i386::make_data_plt): New method to call it.
4175         (Target_i386::make_plt_section): Use that.
4176         Call this->plt_->add_eh_frame method here.
4177         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
4178         rather than plt_entry_size variable.
4179         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
4180         (Output_data_plt_i386::address_for_local): Likewise.
4181         (Output_data_plt_i386::do_write): Likewise.
4182         Move guts of PLT filling to...
4183         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
4184         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
4185         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
4186         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
4187
4188 2012-05-01  Cary Coutant  <ccoutant@google.com>
4189
4190         * dwarf_reader.cc (Dwarf_die::read_attributes)
4191         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
4192         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
4193         * reduced_debug_output.cc
4194         (Output_reduced_debug_info_section::get_die_end): Remove
4195         DW_FORM_GNU_ref_index.  Add default case.
4196
4197 2012-04-26  Mark Wielaard  <mjw@redhat.com>
4198
4199         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
4200         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
4201         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
4202         DW_AT_high_pc as offset from DW_AT_low_pc.
4203
4204         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
4205         * testsuite/Makefile.in: Regenerate.
4206         * testsuite/gdb_index_test_3.c: New test source file.
4207         * testsuite/gdb_index_test_3.sh: New test source file.
4208
4209 2012-04-25  Ian Lance Taylor  <iant@google.com>
4210
4211         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
4212         pointer.
4213         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
4214         as a class, not a struct.
4215         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
4216         (Target_arm::apply_cortex_a8_workaround): Likewise.
4217         * gc.h: Declare Reloc_types as a struct, not a class.
4218         * object.h: Declare Symbols_data as a struct.
4219         * reloc.h: Declare Read_relocs_data as a struct.
4220         * target.h: Declare Relocate_info as a struct.
4221
4222 2012-04-24  David S. Miller  <davem@davemloft.net>
4223
4224         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
4225         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
4226         and R_SPARC_WPLT30.
4227
4228 2012-04-24  Cary Coutant  <ccoutant@google.com>
4229
4230         * incremental-dump.cc (find_input_containing_global): Replace
4231         magic number with symbolic constant.
4232         (dump_incremental_inputs): Update version number.
4233         * incremental.cc (Output_section_incremental_inputs): Update version
4234         number; import symbolic constants from Incremental_inputs_reader.
4235         (Incremental_inputs::create_data_sections): Align relocations
4236         section correctly for 64-bit targets.
4237         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
4238         constants; add padding.
4239         (Output_section_incremental_inputs::write_header): Add assert for
4240         header_size.
4241         (Output_section_incremental_inputs::write_input_files): Add assert
4242         for input_entry_size.
4243         (Output_section_incremental_inputs::write_info_blocks): Add padding;
4244         add assert for object_info_size, input_section_entry_size,
4245         global_sym_entry_size.
4246         * incremental.h (Incremental_inputs_reader): Add symbolic constants
4247         for data structure sizes; use them.
4248         (Incremental_input_entry_reader): Import symbolic constants from
4249         Incremental_inputs_reader; use them.
4250
4251 2012-04-23  David S. Miller  <davem@davemloft.net>
4252
4253         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
4254         and elf_flags_set_.
4255         (Target_sparc::Target_sparc): Initialize new fields.
4256         (Target_sparc::do_make_elf_object): New function.
4257         (Target_sparc::do_adjust_elf_header): New function.
4258
4259 2012-04-23  Cary Coutant  <ccoutant@google.com>
4260
4261         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
4262         CU range table of gdb index.
4263
4264 2012-04-20  David S. Miller  <davem@davemloft.net>
4265
4266         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
4267         instead of false.
4268
4269 2012-04-16  David S. Miller  <davem@davemloft.net>
4270
4271         * sparc.cc (Target_sparc::got_address): New function.
4272         (Sparc_relocate_functions::gdop_hix22): New function.
4273         (Sparc_relocate_functions::gdop_lox10): New function.
4274         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
4275         relocs.
4276         (Target_sparc::Scan::local): Likewise if the global symbol is not
4277         preemptible and is not IFUNC.
4278         (Target_sparc::Relocate::relocate): Perform GOTDATA code
4279         transformations for local and non-preemptible non-IFUNC global
4280         symbols.
4281
4282         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
4283         writing out 64-bit part of ranges.
4284
4285         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
4286         -fpic and -fpie respectively.
4287         * Makefile.in: Regenerate.
4288
4289         * sparc.cc (class Target_sparc): Add rela_ifunc_.
4290         (Target_sparc::Target_sparc): Initialize new field.
4291         (Target_sparc::do_plt_section_for_global): New function.
4292         (Target_sparc::do_plt_section_for_local): New function.
4293         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
4294         (Target_sparc::make_plt_section): New function, broken out of
4295         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
4296         (Target_sparc::make_plt_entry): Call make_plt_section.
4297         (Target_sparc::make_local_ifunc_plt_entry): New function.
4298         (Target_sparc::rela_ifunc_section): New function.
4299         (Target_sparc::plt_section): Remove const.
4300         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
4301         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
4302         and ifunc_count_ fields.
4303         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
4304         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
4305         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
4306         (Output_data_plt_sparc::rela_ifunc): New function.
4307         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
4308         (Output_data_plt_sparc::has_ifunc_section): New function.
4309         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
4310         (Output_data_plt_sparc::address_for_global): New function.
4311         (Output_data_plt_sparc::address_for_local): New function.
4312         (Output_data_plt_sparc::plt_index_to_offset): New function.
4313         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
4314         and entry_count.
4315         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
4316         entry_count.
4317         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
4318         R_SPARC_JMP_IREL to switch.
4319         (Target_sparc::Scan::check_non_pic): Likewise.
4320         (Target_sparc::Scan::local): Handle IFUNC symbols.
4321         (Target_sparc::Scan::local): Likewise.
4322         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
4323         and plt_address_for_local.
4324         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
4325         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
4326
4327         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
4328         (class Output_data_reloc): Adjust calls to Output_reloc_type.
4329         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
4330         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
4331         global relocs too.
4332         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
4333         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
4334         calls.
4335         * sparc.cc (Target_sparc::Scan::global): Likewise.
4336         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4337
4338 2012-04-16  Cary Coutant  <ccoutant@google.com>
4339
4340         * archive.cc (Library_base::should_include_member): Check for
4341         --export-dynamic-symbol.
4342         * options.h (class General_options): Add --export-dynamic-symbol.
4343         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
4344         --export-dynamic-symbol.
4345         (Symbol_table::gc_mark_undef_symbols): Likewise.
4346         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
4347
4348 2012-04-12  David S. Miller  <davem@davemloft.net>
4349
4350         * sparc.cc (Reloc::wdisp10): New relocation method.
4351         (Reloc::h34): Likewise.
4352         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
4353         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
4354         R_SPARC_WDISP10.
4355         (Target_sparc::Scan::local): Likewise.
4356         (Target_sparc::Scan::global): Likewise.
4357         (Target_sparc::Relocate::relocate): Likewise.
4358
4359 2012-04-09  Cary Coutant  <ccoutant@google.com>
4360
4361         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
4362         low_pc == 0.
4363
4364 2012-04-06  Ian Lance Taylor  <iant@google.com>
4365
4366         * timer.cc: #include <unistd.h>.
4367
4368 2012-04-06  Roland McGrath  <mcgrathr@google.com>
4369
4370         * configure.in (AC_CHECK_HEADERS): Add locale.h.
4371         * config.in: Regenerate.
4372         * configure: Regenerate.
4373
4374 2012-04-05  Nick Clifton  <nickc@redhat.com>
4375
4376         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
4377         (AM_LC_MESSAGES): Add.
4378         * aclocal.m4: Regenerate.
4379         * config.in: Regenerate.
4380         * configure: Regenerate.
4381
4382 2012-03-21  Cary Coutant  <ccoutant@google.com>
4383
4384         * Makefile.am: Add gdb-index.cc, gdb-index.h.
4385         * Makefile.in: Regenerate.
4386         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
4387         (Sized_elf_reloc_mapper::symbol_section): New function.
4388         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
4389         (make_elf_reloc_mapper): New function.
4390         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
4391         (Dwarf_abbrev_table::do_read_abbrevs): New function.
4392         (Dwarf_abbrev_table::do_get_abbrev): New function.
4393         (Dwarf_ranges_table::read_ranges_table): New function.
4394         (Dwarf_ranges_table::read_range_list): New function.
4395         (Dwarf_pubnames_table::read_section): New function.
4396         (Dwarf_pubnames_table::read_header): New function.
4397         (Dwarf_pubnames_table::next_name): New function.
4398         (Dwarf_die::Dwarf_die): New function.
4399         (Dwarf_die::read_attributes): New function.
4400         (Dwarf_die::skip_attributes): New function.
4401         (Dwarf_die::set_name): New function.
4402         (Dwarf_die::set_linkage_name): New function.
4403         (Dwarf_die::attribute): New function.
4404         (Dwarf_die::string_attribute): New function.
4405         (Dwarf_die::int_attribute): New function.
4406         (Dwarf_die::uint_attribute): New function.
4407         (Dwarf_die::ref_attribute): New function.
4408         (Dwarf_die::child_offset): New function.
4409         (Dwarf_die::sibling_offset): New function.
4410         (Dwarf_info_reader::check_buffer): New function.
4411         (Dwarf_info_reader::parse): New function.
4412         (Dwarf_info_reader::do_parse): New function.
4413         (Dwarf_info_reader::do_read_string_table): New function.
4414         (Dwarf_info_reader::lookup_reloc): New function.
4415         (Dwarf_info_reader::get_string): New function.
4416         (Dwarf_info_reader::visit_compilation_unit): New function.
4417         (Dwarf_info_reader::visit_type_unit): New function.
4418         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
4419         Sized_elf_reloc_mapper.
4420         (Sized_dwarf_line_info::symbol_section): Remove function.
4421         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
4422         (Sized_dwarf_line_info::read_line_mappings): Remove object
4423         parameter, adjust callers.
4424         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
4425         * dwarf_reader.h: Include <sys/types.h>.
4426         (class Track_relocs): Remove forward declaration.
4427         (class Elf_reloc_mapper): New class.
4428         (class Sized_elf_reloc_mapper): New class.
4429         (class Dwarf_abbrev_table): New class.
4430         (class Dwarf_range_list): New class.
4431         (class Dwarf_ranges_table): New class.
4432         (class Dwarf_pubnames_table): New class.
4433         (class Dwarf_die): New class.
4434         (class Dwarf_info_reader): New class.
4435         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
4436         (Sized_dwarf_line_info::symbol_section): Remove member function.
4437         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
4438         base class.
4439         * gdb-index.cc: New source file.
4440         * gdb-index.h: New source file.
4441         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
4442         and .debug_types sections, call Layout::add_to_gdb_index.
4443         (Sized_relobj_incr::do_section_name): Implement.
4444         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
4445         return type; Implement.
4446         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
4447         return type.
4448         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
4449         parameter list and return type.
4450         (Sized_incr_dynobj::do_section_contents): Likewise.
4451         * layout.cc: Include gdb-index.h.
4452         (Layout::Layout): Initialize gdb_index_data_.
4453         (Layout::init_fixed_output_section): Check for .gdb_index section.
4454         (Layout::add_to_gdb_index): New function. Instantiate.
4455         * layout.h: Add forward declaration for class Gdb_index.
4456         (Layout::add_to_gdb_index): New member function.
4457         (Layout::gdb_index_data_): New data member.
4458         * main.cc: Include gdb-index.h.
4459         (main): Print statistics for gdb index.
4460         * object.cc (Object::section_contents): Move code into
4461         do_section_contents.
4462         (need_decompressed_section): Check for sections needed when building
4463         gdb index.
4464         (build_compressed_section_map): Likewise.
4465         (Sized_relobj_file::do_read_symbols): Need local symbols when building
4466         gdb index.
4467         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
4468         sections; call Layout::add_to_gdb_index.
4469         (Sized_relobj_file::do_decompressed_section_contents): Call
4470         do_section_contents directly.
4471         * object.h (Object::do_section_contents): Adjust parameter list and
4472         return type.
4473         (Object::do_decompressed_section_contents): Call do_section_contents
4474         directly.
4475         (Sized_relobj_file::do_section_contents): Adjust parameter list and
4476         return type.
4477         * options.h (class General_options): Add --gdb-index option.
4478         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
4479         list and return type.
4480         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
4481         * reloc.h (Track_relocs::checkpoint): New function.
4482         (Track_relocs::reset): New function.
4483
4484         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
4485         New test cases.
4486         * testsuite/Makefile.in: Regenerate.
4487         * testsuite/gdb_index_test.cc: New test source file.
4488         * testsuite/gdb_index_test_1.sh: New test source file.
4489         * testsuite/gdb_index_test_2.sh: New test source file.
4490
4491 2012-03-19  Doug Kwan  <dougkwan@google.com>
4492
4493         * arm.cc (Target_arm::do_define_standard_symbols): New method.
4494         (Target_arm::do_finalize_sections): Remove code which defines
4495         __exidx_start and __exidx_end.  Make symbol table parameter
4496         anonymous as it is not used.
4497         * gold.cc (queue_middle_tasks): Call target hook to define any
4498         target-specific symbols.
4499         * target.h (Target::define_standard_symbols): New method.
4500         (Target::do_define_standard_symbols): Same.
4501         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
4502         * testsuite/Makefile.in: Regenerate.
4503         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
4504         and __exidx_end.
4505         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
4506         relocations are generated for __exidx_start and __exidx_end.
4507
4508 2012-03-16  Doug Kwan  <dougkwan@google.com>
4509
4510         * testsuite/Makefile.am: Disable test initpri3b.
4511         * testsuite/Makefile.in: Regenerate.
4512
4513 2012-03-15  Doug Kwan  <dougkwan@google.com>
4514
4515         * arm.cc (Target_arm::got_section): Make .got section read-only
4516         if -z now is given.
4517
4518 2012-03-15  Ian Lance Taylor  <iant@google.com>
4519
4520         PR gold/13850
4521         * layout.cc (Layout::make_output_section): Correctly mark
4522         SHT_INIT_ARRAY, et. al., as relro.
4523
4524 2012-03-14  Doug Kwan  <dougkwan@google.com>
4525
4526         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
4527         dynamic relocations for protected symbols in shared objects.
4528
4529 2012-03-13  Ian Lance Taylor  <iant@google.com>
4530
4531         * resolve.cc (Symbol_table::resolve): When merging common symbols,
4532         keep the larger alignment.
4533
4534 2012-03-12  Cary Coutant  <ccoutant@google.com>
4535
4536         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
4537         handling of DW_LNE_define_file.
4538
4539 2012-03-12  Cary Coutant  <ccoutant@google.com>
4540
4541         * reduced_debug_output.cc
4542         (Output_reduced_debug_info_section::get_die_end): Add new FORM
4543         codes to switch.
4544
4545 2012-02-29  Cary Coutant  <ccoutant@google.com>
4546
4547         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
4548
4549 2012-02-29  Cary Coutant  <ccoutant@google.com>
4550
4551         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4552         Call Object::decompressed_section_contents.
4553         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
4554         New dtor.
4555         (Sized_dwarf_line_info::buffer_start_): New data member.
4556         * merge.cc (Output_merge_data::do_add_input_section): Call
4557         Object::decompressed_section_contents.
4558         (Output_merge_string::do_add_input_section): Likewise.
4559         * object.cc (need_decompressed_section): New function.
4560         (build_compressed_section_map): Decompress sections needed later.
4561         (Sized_relobj_file::do_decompressed_section_contents): New function.
4562         (Sized_relobj_file::do_discard_decompressed_sections): New function.
4563         * object.h (Object::decompressed_section_contents): New function.
4564         (Object::discard_decompressed_sections): New function.
4565         (Object::do_decompressed_section_contents): New function.
4566         (Object::do_discard_decompressed_sections): New function.
4567         (Compressed_section_info): New type.
4568         (Compressed_section_map): Include decompressed section contents.
4569         (Sized_relobj_file::do_decompressed_section_contents): New function.
4570         (Sized_relobj_file::do_discard_decompressed_sections): New function.
4571
4572 2012-02-16  Cary Coutant  <ccoutant@google.com>
4573
4574         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
4575         * testsuite/Makefile.in: Regenerate.
4576
4577 2012-02-14  Cary Coutant  <ccoutant@google.com>
4578
4579         * options.cc (General_options::finalize): Disallow -pie and -static.
4580
4581 2012-02-03  Doug Kwan  <dougkwan@google.com>
4582
4583         * arm.cc (Arm_relocate_functions::abs8,
4584         Arm_relocate_functions::abs16): Use
4585         Bits::has_signed_unsigned_overflow32.
4586         (Arm_relocate_functions::thm_abs8): Correct range of
4587         overflow check.
4588         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
4589         in assertions.
4590
4591 2012-02-02  Doug Kwan  <dougkwan@google.com>
4592
4593         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
4594         position independent outputs, not just shared objects.
4595
4596 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
4597
4598         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
4599         * configure: Regenerated.
4600
4601 2012-01-27  Ian Lance Taylor  <iant@google.com>
4602
4603         * reloc.h (Bits): New class with static functions, copied from
4604         namespace utils in arm.cc.
4605         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
4606         instead.
4607
4608 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4609
4610         * incremental.cc (write_info_blocks): Correct relocation offset.
4611
4612 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4613
4614         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
4615         (Relocate::tls_gd_to_le): Likewise.
4616
4617 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4618
4619         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
4620
4621 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4622
4623         * configure.ac: Check if -mcmodel=medium works.
4624         * configure: Regenerated.
4625
4626 2012-01-24  Cary Coutant  <ccoutant@google.com>
4627
4628         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
4629         definition and ...
4630         (read_unsigned_LEB_128_x): ... this new function.
4631         (read_signed_LEB_128): Replaced with inline definition and ...
4632         (read_signed_LEB_128_x): ... this new function.
4633         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
4634         (read_unsigned_LEB_128): Add inline definition.
4635         (read_signed_LEB_128_x): New function.
4636         (read_signed_LEB_128): Add inline definition.
4637         * testsuite/Makefile.am (leb128_unittest): New unit test.
4638         * testsuite/Makefile.in: Regenerate.
4639         * testsuite/leb128_unittest.cc: New unit test.
4640
4641 2012-01-23  Ian Lance Taylor  <iant@google.com>
4642
4643         PR gold/13617
4644         * i386.cc (Target_i386::do_code_fill): When using a jmp
4645         instruction, pad with nop instructions.
4646         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4647
4648 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
4649
4650         * x86_64.cc (gc_process_relocs): Add typename on types used in
4651         template.
4652         (scan_relocs): Likewise.
4653         (relocate_section): Likewise.
4654         (apply_relocation): Likewise.
4655
4656 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
4657
4658         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
4659         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
4660         under x32.
4661
4662 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
4663
4664         * x86_64.cc: Initial support for x32.
4665
4666 2012-01-03  Cary Coutant  <ccoutant@google.com>
4667
4668         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
4669         Use abstract base class for GOT.
4670         * gold/output.h (class Output_data_got_base): New abstract base class.
4671         (class Output_data_got): Derive from new base class, adjust ctors.
4672         (Output_data_got::reserve_slot): Make virtual; rename to
4673         do_reserve_slot; Adjust callers.
4674         * gold/target.h (Sized_target::init_got_plt_for_update): Return
4675         pointer to abstract base class.
4676         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
4677
4678 2011-12-18  Ian Lance Taylor  <iant@google.com>
4679
4680         * object.h (Relobj::local_symbol_value): New function.
4681         (Relobj::local_plt_offset): New function.
4682         (Relobj::local_has_got_offset): New function.
4683         (Relobj::local_got_offset): New function.
4684         (Relobj::set_local_got_offset): New function.
4685         (Relobj::do_local_symbol_value): New pure virtual function.
4686         (Relobj::do_local_plt_offset): Likewise.
4687         (Relobj::do_local_has_got_offset): Likewise.
4688         (Relobj::do_local_got_offset): Likewise.
4689         (Relobj::do_set_local_got_offset): Likewise.
4690         (Sized_relobj::do_local_has_got_offset): Rename from
4691         local_has_got_offset.
4692         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
4693         (Sized_relobj::do_set_local_got_offset): Rename from
4694         set_local_got_offset.
4695         (Sized_relobj_file::do_local_plt_offset): Rename from
4696         local_plt_offset.
4697         (Sized_relobj_file::do_local_symbol_value): New function.
4698         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
4699         local_plt_offset.
4700         * output.cc (Output_data_got::Got_entry::write): Change object to
4701         Relobj.  Use local_symbol_value.
4702         (Output_data_got::add_global_with_rel): Change rel_dyn to
4703         Output_data_reloc_generic*.  Use add_global_generic.
4704         (Output_data_got::add_global_with_rela): Remove.  Change all
4705         callers to use add_global_with_rel.
4706         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
4707         Output_data_reloc_generic*.  Use add_global_generic.
4708         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
4709         callers to use add_global_pair_with_rel.
4710         (Output_data_got::add_local): Change object to Relobj*.
4711         (Output_data_got::add_local_plt): Likewise.
4712         (Output_data_got::add_local_with_rel): Change object to Relobj*,
4713         change rel_dyn to Output_data_reloc_generic*.  Use
4714         add_local_generic.
4715         (Output_data_got::add_local_with_rela): Remove.  Change all
4716         callers to use all_local_with_rel.
4717         (Output_data_got::add_local_pair_with_rel): Change object to
4718         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
4719         add_output_section_generic.
4720         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
4721         callers to use add_local_pair_with_rel.
4722         (Output_data_got::reserve_local): Change object to Relobj*.
4723         * output.h: (class Output_data_reloc_generic): Add pure virtual
4724         declarations for add_global_generic, add_local_generic,
4725         add_output_section_generic.
4726         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
4727         functions for Output_data_reloc_generic.  Update declarations for
4728         changes listed in output.cc.
4729         (class Output_data_got): Change template parameter to got_size.
4730         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
4731         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
4732         function.
4733         (Sized_relobj_incr::do_local_plt_offset): New function.
4734         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
4735         add_global_generic.
4736
4737 2011-12-17  Cary Coutant  <ccoutant@google.com>
4738
4739         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
4740         * resolve.cc (Symbol_table::resolve): Likewise.
4741         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
4742         arrays.
4743         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4744
4745 2011-12-16  Ian Lance Taylor  <iant@google.com>
4746
4747         * output.h (Output_data_reloc_generic::add): Only call
4748         add_dynamic_reloc if this is a dynamic reloc section.
4749
4750 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
4751
4752         PR gold/13505
4753         * target-reloc.h (apply_relocation): Replace <64, false> with
4754         <size, big_endian>.
4755
4756 2011-11-25  Nick Clifton  <nickc@redhat.com>
4757
4758         * po/it.po: New Italian translation.
4759
4760 2011-11-17  Sterling Augustine  <saugustine@google.com>
4761
4762         * script.cc (script_include_directive): Implement.
4763         (read_script_file): New local variables name and search_path. Update
4764         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
4765         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
4766         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
4767
4768 2011-11-11  Sterling Augustine  <saugustine@google.com>
4769
4770         * yyscript.y (section_cmd): Add support for INCLUDE directive.
4771         (file_or_sections_cmd): Likewise.
4772
4773 2011-11-11  Doug Kwan  <dougkwan@google.com>
4774
4775         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
4776         if --just-symbols is given.
4777
4778 2011-11-10  Doug Kwan  <dougkwan@google.com>
4779
4780         PR gold/13362
4781         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
4782         when processing data relocs.
4783         * reloc.h (Relocate_functions::rel_unaligned): New method.
4784         (Relocate_functions::pcrel_unaligned): Ditto.
4785         (Relocate_functions::rel32_unaligned): Ditto.
4786         (Relocate_functions::pcrel32_unaligned): Ditto.
4787
4788 2011-11-09  Doug Kwan  <dougkwan@google.com>
4789
4790         PR gold/13362
4791         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
4792         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
4793         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
4794         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4795         (Relocate_functions::rel_unaligned): New.
4796         (Relocate_functions::rel32_unaligned): New.
4797         * target-reloc.h (relocate_for_relocatable): Add code to handle
4798         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4799         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
4800         arm_unaligned_reloc_r): New targets.
4801         * testsuite/Makefile.in: Regenerate.
4802         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
4803         linking.
4804
4805 2011-11-02  Ian Lance Taylor  <iant@google.com>
4806
4807         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
4808         NATIVE_LINKER.
4809         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
4810         * options.cc (General_options::finalize): Use library search path
4811         from configure script if specified.  If not native and no sysroot,
4812         only search TOOLLIBDIR.
4813         * options.h (Search_directory::Search_directory): Change name to
4814         const std::string&.
4815         (General_options::add_to_library_path_with_sysroot): Change arg to
4816         const std::string&.
4817         * configure, Makefile.in, config.in: Rebuild.
4818
4819 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
4820
4821         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
4822         we are working around the ARM1176 Erratum.
4823         * options.h (General_options::fix_arm1176): Add option.
4824         * testsuite/Makefile.am: Add testcases, and keep current ones
4825         working.
4826         * testsuite/Makefile.in: Regenerate.
4827         * testsuite/arm_fix_1176.s: New file.
4828         * testsuite/arm_fix_1176.sh: Likewise.
4829
4830 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
4831
4832         * arm.cc (Target_arm::Target_arm): Remove initialisation of
4833         may_use_blx_.
4834         (Target_arm::may_use_blx): Remove method.
4835         (Target_arm::set_may_use_blx): Likewise.
4836         (Target_arm::may_use_v4t_interworking): New method.
4837         (Target_arm::may_use_v5t_interworking): Likewise.
4838         (Target_arm::may_use_blx_): Remove member variable.
4839         (Arm_relocate_functions::arm_branch_common): Check for v5T
4840         interworking.
4841         (Arm_relocate_functions::thumb_branch_common): Likewise.
4842         (Reloc_stub::stub_type_for_reloc): Likewise.
4843         (Target_arm::do_finalize_sections): Correct interworking checks.
4844         * testsuite/Makefile.am: Add new tests.
4845         * testsuite/Makefile.in: Regenerate.
4846         * testsuite/arm_farcall_arm_arm.s: New test.
4847         * testsuite/arm_farcall_arm_arm.sh: Likewise.
4848         * testsuite/arm_farcall_arm_thumb.s: Likewise.
4849         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
4850         * testsuite/arm_farcall_thumb_arm.s: Likewise.
4851         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
4852         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
4853         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
4854
4855 2011-10-31  Cary Coutant  <ccoutant@google.com>
4856
4857         PR gold/13023
4858         * expression.cc (Expression::eval_with_dot): Add
4859         is_section_dot_assignment parameter.
4860         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
4861         absolute and assigning to dot within a section.
4862         * script-sections.cc
4863         (Output_section_element_assignment::set_section_addresses): Pass
4864         dot_section to set_if_absolute.
4865         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
4866         as is_section_dot_assignment flag to eval_with_dot.
4867         (Output_section_element_dot_assignment::set_section_addresses):
4868         Likewise.
4869         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
4870         parameter.  Also set value if relative to dot_section; set the
4871         symbol's output_section.
4872         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
4873         parameter.  Adjust all callers.
4874         (Expression::eval_maybe_dot): Likewise.
4875         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
4876         Adjust all callers.
4877         * testsuite/script_test_2.t: Test assignment of an absolute value
4878         to dot within an output section element.
4879
4880 2011-10-31  Cary Coutant  <ccoutant@google.com>
4881
4882         * options.h (class General_options): Add --[no-]gnu-unique options.
4883         * symtab.cc (Symbol_table::sized_write_globals): Convert
4884         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
4885
4886 2011-10-31  Cary Coutant  <ccoutant@google.com>
4887
4888         PR gold/13359
4889         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
4890         unnecessary assertion.
4891         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
4892
4893 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
4894
4895         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4896         gc_mark_symbol.
4897         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4898         gc_mark_symbol.
4899         Change to just keep the section associated with symbol.
4900         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
4901         they are externally visible and --export-dynamic is turned on.
4902         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
4903
4904 2011-10-19  Ian Lance Taylor  <iant@google.com>
4905
4906         PR gold/13163
4907         * script-sections.cc
4908         (Output_section_element_dot_assignment::needs_output_section): New
4909         function.
4910
4911 2011-10-19  Ian Lance Taylor  <iant@google.com>
4912
4913         PR gold/13204
4914         * layout.cc (Layout::segment_precedes): Don't assert failure if a
4915         --section-start option was seen.
4916         * options.h (General_options::any_section_start): New function.
4917
4918 2011-10-18  David S. Miller  <davem@davemloft.net>
4919
4920         PR binutils/13301
4921         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
4922         member to track relocation locations that have moved during TLS
4923         reloc optimizations.
4924         (Target_sparc::Relocate::Relocate): Initialize to NULL.
4925         (Target_sparc::Relocate::relocate): Adjust view down by 4
4926         bytes if it matches reloc_adjust_addr_.
4927         (Target_sparc::Relocate::relocate_tls): Always move the
4928         __tls_get_addr call delay slot instruction forward 4 bytes when
4929         performing relaxation.
4930
4931 2011-10-18  Cary Coutant  <ccoutant@google.com>
4932
4933         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
4934         (Output_file::map_no_anonymous): Check for non-zero
4935         return code from posix_fallocate.
4936
4937 2011-10-17  Cary Coutant  <ccoutant@google.com>
4938
4939         PR gold/13245
4940         * plugin.cc (is_visible_from_outside): Check for symbols
4941         referenced from dynamic objects.
4942         * resolve.cc (Symbol_table::resolve): Don't count references
4943         from dynamic objects as references from real ELF files.
4944         * testsuite/plugin_test_2.sh: Adjust expected result.
4945
4946 2011-10-17  Cary Coutant  <ccoutant@google.com>
4947
4948         * gold.cc: Include timer.h.
4949         (queue_middle_tasks): Stamp time.
4950         (queue_final_tasks): Likewise.
4951         * main.cc (main): Store timer in parameters.  Print timers
4952         for each pass.
4953         * parameters.cc (Parameters::Parameters): Initialize timer_.
4954         (Parameters::set_timer): New function.
4955         (set_parameters_timer): New function.
4956         * parameters.h (Parameters::set_timer): New function.
4957         (Parameters::timer): New function.
4958         (Parameters::timer_): New data member.
4959         (set_parameters_timer): New function.
4960         * timer.cc (Timer::stamp): New function.
4961         (Timer::get_pass_time): New function.
4962         * timer.h (Timer::stamp): New function.
4963         (Timer::get_pass_time): New function.
4964         (Timer::pass_times_): New data member.
4965
4966 2011-10-17  Cary Coutant  <ccoutant@google.com>
4967
4968         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4969         task for members of lib groups.
4970
4971 2011-10-17  Cary Coutant  <ccoutant@google.com>
4972
4973         PR gold/13288
4974         * fileread.cc (File_read::find_view): Add assert.
4975         (File_read::make_view): Move bounds check (replace with assert)...
4976         (File_read::find_or_make_view): ... to here.
4977
4978 2011-10-12  Cary Coutant  <ccoutant@google.com>
4979
4980         * output.cc (Output_file::open_base_file): Handle case where
4981         ::read returns less than requested size.
4982
4983 2011-10-10  Cary Coutant  <ccoutant@google.com>
4984
4985         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4986         Initialize defined_count_.
4987         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4988         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4989         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4990         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4991         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4992         * incremental.h (Sized_relobj_incr::defined_count_): New data
4993         member.
4994         (Sized_incr_dynobj::defined_count_): New data member.
4995         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4996         Return zeroes instead of internal error.
4997
4998 2011-10-10  Cary Coutant  <ccoutant@google.com>
4999
5000         PR gold/13249
5001         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
5002         (Output_reloc::symbol_value): Return PLT offset if flag is set.
5003         * output.h (class Output_reloc): Add use_plt_offset flag.
5004         (Output_reloc::type_): Adjust size of bit field.
5005         (Output_reloc::use_plt_offset_): New bit field.
5006         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
5007         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
5008         flag.  Adjust all callers.
5009         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
5010         creating RELATIVE relocations.
5011
5012 2011-10-10  Nick Clifton  <nickc@redhat.com>
5013
5014         * po/es.po: Updated Spanish translation.
5015         * po/fi.po: Updated Finnish translation.
5016
5017 2011-10-03   Diego Novillo  <dnovillo@google.com>
5018
5019         * options.cc (parse_uint): Fix dereference of RETVAL.
5020
5021 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
5022
5023         * layout.h (section_order_map_): New member.
5024         (get_section_order_map): New member function.
5025         * output.cc (Output_section::add_input_section): Check for patterns
5026         only when --section-ordering-file is specified.
5027         * gold.cc (queue_middle_tasks): Delay updating order of sections till
5028         output_sections have been formed.
5029         * layout.cc (Layout_Layout): Initialize section_order_map_.
5030         * plugin.cc (update_section_order): Store order in order_map. Do not
5031         update the order.
5032         * testsuite/Makefile.am: Add test case for plugin_final_layout.
5033         * testsuite/Makefile.in: Regenerate.
5034         * testsuite/plugin_section_order.c: New file.
5035         * testsuite/plugin_final_layout.cc: New file.
5036         * testsuite/plugin_final_layout.sh: New file.
5037
5038 2011-09-29  Cary Coutant  <ccoutant@google.com>
5039
5040         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5041         Check for NULL.
5042         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
5043         symbols during incremental update.
5044         (Symbol_table::add_from_dynobj): Likewise.
5045
5046 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5047             Ian Lance Taylor  <iant@google.com>
5048
5049         * symtab.cc (Symbol_table::define_special_symbol): Always
5050         canonicalize version string.
5051
5052 2011-09-26  Cary Coutant  <ccoutant@google.com>
5053
5054         * gold.cc (queue_initial_tasks): Move option checks ...
5055         * options.cc (General_options::finalize): ... to here. Disable
5056         some options; make others fatal.
5057
5058 2011-09-26  Cary Coutant  <ccoutant@google.com>
5059
5060         gcc PR lto/47247
5061         * plugin.cc (get_symbols_v2): New function.
5062         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
5063         (is_referenced_from_outside): New function.
5064         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
5065         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
5066         (get_symbols): Pass version parameter.
5067         (get_symbols_v2): New function.
5068         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
5069         parameter.
5070         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
5071         (onload): Add LDPT_GET_SYMBOLS_V2.
5072         (all_symbols_read_hook): Use get_symbols_v2; check for
5073         LDPR_PREVAILING_DEF_IRONLY_EXP.
5074         * testsuite/plugin_test_3.sh: Update expected results.
5075
5076 2011-09-23  Simon Baldwin  <simonb@google.com>
5077
5078         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
5079         configuration options.
5080         * configure: Regenerate.
5081         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
5082         * Makefile.in: Regenerate.
5083         * testsuite/Makefile.in: Regenerate.
5084
5085 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
5086
5087         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
5088
5089 2011-09-19  Cary Coutant  <ccoutant@google.com>
5090
5091         * incremental.cc (can_incremental_update): Fix typo in comment.
5092         * incremental.h (can_incremental_update): Likewise.
5093
5094 2011-09-18  Cary Coutant  <ccoutant@google.com>
5095
5096         * incremental.cc (can_incremental_update): New function.
5097         * incremental.h (can_incremental_update): New function.
5098         * layout.cc (Layout::init_fixed_output_section): Call it.
5099         (Layout::make_output_section): Don't allow patch space in .eh_frame.
5100         * object.cc (Sized_relobj_file::do_layout): Call
5101         can_incremental_update.
5102
5103 2011-09-13  Cary Coutant  <ccoutant@google.com>
5104
5105         * configure.ac: Check for glibc support for gnu_indirect_function
5106         support with static linking, setting automake conditional
5107         IFUNC_STATIC.
5108         * Makefile.in: Regenerate.
5109         * configure: Regenerate.
5110
5111         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
5112         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
5113         for IFUNC_STATIC.
5114         * testsuite/Makefile.in: Regenerate.
5115
5116 2011-09-13  Cary Coutant  <ccoutant@google.com>
5117
5118         * incremental.cc (Sized_relobj_incr::do_layout): Call
5119         report_comdat_group for kept comdat sections.
5120         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
5121         * testsuite/Makefile.in: Regenerate.
5122         * testsuite/incr_comdat_test_1.cc: New source file.
5123         * testsuite/incr_comdat_test_2_v1.cc: New source file.
5124         * testsuite/incr_comdat_test_2_v2.cc: New source file.
5125         * testsuite/incr_comdat_test_2_v3.cc: New source file.
5126
5127 2011-09-13  Ian Lance Taylor  <iant@google.com>
5128
5129         * object.cc (Sized_relobj_file::do_layout): Remove unused local
5130         variable external_symbols_offset.
5131
5132 2011-09-12  Ian Lance Taylor  <iant@google.com>
5133
5134         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
5135         triggered if object has no symbols.
5136
5137 2011-09-09  David S. Miller  <davem@davemloft.net>
5138
5139         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
5140         (Output_fill_debug_line::do_write): Likewise.
5141
5142 2011-08-29  Cary Coutant  <ccoutant@google.com>
5143
5144         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
5145         casts to match formatting specs.
5146         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
5147
5148 2011-08-26  Cary Coutant  <ccoutant@google.com>
5149
5150         * layout.cc (Free_list::allocate): Provide guarantee of minimum
5151         remaining hole size when allocating.
5152         (Layout::make_output_section): Set fill methods for debug sections.
5153         * layout.h (Free_list::Free_list_node): Move from private to
5154         public.
5155         (Free_list::set_min_hole_size): New function.
5156         (Free_list::begin, Free_list::end): New functions.
5157         (Free_list::min_hole_): New data member.
5158         * output.cc: Include dwarf.h.
5159         (Output_fill_debug_info::do_minimum_hole_size): New function.
5160         (Output_fill_debug_info::do_write): New function.
5161         (Output_fill_debug_line::do_minimum_hole_size): New function.
5162         (Output_fill_debug_line::do_write): New function.
5163         (Output_section::Output_section): Initialize new data member.
5164         (Output_section::set_final_data_size): Ensure patch space is larger
5165         than minimum hole size.
5166         (Output_section::do_write): Fill holes in debug sections.
5167         * output.h (Output_fill): New class.
5168         (Output_fill_debug_info): New class.
5169         (Output_fill_debug_line): New class.
5170         (Output_section::set_free_space_fill): New function.
5171         (Output_section::free_space_fill_): New data member.
5172         * testsuite/Makefile.am (incremental_test_3): Add
5173         --incremental-patch option.
5174         (incremental_test_4): Likewise.
5175         (incremental_test_5): Likewise.
5176         (incremental_test_6): Likewise.
5177         (incremental_copy_test): Likewise.
5178         (incremental_common_test_1): Likewise.
5179         * testsuite/Makefile.in: Regenerate.
5180
5181 2011-08-26  Nick Clifton  <nickc@redhat.com>
5182
5183         * po/es.po: Updated Spanish translation.
5184
5185 2011-08-01  Cary Coutant  <ccoutant@google.com>
5186
5187         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
5188         * gold/testsuite/Makefile.in: Regenerate.
5189         * gold/testsuite/justsyms_exec.c: New source file.
5190         * gold/testsuite/justsyms_lib.c: New source file.
5191
5192 2011-08-01  Cary Coutant  <ccoutant@google.com>
5193
5194         * layout.cc (Layout::set_segment_offsets): Don't realign text
5195         segment if -Ttext was specified.
5196         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
5197         file type.
5198         * object.h (Sized_relobj_file::e_type): New function.
5199         (Sized_relobj_file::e_type_): New data member.
5200         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
5201         base address for ET_EXEC files.
5202         * target.cc (Target::do_make_elf_object_implementation): Allow
5203         ET_EXEC files with --just-symbols option.
5204
5205 2011-07-28  Cary Coutant  <ccoutant@google.com>
5206
5207         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
5208         Add thread_number parameter.
5209         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
5210         * workqueue-threads.cc
5211         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
5212         current thread if its thread number is greater than desired thread
5213         count.
5214         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
5215         Add thread_number parameter.
5216         (Workqueue::should_cancel_thread): Likewise.
5217         (Workqueue::find_runnable_or_wait): Pass thread_number to
5218         should_cancel_thread.
5219         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
5220         parameter.
5221
5222 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
5223
5224         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
5225         only after checking if it cannot be forced local.
5226         * symtab.h (is_externally_visible): Check if the symbol is not forced
5227         local.
5228
5229 2011-07-15  Ian Lance Taylor  <iant@google.com>
5230
5231         * options.h (class General_options): Add --print-output-format.
5232         Move -EL next to -EB, for  better --help output.
5233         * target-select.cc: Include <cstdio>, "options.h", and
5234         "parameters.h".
5235         (Target_selector::do_target_bfd_name): New function.
5236         (print_output_format): New function.
5237         * target-select.h (class Target_selector): Update declarations.
5238         (Target_selector::target_bfd_name): New function.
5239         (print_output_format): Declare.
5240         * main.cc: Include "target-select.h".
5241         (main): Handle --print-output-format.
5242         * gold.cc: Include "target-select.h".
5243         (queue_initial_tasks): Handle --print-output-format when there are
5244         no input files.
5245         * parameters.cc (parameters_force_valid_target): Give a better
5246         error message if -EB/-EL does not match target.
5247         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
5248         function.
5249
5250 2011-07-15  Ian Lance Taylor  <iant@google.com>
5251
5252         * i386.cc (class Output_data_plt_i386): Add layout_ field.
5253         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
5254         (Output_data_plt_i386::do_write): Write address of .dynamic
5255         section to first entry in .got.plt section.
5256         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
5257         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5258         Initialize layout_.
5259         (Output_data_plt_x86_64::do_write): Write address of .dynamic
5260         section to first entry in .got.plt section.
5261         * layout.h (Layout::dynamic_section): New function.
5262
5263 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
5264
5265         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
5266         to claim_file call.
5267         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
5268         input_section_position_, and input_section_glob_.
5269         (read_layout_from_file): Call function section_ordering_specified.
5270         * layout.h (is_section_ordering_specified): New function.
5271         (section_ordering_specified): New function.
5272         (section_ordering_specified_): New boolean member.
5273         * main.cc(main): Call load_plugins after layout object is defined.
5274         * output.cc (Output_section::add_input_section): Use
5275         function section_ordering_specified to check if section ordering is
5276         needed.
5277         * output.cc (Output_section::add_relaxed_input_section): Use
5278         function section_ordering_specified to check if section ordering is
5279         needed.
5280         (Output_section::update_section_layout): New function.
5281         (Output_section::sort_attached_input_sections): Check if input section
5282         must be reordered.
5283         * output.h (Output_section::update_section_layout): New function.
5284         * plugin.cc (get_section_count): New function.
5285         (get_section_type): New function.
5286         (get_section_name): New function.
5287         (get_section_contents): New function.
5288         (update_section_order): New function.
5289         (allow_section_ordering): New function.
5290         (Plugin::load): Add the new interfaces to the transfer vector.
5291         (Plugin_manager::load_plugins): New parameter.
5292         (Plugin_manager::all_symbols_read): New parameter.
5293         (Plugin_manager::claim_file): New parameter. Save the elf object for
5294         unclaimed objects.
5295         (Plugin_manager::get_elf_object): New function.
5296         (Plugin_manager::get_view): Change to directly use the bool to check
5297         if get_view is called from claim_file_hook.
5298         * plugin.h (input_objects): New function
5299         (Plugin__manager::load_plugins): New parameter.
5300         (Plugin_manager::claim_file): New parameter.
5301         (Plugin_manager::get_elf_object): New function.
5302         (Plugin_manager::in_claim_file_handler): New function.
5303         (Plugin_manager::in_claim_file_handler_): New member.
5304         (layout): New function.
5305         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
5306         handler with an extra parameter. Make the elf object before calling
5307         claim_file handler.
5308         * testsuite/plugin_test.c (get_section_count): New function pointer.
5309         (get_section_type): New function pointer.
5310         (get_section_name): New function pointer.
5311         (get_section_contents): New function pointer.
5312         (update_section_order): New function pointer.
5313         (allow_section_ordering): New function pointer.
5314         (onload): Check if the new interfaces exist.
5315
5316 2011-07-13  Ian Lance Taylor  <iant@google.com>
5317
5318         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
5319         relro section.
5320         * x86_64.cc (Target_x86_64::got_section): Likewise.
5321         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
5322         (relro_now_test_SOURCES): New variable.
5323         (relro_now_test_DEPENDENCIES): New variable.
5324         (relro_now_test_LDFLAGS): New variable.
5325         (relro_now_test_LDADD): New variable.
5326         (relro_now_test.so): New target.
5327         * testsuite/Makefile.in: Rebuild.
5328
5329 2011-07-12  Ian Lance Taylor  <iant@google.com>
5330
5331         PR gold/12980
5332         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
5333         GLOB_DAT relocation rather than a RELATIVE relocation for a
5334         protected symbol when creating a shared library.
5335         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5336         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
5337         * testsuite/protected_main_1.cc (main): Test that protected
5338         function has same address.
5339
5340 2011-07-11  Ian Lance Taylor  <iant@google.com>
5341
5342         PR gold/12979
5343         * options.h (class General_options): Add -Bgroup.
5344         * options.cc (General_options::finalize): If -Bgroup is set,
5345         default to --unresolved-symbols=report-all.
5346         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
5347         * target-reloc.h (issue_undefined_symbol_error): Handle
5348         --unresolved-symbols=report-all.
5349
5350 2011-07-08  Ian Lance Taylor  <iant@google.com>
5351
5352         PR gold/11985
5353         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
5354         if linker script discards key sections.
5355         (Layout::create_dynamic_symtab): Likewise.
5356         (Layout::assign_local_dynsym_offsets): Likewise.
5357         (Layout::sized_create_version_sections): Likewise.
5358         (Layout::create_interp): Likewise.
5359         (Layout::finish_dynamic_section): Likewise.
5360         (Layout::set_dynamic_symbol_size): Likewise.
5361
5362 2011-07-08  Ian Lance Taylor  <iant@google.com>
5363
5364         PR gold/12386
5365         * options.h (class General_options): Add --unresolved-symbols.
5366         * target-reloc.h (issue_undefined_symbol_error): Check
5367         --unresolved-symbols.  Add comments.
5368
5369 2011-07-08  Ian Lance Taylor  <iant@google.com>
5370
5371         * testsuite/odr_violation2.cc (Ordering::operator()): Make
5372         expression more complex.
5373
5374 2011-07-08  Ian Lance Taylor  <iant@google.com>
5375
5376         PR gold/11317
5377         * target-reloc.h (issue_undefined_symbol_error): New inline
5378         function, broken out of relocate_section.
5379         (relocate_section): Call issue_undefined_symbol_error.
5380         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5381         there is no TLS segment if we are about to issue an undefined
5382         symbol error.
5383         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5384
5385 2011-07-08  Ian Lance Taylor  <iant@google.com>
5386
5387         PR gold/12279
5388         * resolve.cc (Symbol_table::should_override): Add fromtype
5389         parameter.  Change all callers.  Give error when linking together
5390         TLS and non-TLS symbol.
5391         (Symbol_table::should_override_with_special): Add fromtype
5392         parameter.  Change all callers.
5393         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5394         there is no TLS segment if we have reported some errors.
5395         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5396
5397 2011-07-08  Ian Lance Taylor  <iant@google.com>
5398
5399         PR gold/12372
5400         * target.h (Target::plt_address_for_global): New function.
5401         (Target::plt_address_for_local): New function.
5402         (Target::plt_section_for_global): Remove.
5403         (Target::plt_section_for_local): Remove.
5404         (Target::do_plt_address_for_global): New virtual function.
5405         (Target::do_plt_address_for_local): New virtual function.
5406         (Target::do_plt_section_for_global): Remove.
5407         (Target::do_plt_section_for_local): Remove.
5408         (Target::register_global_plt_entry): Add Symbol_table and Layout
5409         parameters.
5410         * output.cc (Output_data_got::Got_entry::write): Use
5411         plt_address_for_global and plt_address_for_local.
5412         * layout.cc (Layout::add_target_dynamic_tags): Use size and
5413         address of output section.
5414         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
5415         got_irelative_, and irelative_count_ fields.  Update
5416         declarations.
5417         (Output_data_plt_i386::has_irelative_section): New function.
5418         (Output_data_plt_i386::entry_count): Add irelative_count_.
5419         (Output_data_plt_i386::set_final_data_size): Likewise.
5420         (class Target_i386): Add got_irelative_ and rel_irelative_
5421         fields.  Update declarations.
5422         (Target_i386::Target_i386): Initialize new fields.
5423         (Target_i386::do_plt_address_for_global): New function replacing
5424         do_plt_section_for_global.
5425         (Target_i386::do_plt_address_for_local): New function replacing
5426         do_plt_section_for_local.
5427         (Target_i386::got_section): Create got_irelative_.
5428         (Target_i386::rel_irelative_section): New function.
5429         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
5430         fields.  Don't define __rel_iplt_{start,end}.
5431         (Output_data_plt_i386::add_entry): Add symtab and layout
5432         parameters.  Change all callers.  Use different PLT and GOT for
5433         IFUNC symbols.
5434         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
5435         layout parameters.  Change all callers.  Use different PLT and
5436         GOT.
5437         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
5438         (Output_data_plt_i386::rel_irelative): New function.
5439         (Output_data_plt_i386::address_for_global): New function.
5440         (Output_data_plt_i386::address_for_local): New function.
5441         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
5442         IRELATIVE GOT when changing IFUNC GOT entries.
5443         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
5444         reloc.
5445         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
5446         if we didn't create an IRELATIVE GOT.
5447         (Target_i386::Relocate::relocate): Use plt_address_for_global and
5448         plt_address_for_local.
5449         (Target_i386::do_dynsym_value): Use plt_address_for_global.
5450         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
5451         got_irelative_, and irelative_count_ fields.  Update
5452         declarations.
5453         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5454         Initialize new fields.  Remove symtab parameter.  Change all
5455         callers.
5456         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
5457         irelative_count_.
5458         (Output_data_plt_x86_64::has_irelative_section): New function.
5459         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
5460         (class Target_x86_64): Add got_irelative_ and rel_irelative_
5461         fields.  Update declarations.
5462         (Target_x86_64::Target_x86_64): Initialize new fields.
5463         (Target_x86_64::do_plt_address_for_global): New function replacing
5464         do_plt_section_for_global.
5465         (Target_x86_64::do_plt_address_for_local): New function replacing
5466         do_plt_section_for_local.
5467         (Target_x86_64::got_section): Create got_irelative_.
5468         (Target_x86_64::rela_irelative_section): New function.
5469         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
5470         all callers.  Don't create __rel_iplt_{start,end}.
5471         (Output_data_plt_x86_64::add_entry): Add symtab and layout
5472         parameters.  Change all callers.  Use different PLT and GOT for
5473         IFUNC symbols.
5474         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
5475         layout parameters.  Change all callers.  Use different PLT and
5476         GOT.
5477         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
5478         parameters.  Change all callers.  Use different PLT and GOT for
5479         IFUNC symbols.
5480         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
5481         (Output_data_plt_x86_64::rela_irelative): New function.
5482         (Output_data_plt_x86_64::address_for_global): New function.
5483         (Output_data_plt_x86_64::address_for_local): New function.
5484         (Output_data_plt_x86_64::set_final_data_size): Likewise.
5485         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
5486         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
5487         (Target_x86_64::register_global_plt_entry): Add symtab and layout
5488         parameters.
5489         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
5490         reloc.
5491         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
5492         symbols if we didn't create an IRELATIVE GOT.
5493         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
5494         plt_address_for_local.
5495         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
5496         * testsuite/ifuncvar1.c: New test file.
5497         * testsuite/ifuncvar2.c: New test file.
5498         * testsuite/ifuncvar3.c: New test file.
5499         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
5500         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
5501         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
5502         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
5503         * testsuite/Makefile.in: Rebuild.
5504
5505 2011-07-07  Cary Coutant  <ccoutant@google.com>
5506
5507         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
5508         (two_file_test_1_ndebug.o): Likewise.
5509         (two_file_test_1b_ndebug.o): Likewise.
5510         (two_file_test_2_ndebug.o): Likewise.
5511         (two_file_test_main_ndebug.o): Likewise.
5512         (incremental_test_2): Link with no-debug versions.
5513
5514 2011-07-06  Cary Coutant  <ccoutant@google.com>
5515
5516         * gold/incremental.cc
5517         (Output_section_incremental_inputs::write_info_blocks): Check for
5518         hidden and internal symbols.
5519
5520 2011-07-06  Cary Coutant  <ccoutant@google.com>
5521
5522         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
5523         Check disposition for startup file.
5524         (Incremental_inputs::report_command_line): Ignore
5525         --incremental-startup-unchanged option.
5526         * options.cc (General_options::parse_incremental_startup_unchanged):
5527         New function.
5528         (General_options::General_options): Initialize new data member.
5529         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
5530         (General_options): Add --incremental-startup-unchanged option.
5531         (General_options::incremental_startup_disposition): New function.
5532         (General_options::incremental_startup_disposition_): New data member.
5533
5534 2011-07-06  Cary Coutant  <ccoutant@google.com>
5535
5536         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
5537         input file index to Script_info ctor.
5538         (Sized_incremental_binary::do_file_has_changed): Find the
5539         command-line argument for files named in scripts.
5540         * incremental.h (Script_info::Script_info): New ctor
5541         with input file index.
5542         (Script_info::input_file_index): New function.
5543         (Script_info::input_file_index_): New data member.
5544         (Incremental_binary::get_library): Add const.
5545         (Incremental_binary::get_script_info): Add const.
5546         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
5547         * testsuite/Makefile.am (incremental_test_5): New test case.
5548         (incremental_test_6): New test case.
5549         * testsuite/Makefile.in: Regenerate.
5550
5551 2011-07-06  Cary Coutant  <ccoutant@google.com>
5552
5553         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
5554         debug output when command lines differ.
5555
5556 2011-07-06  Cary Coutant  <ccoutant@google.com>
5557
5558         * incremental.cc (Incremental_inputs::report_command_line): Ignore
5559         --incremental-patch option.
5560         * layout.cc (Free_list::allocate): Extend allocation beyond original
5561         end if enabled.
5562         (Layout::make_output_section): Mark sections that should get
5563         patch space.
5564         * options.cc (parse_percent): New function.
5565         * options.h (parse_percent): New function.
5566         (DEFINE_percent): New macro.
5567         (General_options): Add --incremental-patch option.
5568         * output.cc (Output_section::Output_section): Initialize new data
5569         members.
5570         (Output_section::add_input_section): Print section name when out
5571         of patch space.
5572         (Output_section::add_output_section_data): Likewise.
5573         (Output_section::set_final_data_size): Add patch space when
5574         doing --incremental-full.
5575         (Output_section::do_reset_address_and_file_offset): Remove patch
5576         space.
5577         (Output_segment::set_section_list_addresses): Print debug output
5578         only if --incremental-update.
5579         * output.h (Output_section::set_is_patch_space_allowed): New function.
5580         (Output_section::is_patch_space_allowed_): New data member.
5581         (Output_section::patch_space_): New data member.
5582         * parameters.cc (Parameters::incremental_full): New function.
5583         * parameters.h (Parameters::incremental_full): New function
5584         * testsuite/Makefile.am (incremental_test_2): Add test for
5585         --incremental-patch option.
5586         * testsuite/Makefile.in: Regenerate.
5587         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
5588         (t18): Remove function body.
5589
5590 2011-07-05  Doug Kwan  <dougkwan@google.com>
5591
5592         PR gold/12771
5593         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
5594         Arm_Address type for relocation result.
5595         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
5596         overflow check.
5597         (Arm_relocate_functions::abs32): Use unaligned access.
5598         (Arm_relocate_functions::rel32): Ditto.
5599         (Arm_relocate_functions::prel31): Ditto.
5600         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
5601         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
5602         static data relocations.
5603         * testsuite/Makefile.in: Regnerate.
5604         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
5605
5606 2011-07-05  Ian Lance Taylor  <iant@google.com>
5607
5608         PR gold/12392
5609         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
5610         symbols if necessary.
5611         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5612
5613 2011-07-05  Ian Lance Taylor  <iant@google.com>
5614
5615         PR gold/12952
5616         * resolve.cc (Symbol::override_base_with_special): Simply override
5617         version with special symbol version, ignoring previous version.
5618
5619 2011-07-05  Ian Lance Taylor  <iant@google.com>
5620
5621         * object.cc (Sized_relobj_file::include_section_group): Add
5622         information to comment about signature location.
5623
5624 2011-07-02  Ian Lance Taylor  <iant@google.com>
5625
5626         PR gold/12957
5627         * options.h (class General_options): Add -f and -F.
5628         * options.cc (General_options::finalize): Fatal error if -f/-F
5629         are used without -shared.
5630         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
5631
5632 2011-07-02  Ian Lance Taylor  <iant@google.com>
5633
5634         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
5635
5636 2011-07-01  Ian Lance Taylor  <iant@google.com>
5637
5638         PR gold/12525
5639         PR gold/12952
5640         * resolve.cc (Symbol::override_base_with_special): Don't override
5641         the version if the overriding symbol has a different name.
5642         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
5643         all callers.  If we give an error about an undefined version,
5644         define the base version if necessary.
5645         * dynobj.h (class Versions): Update declaration.
5646         * testsuite/weak_alias_test_5.cc: New file.
5647         * testsuite/weak_alias_test.script: New file.
5648         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
5649         and versioned_alias have the right value, and call t2.
5650         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
5651         weak_alias_test_5.so.
5652         (weak_alias_test_LDADD): Likewise.
5653         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
5654         * testsuite/Makefile.in: Rebuild.
5655
5656 2011-07-01  Ian Lance Taylor  <iant@google.com>
5657
5658         PR gold/12525
5659         * options.h (class General_options): Support -z notext.
5660         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
5661         -Wl,-z,notext.
5662         (two_file_shared_nonpic.so): Likewise.
5663         (two_file_shared_mixed.so): Likewise.
5664         (two_file_shared_mixed_1.so): Likewise.
5665         (weak_undef_lib_nonpic.so): Likewise.
5666         (alt/weak_undef_lib_nonpic.so): Likewise.
5667         (tls_test_shared_nonpic.so): Likewise.
5668         * testsuite/Makefile.in: Rebuild.
5669
5670 2011-07-01  Ian Lance Taylor  <iant@google.com>
5671
5672         PR gold/12525
5673         * configure.ac: Test whether static linking works, setting
5674         the automake conditional HAVE_STATIC.
5675         * testsuite/Makefile.am: Disable tests using -static if
5676         HAVE_STATIC is not true.
5677         * configure, testsuite/Makefile.in: Rebuild.
5678
5679 2011-07-01  Ian Lance Taylor  <iant@google.com>
5680
5681         PR gold/12525
5682         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
5683         Assert if we see DW_EH_PE_indirect.
5684         * target.h (Target::ehframe_datarel_base): New function.
5685         (Target::do_ehframe_datarel_base): New target function.
5686         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
5687         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
5688         function.
5689
5690 2011-07-01  Ian Lance Taylor  <iant@google.com>
5691
5692         PR gold/12571
5693         * options.h (class General_options): Add
5694         --ld-generated-unwind-info.
5695         * ehframe.cc (Fde::write): Add address parameter.  Change all
5696         callers.  If associated with PLT, fill in address and size.
5697         (Cie::set_output_offset): Only add merge mapping if there is an
5698         object.
5699         (Cie::write): Add address parameter.  Change all callers.
5700         (Eh_frame::add_ehframe_for_plt): New function.
5701         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
5702         input_offset_ fields into union u_, with new plt field.
5703         (Fde::Fde): Adjust for new union field.
5704         (Fde::Fde) [Output_data version]: New constructor.
5705         (Fde::add_mapping): Only add merge mapping if there is an object.
5706         (class Cie): Update declarations.
5707         (class Eh_frame): Declare add_ehframe_for_plt.
5708         * layout.cc (Layout::layout_eh_frame): Break out code into
5709         make_eh_frame_section, and call it.
5710         (Layout::make_eh_frame_section): New function.
5711         (Layout::add_eh_frame_for_plt): New function.
5712         * layout.h (class Layout): Update declarations.
5713         * merge.cc (Merge_map::add_mapping): Add assertion.
5714         * i386.cc: Include "dwarf.h".
5715         (class Output_data_plt_i386): Make first_plt_entry,
5716         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
5717         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5718         and plt_eh_frame_fde.
5719         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
5720         boundary.  Call add_eh_frame_for_plt if appropriate.
5721         * x86_64.cc: Include "dwarf.h".
5722         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
5723         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
5724         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5725         and plt_eh_frame_fde.
5726         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
5727         appropriate.
5728
5729 2011-06-29  Ian Lance Taylor  <iant@google.com>
5730
5731         PR gold/12629
5732         * object.cc (Sized_relobj_file::layout_section): Change shdr
5733         parameter to be const.
5734         (Sized_relobj_file::layout_eh_frame_section): New function, broken
5735         out of do_layout.
5736         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
5737         appropriate.  Call layout_eh_frame_section.
5738         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
5739         sections.
5740         * object.h (class Sized_relobj_file): Update declarations.
5741
5742 2011-06-29  Ian Lance Taylor  <iant@google.com>
5743
5744         PR gold/12652
5745         * script.cc (Token::integer_value): Accept trailing M/m/K/k
5746         modifier.
5747         (Lex::gather_token): Accept trailing M/m/K/k for integers.
5748
5749 2011-06-29  Ian Lance Taylor  <iant@google.com>
5750
5751         PR gold/12675
5752         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
5753         SHT_X86_64_UNWIND.
5754         * layout.cc (Layout::layout_eh_frame): Likewise.
5755
5756 2011-06-29  Ian Lance Taylor  <iant@google.com>
5757
5758         PR gold/12695
5759         * layout.cc (Layout::symtab_section_shndx): New function.
5760         * layout.h (class Layout): Declare symtab_section_shndx.
5761         * output.cc (Output_section::write_header): Call it.
5762
5763 2011-06-29  Ian Lance Taylor  <iant@google.com>
5764
5765         PR gold/12818
5766         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
5767         symbols which are not used in a relocation.
5768
5769 2011-06-28  Ian Lance Taylor  <iant@google.com>
5770
5771         PR gold/12898
5772         * layout.cc (Layout::segment_precedes): Don't crash if a linker
5773         script create indistinguishable segments.
5774         (Layout::set_segment_offsets): Use stable_sort when sorting
5775         segments.  Pass this to Compare_segments constructor.
5776         * layout.h (class Layout): Make segment_precedes non-static.
5777         (class Compare_segments): Change from struct to class.  Add
5778         layout_ field.  Add constructor.
5779         * script-sections.cc
5780         (Script_sections::attach_sections_using_phdrs_clause): Rename
5781         local orphan to is_orphan.  Don't report failure to put empty
5782         section in segment.  On attachment failure, report name of
5783         section, and attach to first PT_LOAD segment.
5784
5785 2011-06-28  Ian Lance Taylor  <iant@google.com>
5786
5787         PR gold/12934
5788         * target-select.cc (Target_selector::Target_selector): Add
5789         emulation parameter.  Change all callers.
5790         (select_target_by_bfd_name): Rename from select_target_by_name.
5791         Change all callers.
5792         (select_target_by_emulation): New function.
5793         (supported_emulation_names): New function.
5794         * target-select.h (class Target_selector): Add emulation_ field.
5795         Update declarations.
5796         (Target_selector::recognize_by_bfd_name): Rename from
5797         recognize_by_name.  Change all callers.
5798         (Target_selector::supported_bfd_names): Rename from
5799         supported_names.  Change all callers.
5800         (Target_selector::recognize_by_emulation): New function.
5801         (Target_selector::supported_emulations): New function.
5802         (Target_selector::emulation): New function.
5803         (Target_selector::do_recognize_by_bfd_name): Rename from
5804         do_recognize_by_name.  Change all callers.
5805         (Target_selector::do_supported_bfd_names): Rename from
5806         do_supported_names.  Change all callers.
5807         (Target_selector::do_recognize_by_emulation): New function.
5808         (Target_selector::do_supported_emulations): New function.
5809         (select_target_by_bfd_name): Change name in declaration.
5810         (select_target_by_emulation): Declare.
5811         (supported_emulation_names): Declare.
5812         * parameters.cc (parameters_force_valid_target): Try to find
5813         target based on emulation from -m option.
5814         * options.h (class General_options): Change doc string for -m.
5815         * options.cc (help): Print emulations.
5816         (General_options::parse_V): Likewise.
5817         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
5818         Add emulation parameter.  Change all callers.
5819
5820 2011-06-28  Ian Lance Taylor  <iant@google.com>
5821
5822         * target.h (class Target): Add osabi_ field.
5823         (Target::osabi): New function.
5824         (Target::set_osabi): New function.
5825         (Target::Target): Initialize osabi_.
5826         (Target::do_adjust_elf_header): Make pure virtual.
5827         (Sized_target::do_adjust_elf_header): Declare.
5828         * target.cc (Sized_target::do_adjust_elf_header): New function.
5829         (class Sized_target): Instantiate all versions.
5830         * freebsd.h (class Target_freebsd): Remove.
5831         (Target_selector_freebsd::do_recognize): Call set_osabi on
5832         Target.
5833         (Target_selector_freebsd::do_recognize_by_name): Likewise.
5834         (Target_selector_freebsd::set_osabi): Remove.
5835         * i386.cc (class Target_i386): Inherit from Sized_target rather
5836         than Target_freebsd.
5837         * x86_64.cc (class Target_x86_64): Likewise.
5838
5839 2011-06-28  Ian Lance Taylor  <iant@google.com>
5840
5841         * target.h (Target::can_check_for_function_pointers): Rewrite.
5842         Make non-virtual.
5843         (Target::can_icf_inline_merge_sections): Likewise.
5844         (Target::section_may_have_icf_unsafe_poineters): Likewise.
5845         (Target::Target_info): Add can_icf_inline_merge_sections field.
5846         (Target::do_can_check_for_function_pointers): New virtual
5847         function.
5848         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
5849         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
5850         from can_check_for_function_pointers, move in file.
5851         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
5852         section_may_have_icf_unsafe_poineters, move in file.
5853         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
5854         * i386.cc (Target_i386::do_can_check_for_function_pointers):
5855         Rename from can_check_for_function_pointers, move in file.
5856         (Target_i386::can_icf_inline_merge_sections): Remove.
5857         (Target_i386::i386_info): Initialize
5858         can_icf_inline_merge_sections.
5859         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
5860         Initialize can_icf_inline_merge_sections.
5861         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
5862         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
5863         Rename from can_check_for_function_pointers, move in file.
5864         (Target_x86_64::can_icf_inline_merge_sections): Remove.
5865         (Target_x86_64::x86_64_info): Initialize
5866         can_icf_inline_merge_sections.
5867         * testsuite/testfile.cc (Target_test::test_target_info):
5868         Likewise.
5869         * icf.cc (get_section_contents): Correct formatting.
5870
5871 2011-06-27  Ian Lance Taylor  <iant@google.com>
5872
5873         * symtab.cc (Symbol::versioned_name): New function.
5874         (Symbol_table::add_to_final_symtab): Use versioned_name when
5875         appropriate.
5876         (Symbol_table::sized_write_symbol): Likewise.
5877         * symtab.h (class Symbol): Declare versioned_name.
5878         * stringpool.h (class Stringpool_template): Add variant of add
5879         which takes a std::basic_string.
5880         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
5881         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
5882         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
5883         (ver_test_12.o): New target.
5884         * testsuite/Makefile.in: Rebuild.
5885
5886 2011-06-27  Doug Kwan  <dougkwan@google.com>
5887
5888         * arm.cc (Arm_relocate_functions::thm_jump8,
5889         Arm_relocate_functions::thm_jump11): Use a wider signed
5890         type to compute offset.
5891         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
5892         arm_thm_jump8.
5893         * testsuite/Makefile.in: Regenerate.
5894         * testsuite/arm_branch_in_range.sh: Check test results of
5895         arm_thm_jump11 and arm_thm_jump8.
5896         * testsuite/arm_thm_jump11.s: New test source file.
5897         * testsuite/arm_thm_jump11.t: New linker script.
5898         * testsuite/arm_thm_jump8.s: New test source file.
5899         * testsuite/arm_thm_jump8.t: New linker script.
5900
5901 2011-06-24  Ian Lance Taylor  <iant@google.com>
5902
5903         * layout.cc: Include "object.h".
5904         (ctors_sections_in_init_array): New static variable.
5905         (Layout::is_ctors_in_init_array): New function.
5906         (Layout::layout): Add entry to ctors_sections_in_init_array if
5907         appropriate.
5908         * layout.h (class Layout): Declare is_ctors_in_init_array.
5909         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
5910         is_ctors_reverse_view is set.
5911         (Sized_relobj_file::write_sections): Add layout parameter.  Change
5912         all callers.  Set is_ctors_reverse_view field of View_size.
5913         (Sized_relobj_file::reverse_words): New function.
5914         * object.h (Sized_relobj_file::View_size): Add
5915         is_ctors_reverse_view field.
5916         (class Sized_relobj_file): Update declarations.
5917         * testsuite/initpri3.c: New test.
5918         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
5919         initpri3b.
5920         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
5921         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
5922         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
5923         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
5924         * testsuite/Makefile.in: Rebuild.
5925
5926 2011-06-24  Cary Coutant  <ccoutant@google.com>
5927
5928         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
5929         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
5930         (debug_msg_cdebug.err): New targets.
5931         * testsuite/Makefile.in: Regenerate.
5932         * testsuite/debug_msg.sh: Check output of link with compressed debug.
5933         Fix checks for link with shared library.
5934
5935 2011-06-24  Doug Kwan  <dougkwan@google.com>
5936
5937         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
5938         skip empty text sections.
5939         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
5940
5941 2011-06-22  Ian Lance Taylor  <iant@google.com>
5942
5943         PR gold/12910
5944         * options.h (class General_options): Add --ctors-in-init-array.
5945         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
5946         friends as SHT_PROGBITS for merging sections.
5947         (Layout::layout): Remove special handling of .init_array and
5948         friends.  Don't sort if doing relocatable link.  Sort for .ctors
5949         and .dtors if ctors_in_init_array.
5950         (Layout::make_output_section): Force correct section types for
5951         .init_array and friends.  Don't sort if doing relocatable link,
5952         Don't sort .ctors and .dtors if ctors_in_init_array.
5953         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
5954         (Layout::output_section_name): Add relobj parameter.  Change all
5955         callers.  Handle .ctors. and .dtors. in code rather than table.
5956         Handle .ctors and .dtors if ctors_in_init_array.
5957         (Layout::match_file_name): New function, moved from output.cc.
5958         * layout.h (class Layout): Update declarations.
5959         * output.cc: Include "layout.h".
5960         (Input_section_sort_entry::get_priority): New function.
5961         (Input_section_sort_entry::match_file_name): Just call
5962         Layout::match_file_name.
5963         (Output_section::Input_section_sort_init_fini_compare::operator()):
5964         Handle .ctors and .dtors.  Sort by explicit priority rather than
5965         by name.
5966         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
5967         * testsuite/initpri2.c: New test.
5968         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5969         (check_PROGRAMS): Add initpri2.
5970         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5971         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5972         * configure, testsuite/Makefile.in: Rebuild.
5973
5974 2011-06-19  Ian Lance Taylor  <iant@google.com>
5975
5976         PR gold/12880
5977         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5978         .interp section to a PT_INTERP segment even if we have seen a
5979         --dynamic-linker option.  Don't do it if we have seen a PHDRS
5980         clause in a linker script.
5981         (Layout::finalize): Don't create a .interp section if we've
5982         already create a PT_INTERP segment.
5983         (Layout::create_interp): Always call choose_output_section (revert
5984         patch of 2011-06-17).  Don't create PT_INTERP segment.
5985         * script-sections.cc
5986         (Script_sections::create_note_and_tls_segments): Add a .interp
5987         section to a PT_INTERP segment even if we have seen a
5988         --dynamic-linker option.
5989
5990 2011-06-18  Ian Lance Taylor  <iant@google.com>
5991
5992         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5993         merely because a non-PT_LOAD segment has a dynamic reloc.
5994
5995 2011-06-18  Ian Lance Taylor  <iant@google.com>
5996
5997         * layout.cc (Layout::finish_dynamic_section): Don't create
5998         DT_FLAGS entry if not needed.
5999
6000 2011-06-18  Ian Lance Taylor  <iant@google.com>
6001
6002         PR gold/12745
6003         * layout.cc (Layout::layout_eh_frame): Correct handling of
6004         writable .eh_frame section.
6005
6006 2011-06-17  Ian Lance Taylor  <iant@google.com>
6007
6008         PR gold/12893
6009         * resolve.cc (Symbol_table::resolve): Don't give an error if a
6010         symbol is redefined with the exact same object and value.
6011
6012 2011-06-17  Ian Lance Taylor  <iant@google.com>
6013
6014         PR gold/12880
6015         * layout.h (class Layout): Add interp_segment_ field.
6016         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
6017         (Layout::attach_allocated_section_to_segment): If making shared
6018         library, put .interp section in PT_INTERP segment.
6019         (Layout::finalize): Also call create_interp if -dynamic-linker
6020         option was used.
6021         (Layout::create_interp): Assert that there is no PT_INTERP
6022         segment.  If not using a SECTIONS clause, use make_output_section.
6023         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
6024         * script-sections.cc
6025         (Script_sections::create_note_and_tls_segments): If making shared
6026         library, put .interp section in PT_INTERP segment.
6027
6028 2011-06-17  Ian Lance Taylor  <iant@google.com>
6029
6030         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
6031         when making a shared library.
6032
6033 2011-06-17  Ian Lance Taylor  <iant@google.com>
6034
6035         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
6036         parameter.  Change all callers.  Don't issue warning about PC32
6037         against locally defined symbol.
6038
6039 2011-06-16  Ian Lance Taylor  <iant@google.com>
6040
6041         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
6042         occurs in same object.
6043
6044 2011-06-14  Alan Modra  <amodra@gmail.com>
6045
6046         * po/POTFILES.in: Regenerate.
6047
6048 2011-06-09  Ian Lance Taylor  <iant@google.com>
6049
6050         * script-sections.cc
6051         (Orphan_output_section::set_section_addresses): For a relocatable
6052         link set address to 0.
6053
6054 2011-06-09  Cary Coutant  <ccoutant@google.com>
6055
6056         PR gold/12804
6057         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
6058         used with --compress-debug-sections.
6059         * gold/object.cc (Sized_relobj_file::do_layout): Report
6060         uncompressed size of compressed input sections.
6061
6062 2011-06-08  Cary Coutant  <ccoutant@google.com>
6063
6064         PR gold/12804
6065         * testsuite/two_file_test_2_v1.cc: Change initialization of
6066         v2 to keep it in .data.
6067
6068 2011-06-07  Cary Coutant  <ccoutant@google.com>
6069
6070         * common.cc (Symbol_table::do_allocate_commons_list): Call
6071         gold_fallback.
6072         * errors.cc (Errors::fatal): Adjust call to gold_exit.
6073         (Errors::fallback): New function.
6074         (gold_fallback): New function.
6075         * errors.h (Errors::fallback): New function.
6076         * gold.cc (gold_exit): Change status parameter to enum; adjust
6077         all callers.
6078         (queue_initial_tasks): Call gold_fallback.
6079         * gold.h: Include cstdlib.
6080         (Exit_status): New enum type.
6081         (gold_exit): Change status parameter to enum.
6082         (gold_fallback): New function.
6083         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
6084         (Layout::create_symtab_sections): Likewise.
6085         (Layout::create_shdrs): Likewise.
6086         * main.cc (main): Adjust call to gold_exit.
6087         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
6088         (Output_data_got::add_got_entry_pair): Likewise.
6089         (Output_section::add_input_section): Likewise.
6090         (Output_section::add_output_section_data): Likewise.
6091         (Output_segment::set_section_list_addresses): Likewise.
6092         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
6093
6094 2011-06-07  Cary Coutant  <ccoutant@google.com>
6095
6096         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
6097         for incremental links.
6098         * output.cc (Output_segment::set_section_list_addresses): Remove
6099         FIXME and test for TLS or BSS.
6100
6101 2011-06-07  Cary Coutant  <ccoutant@google.com>
6102
6103         * testsuite/Makefile.am: Add incremental_copy_test,
6104         incremental_common_test_1.
6105         * testsuite/Makefile.in: Regenerate.
6106         * testsuite/common_test_1_v1.c: New source file.
6107         * testsuite/common_test_1_v2.c: New source file.
6108         * testsuite/copy_test_v1.cc: New source file.
6109
6110 2011-06-07  Cary Coutant  <ccoutant@google.com>
6111
6112         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
6113         update, allocate common from bss section's free list.
6114         * incremental-dump.cc (dump_incremental_inputs): Print flag for
6115         linker-defined symbols.
6116         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
6117         Skip GOT and PLT entries that are no longer referenced.
6118         (Output_section_incremental_inputs::write_info_blocks): Mark
6119         linker-defined symbols.
6120         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
6121         * output.cc (Output_section::allocate): New function.
6122         * output.h (Output_section::allocate): New function.
6123         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
6124         linker-defined symbols.
6125         (Symbol::override_base_with_special): Copy is_predefined_ flag.
6126         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
6127         (Symbol::init_base_output_data): Likewise.
6128         (Symbol::init_base_output_segment): Likewise.
6129         (Symbol::init_base_constant): Likewise.
6130         (Sized_symbol::init_output_data): Likewise.
6131         (Sized_symbol::init_output_segment): Likewise.
6132         (Sized_symbol::init_constant): Likewise.
6133         (Symbol_table::do_define_in_output_data): Likewise.
6134         (Symbol_table::do_define_in_output_segment): Likewise.
6135         (Symbol_table::do_define_as_constant): Likewise.
6136         * symtab.h (Symbol::is_predefined): New function.
6137         (Symbol::init_base_output_data): Add is_predefined parameter.
6138         (Symbol::init_base_output_segment): Likewise.
6139         (Symbol::init_base_constant): Likewise.
6140         (Symbol::is_predefined_): New data member.
6141         (Sized_symbol::init_output_data): Add is_predefined parameter.
6142         (Sized_symbol::init_output_segment): Likewise.
6143         (Sized_symbol::init_constant): Likewise.
6144         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
6145
6146 2011-06-07  Cary Coutant  <ccoutant@google.com>
6147
6148         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
6149         instead of emit_copy_reloc.
6150         (Copy_relocs::emit_copy_reloc): Refactor.
6151         (Copy_relocs::make_copy_reloc): New function.
6152         (Copy_relocs::add_copy_reloc): Remove.
6153         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
6154         section.
6155         (Copy_relocs::make_copy_reloc): New function.
6156         (Copy_relocs::add_copy_reloc): Remove.
6157         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
6158         unchanged input files.
6159         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
6160         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
6161         Reserve BSS space for COPY relocations.
6162         (Sized_incremental_binary::do_emit_copy_relocs): New function.
6163         (Output_section_incremental_inputs::write_info_blocks): Record
6164         whether a symbol is copied from a shared object.
6165         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
6166         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
6167         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
6168         (Incremental_input_entry_reader::get_output_symbol_index): Add
6169         is_copy parameter.
6170         (Incremental_binary::emit_copy_relocs): New function.
6171         (Incremental_binary::do_emit_copy_relocs): New function.
6172         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6173         new data member.
6174         (Sized_incremental_binary::add_copy_reloc): New function.
6175         (Sized_incremental_binary::do_emit_copy_relocs): New function.
6176         (Sized_incremental_binary::Copy_reloc): New struct.
6177         (Sized_incremental_binary::Copy_relocs): New typedef.
6178         (Sized_incremental_binary::copy_relocs_): New data member.
6179         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
6180         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
6181         * target.h (Sized_target::emit_copy_reloc): New function.
6182         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
6183
6184 2011-06-02  Cary Coutant  <ccoutant@google.com>
6185
6186         PR gold/12163
6187         * gold/archive.cc (Archive::Archive): Initialize new data member.
6188         (Archive::include_all_members): Return if archive has already been
6189         included.
6190         * gold/archive.h (Archive::include_all_members_): New data member.
6191
6192 2011-06-02  Nick Clifton  <nickc@redhat.com>
6193
6194         * dynobj.h: Fix spelling mistake in comment.
6195         * output.cc: Likewise.
6196
6197 2011-05-31  Doug Kwan  <dougkwan@google.com>
6198             Asier Llano
6199
6200         PR gold/12826
6201         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
6202         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
6203         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
6204         redundant arm_exidx_test.so.
6205         * testsuite/Makefile.in: Regenerate.
6206         (check_SCRIPTS): Add pr12826.sh
6207         (check_DATA): Add pr12826.stdout
6208         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
6209         * testsuite/pr12826.sh: New file.
6210         * testsuite/pr12826_1.s: Ditto.
6211         * testsuite/pr12826_1.s: Ditto.
6212
6213 2011-05-30  Ian Lance Taylor  <iant@google.com>
6214
6215         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
6216         sections.
6217
6218 2011-05-29  Ian Lance Taylor  <iant@google.com>
6219
6220         PR gold/12804
6221         * testsuite/Makefile.am: Use different file name for two_file_test
6222         temporary file for each incremental test.
6223         * testsuite/Makefile.in: Rebuild.
6224
6225 2011-05-29  Ian Lance Taylor  <iant@google.com>
6226
6227         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
6228         binary input file is empty.
6229
6230 2011-05-27  Ian Lance Taylor  <iant@google.com>
6231
6232         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
6233         (ver_test_9.so): Likewise.
6234         * testsuite/Makefile.in: Rebuild.
6235
6236 2011-05-26 Cary Coutant  <ccoutant@google.com>
6237
6238         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
6239         * incremental.cc (Incremental_inputs::report_input_section): Fix
6240         comment, indentation.
6241         (Incremental_inputs::report_comdat_group): New function.
6242         (Output_section_incremental_inputs::set_final_data_size): Adjust size
6243         of data for incremental input file entry.
6244         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
6245         group count, COMDAT group signatures.
6246         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
6247         an unchanged input file.
6248         * incremental.h (Incremental_object_entry::Incremental_object_entry):
6249         Initialize new data member.
6250         (Incremental_object_entry::add_comdat_group): New function.
6251         (Incremental_object_entry::get_comdat_group_count): New function.
6252         (Incremental_object_entry::get_comdat_signature_key): New function.
6253         (Incremental_object_entry::groups_): New data member.
6254         (Incremental_inputs::report_comdat_group): New function.
6255         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
6256         data for incremental input file entry.
6257         (Incremental_input_entry_reader::get_comdat_group_count): New function.
6258         (Incremental_input_entry_reader::get_input_section): Adjust size of
6259         data for incremental input file entry.
6260         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
6261         (Incremental_input_entry_reader::get_comdat_group_signature): New
6262         function.
6263         * object.cc (Sized_relobj::include_section_group): Report kept
6264         COMDAT groups for incremental links.
6265
6266 2011-05-24  David Meyer  <pdox@google.com>
6267
6268         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
6269         with name parameter.  Add found_name parameter.
6270         * fileread.cc (Input_file::find_file): Adjust code accordingly.
6271         * dirsearch.h (class Dirsearch): Update declaration.
6272
6273 2011-05-24  Ian Lance Taylor  <iant@google.com>
6274
6275         * archive.cc (Library_base::should_include_member): Pull in object
6276         from archive if it defines the entry symbol.
6277         * parameters.cc (Parameters::entry): New function.
6278         * parameters.h (class Parameters): Declare entry.
6279         * output.h (class Output_file_header): Remove entry_ field.
6280         * output.cc (Output_file_header::Output_file_header): Remove entry
6281         parameter.  Change all callers.
6282         (Output_file_header::entry): Use parameters->entry.
6283         * gold.cc (queue_middle_tasks): Likewise.
6284         * plugin.cc (Plugin_hook::run): Likewise.
6285
6286 2011-05-24 Cary Coutant  <ccoutant@google.com>
6287
6288         * gold.cc (queue_initial_tasks): Pass incremental base filename
6289         to Output_file::open_base_file; don't print error message.
6290         * incremental-dump.cc (main): Adjust call to
6291         Output_file::open_for_modification.
6292         * incremental-dump.cc (main): Likewise.
6293         * incremental.cc (Incremental_inputs::report_command_line):
6294         Ignore --incremental-base option when comparing command lines.
6295         Ignore parameter when given as separate argument.
6296         * options.h (class General_options): Add --incremental-base.
6297         * output.cc (Output_file::Output_file):
6298         (Output_file::open_base_file): Add base_name and writable parameters;
6299         read base file into new file; print error message here.
6300         (Output_file::map_no_anonymous): Add writable parameter; adjust all
6301         callers.
6302         * output.h (Output_file::open_for_modification): Rename to...
6303         (Output_file::open_base_file): ...this; add base_name and
6304         writable parameters; adjust all callers.
6305         (Output_file::map_no_anonymous): Add writable parameter; adjust all
6306         callers.
6307         * testsuite/Makefile.am (incremental_test_4): Test
6308         --incremental-base.
6309         * testsuite/Makefile.in: Regenerate.
6310
6311 2011-05-24 Cary Coutant  <ccoutant@google.com>
6312
6313         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
6314         incremental_test_4.
6315         * testsuite/Makefile.in: Regenerate.
6316         * testsuite/two_file_test_1_v1.cc: New test source file.
6317         * testsuite/two_file_test_1b_v1.cc: New test source file.
6318         * testsuite/two_file_test_2_v1.cc: New test source file.
6319
6320 2011-05-24 Cary Coutant  <ccoutant@google.com>
6321
6322         * dynobj.h (Dynobj::do_dynobj): New function.
6323         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
6324         flag and soname for shared objects.
6325         * incremental.cc (Incremental_inputs::report_object): Make
6326         either Incremental_object_entry or Incremental_dynobj_entry; add
6327         soname to string table.
6328         (Incremental_inputs::report_input_section): Add assertion.
6329         (Output_section_incremental_inputs::set_final_data_size): Adjust
6330         type of input file entry for shared libraries; adjust size of
6331         shared library info entry.
6332         (Output_section_incremental_inputs::write_input_files): Write
6333         as_needed flag for shared libraries.
6334         (Output_section_incremental_inputs::write_info_blocks): Adjust type
6335         of input file entry for shared libraries; write soname.
6336         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
6337         soname from incremental info.
6338         * incremental.h (enum Incremental_input_flags): Add
6339         INCREMENTAL_INPUT_AS_NEEDED.
6340         (Incremental_input_entry::Incremental_input_entry): Initialize new
6341         data member.
6342         (Incremental_input_entry::set_as_needed): New function.
6343         (Incremental_input_entry::as_needed): New function.
6344         (Incremental_input_entry::do_dynobj_entry): New function.
6345         (Incremental_input_entry::as_needed_): New data member.
6346         (Incremental_object_entry::Incremental_object_entry): Don't check
6347         for shared library.
6348         (Incremental_object_entry::do_type): Likewise.
6349         (class Incremental_dynobj_entry): New class.
6350         (Incremental_input_entry_reader::as_needed): New function.
6351         (Incremental_input_entry_reader::get_soname): New function.
6352         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
6353         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
6354         size of shared library info entry.
6355         * layout.cc (Layout::finish_dynamic_section): Don't test for
6356         incremental link when adding DT_NEEDED entries.
6357         * object.h (Object::Object): Initialize new data member.
6358         (Object::dynobj): New function.
6359         (Object::set_as_needed): New function.
6360         (Object::as_needed): New function.
6361         (Object::do_dynobj): New function.
6362         (Object::as_needed_): New data member.
6363
6364 2011-05-24 Cary Coutant  <ccoutant@google.com>
6365
6366         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
6367         info; adjust display of GOT entries.
6368         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6369         vector of input objects; remove file_status_.
6370         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
6371         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
6372         got_plt reader; call target hooks to reserve GOT entries.
6373         (Output_section_incremental_inputs::set_final_data_size): Adjust size
6374         of input file info header and GOT info entry.
6375         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
6376         relocation info.
6377         (Got_plt_view_info::got_descriptor): Remove.
6378         (Got_plt_view_info::sym_index): New data member.
6379         (Got_plt_view_info::input_index): New data member.
6380         (Local_got_offset_visitor::visit): Write input file index.
6381         (Global_got_offset_visitor::visit): Write 0 for input file index.
6382         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
6383         with sym_index and input_index.
6384         (Output_section_incremental_inputs::write_got_plt): Adjust size of
6385         incremental info GOT entry; replace got_descriptor with input_index.
6386         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
6387         map from input file index to object.
6388         (Sized_relobj_incr::do_layout): Replace direct data member reference
6389         with accessor function.
6390         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
6391         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
6392         Adjust size of input file info header.
6393         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
6394         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
6395         (Incremental_input_entry_reader::get_input_section): Adjust size of
6396         input file info header.
6397         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
6398         of incremental info GOT entry.
6399         (Incremental_got_plt_reader::get_got_desc): Remove.
6400         (Incremental_got_plt_reader::get_got_symndx): New function.
6401         (Incremental_got_plt_reader::get_got_input_index): New function.
6402         (Sized_incremental_binary::Sized_incremental_binary): Remove
6403         file_status_; add input_objects_.
6404         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
6405         (Sized_incremental_binary::set_file_is_unchanged): Remove.
6406         (Sized_incremental_binary::file_is_unchanged): Remove.
6407         (Sized_incremental_binary::set_input_object): New function.
6408         (Sized_incremental_binary::input_object): New function.
6409         (Sized_incremental_binary::file_status_): Remove.
6410         (Sized_incremental_binary::input_objects_): New data member.
6411         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
6412         references.
6413         (Sized_relobj_incr::invalid_address): Move to base class.
6414         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
6415         class.
6416         (Sized_relobj_incr::do_output_section_offset): Likewise.
6417         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
6418         (Sized_relobj_incr::section_offsets_): Likewise.
6419         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
6420         function.
6421         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
6422         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
6423         with accessor function.
6424         (Sized_relobj_file::do_layout): Likewise.
6425         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
6426         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
6427         (Sized_relobj_file::compute_final_local_value): Replace refs to
6428         section_offsets_ with accessor function.
6429         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
6430         * object.h (Relobj::Relobj): Initialize new data members.
6431         (Relobj::add_dyn_reloc): New function.
6432         (Relobj::first_dyn_reloc): New function.
6433         (Relobj::dyn_reloc_count): New function.
6434         (Relobj::first_dyn_reloc_): New data member.
6435         (Relobj::dyn_reloc_count_): New data member.
6436         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
6437         references.
6438         (Sized_relobj::Address): New typedef.
6439         (Sized_relobj::invalid_address): Move here from child class.
6440         (Sized_relobj::Sized_relobj): Initialize new data members.
6441         (Sized_relobj::sized_relobj): New function.
6442         (Sized_relobj::is_output_section_offset_invalid): Move here from
6443         child class.
6444         (Sized_relobj::get_output_section_offset): Likewise.
6445         (Sized_relobj::local_has_got_offset): Likewise.
6446         (Sized_relobj::local_got_offset): Likewise.
6447         (Sized_relobj::set_local_got_offset): Likewise.
6448         (Sized_relobj::do_for_all_local_got_entries): Likewise.
6449         (Sized_relobj::clear_got_offsets): New function.
6450         (Sized_relobj::section_offsets): Move here from child class.
6451         (Sized_relobj::do_output_section_offset): Likewise.
6452         (Sized_relobj::do_set_section_offset): Likewise.
6453         (Sized_relobj::Local_got_offsets): Likewise.
6454         (Sized_relobj::local_got_offsets_): Likewise.
6455         (Sized_relobj::section_offsets_): Likewise.
6456         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
6457         references.
6458         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
6459         class.
6460         (Sized_relobj_file::sized_relobj): New function
6461         (Sized_relobj_file::local_has_got_offset): Move to base class.
6462         (Sized_relobj_file::local_got_offset): Likewise.
6463         (Sized_relobj_file::set_local_got_offset): Likewise.
6464         (Sized_relobj_file::get_output_section_offset): Likewise.
6465         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
6466         (Sized_relobj_file::do_output_section_offset): Likewise.
6467         (Sized_relobj_file::do_set_section_offset): Likewise.
6468         (Sized_relobj_file::Local_got_offsets): Likewise.
6469         (Sized_relobj_file::local_got_offsets_): Likewise.
6470         (Sized_relobj_file::section_offsets_): Likewise.
6471         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
6472         (all constructors).
6473         (set_needs_dynsym_index): Convert relobj to derived class pointer.
6474         (Output_reloc::get_symbol_index): Likewise.
6475         (Output_reloc::local_section_offset): Likewise.
6476         (Output_reloc::get_address): Likewise.
6477         (Output_reloc::symbol_value): Likewise.
6478         (Output_data_got::reserve_slot): Move to class definition.
6479         (Output_data_got::reserve_local): New function.
6480         (Output_data_got::reserve_slot_for_global): Remove.
6481         (Output_data_got::reserve_global): New function.
6482         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
6483         (all constructors, two instantiations).
6484         (Output_reloc::get_relobj): New function (two instantiations).
6485         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
6486         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
6487         (Output_data_reloc::add_global): Adjust type of relobj.
6488         (Output_data_reloc::add_global_relative): Likewise.
6489         (Output_data_reloc::add_symbolless_global_addend): Likewise.
6490         (Output_data_reloc::add_local): Likewise.
6491         (Output_data_reloc::add_local_relative): Likewise.
6492         (Output_data_reloc::add_symbolless_local_addend): Likewise.
6493         (Output_data_reloc::add_local_section): Likewise.
6494         (Output_data_reloc::add_output_section): Likewise.
6495         (Output_data_reloc::add_absolute): Likewise.
6496         (Output_data_reloc::add_target_specific): Likewise.
6497         (Output_data_got::reserve_slot): Move definition here.
6498         (Output_data_got::reserve_local): New function.
6499         (Output_data_got::reserve_global): New function.
6500         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
6501         section_offsets_ with accessor function.
6502         (Sized_relobj_file::write_sections): Likewise.
6503         (Sized_relobj_file::do_relocate_sections): Likewise.
6504         * target.h (Sized_target::reserve_local_got_entry): New function.
6505         (Sized_target::reserve_global_got_entry): New function.
6506         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
6507         (Target_x86_64::reserve_global_got_entry): New function.
6508         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
6509
6510 2011-05-23 Cary Coutant  <ccoutant@google.com>
6511
6512         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
6513         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
6514         bit when checking got_type.
6515         * incremental.cc (Sized_incremental_binary::setup_readers):
6516         Store symbol table and string table locations; initialize bit vector
6517         of file status flags.
6518         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
6519         unchanged files.
6520         (Sized_incremental_binary::do_process_got_plt): New function.
6521         (Sized_incremental_binary::get_symtab_view): Use stored locations.
6522         (Output_section_incremental_inputs::set_final_data_size): Record
6523         file index for each input file.
6524         (Output_section_incremental_inputs::write_got_plt): Store file index
6525         instead of input entry offset for each GOT entry.
6526         * incremental.h
6527         (Incremental_input_entry::Incremental_input_entry): Initialize new
6528         data member.
6529         (Incremental_input_entry::set_offset): Store file index.
6530         (Incremental_input_entry::get_file_index): New function.
6531         (Incremental_input_entry::file_index_): New data member.
6532         (Incremental_binary::process_got_plt): New function.
6533         (Incremental_binary::do_process_got_plt): New function.
6534         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6535         data members.
6536         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
6537         (Sized_incremental_binary::set_file_is_unchanged): New function.
6538         (Sized_incremental_binary::file_is_unchanged): New function.
6539         (Sized_incremental_binary::do_process_got_plt): New function.
6540         (Sized_incremental_binary::file_status_): New data member.
6541         (Sized_incremental_binary::main_symtab_loc_): New data member.
6542         (Sized_incremental_binary::main_strtab_loc_): New data member.
6543         * output.cc (Output_data_got::Got_entry::write): Add case
6544         RESERVED_CODE.
6545         (Output_data_got::add_global): Call add_got_entry.
6546         (Output_data_got::add_global_plt): Likewise.
6547         (Output_data_got::add_global_with_rel): Likewise.
6548         (Output_data_got::add_global_with_rela): Likewise.
6549         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
6550         (Output_data_got::add_global_pair_with_rela): Likewise.
6551         (Output_data_got::add_local): Call add_got_entry.
6552         (Output_data_got::add_local_plt): Likewise.
6553         (Output_data_got::add_local_with_rel): Likewise.
6554         (Output_data_got::add_local_with_rela): Likewise.
6555         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
6556         (Output_data_got::add_local_pair_with_rela): Likewise.
6557         (Output_data_got::reserve_slot): New function.
6558         (Output_data_got::reserve_slot_for_global): New function.
6559         (Output_data_got::add_got_entry): New function.
6560         (Output_data_got::add_got_entry_pair): New function.
6561         (Output_section::add_output_section_data): Edit FIXME.
6562         * output.h
6563         (Output_section_data_build::Output_section_data_build): New
6564         constructor with size parameter.
6565         (Output_data_space::Output_data_space): Likewise.
6566         (Output_data_got::Output_data_got): Initialize new data member; new
6567         constructor with size parameter.
6568         (Output_data_got::add_constant): Call add_got_entry.
6569         (Output_data_got::reserve_slot): New function.
6570         (Output_data_got::reserve_slot_for_global): New function.
6571         (class Output_data_got::Got_entry): Add RESERVED_CODE.
6572         (Output_data_got::add_got_entry): New function.
6573         (Output_data_got::add_got_entry_pair): New function.
6574         (Output_data_got::free_list_): New data member.
6575         * target.h (Sized_target::init_got_plt_for_update): New function.
6576         (Sized_target::register_global_plt_entry): New function.
6577         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
6578         Initialize new data member; call init; add constructor with PLT count.
6579         (Output_data_plt_x86_64::init): New function.
6580         (Output_data_plt_x86_64::add_relocation): New function.
6581         (Output_data_plt_x86_64::reserve_slot): New function.
6582         (Output_data_plt_x86_64::free_list_): New data member.
6583         (Target_x86_64::init_got_plt_for_update): New function.
6584         (Target_x86_64::register_global_plt_entry): New function.
6585         (Output_data_plt_x86_64::add_entry): Allocate from free list for
6586         incremental updates.
6587         (Output_data_plt_x86_64::add_relocation): New function.
6588         * testsuite/object_unittest.cc (Object_test): Set default options.
6589
6590 2011-05-16  Ian Lance Taylor  <iant@google.com>
6591
6592         * options.h (class General_options): Make -i a synonym for -r.
6593
6594 2011-05-16  Ian Lance Taylor  <iant@google.com>
6595
6596         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
6597
6598 2011-05-10 Cary Coutant  <ccoutant@google.com>
6599
6600         * object.cc (Sized_relobj::do_count_local_symbols): Check for
6601         strip_all (-s).
6602
6603 2011-05-06  Ian Lance Taylor  <iant@google.com>
6604
6605         * layout.cc (Layout::layout): If the output section flags change,
6606         update the ordering.
6607
6608 2011-04-25 Cary Coutant  <ccoutant@google.com>
6609
6610         * incremental-dump.cc (dump_incremental_inputs): Print local
6611         symbol info for each input file.
6612         * incremental.cc
6613         (Output_section_incremental_inputs::set_final_data_size): Add local
6614         symbol info to input file entries in incremental info.
6615         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6616         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
6617         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
6618         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
6619         implementation.
6620         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
6621         (Sized_incr_relobj::do_relocate): Write the local symbols.
6622         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
6623         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
6624         Adjust size of input file header.
6625         (Incremental_inputs_reader::get_local_symbol_offset): New function.
6626         (Incremental_inputs_reader::get_local_symbol_count): New function.
6627         (Incremental_inputs_reader::get_input_section): Adjust size of input
6628         file header.
6629         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
6630         (Sized_incr_relobj::This): New typedef.
6631         (Sized_incr_relobj::sym_size): New const data member.
6632         (Sized_incr_relobj::Local_symbol): New struct.
6633         (Sized_incr_relobj::do_output_local_symbol_count): New function.
6634         (Sized_incr_relobj::do_local_symbol_offset): New function.
6635         (Sized_incr_relobj::local_symbol_count_): New data member.
6636         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
6637         (Sized_incr_relobj::local_symbol_index_): New data member.
6638         (Sized_incr_relobj::local_symbol_offset_): New data member.
6639         (Sized_incr_relobj::local_dynsym_offset_): New data member.
6640         (Sized_incr_relobj::local_symbols_): New data member.
6641         * object.h (Relobj::output_local_symbol_count): New function.
6642         (Relobj::local_symbol_offset): New function.
6643         (Relobj::do_output_local_symbol_count): New function.
6644         (Relobj::do_local_symbol_offset): New function.
6645         (Sized_relobj::do_output_local_symbol_count): New function.
6646         (Sized_relobj::do_local_symbol_offset): New function.
6647
6648 2011-04-22  Vladimir Simonov  <sv@sw.ru>
6649
6650         * descriptors.cc (set_close_on_exec): New function.
6651         (Descriptors::open): Use set_close_on_exec.
6652         * output.cc (S_ISLNK): Define if not defined.
6653
6654 2011-04-22 Cary Coutant  <ccoutant@google.com>
6655
6656         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6657         global symbol map.
6658         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6659         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
6660         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
6661         relocations.
6662         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
6663         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
6664         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
6665         * incremental.h
6666         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
6667         function.
6668         (Incremental_binary::apply_incremental_relocs): New function.
6669         (Incremental_binary::do_apply_incremental_relocs): New function.
6670         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6671         data member.
6672         (Sized_incremental_binary::add_global_symbol): New function.
6673         (Sized_incremental_binary::global_symbol): New function.
6674         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6675         (Sized_incremental_binary::symbol_map_): New data member.
6676         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
6677         * target.h (Sized_target::apply_relocation): New function.
6678         * target-reloc.h (apply_relocation): New function.
6679         * x86_64.cc (Target_x86_64::apply_relocation): New function.
6680
6681 2011-04-22  Doug Kwan  <dougkwan@google.com>
6682
6683         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
6684         flag of a SHT_ARM_EXIDX section.
6685         * testsuite/Makefile.am (arm_exidx_test): New test rules.
6686         * testsuite/Makefile.in: Regenerate.
6687         * testsuite/arm_exidx_test.s: New file.
6688         * testsuite/arm_exidx_test.sh: Same.
6689
6690 2011-04-20 Cary Coutant  <ccoutant@google.com>
6691
6692         PR gold/12689
6693         * archive.h (Incremental_archive_entry::Archive_member):
6694         Initialize arg_serial_ (second constructor).
6695
6696 2011-04-17  Ian Lance Taylor  <iant@google.com>
6697
6698         * object.cc (Relocate_info::location): Simplify location string.
6699         * errors.cc (Errors::error_at_location): Don't print program
6700         name.
6701         (Errors::warning_at_location): Likewise.
6702         (Errors::undefined_symbol): Likewise.
6703         * testsuite/debug_msg.sh: Update accordingly.
6704
6705 2011-04-14 Cary Coutant  <ccoutant@google.com>
6706
6707         * gold/layout.cc (Layout::symtab_section_offset): New function.
6708         * gold/layout.h (Layout::symtab_section_offset): New function.
6709         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
6710
6711 2011-04-12  Ian Lance Taylor  <iant@google.com>
6712
6713         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
6714         with MREMAP_MAYMOVE.
6715         * output.h (class Output_file): Add map_is_allocated_ field.
6716         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
6717         not available, provide stubs.  If mremap is not available, #define
6718         it to gold_mremap.
6719         (MREMAP_MAYMOVE): Define if not defined.
6720         (Output_file::Output_file): Initialize map_is_allocated_.
6721         (Output_file::resize): Check map_is_allocated_.
6722         (Output_file::map_anonymous): If mmap fails, use malloc.
6723         (Output_file::unmap): Don't do anything for an anonymous map.
6724         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
6725         is not available, provide stubs.
6726         (File_read::View::~View): Use free rather than delete[].
6727         (File_read::make_view): Use malloc rather than new[].  If mmap
6728         fails, use malloc.
6729         (File_read::find_or_make_view): Use malloc rather than new[].
6730         * gold.h: Remove HAVE_REMAP code.
6731         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
6732         exists.  Rename mremap to gold_mremap.  If mmap is not available
6733         don't do anything.
6734         * configure, config.in: Rebuild.
6735
6736 2011-04-11  Ian Lance Taylor  <iant@google.com>
6737
6738         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
6739         initialize local variable v.
6740
6741 2011-04-11  Cary Coutant  <ccoutant@google.com>
6742
6743         * archive.cc (Archive::include_member): Adjust call to
6744         report_object.
6745         (Add_archive_symbols::run): Track argument serial numbers.
6746         (Lib_group::include_member): Likewise.
6747         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
6748         * archive.h (Incremental_archive_entry::Archive_member):
6749         Initialize arg_serial_.
6750         (Archive_member::arg_serial_): New data member.
6751         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
6752         (Sized_dynobj::do_add_symbols): Track symbols when doing an
6753         incremental link.
6754         (Sized_dynobj::do_for_all_local_got_entries): New function.
6755         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
6756         function.
6757         * fileread.cc (get_mtime): New function.
6758         * fileread.h (get_mtime): New function.
6759         * gold.cc (queue_initial_tasks): Check for incremental update.
6760         (process_incremental_input): New function.
6761         (queue_middle_tasks): Don't force valid target for incremental
6762         update.
6763         * incremental-dump.cc (find_input_containing_global): Adjust
6764         size of symbol info entry.
6765         (dump_incremental_inputs): Dump argument serial number and
6766         in_system_directory flag; bias shndx by 1; print symbol names
6767         when dumping per-file symbol lists; use new symbol info readers.
6768         * incremental.cc
6769         (Output_section_incremental_inputs:update_data_size): New function.
6770         (Sized_incremental_binary::setup_readers): Setup input readers
6771         for each input file; build maps for files added from libraries
6772         and scripts.
6773         (Sized_incremental_binary::check_input_args): New function.
6774         (Sized_incremental_binary::do_check_inputs): Build map of argument
6775         serial numbers to input arguments.
6776         (Sized_incremental_binary::do_file_has_changed): Rename
6777         do_file_is_unchanged to this; compare file modification times.
6778         (Sized_incremental_binary::do_init_layout): New function.
6779         (Sized_incremental_binary::do_reserve_layout): New function.
6780         (Sized_incremental_binary::do_get_input_reader): Remove.
6781         (Sized_incremental_binary::get_symtab_view): New function.
6782         (Incremental_checker::can_incrementally_link_output_file): Remove.
6783         (Incremental_inputs::report_command_line): Exclude --debug options.
6784         (Incremental_inputs::report_archive_begin): Add parameter; track
6785         argument serial numbers; don't put input file entry for archive
6786         before archive members.
6787         (Incremental_inputs::report_archive_end): Put input file entry
6788         for archive after archive members.
6789         (Incremental_inputs::report_object): Add parameter; track argument
6790         serial numbers and in_system_directory flag.
6791         (Incremental_inputs::report_script): Add parameter; track argument
6792         serial numbers.
6793         (Output_section_incremental_inputs::set_final_data_size): Adjust
6794         size of symbol info entry; check for forwarding symbols.
6795         (Output_section_incremental_inputs::write_input_files): Write
6796         in_system_directory flag and argument serial number.
6797         (Output_section_incremental_inputs::write_info_blocks): Map section
6798         indices between incremental info and original input file; store
6799         input section index for each symbol.
6800         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
6801         change operator() to visit().
6802         (class Global_got_offset_visitor): Likewise.
6803         (class Global_symbol_visitor_got_plt):
6804         (Output_section_incremental_inputs::write_got_plt): Use new visitor
6805         classes.
6806         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
6807         (Sized_incr_relobj::do_read_symbols): New function.
6808         (Sized_incr_relobj::do_layout): New function.
6809         (Sized_incr_relobj::do_layout_deferred_sections): New function.
6810         (Sized_incr_relobj::do_add_symbols): New function.
6811         (Sized_incr_relobj::do_should_include_member): New function.
6812         (Sized_incr_relobj::do_for_all_global_symbols): New function.
6813         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
6814         (Sized_incr_relobj::do_section_size): New function.
6815         (Sized_incr_relobj::do_section_name): New function.
6816         (Sized_incr_relobj::do_section_contents): New function.
6817         (Sized_incr_relobj::do_section_flags): New function.
6818         (Sized_incr_relobj::do_section_entsize): New function.
6819         (Sized_incr_relobj::do_section_address): New function.
6820         (Sized_incr_relobj::do_section_type): New function.
6821         (Sized_incr_relobj::do_section_link): New function.
6822         (Sized_incr_relobj::do_section_info): New function.
6823         (Sized_incr_relobj::do_section_addralign): New function.
6824         (Sized_incr_relobj::do_initialize_xindex): New function.
6825         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
6826         (Sized_incr_relobj::do_read_relocs): New function.
6827         (Sized_incr_relobj::do_gc_process_relocs): New function.
6828         (Sized_incr_relobj::do_scan_relocs): New function.
6829         (Sized_incr_relobj::do_count_local_symbols): New function.
6830         (Sized_incr_relobj::do_finalize_local_symbols): New function.
6831         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
6832         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
6833         (Sized_incr_relobj::do_relocate): New function.
6834         (Sized_incr_relobj::do_set_section_offset): New function.
6835         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
6836         (Sized_incr_dynobj::do_read_symbols): New function.
6837         (Sized_incr_dynobj::do_layout): New function.
6838         (Sized_incr_dynobj::do_add_symbols): New function.
6839         (Sized_incr_dynobj::do_should_include_member): New function.
6840         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
6841         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
6842         (Sized_incr_dynobj::do_section_size): New function.
6843         (Sized_incr_dynobj::do_section_name): New function.
6844         (Sized_incr_dynobj::do_section_contents): New function.
6845         (Sized_incr_dynobj::do_section_flags): New function.
6846         (Sized_incr_dynobj::do_section_entsize): New function.
6847         (Sized_incr_dynobj::do_section_address): New function.
6848         (Sized_incr_dynobj::do_section_type): New function.
6849         (Sized_incr_dynobj::do_section_link): New function.
6850         (Sized_incr_dynobj::do_section_info): New function.
6851         (Sized_incr_dynobj::do_section_addralign): New function.
6852         (Sized_incr_dynobj::do_initialize_xindex): New function.
6853         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
6854         (make_sized_incremental_object): New function.
6855         (Incremental_library::copy_unused_symbols): New function.
6856         (Incremental_library::do_for_all_unused_symbols): New function.
6857         * incremental.h (enum Incremental_input_flags): New type.
6858         (class Incremental_checker): Remove.
6859         (Incremental_input_entry::Incremental_input_entry): Add argument
6860         serial number.
6861         (Incremental_input_entry::arg_serial): New function.
6862         (Incremental_input_entry::set_is_in_system_directory): New function.
6863         (Incremental_input_entry::is_in_system_directory): New function.
6864         (Incremental_input_entry::arg_serial_): New data member.
6865         (Incremental_input_entry::is_in_system_directory_): New data member.
6866         (class Script_info): Move here from script.h.
6867         (Script_info::Script_info): Add filename parameter.
6868         (Script_info::filename): New function.
6869         (Script_info::filename_): New data member.
6870         (Incremental_script_entry::Incremental_script_entry): Add argument
6871         serial number.
6872         (Incremental_object_entry::Incremental_object_entry): Likewise.
6873         (Incremental_object_entry::add_input_section): Build list of input
6874         sections with map to original shndx.
6875         (Incremental_object_entry::get_input_section_index): New function.
6876         (Incremental_object_entry::shndx_): New data member.
6877         (Incremental_object_entry::name_key_): Rename; adjust all refs.
6878         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
6879         (Incremental_archive_entry::Incremental_archive_entry): Add argument
6880         serial number.
6881         (Incremental_inputs::report_archive_begin): Likewise.
6882         (Incremental_inputs::report_object): Likewise.
6883         (Incremental_inputs::report_script): Likewise.
6884         (class Incremental_global_symbol_reader): New class.
6885         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
6886         and store flags and input file type.
6887         (Incremental_input_entry_reader::arg_serial): New function.
6888         (Incremental_input_entry_reader::type): Extract type from flags.
6889         (Incremental_input_entry_reader::is_in_system_directory): New function.
6890         (Incremental_input_entry_reader::get_input_section_count): Call
6891         accessor function for type.
6892         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
6893         function for type; adjust size of global symbol entry.
6894         (Incremental_input_entry_reader::get_global_symbol_count): Call
6895         accessor function for type.
6896         (Incremental_input_entry_reader::get_object_count): Likewise.
6897         (Incremental_input_entry_reader::get_object_offset): Likewise.
6898         (Incremental_input_entry_reader::get_member_count): Likewise.
6899         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
6900         (Incremental_input_entry_reader::get_member_offset): Likewise.
6901         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
6902         (Incremental_input_entry_reader::Global_symbol_info): Remove.
6903         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
6904         (Incremental_input_entry_reader::get_global_symbol_reader): New
6905         function.
6906         (Incremental_input_entry_reader::get_output_symbol_index): New
6907         function.
6908         (Incremental_input_entry_reader::type_): Remove.
6909         (Incremental_input_entry_reader::flags_): New data member.
6910         (Incremental_inputs_reader::input_file_offset): New function.
6911         (Incremental_inputs_reader::input_file_index): New function.
6912         (Incremental_inputs_reader::input_file): Call input_file_offset.
6913         (Incremental_inputs_reader::input_file_at_offset): New function.
6914         (Incremental_relocs_reader::get_r_type): Reformat.
6915         (Incremental_relocs_reader::get_r_shndx): Reformat.
6916         (Incremental_relocs_reader::get_r_offset): Reformat.
6917         (Incremental_relocs_reader::data): New function.
6918         (Incremental_binary::Incremental_binary): Initialize new data members.
6919         (Incremental_binary::check_inputs): Add cmdline parameter.
6920         (Incremental_binary::file_is_unchanged): Remove.
6921         (Input_reader::arg_serial): New function.
6922         (Input_reader::get_unused_symbol_count): New function.
6923         (Input_reader::get_unused_symbol): New function.
6924         (Input_reader::do_arg_serial): New function.
6925         (Input_reader::do_get_unused_symbol_count): New function.
6926         (Input_reader::do_get_unused_symbol): New function.
6927         (Incremental_binary::input_file_count): New function.
6928         (Incremental_binary::get_input_reader): Change signature to use
6929         index instead of filename.
6930         (Incremental_binary::file_has_changed): New function.
6931         (Incremental_binary::get_input_argument): New function.
6932         (Incremental_binary::get_library): New function.
6933         (Incremental_binary::get_script_info): New function.
6934         (Incremental_binary::init_layout): New function.
6935         (Incremental_binary::reserve_layout): New function.
6936         (Incremental_binary::output_file): New function.
6937         (Incremental_binary::do_check_inputs): New function.
6938         (Incremental_binary::do_file_is_unchanged): Remove.
6939         (Incremental_binary::do_file_has_changed): New function.
6940         (Incremental_binary::do_init_layout): New function.
6941         (Incremental_binary::do_reserve_layout): New function.
6942         (Incremental_binary::do_input_file_count): New function.
6943         (Incremental_binary::do_get_input_reader): Change signature.
6944         (Incremental_binary::input_args_map_): New data member.
6945         (Incremental_binary::library_map_): New data member.
6946         (Incremental_binary::script_map_): New data member.
6947         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6948         new data members.
6949         (Sized_incremental_binary::output_section): New function.
6950         (Sized_incremental_binary::inputs_reader): Add const.
6951         (Sized_incremental_binary::symtab_reader): Add const.
6952         (Sized_incremental_binary::relocs_reader): Add const.
6953         (Sized_incremental_binary::got_plt_reader): Add const.
6954         (Sized_incremental_binary::get_symtab_view): New function.
6955         (Sized_incremental_binary::Inputs_reader): New typedef.
6956         (Sized_incremental_binary::Input_entry_reader): New typedef.
6957         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
6958         (Sized_incremental_binary::do_file_is_unchanged): Remove.
6959         (Sized_incremental_binary::do_file_has_changed): New function.
6960         (Sized_incremental_binary::do_init_layout): New function.
6961         (Sized_incremental_binary::do_reserve_layout): New function.
6962         (Sized_input_reader::Inputs_reader): Remove.
6963         (Sized_input_reader::Input_entry_reader): Remove.
6964         (Sized_input_reader::do_arg_serial): New function.
6965         (Sized_input_reader::do_get_unused_symbol_count): New function.
6966         (Sized_input_reader::do_get_unused_symbol): New function.
6967         (Sized_incremental_binary::do_input_file_count): New function.
6968         (Sized_incremental_binary::do_get_input_reader): Change signature;
6969         use index instead of filename.
6970         (Sized_incremental_binary::section_map_): New data member.
6971         (Sized_incremental_binary::input_entry_readers_): New data member.
6972         (class Sized_incr_relobj): New class.
6973         (class Sized_incr_dynobj): New class.
6974         (make_sized_incremental_object): New function.
6975         (class Incremental_library): New class.
6976         * layout.cc (Free_list::num_lists): New static data member.
6977         (Free_list::num_nodes): New static data member.
6978         (Free_list::num_removes): New static data member.
6979         (Free_list::num_remove_visits): New static data member.
6980         (Free_list::num_allocates): New static data member.
6981         (Free_list::num_allocate_visits): New static data member.
6982         (Free_list::init): New function.
6983         (Free_list::remove): New function.
6984         (Free_list::allocate): New function.
6985         (Free_list::dump): New function.
6986         (Free_list::print_stats): New function.
6987         (Layout_task_runner::run): Resize output file for incremental updates.
6988         (Layout::Layout): Initialize new data members.
6989         (Layout::set_incremental_base): New function.
6990         (Layout::init_fixed_output_section): New function.
6991         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6992         incremental updates.
6993         (Layout::create_gold_note): Do not create gold note section for
6994         incremental updates.
6995         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6996         for incremental updates.
6997         (Layout::set_section_offsets): For incremental updates, allocate space
6998         from free list.
6999         (Layout::create_symtab_sections): Layout with offsets relative to
7000         start of section; for incremental updates, allocate space from free
7001         list.
7002         (Layout::create_shdrs): For incremental updates, allocate space from
7003         free list.
7004         (Layout::finish_dynamic_section): For incremental updates, do not
7005         check --as-needed (fixed in subsequent patch).
7006         * layout.h (class Free_list): New class.
7007         (Layout::set_incremental_base): New function.
7008         (Layout::incremental_base): New function.
7009         (Layout::init_fixed_output_section): New function.
7010         (Layout::allocate): New function.
7011         (Layout::incremental_base_): New data member.
7012         (Layout::free_list_): New data member.
7013         * main.cc (main): Print Free_list statistics.
7014         * object.cc (Relobj::finalize_incremental_relocs): Add
7015         clear_counts parameter; clear counts only when clear_counts is set.
7016         (Sized_relobj::Sized_relobj): Initialize new base class.
7017         (Sized_relobj::do_layout): Don't report special sections.
7018         (Sized_relobj::do_for_all_local_got_entries): New function.
7019         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
7020         symtab_off to all symbol table offsets.
7021         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
7022         * object.h (class Got_offset_list): Move to top of file.
7023         (Object::Object): Allow case where input_file == NULL.
7024         (Object::~Object): Likewise.
7025         (Object::input_file): Assert that input_file != NULL.
7026         (Object::lock): Allow case where input_file == NULL.
7027         (Object::unlock): Likewise.
7028         (Object::is_locked): Likewise.
7029         (Object::token): Likewise.
7030         (Object::release): Likewise.
7031         (Object::is_incremental): New function.
7032         (Object::get_mtime): New function.
7033         (Object::for_all_local_got_entries): New function.
7034         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
7035         (Object::set_is_in_system_directory): New function.
7036         (Object::is_in_system_directory): New function.
7037         (Object::do_is_incremental): New function.
7038         (Object::do_get_mtime): New function.
7039         (Object::do_for_all_local_got_entries): New function.
7040         (Object::is_in_system_directory_): New data member.
7041         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
7042         (class Sized_relobj_base): New class.
7043         (class Sized_relobj): Derive from Sized_relobj_base.
7044         (class Sized_relobj::Symbols): Redeclare from base class.
7045         (class Sized_relobj::local_got_offset_list): Remove.
7046         (class Sized_relobj::Output_sections): Redeclare from base class.
7047         (class Sized_relobj::do_for_all_local_got_entries): New function.
7048         (class Sized_relobj::write_local_symbols): Add offset parameter.
7049         (class Sized_relobj::local_symbol_offset_): Update comment.
7050         (class Sized_relobj::local_dynsym_offset_): Update comment.
7051         * options.cc (Input_arguments::add_file): Remove const.
7052         * options.h (Input_file_argument::Input_file_argument):
7053         Initialize arg_serial_ (all constructors).
7054         (Input_file_argument::set_arg_serial): New function.
7055         (Input_file_argument::arg_serial): New function.
7056         (Input_file_argument::arg_serial_): New data member.
7057         (Input_arguments::Input_arguments): Initialize file_count_.
7058         (Input_arguments::add_file): Remove const.
7059         (Input_arguments::number_of_input_files): New function.
7060         (Input_arguments::file_count_): New data member.
7061         (Command_line::number_of_input_files): Call
7062         Input_arguments::number_of_input_files.
7063         * output.cc (Output_segment_headers::Output_segment_headers):
7064         Set current size.
7065         (Output_section::Input_section::current_data_size): New function.
7066         (Output_section::Output_section): Initialize new data members.
7067         (Output_section::add_input_section): Don't do merge sections for
7068         an incremental link; allocate space from free list for an
7069         incremental update.
7070         (Output_section::add_output_section_data): Allocate space from
7071         free list for an incremental update.
7072         (Output_section::update_data_size): New function.
7073         (Output_section::set_fixed_layout): New function.
7074         (Output_section::reserve): New function.
7075         (Output_segment::set_section_addresses): Remove const.
7076         (Output_segment::set_section_list_addresses): Remove const; allocate
7077         space from free list for an incremental update.
7078         (Output_segment::set_offset): Adjust size of RELRO segment for an
7079         incremental update.
7080         * output.h (Output_data::current_data_size): Move here from
7081         child classes.
7082         (Output_data::pre_finalize_data_size): New function.
7083         (Output_data::update_data_size): New function.
7084         (Output_section_headers::update_data_size): new function.
7085         (Output_section_data_build::current_data_size): Move to Output_data.
7086         (Output_data_strtab::update_data_size): New function.
7087         (Output_section::current_data_size): Move to Output_data.
7088         (Output_section::set_fixed_layout): New function.
7089         (Output_section::has_fixed_layout): New function.
7090         (Output_section::reserve): New function.
7091         (Output_section::update_data_size): New function.
7092         (Output_section::has_fixed_layout_): New data member.
7093         (Output_section::free_list_): New data member.
7094         (Output_segment::set_section_addresses): Remove const.
7095         (Output_segment::set_section_list_addresses): Remove const.
7096         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
7097         New function.
7098         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
7099         New function.
7100         * readsyms.cc (Read_symbols::do_read_symbols): Add library
7101         parameter when calling Add_symbols constructor; store argument
7102         serial number for members of a lib group.
7103         (Add_symbols::locks): Allow case where token == NULL.
7104         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
7105         (Read_member::~Read_member): New function.
7106         (Read_member::is_runnable): New function.
7107         (Read_member::locks): New function.
7108         (Read_member::run): New function.
7109         (Check_script::~Check_script): New function.
7110         (Check_script::is_runnable): New function.
7111         (Check_script::locks): New function.
7112         (Check_script::run): New function.
7113         (Check_library::~Check_library): New function.
7114         (Check_library::is_runnable): New function.
7115         (Check_library::locks): New function.
7116         (Check_library::run): New function.
7117         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
7118         (Add_symbols::library_): New data member.
7119         (class Read_member): New class.
7120         (class Check_script): New class.
7121         (class Check_library): New class.
7122         * reloc.cc (Read_relocs::is_runnable): Allow case where
7123         token == NULL.
7124         (Read_relocs::locks): Likewise.
7125         (Scan_relocs::locks): Likewise.
7126         (Relocate_task::locks): Likewise.
7127         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
7128         to clear counters.
7129         (Sized_relobj::incremental_relocs_scan): Fix comment.
7130         (Sized_relobj::do_relocate): Pass output file offset to
7131         write_local_symbols.
7132         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
7133         from class declaration.
7134         * script.cc (read_input_script): Allocate Script_info; pass
7135         argument serial number to report_script.
7136         * script.h (class Script_info): Move to incremental.h.
7137         * symtab.cc (Symbol_table::add_from_incrobj): New function.
7138         * symtab.h (Symbol_table::add_from_incrobj): New function.
7139         (Symbol_table::set_file_offset): New function.
7140
7141 2011-04-05  Cary Coutant  <ccoutant@google.com>
7142
7143         * incremental-dump.cc (dump_incremental_inputs): Change signature
7144         to take a Sized_incremental_binary; change caller.  Use readers
7145         in Sized_incremental_binary.
7146         * incremental.cc
7147         (Sized_incremental_binary::find_incremental_inputs_sections):
7148         Rename do_find_incremental_inputs_sections to this.
7149         (Sized_incremental_binary::setup_readers): New function.
7150         (Sized_incremental_binary::do_check_inputs): Check
7151         has_incremental_info_ flag; move setup code to setup_readers;
7152         use input readers.
7153         (Sized_incremental_binary::do_file_is_unchanged): New function.
7154         (Sized_incremental_binary::do_get_input_reader): New function.
7155         * incremental.h (class Incremental_binary): Move to end of file.
7156         (Incremental_binary::file_is_unchanged): New function.
7157         (Incremental_binary::do_file_is_unchanged): New function.
7158         (Incremental_binary::Input_reader): New class.
7159         (Incremental_binary::get_input_reader): New function.
7160         (class Sized_incremental_binary): Move to end of file.
7161         (Sized_incremental_binary::Sized_incremental_binary): Setup the
7162         input section reader classes.
7163         (Sized_incremental_binary::has_incremental_info): New function.
7164         (Sized_incremental_binary::inputs_reader): New function.
7165         (Sized_incremental_binary::symtab_reader): New function.
7166         (Sized_incremental_binary::relocs_reader): New function.
7167         (Sized_incremental_binary::got_plt_reader): New function.
7168         (Sized_incremental_binary::do_file_is_unchanged): New function.
7169         (Sized_incremental_binary::Sized_input_reader): New class.
7170         (Sized_incremental_binary::get_input_reader): New function.
7171         (Sized_incremental_binary::find_incremental_inputs_sections):
7172         Rename do_find_incremental_inputs_sections to this.
7173         (Sized_incremental_binary::setup_readers): New function.
7174         (Sized_incremental_binary::has_incremental_info_): New data member.
7175         (Sized_incremental_binary::inputs_reader_): New data member.
7176         (Sized_incremental_binary::symtab_reader_): New data member.
7177         (Sized_incremental_binary::relocs_reader_): New data member.
7178         (Sized_incremental_binary::got_plt_reader_): New data member.
7179         (Sized_incremental_binary::current_input_file_): New data member.
7180
7181 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
7182
7183         PR gold/12640
7184         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
7185         violation.
7186
7187 2011-03-30  Cary Coutant  <ccoutant@google.com>
7188
7189         * archive.cc (Archive::include_member): Adjust call to report_object.
7190         (Add_archive_symbols::run): Add script_info to call to
7191         report_archive_begin.
7192         (Lib_group::include_member): Adjust call to report_object.
7193         (Add_lib_group_symbols::run): Adjust call to report_object.
7194         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
7195         blocks.  Add object count for script input files.
7196         * incremental.cc (Incremental_inputs::report_archive_begin): Add
7197         script_info parameter; change all callers.
7198         (Incremental_inputs::report_object): Add script_info parameter;
7199         change all callers.
7200         (Incremental_inputs::report_script): Store backpointer to
7201         incremental info entry.
7202         (Output_section_incremental_inputs::set_final_data_size): Record
7203         additional information for scripts.
7204         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7205         * incremental.h (Incremental_script_entry::add_object): New function.
7206         (Incremental_script_entry::get_object_count): New function.
7207         (Incremental_script_entry::get_object): New function.
7208         (Incremental_script_entry::objects_): New data member; adjust
7209         constructor.
7210         (Incremental_inputs::report_archive_begin): Add script_info parameter.
7211         (Incremental_inputs::report_object): Add script_info parameter.
7212         (Incremental_inputs_reader::get_object_count): New function.
7213         (Incremental_inputs_reader::get_object_offset): New function.
7214         * options.cc (Input_arguments::add_file): Return reference to
7215         new input argument.
7216         * options.h (Input_argument::set_script_info): New function.
7217         (Input_argument::script_info): New function.
7218         (Input_argument::script_info_): New data member; adjust all
7219         constructors.
7220         (Input_file_group::add_file): Return reference to new input argument.
7221         (Input_file_lib::add_file): Likewise.
7222         (Input_arguments::add_file): Likewise.
7223         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
7224         * script.cc (Parser_closure::Parser_closure): Add script_info
7225         parameter; adjust all callers.
7226         (Parser_closure::script_info): New function.
7227         (Parser_closure::script_info_): New data member.
7228         (read_input_script): Report scripts earlier to incremental info.
7229         (script_add_file): Set script_info in Input_argument.
7230         (script_add_library): Likewise.
7231         * script.h (Script_options::Script_info): Rewrite class.
7232
7233 2011-03-29  Cary Coutant  <ccoutant@google.com>
7234
7235         * archive.cc (Library_base::should_include_member): Move
7236         method here from class Archive.
7237         (Archive::Archive): Initialize base class.
7238         (Archive::should_include_member): Move to base class.
7239         (Archive::do_for_all_unused_symbols): New function.
7240         (Add_archive_symbols::run): Remove redundant access to
7241         incremental_inputs.
7242         (Lib_group::Lib_group): Initialize base class.
7243         (Lib_group::do_filename): New function.
7244         (Lib_group::include_member): Pass pointer to Lib_group to
7245         report_object.
7246         (Lib_group::do_for_all_unused_symbols): New function.
7247         (Add_lib_group_symbols::run): Report archive information for
7248         incremental links.
7249         * archive.h (class Library_base): New base class.
7250         (class Archive): Derive from Library_base.
7251         (Archive::filename): Move to base class.
7252         (Archive::set_incremental_info): Likewise.
7253         (Archive::incremental_info): Likewise.
7254         (Archive::Should_include): Likewise.
7255         (Archive::should_include_member): Likewise.
7256         (Archive::Armap_entry): Remove.
7257         (Archive::Unused_symbol_iterator): Remove.
7258         (Archive::unused_symbols_begin): Remove.
7259         (Archive::unused_symbols_end): Remove.
7260         (Archive::do_filename): New function.
7261         (Archive::do_get_mtime): New function.
7262         (Archive::do_for_all_unused_symbols): New function.
7263         (Archive::task_): Move to base class.
7264         (Archive::incremental_info_): Likewise.
7265         (class Lib_group): Derive from Library_base.
7266         (Lib_group::do_filename): New function.
7267         (Lib_group::do_get_mtime): New function.
7268         (Lib_group::do_for_all_unused_symbols): New function.
7269         (Lib_group::task_): Move to base class.
7270         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
7271         function.
7272         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
7273         function.
7274         * incremental.cc (Incremental_inputs::report_archive_begin):
7275         Use Library_base; call library's get_mtime; add incremental inputs
7276         entry before members.
7277         (class Unused_symbol_visitor): New class.
7278         (Incremental_inputs::report_archive_end): Use Library_base; use
7279         visitor class to record unused symbols; don't add incremental inputs
7280         entry after members.
7281         (Incremental_inputs::report_object): Use Library_base.
7282         * incremental.h
7283         (Incremental_archive_entry::Incremental_archive_entry): Remove
7284         unused Archive parameter.
7285         (Incremental_inputs::report_archive_begin): Use Library_base.
7286         (Incremental_inputs::report_archive_end): Likewise.
7287         (Incremental_inputs::report_object): Likewise.
7288         * object.cc (Sized_relobj::do_for_all_global_symbols): New
7289         function.
7290         * object.h (Object::for_all_global_symbols): New function.
7291         (Object::do_for_all_global_symbols): New function.
7292         (Sized_relobj::do_for_all_global_symbols): New function.
7293         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
7294         function.
7295         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
7296         function.
7297
7298 2011-03-27  Ian Lance Taylor  <iant@google.com>
7299
7300         * archive.cc (Archive::interpret_header): Return -1 if something
7301         goes wrong.  Change callers accordingly.
7302
7303 2011-03-25  Cary Coutant  <ccoutant@google.com>
7304
7305         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
7306         * testsuite/Makefile.in: Regenerate.
7307
7308 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
7309
7310         * plugin.cc (get_view): New.
7311         (Plugin::load): Pass get_view to the plugin.
7312         (Plugin_manager::get_view): New.
7313
7314 2011-03-21  Ian Lance Taylor  <iant@google.com>
7315
7316         * testsuite/final_layout.sh: Rewrite to not use dc.
7317         * testsuite/relro_test.sh: Fail if dc is not present.
7318
7319 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
7320
7321         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
7322         Change == to -eq.
7323         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
7324         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
7325         Change == to -eq.
7326         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
7327         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
7328
7329 2011-03-14  Ian Lance Taylor  <iant@google.com>
7330
7331         * script-sections.cc (Sort_output_sections::script_compare):
7332         Rename from is_before, change return type.
7333         (Sort_output_sections::operator()): Adjust accordingly.
7334
7335 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
7336
7337         PR gold/12572
7338         * testsuite/odr_violation2.cc: Add comment to make all error line
7339         numbers double digits.
7340         * testsuite/debug_msg.sh: Adjust expected errors.
7341
7342 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
7343
7344         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
7345         but mark earlier ones as non-canonical
7346         (offset_to_iterator): Update search target and example
7347         (do_addr2line): Return extra lines in a vector*
7348         (format_file_lineno): Extract from do_addr2line
7349         (one_addr2line): Add vector* out-param
7350         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
7351         when a lineno entry appeared last for its instruction
7352         (Dwarf_line_info): Add vector* out-param
7353         * object.cc (Relocate_info): Pass NULL for the vector* out-param
7354         * symtab.cc (Odr_violation_compare): Include the lineno in the
7355         comparison again.
7356         (linenos_from_loc): New. Combine the canonical line for an
7357         address with its other lines.
7358         (True_if_intersect): New. Helper functor to make
7359         std::set_intersection a query.
7360         (detect_odr_violations): Compare sets of lines instead of just
7361         one line for each function. This became less deterministic, but
7362         has fewer false positives.
7363         * symtab.h: Declarations.
7364         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
7365         mix an optimized and non-optimized object in the same binary
7366         (odr_violation2.so): Same.
7367         * testsuite/Makefile.in: Regenerate from Makefile.am.
7368         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
7369         * testsuite/debug_msg.sh: Update line numbers and add
7370         assertions.
7371         * testsuite/odr_violation1.cc: Use OdrDerived, in a
7372         non-optimized context.
7373         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
7374         isn't inlined, and use OdrDerived in an optimized context.
7375         * testsuite/odr_header1.h: Defines OdrDerived, where
7376         optimization will change the
7377         first-instruction-in-the-destructor's file and line number.
7378         * testsuite/odr_header2.h: Defines OdrBase.
7379
7380 2011-03-09  Ian Lance Taylor  <iant@google.com>
7381
7382         * fileread.cc (File_read::clear_views): Don't delete the whole
7383         file view.
7384
7385 2011-03-08  Ian Lance Taylor  <iant@google.com>
7386
7387         PR gold/12525
7388         * fileread.cc: #include <climits>.
7389         (GOLD_IOV_MAX): Define.
7390         (File_read::read_multiple): Limit number of entries by iov_max.
7391         * fileread.h (class File_read): Always set max_readv_entries to
7392         128.
7393
7394 2011-03-07  Ian Lance Taylor  <iant@google.com>
7395
7396         PR gold/12525
7397         * options.h (class General_options): Add -dy and -dn.
7398
7399 2011-03-02  Cary Coutant  <ccoutant@google.com>
7400
7401         * testsuite/script_test_9.t: Add TLS segment.
7402
7403 2011-03-02  Simon Baldwin  <simonb@google.com>
7404
7405         * configure.ac: Add check for gnu_indirect_function support in
7406         the toolchain building binutils.
7407         * configure: Rebuild.
7408
7409 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
7410
7411         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
7412         plugin only symbols.
7413         (Symbol_table::sized_finalize_symbol) Mark symbol only present
7414         in plugin files as not needed in the symbol table.
7415
7416 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
7417
7418         * output.cc (Output_section::add_input_section): Delay fill
7419         generation for section ordering.
7420
7421 2011-02-09  Ian Lance Taylor  <iant@google.com>
7422
7423         PR gold/12316
7424         * object.h (class Sized_relobj): Remove clear_local_symbols.
7425         * reloc.cc (Sized_relobj::do_relocate): Don't call
7426         clear_local_symbols.
7427
7428 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
7429
7430         * plugin.cc (is_visible_from_outside): Return true for symbols
7431         in the -u option.
7432
7433 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
7434
7435         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
7436         filename.
7437
7438 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
7439
7440         * icf.h (is_section_foldable_candidate): Change type of parameter
7441         to std::string.
7442         * icf.cc (Icf::find_identical_sections): Change type of local variable
7443         section_name to be std::string.
7444         (is_function_ctor_or_dtor): Change type of parameter to std::string.
7445
7446 2011-01-25  Ian Lance Taylor  <iant@google.com>
7447
7448         * script.cc (script_add_extern): Rewrite to use
7449         add_symbol_reference.
7450
7451 2011-01-25  Doug Kwan  <dougkwan@google.com>
7452
7453         * icf.cc (get_section_contents): Always lock section's object.
7454
7455 2011-01-24  Ian Lance Taylor  <iant@google.com>
7456
7457         * options.h (class General_options): Accept
7458         --no-detect-odr-violations.
7459
7460 2011-01-24  Ian Lance Taylor  <iant@google.com>
7461
7462         * version.cc (version_string): Bump to 1.11.
7463
7464 2011-01-24  Ian Lance Taylor  <iant@google.com>
7465
7466         * plugin.cc (class Plugin_rescan): Define new class.
7467         (Plugin_manager::claim_file): Set any_claimed_.
7468         (Plugin_manager::save_archive): New function.
7469         (Plugin_manager::save_input_group): New function.
7470         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
7471         necessary.
7472         (Plugin_manager::new_undefined_symbol): New function.
7473         (Plugin_manager::rescan): New function.
7474         (Plugin_manager::rescannable_defines): New function.
7475         (Plugin_manager::add_input_file): Set any_added_.
7476         * plugin.h (class Plugin_manager): define new fields rescannable_,
7477         undefined_symbols_, any_claimed_, and any_added_.  Declare
7478         Plugin_rescan as friend.  Declare new functions.
7479         (Plugin_manager::Rescannable): Define type.
7480         (Plugin_manager::Rescannable_list): Define type.
7481         (Plugin_manager::Undefined_symbol_list): Define type.
7482         (Plugin_manager::Plugin_manager): Initialize new fields.
7483         * archive.cc (Archive::defines_symbol): New function.
7484         (Add_archive_symbols::run): Pass archive to plugins if any.
7485         * archive.h (class Archive): Declare defines_symbol.
7486         * readsyms.cc (Input_group::~Input_group): New function.
7487         (Finish_group::run): Pass input_group to plugins if any.
7488         * readsyms.h (class Input_group): Declare destructor.
7489         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
7490         any.
7491
7492 2011-01-10  Ian Lance Taylor  <iant@google.com>
7493
7494         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
7495         section as relro.
7496         (Layout::set_segment_offsets): Reset increase_relro before calling
7497         set_section_addresses a second time.
7498
7499 2011-01-04  Cary Coutant  <ccoutant@google.com>
7500
7501         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
7502         sections before NOBITS sections.
7503
7504 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
7505
7506         * version.cc (print_version): Update copyright to 2011.
7507
7508 2010-12-23  Cary Coutant  <ccoutant@google.com>
7509
7510         * output.h (Output_data_reloc::add_output_section): Pass OD instead
7511         of OS to this->add.  Add OD parameter to second form of the function.
7512
7513 2010-12-20  Ian Lance Taylor  <iant@google.com>
7514
7515         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
7516         second of two consecutive entries with same offset.
7517
7518 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7519
7520         * testsuite/Makefile.am (ifuncmain2static_LDADD)
7521         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
7522         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
7523         to avoid unneeded links against $(LDADD).
7524         * testsuite/Makefile.in: Regenerate.
7525
7526 2010-12-15  Ian Lance Taylor  <iant@google.com>
7527
7528         PR gold/12324
7529         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
7530         for R_X86_64_32 and R_X86_64_PC32.
7531         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
7532         ver_matching_def_pic.o.
7533         (ver_matching_def_pic.o): New target.
7534
7535 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7536
7537         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
7538         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
7539         Move definition before File_read::View member definitions.
7540         (File_read::View::~View): Initialize and hold lock before
7541         updating current_mapped_bytes.
7542
7543 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7544
7545         * dwarf_reader.cc: Remove outdated comment.
7546         * gold-threads.cc: Fix typo in error message.
7547         * archive.cc: Fix typos in comments.
7548         * archive.h: Likewise.
7549         * arm-reloc-property.cc: Likewise.
7550         * arm-reloc-property.h: Likewise.
7551         * arm-reloc.def: Likewise.
7552         * arm.cc: Likewise.
7553         * attributes.h: Likewise.
7554         * cref.cc: Likewise.
7555         * ehframe.cc: Likewise.
7556         * fileread.h: Likewise.
7557         * gold.h: Likewise.
7558         * i386.cc: Likewise.
7559         * icf.cc: Likewise.
7560         * incremental.h: Likewise.
7561         * int_encoding.cc: Likewise.
7562         * layout.h: Likewise.
7563         * main.cc: Likewise.
7564         * merge.h: Likewise.
7565         * object.cc: Likewise.
7566         * object.h: Likewise.
7567         * options.cc: Likewise.
7568         * readsyms.cc: Likewise.
7569         * reduced_debug_output.cc: Likewise.
7570         * reloc.cc: Likewise.
7571         * script-sections.cc: Likewise.
7572         * sparc.cc: Likewise.
7573         * symtab.h: Likewise.
7574         * target-reloc.h: Likewise.
7575         * target.cc: Likewise.
7576         * target.h: Likewise.
7577         * timer.cc: Likewise.
7578         * timer.h: Likewise.
7579         * x86_64.cc: Likewise.
7580
7581 2010-12-09  Cary Coutant  <ccoutant@google.com>
7582
7583         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
7584         stack.
7585         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
7586         parameter; change all callers.
7587         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
7588         * options.h (warn_execstack): New option.
7589
7590 2010-12-07  Doug Kwan  <dougkwan@google.com>
7591
7592         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
7593         like function call relocations.
7594
7595 2010-12-07  Ian Lance Taylor  <iant@google.com>
7596
7597         * archive.cc (Archive::get_elf_object_for_member): Permit
7598         punconfigured to be NULL.
7599         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
7600         (Archive::include_member): Pass NULL to get_elf_object_for_member
7601         if we searched for the archive and this is the first included
7602         object.
7603
7604 2010-12-01  Ian Lance Taylor  <iant@google.com>
7605
7606         * dwarf_reader.h (class Sized_dwarf_line_info): Add
7607         track_relocs_type_ field.
7608         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7609         Set track_relocs_type_.
7610         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
7611         contents when using RELA relocs.
7612         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
7613         reloc_map_.
7614         * reloc.cc (Track_relocs::next_addend): New function.
7615         * reloc.h (class Track_relocs): Declare next_addend.
7616
7617 2010-12-01  Ian Lance Taylor  <iant@google.com>
7618
7619         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
7620         virtual destructor.
7621
7622 2010-12-01  Ian Lance Taylor  <iant@google.com>
7623
7624         * README: Update compilers known to work and fail.
7625
7626 2010-11-23  Matthias Klose  <doko@ubuntu.com>
7627
7628         * configure.in: For --enable-gold, handle value `default' instead of
7629         `both*'.  Always install ld as ld.bfd, install as ld if gold is
7630         not the default.
7631         * configure: Regenerate.
7632
7633 2010-11-18  Doug Kwan  <dougkwan@google.com>
7634
7635         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
7636         and right_alignment to be zero.  Store result alignment only if it is
7637         greater than existing alignment.
7638
7639 2010-11-16  Cary Coutant  <ccoutant@google.com>
7640
7641         PR gold/12220
7642         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7643         Check for ".zdebug_line".
7644
7645 2010-11-16  Doug Kwan  <dougkwan@google.com>
7646             Cary Coutant  <ccoutant@google.com>
7647
7648         * output.h (Output_segment::set_section_addresses): Pass increase_relro
7649         by reference; adjust all callers.
7650         * output.cc (Output_segment::set_section_addresses): Adjust references
7651         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
7652         list is empty.
7653         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
7654         end at page boundary.
7655
7656 2010-11-16  Cary Coutant  <ccoutant@google.com>
7657
7658         PR gold/12220
7659         * layout.cc (Layout::choose_output_section): Transform names of
7660         compressed sections even when using a script with a SECTIONS clause.
7661         (Layout::output_section_name): Remove code to transform
7662         compressed debug section names.
7663         * output.cc (Output_section::add_input_section): Use uncompressed
7664         section size when tracking input sections.
7665
7666 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
7667
7668         * symtab.h (Symbol::NON_PIC_REF): Remove.
7669         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
7670         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
7671         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
7672         (Symbol::use_plt_offset): Take a flags argument and pass it
7673         directly to needs_dynamic_reloc.  Restrict check for undefined
7674         weak symbols to function calls.
7675         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
7676         (Target_arm::Scan::global): Use it.
7677         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
7678         (Target_arm::Relocate::relocate): Likewise.
7679         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
7680         parameter with an r_type parameter.  Use get_reference_flags
7681         to get the flags.
7682         (Target_arm::Relocate::relocate): Update accordingly.
7683         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
7684         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
7685         (Target_i386::Scan::global): Likewise.
7686         (Target_i386::Relocate::relocate): Likewise.
7687         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
7688         parameter with an r_type parameter.  Use get_reference_flags
7689         to get the flags.
7690         (Target_i386::Relocate::relocate): Update accordingly.
7691         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
7692         (Target_powerpc::Scan::global): Use it.
7693         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
7694         (Target_powerpc::Relocate::relocate): Likewise.
7695         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
7696         (Target_sparc::Scan::global): Use it.
7697         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
7698         (Target_sparc::Relocate::relocate): Likewise.
7699         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
7700         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
7701         (Target_x86_64::Scan::global): Likewise.
7702         (Target_x86_64::Relocate::relocate): Likewise.
7703
7704 2010-11-08  Doug Kwan  <dougkwan@google.com>
7705             Cary Coutant  <ccoutant@google.com>
7706
7707         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
7708         (Arm_exidx_merge_section::section_contents_): New data member.
7709         (Arm_input_section::Arm_input_section): Initialize original_contents_.
7710         (Arm_input_section::~Arm_input_section): De-allocate memory.
7711         (Arm_input_section::original_contents_): New data member.
7712         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
7713         in parameters instead of calling Object::section_contents without
7714         locking.
7715         (Arm_output_section::group_section): New parameter TASK.  Pass it
7716         to callees that need locking objects.
7717         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
7718         to lock EXIDX input sections.  Fix a formatting issue.  Call
7719         Arm_exidx_merged_section::build_contents to create merged section
7720         contents.
7721         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
7722         to lock object of stub table owner.
7723         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
7724         TEXT_SIZE to initialize data member TEXT_SIZE_.
7725         (Arm_exidx_input_section::addralign): Fix typo in comment.
7726         (Arm_exidx_input_section::text_size): New method.
7727         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
7728         that require locking objects.  Lock objects before scanning for stubs
7729         and updating local symbols.
7730         (Arm_input_section<big_endian>::init): Copy contents of original
7731         input section.
7732         (Arm_input_section<big_endian>::do_write): Use saved contents of
7733         original input section instead of calling Object::section_contents
7734         without locking.
7735         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
7736         size without calling Object::section_size().
7737         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
7738         for size.  Allocate a buffer for merged EXIDX entries.
7739         (Arm_exidx_merged_section::build_contents): New method.
7740         (Arm_exidx_merged_section::do_write): Move merge section contents
7741         building code to Arm_exidx_merged_section::build_contetns.  Write
7742         out contetns in buffer instead of building it on the fly.
7743         (Arm_relobj::make_exidx_input_section): Also pass text section size
7744         to Arm_exidx_input_section constructor.
7745         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
7746         (Arm_dynobj::do_read_symbols): Fix memory leak.
7747         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
7748         * target.h: (class Task): Add forward declaration.
7749         (Target::relax): Add new parameter TASK and pass it to
7750         Target::do_relax().
7751         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
7752
7753 2010-11-05  Cary Coutant  <ccoutant@google.com>
7754
7755         PR gold/10708
7756         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
7757         object when reading from the file.
7758         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
7759         second layout pass.
7760         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
7761         when reading section contents.
7762         (get_section_contents): Likewise.
7763         (icf::find_identical_sections): Likewise.
7764         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
7765         object when reading from the file.
7766         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
7767         the object when doing deferred section layout.
7768
7769 2010-11-03  Nick Clifton  <nickc@redhat.com>
7770
7771         PR gold/12001
7772         * script.h (class Symbol_assignment: name): New member.  Returns
7773         the name of the symbol.
7774         * scrfipt.cc (Script_options::is_pending_assignment): New member.
7775         Returns true if the given symbol name is on the list of
7776         assignments wating to be processed.
7777         * archive.cc (should_incldue_member): If the symbol is undefined,
7778         check to see if it is on the list of symbols pending assignment.
7779
7780 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
7781
7782         * script-sections.cc (Script_sections::find_memory_region): Check
7783         for a NULL output section pointer.
7784
7785 2010-10-29  Doug Kwan  <dougkwan@google.com>
7786
7787         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
7788         Output_section::add_relaxed_input_section.
7789         * output.cc (Output_section::add_relaxed_input_section): Add new
7790         arguments LAYOUT and NAME.  Set section order index.
7791         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7792         Copy section order index.
7793         * output.h (Output_section::add_relaxed_input_section): Add new
7794         arguments LAYOUT and NAME.
7795
7796 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7797
7798         * testsuite/Makefile.am: Move gcctestdir/ld rule to
7799         NATIVE_OR_CROSS_LINKER.
7800         * testsuite/Makefile.in: Regenerate.
7801
7802 2010-10-20  Doug Kwan  <dougkwan@google.com>
7803
7804         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
7805         without SHF_LINK_ORDER flags.
7806         * layout.cc (Layout::choose_output_section): Do not filter
7807         SHF_LINK_ORDER flag in a relocatable link.
7808
7809 2010-10-17  Cary Coutant  <ccoutant@google.com>
7810
7811         * output.h (Output_segment::set_section_addresses): Change function
7812         signature.  Update all callers.
7813         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
7814         sections.
7815         (Output_segment::set_section_addresses): Align after last TLS
7816         section.  Add padding before last relro section instead of after.
7817
7818 2010-10-17  Doug Kwan  <dougkwan@google.com>
7819
7820         * gold/arm.cc (Target_arm::got_section): Use correct order and set
7821         GOT output section to be writable.
7822
7823 2010-10-14  Cary Coutant  <ccoutant@google.com>
7824
7825         * debug.h (DEBUG_INCREMENTAL): New flag.
7826         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
7827         * gold.cc (queue_initial_tasks): Check parameters for incremental link
7828         mode.
7829         * incremental.cc (report_command_line): Ignore all forms of
7830         --incremental.
7831         * layout.cc (Layout::Layout): Check parameters for incremental link
7832         mode.
7833         * options.cc (General_options::parse_incremental): New function.
7834         (General_options::parse_no_incremental): New function.
7835         (General_options::parse_incremental_full): New function.
7836         (General_options::parse_incremental_update): New function.
7837         (General_options::incremental_mode_): New data member.
7838         (General_options::finalize): Check incremental_mode_.
7839         * options.h (General_options): Update help text for --incremental.
7840         Add --no-incremental, --incremental-full, --incremental-update.
7841         (General_options::Incremental_mode): New enum type.
7842         (General_options::incremental_mode): New function.
7843         (General_options::incremental_mode_): New data member.
7844         * parameters.cc (Parameters::incremental_mode_): New data member.
7845         (Parameters::set_options): Set incremental_mode_.
7846         (Parameters::set_incremental_full): New function.
7847         (Parameters::incremental): New function.
7848         (Parameters::incremental_update): New function.
7849         (set_parameters_incremental_full): New function.
7850         * parameters.h (Parameters::set_incremental_full): New function.
7851         (Parameters::incremental): New function.
7852         (Parameters::incremental_update): New function.
7853         (Parameters::incremental_mode_): New data member.
7854         (set_parameters_incremental_full): New function.
7855         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
7856         incremental link mode.
7857         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
7858         (Sized_relobj::do_relocate_sections): Likewise.
7859         * testsuite/Makefile.am (incremental_test): Use --incremental-full
7860         option.
7861         * testsuite/Makefile.in: Regenerate.
7862         * testsuite/incremental_test.sh: Filter all forms of --incremental.
7863
7864 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7865
7866         * script-sections.h (class Script_sections): Make
7867         Sections_elements typedef public.
7868         * script-sections.cc (class Sort_output_sections): Add elements_
7869         field.  Add constructor which sets it; change all callers.
7870         (Sort_output_sections::is_before): New function.
7871         (Sort_output_sections::operator()): Call is_before.
7872         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
7873         conditional.
7874         * testsuite/script_test_10.sh: New test. Test script section
7875         order.
7876         * testsuite/script_test_10.t: Likewise.
7877         * testsuite/script_test_10.s: Likewise.
7878         * testsuite/Makefile.am: Wrap the cross linker tests and the
7879         common tests into NATIVE_OR_CROSS_LINKER.
7880         (check_SCRIPTS): Add script_test_10.sh.
7881         (check_DATA): Add script_test_10.stdout.
7882         (script_test_10.o, script_test_10): New targets.
7883         (script_test_10.stdout): New target.
7884         * configure, testsuite/Makefile.in: Regenerate.
7885
7886 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7887
7888         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
7889         error for the deprecated relocations.
7890         (Target_arm::Scan::global): Likewise.
7891         (Target_arm::Relocate::relocate): Likewise.
7892
7893 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
7894
7895         * fileread.cc (Input_file::find_file): Initialize *found_name
7896         and *namep when using the fallback search for case 4.
7897
7898 2010-10-11  Cary Coutant  <ccoutant@google.com>
7899
7900         * options.h (class General_options): Redefine -z lazy as an alias for
7901         the negation of -z now.
7902
7903 2010-10-11  Ian Lance Taylor  <iant@google.com>
7904
7905         * resolve.cc (symbol_to_bits): Report the value of the unsupported
7906         binding.
7907
7908 2010-10-06  Nick Clifton  <nickc@redhat.com>
7909
7910         * script-sections.cc(class Memory_region): Remove
7911         current_lma_offset_ field.  Rename current_vma_offset_ to
7912         current_offset_.  Add last_section_ field.
7913         (Memory_region::get_current_vma_address): Rename to
7914         get_current_address.
7915         (Memory_region::get_current_lma_address): Delete.
7916         (Memory_region::increment_vma_offset): Rename to
7917         increment_offset.
7918         (Memory_region::increment_lma_offset): Delete.
7919         (Memory_region::attributes_compatible): New method.  Returns
7920         true if the provided section is compatible with the region.
7921         (Memory_region::get_last_section): New method.  Returns the last
7922         section to use the region.
7923         (Memory_region::set_last_section): New method.  Stores the last
7924         section to use the region.
7925         (Script_sections::block_in_region): New method.  Returns true if
7926         a block of memory is contained within a region.
7927         (Script_sections::find_memory_region): New method.  Locates a
7928         memory region to be used to set a VMA or LMA address.
7929         (Output_section_definition::set_section_addresses): Add code to
7930         check for addresses set by memory regions.
7931         (Output_segment::set_section_addresses): Remove memory region
7932         walking code.
7933         (Script_sections::create_segment): Add a warning if a header
7934         segment is created outside of any region.
7935         * script-sections.h (class Script_sections): Add prototypes for
7936         find_memory_region and block_in_region methods.
7937         * testsuite/memory_test.s: Use .long instead of .word.
7938         * testsuite/memory_test.t: Add some more output sections.
7939         * testsuite/memory_test.sh: Update expected output.
7940
7941 2010-10-02  Doug Kwan  <dougkwan@google.com>
7942
7943         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
7944         defintion to symtab.h
7945         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
7946         declaration to defintion.
7947
7948 2010-10-01  Nick Clifton  <nickc@redhat.com>
7949
7950         * expression.cc (eval): Replace dummy argument with NULL.
7951         (eval_maybe_dot): Check for a NULL result section pointer.
7952         (Symbol_expression::value): Likewise.
7953         (Dot_expression::value): Likewise.
7954         (BINARY_EXPRESSION): Likewise.
7955         (Max_expression::value): Likewise.
7956         (Min_expression::value): Likewise.
7957         (Absolute_expression::value): Likewise.
7958         (Addr_expression::value_from_output_section): Likewise.
7959         (Loaddddr_expression::value_from_output_section): Likewise.
7960         (Segment_start_expression::value): Likewise.
7961         * script-sections.cc
7962         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
7963         argument with NULL.
7964         (Sections_elememt_dot_assignment::set_section_addresses):
7965         Likewise.
7966         (Output_data_expression::do_write_to_buffer): Likewise.
7967         (Output_section_definition::finalize_symbols): Likewise.
7968         (Output_section_definition::set_section_addresses): Likewise.
7969
7970 2010-09-30  Doug Kwan  <dougkwan@google.com>
7971
7972         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
7973
7974 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
7975
7976         * target.h (Target::can_icf_inline_merge_sections): New virtual
7977         function.
7978         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7979         virtual function.
7980         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
7981         virtual function.
7982         * icf.cc (get_section_contents): Inline merge sections only when
7983         target allows it.
7984
7985 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7986
7987         * configure: Regenerate.
7988
7989 2010-09-17  Ian Lance Taylor  <iant@google.com>
7990
7991         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7992         * testsuite/Makefile.am (memory_test.o): New target.
7993         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7994         memory_test.t.
7995         * testsuite/Makefile.in: Rebuild.
7996
7997 2010-09-17  Doug Kwan  <dougkwan@google.com>
7998
7999         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
8000         defintion if relocation uses GOT entries of the symbol.
8001         * testsuite/icf_safe_test.sh: Fix test.
8002         * testsuite/icf_safe_so_test.sh: Fix test.
8003
8004 2010-09-16  Cary Coutant  <ccoutant@google.com>
8005
8006         * script_sections.cc (class Memory_region): Remove "NULL" from
8007         vector initializations.
8008
8009 2010-09-15  Cary Coutant  <ccoutant@google.com>
8010
8011         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
8012         Resolve forwarding symbols.
8013
8014 2010-09-15  Doug Kwan  <dougkwan@google.com>
8015
8016         * gold/testsuite/script_test_3.t: Add ARM special sections.
8017         * gold/testsuite/script_test_4.t: Same.
8018         * gold/testsuite/script_test_5.t: Same.
8019         * gold/testsuite/script_test_6.t: Same.
8020         * gold/testsuite/script_test_7.t: Same.
8021         * gold/testsuite/script_test_7.t: Same.
8022         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
8023
8024 2010-09-14  Cary Coutant  <ccoutant@google.com>
8025
8026         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
8027         (Target_x86_64::Relocate::relocate_tls): Replace check for
8028         saw_tls_block_reloc_ with test for executable section.
8029
8030 2010-09-12  Cary Coutant  <ccoutant@google.com>
8031
8032         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
8033         position-independent executables to shared libraries need dynamic
8034         relocations.
8035         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
8036         position-independent executables.
8037         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
8038         * testsuite/Makefile.in: Regenerate.
8039
8040 2010-09-10  Nick Clifton  <nickc@redhat.com>
8041
8042         PR gold/11997
8043         * testsuite/memory_test.t: Discard any sections that are not
8044         needed.
8045
8046 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
8047
8048         PR gold/11996
8049         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
8050         "This::" to work around a bug in gcc 4.2.
8051
8052         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
8053
8054 2010-09-09  Rafael Espindola  <espindola@google.com>
8055
8056         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
8057         sections with different PF_X flags in the same segment.
8058         (Layout::find_first_load_seg): Search all segments to find the first
8059         one.
8060         * options.h (rosegment): New.
8061
8062 2010-09-08  Rafael Espindola  <espindola@google.com>
8063
8064         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
8065
8066 2010-09-08  Doug Kwan  <dougkwan@google.com>
8067
8068         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
8069         (Arm_relobj::do_relocate_sections): Add new parameter for output
8070         file to match the parent.
8071         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
8072         of local symbols instead of input values.  Update code to track
8073         changes in gold::relocate_section.
8074         * object.cc (Sized_relobj::compute_final_local_value): New methods.
8075         (Sized_relobj::compute_final_local_value_internal): New methods.
8076         (Sized_relobj::do_finalize_local_symbols): Move code from loop
8077         body into private version of Sized_relobj::compute_final_local_value.
8078         Call the inline method.
8079         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
8080         merged symbol value if there is one.
8081         (Symbol_value::has_output_value): New method defintiion.
8082         (Sized_relobj::Compute_final_local_value_status): New enum type.
8083         (Sized_relobj::compute_final_local_value): New methods.
8084         (Sized_relobj::compute_final_local_value_internal): New methods.
8085         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
8086         and arm_cortex_a8.sh.
8087         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
8088         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
8089         New tests.
8090         * Makefile.in: Regenerate.
8091         * testsuite/arm_bl_out_of_range.s: Update test.
8092         * testsuite/thumb_bl_out_of_range.s: Ditto.
8093         * testsuite/thumb_blx_out_of_range.s: Ditto.
8094         * testsuite/arm_branch_out_of_range.sh: New file.
8095         * testsuite/arm_cortex_a8.sh: Ditto.
8096         * testsuite/arm_cortex_a8_b.s: Ditto.
8097         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
8098         * testsuite/arm_cortex_a8_b_local.s: Ditto.
8099         * testsuite/arm_cortex_a8_bl.s: Ditto.
8100         * testsuite/arm_cortex_a8_blx.s: Ditto.
8101         * testsuite/arm_cortex_a8_local.s: Ditto.
8102         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
8103         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
8104
8105 2010-09-08  Rafael Espindola  <espindola@google.com>
8106
8107         * Makefile.am (memory_test.stdout): Run readelf with -W.
8108         * Makefile.in: Regenerate.
8109         * testsuite/memory_test.sh: Make the regexps accept both 32 and
8110         64 bit output.
8111
8112 2010-09-08  Rafael Espindola  <espindola@google.com>
8113
8114         * script-sections.cc (Script_sections::add_memory_region): Convert
8115         field precision to int.
8116         * script.cc (script_set_section_region, script_set_section_region):
8117         Convert field precision to int.
8118
8119 2010-09-08  Rafael Espindola  <espindola@google.com>
8120
8121         * arm.cc (do_finalize_sections): Create the __exidx_start and
8122         __exdix_end symbols even when the section is missing.
8123
8124 2010-09-08  Nick Clifton  <nickc@redhat.com>
8125
8126         * README: Remove claim that MEMORY is not supported.
8127         * expression.cc (script_exp_function_origin)
8128         (script_exp_function_length): Move from here to ...
8129         * script.cc: ... here.
8130         (script_set_section_region, script_add_memory)
8131         (script_parse_memory_attr, script_include_directive): New
8132         functions.
8133         * script-sections.cc
8134         (class Memory_region): New class.
8135         (class Output_section_definition): Add set_memory_region,
8136         set_section_vma, set_section_lma and get_section_name methods.
8137         (class Script_Sections): Add add_memory_region,
8138         find_memory_region, find_memory_region_origin,
8139         find_memory_region_length and set_memory_region methods.
8140         Have set_section_addresses method walk the list of set memory
8141         regions.
8142         Extend the print methos to display memory regions.
8143         * script-sections.h: Add prototypes for new methods.
8144         Add enum for MEMORY region attributes.
8145         * yyscript.y: Add support for parsing MEMORY regions.
8146         * script-c.h: Add prototypes for new functions.
8147         * testsuite/Makefile.am: Add test of MEMORY region functionality.
8148         * testsuite/Makefile.in: Regenerate.
8149         * testsuite/memory_test.sh: New script.
8150         * testsuite/memory_test.s: New assembler source file.
8151         * testsuite/memory_test.t: New linker script.
8152
8153 2010-08-27  Doug Kwan  <dougkwan@google.com>
8154
8155         * gold/resolve.cc (Symbol_table::should_override): Let a weak
8156         reference override an existing dynamic weak reference.
8157         * testsuite/Makefile.am: Add new test dyn_weak_ref.
8158         * testsuite/Makefile.in: Regenerate.
8159         * testsuite/dyn_weak_ref.sh: New file.
8160         * testsuite/dyn_weak_ref_1.c: Ditto.
8161         * testsuite/dyn_weak_ref_2.c: Ditto.
8162
8163 2010-08-27  Ian Lance Taylor  <iant@google.com>
8164
8165         * incremental.h (class Incremental_input_entry): Add virtual
8166         destructor.
8167
8168 2010-08-27  Ian Lance Taylor  <iant@google.com>
8169
8170         * testsuite/start_lib_test_3.c: Mark t3 as used.
8171
8172 2010-08-27  Nick Clifton  <nickc@redhat.com>
8173
8174         * options.cc (version_script): Fix small typo in previous
8175         whitespace tidyup.
8176
8177 2010-08-25  Nick Clifton  <nickc@redhat.com>
8178
8179         * archive.cc: Formatting fixes: Remove whitespace between
8180         typename and following asterisk.  Remove whitespace between
8181         function name and opening parenthesis.
8182         * archive.h: Likewise.
8183         * arm.cc: Likewise.
8184         * attributes.cc: Likewise.
8185         * attributes.h: Likewise.
8186         * common.cc: Likewise.
8187         * copy-relocs.cc: Likewise.
8188         * dirsearch.h: Likewise.
8189         * dynobj.cc: Likewise.
8190         * ehframe.cc: Likewise.
8191         * ehframe.h: Likewise.
8192         * expression.cc: Likewise.
8193         * fileread.cc: Likewise.
8194         * fileread.h: Likewise.
8195         * gc.h: Likewise.
8196         * gold-threads.cc: Likewise.
8197         * gold.cc: Likewise.
8198         * i386.cc: Likewise.
8199         * icf.h: Likewise.
8200         * incremental-dump.cc: Likewise.
8201         * incremental.cc: Likewise.
8202         * layout.cc: Likewise.
8203         * layout.h: Likewise.
8204         * main.cc: Likewise.
8205         * merge.cc: Likewise.
8206         * merge.h: Likewise.
8207         * object.cc: Likewise.
8208         * object.h: Likewise.
8209         * options.cc: Likewise.
8210         * options.h: Likewise.
8211         * output.cc: Likewise.
8212         * output.h: Likewise.
8213         * plugin.cc: Likewise.
8214         * plugin.h: Likewise.
8215         * powerpc.cc: Likewise.
8216         * reloc.cc: Likewise.
8217         * script-c.h: Likewise.
8218         * script-sections.cc: Likewise.
8219         * script.cc: Likewise.
8220         * stringpool.cc: Likewise.
8221         * symtab.cc: Likewise.
8222         * symtab.h: Likewise.
8223         * target.cc: Likewise.
8224         * timer.cc: Likewise.
8225         * timer.h: Likewise.
8226         * version.cc: Likewise.
8227         * x86_64.cc: Likewise.
8228
8229 2010-08-24  Nick Clifton  <nickc@redhat.com>
8230
8231         PR 11899
8232         * layout.cc (segment_precedes): Sort segments by their physical
8233         addresses, if they have been set.
8234
8235 2010-08-23  Cary Coutant  <ccoutant@google.com>
8236
8237         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
8238         symbols data.
8239         (Lib_group::include_member): Unlock object after deleting its
8240         symbols data.
8241         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
8242         the bug fixed here.
8243
8244 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
8245             Cary Coutant  <ccoutant@google.com>
8246
8247         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
8248         constructor, and set_blocker.
8249         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
8250         readsyms_blocker_.
8251         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
8252         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
8253         * testsuite/Makefile.am (start_lib_test): New test case.
8254         * testsuite/Makefile.in: Regenerate.
8255         * testsuite/start_lib_test_main.c: New file.
8256         * testsuite/start_lib_test_1.c: New file.
8257         * testsuite/start_lib_test_2.c: New file.
8258         * testsuite/start_lib_test_3.c: New file.
8259
8260 2010-08-19  Ian Lance Taylor  <iant@google.com>
8261
8262         * Makefile.in: Rebuild with automake 1.11.1.
8263         * aclocal.m4: Likewise.
8264         * testsuite/Makefile.in: Likewise.
8265
8266 2010-08-19  Ian Lance Taylor  <iant@google.com>
8267
8268         PR 10893
8269         * i386.cc (class Output_data_plt_i386): Update declarations.
8270         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
8271         local_ifuncs_ fields.
8272         (Target_i386::do_plt_section_for_global): New function.
8273         (Target_i386::do_plt_section_for_local): New function.
8274         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
8275         parameter; change all callers.  Initialize global_ifuncs_ and
8276         local_ifuncs_.  If doing a static link define __rel_iplt_start and
8277         __rel_iplt_end.
8278         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
8279         (Output_data_plt_i386::add_local_ifunc_entry): New function.
8280         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
8281         symbols.
8282         (Target_i386::make_plt_section): New function, broken out of
8283         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
8284         (Target_i386::make_plt_entry): Call make_plt_section.
8285         (Target_i386::make_local_ifunc_plt_entry): New function.
8286         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
8287         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
8288         R_386_IRELATIVE to switch.
8289         (Target_i386::Scan::global): Likewise.
8290         (Target_i386::Relocate::relocate): Likewise.
8291         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
8292         switch.
8293         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
8294         (Target_x86_64::do_plt_section_for_global): New function.
8295         (Target_x86_64::do_plt_section_for_local): New function.
8296         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
8297         parameter; change all callers.  If doing a static link define
8298         __rela_iplt_start and __rela_iplt_end.
8299         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
8300         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
8301         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
8302         to point to .plt.
8303         (Target_x86_64::make_local_ifunc_plt_entry): New function.
8304         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
8305         switch.
8306         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
8307         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
8308         R_X86_64_IRELATIVE to switch.
8309         (Target_x86_64::Scan::global): Likewise.
8310         (Target_x86_64::Relocate::relocate): Likewise.
8311         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
8312         switch.
8313         * target.h (class Target): Add plt_section_for_global and
8314         plt_section_for_local functions.  Add do_plt_section_for_global
8315         and do_plt_section_for_local virtual functions.
8316         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
8317         clarifying comments.
8318         (Symbol::use_plt_offset): Handle IFUNC symbol.
8319         * object.cc (Sized_relobj::Sized_relobj): Initialize
8320         local_plt_offsets_.
8321         (Sized_relobj::local_has_plt_offset): New function.
8322         (Sized_relobj::local_plt_offset): New function.
8323         (Sized_relobj::set_local_plt_offset): New function.
8324         (Sized_relobj::do_count): Handle IFUNC symbol.
8325         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
8326         a bit away from input_shndx_ field.  Add set_is_func_symbol and
8327         is_ifunc_symbol functions.
8328         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
8329         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
8330         local_plt_offsets_ field.
8331         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
8332         * output.h (class Output_section_data): Add non-const
8333         output_section function.
8334         (class Output_data_got): Update declarations.
8335         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
8336         Add use_plt_offset parameter to global and local constructors.
8337         Change all callers.  Change local_sym_index_ field to 31 bits.
8338         Change GSYM_CODE and CONSTANT_CODE accordingly.
8339         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
8340         doing a static link don't set sh_link field.
8341         (Output_data_got::Got_entry::write): Use PLT offset if
8342         appropriate.
8343         (Output_data_got::add_global_plt): New function.
8344         (Output_data_got::add_local_plt): New function.
8345         * target-reloc.h (relocate_section): Handle IFUNC symbol.
8346         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
8347         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
8348         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
8349         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
8350         IFUNC conditional.
8351         * testsuite/ifunc-sel.h: New file.
8352         * testsuite/ifuncmain1.c: New file.
8353         * testsuite/ifuncmain1vis.c: New file.
8354         * testsuite/ifuncmod1.c: New file.
8355         * testsuite/ifuncdep2.c: New file.
8356         * testsuite/ifuncmain2.c: New file.
8357         * testsuite/ifuncmain3.c: New file.
8358         * testsuite/ifuncmod3.c: New file.
8359         * testsuite/ifuncmain4.c: New file.
8360         * testsuite/ifuncmain5.c: New file.
8361         * testsuite/ifuncmod5.c: New file.
8362         * testsuite/ifuncmain6pie.c: New file.
8363         * testsuite/ifuncmod6.c: New file.
8364         * testsuite/ifuncmain7.c: New file.
8365         * configure, testsuite/Makefile.in: Rebuild.
8366
8367 2010-08-18  Ian Lance Taylor  <iant@google.com>
8368
8369         * incremental.cc
8370         (Output_section_incremental_inputs::write_input_files): Add cast
8371         to avoid signed/unsigned comparison warning.
8372         (Output_section_incremental_inputs::write_info_blocks): Likewise.
8373
8374 2010-08-12  Cary Coutant  <ccoutant@google.com>
8375
8376         * common.cc (Sort_commons::operator()): Remove unnecessary code.
8377
8378 2010-08-13  Ian Lance Taylor  <iant@google.com>
8379
8380         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
8381
8382 2010-08-12  Cary Coutant  <ccoutant@google.com>
8383             Doug Kwan  <dougkwan@google.com>
8384
8385         * resolve.cc (Symbol_table::should_override): When a weak dynamic
8386         defintion overrides non-weak undef, remember that the original undef
8387         is not weak.
8388         * symtab.cc (Symbol_table::sized_write_global): For undef without
8389         an original weak binding, set binding to global in output.
8390         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
8391         * testsuite/Makefile.in: Regenerate.
8392         * testsuite/strong_ref_weak_def.sh: New file.
8393         * testsuite/strong_ref_weak_def_1.c: Ditto.
8394         * testsuite/strong_ref_weak_def_2.c: Ditto.
8395
8396 2010-08-12  Cary Coutant  <ccoutant@google.com>
8397
8398         * testsuite/incremental_test.sh: Rewrite.
8399         * testsuite/incremental_test_1.c: Rewrite.
8400         * testsuite/incremental_test_2.c: Rewrite.
8401
8402 2010-08-12  Cary Coutant  <ccoutant@google.com>
8403
8404         * arm.cc (Target_arm::got_size): Add const.
8405         (Target_arm::got_entry_count): New function.
8406         (Target_arm::plt_entry_count): New function.
8407         (Target_arm::first_plt_entry_offset): New function.
8408         (Target_arm::plt_entry_size): New function.
8409         (Output_data_plt_arm::entry_count): New function.
8410         (Output_data_plt_arm::first_plt_entry_offset): New function.
8411         (Output_data_plt_arm::get_plt_entry_size): New function.
8412         * i386.cc (Target_i386::got_size): Add const.
8413         (Target_i386::got_entry_count): New function.
8414         (Target_i386::plt_entry_count): New function.
8415         (Target_i386::first_plt_entry_offset): New function.
8416         (Target_i386::plt_entry_size): New function.
8417         (Output_data_plt_i386::entry_count): New function.
8418         (Output_data_plt_i386::first_plt_entry_offset): New function.
8419         (Output_data_plt_i386::get_plt_entry_size): New function.
8420         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
8421         find_incremental_inputs_sections.  Dump incremental_got_plt section.
8422         * incremental.cc: Include target.h.
8423         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
8424         parameter.  Adjust all callers.  Find incremental_got_plt section.
8425         (Incremental_inputs::create_data_sections): Create incremental_got_plt
8426         section.
8427         (Output_section_incremental_inputs::set_final_data_size): Calculate
8428         size of incremental_got_plt section.
8429         (Output_section_incremental_inputs::do_write): Write the
8430         incremental_got_plt section.
8431         (Got_plt_view_info): New struct.
8432         (Local_got_offset_visitor): New class.
8433         (Global_got_offset_visitor): New class.
8434         (Global_symbol_visitor_got_plt): New class.
8435         (Output_section_incremental_inputs::write_got_plt): New function.
8436         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
8437         Add parameter.  Adjust all callers.
8438         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8439         (Incremental_inputs::got_plt_section): New function.
8440         (Incremental_inputs::got_plt_section_): New data member.
8441         (Incremental_got_plt_reader): New class.
8442         * layout.cc (Layout::create_incremental_info_sections): Add the
8443         incremental_got_plt section.
8444         * object.h (Got_offset_list::get_list): New function.
8445         (Got offset_list::for_all_got_offsets): New function.
8446         (Sized_relobj::local_got_offset_list): New function.
8447         * powerpc.cc (Target_powerpc::got_size): Add const.
8448         (Target_powerpc::got_entry_count): New function.
8449         (Target_powerpc::plt_entry_count): New function.
8450         (Target_powerpc::first_plt_entry_offset): New function.
8451         (Target_powerpc::plt_entry_size): New function.
8452         (Output_data_plt_powerpc::entry_count): New function.
8453         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
8454         (Output_data_plt_powerpc::get_plt_entry_size): New function.
8455         * sparc.cc (Target_sparc::got_size): Add const.
8456         (Target_sparc::got_entry_count): New function.
8457         (Target_sparc::plt_entry_count): New function.
8458         (Target_sparc::first_plt_entry_offset): New function.
8459         (Target_sparc::plt_entry_size): New function.
8460         (Output_data_plt_sparc::entry_count): New function.
8461         (Output_data_plt_sparc::first_plt_entry_offset): New function.
8462         (Output_data_plt_sparc::get_plt_entry_size): New function.
8463         * symtab.h (Symbol::got_offset_list): New function.
8464         (Symbol_table::for_all_symbols): New function.
8465         * target.h (Sized_target::got_entry_count): New function.
8466         (Sized_target::plt_entry_count): New function.
8467         (Sized_target::plt_entry_size): New function.
8468         * x86_64.cc (Target_x86_64::got_size): Add const.
8469         (Target_x86_64::got_entry_count): New function.
8470         (Target_x86_64::plt_entry_count): New function.
8471         (Target_x86_64::first_plt_entry_offset): New function.
8472         (Target_x86_64::plt_entry_size): New function.
8473         (Output_data_plt_x86_64::entry_count): New function.
8474         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
8475         (Output_data_plt_x86_64::get_plt_entry_size): New function.
8476
8477 2010-08-12  Cary Coutant  <ccoutant@google.com>
8478
8479         * archive.cc: Include incremental.h.
8480         (Archive::Archive): Initialize incremental_info_.
8481         (Archive::include_member): Record archive members in incremental info.
8482         (Add_archive_symbols::run): Record begin and end of an archive in
8483         incremental info.
8484         (Lib_group::include_member): Record objects in incremental info.
8485         * archive.h (Incremental_archive_entry): Forward declaration.
8486         (Archive::set_incremental_info): New member function.
8487         (Archive::incremental_info): New member function.
8488         (Archive::Unused_symbol_iterator): New class.
8489         (Archive::unused_symbols_begin): New member function.
8490         (Archive::unused_symbols_end): New member function.
8491         (Archive::incremental_info_): New data member.
8492         * incremental-dump.cc (find_input_containing_global): New function.
8493         (dump_incremental_inputs): Dump new incremental info sections.
8494         * incremental.cc: Include symtab.h.
8495         (Output_section_incremental_inputs): New class.
8496         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
8497         new incremental info sections.
8498         (Sized_incremental_binary::do_check_inputs): Likewise.
8499         (Incremental_inputs::report_archive): Remove.
8500         (Incremental_inputs::report_archive_begin): New function.
8501         (Incremental_inputs::report_archive_end): New function.
8502         (Incremental_inputs::report_object): New function.
8503         (Incremental_inputs::finalize_inputs): Remove.
8504         (Incremental_inputs::report_input_section): New function.
8505         (Incremental_inputs::report_script): Rewrite.
8506         (Incremental_inputs::finalize): Do nothing but finalize string table.
8507         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8508         (Incremental_inputs::sized_create_inputs_section_data): Remove.
8509         (Incremental_inputs::create_data_sections): New function.
8510         (Incremental_inputs::relocs_entsize): New function.
8511         (Output_section_incremental_inputs::set_final_data_size): New function.
8512         (Output_section_incremental_inputs::do_write): New function.
8513         (Output_section_incremental_inputs::write_header): New function.
8514         (Output_section_incremental_inputs::write_input_files): New function.
8515         (Output_section_incremental_inputs::write_info_blocks): New function.
8516         (Output_section_incremental_inputs::write_symtab): New function.
8517         * incremental.h (Incremental_script_entry): Forward declaration.
8518         (Incremental_object_entry): Forward declaration.
8519         (Incremental_archive_entry): Forward declaration.
8520         (Incremental_inputs): Forward declaration.
8521         (Incremental_inputs_header_data): Remove.
8522         (Incremental_inputs_header): Remove.
8523         (Incremental_inputs_header_write): Remove.
8524         (Incremental_inputs_entry_data): Remove.
8525         (Incremental_inputs_entry): Remove.
8526         (Incremental_inputs_entry_write): Remove.
8527         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
8528         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
8529         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8530         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
8531         Likewise.
8532         (Incremental_input_entry): New class.
8533         (Incremental_script_entry): New class.
8534         (Incremental_object_entry): New class.
8535         (Incremental_archive_entry): New class.
8536         (Incremental_inputs::Incremental_inputs): Initialize new data members.
8537         (Incremental_inputs::report_inputs): Remove.
8538         (Incremental_inputs::report_archive): Remove.
8539         (Incremental_inputs::report_archive_begin): New function.
8540         (Incremental_inputs::report_archive_end): New function.
8541         (Incremental_inputs::report_object): Change prototype.
8542         (Incremental_inputs::report_input_section): New function.
8543         (Incremental_inputs::report_script): Change prototype.
8544         (Incremental_inputs::get_reloc_count): New function.
8545         (Incremental_inputs::set_reloc_count): New function.
8546         (Incremental_inputs::create_data_sections): New function.
8547         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8548         (Incremental_inputs::inputs_section): New function.
8549         (Incremental_inputs::symtab_section): New function.
8550         (Incremental_inputs::relocs_section): New function.
8551         (Incremental_inputs::get_stringpool): Add const.
8552         (Incremental_inputs::command_line): Add const.
8553         (Incremental_inputs::inputs): Remove.
8554         (Incremental_inputs::command_line_key): New function.
8555         (Incremental_inputs::input_file_count): New function.
8556         (Incremental_inputs::input_files): New function.
8557         (Incremental_inputs::relocs_entsize): New function.
8558         (Incremental_inputs::sized_create_inputs_section_data): Remove.
8559         (Incremental_inputs::finalize_inputs): Remove.
8560         (Incremental_inputs::Input_info): Remove.
8561         (Incremental_inputs::lock_): Remove.
8562         (Incremental_inputs::inputs_): Change type.
8563         (Incremental_inputs::inputs_map_): Remove.
8564         (Incremental_inputs::current_object_entry_): New data member.
8565         (Incremental_inputs::inputs_section_): New data member.
8566         (Incremental_inputs::symtab_section_): New data member.
8567         (Incremental_inputs::relocs_section_): New data member.
8568         (Incremental_inputs::reloc_count_): New data member.
8569         (Incremental_inputs_reader): New class.
8570         (Incremental_symtab_reader): New class.
8571         (Incremental_relocs_reader): New class.
8572         * layout.cc (Layout::finalize): Move finalization of incremental info
8573         and creation of incremental info sections to follow finalization of
8574         symbol table.  Set offsets for postprocessing sections.
8575         (Layout::create_incremental_info_sections): Call
8576         Incremental_inputs::create_data_sections.  Add incremental symtab
8577         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
8578         sections to layout after input sections.
8579         * layout.h (struct Timespec): Forward declaration.
8580         (Layout::incremental_inputs): Add const.
8581         (Layout::create_incremental_info_sections): Add parameter.
8582         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
8583         * object.cc: Include incremental.h.
8584         (Relobj::finalize_incremental_relocs): New function.
8585         (Sized_relobj::do_layout): Record input sections in incremental info.
8586         * object.h (Object::output_section): New function.
8587         (Object::output_section_offset): Moved from Relobj.
8588         (Object::get_incremental_reloc_base): New function.
8589         (Object::get_incremental_reloc_count): New function.
8590         (Object::do_output_section): New function.
8591         (Object::do_output_section_offset): Moved from Relobj.
8592         (Object::do_get_incremental_reloc_base): New function.
8593         (Object::do_get_incremental_reloc_count): New function.
8594         (Object::Object): Initialize new data members.
8595         (Relobj::output_section): Renamed do_output_section and moved to
8596         protected.
8597         (Relobj::output_section_offset): Moved to Object.
8598         (Relobj::do_get_incremental_reloc_base): New function.
8599         (Relobj::do_get_incremental_reloc_count): New function.
8600         (Relobj::allocate_incremental_reloc_counts): New function.
8601         (Relobj::count_incremental_reloc): New function.
8602         (Relobj::finalize_incremental_relocs): New function.
8603         (Relobj::next_incremental_reloc_index): New function.
8604         (Relobj::reloc_counts_): New data member.
8605         (Relobj::reloc_bases_): New data member.
8606         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
8607         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
8608         (Sized_relobj::incremental_relocs_scan): New function.
8609         (Sized_relobj::incremental_relocs_scan_reltype): New function.
8610         (Sized_relobj::incremental_relocs_write): New function.
8611         (Sized_relobj::incremental_relocs_write_reltype): New function.
8612         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
8613         incremental link.
8614         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
8615         archives and object files elsewhere.
8616         (Add_symbols::run): Report object files here.
8617         (Finish_group::run): Report end of archive at end of group.
8618         * reloc.cc: Include layout.h, incremental.h.
8619         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
8620         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
8621         (Sized_relobj::incremental_relocs_scan): New function.
8622         (Sized_relobj::incremental_relocs_scan_reltype): New function.
8623         (Sized_relobj::do_relocate_sections): Write incremental relocations.
8624         (Sized_relobj::incremental_relocs_write): New function.
8625         (Sized_relobj::incremental_relocs_write_reltype): New function.
8626         * script.cc (read_input_script): Rewrite test for incremental link.
8627         Change call to Incremental_inputs::report_script.
8628         * symtab.h (Symbol_table::first_global_index): New function.
8629         (Symbol_table::output_count): New function.
8630
8631 2010-08-12  Doug Kwan  <dougkwan@google.com>
8632
8633         * arm.cc (Target_arm::merge_object_attributes): Check command line
8634         options --no-wchar-size-warning and --no-enum-size-warning.
8635         * options.h (General_options): Add ld-compatible options
8636         --no-enum-size-warning and --no-wchar-size-warning.
8637
8638 2010-08-04  Ian Lance Taylor  <iant@google.com>
8639
8640         * x86_64.cc (Target_x86_64::Scan::local): Use
8641         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
8642         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
8643         (Target_x86_64::Scan::global): Likewise.
8644         (Target_x86_64::Relocate::relocate): Likewise.
8645         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
8646         Likewise.
8647
8648 2010-08-03  Cary Coutant  <ccoutant@google.com>
8649
8650         * merge.cc (Output_merge_string::do_add_input_section): Count strings
8651         to reserve space in merged_strings vector. Keep total input size
8652         for stats.
8653         (Output_merge_string::do_print_merge_stats): Print total input size.
8654         * merge.h (Output_merge_string): Add input_size_ field.
8655         * stringpool.cc (Stringpool_template::string_length): Move
8656         implementations out of Stringpool_template class and place in
8657         stringpool.h.
8658         * stringpool.h (string_length): Move out of Stringpool_template.
8659
8660 2010-08-03  Ian Lance Taylor  <iant@google.com>
8661
8662         PR 11712
8663         * layout.cc (relaxation_loop_body): If address of load segment is
8664         set, adjust address to include headers if possible.
8665
8666 2010-08-03  Ian Lance Taylor  <iant@google.com>
8667
8668         * version.cc (version_string): Bump to 1.10.
8669
8670 2010-08-03  Ian Lance Taylor  <iant@google.com>
8671
8672         PR 11805
8673         * layout.h (enum Output_section_order): Define.
8674         (class Layout): Update declarations.
8675         * layout.cc (Layout::get_output_section): Add order parameter.
8676         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
8677         is_first_non_relro parameters.  Change all callers.
8678         (Layout::choose_output_section): Likewise.
8679         (Layout::add_output_section_data): Likewise.
8680         (Layout::make_output_section): Likewise.  Set order.
8681         (Layout::default_section_order): New function.
8682         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
8683         * output.cc (Output_section::Output_section): Initialize order_.
8684         Don't initialize deleted fields.
8685         (Output_segment::Output_segment): Don't initialize deleted
8686         fields.
8687         (Output_segment::add_output_section_to_load): New function
8688         replacing add_output_section.  Change all callers to call this or
8689         add_output_section_to_nonload.
8690         (Output_segment::add_output_section_to_nonload): New function.
8691         (Output_segment::remove_output_section): Rewrite.
8692         (Output_segment::add_initial_output_data): Likewise.
8693         (Output_segment::has_any_data_sections): Likewise.
8694         (Output_segment::is_first_section_relro): Likewise.
8695         (Output_segment::maximum_alignment): Likewise.
8696         (Output_segment::has_dynamic_reloc): New function replacing
8697         dynamic_reloc_count.  Change all callers.
8698         (Output_segment::has_dynamic_reloc_list): New function replacing
8699         dynamic_reloc_count_list.  Change all callers.
8700         (Output_segment::set_section_addresses): Rewrite.
8701         (Output_segment::set_offset): Rewrite.
8702         (Output_segment::find_first_and_last_list): Remove.
8703         (Output_segment::set_tls_offsets): Rewrite.
8704         (Output_segment::first_section_load_address): Likewise.
8705         (Output_segment::output_section_count): Likewise.
8706         (Output_segment::section_with_lowest_load_address): Likewise.
8707         (Output_segment::write_section_headers): Likewise.
8708         (Output_segment::print_sections_to_map): Likewise.
8709         * output.h (class Output_data): Remove dynamic_reloc_count_
8710         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
8711         (Output_data::add_dynamic_reloc): Rewrite.
8712         (Output_data::has_dynamic_reloc): New function.
8713         (Output_data::dynamic_reloc_count): Remove.
8714         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
8715         is_last_relro_, is_first_non_relro_, is_interp_,
8716         is_dynamic_linker_section_ fields.  Add order and set_order
8717         functions.  Remove is_relro_local, set_is_relro_local,
8718         is_last_relro, set_is_last_relro, is_first_non_relro,
8719         set_is_first_non_relro functions, is_interp, set_is_interp,
8720         is_dynamic_linker_section, and set_is_dynamic_linker_section
8721         functions.
8722         (class Output_segment): Change Output_data_list from std::list to
8723         std:;vector.  Add output_lists_ field.  Remove output_data_ and
8724         output_bss_ fields.  Update declarations.
8725
8726 2010-08-02  Ian Lance Taylor  <iant@google.com>
8727
8728         * arm.cc (Target_arm::gc_process_relocs): Use typename.
8729         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
8730         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
8731
8732 2010-08-02  Ian Lance Taylor  <iant@google.com>
8733
8734         PR 11855
8735         * script.cc (Script_options::Script_options): Initialize
8736         symbol_definitions_ and symbol_references_.
8737         (Script_options::add_symbol_assignment): Update
8738         symbol_definitions_ and symbol_references_.
8739         (Script_options::add_symbol_reference): New function.
8740         (script_symbol): New function.
8741         * script.h (class Script_options): Add symbol_definitions_ and
8742         symbol_references_ fields.
8743         (Script_options::referenced_const_iterator): New type.
8744         (Script_options::referenced_begin): New function.
8745         (Script_options::referenced_end): New function.
8746         (Script_options::is_referenced): New function.
8747         (Script_options::any_unreferenced): New function.
8748         * script-c.h (script_symbol): Declare.
8749         * yyscript.y (exp): Call script_symbol.
8750         * symtab.cc: Include "script.h".
8751         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
8752         Change all callers.  Check symbols referenced by scripts.
8753         (Symbol_table::add_undefined_symbols_from_command_line): Add
8754         layout parameter.  Change all callers.
8755         (Symbol_table::do_add_undefined_symbols_from_command_line):
8756         Likewise.  Break out loop body.  Check symbols referenced by
8757         scripts.
8758         (Symbol_table::add_undefined_symbol_from_command_line): New
8759         function broken out of
8760         do_add_undefined_symbols_from_command_line.
8761         * symtab.h (class Symbol_table): Update declarations.
8762         * archive.cc: Include "layout.h".
8763         (Archive::should_include_member): Add layout parameter.  Change
8764         all callers.  Check for symbol mentioned in expression.
8765         * archive.h (class Archive): Update declaration.
8766         * object.cc (Sized_relobj::do_should_include_member): Add layout
8767         parameter.
8768         * object.h (Object::should_include_member): Add layout parameter.
8769         Change all callers.
8770         (Object::do_should_include_member): Add layout parameter.
8771         (class Sized_relobj): Update declaration.
8772         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
8773         parameter.
8774         * dynobj.h (class Sized_dynobj): Update declaration.
8775         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
8776         layout parameter.
8777         * plugin.h (class Sized_pluginobj): Update declaration.
8778
8779 2010-08-02  Ian Lance Taylor  <iant@google.com>
8780
8781         PR 11866
8782         * output.cc (Output_segment::set_offset): Search for the first and
8783         last sections rather than assuming that the list is in order.
8784         (Output_segment::find_first_and_last_list): New function.
8785         * output.h (class Output_segment): Update declarations.
8786         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
8787         (relro_strip_test_SOURCES): New variable.
8788         (relro_strip_test_DEPENDENCIES): New variable.
8789         (relro_strip_test_LDFLAGS): New variable.
8790         (relro_strip_test_LDADD): New variable.
8791         (relro_strip_test.so): New target.
8792
8793 2010-08-02  Ian Lance Taylor  <iant@google.com>
8794
8795         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
8796         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
8797         (Target_i386::got_tlsdesc_section): New function.
8798         (Target_i386::got_section): Create space for GOT entries for
8799         TLSDESC relocations.
8800         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
8801         R_386_TLS_GOTDESC.
8802         (Target_i386::Scan::global): Likewise.
8803         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
8804         using TLSDESC GOT.
8805         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
8806         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
8807         (Target_x86_64::got_tlsdesc_section): New function.
8808         (Target_x86_64::got_section): Create space for GOT entries for
8809         TLSDESC relocations.
8810         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
8811         R_386_TLS_GOTDESC.
8812         (Target_x86_64::Scan::global): Likewise.
8813         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
8814         using TLSDESC GOT.
8815
8816 2010-08-02  Ian Lance Taylor  <iant@google.com>
8817
8818         * testsuite/final_layout.sh: Use dc to convert from hex to
8819         decimal.
8820
8821 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
8822
8823         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
8824         paramter to the call to gold::gc_process_relocs.
8825         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
8826         paramter to the call to gold::gc_process_relocs.
8827         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
8828         parameter to the call to gold::gc_process_relocs.
8829         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
8830         template parameter to the call to gold::gc_process_relocs.
8831         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
8832         paramter to the call to gold::gc_process_relocs.
8833         * gc.h (get_embedded_addend_size): New function.
8834         (gc_process_relocs): Save the size of the reloc for use by ICF.
8835         * icf.cc (get_section_contents): Get the addend from the text section
8836         for SHT_REL relocation sections.
8837         * icf.h (Icf::Reloc_addend_size_info): New typedef.
8838         (Icf::Reloc_info): Add new member reloc_addend_size_info.
8839         * int_encoding.h (read_from_pointer): New overloaded function.
8840         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
8841         * testsuite/icf_sht_rel_addend_test.sh: New file.
8842         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
8843         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
8844
8845 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8846
8847         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
8848         * Makefile.in: Regenerate.
8849         * testsuite/Makefile.in: Regenerate.
8850
8851 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
8852
8853         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
8854         * gold/testsuite/debug_msg.cc: Likewise.
8855         * gold/testsuite/odr_violation1.cc
8856         * gold/testsuite/odr_violation2.cc
8857
8858 2010-07-21  Cary Coutant  <ccoutant@google.com>
8859
8860         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
8861         string, and length fields.
8862         (Output_merge_string::Merged_strings_list): New type.
8863         (Output_merge_string::Merged_strings_lists): New typedef.
8864         (Output_merge_string): Replace merged_strings_ with
8865         merged_strings_lists_.
8866         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
8867         Merged_strings_list per input object and section.  Don't store pointer
8868         to the string.  Don't store length with each merged string entry.
8869         (Output_merge_string::finalize_merged_data): Loop over list of merged
8870         strings lists.  Recompute length of each merged string.
8871
8872 2010-07-15  Cary Coutant  <ccoutant@google.com>
8873
8874         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
8875         here.
8876
8877 2010-07-14  Ian Lance Taylor  <iant@google.com>
8878
8879         * descriptors.cc (Descriptors::open): Report correct name in error
8880         message.
8881
8882 2010-07-13  Doug Kwan  <dougkwan@google.com>
8883
8884         * arm.cc (Arm_input_section::Arm_input_section): For a
8885         SHT_ARM_EXIDX section, always keeps the input sections.
8886         (Arm_input_section::set_exidx_section_link): New method.
8887         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
8888         has_errors_ to false.
8889         (Arm_exidx_input_section::has_errors,
8890         Arm_exidx_input_section::set_has_errors): New methods.
8891         (Arm_exidx_input_section::has_errors_): New data member.
8892         (Arm_relobj::get_exidx_shndx_list): New method.
8893         (Arm_output_section::append_text_sections_to_list): Do not skip
8894         section without SHF_EXECINSTR.
8895         (Arm_output_section::fix_exidx_coverage): Skip input sections with
8896         errors.
8897         (Arm_relobj::make_exidx_input_section): Add new parameter for text
8898         section header.  Make error messages more verbose.  Check for
8899         a non-executable section linked to an EXIDX section.
8900         (Arm_relobj::do_read_symbols): Remove error checking, which has been
8901         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
8902         check that there is no deferred EXIDX section if we exit early.
8903         Instead of not making an EXIDX section in case of an error, make one
8904         and set the has_errors flag of it.
8905         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
8906         in a relocatable link.
8907         (Target_arm::do_relax): Look for the EXIDX output section instead of
8908         assuming that it is called .ARM.exidx.
8909         (Target_arm::fix_exidx_coverage): Add a new parameter for input
8910         section list.  Do not check for SHF_EXECINSTR section flags but
8911         skip any input section with errors.
8912         * output.cc (Output_section::Output_section): Initialize
8913         always_keeps_input_sections_ to false.
8914         (Output_section::add_input_section): Check for
8915         always_keeps_input_sections_.
8916         *  output.h (Output_section::always_keeps_input_sections,
8917         Output_section::set_always_keeps_input_sections): New methods.
8918         (Output_section::always_keeps_input_sections): New data member.
8919
8920 2010-07-13  Rafael Espindola  <espindola@google.com>
8921
8922         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
8923         * fileread.h (Input_file): Add try_extra_search_path and find_file.
8924
8925 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
8926             Ian Lance Taylor  <iant@google.com>
8927
8928         * output.h (Output_section_lookup_maps::add_merge_section):
8929         Correct check of whether value was inserted.
8930         (Output_section_lookup_maps::add_merge_input_section): Likewise.
8931         (Output_section_lookup_maps::add_relaxed_input_section):
8932         Likewise.
8933         * arm.cc (Target_arm::got_section): Remove used local os.
8934         * i386.cc (Target_i386::got_section): Likewise.
8935         * x86_64.cc (Target_x86_64::got_section): Likewise.
8936         * sparc.cc (Target_sparc::got_section): Likewise.
8937         (Target_sparc::relocate): Remove unused local have_got_offset.
8938         * powerpc.cc (Target_powerpc::relocate): Likewise.
8939
8940 2010-07-13  Ian Lance Taylor  <iant@google.com>
8941
8942         * compressed_output.cc (zlib_decompress): Fix signature in
8943         !HAVE_ZLIB_H case.
8944
8945         * archive.cc (Archive::include_member): Unlock an external member
8946         of a thin archive.  Don't bother to delete an object we know is
8947         NULL.
8948
8949 2010-07-12  Cary Coutant  <ccoutant@google.com>
8950
8951         * compressed_output.cc (zlib_decompress): New function.
8952         (get_uncompressed_size): New function.
8953         (decompress_input_section): New function.
8954         * compressed_output.h (get_uncompressed_size): New function.
8955         (decompress_input_section): New function.
8956         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
8957         Handle compressed debug sections.
8958         * layout.cc (is_compressed_debug_section): New function.
8959         (Layout::output_section_name): Map compressed section names to
8960         canonical names.
8961         * layout.h (is_compressed_debug_section): New function.
8962         (is_debug_info_section): Recognize compressed debug sections.
8963         * merge.cc: Include compressed_output.h.
8964         (Output_merge_data::do_add_input_section): Handle compressed
8965         debug sections.
8966         (Output_merge_string::do_add_input_section): Handle compressed
8967         debug sections.
8968         * object.cc: Include compressed_output.h.
8969         (Sized_relobj::Sized_relobj): Initialize new data members.
8970         (build_compressed_section_map): New function.
8971         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8972         * object.h (Object::section_is_compressed): New method.
8973         (Object::do_section_is_compressed): New method.
8974         (Sized_relobj::Compressed_section_map): New type.
8975         (Sized_relobj::do_section_is_compressed): New method.
8976         (Sized_relobj::compressed_sections_): New data member.
8977         * output.cc (Output_section::add_input_section): Handle compressed
8978         debug sections.
8979         * reloc.cc: Include compressed_output.h.
8980         (Sized_relobj::write_sections): Handle compressed debug sections.
8981
8982 2010-07-08  Cary Coutant  <ccoutant@google.com>
8983
8984         * resolve.cc (Symbol_table::resolve): Remember whether undef was
8985         weak when resolving to a dynamic def.
8986         (Symbol_table::should_override): Add adjust_dyndef flag; set it
8987         for weak undef/dynamic def cases. Adjust callers.
8988         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8989         undef_binding_weak_.
8990         (Symbol_table::sized_write_globals): Adjust symbol binding.
8991         (Symbol_table::sized_write_symbol): Add binding parameter.
8992         * symtab.h (Symbol::set_undef_binding): New method.
8993         (Symbol::is_undef_binding_weak): New method.
8994         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8995         (Symbol_table::should_override): Add new parameter.
8996         (Symbol_table::sized_write_symbol): Add new parameter.
8997
8998         * testsuite/weak_undef_file1.cc: Add new test case.
8999         * testsuite/weak_undef_file2.cc: Fix header comment.
9000         * testsuite/weak_undef_test.cc: Add new test case.
9001
9002 2010-06-29  Doug Kwan  <dougkwan@google.com>
9003
9004         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
9005         Initialize USE_SYMBOL_.
9006         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
9007         definition.
9008         (Arm_reloc_property::uses_symbol_): New data member declaration.
9009         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
9010         uses symbol value and symbol is undefined but not weakly undefined.
9011
9012 2010-06-28  Rafael Espindola  <espindola@google.com>
9013
9014         * plugin.cc (Plugin::load): Use dlerror.
9015
9016 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
9017
9018         * symtab.cc (detect_odr_violations): When reporting an ODR
9019         violation, report an object where the symbol is defined.
9020
9021 2010-06-25  Doug Kwan  <dougkwan@google.com>
9022
9023         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
9024         (Target_arm::section_may_have_icf_unsafe_pointers): New method
9025         definition.
9026         (Target_arm::Scan::local_reloc_may_be_function_pointer,
9027         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
9028         target hook to detect function points.
9029         (Target_arm::Scan::possible_function_pointer_reloc): New method.
9030         * icf.h (Icf::check_section_for_function_pointers): Change type of
9031         parameter SECTION_NAME to const reference to std::string.  Use
9032         target hook to determine if section may have unsafe pointers.
9033         * target.h (Target::section_may_have_icf_unsafe_pointers): New
9034         method definition.
9035
9036 2010-06-21  Rafael Espindola  <espindola@google.com>
9037
9038         * fileread.cc (Input_file::find_fie): New
9039         (Input_file::open): Use Input_file::find_fie.
9040         * fileread.h (Input_file::find_fie): New
9041         * plugin.cc (set_extra_library_path): New.
9042         (Plugin::load): Add set_extra_library_path to the transfer vector.
9043         (Plugin_manager::set_extra_library_path): New.
9044         (Plugin_manager::add_input_file): Use the extra search path if set.
9045         (set_extra_library_path(): New.
9046         * plugin.h (Plugin_manager): Add set_extra_library_path and
9047         extra_search_path_.
9048
9049 2010-06-19  Cary Coutant  <ccoutant@google.com>
9050
9051         * layout.cc (gdb_sections): Add .debug_types.
9052         (lines_only_debug_sections): Likewise.
9053
9054 2010-06-18  Rafael Espindola  <espindola@google.com>
9055
9056         * plugin.cc (add_input_file,add_input_library)
9057         (Plugin_manager::add_input_file): Make filename arguments const.
9058         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
9059         const.
9060
9061 2010-06-16  Doug Kwan  <dougkwan@google.com>
9062
9063         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
9064         .ARM.attributes section if we have not merged any input
9065         attributes sections.
9066
9067 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9068
9069         * arm.cc: Allow combining objects with no EABI version
9070         information.
9071
9072 2010-06-15  Rafael Espindola  <espindola@google.com>
9073
9074         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
9075
9076 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9077
9078         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
9079         (struct iovec): Correct !HAVE_READV definition.
9080
9081 2010-06-10  Cary Coutant  <ccoutant@google.com>
9082
9083         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
9084         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
9085         reloc sections.
9086         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
9087
9088         PR 11683
9089         * symtab.h (Symbol::is_placeholder): New member function.
9090         * target-reloc.h (relocate_section): Check for placeholder symbols.
9091
9092         * testsuite/Makefile.am (plugin_test_8): New test.
9093         (plugin_test_9): New test.
9094         * testsuite/Makefile.in: Regenerate.
9095
9096 2010-06-09  Nick Clifton  <nickc@redhat.com>
9097
9098         * yyscript.y (input_list_element): Allow strings prefixed with
9099         the '-' character.  Treat these as libraries.
9100         * script.cc (script_add_library): New function.  Adds a library
9101         specified by "-l<name>" found in an input script.
9102         * script-c.h: Add prototype for script_add_library.
9103
9104 2010-06-07  Doug Kwan  <dougkwan@google.com>
9105
9106         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
9107         Restrict stub-group size to be within long conditional branch
9108         range when working around cortex-A8 erratum.
9109
9110 2010-06-07  Damien Diederen  <dd@crosstwine.com>
9111
9112         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
9113         #ifdef typo.
9114
9115 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
9116
9117         PR gold/11658
9118         * output.cc
9119         (Output_section::Input_section_sort_entry::compare_section_ordering):
9120         Change to return non-zero correctly.
9121         (Output_section::Input_section_sort_section_order_index_compare
9122         ::operator()): Change to fix ambiguity in comparisons.
9123
9124 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
9125
9126         * gold.h (is_wildcard_string): New function.
9127         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
9128         (Layout::layout_eh_frame): Ditto.
9129         (Layout::find_section_order_index): New method.
9130         (Layout::read_layout_from_file): New method.
9131         * layout.h (Layout::find_section_order_index): New method.
9132         (Layout::read_layout_from_file): New method.
9133         (Layout::input_section_position_): New private member.
9134         (Layout::input_section_glob_): New private member.
9135         * main.cc (main): Call read_layout_from_file here.
9136         * options.h (--section-ordering-file): New option.
9137         * output.cc (Output_section::input_section_order_specified_): New
9138         member.
9139         (Output_section::Output_section): Initialize new member.
9140         (Output_section::add_input_section): Add new parameter.
9141         Keep input sections when --section-ordering-file is used.
9142         (Output_section::set_final_data_size): Sort input sections when
9143         section ordering file is specified.
9144         (Output_section::Input_section_sort_entry): Add new parameter.
9145         Check sorting type.
9146         (Output_section::Input_section_sort_entry::compare_section_ordering):
9147         New method.
9148         (Output_section::Input_section_sort_compare::operator()): Change to
9149         consider section_order_index.
9150         (Output_section::Input_section_sort_init_fini_compare::operator()):
9151         Change to consider section_order_index.
9152         (Output_section::Input_section_sort_section_order_index_compare
9153         ::operator()): New method.
9154         (Output_section::sort_attached_input_sections): Change to sort
9155         according to section order when specified.
9156         (Output_section::add_input_section<32, true>): Add new parameter.
9157         (Output_section::add_input_section<64, true>): Add new parameter.
9158         (Output_section::add_input_section<32, false>): Add new parameter.
9159         (Output_section::add_input_section<64, false>): Add new parameter.
9160         * output.h (Output_section::add_input_section): Add new parameter.
9161         (Output_section::input_section_order_specified): New
9162         method.
9163         (Output_section::set_input_section_order_specified): New method.
9164         (Input_section::Input_section): Initialize section_order_index_.
9165         (Input_section::section_order_index): New method.
9166         (Input_section::set_section_order_index): New method.
9167         (Input_section::section_order_index_): New member.
9168         (Input_section::Input_section_sort_section_order_index_compare): New
9169         struct.
9170         (Output_section::input_section_order_specified_): New member.
9171         * script-sections.cc (is_wildcard_string): Delete and move modified
9172         method to gold.h.
9173         (Output_section_element_input::Output_section_element_input): Modify
9174         call to is_wildcard_string.
9175         (Output_section_element_input::Input_section_pattern
9176         ::Input_section_pattern): Ditto.
9177         (Output_section_element_input::Output_section_element_input): Ditto.
9178         * testsuite/Makefile.am (final_layout): New test case.
9179         * testsuite/Makefile.in: Regenerate.
9180         * testsuite/final_layout.cc: New file.
9181         * testsuite/final_layout.sh: New file.
9182
9183 2010-06-01  Rafael Espindola  <espindola@google.com>
9184
9185         * plugin.cc (Plugin::load): Pass the output name to the plugin.
9186
9187 2010-06-01  Rafael Espindola  <espindola@google.com>
9188
9189         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
9190         visibility of symbols.
9191
9192 2010-05-27  Doug Kwan  <dougkwan@google.com>
9193
9194         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
9195         from start of output section instead of address for a local symbol
9196         in a merged or relaxed section when doing a relocatable link.
9197
9198 2010-05-26  Rafael Espindola  <espindola@google.com>
9199
9200         PR 11604
9201         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
9202         adding sections the garbage collector removed.
9203         * gold/testsuite/Makefile.am: Add test.
9204         * gold/testsuite/Makefile.in: Regenerate.
9205         * gold/testsuite/plugin_test_7.sh: New.
9206         * gold/testsuite/plugin_test_7_1.c: New.
9207         * gold/testsuite/plugin_test_7_2.c: New.
9208
9209 2010-05-26  Rafael Espindola  <espindola@google.com>
9210
9211         * script-sections.cc (Output_section_definition::set_section_addresses):
9212         Check for --section-start.
9213
9214 2010-05-26  Doug Kwan  <dougkwan@google.com>
9215
9216         * arm.cc (Arm_scan_relocatable_relocs): New class.
9217         (Target_arm::relocate_special_relocatable): New method.
9218         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
9219         (Arm_relocate_functions::thumb_branch_common): Same.
9220         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
9221         instead of Default_scan_relocatable_relocs.
9222         * target-reloc.h (relocate_for_relocatable): Let target handle
9223         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
9224         * target.h (Sized_target::relocate_special_relocatable): New method.
9225
9226 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9227
9228         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
9229
9230 2010-05-23  Doug Kwan  <dougkwan@google.com>
9231
9232         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
9233         instead of a cast.
9234         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
9235         with a direct branch, not a conditional branch, to a stub.
9236         * merge.cc (Output_merge_base::record_input_section): New method
9237         defintion.
9238         (Output_merge_data::do_add_input_section): Record input section if
9239         keeps-input-sections flag is set.
9240         (Output_merge_string::do_add_input_section): Ditto.
9241         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
9242         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
9243         INPUT_SECTIONS_.
9244         (Output_merge_base::keeps_input_sections,
9245         Output_merge_base::set_keeps_input_sections,
9246         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
9247         method definitions.
9248         (Output_merge_base::Input_sections): New type declaration.
9249         (Output_merge_base::input_sections_begin,
9250         Output_merge_base::input_sections_end,
9251         Output_merge_base::do_set_keeps_input_sections): New method definitions.
9252         (Output_merge_base::bool keeps_input_sections_,
9253         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
9254         Output_merge_base::input_sections_): New data members.
9255         (Output_merge_data::do_set_keeps_input_sections): New method
9256         defintion.
9257         (Output_merge_string::do_set_keeps_input_sections): Ditto.
9258         * output.cc (Output_section::Input_section::relobj): Move method
9259         defintion from class declaration to here and handle merge sections.
9260         (Output_section::Input_section::shndx): Ditto.
9261         (Output_section::Output_section): Remove initializations of removed
9262         data members and initialize new data member LOOKUP_MAPS_.
9263         (Output_section::add_input_section): Set keeps-input-sections flag
9264         for a newly created merge output section as appropriate.  Adjust code
9265         to use Output_section_lookup_maps class.
9266         (Output_section::add_relaxed_input_section): Adjst code for lookup
9267         maps code refactoring.
9268         (Output_section::add_merge_input_section): Add a new parameter
9269         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
9270         class.  If adding input section to a newly created merge output
9271         section fails, remove the new merge section.
9272         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
9273         Adjust code for use of the Output_section_lookup_maps class.
9274         (Output_section::find_merge_section): Ditto.
9275         (Output_section::build_lookup_maps): New method defintion.
9276         (Output_section::find_relaxed_input_section): Adjust code to use
9277         Output_section_lookup_maps class.
9278         (Output_section::get_input_sections): Export merge sections.  Adjust
9279         code to use Output_section_lookup_maps class.
9280         (Output_section:::add_script_input_section): Adjust code to use
9281         Output_section_lookup_maps class.  Update lookup maps for merge
9282         sections also.
9283         (Output_section::discard_states): Use Output_section_lookup_maps.
9284         (Output_section::restore_states): Same.
9285         * output.h (Merge_section_properties): Move class defintion out of
9286         Output_section.
9287         (Output_section_lookup_maps): New class.
9288         (Output_section::Input_section::is_merge_section): New method
9289         defintion.
9290         (Output_section::Input_section::relobj): Move defintion out of class
9291         defintion.  Declare method only.
9292         (Output_section::Input_section::shndx): Ditto.
9293         (Output_section::Input_section::output_merge_base): New method defintion.
9294         (Output_section::Input_section::u2_.pomb): New union field.
9295         (Output_section::Merge_section_by_properties_map,
9296         Output_section::Output_section_data_by_input_section_map,
9297         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
9298         Remove types.
9299         (Output_section::add_merge_input_section): Add new parameter
9300         KEEPS_INPUT_SECTIONS.
9301         (Output_section::build_lookup_maps): New method declaration.
9302         (Output_section::merge_section_map_,
9303         Output_section::merge_section_by_properties_map_,
9304         Output_section::relaxed_input_section_map_,
9305         Output_section::is_relaxed_input_section_map_valid_): Remove data
9306         members.
9307         (Output_section::lookup_maps_): New data member.
9308
9309 2010-05-21  Doug Kwan  <dougkwan@google.com>
9310
9311         PR gold/11619
9312         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
9313         avoid a compilation error.
9314
9315 2010-05-19  Rafael Espindola  <espindola@google.com>
9316
9317         * script-sections.cc (Output_section_definition::allocate_to_segment):
9318         Update the phdrs_list even when the output section is NULL.
9319         * testsuite/Makefile.am: Add test.
9320         * testsuite/Makefile.in: Regenerate.
9321         * testsuite/script_test_9.cc: New.
9322         * testsuite/script_test_9.sh: New.
9323         * testsuite/script_test_9.t: New.
9324
9325 2010-05-19  Doug Kwan  <dougkwan@google.com>
9326
9327         * arm.cc (Arm_input_section::original_size): New method.
9328         (Arm_input_section::do_addralign): Add a cast.
9329         (Arm_input_section::do_output_offset): Remove static cast.
9330         (Arm_input_section::original_addralign,
9331          Arm_input_section::original_size_): Change type to uint32_t.
9332         (Arm_input_section::init): Add safe casts for section alignment
9333         and size.
9334         (Arm_input_section::set_final_data_size): Do not set address and
9335         offset of stub table.
9336         (Arm_output_section::fix_exidx_coverage): Change use of of
9337         Output_section::Simple_input_section to that of
9338         Output_section::Input_section.
9339         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
9340         except for the first pass.
9341         * output.cc (Output_section::get_input_sections): Change type of
9342         input_sections to std::list<Input_section>.
9343         (Output_section::add_script_input_section): Rename from
9344         Output_section::add_simple_input_section.  Change type of SIS
9345         parameter from Simple_input_section to Input_section.
9346         * output.h (Output_section::Simple_input_section): Remove class.
9347         (Output_section::Input_section): Change class visibility to public.
9348         (Output_section::Input_section::addralign): Use stored alignments
9349         for special input sections if set.
9350         (Output_section::Input_section::set_addralign): New method.
9351         (Output_section::get_input_sections): Change parameter type from
9352         list of Simple_input_section to list of Input_section.
9353         (Output_section::add_script_input_section): Rename from
9354         Output_section::add_simple_input_section. Change first parameter's
9355         type from Simple_input_section to Input_section and remove the
9356         second and third parameters.
9357         * script-sections.cc (Input_section::Input_section_list): Change
9358         type to list of Output_section::Input_section/
9359         (Input_section_info::Input_section_info): Change parameter type of
9360         INPUT_SECTION to Output_section::Input_section.
9361         (Input_section_info::input_section): Change return type.
9362         (Input_section_info::input_section_): Change type to
9363         Output_section::Input_section.
9364         (Output_section_element_input::set_section_addresses): Adjust code
9365         to use Output_section::Input_section instead of
9366         Output_section::Simple_input_section.  Adjust code for renaming
9367         of Output_section::add_simple_input_section.
9368         (Orphan_output_section::set_section_addresses): Ditto.
9369
9370 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9371
9372         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
9373         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
9374
9375 2010-05-18  Rafael Espindola  <espindola@google.com>
9376
9377         * options.cc (General_options::finalize): Handle -nostdlib.
9378         * options.h (nostdlib): New option.
9379         * script.cc (script_add_search_dir): Handle -nostdlib.
9380
9381 2010-05-12  Doug Kwan  <dougkwan@google.com>
9382
9383         * arm.cc (Target_arm::do_finalize_sections): Create an empty
9384         attributes section only if there no attributes section after merging.
9385         (Target_arm::merge_object_attributes): Move value of
9386         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
9387         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
9388         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
9389         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
9390         and arm_attr_merge_7.stdout.
9391         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
9392         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
9393         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
9394         arm_attr_merge_7b.o): New rules.
9395         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
9396         arm_attr_merge_7
9397         * testsuite/Makefile.in: Regenerate.
9398         * testsuite/arm_attr_merge.sh: New file.
9399         * testsuite/arm_attr_merge_[67][ab].s: Same.
9400
9401 2010-05-05  Nick Clifton  <nickc@redhat.com>
9402
9403         * po/es.po: Updated Spanish translation.
9404
9405 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
9406
9407         * Makefile.am (install-exec-local): Properly install gold as
9408         default cross linker.
9409         * Makefile.in: Regenerated.
9410
9411 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
9412             Nick Clifton  <nickc@redhat.com>
9413
9414         * configure.ac (install_as_default): Define and set to false
9415         unless --enable-gold or --enable-gold=both/gold has been
9416         specified.
9417         * configure: Regenerate.
9418
9419         * Makefile.am (install-exec-local): Install the executable as
9420         'ld.gold'.  If install_as_default is true then also install it as
9421         'ld'.
9422         * Makefile.in: Regenerated.
9423
9424 2010-04-24  Ian Lance Taylor  <iant@google.com>
9425
9426         * layout.cc (Layout::layout_reloc): In relocatable link don't
9427         combine reloc sections for grouped sections.
9428
9429 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
9430
9431         * gc.h (gc_process_relocs): Pass information on relocs pointing to
9432         sections that are not ordinary to icf.
9433         * icf.cc (get_section_contents): Handle relocation pointing to section
9434         with no object or shndx information.
9435         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
9436         * testsuite/Makefile.in: Regenerate.
9437         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
9438         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
9439
9440 2010-04-22  Ian Lance Taylor  <iant@google.com>
9441
9442         * expression.cc (Expression::Expression_eval_info): Add
9443         result_alignment_pointer field.
9444         (Expression::eval_with_dot): Add result_alignment_pointer
9445         parameter.  Change all callers.
9446         (Expression::eval_maybe_dot): Likewise.
9447         (class Binary_expression): Add alignment_pointer parameter to
9448         left_value and right_value.  Change all callers.
9449         (BINARY_EXPRESSION): Set result alignment.
9450         (class Trinary_expression): Add alignment_pointer parameter to
9451         arg2_value and arg3_value.  Change all callers.
9452         (Trinary_cond::value): Set result alignment.
9453         (Max_expression::value, Min_expression::value): Likewise.
9454         (Align_expression::value): Likewise.
9455         * script-sections.cc (class Sections_element): Add dot_alignment
9456         parameter to set_section_addresses virtual function.  Update
9457         instantiations.
9458         (class Output_section_element): Likewise.
9459         (Script_sections::create_segments): Add dot_alignment parameter.
9460         Change all callers.
9461         (Script_sections::create_segments_from_phdrs_clause): Likewise.
9462         (Script_sections::set_phdrs_clause_addresses): Likewise.
9463         * script-sections.h: Update declarations.
9464         * script.h: Update declarations.
9465         * output.h (Output_segment::set_minimum_p_align): Don't decrease
9466         min_p_align.
9467         * testsuite/script_test_3.t: Set large alignment.
9468         * testsuite/script_test_3.sh: Make sure that at least one LOAD
9469         segment has expected alignment.
9470
9471 2010-04-22  Nick Clifton  <nickc@redhat.com>
9472
9473         * po/gold.pot: Updated by the Translation project.
9474         * po/vi.po: Updated Vietnamese translation.
9475
9476 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
9477
9478         * testsuite/Makefile.am (check_PROGRAMS): Add
9479         icf_virtual_function_folding_test.
9480         * testsuite/Makefile.in: Regenerated.
9481
9482 2010-04-15  Andrew Haley  <aph@redhat.com>
9483
9484         * options.h (merge_exidx_entries): New option.
9485         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
9486         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
9487         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
9488         (Target_arm::merge_exidx_entries): New function.
9489         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
9490         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
9491         to Arm_exidx_fixup constructor.
9492         Add new arg, merge_exidx_entries.
9493         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
9494         Arm_output_section::fix_exidx_coverage.
9495
9496 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
9497
9498         * icf.cc (get_section_contents): Check for preemptible functions.
9499         Ignore addend when appropriate.
9500         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
9501         section folded.
9502         (add_from_relobj): Check for section folded.
9503         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
9504         * symtab.h (should_add_dynsym_entry): Add new parameter.
9505         * target-reloc.h (scan_relocs): Check for section folded.
9506         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
9507         Check reloc types for function pointers in shared objects.
9508         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
9509         case.
9510         (icf_preemptible_functions_test): New test case.
9511         (icf_string_merge_test): New test case.
9512         * testsuite.Makefile.in: Regenerate.
9513         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
9514         bar_glob.  Refactor code.
9515         * testsuite/icf_preemptible_functions_test.cc: New file.
9516         * testsuite/icf_preemptible_functions_test.sh: New file.
9517         * testsuite/icf_string_merge_test.cc: New file.
9518         * testsuite/icf_string_merge_test.sh: New file.
9519         * testsuite/icf_virtual_function_folding_test.cc: New file.
9520         * testsuite/icf_virtual_function_folding_test.sh: New file.
9521
9522 2010-04-14  Doug Kwan  <dougkwan@google.com>
9523
9524         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
9525         for local symbol recounting if we remove a section due to ICF.
9526         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
9527         there are no regular objects in input.
9528
9529 2010-04-13  Doug Kwan  <dougkwan@google.com>
9530
9531         * arm.cc (Arm_input_section::set_final_data_size): Compute
9532         accurate final data size instead of using current data size.
9533
9534 2010-04-09  Doug Kwan  <dougkwan@google.com>
9535
9536         * layout.cc (Layout::choose_output_section): Handle script section
9537         types.
9538         (Layout::make_output_section_for_script): Add section type parameter.
9539         Handle script section types.
9540         * layout.h (Layout::make_output_section_for_script): Add section
9541         type parameter.
9542         * output.cc (Output_section::Output_section): Initialize data member
9543         is_noload_.
9544         (Output_section::do_reset_address_and_file_offset): Do not set address
9545         to 0 if section is a NOLOAD section.
9546         * output.h (Output_section::is_noload): New method.
9547         (Output_section::set_is_noload): Ditto.
9548         (Output_section::is_noload_): New data member.
9549         * script-c.h (Script_section_type): New enum type.
9550         (struct Parser_output_section_header): Add new file section_type.
9551         * script-sections.cc (Sections_element::output_section_name): Add
9552         parameter for returning script section type.
9553         (Output_section_definition::output_section_name): Ditto.
9554         (Output_section_definition::section_type)P; New method.
9555         (Output_section_definiton::script_section_type_name): Ditto.
9556         (Output_section_definition::script_section_type_): New data member.
9557         (Output_section_definition::Output_section_definition): Initialize
9558         data member Output_section_definition::script_section_type_.
9559         (Output_section_definition::create_sections): Pass script section type
9560         to Layout::make_output_section_for_script.
9561         (Output_section_definition::output_section_name): Return script
9562         section type to caller.
9563         (Output_section_definition::set_section_address): Do not advance
9564         dot value and load address if section type is NOLOAD.  Set address
9565         of NOLOAD sections regardless of section flags.
9566         (Output_section_definition::print): Print section type if it is
9567         not SCRIPT_SECTION_TYPE_NONE.
9568         (Output_section_definition::section_type): New method.
9569         (Output_section_definition::script_section_type_name): Ditto.
9570         (Script_sections::output_section_name): Add new parameter
9571         PSECTION_TYPE for returning script section type.  Pass it to
9572         section elements.  Handle discard sections.
9573         (Sort_output_sections::operator()): Handle NOLOAD sections.
9574         * script-sections.h (Script_sections::Section_type): New enum type.
9575         (Script_sections::output_section_name): Add a new parameter for
9576         returning script section type.
9577         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
9578         INFO and NOLOAD.
9579         * yyscript.y (union): Add new field SECTION_TYPE.
9580         (COPY, DSECT, INFO, NOLOAD): New tokens.
9581         (opt_address_and_section_type): Change type to output_section_header.
9582         (section_type): New non-terminal
9583         (section_header): Handle section type.
9584         (opt_address_and_section_type): Return section type value.
9585
9586 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
9587
9588         * testsuite/plugin_common_test_1.c (foo): Add prototype.
9589         * testsuite/plugin_common_test_2.c (foo): Likewise.
9590
9591 2010-04-08  Doug Kwan  <dougkwan@google.com>
9592
9593         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
9594         Output_merge_data.
9595         * output.cc (Output_section::add_merge_input_section): Simplify
9596         code and return status of Output_merge_base::add_input_section.
9597         Update merge section map only if Output_merge_base::add_input_section
9598         returns true.
9599
9600 2010-04-07  Doug Kwan  <dougkwan@google.com>
9601
9602         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
9603         if section is marked as containing instructions but has no mapping
9604         symbols.
9605         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
9606         correct section index.
9607         (Arm_relobj::find_linked_text_section): Ditto.
9608
9609 2010-04-07  Cary Coutant  <ccoutant@google.com>
9610
9611         * archive.cc (include_member): Destroy Read_symbols_data object before
9612         releasing file.
9613         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
9614         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
9615         (Read_symbols_data::~Read_symbols_data) New destructor.
9616         (Section_relocs::Section_relocs) New constructor.
9617         (Section_relocs::~Section_relocs) New destructor.
9618         (Read_relocs_data::Read_relocs_data) New constructor.
9619         (Read_relocs_data::~Read_relocs_data) New destructor.
9620         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
9621         pointers to NULL after deleting.
9622
9623 2010-04-07  Doug Kwan  <dougkwan@google.com>
9624
9625         * arm.cc: Replace "endianity" with "endianness" in comments.
9626         (Arm_exidx_cantunwind): Ditto.
9627         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
9628         (Arm_relobj::merge_flags_and_attributes): New method.
9629         (Arm_relobj::merge_flags_and_attributes_): New data member.
9630         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
9631         (Arm_relobj::scan_sections_for_stubs): Ditto.
9632         (Arm_relobj::do_read_symbols): Check to see if we really want to
9633         merge processor-specific flags and attributes.  Exit early if
9634         an object is empty except for section names and the undefined symbol.
9635         (Target_arm::do_finalize_sections): Move check for ELF format to
9636         Arm_relobj::do_read_symbols.  Merge processor specific flags and
9637         attributes from a regular object only when we have determined that
9638         it is aapropriate.  Do not create an .ARM.attributes section in
9639         output if there is no regular input object.
9640         (Target_arm::merge_processor_specific_flags): Check
9641         --warn-mismatch before printing any error.
9642         (Target_arm::merge_object_attributes): Ditto.
9643         * gold.cc (queue_middle_tasks): Handle the case in which there is
9644         no regular object in input.
9645         * options.cc (General_options::parse_EB): New method.
9646         (General_options::parse_EL): Same.
9647         (General_options::General_options): Initialize endianness_.
9648         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
9649         New options.
9650         (General_options::Endianness): New enum.
9651         (General_options::endianness): New method.
9652         (General_options::endianness_): New data member.
9653         * parameters.cc (Parameters::set_options): Check target endianness.
9654         (Parameters::set_target_once): Ditto.
9655         (Parameters::check_target_endianness): New method.
9656         (parameters_force_valid_target): If either -EL or -EB is specified,
9657         use it to define endianness of default target.
9658         * parameters.h (Parameters::check_target_endianness): New method
9659         declaration.
9660         * target.h (class Target): Change "endianity" to "endianness"
9661         in comments.
9662
9663 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9664
9665         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
9666         * configure: Regenerate.
9667         * Makefile.in: Regenerate.
9668         * testsuite/Makefile.in: Regenerate.
9669
9670 2010-04-06  Cary Coutant  <ccoutant@google.com>
9671
9672         gcc PR lto/42757
9673         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
9674         prevailing definitions of common symbols.
9675         * testsuite/plugin_test_6.sh: New test case.
9676         * testsuite/plugin_common_test_1.c: New test case.
9677         * testsuite/plugin_common_test_2.c: New test case.
9678         * testsuite/Makefile.am (plugin_test_6): New test case.
9679         * testsuite/Makefile.in: Regenerate.
9680
9681 2010-04-06  Nick Clifton  <nickc@redhat.com>
9682
9683         * po/vi.po: New Vietnamese translation.
9684
9685 2010-03-30  Doug Kwan  <dougkwan@google.com>
9686
9687         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
9688
9689 2010-03-25  Doug Kwan  <dougkwan@google.com>
9690
9691         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
9692         to avoid a conversion warning on a 32-bit host.
9693
9694 2010-03-24  Ian Lance Taylor  <iant@google.com>
9695
9696         * testsuite/script_test_3.t: Add a TLS segment.
9697         * testsuite/Makefile.am (check_PROGRAMS): Add
9698         tls_phdrs_script_test.
9699         (tls_phdrs_script_test_SOURCES): Define.
9700         (tls_phdrs_script_test_DEPENDENCIES): Define.
9701         (tls_phdrs_script_test_LDFLAGS): Define.
9702         (tls_phdrs_script_test_LDADD): Define.
9703         * testsuite/Makefile.in: Rebuild.
9704
9705 2010-03-23  Cary Coutant  <ccoutant@google.com>
9706
9707         * fileread.cc (find_or_make_view): Fix comment.
9708
9709 2010-03-23  Ian Lance Taylor  <iant@google.com>
9710
9711         * script-sections.cc (class Orphan_section_placement): Define
9712         PLACE_TLS and PLACE_TLS_BSS.
9713         (Orphan_section_placement::Orphan_section_placement): Initialize
9714         new places.
9715         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
9716         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
9717         (tls_script_test_SOURCES): Define.
9718         (tls_script_test_DEPENDENCIES): Define.
9719         (tls_script_test_LDFLAGS): Define.
9720         (tls_script_test_LDADD): Define.
9721         * testsuite/Makefile.in: Rebuild.
9722
9723 2010-03-22  Doug Kwan  <dougkwan@google.com>
9724
9725         * arm.cc (Arm_relocate_functions::abs8,
9726         Arm_relocate_functions::abs16): Use correct check for overflow
9727         specified in the ARM ELF specs.
9728         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
9729         target of a BLX instruction specially.
9730         (Reloc_stub::stub_type_for_reloc): Ditto.
9731         (Relocate::relocate): Use symbolic names instead of numeric relocation
9732         codes to report error.
9733         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
9734         workaround.
9735         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
9736         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
9737         thumb2_blx_out_of_range.stdout
9738         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
9739         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
9740         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
9741         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
9742         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
9743         thumb2_blx_in_range, thumb2_blx_in_range.o,
9744         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
9745         thumb2_blx_out_of_range.o): New rules.
9746         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
9747         thumb2_blx_in_range and thumb2_blx_out_of_range.
9748         * testsuite/Makefile.in: Regenerate.
9749         * arm_branch_in_range.sh: Add tests for THUMB BLX.
9750         * testsuite/thumb_blx_in_range.s: New file.
9751         * testsuite/thumb_blx_out_of_range.s: New file.
9752
9753 2010-03-22  Rafael Espindola  <espindola@google.com>
9754
9755         * archive.cc (Should_include): Move to archive.h.
9756         (should_include_member): Make it a member of Archive.
9757         (Lib_group): New.
9758         (Add_lib_group_symbols): New.
9759         * archive.h: Include options.h.
9760         (Archive_member): Moved from Archive.
9761         (Should_include): Moved from archive.cc.
9762         (Lib_group): New.
9763         (Add_lib_group_symbols): New.
9764         * dynobj.cc (do_should_include_member): New.
9765         * dynobj.h (do_should_include_member): New.
9766         * gold.cc (queue_initial_tasks): Update call to queue.
9767         * main.cc (main): Print lib group stats.
9768         * object.cc (do_should_include_member): New.
9769         * object.h: Include archive.h.
9770         (Object::should_include_member): New.
9771         (Object::do_should_include_member): New.
9772         (Sized_relobj::do_should_include_member): New.
9773         * options.cc (General_options::parse_start_lib): New.
9774         (General_options::parse_end_lib): New.
9775         (Input_arguments::add_file): Handle lib groups.
9776         (Input_arguments::start_group): Check we are not in a lib.
9777         (Input_arguments::start_lib): New.
9778         (Input_arguments::end_lib): New.
9779         * options.h (General_options): Add start_lib and end_lib.
9780         (Input_argument::lib_): New.
9781         (Input_argument::lib): New.
9782         (Input_argument::is_lib): New.
9783         (Input_file_lib): New.
9784         (Input_arguments::in_lib_): New.
9785         (Input_arguments::in_lib): New.
9786         (Input_arguments::start_lib): New.
9787         (Input_arguments::end_lib_): New.
9788         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
9789         in unused members as preempted.
9790         (Sized_pluginobj::do_should_include_member): New.
9791         * plugin.h (Sized_pluginobj::do_should_include_member): New.
9792         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
9793         return the blocker.
9794         (Read_symbols::do_whole_lib_group): New.
9795         (Read_symbols::do_lib_group): New.
9796         (Read_symbols::do_read_symbols): Handle lib groups.
9797         (Read_symbols::get_name): Handle lib groups.
9798         * readsyms.h (Read_symbols): Add an archive member pointer.
9799         (Read_symbols::do_whole_lib_group): New.
9800         (Read_symbols::do_lib_group): New.
9801         (Read_symbols::member_): New.
9802         * script.cc (read_input_script): Update call to queue_soon.
9803
9804 2010-03-19  Doug Kwan  <dougkwan@google.com>
9805
9806         * arm.cc (Stub_table::Stub_table): Initialize new data members
9807         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9808         (Stub_table::add_reloc_stub): Assign stub offset and update
9809         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9810         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
9811         New data members.
9812         (Stub_table::update_data_size_and_addralign): Use
9813         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
9814         instead of going over all reloc stubs.
9815         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
9816         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9817         Stringpool_template::offset_ to size of Stringpool_char.
9818         (Stringpool_template::new_key_offset): Remove code to initialize
9819         Stringpool_template::offset_.
9820         * stringpool.h (Stringpool_template::set_no_zero_null): Set
9821         Stringpool_template::offset_ to zero.
9822
9823 2010-03-15  Doug Kwan  <dougkwan@google.com>
9824
9825         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9826         offset_.
9827         (Stringpool_template::new_key_offset): New method.
9828         (Stringpool_template::add_string): Assign offsets when adding new
9829         strings.
9830         (Stringpool_template::set_string_offsets): Do not set string offsets
9831         when not optimizing.
9832         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
9833         member size_.
9834         (Chunked_vector::clear): Clear size_.
9835         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
9836         (Chunked_vector::size): Return size_.
9837         (Chunked_vector::push_back): Use size_ to find insert position.
9838         (Chunked_vector::size_): New data member.
9839         (Stringpool_template::set_no_zero_null): Assert string set is empty.
9840         (Stringpool_template::new_key_offset): New method declaration.
9841         (Stringpool_template::offset_): New data member.
9842
9843 2010-03-15   Rafael Espindola  <espindola@google.com>
9844
9845         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
9846         Add_symbols' constructor.
9847         * readsyms.h (Add_symbols): Remove the input_group member.
9848
9849 2010-03-10  Ian Lance Taylor  <iant@google.com>
9850
9851         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
9852         target to ask whether a reference to a symbol requires a stack
9853         split.
9854         * target.h (Target::is_call_to_non_split): New function.
9855         (Target::do_is_call_to_non_split): Declare virtual function.
9856         * target.cc: Include "symtab.h".
9857         (Target::do_is_call_to_non_split): New function.
9858         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
9859
9860 2010-03-10  Cary Coutant  <ccoutant@google.com>
9861
9862         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
9863         (File_read::open[1]): Remove initial mapping of whole_file_view_.
9864         (File_read::open[2]): Add whole_file_view_ to list of views.
9865         (File_read::make_view): Remove test of whole_file_view_.
9866         (File_read::find_or_make_view): Create whole_file_view_ if
9867         necessary.
9868         (File_read::clear_views): Replace bool parameter with enum;
9869         adjust all callers.  Don't delete views with permanent data;
9870         do delete cached views and views from archives if
9871         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
9872         if clearing the corresponding view.
9873         * fileread.h (File_read::Clear_views_mode): New enum.
9874         (File_read::View::is_permanent_view): New method.
9875         (File_read::clear_views): Replace bool parameter
9876         with enum; adjust all callers.
9877         * options.h (General_options): Change keep_files_mapped option;
9878         add map_whole_files.
9879         * readsyms.cc (Add_symbols::run): Delete sd_ object before
9880         releasing the file.
9881         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
9882         the file.
9883
9884 2010-03-10  David S. Miller  <davem@davemloft.net>
9885
9886         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
9887
9888 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
9889
9890         * icf.cc (get_section_contents): Add '@' marker after processing the
9891         merge reloc.
9892
9893 2010-03-08  Doug Kwan  <dougkwan@google.com>
9894
9895         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
9896         due to a conversion warning.
9897         (Arm_relobj::update_output_local_symbol_count): Check for local
9898         symbol with unset output index.
9899
9900 2010-03-05  Ian Lance Taylor  <iant@google.com>
9901
9902         * options.h (class General_options): Add --spare-dynamic-tags.
9903         * output.cc (Output_data_dynamic::set_final_data_size): Implement
9904         --spare-dynamic-tags.
9905
9906 2010-03-05  Ian Lance Taylor  <iant@google.com>
9907
9908         * incremental.cc: Include "libiberty.h".
9909
9910 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
9911
9912         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
9913         function, is_info_ member.
9914         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
9915         (Versions::Versions): Update caller.
9916         (Versions::define_base_version): Likewise.
9917         (Versions::add_def): Likewise.
9918
9919 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
9920
9921         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
9922         (Scan::possible_function_pointer_reloc): New function.
9923         (Scan::local_reloc_may_be_function_pointer): Change to call
9924         possible_function_pointer_reloc.
9925         (Scan::global_reloc_may_be_function_pointer): Ditto.
9926         * icf.h (Icf::check_section_for_function_pointers): Change to reject
9927         relocations in ".data.rel.ro._ZTV" section.
9928         * testsuite/icf_safe_so_test.sh: Change to pass i386.
9929         * testsuite/icf_safe_so_test.cc: Ditto.
9930         * testsuite/icf_safe_test.cc: Ditto.
9931         * testsuite/icf_safe_test.sh: Ditto.
9932
9933 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9934             Ian Lance Taylor  <iant@google.com>
9935
9936         * target-reloc.h (relocate_section): Check the symbol table index
9937         for -1U before setting the local symbol index.
9938         (scan_relocatable_relocs): If copying the relocation, record that
9939         the local symbol is required.
9940         * object.h (Symbol_value::is_output_symtab_index_set): New
9941         function.
9942         (Symbol_value::may_be_discarded_from_output_symtab): New
9943         function.
9944         (Symbol_value::has_output_symtab_entry): New function.
9945         (Symbol_value::needs_output_symtab_entry): Remove.
9946         (Symbol_value::output_symtab_index): Make sure the symbol index is
9947         set.
9948         (Symbol_value::set_output_symtab_index): Make sure the symbol
9949         index is not set.  Make sure the new index is valid.
9950         (Symbol_value::set_must_have_output_symtab_entry): New function.
9951         (Symbol_value::has_output_dynsym_entry): New function.
9952         (Symbol_value::set_output_dynsym_index): Make sure the new index
9953         is valid.
9954         (Sized_relobj::set_must_have_output_symtab_entry): New function.
9955         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
9956         local symbol if permitted.
9957         (Sized_relobj::do_finalize_local_symbols): Call
9958         is_output_symtab_index_set rather than needs_output_symtab_entry.
9959         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
9960         rather than needs_output_symtab_entry.  Call
9961         has_output_dynsym_entry rather than needs_output_dynsym_entry.
9962         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
9963         is_output_symtab_index_set rather than needs_output_symtab_entry.
9964         * testsuite/discard_locals_relocatable_test.c: New file.
9965         * testsuite/discard_locals_test.sh: Test -r.
9966         * testsuite/Makefile.am (check_DATA): Add
9967         discard_locals_relocatable_test1.syms,
9968         discard_local_relocatable_test2.syms.
9969         (MOSTLYCLEANFILES): Likewise.  Also add
9970         discard_locals_relocatable_test1.lout and
9971         discard_locals_relocatable_test2.out.
9972         (discard_locals_relocatable_test1.syms): New target.
9973         (discard_locals_relocatable_test.o): New target.
9974         (discard_locals_relocatable_test1.out): New target.
9975         (discard_locals_relocatable_test2.syms): New target.
9976         (discard_locals_relocatable_test2.out): New target.
9977         (various): Add missing ../ld-new dependencies.
9978         * testsuite/Makefile.in: Rebuild.
9979
9980 2010-03-03  Nick Clifton  <nickc@redhat.com>
9981
9982         * po/fi.po: New Finnish translation.
9983
9984 2010-03-01  Doug Kwan  <dougkwan@google.com>
9985
9986         * layout.cc (Layout::Layout): Force section types of .init_array*,
9987         .preinit_array* and .fini_array* sections.
9988         * output.cc (Output_section::Input_section_sort_entry::has_priority):
9989         Fix check of return value of std::string::find.().
9990         (Output_section::Input_section_sort_compare::operator()): Remove
9991         comment about .init_array.
9992         (Output_section::Input_section_sort_init_fini_compare::operator()):
9993         New method.
9994         (Output_section::sort_attached_input_sections): Handle .init_array
9995         and .fini_array specially.
9996         * output.h (Output_section::Inut_section_sort_compare): Update
9997         comment.
9998         (Output_section::Input_section_sort_init_fini_compare): New struct.
9999
10000 2010-02-26  Doug Kwan  <dougkwan@google.com>
10001
10002         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
10003         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
10004         * testsuite/debug_msg.sh: Avoid matching source line number for
10005         use of global variable undef_int.
10006
10007 2010-02-26  Doug Kwan  <dougkwan@google.com>
10008
10009         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
10010         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
10011         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
10012         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
10013         * options.cc (General_options::General_options): Initialize member
10014         fix_v4bx_.
10015         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
10016         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
10017         and rm_no_fix_v4bx.stdout
10018         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
10019         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
10020         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
10021         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
10022         and arm_no_fix_v4bx.
10023         * Makefile.in: Regenerate.
10024         * testsuite/arm_fix_v4bx.s: New file.
10025         * testsuite/arm_fix_v4bx.sh: Ditto.
10026
10027 2010-02-24  Doug Kwan  <dougkwan@google.com>
10028
10029         * arm.cc (Target_arm::got_section): Make the .got section the first
10030         non RELRO section in the data segment.
10031         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
10032         suffixes of section names.
10033
10034 2010-02-24  Doug Kwan  <dougkwan@google.com>
10035
10036         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
10037         flags and attributes merging if an input file is a binary file.
10038         * fileread.cc (Input_file::open): Record format of original file.
10039         * fileread.h (Input_file::Format): New enum type.
10040         (Input_file::Input_file): Initialize data member format_.
10041         (Input_file::format): New method definition.
10042         (Input_file::format_):: New data member.
10043
10044 2010-02-24  Doug Kwan  <dougkwan@google.com>
10045
10046         * arm.cc (Arm_output_data_got): New class.
10047         (ARM_TCB_SIZE): New constant
10048         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
10049         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
10050         If user uses a script with a SECTIONS clause, issue only a warning
10051         for a misplaced EXIDX input section.  Otherwise, issue an error.
10052         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
10053         garbage collection.
10054         (Target_arm::got_mode_index_entry): Handle static linking.
10055         (Target_arm::Scan::local): Ditto.
10056         (Target_arm::Scan::global): Ditto.
10057         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
10058         all incorrectly implemented relocations.
10059         (Target_arm::fix_exidx_coverage): Pass layout to
10060         Arm_output_section::fix_exidx_coverage.
10061         * layout.cc (Layout::section_name_mapping): Remove trailing dots
10062         from ".ARM.exidx." and ".ARM.extab.".
10063
10064 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10065
10066         * arm.cc (Target_arm::do_finalize_sections): Create attribute
10067         section if it does not already exist.
10068         * attributes.cc (Attributes_section_data::Attributes_section_data):
10069         Don't crash if size is zero.
10070
10071 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10072             Ian Lance Taylor  <iant@google.com>
10073
10074         * gold.cc (queue_middle_tasks): If no input files were opened,
10075         exit.
10076         * workqueue.h (Task_function::Task_function): Assert that there is
10077         a blocker.
10078
10079 2010-02-22  Doug Kwan  <dougkwan@google.com>
10080
10081         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
10082         * icf.cc (get_section_contents): Cast snprintf arguments to long long
10083         types to avoid warnings due to different uint64_t implementations
10084         on different hosts.
10085
10086 2010-02-21  Doug Kwan  <dougkwan@google.com>
10087
10088         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
10089         handling of the maximum backward branch offset.
10090         (Arm_relocate_functions::thumb_branch_common): Ditto.
10091         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
10092         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
10093         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
10094         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
10095         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
10096         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
10097         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
10098         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
10099         thumb_bl_out_of_range thumb_bl_out_of_range.o,
10100         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
10101         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
10102         thumb2_bl_out_of_range.o): New rules.
10103         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
10104         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
10105         thumb2_bl_out_of_range
10106         * testsuite/Makefile.in: Regenerate.
10107         * testsuite/arm_bl_in_range.s: New file.
10108         * testsuite/arm_bl_out_of_range.s: Ditto.
10109         * testsuite/arm_branch_in_range.sh: Ditto.
10110         * testsuite/arm_branch_range.t: Ditto.
10111         * testsuite/thumb2_branch_range.t: Ditto.
10112         * testsuite/thumb_bl_in_range.s: Ditto.
10113         * testsuite/thumb_bl_out_of_range.s: Ditto.
10114         * testsuite/thumb_branch_range.t: Ditto.
10115
10116 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
10117
10118         * gc.h (gc_process_relocs): Change vectors to point to the new list.
10119         Add reloc offset information.
10120         * icf.cc (get_section_contents): Change iterators to point to the new
10121         vectors. Add reloc offset information to the contents.
10122         * icf.h (Icf::Sections_reachable_info): New typedef.
10123         (Icf::Sections_reachable_list): New typedef.
10124         (Icf::Offset_info): New typedef.
10125         (Icf::Reloc_info): New struct typedef.
10126         (Icf::Reloc_info_list): New typedef.
10127         (Icf::symbol_reloc_list): Delete method.
10128         (Icf::addend_reloc_list): Delete method.
10129         (Icf::section_reloc_list): Delete method.
10130         (Icf::reloc_info_list): New method.
10131         (Icf::reloc_info_list_): New member.
10132
10133 2010-02-19  Doug Kwan  <dougkwan@google.com>
10134
10135         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
10136         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
10137         * arm.cc (Arm_relocation_functions): New forward declaration.
10138         (Target_arm::Target_arm): Initialize new data members
10139         got_mod_index_offset_ and tls_base_symbol_defined_.
10140         (Target_arm::Relocate::relocate_tls): New method.
10141         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
10142          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
10143         New methods.
10144         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
10145         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
10146         (Target_arm::got_mod_index_offset_,
10147         Target_arm::tls_base_symbol_defined_): New data members.
10148         (Target_arm::Scan::local, Target::Scan::global,
10149         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
10150         relocations.
10151
10152 2010-02-18  Doug Kwan  <dougkwan@google.com>
10153
10154         * arm.cc (Arm_relobj::find_linked_text_section): New method.
10155         (Arm_relobj::make_exidx_input_section): Pass section index of linked
10156         text section as a parameter becuase some broken tools may not set
10157         the link in section header.
10158         (Target_arm::has_got_section): New method.
10159         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
10160         without any mapping symbol as data only.  Remove warning.
10161         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
10162         link in its section header, try to discover the link by inspecting the
10163         REL31 relocation at the beginning of the section.
10164         (Target_arm::Scan::check_non_pic): Report name of offending relocation
10165         in error message.
10166         (Target_arm::Scan::global): Treat any reference to the symbol
10167         _GLOBAL_OFFSET_TABLE_ as a GOT access.
10168
10169 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
10170
10171         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
10172         (Scan::global_reloc_may_be_function_pointer): New function.
10173         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10174         (Scan::global_reloc_may_be_function_pointer): New function.
10175         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10176         (Scan::global_reloc_may_be_function_pointer): New function.
10177         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
10178         (Scan::global_reloc_may_be_function_pointer): New function.
10179         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
10180         (Scan::global_reloc_may_be_function_pointer): New function.
10181         (Scan::possible_function_pointer_reloc): New function.
10182         (Target_x86_64::can_check_for_function_pointers): New function.
10183         * gc.h (gc_process_relocs): Scan relocation types to determine if
10184         function pointers were taken for targets that support it.
10185         * icf.cc (Icf::find_identical_sections): Include functions for
10186         folding in safe ICF whose pointer is not taken.
10187         * icf.h (Secn_fptr_taken_set): New typedef.
10188         (fptr_section_id_): New member.
10189         (section_has_function_pointers): New function.
10190         (set_section_has_function_pointers): New function.
10191         (check_section_for_function_pointers): New function.
10192         * options.h: Fix comment for safe ICF option.
10193         * target.h (can_check_for_function_pointers): New function.
10194         * testsuite/Makefile.am: Add icf_safe_so_test test case.
10195         Modify icf_safe_test for X86-64.
10196         * testsuite/Makefile.in: Regenerate.
10197         * testsuite/icf_safe_so_test.cc: New file.
10198         * testsuite/icf_safe_so_test.sh: New file.
10199         * testsuite/icf_safe_test.cc (kept_func_3): New function.
10200         (main): Change to take pointer to function kept_func_3.
10201         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
10202         folding is done correctly for X86-64.
10203
10204 2010-02-12  David S. Miller  <davem@davemloft.net>
10205
10206         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
10207         is_symbolless parameter.
10208         (Output_reloc<SHT_REL>::is_symbolless): New.
10209         (Output_reloc<SHT_REL>::is_symbolless_): New.
10210         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
10211         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
10212         (Output_reloc<SHT_RELA>::is_symbolless): New.
10213         (Output_data_reloc::add_global): Handle is_symbolless.
10214         (Output_data_reloc::add_global_relative): Likewise.
10215         (Output_data_reloc::add_local): Likewise.
10216         (Output_data_reloc::add_local_relative): Likewise.
10217         (Output_data_reloc::add_symbolless_global_addend): New.
10218         (Output_data_reloc::add_symbolless_local_addend): New.
10219         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
10220         is_symbolless.
10221         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
10222         instead of ->is_relative_
10223         (Output_reloc::write): Likewise.
10224         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
10225         (Output_reloc::write_rel): Simplify.
10226
10227         * sparc.cc (Target_sparc::Scan::local): Use
10228         ->add_symbolless_local_addend as needed.
10229         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
10230         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
10231         based upon relocation offset.
10232
10233 2010-02-11  Doug Kwan  <dougkwan@google.com>
10234
10235         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
10236         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
10237         beginning of function.
10238         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
10239         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
10240         parameter is_32bit in calls to should_apply_static_reloc.
10241         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
10242         (check_DATA): Add arm_abs_global.stdout.
10243         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
10244         arm_abs_global.stdout): New rules.
10245         (MOSTLLYCLEANFILES): Add arm_abs_global
10246         * Makefile.in: Regenerate.
10247         * testsuite/arm_abs_global.s: New file.
10248         * testsuite/arm_abs_global.sh: Ditto.
10249         * testsuite/arm_abs_lib.s: Ditto.
10250
10251 2010-02-11  Ian Lance Taylor  <iant@google.com>
10252
10253         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
10254         Read_relocs task.
10255         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
10256         Allocate_commons_task first.
10257         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
10258         task, rather than symtab_lock_.
10259         (Gc_process_relocs::~Gc_process_relocs): New function.
10260         (Gc_process_relocs::is_runnable): Check this_blocker_.
10261         (Gc_process_relocs::locks): Use next_blocker_ rather than
10262         blocker_.
10263         (Scan_relocs::~Scan_relocs): New function.
10264         (Scan_relocs::is_runnable): Check this_blocker_ rather than
10265         symtab_lock_.
10266         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
10267         next_blocker_.
10268         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
10269         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
10270         constructor accordingly.
10271         (class Gc_process_relocs): Likewise.
10272         (class Scan_relocs): Likewise.
10273         * common.h (class Allocate_commons_task): Remove symtab_lock_
10274         field, and corresponding constructor parameter.
10275         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
10276         symtab_lock_.
10277         (Allocate_commons_task::locks): Likewise.
10278
10279 2010-02-11  Ian Lance Taylor  <iant@google.com>
10280
10281         * gold-threads.h (class Once): Define.
10282         (class Initialize_lock): Rewrite as child of Once.
10283         * gold-threads.cc (class Once_initialize): Define.
10284         (once_pointer_control): New static variable.
10285         (once_pointer, once_arg): New static variables.
10286         (c_run_once): New static function.
10287         (Once::Once, Once::run_once, Once::internal_run): New functions.
10288         (class Initialize_lock_once): Remove.
10289         (initialize_lock_control): Remove.
10290         (initialize_lock_pointer): Remove.
10291         (initialize_lock_once): Remove.
10292         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
10293         (Initialize_lock::initialize): Rewrite.
10294         (Initialize_lock::do_run_once): New function.
10295         * archive.cc (Archive::interpret_header): Only clear name if it is
10296         not already empty.
10297         * fileread.cc: Include "gold-threads.h"
10298         (file_counts_lock): New static variable.
10299         (file_counts_initialize_lock): Likewise.
10300         (File_read::release): Only increment counts when using --stats.
10301         Use a lock around the increment.
10302         * parameters.cc (class Set_parameters_target_once): Define.
10303         (set_parameters_target_once): New static variable.
10304         (Parameters::Parameters): Move here from parameters.h.
10305         (Parameters::set_target): Rewrite.
10306         (Parameters::set_target_once): New function.
10307         (Parameters::clear_target): Move here and rewrite.
10308         * parameters.h (class Parameters): Update declarations.  Add
10309         set_parameters_target_once_ field.
10310         (Parameters::Parameters): Move to parameters.cc.
10311         (Parameters::clear_target): Likewise.
10312         * readsyms.cc (Read_symbols::do_group): Create a Start_group
10313         task.
10314         (Start_group::~Start_group): New function.
10315         (Start_group::is_runnable): New function.
10316         (Start_group::locks, Start_group::run): New functions.
10317         (Finish_group::run): Change saw_undefined to size_t.
10318         * readsyms.h (class Start_group): Define.
10319         (class Finish_group): Change saw_undefined_ field to size_t.
10320         (Finish_group::Finish_group): Remove saw_undefined and
10321         this_blocker parameters.  Change all callers.
10322         (Finish_group::set_saw_undefined): New function.
10323         (Finish_group::set_blocker): New function.
10324         * symtab.h (class Symbol_table): Change saw_undefined to return
10325         size_t.  Change saw_undefined_ field to size_t.
10326         * target-select.cc (Set_target_once::do_run_once): New function.
10327         (Target_selector::Target_selector): Initialize set_target_once_
10328         field.  Don't initialize lock_ and initialize_lock_ fields.
10329         (Target_selector::instantiate_target): Rewrite.
10330         (Target_selector::set_target): New function.
10331         * target-select.h (class Set_target_once): Define.
10332         (class Target_selector): Update declarations.  Make
10333         Set_target_once a friend.  Remove lock_ and initialize_lock_
10334         fields.  Add set_target_once_ field.
10335
10336 2010-02-10  Ian Lance Taylor  <iant@google.com>
10337
10338         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
10339         queueing any tasks.
10340         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
10341         (queue_middle_tasks): Add all blockers before queueing any tasks.
10342         (queue_final_tasks): Likewise.
10343         * token.h (Task_token::add_blockers): New function.
10344         * object.h (Input_objects::number_of_relobjs): New function.
10345
10346 2010-02-10  Ian Lance Taylor  <iant@google.com>
10347
10348         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
10349         shared, not if not position independent.
10350         * x86_64.cc (Relocate::relocate_tls): Likewise.
10351         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
10352         (tls_pie_pic_test): New target.
10353         * testsuite/Makefile.in: Rebuild.
10354
10355         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
10356         (tls_test_main_pie.o, tls_test_pie.o): New targets.
10357         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
10358         * testsuite/Makefile.in: Rebuild.
10359
10360 2010-02-09  David S. Miller  <davem@davemloft.net>
10361
10362         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
10363         R_SPARC_RELATIVE using ->add_local_relative().
10364         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
10365
10366         * output.h (Output_data_dynamic::add_section_size): New method
10367         that takes two Output_data objects.
10368         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
10369         entry param.  Handle it in initializers.
10370         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
10371         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
10372         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
10373         arg.
10374         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
10375         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
10376         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
10377         for dynrel_includes_plt.
10378         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10379         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10380         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
10381         before .rela.plt
10382         (Target_sparc::do_finalize_sections): Update to pass true for
10383         dynrel_includes_plt.
10384         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
10385         output before .rela.plt
10386         (Target_powerpc::do_finalize_sections): Update to pass true for
10387         dynrel_includes_plt when 32-bit.
10388
10389 2010-02-08  Doug Kwan  <dougkwan@google.com>
10390
10391         * arm.cc (Arm_relobj::simple_input_section_output_address): New
10392         method.
10393         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
10394         Arm_relobj::scan_section_for_cortex_a8_stubs,
10395         Arm_relobj::do_relocation_section): Instead of calling
10396         Output_section::output_address, use faster
10397         Arm_relobj::simple_input_section_output_address.
10398
10399 2010-02-08  David S. Miller  <davem@davemloft.net>
10400
10401         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
10402         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
10403         relocation helper function.
10404
10405         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
10406         just like R_SPARC_GOT{10,13,22}.
10407         (Target_sparc::Scan::local): Likewise.
10408         (Target_sparc::Relocate:relocate): Likewise.
10409
10410 2010-02-06  Ian Lance Taylor  <iant@google.com>
10411
10412         * configure.ac: Rewrite targetobjs duplicate removal code to use
10413         only shell constructs.
10414         * configure: Rebuild.
10415
10416 2010-02-05  Doug Kwan  <dougkwan@google.com>
10417
10418         PR 11247
10419         * arm.cc (Arm_relobj::section_is_scannable): New method.
10420         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
10421         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
10422
10423 2010-02-04  Doug Kwan  <dougkwan@google.com>
10424
10425         PR 11247
10426         * arm-reloc-property.cc (cstdio): Include.
10427         * configure.ac (targetobjs): Remove duplicates.
10428         * configure: Regenerate.
10429         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
10430         big and little endian version for a given address size.
10431
10432 2010-02-03  Doug Kwan  <dougkwan@google.com>
10433
10434         * arm-reloc-property.cc
10435         (Arm_reloc_property_table::reloc_name_in_error_message): New method
10436         definition.
10437         * arm-reloc-property.h
10438         (Arm_reloc_property_table::get_implemented_static_reloc_property):
10439         New method definition.
10440         (Arm_reloc_property_table::reloc_name_in_error_message): New method
10441         declaration.
10442         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
10443         overflow to N.
10444         (GOT_PREL): Change implemented to Y.
10445         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
10446         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
10447         (Arm_relocate_functions::movw_abs_nc): Remove method.
10448         (Arm_relocate_functions::movt_abs): Ditto.
10449         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
10450         (Arm_relocate_functions::thm_movt_abs): Ditto.
10451         (Arm_relocate_functions::movw_rel_nc): Ditto.
10452         (Arm_relocate_functions::movw_rel): Ditto.
10453         (Arm_relocate_functions::movt_rel): Ditto.
10454         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
10455         (Arm_relocate_functions:thm_movw_rel): Ditto.
10456         (Arm_relocate_functions:thm_movt_rel): Ditto.
10457         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
10458         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
10459         New method definitions.
10460         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
10461         (Arm_relocation_functions::arm_grp_ldr): Ditto.
10462         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
10463         (Arm_relocation_functions::arm_grp_ldc): Ditto.
10464         (Target_arm::Relocate::relocate): Check for non-static or
10465         unimplemented relocation code and exit early.  Change calls to
10466         Target_arm::reloc_uses_thumb_bit and
10467         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
10468         instead.  Refactor code to handle similar relocations to increase
10469         code sharing.  Remove check for unsupported relocation code in switch
10470         statement.
10471         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
10472         relocation property table to find out size.  Change error message to
10473         print out the name of a relocation code instead of the numeric value.
10474         (Target_arm::scan_reloc_for_stub): Use relocation property table
10475         instead of calling Target_arm::reloc_uses_thumb_bit().
10476
10477 2010-02-02  Doug Kwan  <dougkwan@google.com>
10478
10479         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
10480         types of relaxed input section.
10481
10482 2010-02-02  Doug Kwan  <dougkwan@google.com>
10483
10484         * Makefile.am (HFILES): Add arm-reloc-property.h.
10485         (DEFFILES): New.
10486         (TARGETSOURCES): Add arm-reloc-property.cc
10487         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
10488         (libgold_a_SOURCES): $(DEFFILES)
10489         * Makefile.in: Regenerate.
10490         * arm-reloc-property.cc: New file.
10491         * arm-reloc-property.h: New file.
10492         * arm-reloc.def: New file.
10493         * arm.cc: Update comments.
10494         (arm-reloc-property.h): New included header.
10495         (arm_reloc_property_table): New global variable.
10496         (Target_arm::do_select_as_default_target): New method definition.
10497         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
10498         arm-reloc-property to targ_extra_obj.
10499         * parameters.cc (set_parameters_target): Call
10500         Target::select_as_default_target().
10501         * target.h (Target::select_as_default_target): New method definition.
10502         (Target::do_select_as_default_target): Same.
10503
10504 2010-02-01  Doug Kwan  <dougkwan@google.com>
10505
10506         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
10507         first_output_text_section_.
10508         (Arm_exidx_fixup::first_output_text_section): New method definition.
10509         (Arm_exidx_fixup::first_output_text_section_): New data member.
10510         (Arm_exidx_fixup::process_exidx_section): Record the first text
10511         output section seen.
10512         (Arm_output_section::fix_exidx_coverage): Set correct linked section
10513         and entsize in output section header.
10514
10515 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10516
10517         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
10518         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
10519         (Arm_relocate_functions::thm_alu11): New Method.
10520         (Arm_relocate_functions::thm_pc8): New Method.
10521         (Arm_relocate_functions::thm_pc12): New Method.
10522         (Target_arm::Scan::local): Handle the relocations.
10523         (Target_arm::Scan::global): Likewise.
10524         (Target_arm::Relocate::relocate): Likewise.
10525         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10526
10527 2010-01-29  Doug Kwan  <dougkwan@google.com>
10528
10529         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
10530         of relocation types as ld.
10531
10532 2010-01-29  Doug Kwan  <dougkwan@google.com>
10533
10534         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
10535         to public.
10536         (Arm_relocate_functions::thumb_branch_common): Ditto.
10537         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
10538         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
10539         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
10540         Arm_relocate_functions::jump24): Remove.
10541         (Target_arm::Relocate::relocate): Adjust code to call
10542         Arm_relocation_functions::arm_branch_common and
10543         Arm_relocation_functions::thumb_branch_common instead of their removed
10544         wrappers.  Merge switch-cases together to reduce source code size.
10545
10546 2010-01-29  Doug Kwan  <dougkwan@google.com>
10547
10548         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
10549         output_local_symbol_count_needs_update_.
10550         (Arm_relobj::output_local_symbol_count_needs_update,
10551          Arm_relobj::set_output_local_symbol_count_needs_update,
10552          Arm_relobj::update_output_local_symbol_count): New methods.
10553         (Arm_relobj::output_local_symbol_count_needs_update_): New data
10554         member.
10555         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
10556         of pointed function as in a R_ARM_PREL31 relocation.
10557         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
10558         for output local symbol count updating.
10559         (Target_arm::do_relax): Update output local symbol counts in objects
10560         if necessary.
10561         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
10562
10563 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10564
10565         * arm.cc: Added support for the ARM relocations:
10566         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
10567         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
10568         (Arm_relocate_functions::movw_rel_nc): Renamed (was
10569         movw_prel_nc).
10570         (Arm_relocate_functions::movw_rel): New method.
10571         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
10572         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
10573         thm_movw_prel_nc).
10574         (Arm_relocate_functions::thm_movw_rel): New method.
10575         (Arm_relocate_functions::thm_movt_rel): Renamed (was
10576         thm_movt_prel).
10577         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
10578         relocations.
10579         (Target_arm::Scan::global): Likewise.
10580         (Target_arm::Relocate::relocate): Likewise.
10581         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10582         Likewise.
10583
10584 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10585
10586         * arm.cc: Added support for ARM group relocations.
10587         (Target_arm::reloc_needs_sym_origin): New method.
10588         (Arm_relocate_functions::calc_grp_kn): New method.
10589         (Arm_relocate_functions::calc_grp_residual): New method.
10590         (Arm_relocate_functions::calc_grp_gn): New method.
10591         (Arm_relocate_functions::arm_grp_alu): New Method.
10592         (Arm_relocate_functions::arm_grp_ldr): New Method.
10593         (Arm_relocate_functions::arm_grp_ldrs): New Method.
10594         (Arm_relocate_functions::arm_grp_ldc): New Method.
10595         (Target_arm::Scan::local): Handle the ARM group relocations.
10596         (Target_arm::Scan::global): Likewise.
10597         (Target_arm::Relocate::relocate): Likewise.
10598         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10599         Likewise.
10600
10601 2010-01-26  Doug Kwan  <dougkwan@google.com>
10602
10603         * arm.cc (set): Include.
10604         (class Arm_exidx_fixup): Change type of last_input_section_ to const
10605         pointer type.
10606         (Arm_output_section::Text_section_list): New type.
10607         (Arm_output_section::append_text_sections_to_list): New method.
10608         (Arm_output_section::fix_exidx_coverage): Ditto.
10609         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
10610         (Arm_relobj::convert_input_section_to_relaxed_section): Use
10611         Relobj::set_section_offset() instead of
10612         Sized_relobj::invalidate_section_offset().
10613         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
10614         parameter for section headers. Ignore relocation sections for
10615         unallocated sections and EXIDX sections.
10616         (Target_arm::fix_exidx_coverage): New method.
10617         (Target_arm::output_section_address_less_than): New type.
10618         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
10619         linked text section instead of the EXIDX section.
10620         (Arm_output_section::create_stub_group): Add an assertion to check
10621         that this is not an EXIDX output section.
10622         (Arm_output_section::append_text_sections_to_list): New method.
10623         (Arm_output_section::fix_exidx_coverage): Ditto.
10624         (Arm_relobj::scan_sections_for_stubs): Adjust call to
10625         Arm_relobj::section_needs_reloc_stub_scanning.
10626         (Target_arm::do_relax): Fix EXIDX output section coverage in the
10627         first pass.
10628         (Target_arm::fix_exidx_coverage): New method.
10629         * object.h (Relobj::set_output_section): New method.
10630         (Sized_relobj::invalidate_section_offset): Remove method.
10631         (Sized_relobj::do_invalidate_section_offset): Remove method.
10632         (Sized_relobj::do_set_section_offset): Handle offset value -1.
10633
10634 2010-01-25  Doug Kwan  <dougkwan@google.com>
10635
10636         * arm.cc (Arm_exidx_merged_section::do_output_offset):
10637         Fix warning due to signed and unsigned comparison on a 32-bit host.
10638
10639 2010-01-22  Doug Kwan  <dougkwan@google.com>
10640
10641         * arm.cc (Target_arm::do_relax): Record an output section for section
10642         offset adjustment it contains any stub table that has changed.
10643         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
10644         offsets in an output section if necessary.
10645         * output.cc (Output_section::Output_section): Initialize
10646         section_offsets_need_adjustments_.
10647         (Output_section::add_input_section_for_script): Renamed to
10648         Output_section::add_simple_input_section.
10649         (Output_section::save_states): Add a comment.
10650         (Output_section::discard_states): New method defintion.
10651         (Output_section::adjust_section_offsets): Same.
10652         * output.h (Output_section::add_input_section_for_script): Renamed to
10653         Output_section::add_simple_input_section.
10654         (Output_section::discard_states): New method declaration.
10655         (Output_section::adjust_section_offsets): Same.
10656         (Output_section::section_offsets_need_adjustment,
10657         Output_section::set_section_offsets_need_adjustment): New method
10658         definitions.
10659         (Output_section::section_offsets_need_adjustment_): New data member.
10660         * script-sections.cc
10661         (Output_section_element_input::set_section_address): Adjust code for
10662         renaming of Output_section::add_input_section_for_script.
10663         (Orphan_output_section::set_section_address): Same.
10664
10665 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10666
10667         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
10668         Fix_v4bx enum values .
10669         * gold/options.h (General_options): New option definitions.
10670         (General_options::fix_v4bx): New method.
10671         (General_options::Fix_v4bx): New enum.
10672         * gold/options.cc (General_options::parse_fix_v4bx): New method.
10673         (General_options::parse_fix_v4bx_interworking): New method.
10674
10675 2010-01-22  Doug Kwan  <dougkwan@google.com>
10676
10677         * arm.cc (Arm_exidx_fixup): New class.
10678
10679 2010-01-21  Doug Kwan  <dougkwan@google.com>
10680
10681         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
10682         classes.
10683         (Arm_exidx_section_offset_map): New type.
10684
10685 2010-01-21  Doug Kwan  <dougkwan@google.com>
10686
10687         * arm.cc (Arm_exidx_input_section): New class.
10688         (Arm_relobj::exidx_input_section_by_link,
10689         Arm_relobj::exidx_input_section_by_shndx,
10690         Arm_relobj::make_exidx_input_section): New methods.
10691         (read_arm_attributes_section): Remove.
10692         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
10693         information about them.
10694         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
10695         to here.
10696
10697 2010-01-20  Doug Kwan  <dougkwan@google.com>
10698
10699         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
10700         Input_section_specifier to Section_id.
10701         (Target_arm::new_arm_input_section: Adjust code for change of key
10702         type.
10703         (Target_arm::find_arm_input_section): Ditto.
10704         * gc.h (object.h): Include for Section_id nand Section_id_hash.
10705         (Section_id): Remove.
10706         (Garbage_collection::Section_id_hash): Remove.
10707         * icf.h (object.h): Include for Section_id nand Section_id_hash.
10708         (Section_id): Remove.
10709         (Icf::Section_id_hash): Remove.
10710         * object.h (Section_id, Const_section_id, Section_id_hash,
10711         Const_section_id_hash): New type definitions.
10712         * output.cc (Output_section::add_relaxed_input_section): Change to
10713         use Const_section_id instead of Input_section_specifier as key type.
10714         (Output_section::add_merge_input_section): Ditto.
10715         (Output_section::build_relaxation_map): Change to use Section_id
10716         instead of Input_section_specifier as key type.
10717         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10718         Ditto.
10719         (Output_section::convert_input_sections_to_relaxed_sections): Change
10720         to use Const_section_id instead of Input_section_specifier as key type.
10721         (Output_section::find_merge_section): Ditto.
10722         (Output_section::find_relaxed_input_section): Ditto.
10723         * output.h (Input_section_specifier): Remove class.
10724         (Output_section::Output_section_data_by_input_section_map): Change
10725         key type to Const_section_id.
10726         (Output_section::Output_relaxed_input_section_by_input_section_map):
10727         Ditto.
10728         (Output_section::Relaxation_map): Change key type to Section_id.
10729
10730 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10731
10732         * gold/arm.cc: Added support for R_ARM_V4BX relocation
10733         (class Arm_v4bx_stub): New class.
10734         (DEF_STUBS): Updated definition to support v4_veneer_bx.
10735         (Stub_factory::make_arm_v4bx_stub): New method.
10736         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
10737         (Stub_table::empty): Handle v4bx stubs.
10738         (Stub_table::add_arm_v4bx_stub): New method.
10739         (Stub_table::find_arm_v4bx_stub): New method.
10740         (Arm_relocate_functions::v4bx): New method.
10741         (Target_arm::fix_v4bx): New method.
10742         (Target_arm::Target_arm): Handle R_ARM_V4BX.
10743         (Stub_table::relocate_stubs): Likewise.
10744         (Stub_table::do_write): Likewise.
10745         (Stub_table::update_data_size_and_addralign): Likewise.
10746         (Stub_table::finalize_stubs):  Likewise.
10747         (Target_arm::Scan::local): Likewise.
10748         (Target_arm::Scan::global): Likewise.
10749         (Target_arm::do_finalize_sections): Likewise.
10750         (Target_arm::Relocate::relocate): Likewise.
10751         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10752         Likewise.
10753         (Target_arm::scan_reloc_for_stub): Likewise.
10754         (Target_arm::scan_reloc_section_for_stubs): Likewise.
10755
10756 2010-01-19  Ian Lance Taylor  <iant@google.com>
10757
10758         * output.cc (Output_section_headers::do_sized_write): Write large
10759         segment count to sh_info field.
10760         (Output_file_header::do_sized_write): For large segment count,
10761         write PN_XNUM to e_phnum field.
10762
10763 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10764
10765         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
10766         (Arm_relocate_functions::thm_jump8): New function.
10767         (Arm_relocate_functions::thm_jump11): New function.
10768         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
10769         R_ARM_THM_JUMP11.
10770         (Target_arm::Scan::global): Likewise.
10771         (Target_arm::Relocate::relocate): Likewise.
10772         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10773         Likewise.
10774
10775 2010-01-14  Doug Kwan  <dougkwan@google.com>
10776
10777         * arm.cc (map, utility): Include headers.
10778         (Target_arm::apply_cortex_a8_workaround): New method.
10779         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
10780         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
10781         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
10782         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
10783         the --[no-]fix-cortex-a8 command line options.
10784         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
10785         (Target_arm::relocate_stub): Use addend in instruction template.
10786         * options.h (DEFINE_bool): Set the user-set flag.
10787         (General_options): Add --[no-]-fix-cortex options.
10788         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
10789         : Update fast look-up map after conversion.
10790
10791 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
10792
10793         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
10794         in the first pass of do_layout.
10795
10796 2010-01-13  Doug Kwan  <dougkwan@google.com>
10797
10798         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10799         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
10800         apparent compiler problem of not folding static constant integral
10801         data members of elfcpp::Elf_sizes<32>.
10802
10803 2010-01-13  Doug Kwan  <dougkwan@google.com>
10804
10805         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10806         Arm_relobj::section_needs_cortex_a8_stub_scanning,
10807         Arm_relobj::scan_section_for_cortex_a8_erratum,
10808         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
10809         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
10810         sections to scan for relocation stubs into a new method
10811         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
10812         relocation and Cortex-A8 stub scanning.
10813         (Target_arm::do_relax): Force stubs to be after stubbed sections
10814         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
10815         the beginning of a new relaxation pass.  Update a comment.
10816         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
10817
10818 2010-01-12  Ian Lance Taylor  <iant@google.com>
10819
10820         * target-reloc.h (visibility_error): New inline function.
10821         (relocate_section): Call visibility_error.
10822         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
10823         (MOSTLYCLEANFILES): Likewise.
10824         (protected_4_pic.o, protected_3.err): New targets.
10825         * testsuite/protected_4.cc: New file.
10826
10827 2010-01-12  Doug Kwan  <dougkwan@google.com>
10828
10829         * arm.cc (Cortex_a8_reloc): New class.
10830         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
10831         and cortex_a8_relocs_info_.
10832         (Target_arm::fix_cortex_a8): New method definition.
10833         (Target_arm::Cortex_a8_relocs_info): New type.
10834         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
10835         New data member declarations.
10836         (Target_arm::scan_reloc_for_stub): Record information about
10837         relocations for THUMB branches that might be exempted from the
10838         Cortex-A8 workaround.
10839         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
10840         at the beginning of a relaxation pass.
10841
10842 2010-01-12  Doug Kwan  <dougkwan@google.com>
10843
10844         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
10845         (Arm_relobj::Mapping_symbol_position,
10846          Arm_reloj::Mapping_symbol_position_less,
10847          Arm_relobj::Mapping_symbols_info): New types.
10848         (Target_arm::is_mapping_symbol_name): New method definition.
10849         (Arm_relobj::do_count_local_symbols): Save information about mapping
10850         symbols.
10851
10852 2010-01-11  Doug Kwan  <dougkwan@google.com>
10853
10854         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
10855         Arm_relocate_functions::thumb32_branch_upper,
10856         Arm_relocate_functions::thumb32_branch_lower,
10857         Arm_relocate_functions::thumb32_cond_branch_offset,
10858         Arm_relocate_functions::thumb32_cond_branch_upper,
10859         Arm_relocate_functions::thumb32_cond_branch_lower,
10860         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
10861         branch offset encoding.
10862         (Arm_relocate_functions::thumb_branch_common): Use new branch
10863         offset encoding methods to avoid code duplication.
10864         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
10865         (Stub_addend_reader::operator()): Use new branch encoding method
10866         to avoid code duplication.
10867
10868 2010-01-11  Doug Kwan  <dougkwan@google.com>
10869
10870         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
10871         (Target_arm::do_finalize_sections): Define special EXIDX section
10872         symbols only if referenced.
10873         * gc.h (Garbage_collection::add_reference): New method.
10874         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
10875         code duplication.
10876
10877 2010-01-11  Ian Lance Taylor  <iant@google.com>
10878
10879         * script.cc (Version_script_info::build_expression_list_lookup):
10880         Change complaing about duplicate wildcard match from error to
10881         warning.
10882
10883         * script.cc (class Lazy_demangler): Recreate--revert part of patch
10884         of 2009-12-30.
10885         (Version_script_info::Version_script_info): Initialize globs_,
10886         default_version_, default_is_global_, and exact_.  Don't
10887         initialize globals_ or locals_.
10888         (Version_script_info::build_lookup_tables): Build local symbols
10889         first.
10890         (Version_script_info::unquote): New function.
10891         (Version_script_info::add_exact_match): New function.
10892         (Version_script_info::build_expression_list_lookup): Remove lookup
10893         parameter.  Add is_global parameter.  Change all callers.  Handle
10894         wildcard pattern specially.  Unquote pattern.  Call
10895         add_exact_match.
10896         (Version_script_info::get_name_to_match): New function.
10897         (Version_script_info::get_symbol_version): New function.
10898         (Version_script_info::get_symbol_version_helper): Remove.
10899         (Version_script_info::check_unmatched_names): Call unquote.
10900         * script.h (class Version_script_info): Change get_symbol_version
10901         to be non-inline and add is_global parameter; change all callers.
10902         Rewrite symbol_is_local.  Update declarations.  Define struct
10903         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
10904         Remove globals_ and locals_ members.  Add exact_, globs_,
10905         default_version_, is_global_.
10906         (Version_script_info::Glob): Remove pattern, add expression and
10907         is_global.  Update constructor.  Change all callers.
10908         * dynobj.cc (Versions::finalize): Mark the version symbol as the
10909         default version.
10910         (Versions::symbol_section_contents): If a symbol is undefined, or
10911         defined in a dynamic object, set the version index to
10912         VER_NDX_LOCAL.
10913         * symtab.cc (Symbol_table::add_from_relobj): Don't call
10914         symbol_is_local.
10915         (Symbol_table::add_from_pluginobj): Likewise.
10916         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
10917
10918 2010-01-11  Doug Kwan  <dougkwan@google.com>
10919
10920         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
10921         (incremental_dump_LDADD): Add linking option for libintl.
10922         * Makefile.in: Regenerate.
10923
10924 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
10925
10926         PR gold/11144
10927         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
10928         instead of -Ds.
10929         * testsuite/Makefile.in: Regenerated.
10930
10931 2010-01-10  Doug Kwan  <dougkwan@google.com>
10932
10933         * options.h (DEFINE_var): Use parentheses around argument varname__
10934         in macro body to avoid any unintended subsequent substitutions.
10935
10936 2010-01-10  Ian Lance Taylor  <iant@google.com>
10937
10938         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
10939         candidates before doing symbol resolution.
10940
10941         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
10942         ODR candidates if only one is weak.
10943
10944 2010-01-08  Ian Lance Taylor  <iant@google.com>
10945
10946         * script.cc (Version_script_info::build_expression_list_lookup):
10947         Don't warn about ambiguous version, just record the ambiguity.
10948         (Version_script_info::get_symbol_version_helper): Give error if
10949         version is ambiguous.
10950
10951 2010-01-08  Doug Kwan  <dougkwan@google.com>
10952
10953         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
10954         prev_data_size_ and prev_addralign_.  Remove initializer for
10955         deleted data member has_been_changed_.
10956         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
10957         to determine if the table is empty.
10958         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
10959         Remove.
10960         (Stub_table::add_reloc_stub): Define method in class definition
10961         instead of just declaring it there.
10962         (Stub_table::add_cortex_a8_stub): New method definition.
10963         (Stub_table::update_data_size_and_addralign): Ditto.
10964         (Stub_table::finalize_stubs): Ditto.
10965         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
10966         (Stub_table::do_addralign_): Return address alignment in the
10967         (Stub_table::do_reset_address_and_file_offset): Define method in
10968         class definition instead of declaring it there.  Set current data
10969         size to be the data size of the previous pass.
10970         (Stub_table::set_final_data_size): Use current data size as the
10971         final data size.
10972         (Stub_table::relocate_stub): Change parameter type of stub from
10973         Reloc_stub pointer to Stub pointer.
10974         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10975         (Stub_table::Cortex_a8_stub_list): New typedef.
10976         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10977          Stub_table::prev_addralign_): New data member.
10978         (Arm_relobj::Arm_relobj): Initialize data member
10979         section_has_cortex_a8_workaround_.
10980         (Arm_relobj::section_has_cortex_a8_workaround,
10981          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
10982          definitions.
10983         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10984         declarations.
10985         (Target_arm::relocate_stub): Change parameter type of stub from
10986         Reloc_stub pointer to Stub pointer.
10987         (Insn_template::size, Insn_template::alignment): Handle
10988         THUMB16_SPECIAL_TYPE.
10989         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10990          Stub_table::update_data_size_and_addralign,
10991          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10992         definitions.
10993         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10994         (Stub_table::do_write): Ditto.
10995         (Target_arm::do_relax): Adjust code for changes in Stub_table.
10996
10997 2010-01-08  Ian Lance Taylor  <iant@google.com>
10998
10999         PR 11108
11000         * symtab.h (class Symbol): Remove fields is_target_special_ and
11001         has_plt_offset_.  Add field is_defined_in_discarded_section_.
11002         (Symbol::is_defined_in_discarded_section): New function.
11003         (Symbol::set_is_defined_in_discarded_section): New function.
11004         (Symbol::has_plt_offset): Rewrite.
11005         (Symbol::set_plt_offset): Verify that new offset is not -1U.
11006         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
11007         Don't initialize is_target_special_ or has_plt_offset_.
11008         Initialize is_defined_in_discarded_section_.
11009         (Symbol_table::add_from_relobj): If appropriate, set
11010         is_defined_in_discarded_section.
11011         * resolve.cc (Symbol::override_base_with_special): Don't test
11012         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
11013         * target-reloc.h (relocate_section): Do special handling for
11014         symbols defined in discarded sections for global symbols as well
11015         as local symbols.
11016
11017 2010-01-08  Ian Lance Taylor  <iant@google.com>
11018
11019         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
11020         the SHT_SYMTAB case.
11021
11022 2010-01-08  Ian Lance Taylor  <iant@google.com>
11023
11024         * object.cc (Sized_relobj::do_layout): Don't get confused if
11025         layout_eh_frame returns NULL.
11026
11027 2010-01-08  Ian Lance Taylor  <iant@google.com>
11028
11029         PR 11084
11030         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
11031         dynamic symbol table, use the normal symbol table.
11032         (Sized_dynobj::do_read_symbols): Remove assertion about type of
11033         symbol table.
11034
11035 2010-01-08  Ian Lance Taylor  <iant@google.com>
11036
11037         PR 11072
11038         * layout.cc (Layout::include_section): Remove .gnu_debuglink
11039         sections.
11040
11041 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
11042
11043         * version.cc (print_version): Change to "Copyright 2010".
11044
11045 2010-01-08  Ian Lance Taylor  <iant@google.com>
11046
11047         PR 10287
11048         PR 11063
11049         * i386.cc (class Target_i386): Change return type of plt_section
11050         to be non-const.
11051         (class Output_data_plt_i386): Add tls_desc_rel_ field.
11052         (Output_data_plt_i386::Output_data_plt_i386): Initialize
11053         tls_desc_rel_ field.
11054         (Output_data_plt_i386::rel_tls_desc): New function.
11055         (Target_i386::rel_tls_desc_section): New function.
11056         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
11057         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
11058         R_386_TLS_DESC reloc in rel_tls_desc_section.
11059         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
11060         Define struct Tlsdesc_info.
11061         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
11062         (Target_x86_64::do_reloc_symbol_index): New function.
11063         (Target_x86_64::add_tlsdesc_info): New function.
11064         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
11065         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
11066         tlsdesc_rel_ field.
11067         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
11068         all callers.
11069         (Output_data_plt_x86_64::rela_tlsdesc): New function.
11070         (Target_x86_64::rela_tlsdesc_section): New function.
11071         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
11072         handling.
11073         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
11074         (Target_x86_64::do_reloc_addend): New function.
11075         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
11076         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
11077         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
11078         (Output_reloc::type): New function.
11079         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
11080         (Output_reloc::is_target_specific): New function.
11081         (Output_reloc::target_arg): New function.
11082         (class Output_reloc) [SHT_RELA]: Add four new constructors for
11083         absolute relocs and target specific relocs.
11084         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
11085         add_target_specific.
11086         (class Output_data_reloc) [SHT_RELA]: Likewise.
11087         * output.cc (Output_reloc::Output_reloc): Add four new versions
11088         for absolute relocs and target specific relocs.
11089         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
11090         (Output_reloc::get_symbol_index): Likewise.
11091         (Output_reloc::local_section_offset): Check that local_sym_index_
11092         is not TARGET_CODE or 0.
11093         (Output_reloc::symbol_value): Likewise.
11094         (Output_reloc::write) [SHT_RELA]: Call target for target specific
11095         reloc.
11096         * target.h (class Target): Add reloc_symbol_index and reloc_addend
11097         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
11098         functions.
11099         * layout.cc (add_target_dynamic_tags): Use output section for
11100         DT_PLTRELSZ and DT_JMPREL.
11101
11102 2010-01-07  Ian Lance Taylor  <iant@google.com>
11103
11104         PR 11061
11105         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
11106         function.
11107         (class Output_data_reloc_generic): Define.
11108         (class Output_data_reloc_base): Change base class to
11109         Output_data_reloc_generic.  Change add() method to call
11110         bump_relative_reloc_count for a relative reloc.  Remove
11111         sort_relocs_ field.
11112         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
11113         to sort_relocs().
11114         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
11115         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
11116         appropriate.
11117         * layout.h (class Layout): Update declaration.
11118
11119 2010-01-07  Ian Lance Taylor  <iant@google.com>
11120
11121         * output.h (class Output_data): Add const version of
11122         output_section and do_output_section.
11123         (class Output_section_data): Add const version of
11124         do_output_section.
11125         (class Output_section): Likewise.
11126         * layout.cc (Layout::add_target_dynamic_tags): New function.
11127         * layout.h (class Layout): Update declarations.
11128         * arm.cc (Target_arm::do_finalize_sections): Use
11129         add_target_dynamic_tags.
11130         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11131         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11132         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11133         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11134
11135 2010-01-07  Ian Lance Taylor  <iant@google.com>
11136
11137         PR 11042
11138         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
11139         object as needed.
11140
11141 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
11142             Ian Lance Taylor  <iant@google.com>
11143
11144         PR 11019
11145         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
11146         Xindex::read_symtab_xindex.
11147
11148 2010-01-07  Doug Kwan  <dougkwan@google.com>
11149
11150         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
11151         (Insn_template::thumb16_bcond_insn): New method declaration.
11152         (Insn_template): Fix spelling.
11153         (Stub::thumb16_special): New method declaration.
11154         (Stub::do_write): Define virtual method which was previously pure
11155         virtual.
11156         (Stub::do_thumb16_special): New method declaration.
11157         (Stub::do_fixed_endian_write): New template member.
11158         (Reloc_stub::do_write): Remove.
11159         (Reloc_stub::do_fixed_endian_write): Remove.
11160         (Cortex_a8_stub): New class definition.
11161         (Stub_factory::make_cortex_a8_stub): New method definition.
11162         (Stub_factory::Stub_factory): Add missing static storage class
11163         qualifier for elf32_arm_stub_a8_veneer_blx.
11164
11165 2010-01-07  Ian Lance Taylor  <iant@google.com>
11166
11167         PR 10980
11168         * options.h (class General_options): Add --warn-unresolved-symbols
11169         and --error-unresolved-symbols.
11170         * errors.cc (Errors::undefined_symbol): Implement
11171         --warn-unresolved-symbols.
11172
11173         * options.h (class General_options): Add -z text and -z textoff.
11174         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
11175
11176 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
11177
11178         * gc.h (Garbage_collection::Cident_section_map): New typedef.
11179         (Garbage_collection::cident_sections): New function.
11180         (Garbage_collection::add_cident_section): New function.
11181         (Garbage_collection::cident_sections_): New member.
11182         (gc_process_relocs): Add references to sections whose names are C
11183         identifiers.
11184         * gold.h (cident_section_start_prefix): New constant.
11185         (cident_section_stop_prefix): New constant.
11186         (is_cident): New function.
11187         * layout.cc (Layout::define_section_symbols): Replace string constants
11188         with the newly defined constants.
11189         * object.cc (Sized_relobj::do_layout): Track sections whose names are
11190         C identifiers.
11191         * testsuite/Makefile.am: Add gc_orphan_section_test.
11192         * testsuite/Makefile.in: Regenerate.
11193         * testsuite/gc_orphan_section_test.cc: New file.
11194         * testsuite/gc_orphan_section_test.sh: New file.
11195
11196 2010-01-06  Ian Lance Taylor  <iant@google.com>
11197
11198         PR 10980
11199         * options.h (class General_options): Add --warn-shared-textrel.
11200         * layout.cc (Layout::finish_dynamic_section): Implement
11201         --warn-shared-textrel.
11202
11203         PR 10980
11204         * options.h (class General_options): Add --warn-multiple-gp.
11205
11206 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11207
11208         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
11209         $(THREADSLIB) and $(LIBDL).
11210         * Makefile.in: Rebuild.
11211
11212 2010-01-06  Ian Lance Taylor  <iant@google.com>
11213
11214         PR 10980
11215         * options.cc (General_options::parse_section_start): New function.
11216         (General_options::section_start): New function.
11217         (General_options::General_options): Initialize all members.
11218         * options.h: Include <map>
11219         (class General_options): Add --section-start.  Add section_starts_
11220         member.
11221         * layout.cc (Layout::attach_allocated_section_to_segment): If
11222         --section-start was used, set the address of the segment.  Remove
11223         local sort_sections.
11224         (Layout::relaxation_loop_body): If the address of the load segment
11225         has been set by --section-start, don't use it.
11226         * output.h (Output_segment::update_flags_for_output_section): New
11227         function.
11228         * output.cc (Output_segment::add_output_section): Call
11229         update_flags_for_output_section.
11230
11231 2010-01-05  Ian Lance Taylor  <iant@google.com>
11232
11233         PR 10980
11234         * options.h (class General_options): Add --undefined-version.
11235         * script.cc (struct Version_expression): Add was_matched_by_symbol
11236         field.
11237         (Version_script_info::matched_symbol): New function.
11238         (Version_script_info::get_symbol_version_helper): Call
11239         matched_symbol.
11240         (Version_script_info::check_unmatched_names): New function.
11241         * script.h (class Version_script_info): Update declarations.
11242         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
11243
11244         * options.h (class General_options): Use DEFINE_bool_alias for
11245         allow_multiple_definition.
11246         * resolve.cc (Symbol_table::should_override): Don't test
11247         allow_multiple_definition.
11248
11249         PR 10980
11250         * options.h (class General_options): Add --cref.
11251         * main.cc (main): Print cref table if --cref.  Don't close mapfile
11252         until after printing cref table.
11253         * cref.cc: Include "symtab.h".
11254         (class Cref_inputs): Define Cref_table_compare and Cref_table.
11255         (Cref_table_compare::operator()): New function.
11256         (Cref_inputs::gather_cref): New function.
11257         (filecol): New static const.
11258         (Cref_inputs::print_cref): New function.
11259         (Cref::print_cref): New function.
11260         * cref.h: Include <cstdio>.
11261         (class Cref): Update declarations.
11262         * mapfile.h (Mapfile::file): New function.
11263         * object.h (class Object): Define Symbols.  Declare virtual
11264         do_get_global_symbols.
11265         (Object::get_global_symbols): New function.
11266         * object.cc (Input_objects::add_object): Pass object to cref_ if
11267         --cref.
11268         (Input_objects::archive_start): Likewise.
11269         (Input_objects::archive_stop): Likewise.
11270         (Input_objects::print_cref): New function.
11271         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
11272         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
11273         --cref.
11274         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
11275         function.
11276         * plugin.h (class Sized_pluginobj): Update declarations.
11277
11278 2010-01-05  Ian Lance Taylor  <iant@google.com>
11279
11280         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
11281         to is_default_version.  Rename insdef to insdefault.
11282         (Symbol_table::add_from_relobj): Rename def to is_default_version
11283         and local to is_forced_local.
11284         (Symbol_table::add_from_pluginobj): Likewise.
11285         (Symbol_table::add_from_dynobj): Likewise.
11286         (Symbol_table::define_special_symbol): Rename insdef to
11287         insdefault.
11288
11289 2010-01-04  Ian Lance Taylor  <iant@google.com>
11290
11291         PR 10980
11292         * options.h (class General_options): Add
11293         --allow-multiple-definition and -z muldefs.
11294         * resolve.cc (Symbol_table::should_override): Don't warn about a
11295         multiple symbol definition if --allow-multiple-definition or -z
11296         muldefs.
11297
11298         PR 10980
11299         * options.h (class General_options): Add --add-needed and
11300         --copy-dt-needed-entries.  Tweak --as-needed help entry.
11301         * object.cc (Input_objects::check_dynamic_dependencies): Give an
11302         error if --copy-dt-needed-entries aka --add-needed is used and
11303         would cause a change in behaviour.
11304
11305         PR 10980
11306         * options.h (class General_options): Add -G as a short version of
11307         --shared.  Add no-op options -assert, -g, and -i.
11308
11309 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
11310
11311         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
11312         check for .text or .gnu.linkonce.t sections.
11313         * icf.cc (Icf::find_identical_sections): Ditto.
11314         Change the detection for mangled function name within the section
11315         name.
11316         * icf.h (is_section_foldable_candidate): New function.
11317
11318 2009-12-30  Ian Lance Taylor  <iant@google.com>
11319
11320         PR 10980
11321         * options.h (class General_options): Permit two dashes with
11322         --retain-symbols-file.
11323
11324 2009-12-30  Ian Lance Taylor  <iant@google.com>
11325
11326         PR 10979
11327         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
11328         don't put the file header and segment headers in the text
11329         segment.
11330
11331         PR 10979
11332         * common.cc (Sort_commons::operator()): Stabilize sort when both
11333         entries are NULL.
11334         (Symbol_table::do_allocate_commons_list): When allocating common
11335         symbols, skip a symbol which is no longer common.
11336         * symtab.h (Symbol::is_common): Test whether the symbol comes from
11337         an object before checking its type.
11338         * testsuite/common_test_2.c: New file.
11339         * testsuite/common_test_3.c: New file.
11340         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
11341         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
11342         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
11343         (common_test_2_pic.o, common_test_2.so): New targets.
11344         (common_test_3_pic.o, common_test_3.so): New targets.
11345         * testsuite/Makefile.in: Rebuild.
11346
11347         PR 10979
11348         * script.cc (read_input_script): If we see a new SECTIONS clause,
11349         and we have added an input section, give an error.
11350         * layout.h (class Layout): Add have_added_input_section function.
11351         Add have_added_input_section_ field.
11352         * layout.cc (Layout::Layout): Initialize
11353         have_added_input_section_.
11354         (Layout::layout): Set have_added_input_section_.
11355         (Layout::layout_eh_frame): Likewise.
11356
11357 2009-12-30  Ian Lance Taylor  <iant@google.com>
11358
11359         PR 10931
11360         * options.h (class General_options): Add --sort-common option.
11361         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
11362         * common.cc (Sort_common): Add sort_order parameter to
11363         constructor.  Add sort_order_ field.
11364         (Sort_commons::operator): Check sort_order_.
11365         (Symbol_table::allocate_commons): Determine the sort order.
11366         (Symbol_table::do_allocate_commons): Add sort_order parameter.
11367         Change all callers.
11368         (Symbol_table::do_allocate_commons_list): Likewise.
11369
11370 2009-12-30  Ian Lance Taylor  <iant@google.com>
11371
11372         PR 10916
11373         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
11374         symbols from this object, don't change the visibility of an
11375         undefined symbol.
11376         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
11377
11378 2009-12-30  Ian Lance Taylor  <iant@google.com>
11379
11380         PR 10861
11381         * script.h (class Version_script_info): Define Language enum.
11382         Update declarations.  Define Glob, Exact, and Lookup types.  Add
11383         new fields globals_, locals_, and is_finalized_.
11384         * script.cc: Various formatting fixes.
11385         (class Parser_closure): Change language_stack_ from a vector of
11386         std::string to one of Version_script_info::Language.  Adjust all
11387         uses accordingly.
11388         (class Lazy_demangler): Remove.
11389         (struct Version_expression): Change language from std::string to
11390         Version_script_info::Language.
11391         (Version_script_info::Version_script_info): New function.
11392         (Version_script_info::~Version_script_info): Don't call clear.
11393         (Version_script_info::finalize): New function.
11394         (Version_script_info::build_lookup_tables): New function.
11395         (Version_script_info::build_expression_list_lookup): New
11396         function.
11397         (Version_script_info::get_symbol_version_helper): Rewrite to use
11398         lookup tables.
11399         (Version_script_info::print_expression_list): Adjust to use
11400         Version_script_info::Language.
11401         (script_push_lex_into_version_mode): Check that the version script
11402         has not been finalized.
11403         (version_script_push_lang): Change language string to
11404         Version_script_info::Language.
11405         * options.cc (Command_line::version_script): New function.
11406         * options.h (class General_options): Add finalize_dynamic_list
11407         function.  Change version_script from declaration to definition.
11408         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
11409         * testsuite/version_script.map: Remove duplicate def of foo.
11410         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
11411         version_script.map.
11412         * testsuite/Makefile.in: Rebuild.
11413
11414 2009-12-30  Ian Lance Taylor  <iant@google.com>
11415
11416         PR 10843
11417         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
11418         if the input symbol index is 0, make the output symbol index 0.
11419
11420 2009-12-30  Ian Lance Taylor  <iant@google.com>
11421
11422         PR 10670
11423         * options.h (class General_options): Add -x/--discard-all.
11424         * object.cc (Sized_relobj::do_count_local_symbols): Handle
11425         --discard-all.  If the local symbol needs a dynamic entry, check
11426         that before handling --discard-locals.
11427
11428 2009-12-30  Ian Lance Taylor  <iant@google.com>
11429
11430         PR 10450
11431         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
11432         flags to PF_R.
11433         (Output_segment::add_output_section): Don't change the flags if
11434         the type is PT_TLS.
11435
11436         PR 10450
11437         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
11438         GNU hash table if they need a dynamic value.  Otherwise, don't add
11439         them if they are defined in a dynamic object or are forced local.
11440
11441 2009-12-29  Ian Lance Taylor  <iant@google.com>
11442
11443         PR 10450
11444         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
11445         .gnu.hash table for a 32-bit target.
11446
11447         PR 10450
11448         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
11449         regular and a dynamic object only needs a dynamic symbol table
11450         entry if it is externally visible.
11451
11452         PR 10450
11453         * i386.cc (class Target_i386): Initialize global_offset_table_ in
11454         constructor.  Add global_offset_table_ field.
11455         (Target_i386::got_section): Set global_offset_table_.
11456         (Target_i386::do_finalize_sections): Set global_offset_table_
11457         size.
11458         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
11459         in constructor.  Add global_offset_table_ field.
11460         (Target_x86_64::got_section): Set global_offset_table_.
11461         (Target_x86_64::do_finalize_sections): Set global_offset_table_
11462         size.
11463
11464         * layout.cc (Layout::Layout): Initialize increase_relro_.
11465         (Layout::get_output_section): Add is_relro, is_last_relro, and
11466         is_first_non_relro parameters.  Change all callers.
11467         (Layout::choose_output_section): Likewise.
11468         (Layout::add_output_section_data): Likewise.
11469         (Layout::make_output_section): Likewise.
11470         (Layout::set_segment_offsets): Clear increase_relro when using a
11471         linker script.
11472         * layout.h (class Layout): Add increase_relro method.  Add
11473         increase_relro_ field.  Update declarations.
11474         * output.cc (Output_section::Output_section): Initialize
11475         is_last_relro_ and is_first_non_relro_.
11476         (Output_segment::add_output_section): Group relro sections is
11477         do_sort is true.  Handle is_last_relro and is_first_non_relro.
11478         (Output_segment::maximum_alignment): Remove relro handling.
11479         (Output_segment::set_section_addresses): Add increase_relro
11480         parameter.  Change all callers.  Add initial alignment to align
11481         relro sections on separate page.  Remove old relro handling.
11482         (Output_segment::set_section_list_addresses): Remove in_relro
11483         parameter.  Change all callers.
11484         (Output_segment::set_offset): Add increase parameter.  Change all
11485         callers.  Remove old relro handling.
11486         * output.h (class Output_section): Add new methods: is_last_relro,
11487         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
11488         Add is_last_relro_ and is_first_non_relro_ fields.
11489         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
11490         Create separate .got.plt section.  Call increase_relro.
11491         * x86_64.cc (Target_x86_64::got_section): Likewise.
11492         * testsuite/relro_script_test.t: Add .got.plt.
11493
11494         PR 10450
11495         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
11496         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
11497         (Layout::finalize): Call set_dynamic_symbol_size.
11498         (Layout::set_dynamic_symbol_size): New function.
11499         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
11500         set_dynamic_symbol_size.
11501
11502         PR 10450
11503         * output.h (class Output_section): Add is_entsize_zero_ field.
11504         * output.cc (Output_section::Output_section): Initialize
11505         is_entsize_zero_.
11506         (Output_section::set_entsize): If two different entsizes are
11507         requested, force it to zero.
11508         (Output_section::add_input_section): Set flags for .debug_str
11509         before updating section flags.  Set entsize.
11510         (Output_section::update_flags_for_input_section): Set SHF_MERGE
11511         and SHF_STRING if all input sections have those flags.
11512
11513 2009-12-29   Rafael Espindola  <espindola@google.com>
11514
11515         * main.cc (main): Fix the sys time reporting.
11516         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
11517         reporting.
11518
11519 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
11520
11521         * options.cc (General_options::parse_version): Allow -v to exit
11522         without an error if there is nothing to link.
11523
11524 2009-12-29  Ian Lance Taylor  <iant@google.com>
11525
11526         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
11527         using a version of gcc before 4.1.
11528         * configure: Rebuild.
11529
11530 2009-12-28  Chris Demetriou  <cgd@google.com>
11531
11532         * attributes.cc (Output_attributes_section_data::do_write): Use
11533         std::vector::front rather than std::vector::data.
11534
11535 2009-12-28  Ian Lance Taylor  <iant@google.com>
11536
11537         * symtab.h (class Symbol_table): Add enum Defined.
11538         * resolve.cc (Symbol_table::should_override): Add defined
11539         parameter.  Change all callers.  Test whether object is NULL
11540         before calling a method on it.
11541         (Symbol_table::report_resolve_problem): Add defined parameter.
11542         Change all callers.
11543         (Symbol_table::should_override_with_special): Likewise.
11544         * symtab.cc (Symbol_table::define_in_output_data): Add defined
11545         parameter.  Change all callers.
11546         (Symbol_table::do_define_in_output_data): Likewise.
11547         (Symbol_table::define_in_output_segment): Likewise.
11548         (Symbol_table::do_define_in_output_segment): Likewise.
11549         (Symbol_table::define_as_constant): Likewise.
11550         (Symbol_table::do_define_as_constant): Likewise.
11551         * script.h (class Symbol_assignment): Add is_defsym parameter to
11552         constructor; change all callers.
11553         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
11554         parameter.  Change all callers.  Add is_defsym_ field.
11555         (class Parser_closure): Add parsing_defsym parameter to
11556         constructor; change all callers.  Add parsing_defsym accessor
11557         function.  Add parsing_defsym_ field.
11558
11559 2009-12-28  Ian Lance Taylor  <iant@google.com>
11560
11561         * gold.cc (queue_middle_tasks): Fix formatting.
11562         * object.cc (Relobj::is_section_name_included): Likewise.
11563
11564 2009-12-23  Ian Lance Taylor  <iant@google.com>
11565
11566         * i386.cc (Target_i386::do_calls_non_split): Recognize
11567         -fsplit-stack prologue for a function with a static chain.
11568         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
11569         -fsplit-stack prologue when using %r11.
11570
11571 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
11572
11573         * options.cc (General_options::parse_version): Make -v continue and do
11574         the link like GNU ld does.
11575
11576 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
11577
11578         * Makefile.am (CCFILES): Add timer.cc.
11579         (HFILES): Add timer.h.
11580         * configure.ac: Check for sysconf and times.
11581         * main.cc: include timer.h.
11582         (main): Use Timer instead of get_run_time.
11583         * timer.cc: New.
11584         * timer.h: New.
11585         * workqueue.cc: include timer.h.
11586         (Workqueue::find_and_run_task):
11587         Report user, sys and wall time.
11588         * Makefile.in: Regenerate.
11589         * config.in: Regenerate.
11590         * configure: Regenerate.
11591
11592 2009-12-16  Doug Kwan  <dougkwan@google.com>
11593
11594         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
11595         sections.
11596         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
11597         relaxed input sections.
11598         * output.cc (Output_section::find_relaxed_input_section): Change
11599         return type to Output_relaxed_input_section pointer.  Adjust code
11600         for new type of relaxed_input_section_map_.
11601         * output.h (Output_section::find_relaxed_input_section): Change
11602         return type to Output_relaxed_input_section pointer.
11603         (Output_section::Output_relaxed_input_section_by_input_section_map):
11604         New type.
11605         (Output_section::relaxed_input_section_map_): Change type to
11606         Output_section::Output_relaxed_input_section_by_input_section_map.
11607         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
11608         input section.
11609
11610 2009-12-15  Ian Lance Taylor  <iant@google.com>
11611
11612         * layout.cc (Layout::create_shstrtab): Only write out after input
11613         sections if we are compressing debug sections.
11614
11615 2009-12-15  Ian Lance Taylor  <iant@google.com>
11616
11617         * archive.cc (Archive::add_symbols): Only look up a symbol without
11618         a version if there is, in fact, a version.
11619
11620 2009-12-14  Ian Lance Taylor  <iant@google.com>
11621
11622         Revert -Wshadow changes, all changes from:
11623         2009-12-11  Doug Kwan  <dougkwan@google.com>
11624         2009-12-11  Nick Clifton  <nickc@redhat.com>
11625         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
11626
11627 2009-12-11  Doug Kwan  <dougkwan@google.com>
11628
11629         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
11630         due to -Wshadow.
11631         * attributes.cc (Object_attribute::size): Ditto.
11632         (Attributes_section_data::size): Ditto.
11633         (Attributes_section_data::Attributes_section_data): Ditto.
11634         (Output_attributes_section_data::do_write): Ditto.
11635         * attributes.h (Object_attribute::set_type): Ditto.
11636         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
11637
11638 2009-12-11  Nick Clifton  <nickc@redhat.com>
11639
11640         * archive.cc: Fix shadowed variable warnings.
11641         * arm.cc: Likewise.
11642         * compressed_output.cc: Likewise.
11643         * compressed_output.h: Likewise.
11644         * configure: Likewise.
11645         * dwarf_reader.cc: Likewise.
11646         * dynobj.cc: Likewise.
11647         * dynobj.h: Likewise.
11648         * ehframe.cc: Likewise.
11649         * ehframe.h: Likewise.
11650         * errors.cc: Likewise.
11651         * expression.cc: Likewise.
11652         * fileread.cc: Likewise.
11653         * fileread.h: Likewise.
11654         * freebsd.h: Likewise.
11655         * i386.cc: Likewise.
11656         * icf.cc: Likewise.
11657         * incremental.h: Likewise.
11658         * layout.cc: Likewise.
11659         * layout.h: Likewise.
11660         * mapfile.cc: Likewise.
11661         * merge.cc: Likewise.
11662         * merge.h: Likewise.
11663         * object.cc: Likewise.
11664         * object.h: Likewise.
11665         * options.h: Likewise.
11666         * output.cc: Likewise.
11667         * output.h: Likewise.
11668         * parameters.cc: Likewise.
11669         * plugin.cc: Likewise.
11670         * powerpc.cc: Likewise.
11671         * reduced_debug_output.cc: Likewise.
11672         * reduced_debug_output.h: Likewise.
11673         * reloc.cc: Likewise.
11674         * reloc.h: Likewise.
11675         * resolve.cc: Likewise.
11676         * script-sections.cc: Likewise.
11677         * script.cc: Likewise.
11678         * script.h: Likewise.
11679         * sparc.cc: Likewise.
11680         * symtab.cc: Likewise.
11681         * symtab.h: Likewise.
11682         * target-select.cc: Likewise.
11683         * target-select.h: Likewise.
11684         * token.h: Likewise.
11685         * workqueue.cc: Likewise.
11686         * workqueue.h: Likewise.
11687         * x86_64.cc: Likewise.
11688
11689 2009-12-10  Doug Kwan  <dougkwan@google.com>
11690
11691         * arm.cc (attributes.h): New include.
11692         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
11693         (Arm_relobj::~Arm_relobj): Delete object pointed by
11694         attributes_section_data_.
11695         (Arm_relobj::attributes_section_data): New method definition.
11696         (Arm_relobj::attributes_section_data_): New data member declaration.
11697         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
11698         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
11699         attributes_section_data_.
11700         (Arm_dynobj::attributes_section_data): New method definition.
11701         (Arm_dynobj::attributes_section_data_): New data member declaration.
11702         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
11703         initialization value of may_use_blx_ to false.
11704         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
11705         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
11706         object attributes to compute results instead of hard-coding.
11707         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
11708         Target_arm::get_secondary_compatible_arch,
11709         Target_arm::set_secondary_compatible_arch
11710         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11711         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
11712         New method declarations.
11713         (Target_arm::get_aeabi_object_attribute): New method definition.
11714         (Target_arm::attributes_section_data_): New data member declaration.
11715         (read_arm_attributes_section): New template definition.
11716         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
11717         (Arm_dynobj::do_read_symbols): Ditto.
11718         (Target_arm::do_finalize_sections): Merge attributes sections from
11719         input.  Check for BLX use after attributes section merging.
11720         Fix __exidx_start and __exidx_end visibility.  Create an
11721         .ARM.attributes section if necessary.
11722         (Target_arm::get_secondary_compatible_arch,
11723         Target_arm::set_secondary_compatible_arch,
11724         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11725         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
11726         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
11727         New method definitions.
11728
11729 2009-12-09  Ian Lance Taylor  <iant@google.com>
11730
11731         * plugin.cc (Plugin::load): Don't cast from void* to a function
11732         pointer.
11733
11734 2009-12-09  Ian Lance Taylor  <iant@google.com>
11735
11736         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
11737         information fields.
11738
11739 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
11740
11741         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
11742         Replace two_file_shared_1.so with two_file_shared_2.so.
11743         * testsuite/Makefile.in: Regenerated.
11744
11745 2009-12-08  Doug Kwan  <dougkwan@google.com>
11746
11747         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
11748         (HFILES): Add attributes.h and int_encoding.h.
11749         * Makefile.in: Regenerate.
11750         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
11751         function definitions to int_encoding.cc
11752         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
11753         prototypes to int_encoding.h
11754         * reduced_debug_output.cc (int_encoding.h): New include.
11755         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
11756         function definitions to int_encoding.cc
11757         (insert_into_vector, read_from_pointer): Move template definitions to
11758         int_encoding.h
11759         * attributes.cc: New file.
11760         * attributes.h: New file.
11761         * int_encoding.cc: New file.
11762         * int_encoding.h: New file.
11763
11764 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
11765
11766         PR gold/11055
11767         * incremental-dump.cc (dump_incremental_inputs): New.
11768         (main): Use dump_incremental_inputs.
11769
11770 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
11771
11772         PR gold/10893
11773         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
11774         checking elfcpp::STT_FUNC.
11775         (Target_i386::Relocate::relocate): Likewise.
11776         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
11777
11778         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
11779         symbols from shared libraries into normal FUNC symbols.
11780
11781         * symtab.h (Symbol): Add is_func and use it.
11782
11783 2009-12-05  Doug Kwan  <dougkwan@google.com>
11784
11785         * arm.cc (Target_arm::arm_info): Initialize new fields
11786         attributes_section and attributes_vendor.
11787         * i386.cc (Target_i386::i386_info): Same.
11788         * object.cc (Sized_relobj::do_layout): Skip attribute section.
11789         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
11790         fields attributes_section and attributes_vendor.
11791         * sparc.cc (Target_sparc::sparc_info): Same.
11792         * target.h (Target::attributes_section, Target::attributes_vendor,
11793         Target::is_attributes_section, Target::attribute_arg_type,
11794         Target::attributes_order): New method definitions.
11795         (Target::Target_info::attributes_section,
11796         Target::Target_info::attributes_vendor): New fields.
11797         (Target::do_attribute_arg_type, Target::do_attributes_order): New
11798         virtual method definitions.
11799         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
11800         attributes_section and attributes_vendor.
11801         * testsuite/testfile.cc (Target_test::test_target_info): Same.
11802
11803 2009-12-05  Doug Kwan  <dougkwan@google.com>
11804
11805         * arm.cc: Update comments about interworking and stub generation.
11806         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
11807         considered as non-PIC.
11808         (Arm_relocate_functions::base_abs): Fix formatting.
11809         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
11810         of function to use GOT entry address instead of offset.
11811         (Target_arm::Scan::global): Issue an error if a symbol would need a
11812         PLT does not get one because it is untyped.  Remove code to create
11813         dynamic symbols for relative branches.
11814         (Target_arm::Relocate::relocate: Use 0 instead of false since function
11815         takes unsigned integer instead of boolean.
11816
11817 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
11818
11819         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
11820         (two_file_test_LDADD): Likewise.
11821         (common_test_1_LDADD): Likewise.
11822         (exception_test_LDADD) Likewise.
11823         (weak_test_LDADD): Likewise.
11824         (many_sections_test_LDADD): Likewise.
11825         (initpri1_LDADD): Likewise.
11826         (script_test_1_LDADD): Likewise.
11827         (script_test_2_LDADD): Likewise.
11828         (justsyms_LDADD): Likewise.
11829         (binary_test_LDADD): Likewise.
11830         (large_LDADD): Likewise.
11831         * testsuite/Makefile.in: Regenerated.
11832
11833 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
11834
11835         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
11836         (Symbol_table::override_with_special): Likewise.
11837         (Symbol_table::add_from_object): Likewise.
11838
11839 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
11840
11841         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11842         Don't set the data_offset twice.
11843
11844 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
11845
11846         * testsuite/Makefile.in: Regenerate.
11847
11848 2009-12-03  Doug Kwan  <dougkwan@google.com>
11849
11850         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
11851         (Target_arm::do_finalize_sections): Add parameter for symbol table
11852         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
11853         * i386.cc (Target_i386::do_finalize_sections): Add an additional
11854         parameter for symbol table pointer.
11855         * layout.cc (Layout::finalize): Call Target::finalize_sections with
11856         an additional parameter for a pointer to symbol table.
11857         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
11858         parameter for a symbol table pointer.
11859         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
11860         * target.h (Target::finalize_sections, Target::do_finalize_sections):
11861         Ditto.
11862         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
11863         parameter for a symbol table pointer.
11864
11865 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
11866
11867         * incremental.cc (Incremental_inputs_header)
11868         (Incremental_inputs_header_write, Incremental_inputs_entry)
11869         (Incremental_inputs_entry_write): Move ...
11870         * incremental.h (Incremental_inputs_header)
11871         (Incremental_inputs_header_write, Incremental_inputs_entry)
11872         (Incremental_inputs_entry_write): here.
11873
11874 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11875
11876         * incremental.cc (make_sized_incremental_binary): Set the target.
11877         Error if it is incompatible.
11878         * output.h (Output_file): Add filename method.
11879
11880 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11881
11882         * incremental.cc (Incremental_inputs_entry): Remove unused argument
11883         from the get_* methods.
11884
11885 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11886
11887         * incremental-dump.cc (main): Check that the offeset of a script is 0.
11888         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11889         Write 0 for the data_offset of scripts.
11890
11891 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11892
11893         * testsuite/Makefile.am: Add the incremental_test.sh test.
11894         * testsuite/incremental_test.sh: New.
11895         * testsuite/incremental_test_1.c: New.
11896         * testsuite/incremental_test_2.c: New.
11897
11898 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
11899
11900         * incremental-dump.cc (main): Fix typos.
11901
11902 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
11903
11904         PR gold/11025
11905         * incremental-dump.cc (main): Use llu to print 64 bit values.
11906
11907 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
11908             H.J. Lu  <hongjiu.lu@intel.com>
11909
11910         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
11911         $(LIBDL).
11912         (incremental_dump_LDADD): Likewise.
11913         * Makefile.in: Regenerated.
11914
11915 2009-11-25  Doug Kwan  <dougkwan@google.com>
11916
11917         Revert:
11918
11919         2009-11-25  Doug Kwan  <dougkwan@google.com>
11920
11921                 * arm.cc (Target_arm::Target_arm): Move method definition
11922                 outside of class definition.  Add code to handle
11923                 --target1-rel, --target1-abs and --target2= options.
11924                 (Target_arm::get_reloc_reloc_type): Change method to be
11925                 non-static and const.
11926                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
11927                 New data member declaration.
11928                 (Target_arm::Scan::local, Target_arm::Scan::global,
11929                 Target_arm::Relocate::relocate,
11930                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11931                 Adjust call to Target_arm::get_real_reloc_type.
11932                 (Target_arm::get_real_reloc_type): Use command line options
11933                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11934                 * options.h (--target1-rel, --target1-abs, --target2): New
11935                 ARM-only options.
11936
11937 2009-11-25  Doug Kwan  <dougkwan@google.com>
11938
11939         * arm.cc (Target_arm::Target_arm): Move method definition outside of
11940         class definition.  Add code to handle --target1-rel, --target1-abs
11941         and --target2= options.
11942         (Target_arm::get_reloc_reloc_type): Change method to be non-static
11943         and const.
11944         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
11945         member declaration.
11946         (Target_arm::Scan::local, Target_arm::Scan::global,
11947         Target_arm::Relocate::relocate,
11948         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
11949         call to Target_arm::get_real_reloc_type.
11950         (Target_arm::get_real_reloc_type): Use command line options to
11951         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11952         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
11953         options.
11954
11955 2009-11-25  Doug Kwan  <dougkwan@google.com>
11956
11957         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
11958         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
11959         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
11960         formatting.
11961         (Arm_relocate_functions::thm_call): Replace body with a call to
11962         Arm_relocate_functions::thumb_branch_common.
11963         (Arm_relocate_functions::thm_jump24,
11964         Arm_relocate_functions::thm_xpc22): New method definitions.
11965         (Arm_relocate_functions::thumb_branch_common): New method definition.
11966         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
11967         operator.
11968         (Target_arm::Relocate::relocate): Adjust call to thm_call.
11969         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
11970
11971 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11972
11973         * Makefile.am: Build incremental-dump
11974         * Makefile.in: Regenerate.
11975         * incremental-dump.cc: New.
11976         * incremental.cc (Incremental_inputs_header_data,
11977         Incremental_inputs_entry_data): Move to incremental.h
11978         * incremental.h: (Incremental_inputs_header_data,
11979         Incremental_inputs_entry_data): Move from incremental.cc
11980
11981 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11982
11983         * incremental.cc (Incremental_inputs_header,
11984         Incremental_inputs_header_write, Incremental_inputs_entry,
11985         Incremental_inputs_entry_write): Add a typedef with the data type.
11986
11987 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11988
11989         * incremental.cc (Incremental_inputs_header,
11990         Incremental_inputs_header_write, Incremental_inputs_entry,
11991         Incremental_inputs_entry_write): Update comment about which
11992         type has the filed descriptions.
11993
11994 2009-11-15  Doug Kwan  <dougkwan@google.com>
11995
11996         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11997         (Arm_relocate_functions::arm_branch_common): Change method defintion
11998         in class definition to a method declaration and update list of formal
11999         parameters.
12000         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
12001         Arm_relocation_functions::jump24): Adjust call to
12002         Arm_relocate_functions::arm_branch_common.  Update list of formal
12003         parameters.
12004         (Arm_relocate_functions::xpc25): New method definition.
12005         (Arm_relocate_functions::arm_branch_common): Move method defintion
12006         out from class definition.  Use stubs for mode-switching and extending
12007         branch ranges.
12008         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
12009         specially.  Change code to enable use of stubs in ARM branches.
12010
12011 2009-11-10  Doug Kwan  <dougkwan@google.com>
12012
12013         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
12014         in method declaration.
12015         (Target_arm::relocate_stub): New method declaration.
12016         (Target_arm::default_target): Change to return a pointer instead of
12017         a const reference.
12018         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
12019         Target_arm::default_target.
12020         (Arm_Relobj::do_relocate_sections): Remove options paramater in
12021         method definition.
12022         (Target_arm::relocate_section): Adjust view.
12023         (Target_arm::relocate_stub): New method definition.
12024
12025 2009-11-10  Doug Kwan  <dougkwan@google.com>
12026
12027         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
12028         a format warning.
12029         * incremental.cc (open_incremental_binary): Initialized local
12030         variables to avoid warnings.
12031         * object.cc (make_elf_object): Ditto.
12032         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
12033         a format warning.
12034
12035 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
12036
12037         PR gold/10930
12038         * testsuite/plugin_test.c: Include "config.h".
12039
12040 2009-11-09  Doug Kwan  <dougkwan@google.com>
12041
12042         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
12043         (arm_symbol_value): Remove.
12044         (Arm_relocate_functions::arm_branch_common,
12045         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
12046         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
12047         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
12048         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
12049         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
12050         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
12051         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
12052         Arm_relocate_functions::thm_mobw_abs_nc,
12053         Arm_relocate_functions::thm_mov_abs,
12054         Arm_relocate_functions::movw_prel_nc,
12055         Arm_relocate_functions::thm_movt_abs,
12056         Arm_relocate_functions::movt_prel,
12057         Arm_relocate_functions::thm_movw_prel_nc,
12058         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
12059         (Target_arm::Relocate::relocate): Only decompose address into two
12060         parts if relocation type uses the thumb-bit and pass the actual
12061         bit instead of a flag indicating that the thumb-bit is used.  Adjust
12062         calls to methods in Arm_relocate_functions for this change.
12063
12064 2009-11-08  Ian Lance Taylor  <iant@google.com>
12065
12066         PR 10925
12067         * reloc.cc: Instantiate
12068         Sized_relobj::initialize_input_to_output_maps and
12069         Sized_relobj:free_input_to_output_maps.
12070
12071 2009-11-06  Ian Lance Taylor  <iant@google.com>
12072
12073         PR 10876
12074         * defstd.cc (in_segment): Set only_if_ref true for "end".
12075
12076 2009-11-06  Doug Kwan  <dougkwan@google.com>
12077
12078         * arm.cc (class Reloc_stub): Correct a comment.
12079         (Target_arm::Target_arm): Initialize arm_input_section_map_.
12080         (Target_arm::scan_section_for_stubs): New method declaration.
12081         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
12082         Change methods from private to protected.
12083         (Target_arm::do_may_relax): New method definition.
12084         (Target_arm::do_relax, Target_arm::group_sections,
12085         Target_arm::scan_reloc_for_stub,
12086         Target_arm::scan_reloc_section_for_stubs): New method declarations.
12087         (Target_arm::arm_input_section_map_): New data member declaration.
12088         (Target_arm::scan_reloc_for_stub,
12089         Target_arm::scan_reloc_section_for_stubs,
12090         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
12091         Target_arm::do_relax): New method definitions.
12092
12093 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
12094
12095         * configure.ac: Check for (struct stat)::st_mtim
12096         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
12097         * config.in: Regenerate.
12098         * configure: Regenerate.
12099
12100 2009-11-05  Ian Lance Taylor  <iant@google.com>
12101
12102         PR 10910
12103         * output.cc (Output_segment::add_output_section): Add missing
12104         return statement.
12105
12106 2009-11-04  Ian Lance Taylor  <iant@google.com>
12107
12108         PR 10880
12109         * object.h (class Object): Add is_needed and set_is_needed
12110         methods.  Add is_needed_ field.  Make bool fields into bitfields.
12111         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
12112         defined in a dynamic object and referenced by a regular object,
12113         set is_needed for the dynamic object.
12114         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
12115         if the file is marked with as_needed and it is not needed.
12116
12117 2009-11-04  Ian Lance Taylor  <iant@google.com>
12118
12119         PR 10887
12120         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
12121         tags if data is discarded by linker script.
12122         * i386.cc (Target_i386::do_finalize_sections): Likewise.
12123         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
12124         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
12125         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
12126
12127 2009-11-04  Ian Lance Taylor  <iant@google.com>
12128
12129         * layout.cc (Layout::get_output_section): Add is_interp and
12130         is_dynamic_linker_section parameters.  Change all callers.
12131         (Layout::choose_output_section): Likewise.
12132         (Layout::make_output_section): Likewise.
12133         (Layout::add_output_section_data): Add is_dynamic_linker_section
12134         parameter.  Change all callers.
12135         * layout.h (class Layout): Update declarations.
12136         * output.h (class Output_section): Add is_interp, set_is_interp,
12137         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
12138         Add is_interp_, is_dynamic_linker_section_ fields.  Change
12139         generate_code_fills_at_write_ to a bitfield.
12140         * output.cc (Output_section::Output_sections): Initialize new
12141         fields.
12142         (Output_segment::add_output_section): Add do_sort parameter.
12143         Change all callers.
12144
12145 2009-11-03  Ian Lance Taylor  <iant@google.com>
12146
12147         PR 10860
12148         * options.h (class General_options): Add --warn-common.
12149         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
12150         merging two common symbols.
12151         (Symbol_table::should_override): Handle --warn-common when merging
12152         a common symbol with a defined symbol.  Use report_resolve_problem
12153         for multiple definitions.
12154         (Symbol_table::report_resolve_problem): New function.
12155         * symtab.h (class Symbol_table): Declare report_resolve_problem.
12156
12157 2009-11-03  Doug Kwan  <dougkwan@google.com>
12158
12159         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
12160         stub_factory_.
12161         (Target_arm::stub_factory): New method definition.
12162         (Target_arm::new_arm_input_section,
12163         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
12164         Target_arm::reloc_uses_thumb_bit): New method declarations.
12165         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
12166         New type definitions.
12167         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
12168         member declarations.
12169         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
12170         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
12171         New method definitions.
12172
12173 2009-11-03  Ian Lance Taylor  <iant@google.com>
12174
12175         * options.h (class General_options): Add --warn_constructors.
12176
12177 2009-11-03  Ian Lance Taylor  <iant@google.com>
12178
12179         PR 10893
12180         * defstd.cc (in_section): Add entries for __rel_iplt_start,
12181         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
12182
12183 2009-11-03  Ian Lance Taylor  <iant@google.com>
12184
12185         PR 10895
12186         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
12187         --msgid-bugs-address.
12188         (install-pdf): New target.
12189         (install-data_yes): Look up one directory to find mkinstalldirs.
12190
12191 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
12192
12193         * po/Make-in (.po.gmo): Don't generate .gmo files in source
12194         tree.
12195
12196 2009-10-30  Doug Kwan  <dougkwan@google.com>
12197
12198         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
12199
12200 2009-10-30  Doug Kwan  <dougkwan@google.com>
12201
12202         * arm.cc (Stub_addend_reader): New struct template definition
12203         and partial specializations.
12204         (Stub_addend_reader::operator()): New method definition for a
12205         partially specialized template.
12206
12207 2009-10-30  Doug Kwan  <dougkwan@google.com>
12208
12209         * arm.cc (Arm_relobj::processor_specific_flags): New method
12210         definition.
12211         (Arm_relobj::do_read_symbols): New method declaration.
12212         (Arm_relobj::processor_specific_flags_): New data member declaration.
12213         (Arm_dynobj): New class definition.
12214         (Target_arm::do_finalize_sections): Add input_objects parameter.
12215         (Target_arm::do_adjust_elf_header): New method declaration.
12216         (Target_arm::are_eabi_versions_compatible,
12217         (Target_arm::merge_processor_specific_flags): New method declaration.
12218         (Target_arm::do_make_elf_object): New overloaded method definitions
12219         and declaration.
12220         (Arm_relobj::do_read_symbols): New method definition.
12221         (Arm_dynobj::do_read_symbols): Ditto.
12222         (Target_arm::do_finalize_sections): Add input_objects parameters.
12223         Merge processor-specific flags from all input objects.
12224         (Target_arm::are_eabi_versions_compatible,
12225         Target_arm::merge_processor_specific_flags,
12226         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
12227         New method definitions.
12228         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
12229         Input_objects pointer type parameter.
12230         * layout.cc (Layout::finalize): Pass input objects to target's.
12231         finalize_sections function.
12232         * output.cc (Output_file_header::do_sized_write): Set ELF file
12233         header's processor-specific flags.
12234         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
12235         Input_objects pointer type parameter.
12236         * sparc.cc (Target_sparc::do_finalize_sections): Same.
12237         * target.h (Input_objects): New forward class declaration.
12238         (Target::processor_specific_flags,
12239         Target::are_processor_specific_flags_sect): New method definitions.
12240         (Target::finalize_sections): Add input_objects parameter.
12241         (Target::Target): Initialize processor_specific_flags_ and
12242         are_processor_specific_flags_set_.
12243         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
12244         parameter.
12245         (Target::set_processor_specific_flags): New method definition.
12246         (Target::processor_specific_flags_,
12247         Target::are_processor_specific_flags_set_): New data member
12248         declarations.
12249         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
12250         Input_objects pointer type parameter.
12251
12252 2009-10-30  Doug Kwan  <dougkwan@google.com>
12253
12254         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
12255
12256 2009-10-28  Ian Lance Taylor  <iant@google.com>
12257
12258         * object.h (class Relobj): Drop options parameter from
12259         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
12260         do_scan_relocs, do_relocate.  Change all callers.
12261         (class Sized_relobj): Drop options parameters from
12262         do_gc_process_relocs, do_scan_relocs, do_relocate,
12263         do_relocate_sections, relocate_sections, emit_relocs_scan,
12264         emit_relocs_scan_reltype.  Change all callers.
12265         (struct Relocate_info): Remove options field and all references to
12266         it.
12267         * reloc.h (class Read_relocs): Remove options constructor
12268         parameter and options_ field.  Change all callers.
12269         (class Gc_process_relocs, class Scan_relocs): Likewise.
12270         (class Relocate_task): Likewise.
12271         * target-reloc.h (scan_relocs): Remove options parameter.  Change
12272         all callers.
12273         (scan_relocatable_relocs): Likewise.
12274         * target.h (class Sized_target): Remove options parameter from
12275         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
12276         all callers.
12277         * gc.h (gc_process_relocs): Remove options parameter.  Change all
12278         callers.
12279         * arm.cc: Update functions to remove options parameters.
12280         * i386.cc: Likewise.
12281         * powerpc.cc: Likewise.
12282         * sparc.cc: Likewise.
12283         * x86_64.cc: Likewise.
12284         * testsuite/testfile.cc: Likewise.
12285
12286 2009-10-28  Doug Kwan  <dougkwan@google.com>
12287
12288         * arm.cc (Arm_relobj): New class definition.
12289         (Arm_relobj::scan_sections_for_stubs,
12290         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
12291         New method definitions.
12292
12293 2009-10-28  Cary Coutant  <ccoutant@google.com>
12294
12295         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
12296         (Plugin::cleanup_done_): New member.
12297         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
12298         (Plugin_manager::cleanup_done_): Remove.
12299         (Plugin_manager::add_input_file): Edit error message.
12300         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
12301         (Plugin_manager::cleanup): Remove use of cleanup_done_.
12302
12303 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
12304
12305         * fileread.cc: (File_read::View::~View): Use the new
12306         data_ownership_ filed.
12307         (File_read::~File_read): Dispose the new whole_file_view_.
12308         (File_read::open): Mmap the whole file if needed.
12309         (File_read::open): Use whole_file_view_ instead of contents_.
12310         (File_read::find_view): Use whole_file_view_ if applicable.
12311         (File_read::do_read): Use whole_file_view_ instead of contents_.
12312         (File_read::make_view): Use whole_file_view_ instead of contents_,
12313         update File_read::View::View call.
12314         (File_read::find_or_make_view): Update File_read::View::View
12315         call.
12316         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
12317         remove contents_
12318         (File_read::View::Data_ownership): New enum.
12319         (File_read::View::View): Replace bool mapped_ with Data_ownership
12320         argument.
12321         (File_read::View::mapped_): Remove (replaced by data_ownership_).
12322         (File_read::View::data_ownership_): New field.
12323         (File_read::contents_): Remove (replaced by whole_file_view_).
12324         (File_read::whole_file_view_): New field.
12325         * options.h (class General_options): Add --keep-files-mapped.
12326
12327 2009-10-27  Cary Coutant  <ccoutant@google.com>
12328
12329         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
12330         * testsuite/Makefile.am (plugin_test_5): New test case.
12331         * testsuite/Makefile.in: Regenerate.
12332
12333 2009-10-25  Doug Kwan  <dougkwan@google.com>
12334
12335         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
12336         from private to protected to allow access by child class.
12337         (Sized_relobj::do_relocate_sections): New method declaration.
12338         (Sized_relobj::relocate_sections): Virtualize.
12339         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
12340         Sized_relobj::relocate_sections.  Instantiate template explicitly
12341         for different target sizes and endianity.
12342
12343 2009-10-24  Doug Kwan  <dougkwan@google.com>
12344
12345         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
12346         (Arm_input_section::as_arm_input_section): New method.
12347         (Arm_output_section): New class definition.
12348         (Arm_output_section::create_stub_group,
12349         Arm_output_section::group_sections): New method definitions.
12350
12351 2009-10-22  Doug Kwan  <dougkwan@google.com>
12352
12353         * arm.cc (Arm_input_section): New class definition.
12354         (Arm_input_section::init, Arm_input_section:do_write,
12355         Arm_input_section::set_final_data_size,
12356         Arm_input_section::do_reset_address_and_file_offset): New method
12357         definitions.
12358
12359 2009-10-21  Doug Kwan  <dougkwan@google.com>
12360
12361         * arm.cc (Stub_table, Arm_input_section): New forward class
12362         declarations.
12363         (Stub_table): New class defintion.
12364         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
12365         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
12366         New method definition.
12367
12368 2009-10-21  Doug Kwan  <dougkwan@google.com>
12369
12370         * arm.cc: Update copyright comments.
12371         (Target_arm): New forward class template declaration.
12372         (Arm_address): New type.
12373         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
12374         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
12375         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
12376         constants.
12377         (Insn_template): Same.
12378         (DEF_STUBS): New macro.
12379         (Stub_type): New enum type.
12380         (Stub_template): New class definition.
12381         (Stub): Same.
12382         (Reloc_stub): Same.
12383         (Stub_factory): Same.
12384         (Target_arm::Target_arm): Initialize may_use_blx_ and
12385         should_force_pic_veneer_.
12386         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
12387         Target_arm::should_force_pic_veneer,
12388         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
12389         Target_arm::using_thumb_only, Target_arm:;default_target): New
12390         method defintions.
12391         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
12392         New data member declarations.
12393         (Insn_template::size, Insn_template::alignment): New method defintions.
12394         (Stub_template::Stub_template): New method definition.
12395         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
12396         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
12397         (Stub_factory::Stub_factory): New method definition.
12398         * gold.h (string_hash): New template.
12399         * output.h (Input_section_specifier::hash_value): Use
12400         gold::string_hash.
12401         (Input_section_specifier::string_hash): Remove.
12402         * stringpool.cc (Stringpool_template::string_hash): Use
12403         gold::string_hash.
12404
12405 2009-10-20  Doug Kwan  <dougkwan@google.com>
12406
12407         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
12408         symbols of relaxed input sections.
12409         * output.h (Output_section::find_relaxed_input_section): Make
12410         method public.
12411
12412 2009-10-16  Doug Kwan  <dougkwan@google.com>
12413
12414         * dynobj.cc (Versions::Versions): Initialize version_script_.
12415         Only insert base version symbol definition for a shared object
12416         if version script defines any version versions.
12417         (Versions::define_base_version): New method definition.
12418         (Versions::add_def): Check that base version is not needed.
12419         (Versions::add_need): Define base version lazily.
12420         * dynobj.h (Versions::define_base_version): New method declaration.
12421         (Versions::needs_base_version_): New data member declaration.
12422         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
12423         (check_DATA): Add no_version_test.stdout.
12424         (libno_version_test.so, no_version_test.o no_version_test.stdout):
12425         New make rules.
12426         * testsuite/Makefile.in: Regenerate.
12427         * testsuite/no_version_test.c: New file.
12428         * testsuite/no_version_test.sh: Ditto.
12429
12430 2009-10-16  Doug Kwan  <dougkwan@google.com>
12431
12432         * expression.cc (class Segment_start_expression): New class definition.
12433         (Segment_start_expression::value): New method definition.
12434         (script_exp_function_segment_start): Return a new
12435         Segment_start_expression.
12436         * gold/script-c.h (script_saw_segment_start_expression): New function
12437         prototype.
12438         * script-sections.cc (Script_sections::Script_sections): Initialize
12439         SAW_SEGMENT_START_EXPRESSION_ to false.
12440         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
12441         and -Tbbs options to specify section addresses if given in
12442         command line and no SEGMENT_START expression is seen in a script.
12443         * script-sections.h (Script_sections::saw_segment_start_expression,
12444         Script_sections::set_saw_segment_start_expression): New method
12445         definition.
12446         (Script_sections::saw_segment_start_expression_): New data member
12447         declaration.
12448         * script.cc (script_saw_segment_start_expression): New function.
12449         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
12450         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
12451         script_test_7.sh and script_test_8.sh.
12452         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
12453         script_test_8.stdout.
12454         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
12455         (script_test_6, script_test_6.stdout, script_test_7,
12456         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
12457         * Makefile.in: Regenerate.
12458         * testsuite/script_test_6.sh: New file.
12459         * testsuite/script_test_6.t: Same.
12460         * testsuite/script_test_7.sh: Same.
12461         * testsuite/script_test_7.t: Same.
12462         * testsuite/script_test_8.sh: Same.
12463
12464 2009-10-16  Doug Kwan  <dougkwan@google.com>
12465
12466         * output.cc (Output_segment::set_section_list_address): Cast
12467         expressions to unsigned long long type to avoid format warnings.
12468
12469 2009-10-15  Ian Lance Taylor  <iant@google.com>
12470
12471         * script.cc (Script_options::add_symbol_assignment): Always add a
12472         dot assignment to script_sections_.
12473         * script-sections.cc (Script_sections::add_dot_assignment):
12474         Initialize if necessary.
12475
12476         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
12477         program headers with no load segment if there is a linker script.
12478
12479         * layout.cc (Layout::set_segment_offsets): Align the file offset
12480         to the segment aligment for -N or -n with no load segment.
12481         * output.cc (Output_segment::add_output_section): Don't crash if
12482         the first section is a TLS section.
12483         (Output_segment::set_section_list_addresses): Print an error
12484         message if the address moves backward in a linker script.
12485         * script-sections.cc
12486         (Output_section_element_input::set_section_addresses): Don't
12487         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
12488         (Orphan_output_section::set_section_addresses): Likewise.
12489
12490 2009-10-15  Doug Kwan  <dougkwan@google.com>
12491
12492         * layout.cc (Layout::finish_dynamic_section): Generate tags
12493         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
12494         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
12495         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
12496
12497 2009-10-14  Ian Lance Taylor  <iant@google.com>
12498
12499         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
12500         fields.
12501         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
12502         data_shdr fields of relinfo.
12503         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
12504         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
12505         R_386_TLS_LDO_32, adjust based on section flags.
12506         (Target_i386::Relocate::fix_up_ldo): Remove.
12507
12508 2009-10-13  Ian Lance Taylor  <iant@google.com>
12509
12510         Add support for -pie.
12511         * options.h (class General_options): Add -pie and
12512         --pic-executable.
12513         (General_options::output_is_position_independent): Test -pie.
12514         (General_options::output_is_executable): Return true if not shared
12515         and not relocatable.
12516         (General_options::output_is_pie): Remove.
12517         * options.cc (General_options::finalize): Reject incompatible uses
12518         of -pie.
12519         * gold.cc (queue_middle_tasks): A -pie link is not static.
12520         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
12521         * symtab.cc (Symbol::final_value_is_known): Return false if
12522         output_is_position_independent.
12523         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
12524         output_is_position_independent.
12525         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
12526         output_is_position_independent.
12527         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
12528         output_is_position_independent.
12529         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
12530         two_file_pie_test.
12531         (basic_pie_test.o, basic_pie_test): New targets.
12532         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
12533         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
12534         (two_file_pie_test): New target.
12535         * testsuite/Makefile.in: Rebuild.
12536         * README: Remove note saying that -pie is not supported.
12537
12538 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
12539
12540         * options.h (class General_options): Add -init and -fini.
12541         * layout.cc (Layout::finish_dynamic_section): Emit
12542         given init and fini functions.
12543
12544 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
12545
12546         * gc.h (gc_process_relocs): Check if icf is enabled using new
12547         function.
12548         * gold.cc (queue_initial_tasks): Likewise.
12549         (queue_middle_tasks): Likewise.
12550         * object.cc (do_layout): Likewise.
12551         * symtab.cc (is_section_folded): Likewise.
12552         * main.cc (main): Likewise.
12553         * reloc.cc (Read_relocs::run): Likewise.
12554         (Sized_relobj::do_scan_relocs): Likewise.
12555         * icf.cc (is_function_ctor_or_dtor): New function.
12556         (Icf::find_identical_sections): Check if function is ctor or dtor when
12557         safe icf is chosen.
12558         * options.h (General_options::icf): Change option to be an enum.
12559         (Icf_status): New enum.
12560         (icf_enabled): New method.
12561         (icf_safe_folding): New method.
12562         (set_icf_status): New method.
12563         (icf_status_): New variable.
12564         * (options.cc) (General_options::finalize): Set icf_status_.
12565         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
12566         icf_test and icf_keep_unique_test to use the --icf enum flag.
12567         * testsuite/icf_safe_test.sh: New file.
12568         * testsuite/icf_safe_test.cc: New file.
12569
12570 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
12571
12572         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
12573         includes to gc.h and icf.h.
12574         * arm.cc: Include gc.h.
12575         * gold.cc: Likewise.
12576         * i386.cc: Likewise.
12577         * powerpc.cc: Likewise.
12578         * sparc.cc: Likewise.
12579         * x86_64.cc: Likewise.
12580         * gc.h: Include icf.h.
12581
12582 2009-10-11  Ian Lance Taylor  <iant@google.com>
12583
12584         * plugin.cc: Include "gold.h" before other header files.
12585
12586 2009-10-10  Chris Demetriou  <cgd@google.com>
12587
12588         * options.h (Input_file_argument::Input_file_type): New enum.
12589         (Input_file_argument::is_lib_): Replace with...
12590         (Input_file_argument::type_): New member.
12591         (Input_file_argument::Input_file_argument): Take Input_file_type
12592         'type' rather than boolean 'is_lib' as second argument.
12593         (Input_file_argument::is_lib): Use type_.
12594         (Input_file_argument::is_searched_file): New function.
12595         (Input_file_argument::may_need_search): Handle is_searched_file.
12596         * options.cc (General_options::parse_library): Support -l:filename.
12597         (General_options::parse_just_symbols): Update for Input_file_argument
12598         changes.
12599         (Command_line::process): Likewise.
12600         * archive.cc (Archive::get_file_and_offset): Likewise.
12601         * plugin.cc (Plugin_manager::release_input_file): Likewise.
12602         * script.cc (read_script_file, script_add_file): Likewise.
12603         * fileread.cc (Input_file::Input_file): Likewise.
12604         (Input_file::will_search_for): Handle is_searched_file.
12605         (Input_file::open): Likewise.
12606         * readsyms.cc (Read_symbols::get_name): Likewise.
12607         * testsuite/Makefile.am (searched_file_test): New test.
12608         * testsuite/Makefile.in: Regenerate.
12609         * testsuite/searched_file_test.cc: New file.
12610         * testsuite/searched_file_test_lib.cc: New file.
12611
12612 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12613             Ian Lance Taylor  <iant@google.com>
12614
12615         * descriptor.cc: Include <cstdio> and "binary-io.h".
12616         (Descriptors::open): Open the files in binary mode always.
12617         * script.cc (Lex::get_token): Treat \r as whitespace.
12618
12619 2009-10-09  Ian Lance Taylor  <iant@google.com>
12620
12621         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
12622
12623 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12624             Ian Lance Taylor  <iant@google.com>
12625
12626         * configure.ac: Check for readv function also.
12627         * fileread.cc (readv): Define if not HAVE_READV.
12628         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
12629         does not exist.
12630         * config.in: Regenerate.
12631         * configure: Regenerate.
12632
12633 2009-10-09  Doug Kwan  <dougkwan@google.com>
12634
12635         * layout.cc (Layout::make_output_section): Call target hook to make
12636         ordinary output section.
12637         (Layout::finalize): Adjust parameter list of call the
12638         Target::may_relax().
12639         * layout.h (class Layout::section_list): New method.
12640         * merge.h (Output_merge_base::entsize): Change visibility to public.
12641         (Output_merge_base::is_string, Output_merge_base::do_is_string):
12642         New methods.
12643         (Output_merge_string::do_is_string): New method.
12644         * object.cc (Sized_relobj::do_setup): renamed from
12645         Sized_relobj::set_up.
12646         * object.h (Sized_relobj::adjust_shndx,
12647         Sized_relobj::initializ_input_to_output_maps,
12648         Sized_relobj::free_input_to_output_maps): Change visibilities to
12649         protected.
12650         (Sized_relobj::setup): Virtualize.
12651         (Sized_relobj::do_setup): New method declaration.
12652         (Sized_relobj::invalidate_section_offset,
12653         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
12654         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
12655         * options.cc (parse_int): New function.
12656         * options.h (parse_int): New declaration.
12657         (DEFINE_int): New macro.
12658         (stub_group_size): New option.
12659         * output.cc (Output_section::Output_section): Initialize memebers
12660         merge_section_map_, merge_section_by_properties_map_,
12661         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
12662         (Output_section::add_input_section): Handled deferred code-fill
12663         generation and remove an old comment.
12664         (Output_section::add_relaxed_input_section): New method definition.
12665         (Output_section::add_merge_input_section): Use merge section by
12666         properties map to speed to search.  Update merge section maps
12667         as appropriate.
12668         (Output_section::build_relaxation_map): New method definition.
12669         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
12670         Same.
12671         (Output_section::relax_input_section): Renamed to
12672         Output_section::convert_input_sections_to_relaxed_sections and change
12673         interface to take a vector of pointers to relaxed sections.
12674         (Output_section::find_merge_section,
12675         Output_section::find_relaxed_input_section): New method definitions.
12676         (Output_section::is_input_address_mapped,
12677         Output_section::output_offset, Output_section::output_address):
12678         Use output section data maps to speed up searching.
12679         (Output_section::find_starting_output_address): Add comments.
12680         (Output_section::do_write,
12681         Output_section::write_to_postprocessing_buffer): Do code-fill
12682         generation as appropriate.
12683         (Output_section::get_input_sections): Invalidate relaxed input section
12684         map.
12685         (Output_section::restore_states): Adjust type of checkpoint .
12686         Invalidate relaxed input section map.
12687         * output.h (Output_merge_base): New class declaration.
12688         (Input_section_specifier): New class defintion.
12689         (class Output_relaxed_input_section) Change base class to
12690         Output_section_data_build.
12691         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
12692         base class initializer.
12693         (Output_section::add_relaxed_input_section): New method declaration.
12694         (Output_section::Input_section): Change visibility to protected.
12695         (Output_section::Input_section::relobj,
12696         Output_section::Input_section::shndx): Handle relaxed input sections.
12697         Output_section::input_sections) Change visibility to protected.  Also
12698         define overload to return a non-const pointer.
12699         (Output_section::Merge_section_properties): New class defintion.
12700         (Output_section::Merge_section_by_properties_map,
12701         Output_section::Output_section_data_by_input_section_map,
12702         Output_section::Relaxation_map): New types.
12703         (Output_section::relax_input_section): Rename method to
12704         Output_section::convert_input_sections_to_relaxed_sections and change
12705         interface to take a vector of relaxed section pointers.
12706         (Output_section::find_merge_section,
12707         Output_section::find_relaxed_input_section,
12708         Output_section::build_relaxation_map,
12709         Output_section::convert_input_sections_in_list_to_relaxed_sections):
12710         New method declarations.
12711         (Output_section::merge_section_map_
12712         Output_section::merge_section_by_properties_map_,
12713         Output_section::relaxed_input_section_map_,
12714         Output_section::is_relaxed_input_section_map_valid_,
12715         Output_section::generate_code_fills_at_write_): New data members.
12716         * script-sections.cc
12717         (Output_section_element_input::set_section_addresses): Call
12718         current_data_size and addralign methods of relaxed input sections.
12719         (Orphan_output_section::set_section_addresses): Call current_data_size
12720         and addralign methods of relaxed input sections.
12721         * symtab.cc (Symbol_table::compute_final_value): Extract template
12722         from the body of Symbol_table::sized_finalize_symbol.
12723         (Symbol_table::sized_finalized_symbol): Call
12724         Symbol_table::compute_final_value.
12725         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
12726         (Symbol_table::compute_final_value): New templated method declaration.
12727         * target.cc (Target::do_make_output_section): New method defintion.
12728         * target.h (Target::make_output_section): New method declaration.
12729         (Target::relax): Add more parameters for input objects, symbol table
12730         and layout.  Adjust call to do_relax.
12731         (Target::do_make_output_section): New method declaration.
12732         (Target::do_relax): Add parameters for input objects, symbol table
12733         and layout.
12734
12735 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12736
12737         * pread.c: Include stdio.h.
12738
12739 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12740
12741         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
12742         defined.
12743
12744 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12745
12746         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
12747         Change read_shndx type to unsigned int.
12748         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12749         int.
12750         (Sized_dwarf_line_info::read_line_mappings): Likewise.
12751         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
12752         Change read_shndx type to unsigned int.
12753         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12754         int.
12755         (Sized_dwarf_line_info::read_line_mappings): Likewise.
12756         * layout.cc (Layout::create_symtab_sections): Cast the result of
12757         local_symcount * symsize to off_t in the gold_assert.
12758
12759 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12760
12761         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
12762         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
12763         R_ARM_BASE_ABS.
12764         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
12765         (Arm_relocate_functions::thm_abs5): New function.
12766         (Arm_relocate_functions::abs12): New function.
12767         (Arm_relocate_functions::abs16): New function.
12768         (Arm_relocate_functions::base_abs): New function.
12769         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
12770         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
12771         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
12772         R_ARM_BASE_ABS.
12773         (Scan::global): Likewise.
12774         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
12775         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
12776         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
12777         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
12778         R_ARM_BASE_ABS.
12779
12780 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12781
12782         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
12783         (Arm_relocate_functions::movt_prel): New function.
12784         (Arm_relocate_functions::thm_movw_prel_nc): New function.
12785         (Arm_relocate_functions::thm_movt_prel): New function.
12786         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
12787         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
12788         (Scan::global, Relocate::relocate): Likewise.
12789         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12790
12791 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
12792
12793         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
12794         Incremental_checker.
12795         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
12796         unsigned int.
12797         (class Incremental_inputs_header): New class.
12798         (Incremental_inputs_header_writer): Edit comment.
12799         (Incremental_inputs_entry): New class.
12800         (Incremental_inputs_entry_writer): Edit comment.
12801         (Sized_incremental_binary::do_find_incremental_inputs_section):
12802         Add *strtab_shndx parameter, fill it.
12803         (Sized_incremental_binary::do_check_inputs): New method.
12804         (Incremental_checker::can_incrementally_link_output_file): Use
12805         Sized_incremental_binary::check_inputs.
12806         (Incremental_inputs::report_command_line): Save command line in
12807         command_line_.
12808         * incremental.h:
12809         (Incremental_binary::find_incremental_inputs_section): New
12810         method.
12811         (Incremental_binary::do_find_incremental_inputs_section): Add
12812         strtab_shndx parameter.
12813         (Incremental_binary::do_check_inputs): New pure virtual method.
12814         (Sized_incremental_binary::do_check_inputs): Declare.
12815         (Incremental_checker::Incremental_checker): Add incremental_inputs
12816         parameter, use it to initialize incremental_inputs_.
12817         (Incremental_checker::incremental_inputs_): New field.
12818         (Incremental_checker::command_line): New method.
12819         (Incremental_checker::inputs): New method.
12820         (Incremental_checker::command_line_): New field.
12821
12822 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
12823
12824         * incremental.cc: Include <cstdarg> and "target-select.h".
12825         (vexplain_no_incremental): New function.
12826         (explain_no_incremental): New function.
12827         (Incremental_binary::error): New method.
12828         (Sized_incremental_binary::do_find_incremental_inputs_section): New
12829         method.
12830         (make_sized_incremental_binary): New function.
12831         (open_incremental_binary): New function.
12832         (can_incrementally_link_file): Add checks if output is ELF and has
12833         inputs section.
12834         * incremental.h: Include "elfcpp_file.h" and "output.h".
12835         (Incremental_binary): New class.
12836         (Sized_incremental_binary): New class.
12837         (open_incremental_binary): Declare.
12838         * object.cc (is_elf_object): Use
12839         elfcpp::Elf_recognizer::is_elf_file.
12840         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
12841         * output.h (Output_file::filesize): New method.
12842
12843 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12844
12845         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
12846         New function.
12847         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
12848         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
12849         function.
12850         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
12851         function.
12852         (Arm_relocate_functions::movw_abs_nc): New function.
12853         (Arm_relocate_functions::movt_abs): New function.
12854         (Arm_relocate_functions::thm_movw_abs_nc): New function.
12855         (Arm_relocate_functions::thm_movt_abs): New function.
12856         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
12857         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
12858         (Scan::global): Likewise.
12859         (Relocate::relocate): Likewise.
12860         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12861
12862 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12863
12864         * arm.cc (Arm_relocate_functions::got_prel) New function.
12865         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
12866         (Relocate::relocate): Likewise.
12867         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12868
12869 2009-10-06  Ian Lance Taylor  <iant@google.com>
12870
12871         * options.h (class General_options): Define
12872         split_stack_adjust_size parameter.
12873         * object.h (class Object): Add uses_split_stack_ and
12874         has_no_split_stack_ fields.  Add uses_split_stack and
12875         has_no_split_stack accessor functions.  Declare
12876         handle_split_stack_section.
12877         (class Reloc_symbol_changes): Define.
12878         (class Sized_relobj): Define Function_offsets.  Declare
12879         split_stack_adjust, split_stack_adjust_reltype, and
12880         find_functions.
12881         * object.cc (Object::handle_split_stack_section): New function.
12882         (Sized_relobj::do_layout): Call handle_split_stack_section.
12883         * dynobj.cc (Sized_dynobj::do_layout): Call
12884         handle_split_stack_section.
12885         * reloc.cc (Sized_relobj::relocate_sections): Call
12886         split_stack_adjust for executable sections in split_stack
12887         objects.  Pass reloc_map to relocate_section.
12888         (Sized_relobj::split_stack_adjust): New function.
12889         (Sized_relobj::split_stack_adjust_reltype): New function.
12890         (Sized_relobj::find_functions): New function.
12891         * target-reloc.h: Include "object.h".
12892         (relocate_section): Add reloc_symbol_changes parameter.  Change
12893         all callers.
12894         * target.h (class Target): Add calls_non_split method.  Declare
12895         do_calls_non_split virtual method.  Declare match_view and
12896         set_view_to_nop.
12897         * target.cc: Include "elfcpp.h".
12898         (Target::do_calls_non_split): New function.
12899         (Target::match_view): New function.
12900         (Target::set_view_to_nop): New function.
12901         * gold.cc (queue_middle_tasks): Give an error if mixing
12902         split-stack and non-split-stack objects with -r.
12903         * i386.cc (Target_i386::relocate_section): Add
12904         reloc_symbol_changes parameter.
12905         (Target_i386::do_calls_non_split): New function.
12906         * x86_64.cc (Target_x86_64::relocate_section): Add
12907         reloc_symbol_changes parameter.
12908         (Target_x86_64::do_calls_non_split): New function.
12909         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
12910         parameter.
12911         * powerpc.cc (Target_powerpc::relocate_section): Add
12912         reloc_symbol_changes parameter.
12913         * sparc.cc (Target_sparc::relocate_section): Add
12914         reloc_symbol_changes parameter.
12915         * configure.ac: Call AM_CONDITIONAL for the default target.
12916         * configure: Rebuild.
12917         * testsuite/Makefile.am (TEST_AS): New variable.
12918         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
12919         (check_DATA): Add split_i386 and split_x86_64 files.
12920         (SPLIT_DEFSYMS): Define.
12921         (split_i386_[1234n].o): New targets.
12922         (split_i386_[124]): New targets.
12923         (split_i386_[1234r].stdout): New targets.
12924         (split_x86_64_[1234n].o): New targets.
12925         (split_x86_64_[124]): New targets.
12926         (split_x86_64_[1234r].stdout): New targets.
12927         (MOSTLYCLEANFILES): Add new executables.
12928         * testsuite/split_i386.sh: New file.
12929         * testsuite/split_x86_64.sh: New file.
12930         * testsuite/split_i386_1.s: New file.
12931         * testsuite/split_i386_2.s: New file.
12932         * testsuite/split_i386_3.s: New file.
12933         * testsuite/split_i386_4.s: New file.
12934         * testsuite/split_i386_n.s: New file.
12935         * testsuite/split_x86_64_1.s: New file.
12936         * testsuite/split_x86_64_2.s: New file.
12937         * testsuite/split_x86_64_3.s: New file.
12938         * testsuite/split_x86_64_4.s: New file.
12939         * testsuite/split_x86_64_n.s: New file.
12940         * testsuite/testfile.cc (Target_test): Update relocation_section
12941         function.
12942         * testsuite/Makefile.in: Rebuild.
12943
12944 2009-10-06  Ian Lance Taylor  <iant@google.com>
12945
12946         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
12947         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
12948         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
12949         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
12950         the address on ldo_addrs_.
12951         (Target_i386::Relocate::fix_up_ldo): New function.
12952
12953 2009-10-06   Rafael Espindola  <espindola@google.com>
12954
12955         * plugin.cc (add_input_library): New.
12956         (Plugin::load): Add add_input_library to tv.
12957         (Plugin_manager::add_input_file): Add the is_lib argument.
12958         (add_input_file): Update call to Plugin_manager::add_input_file.
12959         (add_input_library): New.
12960         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
12961
12962 2009-09-30  Doug Kwan  <dougkwan@google.com>
12963
12964         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
12965         symbol and call Symbol::may_need_copy_reloc to determine if
12966         a copy reloc is needed.
12967         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12968         nocopyreloc is given in command line.
12969         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12970         given in command line.
12971         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12972         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
12973         of the removed Target_i386::may_need_copy_reloc.
12974         * options.h (copyreloc): New option with default value false.
12975         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12976         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12977         instead of the removed Target_powerpc::may_need_copy_reloc.
12978         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12979         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
12980         instead of the removed Target_sparc::may_need_copy_reloc.
12981         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
12982         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
12983         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12984         instead of the removed Target_x86_64::may_need_copy_reloc.
12985
12986 2009-09-30  Ian Lance Taylor  <iant@google.com>
12987
12988         * object.h (class Object): Remove target_ field, and target,
12989         sized_target, and set_target methods.
12990         (Object::sized_target): Remove.
12991         (class Sized_relobj): Update declarations.  Remove sized_target.
12992         * object.cc (Sized_relobj::setup): Remove target parameter.
12993         Change all callers.
12994         (Input_objects::add_object): Don't do anything with the target.
12995         (make_elf_sized_object): Add punconfigured parameter.  Change all
12996         callers.  Set or test parameter target.
12997         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12998         Change all callers.
12999         * parameters.cc (Parameters::set_target): Change parameter type to
13000         be non-const.
13001         (Parameters::default_target): Remove.
13002         (set_parameters_target): Change parameter type to be non-const.
13003         (parameters_force_valid_target): New function.
13004         (parameters_clear_target): New function.
13005         * parameters.h (class Parameters): Update declarations.  Remove
13006         default_target method.  Add sized_target and clear_target
13007         methods.  Change target_ to be non-const.
13008         (set_parameters_target): Update declaration.
13009         (parameters_force_valid_target): Declare.
13010         (parameters_clear_target): Declare.
13011         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
13012         as NULL if we aren't searching.
13013         (Add_symbols::run): Don't check for compatible target.
13014         * fileread.cc (Input_file::open_binary): Call
13015         parameters_force_valid_target.
13016         * gold.cc (queue_middle_tasks): Likewise.
13017         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
13018         set_target on object.
13019         * dynobj.h (class Sized_dynobj): Update declarations.
13020         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
13021         make_elf_object returns NULL.
13022         (Archive::include_member): Don't check whether object target is
13023         compatible.
13024         * output.cc (Output_section::add_input_section): Get target from
13025         parameters.
13026         (Output_section::relax_input_section): Likewise.
13027         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
13028         parameters.
13029         (Sized_relobj::do_scan_relocs): Likewise.
13030         (Sized_relobj::relocate_sections): Likewise.
13031         * resolve.cc (Symbol_table::resolve): Likewise.
13032         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
13033         parameter.  Change all callers.
13034         (Symbol_table::add_from_object): Get target from parameters.
13035         (Symbol_table::add_from_relobj): Don't check object target.
13036         (Symbol_table::add_from_dynobj): Likewise.
13037         (Symbol_table::define_special_symbol): Get target from
13038         parameters.
13039         * symtab.h (class Symbol_table): Update declaration.
13040         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
13041         parameter.  Change all callers.  Clear parameter target.
13042         (Binary_test): Test target here.
13043         * testsuite/object_unittest.cc (gold_testsuite): Remove
13044         target_test_pointer parameter.  Change all callers.
13045         (Object_test): Test target here.
13046
13047 2009-09-26  Ian Lance Taylor  <iant@google.com>
13048
13049         * testsuite/initpri1.c: Don't try to use constructor priorities if
13050         compiling with gcc before 4.3.
13051
13052 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
13053
13054         * testsuite/retain_symbols_file_test.sh (check_present): Change
13055         output file name to retain_symbols_file_test.stdout.
13056         (check_absent): Likewise.
13057
13058 2009-09-18  Craig Silverstein  <csilvers@google.com>
13059
13060         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
13061         * options.cc: Include <cerrno> and <fstream>.
13062         (General_options::finalize): Parse -retain-symbols-file tag.
13063         * options.h: New flag.
13064         (General_options): New method should_retain_symbol, new
13065         variable symbols_to_retain.
13066         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
13067         should_retain_symbol map.
13068         * testsuite/Makefile.am (retain_symbols_file_test): New test.
13069         * testsuite/Makefile.in: Regenerate.
13070         * testsuite/retain_symbols_file_test.sh: New file.
13071
13072 2009-09-18  Nick Clifton  <nickc@redhat.com>
13073
13074         * po/es.po: Updated Spanish translation.
13075
13076 2009-09-17  Doug Kwan  <dougkwan@google.com>
13077
13078         * debug.h (DEBUG_RELAXATION): New constant.
13079         (DEBUG_ALL): Add DEBUG_RELAXATION.
13080         (debug_string_to_enum): Add relaxation debug option.
13081         * layout.cc
13082         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
13083         Layout::Relaxation_debug_check::read_sections,
13084         Layout::Relaxation_debug_check::read_sections): New method definitions.
13085         (Layout::Layout): Initialize data members
13086         record_output_section_data_from_scrips_,
13087         script_output_section_data_list_ and relaxation_debug_check_.
13088         (Layout::save_segments, Layout::restore_segments,
13089         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13090         Layout::relaxation_loop_body): New method definitions.
13091         (Layout::finalize): Support relaxation.  Move section layout code to
13092         Layout::relaxation_loop_body.
13093         (Layout::set_asection_address_from_script): Move code for orphan
13094         section placement out.
13095         (Layout::place_orphan_sections_in_script): New method definition.
13096         * layout.h (Output_segment_headers, Output_file_header):
13097         New forward class declarations.
13098         (Layout::~Layout): Define.
13099         (Layout::new_output_section_data_from_script): New method definition.
13100         (Layout::place_orphan_sections_in_script): New method declaration.
13101         (Layout::Segment_states): New type declaration.
13102         (Layout::save_segments, Layout::restore_segments,
13103         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13104         Layout::relaxation_loop_body): New method declarations.
13105         (Layout::Output_section_data_list): New type declaration.
13106         (Layout::Relaxation_debug_check): New class definition.
13107         (Layout::record_output_section_data_from_script_,
13108         Layout::script_output_section_data_list_, Layout::segment_states_,
13109         Layout::relaxation_debug_check_): New data members.
13110         * output.cc: (Output_section_headers::do_size): New method definition.
13111         (Output_section_headers::Output_section_headers): Move size
13112         computation to Output_section_headers::do_size.
13113         (Output_segment_headers::do_size): New method definition.
13114         (Output_file_header::Output_file_header): Move size computation to
13115         Output_file_header::do_size and call it.
13116         (Output_file_header::do_size): New method definition.
13117         (Output_data_group::Output_data_group): Adjust call to
13118         Output_section_data.
13119         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
13120         (Output_symtab_xindex::do_write): Add array bound check.
13121         (Output_section::Input_section::print_to_mapfile): Handle
13122         RELAXED_INPUT_SECTION_CODE.
13123         (Output_section::Output_section): Initialize data member checkpoint_.
13124         (Output_section::~Output_section): Delete checkpoint object pointed
13125         by checkpoint_.
13126         (Output_section::add_input_section): Always add an Input_section if
13127         relaxing.
13128         (Output_section::add_merge_input_section): Add assert.
13129         (Output_section::relax_input_section): New method definition.
13130         (Output_section::set_final_data_size): Set load address to zero for
13131         an unallocated section.
13132         (Output_section::do_address_and_file_offset_have_reset_values):
13133         New method definition.
13134         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
13135         Handle relaxed input section.
13136         (Output_section::sort_attached_input_sections): Checkpoint input
13137         section list lazily.
13138         (Output_section::get_input_sections): Change type of input_sections to
13139         list of Simple_input_section pointers.  Checkpoint input section list
13140         lazily.  Also handle relaxed input sections.
13141         (Output_section::add_input_section_for_script): Take a reference to
13142         a Simple_input_section object instead of Relobj pointer and section
13143         index as parameter.  Handle relaxed input sections.
13144         (Output_section::save_states, Output_section::restore_states): New
13145         method definitions.
13146         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
13147         (Output_data::is_data_size_fixed): New method definition.
13148         (Output_data::reset_addresss_and_file_offset): Do not reset data size
13149         if it is fixed.
13150         (Output_data::address_and_file_offset_have_reset_values): New method
13151         definition.
13152         (Output_data::do_address_and_file_offset_have_reset_values): New method
13153         definition.
13154         (Output_data::set_data_size): Check that data size is not fixed.
13155         (Output_data::fix_data_size): New method definition.
13156         (Output_data::is_data_size_fixed_): New data member.
13157         (Output_section_headers::set_final_data_size): New method definition.
13158         (Output_section_headers::do_size): New method declaration.
13159         (Output_segment_headers::set_final_data_size): New method definition.
13160         (Output_segment_headers::do_size): New method declaration.
13161         (Output_file_header::set_final_data_size)::New method definition.
13162         (Output_file_header::do_size)::New method declaration.
13163         (Output_section_data::Output_section_data): Add new parameter
13164         is_data_size_fixed and use it to fix data size.
13165         (Output_data_const::Output_data_const): Adjust call to base class
13166         constructor and fix data size.
13167         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
13168         base class constructor and fix data size.
13169         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
13170         base class constructor and fix data size.
13171         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
13172         class constructor and fix data size.
13173         (Output_data_group::set_final_data_size): New method definition.
13174         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
13175         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
13176         class constructor and fix data size.
13177         (Output_relaxed_input_section): New class definition.
13178         (Output_section::Simple_input_section): New class definition.
13179         (Output_section::get_input_sections): Adjust parameter list.
13180         (Output_section::add_input_section_for_script): Same.
13181         (Output_section::save_states, Output_section::restore_states,
13182         Output_section::do_address_and_file_offset_have_reset_values,
13183         (Output_section::Input_section::Input_section): Handle
13184         RELAXED_INPUT_SECTION_CODE.  Add new overload for
13185         Output_relaxed_input_section.
13186         (Output_section::Input_section::is_input_section,
13187         Output_section::Input_section::set_output_section): Handle relaxed
13188         input section.
13189         (Output_section::Input_section::is_relaxed_input_section,
13190         Output_section::Input_section::output_section_data,
13191         Output_section::Input_section::relaxed_input_section): New method
13192         definitions.
13193         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
13194         value.
13195         (Output_section::Input_section::u1_): Update comments.
13196         (Output_section::Input_section::u2_): Add new union member poris.
13197         (Output_section::Checkpoint_output_section): New classs definition.
13198         (Output_section::relax_input_section): New method declaration.
13199         (Output_section::checkpoint_): New data member.
13200         (Output_segment): Update comments.
13201         (Output_segment::Output_segment): Un-privatize copy constructor.
13202         (Output_segment::operator=): Un-privatize.
13203         * script-sections.cc (Output_section_element::Input_section_list):
13204         Change element type to Output_section::Simple_input_section.
13205         (Output_section_element_dot_assignment::set_section_addresses):
13206         Register output section data for relaxation clean up.
13207         (Output_data_exression::Output_data_expression): Adjust call to base
13208         constructor to fix data size.
13209         (Output_section_element_data::set_section_addresses): Register
13210         Output_data_expression object for relaxation clean up.
13211         (struct Input_section_info): Replace Relobj pointer and section index
13212         pair with Output_section::Simple_input_section and Convert struct to a
13213         class.
13214         (Input_section_sorter::operator()): Adjust access to
13215         Input_section_info data member to use accessors.
13216         (Output_section_element_input::set_section_addresses): Use layout
13217         parameter.  Adjust code to use Output_section::Simple_input_section
13218         and Input_secction_info classes.  Register filler for relaxation
13219         clean up.
13220         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
13221         and section index pair with Output_section::Simple_input_section
13222         class.  Adjust code accordingly.
13223         (Phdrs_element::release_segment): New method definition.
13224         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
13225         segment list.
13226         (Script_sections::release_segments): New method definition.
13227         * gold/script-sections.h (Script_sections::release_segments): New
13228         method declaration.
13229         * gold/target.h (Target::may_relax, Target::relax,
13230         Target::do_may_relax, Target::do_relax): New method definitions.
13231
13232 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13233
13234         * arm.cc (has_signed_unsigned_overflow): New function.
13235         (Arm_relocate_functions::abs8): New function.
13236         (Target_arm::Scan::local): Handle R_ARM_ABS8.
13237         (Target_arm::Scan::global): Likewise.
13238         (Target_arm::relocate::relocate): Likewise.
13239         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
13240         Likewise.
13241
13242 2009-09-16  Cary Coutant  <ccoutant@google.com>
13243
13244         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
13245         * testsuite/Makefile.in: Regenerate.
13246
13247 2009-09-11  Nick Clifton  <nickc@redhat.com>
13248
13249         * po/gold.pot: Updated by the Translation project.
13250
13251 2009-09-08  Cary Coutant  <ccoutant@google.com>
13252
13253         * output.cc (Output_file::open): Add execute permission to empty file.
13254         * testsuite/Makefile.am (permission_test): New test.
13255         * testsuite/Makefile.in: Regenerate.
13256
13257 2009-09-02  Ian Lance Taylor  <iant@google.com>
13258
13259         * output.cc (Output_file::resize): Call map_no_anonymous rather
13260         than map.
13261
13262 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
13263
13264         * gold.cc: Include "incremental.h".
13265         (queue_initial_tasks): Call Incremental_checker methods.
13266         * incremental.cc: Include "output.h".
13267         (Incremental_checker::can_incrementally_link_output_file): New
13268         method.
13269         * incremental.h (Incremental_checker): New class.
13270
13271         * output.cc (Output_file::open_for_modification): New method.
13272         (Output_file::map_anonymous): Changed return type to bool.  Record
13273         map in base_ field.
13274         (Output_file::map_no_anonymous): New method, broken out of map.
13275         (Output_file::map): Use map_no_anonymous and map_anonymous.
13276         * output.h (class Output_file): Update declarations.
13277
13278 2009-08-24  Cary Coutant  <ccoutant@google.com>
13279
13280         * options.h (Command_line::Pre_options): New class.
13281         (Command_line::pre_options): New member.
13282         * options.cc (gold::options::ready_to_register): New variable.
13283         (One_option::register_option): Do nothing if not registering options.
13284         Assert if same short option registered twice.
13285         (General_options::General_options): Turn off option registration when
13286         done constructing.
13287         (Command_line::Pre_options::Pre_options): New constructor.
13288
13289 2009-08-24  Cary Coutant  <ccoutant@google.com>
13290
13291         * options.h (General_options::no_keep_memory): Remove incorrect
13292         short option.
13293
13294 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
13295
13296         * Makefile.am (am__skiplex, am__skipyacc): New.
13297         * Makefile.in: Regenerate.
13298
13299 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
13300
13301         * Makefile.am (AM_CPPFLAGS): Renamed from ...
13302         (INCLUDES): ... this.
13303         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
13304         (AM_CPPFLAGS): Renamed from ...
13305         (INCLUDE): ... this.
13306         * Makefile.in, testsuite/Makefile.in: Regenerate.
13307
13308         * Makefile.in: Regenerate.
13309         * aclocal.m4: Likewise.
13310         * config.in: Likewise.
13311         * configure: Likewise.
13312         * testsuite/Makefile.in: Likewise.
13313
13314         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13315         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13316         * Makefile.in: Regenerate.
13317         * testsuite/Makefile.in: Regenerate.
13318
13319 2009-08-19  Cary Coutant  <ccoutant@google.com>
13320
13321         * resolve.cc (Symbol_table::resolve): Don't complain about defined
13322         symbols in shared libraries overridden by hidden or internal symbols
13323         in the main program.
13324
13325 2009-08-19  Chris Demetriou  <cgd@google.com>
13326
13327         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
13328         checking source file names in error messages.
13329
13330 2009-08-18  Doug Kwan  <dougkwan@google.com>
13331
13332         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
13333         an elcpp::Ehdr as parameter.  Adjust call to set_target.
13334         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
13335         an elfcpp::Ehdr as parameter.
13336         * object.cc (Object::set_target): Remove the version that looks up
13337         a target and sets it.
13338         (Sized_relobj::setup): Take a Target object instead of
13339         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
13340         (make_elf_sized_object): Find target and ask target to
13341         make an ELF object.
13342         * object.h: (Object::set_target): Remove the version that looks up
13343         a target and sets it.
13344         (Sized_relobj::setup): Take a Target object instead of
13345         an elfcpp:Ehdr as parameter.
13346         * target.cc: Include dynobj.h.
13347         (Target::do_make_elf_object_implementation): New.
13348         (Target::do_make_elf_object): New.
13349         * target.h (Target::make_elf_object): New template declaration.
13350         (Target::do_make_elf_object): New method declarations.
13351         (Target::do_make_elf_object_implementation): New template declaration.
13352
13353 2009-08-14  Ian Lance Taylor  <iant@google.com>
13354
13355         * gold.h (FUNCTION_NAME): Define.
13356         (gold_unreachable): Use FUNCTION_NAME.
13357
13358 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
13359
13360         * icf.cc (Icf::find_identical_sections): Issue a warning when a
13361         symbol in the --keep-unique list is not found.
13362
13363 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
13364
13365         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
13366         been maked as --keep-unique.
13367         (Icf::unfold_section): New function.
13368         * icf.h (Icf::unfold_section): New function.
13369         * options.h (General_options::keep_unique): New option.
13370         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
13371         * testsuite/Makefile.in: Regenerate.
13372         * testsuite/icf_keep_unique_test.sh: New file.
13373         * testsuite/icf_keep_unique_test.cc: New file.
13374
13375 2009-08-12  Cary Coutant  <ccoutant@google.com>
13376
13377         PR 10471
13378         * resolve.cc (Symbol_table::resolve): Check for references from
13379         dynamic objects to hidden and internal symbols.
13380         * testsuite/Makefile.am (hidden_test.sh): New test.
13381         * testsuite/Makefile.in: Regenerate.
13382         * testsuite/hidden_test.sh: New script.
13383         * testsuite/hidden_test_1.c: New test source.
13384         * testsuite/hidden_test_main.c: New test source.
13385
13386 2009-08-11  Doug Kwan  <dougkwan@google.com>
13387
13388         * arm.cc: Update comments.
13389         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
13390         segment to locate the .ARM.exidx section if present.
13391
13392 2009-08-09  Doug Kwan  <dougkwan@google.com>
13393
13394         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
13395         patch.
13396
13397 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
13398         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
13399         compiler warnings.
13400
13401 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
13402
13403         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
13404         valid tls_segment only for non-debug-section relocations.
13405         * testsuite/Makefile.am: Add gc_tls_test.
13406         * testsuite/Makefile.in: Regenerate.
13407         * testsuite/gc_tls_test.cc: New file.
13408         * testsuite/gc_tls_test.sh: New file.
13409
13410 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
13411
13412         * icf.cc: New file.
13413         * icf.h: New file.
13414         * Makefile.am (CCFILES): Add icf.cc.
13415         (HFILES): Add icf.h
13416         * Makefile.in: Regenerate.
13417         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
13418         * gc.h (gc_process_relocs): Populate lists used by icf to contain
13419         section, symbol and addend information for the relocs.
13420         * gold.cc (queue_middle_tasks): Call identical code folding.
13421         * gold.h: Add defines for multimap.
13422         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
13423         to the call of finalize_local_symbols.
13424         * main.cc (main): Create object of class Icf.
13425         * object.cc (Sized_relobj::do_layout): Allow this function to be
13426         called twice during icf.
13427         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
13428         to sections marked as identical by icf.
13429         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
13430         when available.
13431         (Sized_relobj::do_section_entsize): New function.
13432         * object.h (Object::section_entsize): New function.
13433         (Object::do_section_entsize): New pure virtual function.
13434         (Relobj::finalize_local_symbols): Add new parameter.
13435         (Relobj::do_section_entsize): New function.
13436         * options.h (General_options::icf): New option.
13437         (General_options::icf_iterations): New option.
13438         (General_options::print_icf_sections): New option.
13439         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
13440         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
13441         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
13442         icf.
13443         * symtab.cc (Symbol_table::is_section_folded): New function.
13444         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
13445         to sections marked as identical by icf.
13446         * symtab.h (Symbol_table::set_icf): New function.
13447         (Symbol_table::icf): New function.
13448         (Symbol_table::is_section_folded): New function.
13449         (Symbol_table::icf_): New data member.
13450         * target-reloc.h (relocate_section): Ignore sections folded by icf.
13451         * testsuite/Makefile.am: Add commands to build icf_test.
13452         * testsuite/Makefile.in: Regenerate.
13453         * testsuite/icf_test.sh: New file.
13454         * testsuite/icf_test.cc: New file.
13455
13456 2009-07-24  Chris Demetriou  <cgd@google.com>
13457
13458         * layout.cc (is_compressible_debug_section): Fix incorrect
13459         comment about compressed section names.
13460
13461 2009-07-20  Ian Lance Taylor  <ian@airs.com>
13462
13463         PR 10419
13464         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
13465
13466 2009-07-16  Ian Lance Taylor  <iant@google.com>
13467
13468         PR 10400
13469         * layout.h: #include <map>.
13470         (class Kept_section): Change from struct to class.  Add accessors
13471         and setters.  Add section size to Comdat_group mapping.  Change
13472         Comdat_group to std::map.  Add is_comdat_ field.  Add
13473         linkonce_size field in union.
13474         (class Layout): Update declaration of find_or_add_kept_section.
13475         Don't declare find_kept_object.
13476         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
13477         parameter.  Add object, shndx, is_comdat, and is_group_name
13478         parameters.  Change all callers.  Adjust for new Kept_section.
13479         (Layout::find_kept_object): Remove.
13480         * object.cc (Sized_relobj::include_section_group): Update use of
13481         Kept_section.  Rename secnum to shndx.  Only record
13482         Kept_comdat_section if sections are the same size.
13483         (Sized_relobj::include_linkonce_section): Update use of
13484         Kept_section.  Only record Kept_comdat_section if sections are the
13485         same size.  Set size of linkonce section.
13486         (Sized_relobj::map_to_kept_section): Update call to
13487         get_kept_comdat_section.
13488         * object.h (class Sized_relobj): Rename fields in
13489         Kept_comdat_section to drop trailing underscores; change object
13490         field to Relobj*.  Change Kept_comdat_section_table to store
13491         struct rather than pointer.
13492         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
13493         Add kept_object and kept_shndx parameters.  Change all callers.
13494         (Sized_relobj::get_kept_comdat_section): Change return type to
13495         bool.  Add kept_object and kept_shndx parameters.  Change all
13496         callers.
13497         * plugin.cc (Pluginobj::include_comdat_group): Update call to
13498         Layout::find_or_add_kept_section.
13499
13500 2009-07-09  Ian Lance Taylor  <iant@google.com>
13501
13502         * merge.cc (Object_merge_map::initialize_input_to_output_map):
13503         Reserve space in the hash table.
13504
13505 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
13506
13507         * fileread.cc (File_read::get_mtime): New method.
13508         * fileread.h (Timespec): New structure.
13509         (File_read::get_mtime): New method.
13510         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
13511         Renamed from timestamp_nsec.
13512         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
13513         Elf_Xword.
13514         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
13515         timestamp_nsec.
13516         (Incremental_inputs::report_archive): Save mtime; style fix.
13517         (Incremental_inputs::report_obejct): Save mtime; style fix.
13518         (Incremental_inputs::report_script): Save mtime; style fix.
13519         (Incremental_inputs::finalize_inputs): Style fix.
13520         (Incremental_inputs::finalize): Style fix.
13521         (Incremental_inputs::create_input_section_data): Store inputs
13522         mtime.
13523         * incremental.h (Incremental_inputs::report_script): Add mtime
13524         argument.
13525         (Incremental_inputs::Input_info::Input_info): Intialize only one
13526         union member.
13527         (Incremental_inputs::Input_info::archive): Move to nameless
13528         union.
13529         (Incremental_inputs::Input_info::obejct): Move to nameless union.
13530         (Incremental_inputs::Input_info::script): Move to nameless union.
13531         (Incremental_inputs::mtime): New field.
13532         * script.cc (read_input_script): Pass file mtime to
13533         Incremental_input.
13534         * script.h (Script_info::inputs): Style fix.
13535
13536 2009-07-01  Ian Lance Taylor  <ian@airs.com>
13537
13538         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
13539         instead of 32.
13540
13541 2009-06-24  Ian Lance Taylor  <iant@google.com>
13542
13543         PR 10156
13544         * layout.cc (Layout::choose_output_section): If we find an
13545         existing section, update the flags.
13546         (Layout::create_notes): New function, broken out of
13547         Layout::finalize.
13548         (Layout::finalize): Don't create note sections.
13549         (Layout::create_note): Don't crash if linker script discards
13550         section.
13551         (Layout::create_gold_note): Likewise.
13552         (Layout::create_build_id): Likewise.  Don't set
13553         after_input_sections on the section.
13554         (Layout::create_executable_stack_info): Remove target parameter.
13555         Change caller.
13556         * layout.h (class Layout): Declare create_notes.  Update
13557         declaration of create_executable_stack_info.
13558         * gold.cc (queue_middle_tasks): Call create_notes.
13559         * output.cc (Output_section::update_flags_for_input_section): Move
13560         here from output.h.  If SHF_ALLOC flag is newly set, mark address
13561         invalid.
13562         * output.h (Output_data::mark_address_invalid): New function.
13563         (class Output_section): Only declare, not define,
13564         update_flags_for_input_section.  Remove set_flags.
13565
13566 2009-06-24  Ian Lance Taylor  <iant@google.com>
13567
13568         * script-sections.cc (Output_section_definition::
13569         set_section_addresses): Rename shadowing local load_address to
13570         laddr.
13571
13572 2009-06-24  Ian Lance Taylor  <iant@google.com>
13573
13574         PR 10244
13575         * reloc.cc (relocate_sections): Skip empty relocation sections.
13576
13577 2009-06-23  Ian Lance Taylor  <iant@google.com>
13578
13579         PR 10156
13580         * layout.cc (Layout::create_note): Use choose_output_section
13581         rather than make_output_section.
13582
13583 2009-06-23  Ian Lance Taylor  <iant@google.com>
13584
13585         PR 10237
13586         * options.cc (General_options::parse_V): Set printed_version_.
13587         (General_options::General_options): Initialize printed_version_.
13588         * options.h (class General_options): Add printed_version_ field.
13589         * gold.cc (queue_initial_tasks): If there are no input files,
13590         don't give a fatal error if we printed the version information.
13591         (queue_middle_tasks): If using -r with a shared object, give a
13592         fatal error rather than an ordinary error.
13593
13594 2009-06-23  Ian Lance Taylor  <iant@google.com>
13595
13596         PR 10219
13597         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
13598         (Layout::make_output_section): Set have_stabstr_section_ if we see
13599         a .stab*str section.
13600         (Layout::finalize): Call link_stabs_sections.
13601         (Layout::link_stabs_sections): New file.
13602         * layout.h (class Layout): Add have_stabstr_section_ field.
13603         Declare link_stabs_sections.
13604
13605 2009-06-23  Doug Kwan  <dougkwan@google.com>
13606
13607         * Makefile.am (libgold_a_LIBADD): New.
13608         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
13609         * Makefile.in: Regenerate.
13610         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
13611         * configure: Regenerate.
13612         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
13613         * fileread.cc: Include sys/state.h
13614         * gold.h: Declare memmem and strndup if found missing.
13615         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
13616
13617 2009-06-23  Ian Lance Taylor  <iant@google.com>
13618
13619         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
13620         * configure: Rebuild.
13621
13622 2009-06-23  Ian Lance Taylor  <iant@google.com>
13623
13624         PR 10147
13625         * object.cc (Object::section_contents): Don't try to get a view if
13626         the section has length zero.
13627         (Object::handle_gnu_warning_section): If the section is empty, use
13628         the name of the section as the warning.
13629
13630 2009-06-23  Ian Lance Taylor  <iant@google.com>
13631
13632         PR 10133
13633         * stringpool.h (class Stringpool_template): Add optimize_ field.
13634         (Stringpool_template::set_optimize): New function.
13635         * stringpool.cc (Stringpool_template::Stringpool_template):
13636         Initialize optimize_ field.
13637         (Stringpool_template::set_string_offsets): Test local optimize
13638         fild rather than parameter.
13639         * layout.cc (Layout::Layout): Call set_optimize on the section
13640         name stringpool.
13641
13642 2009-06-22  Ian Lance Taylor  <iant@google.com>
13643
13644         PR 10030
13645         * yyscript.y: Parse TARGET.
13646         * script.cc (script_set_target): New function.
13647         * script-c.h (script_set_target): Declare.
13648         * options.cc (General_options::string_to_object_format): Rename
13649         from string_to_object_format in anonymous namespace.  Change
13650         callers.
13651         * options.h (class General_options): Declare
13652         string_to_object_format.
13653
13654 2009-06-22  Ian Lance Taylor  <iant@google.com>
13655
13656         * script-sections.cc (Script_sections::create_segments): Don't put
13657         program headers in a PT_LOAD segment if -n or -N.
13658
13659 2009-06-22  Ian Lance Taylor  <iant@google.com>
13660
13661         PR 10141
13662         * options.h (class General_options): Add -z lazy and -z now.  Sort
13663         -z options into alphabetical order.
13664         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
13665
13666 2009-06-21  Ian Lance Taylor  <iant@google.com>
13667
13668         * layout.cc (Layout::make_output_section): Call
13669         Target::new_output_section.
13670         (Layout::attach_allocated_section_to_segment): Put large section
13671         sections in a separate load segment with the large segment flag
13672         set.
13673         (Layout::segment_precedes): Sort large data segments after other
13674         load segments.
13675         (align_file_offset): New static function.
13676         (Layout::set_segment_offsets): Use align_file_offset.
13677         * output.h (class Output_section): Add is_small_section_ and
13678         is_large_section_ fields.
13679         (Output_section::is_small_section): New function.
13680         (Output_section::set_is_small_section):  New function.
13681         (Output_section::is_large_section): New function.
13682         (Output_section::set_is_large_section): New function.
13683         (Output_section::is_large_data_section): New function.
13684         (class Output_segment): Add is_large_data_segment_ field.
13685         (Output_segment::is_large_data_segment): New function.
13686         (Output_segment::set_is_large_data_segment): New function.
13687         * output.cc (Output_section::Output_section): Initialize new
13688         fields.
13689         (Output_segment::Output_segment): Likewise.
13690         (Output_segment::add_output_section): Add assertion that large
13691         data sections always go in large data segments.  Force small data
13692         sections to the end of the list of data sections.  Force small BSS
13693         sections to the start of the list of BSS sections.  For large BSS
13694         sections to the end of the list of BSS sections.
13695         * symtab.h (class Symbol): Declare is_common_shndx.
13696         (Symbol::is_defined): Check Symbol::is_common_shndx.
13697         (Symbol::is_common): Likewise.
13698         (class Symbol_table): Define enum Commons_section_type.  Update
13699         declarations.  Add small_commons_ and large_commons_ fields.
13700         * symtab.cc (Symbol::is_common_shndx): New function.
13701         (Symbol_table::Symbol_table): Initialize new fields.
13702         (Symbol_table::add_from_object): Put small and large common
13703         symbols in the right list.
13704         (Symbol_table::sized_finalized_symbol): Check
13705         Symbol::is_common_shndx.
13706         (Symbol_table::sized_write_globals): Likewise.
13707         * common.cc (Symbol_table::do_allocate_commons): Allocate new
13708         common symbol lists.  Don't call do_allocate_commons_list if the
13709         list is empty.
13710         (Symbol_table::do_allocate_commons_list): Remove is_tls
13711         parameter.  Add comons_section_type parameter.  Change all
13712         callers.  Handle small and large common symbols.
13713         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
13714         Symbol::is_common_shndx.
13715         * resolve.cc (symbol_to_bits): Likewise.
13716         * target.h (Target::small_common_shndx): New function.
13717         (Target::small_common_section_flags): New function.
13718         (Target::large_common_shndx): New function.
13719         (Target::large_common_section_flags): New function.
13720         (Target::new_output_section): New function.
13721         (Target::Target_info): Add small_common_shndx, large_common_shndx,
13722         small_common_section_flags, and large_common_section_flags
13723         fields.
13724         (Target::do_new_output_section): New virtual function.
13725         * arm.cc (Target_arm::arm_info): Initialize new fields.
13726         * i386.cc (Target_i386::i386_info): Likewise.
13727         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
13728         Likewise.
13729         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
13730         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13731         (Target_x86_64::do_new_output_section): New function.
13732         * configure.ac: Define conditional MCMODEL_MEDIUM.
13733         * testsuite/Makefile.am (check_PROGRAMS): Add large.
13734         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
13735         (large_LDFLAGS): Define.
13736         * testsuite/large.c: New file.
13737         * testsuite/testfile.cc (Target_test::test_target_info):
13738         Initialize new fields.
13739         * configure, testsuite/Makefile.in: Rebuild.
13740
13741 2009-06-05  Doug Kwan  <dougkwan@google.com>
13742
13743         * Makefile.am (CCFILES): Add target.cc.
13744         * Makefile.in: Regenerate.
13745         * i386.cc (class Target_i386): Define new virtual method to
13746         override do_is_local_label_name in parent.
13747         * object.cc (Sized_relobj::do_count_local_symbols): Discard
13748         local symbols if --discard-locals or -X is given.
13749         * options.h (class General_options): Declare new options
13750         '--discard-locals' and '-X' for discarding locals.
13751         * target.h (class Target): Define new methods is_local_label_name.
13752         Declare new virtual method do_is_local_label_name.
13753         * target.cc: New file.
13754         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
13755         (check_SCRIPTS): Add discard_locals_test.sh.
13756         (check_DATA): Add discard_local_tests.syms.
13757         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
13758         (discard_local_tests.syms, discard_locals_test.o): New make rules.
13759         * testsuite/Makefile.in: Regenerate.
13760         * testsuite/discard_locals_test.c: New file.
13761         * testsuite/discard_locals_test.sh: Same.
13762
13763 2009-06-05  Doug Kwan  <dougkwan@google.com>
13764
13765         * object.cc (Sized_relobj::Sized_relobj): Initialize
13766         discarded_eh_frame_shndx_ to -1U.
13767         (Sized_relobj::do_layout): Record index of a discard .eh_frame
13768         section.
13769         (Sized_relobj::do_count_local_symbols): Skip local symbols in
13770         a discarded .eh_frame section.
13771         (Sized_relobj::do_finalize_local_symbols): Ditto.
13772         * object.h (class Sized_relobj): Declare new member
13773         discarded_eh_frame_shndx_.
13774         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
13775         (local_labels_test.o, local_labels_test): New rules.
13776         * testsuite/Makefile.in: Regenerate.
13777
13778 2009-06-04  Doug Kwan  <dougkwan@google.com>
13779
13780         * layout.cc (Layout::section_name_mapping): Add mapping for
13781         special ARM sections.
13782
13783 2009-06-03  Doug Kwan  <dougkwan@google.com>
13784
13785         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
13786         (utils::has_overflow): Same.
13787
13788 2009-06-03  Ian Lance Taylor  <iant@google.com>
13789
13790         * layout.cc (Layout::section_name_mapping): New array, replacing
13791         Layout::linkonce_mapping.
13792         (Layout::section_name_mapping_count): New variable, replacing
13793         Layout::linkonce_mapping_count.
13794         (Layout::linkonce_output_name): Remove.
13795         (Layout::output_section_name): Rewrite.
13796         * layout.h (class Layout): Rename Linkonce_mapping to
13797         Section_name_mapping, linkonce_mapping to section_name_mapping,
13798         linkonce_mapping_count to section_name_mapping_count.  Don't
13799         declare linkonce_output_name.
13800
13801 2009-06-03  Doug Kwan  <dougkwan@google.com>
13802
13803         * gold/arm.cc (namespace utils): New.
13804         (Target_arm::reloc_is_non_pic): Define new method.
13805         (class Arm_relocate_functions): New.
13806         (Target_arm::Relocate::relocate): Handle relocation types used by
13807         Android.
13808
13809 2009-06-03  Ian Lance Taylor  <iant@google.com>
13810
13811         * arm.cc (Target_arm::scan::global): Use || instead of |.
13812
13813 2009-06-02  Doug Kwan  <dougkwan@google.com>
13814
13815         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
13816         issued_non_pic_error_.
13817         (class Target_arm::Scan): Declare new method check_non_pic.
13818         Define new method symbol_needs_plt_entry.
13819         Declare new data member issued_non_pic_error_.
13820         (class Target_arm::Relocate): Declare new method
13821         should_apply_static_reloc.
13822         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
13823         (Target_arm::Scan::check_non_pic): Define new method.
13824         (Target_arm::Scan::local): Handle a small subset of reloc types used
13825         by Android.
13826         (Target_arm::Scan::local): Same.
13827         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
13828
13829 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
13830
13831         * incremental.cc (Incremental_inputs::report_command_line): Filter
13832         out --incremental-* options.
13833
13834 2009-05-29  Doug Kwan  <dougkwan@google.com>
13835
13836         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
13837         template class.
13838         (class Target_arm): Update comment.
13839         (Target_arm::Target_arm): Initialize new data members GOT_,
13840         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
13841         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
13842         and Target_arm::rel_dyn_section.
13843         Declare new_enum Target_arm::Got_type.
13844         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
13845         and DYNBSS_.
13846         Update commments for member do_dynsym_value.
13847         (Target_arm::got_size, Target_arm::plt_section,
13848         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
13849         new methods inside class defintion.
13850         (Target_arm::got_section): Define new method.
13851         (Target_arm::rel_dyn_section): Same.
13852         (Output_data_plt_arm): New template class.
13853         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
13854         (Output_data_plt_arm:do_adjust_output_section): Define new method.
13855         (Output_data_plt_arm::add_entry): Same.
13856         (Output_data_plt_arm::first_plt_entry): Define new
13857         static data member for PLT instruction template.
13858         (Output_data_plt_arm::plt_entry): Same.
13859         (Output_data_plt_arm::do_write): Define new method.
13860         (Target_arm::make_plt_entry): Same.
13861         (Target_arm::do_finalize_sections): Same.
13862         (Target_arm::do_dynsym_value): Same.
13863
13864 2009-05-28  Doug Kwan  <dougkwan@google.com>
13865
13866         * Makefile.am (TARGETSOURCES): Add arm.cc.
13867         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
13868         * Makefile.in: Regenerate.
13869         * arm.cc: New file.
13870         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
13871
13872 2009-05-26  Doug Kwan  <dougkwan@google.com>
13873
13874         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
13875         (General_options::check_excluded_libs): Strip off directories in
13876         archive name before matching like GNU ld does.
13877         * testsuite/Makefile.am (MOSTLYCLEANFILES,
13878         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
13879         (exclude_libs_test_LDFLAGS): Add linker option
13880         -Wl,--exclude-libs,libexclude_libs_test_3
13881         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
13882         an explicit archive without using -l.
13883         (alt/libexclude_libs_test_3.a): New make rule.
13884         * testsuite/Makefile.in: Regenerate.
13885         * testsuite/exclude_libs_test.c : Declare lib3_default().
13886         (main): Call it.
13887         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
13888         * exclude_libs_test_3.c: New file.
13889
13890 2009-05-26  Nick Clifton  <nickc@redhat.com>
13891
13892         * po/id.po: New Indonesian translation.
13893         * po/gold.pot: Updated template file.
13894
13895 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
13896
13897         * testsuite/Makefile.am: Add -ffunction-sections to compile
13898         gc_comdat_test files.  Add -Wl,--gc-sections to build
13899         gc_comdat_test.
13900         * testsuite/Makefile.in: Regenerate.
13901         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
13902
13903 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
13904
13905         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
13906         kept comdat section was garbage collected.
13907         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
13908         * testsuite/Makefile.in: Regenerate.
13909         * testsuite/gc_comdat_test.sh: New file.
13910         * testsuite/gc_comdat_test_1.cc: New file.
13911         * testsuite/gc_comdat_test_2.cc: New file.
13912
13913 2009-05-19  Doug Kwan  <dougkwan@google.com>
13914
13915         * archive.cc (Archive::Archive): Move constructor from archive.h
13916         to here.  Initialize no_export_.
13917         (Archive::get_elf_object_for_member): Set no_export flag of object.
13918         * archive.h (Archive::Archive): Move constructor body to
13919         archive.cc.
13920         (Archive::no_export): New method.
13921         (Archive::no_export_): New field.
13922         * object.h (Object::Object): Initialize no_export_ to false.
13923         (Object::no_export, Object::set_no_export): New methods.
13924         (Object::no_export_): New field.
13925         * options.cc (General_options::parse_exclude_libs): New method.
13926         (General_options::check_excluded_libs) Same.
13927         * options.h (exclude_libs): New option.
13928         (General_options::check_excluded_libs): New method declaration.
13929         (General_options::excluded_libs_): New field.
13930         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
13931         default or protected visibility if an object has no-export flag set.
13932         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
13933         (check_SCRIPTS): Add exclude_libs_test.sh.
13934         (check_DATA): Add exclude_libs_test.syms.
13935         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
13936         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
13937         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
13938         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
13939         (exclude_libs_test.syms, libexclude_libs_test_1.a,
13940         libexclude_libs_test_2.a): New rules.
13941         * testsuite/Makefile.in: Regenerate.
13942         * testsuite/exclude_libs_test.c: New file.
13943         * testsuite/exclude_libs_test.sh: Ditto.
13944         * testsuite/exclude_libs_test_1.c: Ditto.
13945         * testsuite/exclude_libs_test_2.c: Ditto.
13946
13947 2009-05-15  Ian Lance Taylor  <iant@google.com>
13948
13949         * configure.ac: Check for declarations for cases where libiberty.h
13950         checks HAVE_DECL_xxx.
13951         * configure, config.in: Rebuild.
13952
13953 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
13954
13955         * gold.h (Incremental_argument_list): Remove (invalid) forward
13956         declaration.
13957         * incremental.cc (Incremental_inputs::report_achive): New method.
13958         (Incremental_inputs::report_object): New method.
13959         (Incremental_inputs::report_script): New method.
13960         (Incremental_inputs::finalize_inputs): New method.
13961         (Incremental_inputs::finalize): Call finalize_inputs().
13962         (Incremental_inputs::sized_create_incremental_inputs_section_data):
13963         Create inputs entries.
13964         * incremental.h (Incremental_input_type): New enum.
13965         (Incremental_inputs::Incremental_input): Initialize new fields.
13966         (Incremental_inputs::report_inputs): New method.
13967         (Incremental_inputs::report_achive): New method.
13968         (Incremental_inputs::report_object): New method.
13969         (Incremental_inputs::report_script): New method.
13970         (Incremental_inputs::finalize_inputs): New method.
13971         (Incremental_inputs::Input_info): New struct.
13972         (Incremental_inputs::Input_info_map): New typedef.
13973         (Incremental_inputs::lock_): New field.
13974         (Incremental_inputs::Inputs_): New field.
13975         (Incremental_inputs::Inputs_map): New field.
13976         * main.cc (main): Call Incremental_input::report_inputs.
13977         * options.h (Input_argument_list): Typedef moved from
13978         Input_arguments.
13979         (Input_file_group::Files): Remove, use ::Input_argument_list.
13980         (Input_file_group::Input_argument_list): Remove, use
13981         ::Input_argument_list.
13982         * plugin.cc (Plugin_manager::add_input_file): Add error in
13983         incremental build.
13984         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13985         functions.
13986         * script.cc (read_input_script): Call
13987         Incremental_input::report_script.
13988         * script.h (Script_info): New class.
13989
13990 2009-04-27  Ian Lance Taylor  <iant@google.com>
13991
13992         * x86_64.cc (do_adjust_output_section): Set entsize to
13993         plt_entry_size.
13994
13995 2009-04-23  Elliott Hughes  <enh@google.com>
13996
13997         * output.cc (Output_file::close): After short writes, continue
13998         writing from the correct offset in the buffer being written.
13999
14000 2009-04-23  Chris Demetriou  <cgd@google.com>
14001
14002         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
14003         * configure: Regenerate.
14004         * config.in: Regenerate.
14005         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
14006         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
14007
14008 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
14009
14010         * incremental.cc (Incremental_inputs_header_data): Renamed from
14011         Incremental_input_header_data.
14012         (Incremental_inputs_header_data::data_size): New field.
14013         (Incremental_inputs_header_data::put_input_file_count): Renamed
14014         from input_file_count.
14015         (Incremental_inputs_header_data::put_command_line_offset): Renamed
14016         from command_line_offset.
14017         (Incremental_inputs_header_data::put_reserved): Renamed from
14018         put_reserved.
14019         (Incremental_inputs_entry_data): Renamed from
14020         Incremental_input_entry_data.
14021         (Incremental_inputs_entry_data::data_size): New field.
14022         (Incremental_inputs::report_command_line): New method.
14023         (Incremental_inputs::finalize): New method.
14024         (Incremental_inputs::create_incremental_inputs_data): New method.
14025         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
14026         * incremental.h: New file.
14027         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
14028         (Layout::finalize): Create incremental inputs section in
14029         incremental builds.
14030         (Layout::create_incremental_info_sections): New method.
14031         * layout.h (Layout::incremental_inputs): New method.
14032         (Layout::create_incremental_info_sections): New method.
14033         (Layout::incremental_inputs_): New field.
14034         * main.cc (main): Notify Incremental_input of the command line.
14035
14036 2009-04-01  Ian Lance Taylor  <iant@google.com>
14037             Mikolaj Zalewski  <mikolajz@google.com>
14038
14039         * gold.h (reserve_unordered_map): Define, three versions, one for
14040         each version of Unordered_map.
14041         * layout.cc (Layout::Layout): Remove options parameter.  Add
14042         number_of_input_files parameter.  Don't initialize options_.
14043         Initialize number_of_input_files_ and resized_signatures_.  Move
14044         sections_are_attached_.
14045         (Layout::layout_group): Reserve space for group_signatures_.
14046         (Layout::find_or_add_kept_section): Change name parameter to be a
14047         reference.  Resize signatures_ map when it gets large enough.
14048         (Layout::layout_eh_frame): Use parameters->options() instead of
14049         this->options_.
14050         (Layout::make_output_section): Likewise.
14051         (Layout::attach_allocated_section_to_segment): Likewise.
14052         (Layout::finalize, Layout::create_executable_stack): Likewise.
14053         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
14054         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
14055         * layout.h (class Layout): Update declarations.  Remove options_
14056         field.  Add number_of_input_files_ and resized_signatures_
14057         fields.  Move sections_are_attached_ field.
14058         * main.cc (main): Pass number of input files to Layout
14059         constructor.  Don't pass options.
14060
14061 2009-03-30  Ian Lance Taylor  <iant@google.com>
14062
14063         * ffsll.c (ffsll): Correct implementation.
14064
14065 2009-03-27  Ian Lance Taylor  <iant@google.com>
14066
14067         * ffsll.c: New file.
14068         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
14069         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
14070         * ftruncate.c (ftruncate): Declare before definition.
14071         * mremap.c (mremap): Likewise.
14072         * pread.c (pread): Likewise.
14073         * configure, Makefile.in, config.in: Rebuild.
14074
14075         * mremap.c: New file.
14076         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
14077         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
14078         (mremap): Declare if HAVE_MREMAP is not defined.
14079         * configure, Makefile.in, config.in: Rebuild.
14080
14081 2009-03-27  Cary Coutant  <ccoutant@google.com>
14082
14083         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
14084         position independent.
14085         * sparc.cc (Target_sparc::check_non_pic): Likewise.
14086         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
14087
14088 2009-03-24  Cary Coutant  <ccoutant@google.com>
14089
14090         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
14091         an executable.
14092         (needs_dynamic_reloc): Likewise.
14093
14094 2009-03-24  Ian Lance Taylor  <iant@google.com>
14095
14096         * yyscript.y (file_cmd): Recognize EXTERN.
14097         (extern_name_list, extern_name_list_body): New nonterminals.
14098         * script.cc (script_add_extern): Define.
14099         * script-c.h (script_add_extern): Declare.
14100
14101 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
14102
14103         * object.cc (is_elf_object): Define.
14104         * object.h (is_elf_object): Declare.
14105         * archive.cc (Archive::get_elf_object_for_member): Call
14106         is_elf_object.
14107         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
14108
14109 2009-03-24  Elliott Hughes  <enh@google.com>
14110
14111         * output.cc (Output_file::map_anonymous): Define.
14112         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
14113         try an anonymous one.  Report the size if the mmap fails.
14114         * output.h (class Output_file): Declare map_anonymous.
14115
14116 2009-03-24  Ian Lance Taylor  <iant@google.com>
14117
14118         * target-select.cc (instantiate_target): Don't acquire the lock if
14119         the instantiated_target_ field has already been set.
14120
14121 2009-03-23  Ian Lance Taylor  <iant@google.com>
14122
14123         * gold-threads.h (class Initialize_lock): Define.
14124         * gold-threads.cc (class Initialize_lock_once): Define.
14125         (initialize_lock_control): New static variable.
14126         (initialize_lock_pointer): New static variable.
14127         (initialize_lock_once): New static function.
14128         (Initialize_lock::Initialize_lock): Define.
14129         (Initialize_lock::initialize): Define.
14130         * target-select.h: Include "gold-threads.h".
14131         (class Target_selector): Add lock_ and initialize_lock_ fields.
14132         Don't define instantiate_target, just declare it.
14133         * target-select.cc (Target_selector::Target_selector): Initialize
14134         new fields.
14135         (Target_selector::instantiate_target): Define.
14136         * descriptors.h: Include "gold-threads.h".
14137         (class Descriptors): Add initialize_lock_ field.
14138         * descriptors.cc (Descriptors::Descriptors): Initialize new
14139         field.
14140         (Descriptors::open): Use initialize_lock_ field
14141         * errors.h (class Errors): Add initialize_lock_ field.
14142         * errors.cc (Errors::Errors): Initialize new field.
14143         (Errors::initialize_lock): Use initialize_lock_ field.
14144         * powerpc.cc (class Target_selector_powerpc): Remove
14145         instantiated_target_ field.  In do_recognize call
14146         instantiate_target rather than do_instantiate_target.  In
14147         do_instantiate_target just allocate a new target.
14148         * sparc.cc (class Target_selector_sparc): Likewise.
14149
14150         * freebsd.h: New file.
14151         * i386.cc: Include "freebsd.h".
14152         (Target_i386): Derive from Target_freebsd rather than
14153         Sized_target.
14154         (Target_selector_i386): Derive from Target_selector_freebsd rather
14155         than Target_selector.
14156         * x86_64.cc: Include "freebsd.h".
14157         (Target_x86_64): Derive from Target_freebsd rather than
14158         Sized_target.
14159         (Target_selector_x86_64): Derive from Target_selector_freebsd
14160         rather than Target_selector.
14161         * target.h (class Target): Add adjust_elf_header and
14162         do_adjust_elf_header.
14163         * output.cc (Output_file_header:: do_sized_write): Call target
14164         adjust_elf_header routine.
14165         * configure.tgt: Set targ_osabi.
14166         * configure.ac: Define GOLD_DEFAULT_OSABI.
14167         * parameters.cc (Parameters::default_target): Pass
14168         GOLD_DEFAULT_OSABI to select_target.
14169         * target-select.h (class Target_selector): Make instantiate_target
14170         protected rather than private.
14171         * Makefile.am (HFILES): Add freebsd.h.
14172         * configure, Makefile.in, config.in: Rebuild.
14173
14174         * merge.cc (do_add_input_section): Correct pend value.  Change
14175         message about last entry not being null terminated from error to
14176         warning.
14177
14178 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
14179
14180         * incremental.cc: New file.
14181         * Makefile.am (CCFILES): Add incremental.cc.
14182         * Makefile.in: Rebuild.
14183
14184 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
14185
14186         * layout.cc (Layout::output_section_name): Preserve names
14187         of '.note.' sections.
14188
14189 2009-03-19  Ian Lance Taylor  <iant@google.com>
14190
14191         * descriptors.cc (Descriptors::open): Check that the options are
14192         valid before using them.
14193
14194 2009-03-18  Ian Lance Taylor  <iant@google.com>
14195
14196         * script-sections.h: Include <list>.
14197         (class Script_sections): Change Sections_elements from std::vector
14198         to std::list.  Typedef public Elements_iterator.  Add
14199         orphan_section_placement_, data_segment_align_start_, and
14200         saw_data_segment_align_ fields.  Remove data_segment_align_index_
14201         field.
14202         * script-sections.cc (class Orphan_section_placement): New class.
14203         (class Sections_element): Add virtual functions is_relro and
14204         orphan_section_init.  Remove virtual function place_orphan_here.
14205         (class Output_section_definition): Add is_relro and
14206         orphan_section_init.  Remove place_orphan_here.
14207         (class Orphan_output_section): Likewise.
14208         (Script_sections::Script_sections): Update for field changes.
14209         (Script_sections::data_segment_align): Set saw_data_segment_align_
14210         and data_segment_align_start_, not data_segment_align_index.
14211         (Script_sections::data_segment_relro_end): Check
14212         saw_data_segment_align_.  Use data_segment_align_start_ rather
14213         than data_segment_align_index_.
14214         (Script_sections::place_orphan): Rewrite to use
14215         Orphan_section_placement.
14216
14217 2009-03-17  Ian Lance Taylor  <iant@google.com>
14218
14219         * archive.cc (Archive::add_symbols): Check for a version attached
14220         to the symbol name in the archive map.
14221         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
14222         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
14223         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
14224         (ver_test_11.a): New target.
14225         * testsuite/Makefile.in: Rebuild.
14226
14227         * configure.ac: Check for chsize and posix_fallocate.  Replace
14228         ftruncate.
14229         * ftruncate.c: New file, from gnulib.
14230         * output.cc (posix_fallocate): Define dummy version if not
14231         HAVE_POSIX_FALLOCATE.
14232         (Output_file::map): Call posix_fallocate rather than lseek and
14233         write.
14234         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
14235         * configure, Makefile.in, config.in: Rebuild.
14236
14237 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
14238
14239         * layout.h (Layout::create_note): Add section_name parameter.
14240         * layout.cc (Layout::create_note): Likewise.
14241         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
14242
14243 2009-03-17  Ian Lance Taylor  <iant@google.com>
14244
14245         * descriptors.cc: Include "options.h".
14246         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
14247         (Descriptors::open): Always use O_CLOEXEC when opening a new
14248         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
14249         then set FD_CLOEXEC.
14250
14251         * sparc.cc (class Target_sparc): Add has_got_section.
14252         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
14253         make sure we have a GOT section.
14254
14255         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
14256         (Target_sparc::Scan::local): Likewise.
14257         (Target_sparc::Scan::global): Likewise.
14258         (Target_sparc::Relocate::relocate): Likewise.
14259         (Target_sparc::Relocate::relocate_tls): Likewise.
14260
14261         * symtab.cc (Symbol_table::define_default_version): New function,
14262         broken out of add_from_object.
14263         (Symbol_table::add_from_object): Call define_default_version.
14264         (Symbol_table::define_special_symbol): Add resolve_oldsym
14265         parameter.  Change all callers.  If the version for a symbol comes
14266         from a version script, resolve it with the symbol with the same
14267         name with no version.  Also add the symbol without a version if
14268         appropriate.
14269         (do_define_in_output_data): If resolving with oldsym, don't delete
14270         sym.
14271         (do_define_in_output_segment): Likewise.
14272         (do_define_as_constant): Likewise.
14273         * symtab.h (class Symbol_table): Update declarations.
14274
14275 2009-03-13  Ian Lance Taylor  <iant@google.com>
14276
14277         * readsyms.cc (Read_symbols::incompatible_warning): New function.
14278         (Read_symbols::requeue): New function.
14279         (Read_symbols::do_read_symbols): If make_elf_object fails because
14280         the target type is not configured, and the file was searched for,
14281         issue a warning and retry with the next directory.
14282         (Add_symbols::run): If the file has an incompatible format, and
14283         it was searched for, requeue the Read_symbols task.  On error,
14284         release the object.
14285         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
14286         dirindex parameter to constructor.  Change all callers.  Declare
14287         incompatible_warning and requeue.
14288         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
14289         input_argument_ and input_group_ fields.  Add them to
14290         constructor.  Change all callers.
14291         (class Read_script): Add dirindex_ field.  Add it to constructor.
14292         Change all callers.
14293         * archive.cc (Archive::setup): Remove input_objects parameter.
14294         Change all callers.
14295         (Archive::get_file_and_offset): Likewise.
14296         (Archive::read_all_symbols): Likewise.
14297         (Archive::read_symbols): Likewise.
14298         (Archive::get_elf_object_for_member): Remove input_objects
14299         parameter.  Add punconfigured parameter.  Change all callers.
14300         (Archive::add_symbols): Change return type to bool.  Check return
14301         value of include_member.
14302         (Archive::include_all_members): Likewise.
14303         (Archive::include_member): Change return type to bool.  Return
14304         false if first included object has incompatible target.  Set
14305         included_member_ field.
14306         (Add_archive_symbols::run): If add_symbols returns false, requeue
14307         Read_symbols task.
14308         * archive.h (class Archive): Add included_member_ field.
14309         Initialize it in constructor.  Add input_file and searched_for
14310         methods.  Update declarations.
14311         (class Add_archive_symbols): Add dirpath_, dirindex_, and
14312         input_argument_ fields.  Add them to constructor.  Change all
14313         callers.
14314         * script.cc: Include "target-select.h".
14315         (class Parser_closure): Add skip_on_incompatible_target_ and
14316         found_incompatible_target_ fields.  Add
14317         skip_on_incompatible_target parameter to constructor.  Change all
14318         callers.  Add methods skip_on_incompatible_target,
14319         clear_skip_on_incompatible_target, found_incompatible_target, and
14320         set_found_incompatible_target.
14321         (read_input_script): Add dirindex parameter.  Change all callers.
14322         If parser finds an incompatible target, requeue Read_symbols
14323         task.
14324         (script_set_symbol): Clear skip_on_incompatible_target in
14325         closure.
14326         (script_add_assertion, script_parse_option): Likewise.
14327         (script_start_sections, script_add_phdr): Likewise.
14328         (script_check_output_format): New function.
14329         * script.h (read_input_script): Update declaration.
14330         * script-c.h (script_check_output_format): Declare.
14331         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
14332         (ignore_cmd): Remove OUTPUT_FORMAT.
14333         * fileread.cc (Input_file::Input_file): Add explicit this.
14334         (Input_file::will_search_for): New function.
14335         (Input_file::open): Add pindex parameter.  Change all callers.
14336         * fileread.h (class Input_file): Add input_file_argument method.
14337         Declare will_search_for.  Update declarations.
14338         * object.cc (make_elf_object): Add punconfigured parameter.
14339         Change all callers.
14340         * object.h (class Object): Make input_file public.  Add
14341         searched_for method.
14342         (make_elf_object): Update declaration.
14343         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
14344         restart search.
14345         * dirsearch.h (class Dirsearch): Update declaration.
14346         * options.h (class General_options): Add --warn-search-mismatch.
14347         * parameters.cc (Parameters::is_compatible_target): New function.
14348         * parameters.h (class Parameters): Declare is_compatible_target.
14349         * workqueue.cc (Workqueue::add_blocker): New function.
14350         * workqueue.h (class Workqueue): Declare add_blocker.
14351
14352         * fileread.cc (Input_file::open): Remove options parameter.
14353         Change all callers.
14354         (Input_file::open_binary): Likewise.
14355         * script.cc (read_input_script): Likewise.
14356         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
14357         options parameter from constructor.  Change all callers.
14358         (class Read_script): Likewise.
14359         * fileread.h (class Input_file): Update declarations.
14360         * script.h (read_input_script): Update declaration.
14361
14362 2009-03-10  Nick Clifton  <nickc@redhat.com>
14363
14364         * po/es.po: New Spanish translation.
14365
14366 2009-03-06  Cary Coutant  <ccoutant@google.com>
14367
14368         * options.cc (parse_short_option): Keep dash_z from registering itself.
14369
14370 2009-03-03  Ian Lance Taylor  <iant@google.com>
14371
14372         PR 9918
14373         * target-reloc.h (relocate_section): Pass output_section to
14374         relocate.
14375         * i386.cc (Target_i386::should_apply_static_reloc): Add
14376         output_section parameter.  Change all callers.
14377         (Target_i386::Relocate::relocate): Add output_section parameter.
14378         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14379         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
14380         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
14381         * testsuite/two_file_shared.sh: New script.
14382         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
14383         (check_DATA): Add two_file_shared.dbg.
14384         (two_file_shared.dbg): New target.
14385         * testsuite/Makefile.in: Rebuild.
14386
14387 2009-03-01  Ian Lance Taylor  <iant@google.com>
14388
14389         * configure.ac: Check for byteswap.h.
14390         * configure: Rebuild.
14391         * config.in: Rebuild.
14392
14393 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
14394
14395         * layout.cc (Layout::find_or_add_kept_section): New function.
14396         (Layout::add_comdat): Removed.
14397         * layout.h (struct Kept_section): Move out of class Layout.
14398         Remove trailing underscores from field names.  Add group_sections
14399         field.  Rename group_ field to is_group.  Change all uses.
14400         (class Layout): Declare find_or_add_kept_section, not add_comdat.
14401         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
14402         comdat_groups_ field.
14403         (Sized_relobj::include_section_group): Use
14404         find_or_add_kept_section and Kept_section::group_sections.
14405         (Sized_relobj::include_linkonce_section): Likewise.
14406         * object.cc (class Sized_relobj): Don't define Comdat_group or
14407         Comdat_group_table.  Remove find_comdat_group and
14408         add_comdat_group.  Remove comdat_groups_ field.
14409         * plugin.cc (include_comdat_group): Use
14410         Layout::find_or_add_kept_section.
14411
14412 2009-02-28  Ian Lance Taylor  <iant@google.com>
14413
14414         * README: --gc-sections and map files are now supported.  Document
14415         some build requirements.
14416
14417         PR 6992
14418         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
14419         relocatable link set the value of the section symbol to zero.
14420         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
14421         relocatable link don't include the section address in the local
14422         symbol value.
14423
14424 2009-02-27  Ian Lance Taylor  <iant@google.com>
14425
14426         PR 6811
14427         * options.h (class Search_directory): Add is_system_directory.
14428         (class General_options): Declare is_in_system_directory.
14429         * options.cc (get_relative_sysroot): Make static.
14430         (get_default_sysroot): Make static.
14431         (General_optoins::is_in_system_directory): New function.
14432         * fileread.cc (Input_file::is_in_system_directory): New function.
14433         * fileread.h (class Input_file): Declare is_in_system_directory.
14434         * object.h (class Object): Add is_in_system_directory.
14435         (class Input_objects): Remove system_library_directory_ field.
14436         * object.cc (Input_objects::add_object): Don't set
14437         system_library_directory_.
14438         (input_objects::found_in_system_library_directory): Remove.
14439         * symtab.cc (Symbol_table::write_globals): Remove input_objects
14440         parameter.  Change all callers.
14441         (Symbol_table::sized_write_globals): Likewise.
14442         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
14443         Call Object::is_in_system_directory.
14444         * symtab.h (class Symbol_table): Update declarations.
14445
14446         PR 5990
14447         * descriptors.h (Open_descriptor): Add is_on_stack field.
14448         * descriptors.cc (Descriptors::open): If the descriptor is on the
14449         top of the stack, remove it.  Initialize is_on_stack field.
14450         (Descriptors::release): Only add pod to stack if it is not on the
14451         stack already.
14452         (Descriptors::close_some_descriptor): Clear stack_next and
14453         is_on_stack fields.
14454
14455         PR 7091
14456         * output.cc (Output_section::find_starting_output_address): Rename
14457         from starting_output_address; add PADDR parameter; change return
14458         type.
14459         * output.h (class Output_section): Declare
14460         find_starting_output_address instead of starting_output_address.
14461         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
14462         section symbol for which we can't find a merge section.
14463
14464         PR 9836
14465         * symtab.cc (Symbol_table::add_from_object): If the visibility is
14466         hidden or internal, force the symbol to be local.
14467         * resolve.cc (Symbol::override_visibility): Define.
14468         (Symbol::override_base): Use override_visibility.
14469         (Symbol_table::resolve): Likewise.
14470         (Symbol::override_base_with_special): Likewise.
14471         (Symbol_table::override_with_special): If the visibility is hidden
14472         or internal, force the symbol to be local.
14473         * symtab.h (class Symbol): Add set_visibility and
14474         override_visibility.
14475         * testsuite/ver_test_1.sh: New file.
14476         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
14477         (check_DATA): Add ver_test_1.syms.
14478         (ver_test_1.syms): New target.
14479         * testsuite/Makefile.in: Rebuild.
14480
14481 2009-02-25  Cary Coutant  <ccoutant@google.com>
14482
14483         * layout.cc (Layout::choose_output_section): Don't rename sections
14484         when using a linker script that has a SECTIONS clause.
14485         * Makefile.in: Regenerate.
14486
14487         * testsuite/Makefile.am (script_test_5.sh): New test case.
14488         * testsuite/Makefile.in: Regenerate.
14489         * testsuite/script_test_5.cc: New file.
14490         * testsuite/script_test_5.sh: New file.
14491         * testsuite/script_test_5.t: New file.
14492
14493 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
14494
14495         * archive.cc (Archive::include_member): Update calls to add_symbols.
14496         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
14497         the Layout argument.
14498         * dynobj.h (do_add_symbols): Add the Layout argument.
14499         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
14500         Layout argument.
14501         * object.h (Object::add_symbols): Add the Layout argument.
14502         (Object::do_add_symbols): Add the Layout argument.
14503         (Sized_relobj::do_add_symbols): Add the Layout argument.
14504         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
14505         Unify the two versions.
14506         (Add_plugin_symbols): Remove.
14507         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
14508         (Sized_pluginobj::do_add_symbols): Unify the two versions.
14509         (Add_plugin_symbols): Remove.
14510         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
14511         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
14512         (Add_symbols::run): Make it work with Pulginobj.
14513
14514 2009-02-06  Ian Lance Taylor  <iant@google.com>
14515
14516         * object.cc (Sized_relobj::do_layout): Make info message start
14517         with lower case letter.
14518
14519 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
14520
14521         * binary.cc: Fix file comment.
14522
14523         * options.h (enum Incremental_disposition): Define.
14524         (class General_options): Add new options: --incremental,
14525         --incremental_changed, --incremental_unchanged,
14526         --incremental_unknown.  Add incremental_disposition_ and
14527         implicit_incremental_ fields.
14528         (General_options::incremental_disposition): New function.
14529         (class Position_dependent_options): Add incremental_disposition
14530         option.
14531         (Position_dependent_options::copy_from_options): Set incremental
14532         dispositions.
14533         * options.cc (General_options::parse_incremental_changed): New
14534         function.
14535         (General_options::parse_incremental_unchanged): New function.
14536         (General_options::parse_incremental_unknown): New function.
14537         (General_options::General_options): Initialize new fields
14538         incremental_disposition_ and implicit_incremental_.
14539         (General_options::finalize): Check for uasge of --incremental-*
14540         without --incremental.
14541
14542 2009-02-06  Chris Demetriou  <cgd@google.com>
14543
14544         * gold.h (gold_undefined_symbol): Change to take only a Symbol
14545         pointer and to report location as the file name associated with
14546         the symbol.
14547         (gold_undefined_symbol_at_location): New function to replace the
14548         old gold_undefined_symbol functionality.
14549         * target-reloc.h (relocate_section): Update to use
14550         gold_undefined_symbol_at_location.
14551         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14552         Call gold_undefined_symbol function rather than gold_error.
14553         * errors.h (Errors::undefined_symbol): Take location as a
14554         string, rather than calculating it from a relocation.
14555         * errors.cc (Errors::fatal): Print "fatal error:" before the
14556         formatted message.
14557         (Errors::error, Errors::error_at_location): Print "error: "
14558         before the formatted message.
14559         (Errors::undefined_symbol): Take location as a string, rather
14560         than calculating it from a relocation.
14561         (gold_undefined_symbol_at_location): New function akin to
14562         old gold_undefined_symbol, calculates location from relocation.
14563         (gold_undefined_symbol): Change to take only a Symbol pointer
14564         and to report location as the file name associated with the symbol.
14565         * testsuite/debug_msg.sh: Update for changed error messages.
14566         * testsuite/undef_symbol.sh: Likewise.
14567
14568 2009-02-04  Duncan Sands  <baldrick@free.fr>
14569
14570         PR 9812
14571         * reduced_debug_output.h
14572         (Output_reduced_debug_abbrev_section::failed): Use format for
14573         gold_warning.
14574         (Output_reduced_debug_info_section::faild): Likewise.
14575
14576 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
14577
14578         * script.cc (Lazy_demangler): New class.
14579         (Version_script_info::get_symbol_version_helper): Demangle a
14580         symbol only once.
14581
14582 2009-01-29  Cary Coutant  <ccoutant@google.com>
14583
14584         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
14585         to __tls_get_addr.
14586         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14587
14588 2009-01-28  Ian Lance Taylor  <iant@google.com>
14589
14590         * version.cc (version_string): Bump to 1.9.
14591
14592         * gold.h: Include <cstring> and <stdint.h>.
14593         * version.cc: Include <cstdio>.
14594         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
14595         warning.
14596         * reduced_debug_output.cc (insert_into_vector): Rename from
14597         Insert_into_vector; change all callers.  Use Swap_unaligned to
14598         avoid aliasing issue; remove union since it is unnecessary.
14599
14600 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
14601
14602         * Makefile.am (CCFILES): Add gc.cc.
14603         (HFILES): Add gc.h.
14604         * Makefile.in: Regenerate.
14605         * gold.cc (Gc_runner): New class.
14606         (queue_initial_tasks): Call garbage collection related tasks
14607         when corresponding options are invoked.
14608         (queue_middle_gc_tasks): New function.
14609         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
14610         processed early before laying out sections during garbage collection.
14611         * gold.h (queue_middle_gc_tasks): New function.
14612         (is_prefix_of): Move from "layout.cc".
14613         * i386.cc (Target_i386::gc_process_relocs): New function.
14614         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
14615         * main.cc (main): Create object of class "Garbage_collection".
14616         * object.cc (Relobj::copy_symbols_data): New function.
14617         (Relobj::is_section_name_included): New function.
14618         (Sized_relobj::do_layout): Allow this function to be called twice
14619         during garbage collection and defer layout of section during the
14620         first call.
14621         * object.h (Relobj::get_symbols_data): New function.
14622         (Relobj::is_section_name_included): New function.
14623         (Relobj::copy_symbols_data): New function.
14624         (Relobj::set_symbols_data): New function.
14625         (Relobj::get_relocs_data): New function.
14626         (Relobj::set_relocs_data): New function.
14627         (Relobj::is_output_section_offset_invalid): New pure virtual function.
14628         (Relobj::gc_process_relocs): New function.
14629         (Relobj::do_gc_process_relocs): New pure virtual function.
14630         (Relobj::sd_): New data member.
14631         (Sized_relobj::is_output_section_offset_invalid): New function.
14632         (Sized_relobj::do_gc_process_relocs): New function.
14633         * options.h (General_options::gc_sections): Modify to not be a no-op.
14634         (General_options::print_gc_sections): New option.
14635         * plugin.cc (Plugin_finish::run): Remove function call to
14636         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
14637         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
14638         * reloc.cc (Read_relocs::run): Add task to process relocs and
14639         determine unreferenced sections when doing garbage collection.
14640         (Gc_process_relocs): New class.
14641         (Sized_relobj::do_gc_process_relocs): New function.
14642         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
14643         sections that are garbage collected.
14644         * reloc.h (Gc_process_relocs): New class.
14645         * sparc.cc (Target_sparc::gc_process_relocs): New function.
14646         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
14647         symbols whose corresponding sections are garbage collected.
14648         (Symbol_table::Symbol_table): Add new parameter for the garbage
14649         collection object.
14650         (Symbol_table::gc_mark_undef_symbols): New function.
14651         (Symbol_table::gc_mark_symbol_for_shlib): New function.
14652         (Symbol_table::gc_mark_dyn_syms): New function.
14653         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
14654         as garbage.
14655         (Symbol_table::add_from_object): Likewise.
14656         (Symbol_table::add_from_relobj): When building shared objects, do not
14657         treat externally visible symbols as garbage.
14658         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
14659         table information for static and relocatable links.
14660         * symtab.h (Symbol_table::set_gc): New function.
14661         (Symbol_table::gc): New function.
14662         (Symbol_table::gc_mark_undef_symbols): New function.
14663         (Symbol_table::gc_mark_symbol_for_shlib): New function.
14664         (Symbol_table::gc_mark_dyn_syms): New function.
14665         (Symbol_table::gc_): New data member.
14666         * target.h (Sized_target::gc_process_relocs): New pure virtual
14667         function.
14668         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
14669         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
14670
14671 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
14672
14673         * options.h (General_options::gc_sections): Define as a no-op for now.
14674         (General_options::no_keep_memory): Ditto.
14675         (General_options::Bshareable): Define.
14676         * options.cc (General_options::finalize): Honor -Bshareable.
14677
14678 2009-01-20  Andreas Schwab  <schwab@suse.de>
14679
14680         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
14681         read the value in the contents, since we don't use it.  Use the
14682         template endianness when writing.
14683         (Relocate::relocate): Use it for R_PPC_REL16_HA.
14684
14685 2009-01-19  Andreas Schwab  <schwab@suse.de>
14686
14687         * configure.tgt (powerpc64-*): Fix targ_obj.
14688
14689 2009-01-15  Ian Lance Taylor  <iant@google.com>
14690
14691         * object.cc (Sized_relobj::write_local_symbols): Don't write out
14692         local symbols when stripping all symbols.
14693
14694 2009-01-14  Cary Coutant  <ccoutant@google.com>
14695
14696         * output.cc (Output_reloc): Add explicit instantiations.
14697
14698 2009-01-14  Cary Coutant  <ccoutant@google.com>
14699
14700         * archive.cc (Archive::get_elf_object_for_member): Remove call
14701         to File_read::claim_for_plugin.
14702         * descriptors.cc (Descriptors::open): Remove reference to
14703         is_claimed.
14704         (Descriptors::claim_for_plugin): Remove.
14705         * descriptors.h (Descriptors::claim_for_plugin): Remove.
14706         (Descriptors::is_claimed): Remove.
14707         (claim_descriptor_for_plugin): Remove.
14708         * fileread.cc (File_read::claim_for_plugin): Remove.
14709         * fileread.h (File_read::claim_for_plugin): Remove.
14710         (File_read::descriptor): Reopen descriptor if necessary.
14711         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
14712         (Plugin_manager::all_symbols_read): Add task parameter. Change
14713         all callers.
14714         (Plugin_manager::get_input_file): New function.
14715         (Plugin_manager::release_input_file): New function.
14716         (Pluginobj::Pluginobj): Add filesize parameter and initialize
14717         corresponding data member.
14718         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
14719         and pass to base constructor. Change all callers.
14720         (get_input_file, release_input_file): New functions.
14721         (make_sized_plugin_object): Add filesize parameter. Change all callers.
14722         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
14723         (Plugin_manager::all_symbols_read): Add task parameter.
14724         (Plugin_manager::get_input_file): New function.
14725         (Plugin_manager::release_input_file): New function.
14726         (Plugin_manager::task_): New data member.
14727         (Pluginobj::Pluginobj): Add filesize parameter.
14728         (Pluginobj::filename): New function.
14729         (Pluginobj::descriptor): New function.
14730         (Pluginobj::filesize): New function.
14731         (Pluginobj::filesize_): New data member.
14732         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
14733         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
14734         File_read::claim_for_plugin; use Object::unlock to unlock the file.
14735
14736         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
14737         with archive libraries.
14738         * testsuite/Makefile.in: Regenerate.
14739         * testsuite/plugin_test.c (struct sym_info): New type.
14740         (get_input_file, release_input_file): New static variables.
14741         (onload): Capture new transfer vector entries.
14742         (claim_file_hook): Stop reading at end of file according to filesize.
14743         Factor out parsing of readelf output into separate function.
14744         (all_symbols_read_hook): Exercise get_input_file and release_input_file
14745         APIs and get the source file name from the symbol table.  Convert
14746         source file name to corresponding object file name.  Print info
14747         message when adding new input files.
14748         (parse_readelf_line): New function.
14749         * testsuite/plugin_test_1.sh: Add checks for new info messages.
14750         * testsuite/plugin_test_2.sh: Likewise.
14751         * testsuite/plugin_test_3.sh: Likewise.
14752         * testsuite/plugin_test_4.sh: New test case.
14753
14754 2009-01-07  Ian Lance Taylor  <iant@google.com>
14755
14756         * version.cc (version_string): Bump to 1.8.
14757
14758 2008-12-23  Cary Coutant  <ccoutant@google.com>
14759
14760         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
14761         * plugin.cc (Plugin_manager::finish): Rename as
14762         layout_deferred_objects.  Move cleanup to separate function.
14763         (Plugin_manager::cleanup): New function.
14764         (Plugin_finish::run): Call layout_deferred_objects and cleanup
14765         separately.
14766         * plugin.h (Plugin_manager::finish): Rename as
14767         layout_deferred_objects.
14768         (Plugin_manager::cleanup): New function.
14769         (Plugin_manager::cleanup_done): New field.
14770
14771 2008-12-23  Cary Coutant  <ccoutant@google.com>
14772
14773         * plugin.cc (is_visible_from_outside): New function.
14774         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
14775         so we don't return "IR only" status for exported symbols or -r links.
14776
14777         * testsuite/Makefile.am (plugin_test_3): New test case.
14778         * testsuite/Makefile.in: Regenerate.
14779         * testsuite/plugin_test_3.sh: New file.
14780
14781 2008-12-22  Cary Coutant  <ccoutant@google.com>
14782
14783         * object.cc (Sized_relobj::layout_section): New function.
14784         (Sized_relobj::do_layout): Defer layout of input sections until after
14785         plugin has provided replacement files.
14786         (Sized_relobj::do_layout_deferred_sections): New function.
14787         * object.h (Relobj::set_section_offset): Remove virtual keyword.
14788         (Relobj::layout_deferred_sections): New function.
14789         (Relobj::do_layout_deferred_sections): New function.
14790         (Sized_relobj::do_layout_deferred_sections): New function.
14791         (Sized_relobj::layout_section): New function.
14792         (Sized_relobj::Deferred_layout): New structure.
14793         (Sized_relobj::deferred_layout_): New field.
14794         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
14795         Change all callers.  Layout deferred sections.
14796         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
14797         references.
14798         (Plugin_hook::run): Move code from do_plugin_hook inline.
14799         (Plugin_hook::do_plugin_hook): Remove.
14800         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
14801         (Plugin_manager::finish): Renamed, was cleanup.
14802         (Plugin_manager::should_defer_layout): New function.
14803         (Plugin_manager::add_deferred_layout_object): New function.
14804         (Plugin_manager::Deferred_layout_list): New type.
14805         (Plugin_manager::deferred_layout_objects_): New field.
14806         (Plugin_hook::do_plugin_hook): Remove.
14807
14808 2008-12-17  Ian Lance Taylor  <iant@google.com>
14809
14810         * options.h (class General_options): Add --no case for
14811         --export-dynamic.
14812
14813 2008-12-16  Cary Coutant  <ccoutant@google.com>
14814
14815         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
14816         vector.
14817         (Plugin_manager::claim_file): Create plugin object even if
14818         plugin did not call the add_symbols callback.
14819         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
14820         asking for more symbols than were added.
14821         * testsuite/Makefile.am (plugin_test_1): Add test case with
14822         no global symbols.
14823         (empty.syms): New target.
14824         * testsuite/Makefile.in: Regenerate.
14825         * testsuite/plugin_test.c (claim_file_hook): Add new debug
14826         message. Don't call add_symbols if no globals.
14827         (all_symbols_read_hook): Don't provide replacement for empty
14828         claimed file.
14829
14830 2008-12-12  Ian Lance Taylor  <iant@google.com>
14831
14832         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
14833         r_type == 0 for a local symbol with r_sym == 0.
14834         (scan_relocatable_relocs): Pass r_sym to
14835         local_non_section_strategy.
14836         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
14837         r_sym parameter.
14838
14839         * configure.ac: Update test for TLS descriptors: they are
14840         supported as of glibc 2.9.
14841         * configure: Rebuild.
14842
14843 2008-12-11  Ian Lance Taylor  <iant@google.com>
14844
14845         PR 7091
14846         * target-reloc.h (Default_scan_relocatable_relocs): For each
14847         function, map r_type == 0 to RELOC_DISCARD.
14848
14849 2008-12-10  Cary Coutant  <ccoutant@google.com>
14850
14851         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
14852         object to override a kept COMDAT group from a plugin object.
14853
14854 2008-12-09  Ian Lance Taylor  <iant@google.com>
14855
14856         PR 7088
14857         * yyscript.y (file_cmd): Handle INPUT.
14858
14859         * testsuite/initpri1.c: Change all declarations to be full
14860         prototypes by adding void, to avoid compiler warnings.
14861
14862 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
14863
14864         * options.cc (General_options::parse_plugin_opt): New.
14865         (General_options::add_plugin): The argument now is just the filename.
14866         (General_options::add_plugin_option): New.
14867         * options.h (plugin_opt): New.
14868         (add_plugin): Change argument name.
14869         (add_plugin_option): New.
14870         * plugin.cc (Plugin::load): Don't parse the plugin option.
14871         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
14872         (Plugin::add_option): New.
14873         (Plugin::args_): Change type.
14874         (Plugin::filename_): New.
14875         (Plugin_manager::add_plugin_option): New.
14876         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
14877         * testsuite/Makefile.in: Regenerate.
14878
14879 2008-12-05  Cary Coutant  <ccoutant@google.com>
14880
14881         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
14882         Handle --strip-lto-sections option.
14883         * options.h (strip_lto_sections): New option.
14884
14885 2008-12-01  Cary Coutant  <ccoutant@google.com>
14886
14887         * plugin.cc (ld_plugin_message): Change format parameter to const.
14888         Fix mismatch between new[] and delete.
14889
14890 2008-11-14  Cary Coutant  <ccoutant@google.com>
14891
14892         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
14893         instead of -1U.
14894
14895 2008-11-05  Craig Silverstein  <csilvers@google.com>
14896
14897         * options.cc (General_options::parse_dynamic_list): New function.
14898         * options.h (General_options): New flags dynamic_list,
14899         dynamic_list_data, dynamic_list_cpp_new, and
14900         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
14901         (General_options::in_dynamic_list): New function.
14902         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
14903         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
14904         (Lex::can_continue_name): Likewise.
14905         (yylex): Likewise.
14906         (read_script_file): New parameter script_options.
14907         (read_dynamic_list): New function.
14908         (Script_options::define_dynamic_list): New function.
14909         (dynamic_list_keyword_parsecodes): New variable.
14910         (dynamic_list_keywords): New variable.
14911         * script.h (Script_options::define_dynamic_list): New function
14912         prototype.
14913         (read_dynamic_list): New function prototype.
14914         * symtab.cc (strprefix): New macro.
14915         (Symbol::should_add_dynsym_entry): Support dynamic_list,
14916         dynamic_list_data, dynamic_list_cpp_new, and
14917         dynamic_list_cpp_typeinfo.
14918         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
14919         (dynamic_list_expr): New rule.
14920         (dynamic_list_nodes): Likewise.
14921         (dynamic_list_node): Likewise.
14922         * testsuite/Makefile.am (dynamic_list): New test.
14923         * testsuite/Makefile.in: Regenerated.
14924         * testsuite/dynamic_list.t: New file.
14925         * testsuite/dynamic_list.sh: New file.
14926
14927 2008-11-05  Craig Silverstein  <csilvers@google.com>
14928
14929         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
14930         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
14931         (t11_last): Likewise.
14932         * testsuite/ver_test_6.c (main): Likewise.
14933
14934 2008-10-07  Cary Coutant  <ccoutant@google.com>
14935
14936         * options.c (General_options::finalize): Add check for -static and
14937         -shared.
14938         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
14939         is not empty.
14940
14941 2008-10-02  Cary Coutant  <ccoutant@google.com>
14942
14943         * plugin.cc (make_sized_plugin_object): Fix conditional
14944         compilation to work when not all targets are enabled.
14945
14946 2008-09-29  Cary Coutant  <ccoutant@google.com>
14947
14948         * archive.cc (Archive::get_file_and_offset): Use filename instead
14949         of name to get library path.
14950         (Archive::include_member): Unlock external member of a thin archive.
14951
14952         * testsuite/Makefile.am (TEST_AR): New variable.
14953         (thin_archive_test_1): New test.
14954         (thin_archive_test_2): New test.
14955         * testsuite/Makefile.in: Regenerate.
14956         * testsuite/thin_archive_main.cc: New file.
14957         * testsuite/thin_archive_test_1.cc: New file.
14958         * testsuite/thin_archive_test_2.cc: New file.
14959         * testsuite/thin_archive_test_3.cc: New file.
14960         * testsuite/thin_archive_test_4.cc: New file.
14961
14962 2008-09-29  Cary Coutant  <ccoutant@google.com>
14963
14964         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
14965         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
14966         instead of -1U.
14967         (Sized_relobj::do_finalize_local_symbols): Likewise.
14968         (Sized_relobj::map_to_kept_section): Likewise.
14969         * object.h (Sized_relobj::invalid_address): New constant.
14970         (Sized_relobj::do_output_section_offset): Check for invalid_address
14971         and return -1ULL.
14972         * output.cc (Output_reloc::local_section_offset): Use constant
14973         invalid_address instead of -1U.
14974         (Output_reloc::get_address): Likewise.
14975         (Output_section::output_address): Change -1U to -1ULL.
14976         * output.h (Output_reloc::invalid_address): New constant.
14977         * reloc.cc (Sized_relobj::write_sections): Use constant
14978         invalid_address instead of -1U.
14979         (Sized_relobj::relocate_sections): Likewise.
14980         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
14981         values for merge sections.
14982         * target-reloc.h (relocate_for_relocatable): Use constant
14983         invalid_address instead of -1U.
14984
14985 2008-09-19  Cary Coutant  <ccoutant@google.com>
14986
14987         Add plugin functionality for link-time optimization (LTO).
14988         * configure.ac (plugins): Add --enable-plugins option.
14989         * configure: Regenerate.
14990         * config.in: Regenerate.
14991         * Makefile.am (LIBDL): New variable.
14992         (CCFILES): Add plugin.cc.
14993         (HFILES): Add plugin.h.
14994         (ldadd_var): Add LIBDL.
14995         * Makefile.in: Regenerate.
14996
14997         * archive.cc: Include "plugin.h".
14998         (Archive::setup): Don't preread archive symbols when using a plugin.
14999         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
15000         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
15001         files.
15002         (Archive::include_member): Add symbols from plugin objects.
15003         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
15004         * descriptors.cc (Descriptors::open): Check for file descriptors
15005         abandoned by plugins.
15006         (Descriptors::claim_for_plugin): New function.
15007         * descriptors.h (Descriptors::claim_for_plugin): New function.
15008         (Open_descriptor::is_claimed): New field.
15009         (claim_descriptor_for_plugin): New function.
15010         * fileread.cc (File_read::claim_for_plugin): New function.
15011         * fileread.h (File_read::claim_for_plugin): New function.
15012         (File_read::descriptor): New function.
15013         * gold.cc: Include "plugin.h".
15014         (queue_initial_tasks): Add task to call plugin hooks for generating
15015         new object files.
15016         * main.cc: Include "plugin.h".
15017         (main): Load plugin libraries.
15018         * object.h (Pluginobj): Declare.
15019         (Object::pluginobj): New function.
15020         (Object::do_pluginobj): New function.
15021         (Object::set_target): New function.
15022         * options.cc: Include "plugin.h".
15023         (General_options::parse_plugin): New function.
15024         (General_options::General_options): Initialize plugins_ field.
15025         (General_options::add_plugin): New function.
15026         * options.h (Plugin_manager): Declare.
15027         (General_options): Add --plugin option.
15028         (General_options::has_plugins): New function.
15029         (General_options::plugins): New function.
15030         (General_options::add_plugin): New function.
15031         (General_options::plugins_): New field.
15032         * plugin.cc: New file.
15033         * plugin.h: New file.
15034         * readsyms.cc: Include "plugin.h".
15035         (Read_symbols::do_read_symbols): Check for archive before checking
15036         for ELF file.  Call plugin hooks to claim files.
15037         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
15038         from a real object file; force override when processing replacement
15039         files.
15040         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
15041         (Symbol::init_base_object): Likewise.
15042         (Symbol::init_base_output_data): Likewise.
15043         (Symbol::init_base_output_segment): Likewise.
15044         (Symbol::init_base_constant): Likewise.
15045         (Symbol::init_base_undefined): Likewise.
15046         (Symbol::output_section): Assert that object is not a plugin.
15047         (Symbol_table::add_from_pluginobj): New function.
15048         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
15049         undefined.
15050         (Symbol_table::sized_write_globals): Likewise.
15051         (Symbol_table::add_from_pluginobj): Instantiate template.
15052         * symtab.h (Sized_pluginobj): Declare.
15053         (Symbol::in_real_elf): New function.
15054         (Symbol::set_in_real_elf): New function.
15055         (Symbol::in_real_elf_): New field.
15056         (Symbol_table::add_from_pluginobj): New function.
15057
15058         * testsuite/Makefile.am (AM_CFLAGS): New variable.
15059         (LIBDL): New variable.
15060         (LDADD): Add LIBDL.
15061         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
15062         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
15063         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
15064         (MOSTLYCLEANFILES): Likewise.
15065         * testsuite/Makefile.in: Regenerate.
15066         * testsuite/plugin_test.c: New file.
15067         * testsuite/plugin_test_1.sh: New file.
15068         * testsuite/plugin_test_2.sh: New file.
15069
15070 2008-09-16  Ian Lance Taylor  <iant@google.com>
15071
15072         * target-reloc.h (relocate_section): Check whether a symbol is
15073         defined by the ABI before reporting an undefined symbol error.
15074         * target.h (Target::is_defined_by_abi): Make parameter const.
15075         (Target::do_is_defined_by_abi): Likewise.
15076         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
15077         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
15078         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
15079         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
15080         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
15081         * testsuite/Makefile.in: Rebuild.
15082
15083         * fileread.cc (make_view): Add casts to avoid warning.
15084
15085 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15086
15087         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
15088         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15089
15090 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15091
15092         * options.h (General_options::output_is_executable): New.
15093         (General_options::output_is_pie): New.
15094         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
15095         for shared libraries.
15096         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15097
15098 2008-09-11  Chris Demetriou  <cgd@google.com>
15099
15100         * options.h (origin): New -z option.
15101         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
15102         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
15103         in DT_FLAGS_1.
15104
15105 2008-09-05  Cary Coutant  <ccoutant@google.com>
15106
15107         * fileread.cc (File_read::make_view): Add check for attempt to map
15108         beyond end of file.
15109
15110 2008-09-05  Cary Coutant  <ccoutant@google.com>
15111
15112         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
15113         explicit instantiations.
15114
15115 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
15116
15117         PR gold/6858
15118         * options.cc (General_options::finalize): Allow undefined symbols
15119         in shlibs if linking -shared.
15120
15121         PR gold/6859
15122         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
15123         symbols as not needing a dynsym entry.
15124
15125 2008-08-20  Craig Silverstein  <csilvers@google.com>
15126
15127         * fileread.cc (File_read::open): Do not lock the file unless it
15128         was successfully opened.
15129
15130 2008-08-14  Cary Coutant  <ccoutant@google.com>
15131
15132         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
15133         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
15134         * testsuite/tls_test.cc (struct int128): 128-bit struct
15135         for testing TLS relocs with non-zero addend.
15136         (v12): New TLS variable.
15137         (t12): New test.
15138         (t_last): Add check for v12.
15139         * testsuite/tls_test.h (t12): New function.
15140         * testsuite/tls_test_main.cc (thread_routine): Call new test.
15141
15142 2008-08-13  Ian Lance Taylor  <iant@google.com>
15143
15144         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
15145         set tls_segment_ or relro_segment_.
15146         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
15147         when appropriate.
15148         * output.h (Output_section::clear_is_relro): New function.
15149         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
15150         sections specially even when output_data_ is empty.
15151         (Output_segment::maximum_alignment): When first section is relro,
15152         only force alignment for PT_LOAD segments.
15153         * script.cc (script_data_segment_align): New function.
15154         (script_data_segment_relro_end): New function.
15155         * script-c.h (script_data_segment_align): Declare.
15156         (script_data_segment_relro_end): Declare.
15157         * script-sections.h (class Script_sections): Declare
15158         data_segment_align and data_segment_relro_end.  Add fields
15159         segment_align_index_ and saw_relro_end_.
15160         * script-sections.cc (class Sections_element): Add set_is_relro
15161         virtual function.  Add new bool* parameter to place_orphan_here.
15162         Add get_output_section virtual function.
15163         (class Output_section_definition): Add set_is_relro.  Add new
15164         bool* parameter to place_orphan_here.  Add get_output_section.
15165         Add is_relro_ field.
15166         (Output_section_definition::Output_section_definition): Initialize
15167         evaluated_address_, evaluated_load_address, evaluated_addralign_,
15168         and is_relro_ fields.
15169         (Output_section_definition::place_orphan_here): Add is_relro
15170         parameter.
15171         (Output_section_definition::set_section_addresses): Set relro for
15172         output section.
15173         (Output_section_definition::alternate_constraint): Likewise.
15174         (class Orphan_output_section): Add new bool* parameter to
15175         place_orphan_here.  Add get_output_section.
15176         (Orphan_output_section::place_orphan_here): Add is_relro
15177         parameter.
15178         (Script_sections::Script_sections): Initialize
15179         data_segment_align_index_ and saw_relro_end_.
15180         (Script_sections::data_segment_align): New function.
15181         (Script_sections::data_segment_relro_end): New function.
15182         (Script_sections::place_orphan): Set or clear is_relro.
15183         (Script_sections::set_section_addresses): Force alignment of first
15184         TLS section.
15185         * yyscript.y (exp): Call script_data_segment_align and
15186         script_data_segment_relro_end.
15187         * testsuite/relro_script_test.t: New file.
15188         * testsuite/relro_test.cc (using_script): Declare.
15189         (t1, t2): Test using_script.
15190         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
15191         (relro_script_test_SOURCES): Define.
15192         (relro_script_test_DEPENDENCIES): Define.
15193         (relro_script_test_LDFLAGS): Define.
15194         (relro_script_test_LDADD): Define.
15195         (relro_script_test.so): New target.
15196         * testsuite/Makefile.in: Rebuild.
15197
15198 2008-08-06  Cary Coutant <ccoutant@google.com>
15199
15200         * archive.cc (Archive::total_archives, Archive::total_members)
15201         (Archive::total_members_loaded): New variables.
15202         (Archive::setup): Add parameter.  Add option to preread
15203         archive symbols.
15204         (Archive::read_armap): Add counter.
15205         (Archive::get_file_and_offset): New function.
15206         (Archive::get_elf_object_for_member): New function.
15207         (Archive::read_all_symbols): New function.
15208         (Archive::read_symbols): New function.
15209         (Archive::add_symbols): Add counters.
15210         (Archive::include_all_members): Use armap to find members if it's
15211         already built.
15212         (Archive::include_member): Skip reading symbols if already read.
15213         Factored code into Archive::get_file_and_offset and
15214         Archive::get_elf_object_for_member.  Changed call to
15215         Mapfile::report_include_archive_member.
15216         (Archive::print_stats): New function.
15217         * archive.h: Declare Object and Read_symbols_data classes.
15218         (Archive::Archive): Add initializers for new members.
15219         (Archive::setup): Add parameter.
15220         (Archive::print_stats): New function.
15221         (Archive::total_archives, Archive::total_members)
15222         (Archive::total_members_loaded): New variables.
15223         (Archive::get_file_and_offset): New function.
15224         (Archive::get_elf_object_for_member): New function.
15225         (Archive::read_all_symbols): New function.
15226         (Archive::read_symbols): New function.
15227         (Archive::Archive_member): New class.
15228         (Archive::members_): New member.
15229         (Archive::num_members_): New member.
15230         * main.cc: Include archive.h.
15231         (main): Call Archive::print_stats.
15232         * mapfile.cc (Mapfile::report_include_archive_member): Delete
15233         archive parameter; member_name is now the fully-decorated name.
15234         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
15235         * options.h: (General_options): Add --preread-archive-symbols option.
15236         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
15237         Archive::setup.
15238
15239 2008-08-04  Ian Lance Taylor  <iant@google.com>
15240
15241         * symtab.h (Symbol::use_plt_offset): New function.
15242         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
15243         * powerpc.cc (Relocate::relocate): Likewise.
15244         * sparc.cc (Relocate::relocate): Likewise.
15245         * x86_64.cc (Relocate::relocate): Likewise.
15246         * testsuite/weak_plt.sh: New test.
15247         * testsuite/weak_plt_main.cc: New test.
15248         * testsuite/weak_plt_shared.cc: New test.
15249         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
15250         (check_PROGRAMS): Add weak_plt.
15251         (check_DATA): Add weak_plt_shared.so.
15252         (weak_plt_main_pic.o, weak_plt): New targets.
15253         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
15254         * testsuite/Makefile.in: Rebuild.
15255
15256         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
15257         gcctestdir/ld.
15258         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
15259         * testsuite/Makefile.in: Rebuild.
15260
15261 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
15262
15263         * Makefile.am (POTFILES.in): Set LC_ALL=C.
15264         * Makefile.in: Regenerate.
15265         * po/POTFILES.in: Regenerate.
15266
15267 2008-07-29  Ian Lance Taylor  <iant@google.com>
15268
15269         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
15270         symbols before other symbols.
15271         * testsuite/script_test_2.cc (test_addr): Declare.
15272         (test_addr_alias): Declare.
15273         (main): Check that test_addr and test_addr_alias have the right
15274         values.
15275         * testsuite/script_test_2.t: Define test_addr_alias and
15276         test_addr.
15277
15278 2008-07-24  Ian Lance Taylor  <iant@google.com>
15279
15280         PR 5990
15281         * descriptors.cc: New file.
15282         * descriptors.h: New file.
15283         * gold-threads.h (class Hold_optional_lock): New class.
15284         * fileread.cc: Include "descriptors.h".
15285         (File_read::~File_read): Release descriptor rather than closing
15286         it.
15287         (File_read::open) [file]: Call open_descriptor rather than open.
15288         Set is_descriptor_opened_.
15289         (File_read::open) [memory]: Assert that descriptor is not open.
15290         (File_read::reopen_descriptor): New function.
15291         (File_read::release): Release descriptor.
15292         (File_read::do_read): Make non-const.  Reopen descriptor.
15293         (File_read::read): Make non-const.
15294         (File_read::make_view): Reopen descriptor.
15295         (File_read::do_readv): Likewise.
15296         * fileread.h (class File_read): Add is_descriptor_opened_ field.
15297         Update declarations.
15298         * layout.cc: Include "descriptors.h".
15299         (Layout::create_build_id): Use open_descriptor rather than open.
15300         * output.cc: Include "descriptors.h".
15301         (Output_file::open): Use open_descriptor rather than open.
15302         * archive.cc (Archive::const_iterator): Change Archive to be
15303         non-const.
15304         (Archive::begin, Archive::end): Make non-const.
15305         (Archive::count_members): Likewise.
15306         * archive.h (class Archive): Update declarations.
15307         * object.h (Object::read): Make non-const.
15308         * Makefile.am (CCFILES): Add descriptors.cc.
15309         (HFILES): Add descriptors.h.
15310         * Makefile.in: Rebuild.
15311
15312         PR 6716
15313         * gold.h: Always include <clocale>.  Add Solaris workarounds
15314         following code in binutils/sysdep.h.
15315
15316         PR 6048
15317         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
15318         this->eh_frame_hdr_ is NULL before using it.
15319
15320         * dynobj.cc (Versions::Versions): Update comment.
15321
15322         * dynobj.cc (Versions::Versions): If there is an soname, use it as
15323         the base version name.
15324
15325         * stringpool.cc (Stringpool_template::add_with_length): Set key to
15326         array size plus one.
15327         (Stringpool_template::set_string_offsets): Subtract one from key
15328         before using it as an array index.
15329         (Stringpool_template::get_offset_with_length): Likewise.
15330         (Stringpool_template::write_to_buffer): Likewise.
15331         * stringpool.h (Stringpool_template::get_offset_from_key):
15332         Likewise.
15333
15334 2008-07-23  Ian Lance Taylor  <iant@google.com>
15335
15336         PR 6658
15337         * object.h (Merged_symbol_value::value): Do our best to handle a
15338         negative addend.
15339
15340         PR 6647
15341         * script.cc (Version_script_info::get_versions): Don't add empty
15342         version tag to return value.
15343         (Version_script_info::get_symbol_version_helper): Change return
15344         type to bool.  Add pversion parameter.  Change all callers.
15345         (script_register_vers_node): Don't require a non-NULL tag.
15346         * script.h (class Version_script_info): Update declarations.
15347         (Version_script_info::get_symbol_version): Change return type to
15348         bool.  Add version parameter.  Change all callers.
15349         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
15350         handling.  Handle an empty version from a version script.
15351         (Symbol_table::define_special_symbol): Likewise.
15352         * testsuite/ver_test_10.script: New file.
15353         * testsuite/ver_test_10.sh: New file.
15354         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
15355         (check_DATA): Add ver_test_10.syms.
15356         (ver_test_10.syms, ver_test_10.so): New target.
15357         * testsuite/Makefile.in: Rebuild.
15358
15359 2008-07-23  Simon Baldwin  <simonb@google.com>
15360
15361         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
15362         to zero for undefined symbols from dynamic libraries.
15363
15364 2008-07-23  Ian Lance Taylor  <iant@google.com>
15365
15366         * symtab.cc (Symbol_table::resolve): Remove version parameter.
15367         Change all callers.
15368         * symtab.h (class Symbol_table): Update declaration.
15369         * testsuite/ver_test_9.cc: New file.
15370         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
15371         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
15372         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
15373         (ver_test_9.so, ver_test_9.o): New targets.
15374         * testsuite/Makefile.in: Rebuild.
15375
15376 2008-07-22  Ian Lance Taylor  <iant@google.com>
15377
15378         * options.h (class General_options): Define --check-sections.
15379         * layout.cc (Layout::set_segment_offsets): Handle
15380         --check-sections.
15381
15382         * options.h (class General_options): Define -n/--nmagic and
15383         -N/--omagic.
15384         * options.cc (General_options::finalize): For -n/--nmagic or
15385         -N/--omagic, set -static.
15386         * layout.cc (Layout::attach_allocated_section_to_segment): If
15387         -N/--omagic, don't put read-only and read-write sections in
15388         different segments.
15389         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
15390         finding a read-only segment.
15391         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
15392         don't set the minimum segment alignment to the common page size,
15393         and don't set the file offset to the address modulo the page size.
15394         * script-sections.cc (Script_sections::create_segments): If
15395         -n/--omagic, don't put read-only and read-write sections in
15396         different segments.
15397
15398         * cref.cc: New file.
15399         * cref.h: New file.
15400         * options.h (class General_options): Add --print-symbol-counts.
15401         * main.cc (main): Issue defined symbol report if requested.
15402         * archive.cc (Archive::interpret_header): Make into a const member
15403         function.
15404         (Archive::add_symbols): Call Input_objects::archive_start and
15405         archive_stop.
15406         (Archive::const_iterator): Define new class.
15407         (Archive::begin, Archive::end): New functions.
15408         (Archive::include_all_members): Rewrite to use iterator.
15409         (Archive::count_members): New function.
15410         * archive.h (class Archive): Update declarations.
15411         (Archive::filename): New function.
15412         * object.cc: Include "cref.h".
15413         (Sized_relobj::Sized_relobj): Initialize defined_count_.
15414         (Sized_relobj::do_get_global_symbol_counts): New function.
15415         (Input_objects::add_object): Add object to cross-referencer.
15416         (Input_objects::archive_start): New function.
15417         (Input_objects::archive_stop): New function.
15418         (Input_objects::print_symbol_counts): New function.
15419         * object.h: Declare Cref and Archive.
15420         (Object::get_global_symbol_counts): New function.
15421         (Object::do_get_global_symbol_counts): New pure virtual function.
15422         (class Sized_relobj): Add defined_count_ field.  Update
15423         declarations.
15424         (class Input_objects): Add cref_ field.  Update constructor.
15425         Update declarations.
15426         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
15427         defined_count_.
15428         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
15429         symbol counts.
15430         (Sized_dynobj::do_get_global_symbol_counts): New function.
15431         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
15432         defined_count_.  Update declarations.  Define Symbols typedef.
15433         * symtab.cc (Symbol_table::add_from_relobj): Add defined
15434         parameter.  Change all callers.
15435         (Symbol_table::add_from_dynobj): Add sympointers and defined
15436         parameters.  Change all callers.
15437         * symtab.h (class Symbol_table): Update declarations.
15438         * Makefile.am (CCFILES): Add cref.cc.
15439         (HFILES): Add cref.h.
15440         * Makefile.in: Rebuild.
15441
15442 2008-07-22  Simon Baldwin  <simonb@google.com>
15443
15444         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
15445         to zero when writing undefined symbols.
15446
15447 2008-07-22  Ian Lance Taylor  <iant@google.com>
15448
15449         * output.cc (Output_section::add_input_section): Don't try to
15450         merge empty merge sections.
15451
15452 2008-07-21  Craig Silverstein  <csilvers@google.com>
15453
15454         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15455         Include symbol version in error message.
15456
15457 2008-07-20  Chris Demetriou  <cgd@google.com>
15458
15459         * configure.ac (gold_cv_c_random_seed): New configured variable.
15460         (RANDOM_SEED_CFLAGS): New substituted variable.
15461         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
15462         * configure: Rebuild.
15463         * Makefile.in: Likewise.
15464         * testsuite/Makefile.in: Likewise.
15465
15466 2008-07-18  Ian Lance Taylor  <iant@google.com>
15467
15468         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
15469         where we see NAME/NULL and NAME/VERSION  as separate symbols.
15470         * testsuite/ver_test_main.cc (main): Call t4.
15471         (t4, t4_2a): Define.
15472         * testsuite/ver_test_2.cc (t4_2): Define.
15473         * testsuite/ver_test_2.script: Put t4_2a in VER2.
15474         * testsuite/ver_test_4.cc (t4_2a): Define.
15475         * testsuite/ver_test_4.script: Put t4_2a in VER2.
15476         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
15477
15478 2008-07-17  Ian Lance Taylor  <iant@google.com>
15479
15480         * dynobj.cc (Versions::add_def): If we give an error about a
15481         missing version, go ahead and create the version anyhow.
15482
15483 2008-07-10  Ian Lance Taylor  <iant@google.com>
15484
15485         Handle output sections with more than 0x7fffffff bytes.
15486         * object.h (class Relobj): Change map_to_output_ to
15487         output_sections_, and just keep a section pointer.  Change all
15488         uses.  Move comdat group support to Sized_relobj.
15489         (Relobj::is_section_specially_mapped): Remove.
15490         (Relobj::output_section): Remove poff parameter.  Change all
15491         callers.
15492         (Relobj::output_section_offset): New function.
15493         (Relobj::set_section_offset): Rewrite.
15494         (Relobj::map_to_output): Remove.
15495         (Relobj::output_sections): New function.
15496         (Relobj::do_output_section_offset): New pure virtual function.
15497         (Relobj::do_set_section_offset): Likewise.
15498         (class Sized_relobj): Add section_offsets_ field.  Add comdat
15499         group support from Relobj.  Update declarations.
15500         (Sized_relobj::get_output_section_offset): New function.
15501         (Sized_relobj::do_output_section_offset): New function.
15502         (Sized_relobj::do_set_section_offset): New function.
15503         * object.cc (Relobj::output_section_address): Remove.
15504         (Sized_relobj::Sized_relobj): Initialize new fields.
15505         (Sized_relobj::include_section_group): Cast find_kept_object to
15506         Sized_relobj.
15507         (Sized_relobj::include_linkonce_section): Likewise.
15508         (Sized_relobj::do_layout): Use separate arrays for output section
15509         and output offset.
15510         (Sized_relobj::do_count_local_symbols): Change map_to_output to
15511         output_sections.
15512         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
15513         output_sections and section_offsets.
15514         (Sized_relobj::write_local_symbols): Likewise.
15515         (map_to_kept_section): Compute output address directly.
15516         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
15517         output_sections and section_offsets.
15518         (Sized_relobj::write_sections): Likewise.
15519         (Sized_relobj::relocate_sections): Likewise.
15520         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
15521         * output.h (class Output_reloc): Update declarations.  Change
15522         u2_.relobj to Sized_relobj*.
15523         (class Output_data_reloc): Change add functions to use
15524         Sized_relobj*.
15525         * output.cc (Output_reloc::Output_reloc): Change relobj to
15526         Sized_relobj*.
15527         (Output_reloc::local_section_offset): Change return type to
15528         Elf_Addr.  Use get_output_section_offset.
15529         (Output_reloc::get_address): Likewise.
15530         (Output_section::is_input_address_mapped): Don't call
15531         is_section_specially_mapped.
15532         (Output_section::output_offset): Likewise.
15533         (Output_section::output_address): Likewise.
15534         (Output_section::starting_output_address): Likewise.
15535         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
15536         parameter to Sized_relobj*.
15537         (Copy_relocs::need_copy_reloc): Likewise.
15538         (Copy_relocs::save): Likewise.
15539         * copy-relocs.h (class Copy_relocs): Update declarations.
15540         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
15541         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
15542         * target-reloc.h (relocate_for_relocatable): Change
15543         offset_in_output_section type to Elf_Addr.  Change code that uses
15544         it as well.
15545         * layout.cc (Layout::layout): Always set *off.
15546         * mapfile.cc (Mapfile::print_input_section): Use
15547         output_section_offset.
15548         * i386.cc (Target_i386::copy_reloc): Change object parameter to
15549         Sized_relobj*.
15550         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
15551         * sparc.cc (Target_sparc::copy_reloc): Likewise.
15552         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
15553
15554 2008-07-03  Ian Lance Taylor  <iant@google.com>
15555
15556         * layout.cc (Layout::include_section): Do not discard unrecognized
15557         SHT_STRTAB sections.
15558
15559 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
15560
15561         * script.cc (Lex::can_continue_name): Make '?' allowable in
15562         version-script names.
15563         * testsuite/version_script.map: Change glob pattern to use '?'
15564
15565 2008-06-30  Manish Singh  <yosh@gimp.org>
15566
15567         PR 6585
15568         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
15569         Correct typo.
15570
15571 2008-06-30  Ian Lance Taylor  <iant@google.com>
15572
15573         PR 6660
15574         PR 6682
15575         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
15576         versions]: Don't try to read the value in the contents, since we
15577         don't use it.  Use the template endianness when writing.
15578
15579 2008-06-25  Cary Coutant  <ccoutant@google.com>
15580
15581         * fileread.cc (File_read::make_view): Assert on zero-length view.
15582         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
15583         symbol table when there are no symbols to read.
15584
15585 2008-06-23  Craig Silverstein  <csilvers@google.com>
15586
15587         * version.cc (version_string): Bump to 1.7
15588
15589 2008-06-18  Craig Silverstein  <csilvers@google.com>
15590
15591         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
15592         constant 0xFFFF to type Valtype.
15593         (Powerpc_relocate_functions::rel16_ha): Likewise.
15594
15595 2008-06-17  Ian Lance Taylor  <iant@google.com>
15596
15597         * output.h (Output_section::Input_section): Initialize p2align_ to
15598         zero for Output_section_data constructors.
15599         (Output_section::Input_section::addralign): If not an input
15600         section, return the alignment of the Output_section_data.
15601         * testsuite/copy_test.cc: New file.
15602         * testsuite/copy_test_1.cc: New file.
15603         * testsuite/copy_test_2.cc: New file.
15604         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
15605         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
15606         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
15607         (copy_test_1_pic.o, copy_test_1.so): New targets.
15608         (copy_test_2_pic.o, copy_test_2.so): New targets.
15609         * testsuite/Makefile.in: Rebuild.
15610
15611         * script-sections.cc (Script_sections::place_orphan): Initialize
15612         local variable exact.
15613
15614 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
15615
15616         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
15617
15618 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
15619             David S. Miller  <davem@davemloft.net>
15620
15621         * powerpc.cc: New file.
15622         * Makefile.am (TARGETSOURCES): Add powerpc.cc
15623         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
15624         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
15625         * Makefile.in: Rebuild.
15626
15627 2008-06-09  Ian Lance Taylor  <iant@google.com>
15628
15629         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
15630         <exception>.
15631         (throwing, orig_terminate): New static variables.
15632         (terminate_handler): New static function.
15633         (t2): Set terminate handler.
15634
15635 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
15636
15637         PR 6584
15638         * binary.cc (Binary_to_elf::sized_convert): Fix .data
15639         alignment.
15640
15641 2008-05-30  Cary Coutant  <ccoutant@google.com>
15642
15643         * archive.cc (Archive::include_all_members) Correct to step
15644         over symbol table and extended name table in thin archives.
15645
15646 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
15647
15648         PR 6407
15649         * target-reloc.h (relocate_for_relocatable): Fix new_offset
15650         calculation.
15651
15652 2008-05-28  Caleb Howe  <cshowe@google.com>
15653
15654         * reduced_debug_output.cc: New file.
15655         * reduced_debug_output.h: New file.
15656         * options.h (class General_options): Add --strip-debug-non-line.
15657         * options.cc (General_options::finalize): Add strip_debug_non_line
15658         to the strip heirarchy.
15659         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
15660         fields.
15661         * layout.cc: Include "reduced_debug_output.h".
15662         (Layout::Layout): Initialize new fields.
15663         (line_only_debug_sections): New static array.
15664         (is_lines_only_debug_sections): New static inline function.
15665         (Layout::include_section): Handle --strip-debug-non-line.
15666         (Layout::make_output_section): If --strip-debug-non-line, build
15667         new output sections for .debug_abbrev and .debug_info.
15668         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
15669         gold.  Warn about possible overflow.
15670         (read_signed_LEB_128): Likewise.
15671         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
15672         (read_signed_LEB_128): Declare.
15673         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
15674         (HFILES): Add reduced_debug_output.h.
15675         * Makefile.in: Rebuild.
15676
15677 2008-05-21  Ian Lance Taylor  <iant@google.com>
15678
15679         * mapfile.cc: New file.
15680         * mapfile.h: New file.
15681         * options.h (class General_options): Add -M/--print-map and -Map.
15682         * options.cc (General_options::finalize): Make -M equivalent to
15683         -Map -.
15684         * main.cc: Include <cstdio> and "mapfile.h".
15685         (main): Open mapfile if requested.
15686         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
15687         constructor.  Change caller.
15688         (queue_initial_tasks): Add mapfile parameter.  Change caller.
15689         (queue_middle_tasks): Likewise.
15690         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
15691         declarations.
15692         * archive.cc: Include "mapfile.h".
15693         (Archive::add_symbols): Add mapfile parameter.  Change all
15694         callers.  Pass mapfile, symbol, and reason to include_member.
15695         (Archive::include_all_members): Add mapfile parameter.  Change all
15696         callers.
15697         (Archive::include_member): Add mapfile, sym, and why parameters.
15698         Change all callers.  Report inclusion to map file.
15699         * archive.h: Include "fileread.h".
15700         (class Archive): Update declarations.
15701         (Archive::file): New const method.
15702         (class Add_archive_symbols): Add mapfile_ field.  Update
15703         constructor.  Change all callers.
15704         * readsyms.h (class Read_symbols): Likewise.
15705         (class Finish_group): Likewise.
15706         (class Read_script): Likewise.
15707         * common.cc: Include "mapfile.h".
15708         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
15709         all callers.
15710         (Symbol_table::do_allocate_commons): Likewise.
15711         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
15712         symbol allocation to mapfile.
15713         * common.h (class Allocate_commons_task): Add mapfile_ field.
15714         Update constructor.  Change all callers.
15715         * symtab.h (class Symbol_table): Update declarations.
15716         * layout.cc: Include "mapfile.h".
15717         (Layout_task_runner::run): Print information to mapfile.
15718         (Layout::create_gold_note): Change Output_data_fixed_space to
15719         Output_data_zero_fill.
15720         (Layout::create_build_id): Likewise.
15721         (Layout::print_to_mapfile): New function.
15722         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
15723         constructor.  Change caller.
15724         (class Layout): Declare print_to_mapfile.
15725         * output.cc (Output_section::Input_section::print_to_mapfile): New
15726         function.
15727         (Output_section::add_input_section): If producing a map, always
15728         add to input_sections_ list.
15729         (Output_section::do_print_to_mapfile): New function.
15730         (Output_segment::print_sections_to_mapfile): New function.
15731         (Output_segment::print_section_list_to_mapfile): New function.
15732         * output.h: Include "mapfile.h".
15733         (Output_data::print_to_mapfile): New function.
15734         (Output_data::do_print_to_mapfile): New virtual function.
15735         (Output_segment_headers::do_print_to_mapfile): New function.
15736         (Output_file_header::do_print_to_mapfile): New function.
15737         (Output_data_const::do_print_to_mapfile): New function.
15738         (class Output_data_const_buffer): Add map_name_ field.  Update
15739         constructor.  Change all callers.  Add do_print_to_mapfile
15740         function.
15741         (class Output_data_fixed_space): Likewise.
15742         (class Output_data_space): Likewise.
15743         (class Output_data_zero_fill): New class.
15744         (Output_data_strtab::do_print_to_mapfile): New function.
15745         (Output_data_reloc_base::do_print_to_mapfile): New function.
15746         (Output_relocatable_relocs::do_print_to_mapfile): New function.
15747         (Output_data_group::do_print_to_mapfile): New function.
15748         (Output_data_got::do_print_to_mapfile): New function.
15749         (Output_data_dynamic::do_print_to_mapfile): New function.
15750         (Output_symtab_xindex::do_print_to_mapfile): New function.
15751         (class Output_section): Declare do_print_to_mapflie.  Declare
15752         print_to_mapfile in Input_section.
15753         (class Output_segment): Declare new functions.
15754         * object.h (Sized_relobj::symbol_count): New function.
15755         * script-sections.cc
15756         (Output_section_element_dot_assignment::set_section_addresses):
15757         Change Output_data_fixed_space to Output_data_zero_fill.
15758         (Output_data_expression::do_print_to_mapfile): New function.
15759         * script.cc (read_input_script): Add mapfile parameter.  Change
15760         all callers.
15761         * script.h (read_input_script): Update declaration.
15762         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
15763         (Eh_frame::do_print_to_mapfile): New function.
15764         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
15765         (Output_merge_string::do_print_to_mapfile): New function.
15766         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
15767         function.
15768         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
15769         function.
15770         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
15771         function.
15772         * Makefile.am (CCFILES): Add mapfile.cc.
15773         (HFILES): Add mapfile.h.
15774         * Makefile.in: Rebuild.
15775
15776 2008-05-19  Ian Lance Taylor  <iant@google.com>
15777
15778         * options.h (class General_options): Add -z relro.
15779         * layout.cc (Layout::Layout): Initialize relro_segment_.
15780         (Layout::add_output_section_data): Return the output section.
15781         (Layout::make_output_section): Rcognize relro sections and mark
15782         them appropriately.
15783         (Layout::attach_allocated_section_to_segment): Put relro sections
15784         in a PT_GNU_RELRO segment.
15785         (Layout::create_initial_dynamic_sections): Mark the .dynamic
15786         section as relro.
15787         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
15788         PT_TLS segments.
15789         (Layout::linkonce_mapping): Map d.rel.ro.local to
15790         .data.rel.ro.local.
15791         (Layout::output_section_name): Us .data.rel.ro.local for any
15792         section which begins with that.
15793         * layout.h (class Layout): Update add_output_section_data
15794         declaration.  Add relro_segment_ field.
15795         * output.cc (Output_section::Output_section): Initialize is_relro_
15796         and is_relro_local_ fields.
15797         (Output_segment::add_output_section): Group relro sections.
15798         (Output_segment::is_first_section_relro): New function.
15799         (Output_segment::maximum_alignment): If there is a relro section,
15800         align the segment to the common page size.
15801         (Output_segment::set_section_addresses): Track whether we are
15802         looking at relro sections.  If the last section is a relro
15803         section, align to the common page size.
15804         (Output_segment::set_section_list_addresses): Add in_relro
15805         parameter.  Change all callers.  Align to the page size when
15806         moving from relro to non-relro section.
15807         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
15808         segment.
15809         * output.h (class Output_section): Add is_relro_ and
15810         is_relro_local_ fields.
15811         (Output_section::is_relro): New function.
15812         (Output_section::set_is_relro): New function.
15813         (Output_section::is_relro_local): New function.
15814         (Output_section::set_is_relro_local): New function.
15815         (class Output_segment): Update declarations.
15816         * i386.cc (Target_i386::got_section): Mark .got section as relro.
15817         * sparc.cc (Target_sparc::got_section): Likewise.
15818         * x86_64.cc (Target_x86_64::got_section): Likewise.
15819         * testsuite/relro_test_main.cc: New file.
15820         * testsuite/relro_test.cc: New file.
15821         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
15822         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
15823         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
15824         (relro_test.so, relro_test_pic.o): New targets.
15825         * testsuite/Makefile.in: Rebuild.
15826
15827 2008-05-16  Ian Lance Taylor  <iant@google.com>
15828
15829         * output.cc (Output_segment::add_output_section): Remove front
15830         parameter.
15831         * output.h (class Output_segment): Remove
15832         add_initial_output_section and overloaded add_output_section.
15833         Update declaration of remaining add_output_section.
15834         * layout.cc (Layout::create_interp): Call add_output_section
15835         rather than add_initial_output_section.
15836         (Layout::finish_dynamic_section): Likewise.
15837
15838         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
15839         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
15840         know the dynamic type.
15841         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
15842         field.  Initialize it in constructor.
15843         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
15844         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
15845         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
15846         reloc.
15847
15848         * output.cc (Output_reloc::get_address): Change return type to
15849         Elf_Addr.
15850         * output.h (class Output_reloc): Update get_address declaration.
15851         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
15852         for section addresses.
15853
15854 2008-05-09  Ian Lance Taylor  <iant@google.com>
15855
15856         PR 6493
15857         * gold.cc (gold_nomem): Use return value of write.
15858
15859 2008-05-08  Ian Lance Taylor  <iant@google.com>
15860
15861         * symtab.c (Symbol::init_base_output_data): Add version
15862         parameter.  Change all callers.
15863         (Symbol::init_base_output_segment): Likewise.
15864         (Symbol::init_base_constant): Likewise.
15865         (Symbol::init_base_undefined): Likewise.
15866         (Sized_symbol::init_output_data): Likewise.
15867         (Sized_symbol::init_output_segment): Likewise.
15868         (Sized_symbol::init_constant): Likewise.
15869         (Sized_symbol::init_undefined): Likewise.
15870         (Symbol_table::do_define_in_output_data): If the new symbol has a
15871         version, mark it as the default.
15872         (Symbol_table::do_define_in_output_segment): Likewise.
15873         (Symbol_table::do_define_as_constant): Likewise.
15874         * symtab.h (class Symbol): Update declarations.
15875         (class Sized_symbol): Likewise.
15876         * resolve.cc (Symbol::override_version): New function.
15877         (Symbol::override_base): Call override_version.
15878         (Symbol::override_base_with_special): Likewise.
15879         * testsuite/ver_script_8.script: New file.
15880         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
15881         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
15882         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
15883         (ver_test_8_1.so, ver_test_8_2.so): New targets.
15884
15885 2008-05-06  Ian Lance Taylor  <iant@google.com>
15886
15887         PR 6049
15888         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
15889         functions.
15890         (class General_options): Remove existing --undefined, and add
15891         --no-undefined instead.  Add new --undefined as synonym for -u.
15892         * archive.cc (Archive::add_symbols): Check whether symbol was
15893         named with -u.
15894         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
15895         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
15896         all uses.  Add IS_UNDEFINED.  Update declarations to split
15897         different versions of init_base.  Declare init_base_undefined.
15898         (Symbol::is_defined): Handle IS_UNDEFINED.
15899         (Symbol::is_undefined): Likewise.
15900         (Symbol::is_weak_undefined): Call is_undefined.
15901         (Symbol::is_absolute): Handle IS_CONSTANT.
15902         (class Sized_symbol): Update declarations to split different
15903         versions of init.  Declare init_undefined.
15904         (class Symbol_table): Declare new functions.
15905         * symtab.cc (Symbol::init_base_object): Rename from init_base.
15906         Change all callers.
15907         (Symbol::init_base_output_data): Likewise.
15908         (Symbol::init_base_output_segment): Likewise.
15909         (Symbol::init_base_constant): Likewise.
15910         (Symbol::init_base_undefined): New function.
15911         (Sized_symbol::init_object): Rename from init.  Change all
15912         callers.
15913         (Sized_symbol::init_output_data): Likewise.
15914         (Sized_symbol::init_output_segment): Likewise.
15915         (Sized_symbol::init_constant): Likewise.
15916         (Sized_symbol::init_undefined): New function.
15917         (Symbol_table::add_undefined_symbols_from_command_line): New
15918         function.
15919         (Symbol_table::do_add_undefined_symbols_from_command_line): New
15920         function.
15921         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
15922         (Symbol::output_section): Likewise.
15923         (Symbol::set_output_section): Likewise.
15924         (Symbol_table::sized_finalize_symbol): Likewise.
15925         (Symbol_table::sized_write_globals): Likewise.
15926         * resolve.cc (Symbol_table::should_override): Likewise.
15927         (Symbol::override_base_with_special): Likewise.
15928
15929         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
15930         symbol, change it to have default visibility.
15931         * testsuite/protected_1.cc: New file.
15932         * testsuite/protected_2.cc: New file.
15933         * testsuite/protected_3.cc: New file.
15934         * testsuite/protected_main_1.cc: New file.
15935         * testsuite/protected_main_2.cc: New file.
15936         * testsuite/protected_main_3.cc: New file.
15937         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
15938         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
15939         (protected_1_LDFLAGS, protected_1_LDADD): Define.
15940         (protected_1.so): New target.
15941         (protected_1_pic.o, protected_2_pic.o): New targets.
15942         (protected_3_pic.o): New target.
15943         (check_PROGRAMS): Add protected_2.
15944         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
15945         (protected_2_LDFLAGS, protected_2_LDADD): Define.
15946         * testsuite/Makefile.in: Rebuild.
15947
15948         * options.h (DEFINE_var): Add set_user_set_##varname__.
15949         (DEFINE_bool_alias): New macro.
15950         (class General_options): Define -Bstatic using DEFINE_bool_alias
15951         rather than DEFINE_special.  Add --undefined as an alias for -z
15952         defs.
15953         * options.cc (General_options::parse_Bstatic): Remove.
15954
15955         * options.h (class General_options): Add --fatal-warnings.
15956         * main.cc (main): Implement --fatal-warnings.
15957         * errors.h (Errors::warning_count): New function.
15958
15959         * options.h (class General_options): Add -Bsymbolic-functions.
15960         * symtab.h (Symbol::is_preemptible): Check for
15961         -Bsymbolic-functions.
15962
15963 2008-05-05  Ian Lance Taylor  <iant@google.com>
15964
15965         * options.h (DEFINE_bool): For DASH_Z, create the negative option
15966         as noVARNAME rather than no-VARNAME.
15967         (class General_options): Add option -z combreloc.
15968         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15969         get_address.
15970         (Output_reloc::sort_before) [SHT_REL]: New function.
15971         (Output_reloc::sort_before) [SHT_RELA]: New function.
15972         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
15973         Sort_relocs_comparison.
15974         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15975         parameter.  Change all callers.
15976         (Output_data_reloc::Output_data_reloc) [both versions]: Add
15977         sort_relocs parameter.  Change all callers.
15978         * output.cc (Output_reloc::get_address): New function, broken out
15979         of write_rel.
15980         (Output_reloc::write_rel): Call it.
15981         (Output_reloc::compare): New function.
15982         (Output_data_reloc_base::do_write): Optionally sort relocs.
15983
15984         * configure.ac: If targ_extra_obj is set, link it in.
15985         * configure.tgt: Initialize all variables.
15986         (x86_64*): Set targ_extra_obj and targ_extra_size.
15987         * configure: Rebuild.
15988
15989         * object.cc (Sized_relobj::include_section_group): Adjust section
15990         indexes read from group data.  Build vector to pass to
15991         layout_group.
15992         * layout.cc (Layout::layout_group): Add flags and shndxes
15993         parameters.  Remove contents parameter.  Change caller.  Update
15994         explicit instantiations.
15995         * layout.h (class Layout): Update layout_group declaration.
15996         * output.cc (Output_data_group::Output_data_group): Add flags and
15997         input_shndxes parameters.  Remove contents parameter.  Change
15998         caller.
15999         (Output_data_group::do_write): Change input_sections_ to
16000         input_shndxes_.
16001         * output.h (class Output_data_group): Update constructor
16002         declaration.  Rename input_sections_ to input_shndxes_.
16003         * testsuite/many_sections_test.cc: Add template.
16004
16005 2008-04-30  Cary Coutant  <ccoutant@google.com>
16006
16007         * target-reloc.h (relocate_section): Fix dead-pointer bug.
16008
16009         * layout.cc (Layout::include_section): Refactored check for debug
16010         info section.
16011         (Layout::add_comdat): Add new parameters.  Change type
16012         of signature parameter.  Add object and shndx to signatures table.
16013         (Layout::find_kept_object): New function.
16014         * layout.h: Include <cstring>.
16015         (Layout::is_debug_info_section): New function.
16016         (Layout::add_comdat): Add new parameters.
16017         (Layout::find_kept_object): New function.
16018         (Layout::Kept_section): New struct.
16019         (Layout::Signatures): Change type of map range.
16020         * object.cc (Relobj::output_section_address): New function.
16021         (Sized_relobj::include_section_group): Add new parameters.  Change
16022         calls to Layout::add_comdat.  Change to build table of kept comdat
16023         groups and table mapping discarded sections to kept sections.
16024         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
16025         (Sized_relobj::do_layout): Change calls to include_section_group and
16026         include_linkonce_section.
16027         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
16028         value to zero when section is discarded.
16029         (Sized_relobj::map_to_kept_section): New function.
16030         * object.h (Relobj::output_section_address): New function.
16031         (Relobj::Comdat_group): New type.
16032         (Relobj::find_comdat_group): New function.
16033         (Relobj::Comdat_group_table): New type.
16034         (Relobj::Kept_comdat_section): New type.
16035         (Relobj::Kept_comdat_section_table): New type.
16036         (Relobj::add_comdat_group): New function.
16037         (Relobj::set_kept_comdat_section): New function.
16038         (Relobj::get_kept_comdat_section): New function.
16039         (Relobj::comdat_groups_): New field.
16040         (Relobj::kept_comdat_sections_): New field.
16041         (Symbol_value::input_value): Update comment.
16042         (Sized_relobj::map_to_kept_section) New function.
16043         (Sized_relobj::include_linkonce_section): Add new parameter.
16044         * target-reloc.h (Comdat_behavior): New type.
16045         (get_comdat_behavior): New function.
16046         (relocate_section): Add code to map a discarded section to the
16047         corresponding kept section when applying a relocation.
16048
16049 2008-04-30  Craig Silverstein  <csilvers@google.com>
16050
16051         * dwarf_reader.cc (next_generation_count): New static var.
16052         (Addr2line_cache_entry): New struct.
16053         (addr2line_cache): New static var.
16054         (Dwarf_line_info::one_addr2line): Added caching.
16055         (Dwarf_line_info::clear_addr2line_cache): New function.
16056         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
16057         cache-size parameter.
16058         (Dwarf_line_info::one_addr2line_cache): New function.
16059         * symtab.cc (Symbol_table::detect_odr_violations): Pass
16060         new cache-size argument to one_addr2line(), and clear cache.
16061
16062 2008-04-28  Cary Coutant  <ccoutant@google.com>
16063
16064         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
16065         R_386_PC8 relocations.
16066
16067 2008-04-23  Ian Lance Taylor  <iant@google.com>
16068
16069         * object.cc (Sized_relobj::include_section_group): Check for
16070         invalid section group.
16071
16072         * object.cc (make_elf_object): Correct test for 64-bit ELF file
16073         header size.
16074
16075         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
16076         than read for file header.
16077         * archive.cc (Archive::include_member): Likewise.
16078
16079 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
16080
16081         * aclocal.m4: Regenerate.
16082         * configure: Regenerate.
16083
16084 2008-04-19  Ian Lance Taylor  <iant@google.com>
16085
16086         * version.cc (version_string): Bump to 1.6.
16087
16088         * testsuite/Makefile.am (many_sections_r_test): New target.
16089         (many_sections_r_test_SOURCES): Remove.
16090         (many_sections_r_test_DEPENDENCIES): Remove.
16091         (many_sections_r_test_LDFLAGS): Remove.
16092         (many_sections_r_test_LDADD): Remove.
16093
16094         * object.cc (Sized_relobj::do_add_symbols): Always pass
16095         local_symbol_count_ to add_from_relobj.
16096
16097         * testsuite/Makefile.am (many_sections_check.h): Only check one in
16098         every thousand variables.
16099         * testsuite/Makefile.in: Rebuild.
16100
16101         * object.cc (Xindex::initialize_symtab_xindex): New function.
16102         (Xindex::read_symtab_xindex): New function.
16103         (Xindex::sym_xindex_to_shndx): New function.
16104         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
16105         available.
16106         (Sized_relobj::do_initialize_xindex): New function.
16107         (Sized_relobj::do_read_symbols): Adjust section links.
16108         (Sized_relobj::symbol_section_and_value): Add is_ordinary
16109         parameter.  Change all callers.
16110         (Sized_relobj::include_section_group): Adjust section links and
16111         symbol section indexes.
16112         (Sized_relobj::do_layout): Adjust section links.
16113         (Sized_relobj::do_count_local_symbols): Adjust section links and
16114         symbol section indexes.
16115         (Sized_relobj::do_finalize_local_symbols): Distinguish between
16116         ordinary and special symbols.
16117         (Sized_relobj::write_local_symbols): Add symtab_xindex and
16118         dynsym_xindex parameters.  Change all callers.  Adjust section
16119         links.  Use SHN_XINDEX when needed.
16120         (Sized_relobj::get_symbol_location_info): Adjust section links.
16121         Don't get fooled by special symbols.
16122         * object.h (class Xindex): Define.
16123         (class Object): Add xindex_ parameter.  Declare virtual functoin
16124         do_initialize_xindex.
16125         (Object::adjust_sym_shndx): New function.
16126         (Object::set_xindex): New protected function.
16127         (class Symbol_value): Add is_ordinary_shndx_ field.
16128         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
16129         (Symbol_value::value): Assert ordinary section.
16130         (Symbol_value::initialize_input_to_output_map): Likewise.
16131         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
16132         Change all callers.
16133         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
16134         all callers.
16135         (class Sized_relobj): Update declarations.
16136         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
16137         parameter.  Change all callers.
16138         (Sized_relobj::adjust_shndx): New function.
16139         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
16140         field.
16141         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
16142         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
16143         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
16144         (Sized_dynobj::read_dynsym_section): Adjust section links.
16145         (Sized_dynobj::read_dynamic): Likewise.
16146         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
16147         section links.
16148         (Sized_dynobj::do_initialize_xindex): New function.
16149         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
16150         do_initialize_xindex.
16151         (Sized_dynobj::adjust_shndx): New function.
16152         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
16153         dynsym_xindex_ fields.
16154         (Layout::finalize): Add a call to set_section_indexes before
16155         creating the symtab sections.
16156         (Layout::set_section_indexes): Don't do anything if the section
16157         already has a section index.
16158         (Layout::create_symtab_sections): Add shnum parameter.  Change
16159         caller.  Create .symtab_shndx section if needed.
16160         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
16161         caller.
16162         (Layout::allocated_output_section_count): New function.
16163         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
16164         needed.
16165         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
16166         fields.  Update declarations.
16167         (Layout::symtab_xindex): New function.
16168         (Layout::dynsym_xindex): New function.
16169         (class Write_symbols_task): Add layout_ field.
16170         (Write_symbols_task::Write_symbols_task): Add layout parameter.
16171         Change caller.
16172         * output.cc (Output_section_headers::Output_section_headers): Add
16173         shstrtab_section parameter.  Change all callers.
16174         (Output_section_headers::do_sized_write): Store overflow values
16175         for section count and section string table section index in
16176         section header zero.
16177         (Output_file_header::do_sized_write): Check for overflow of
16178         section count and section string table section index.
16179         (Output_symtab_xindex::do_write): New function.
16180         (Output_symtab_xindex::endian_do_write): New function.
16181         * output.h (class Output_section_headers): Add shstrtab_section_.
16182         Update declarations.
16183         (class Output_symtab_xindex): Define.
16184         (Output_section::has_out_shndx): New function.
16185         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
16186         field.
16187         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
16188         Change all callers.
16189         (Sized_symbol::init): Likewise.
16190         (Symbol::output_section): Check for ordinary symbol.
16191         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
16192         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
16193         callers.
16194         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
16195         Change all callers.  Simplify handling of symbols from sections
16196         not included in the link.
16197         (Symbol_table::add_from_dynobj): Handle ordinary symbol
16198         distinction.
16199         (Weak_alias_sorter::operator()): Assert that symbols are
16200         ordinary.
16201         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
16202         distinction.
16203         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
16204         parameters.  Change all callers.
16205         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
16206         symbol distinction.  Use SHN_XINDEX when needed.
16207         (Symbol_table::write_section_symbol): Add symtab_xindex
16208         parameter.  Change all callers.
16209         (Symbol_table::sized_write_section_symbol): Likewise.  Use
16210         SHN_XINDEX when needed.
16211         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
16212         declarations.
16213         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
16214         (Symbol::is_defined): Check is_ordinary.
16215         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
16216         (Symbol::is_absolute, Symbol::is_common): Likewise.
16217         (class Sized_symbol): Update declarations.
16218         (class Symbol_table): Update declarations.
16219         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
16220         parameters.  Change all callers.
16221         (Sized_symbol::override): Likewise.
16222         (Symbol_table::override): Likewise.
16223         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
16224         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
16225         is_ordinary, and orig_st_shndx parameters.  Change all callers.
16226         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
16227         to be in an ordinary section.
16228         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
16229         object and is_ordinary parameters.  Change all callers.
16230         (Sized_dwarf_line_info::read_relocs): Add object parameter.
16231         Change all callers.  Don't add undefined or non-ordinary symbols
16232         to reloc_map_.
16233         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
16234         Change all callers.
16235         * dwarf_reader.h (class Sized_dwarf_line_info): Update
16236         declarations.
16237         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
16238         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
16239         (Sized_relobj::relocate_sections): Likewise.
16240         * target-reloc.h (scan_relocs): Adjust section symbol index.
16241         (scan_relocatable_relocs): Likewise.
16242         * i386.cc (Scan::local): Check for ordinary symbols.
16243         * sparc.cc (Scan::local): Likewise.
16244         * x86_64.cc (Scan::local): Likewise.
16245         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
16246         to symbol_section_and_value.
16247         * testsuite/many_sections_test.cc: New file.
16248         * testsuite/Makefile.am (BUILT_SOURCES): Define.
16249         (check_PROGRAMS): Add many_sections_test.
16250         (many_sections_test_SOURCES): Define.
16251         (many_sections_test_DEPENDENCIES): Define.
16252         (many_sections_test_LDFLAGS): Define.
16253         (BUILT_SOURCES): Add many_sections_define.h.
16254         (many_sections_define.h): New target.
16255         (BUILT_SOURCES): Add many_sections_check.h.
16256         (many_sections_check.h): New target.
16257         (check_PROGRAMS): Add many_sections_r_test.
16258         (many_sections_r_test_SOURCES): Define.
16259         (many_sections_r_test_DEPENDENCIES): Define.
16260         (many_sections_r_test_LDFLAGS): Define.
16261         (many_sections_r_test_LDADD): Define.
16262         (many_sections_r_test.o): New target.
16263         * testsuite/Makefile.in: Rebuild.
16264
16265 2008-04-17  Cary Coutant  <ccoutant@google.com>
16266
16267         * errors.cc (Errors::info): New function.
16268         (gold_info): New function.
16269         * errors.h (Errors::info): New function.
16270         * gold.h (gold_info): New function.
16271         * object.cc (Input_objects::add_object): Print trace output.
16272         * options.cc (options::parse_set): New function.
16273         (General_options::parse_wrap): Deleted.
16274         (General_options::General_options): Deleted initializer.
16275         * options.h (options::String_set): New typedef.
16276         (options::parse_set): New function.
16277         (DEFINE_set): New macro.
16278         (General_options::wrap): Changed to use DEFINE_set. Changed
16279         callers of any_wrap_symbols and is_wrap_symbol.
16280         (General_options::trace, General_options::trace_symbol):
16281         New options.
16282         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
16283         (General_options::wrap_symbols_): Deleted.
16284         * symtab.cc (Symbol_table::add_from_object): Print trace output.
16285
16286 2008-04-17  David S. Miller  <davem@davemloft.net>
16287
16288         * options.cc (General_options::parse_V): New function.
16289         * options.h: Add entries for -V and -Qy.
16290
16291 2008-04-17  Ian Lance Taylor  <iant@google.com>
16292
16293         * common.cc (Symbol_table::allocate_commons): Remove options
16294         parameter.  Change caller.
16295         (Symbol_table::do_allocate_commons): Remove options parameter.
16296         Change caller.  Just call do_allocate_commons_list twice.
16297         (Symbol_table::do_allocate_commons_list): New function, broken out
16298         of do_allocate_commons.
16299         * common.h (class Allocate_commons_task): Remove options_ field.
16300         Update constructor.
16301         * symtab.cc (Symbol_table::Symbol_table): Initialize
16302         tls_commons_.
16303         (Symbol_table::add_from_object): Put TLS common symbols on
16304         tls_commons_ list.
16305         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
16306         which are IN_OUTPUT_DATA.
16307         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
16308         allocate_commons and do_allocate_commons declarations.  Declare
16309         do_allocate_commons_list.
16310         * gold.cc (queue_middle_tasks): Update creation of
16311         Allocate_commons_task to not pass options.
16312         * testsuite/Makefile.am (INCLUDES): Add -I.. .
16313         (TLS_TEST_C_FLAGS): New variable.
16314         (tls_test_c_pic.o): New target.
16315         (tls_test_shared.so): Link in tls_test_c_pic.o.
16316         (tls_test_c_pic_ie.o): New target.
16317         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
16318         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
16319         (tls_test_c.o): New target.
16320         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
16321         (tls_pic_test_LDADD): Likewise.
16322         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
16323         (tls_shared_gd_to_ie_test_LDADD): Likewise.
16324         (tls_test_c_gnu2.o): New target.
16325         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
16326         tls_test_c_gnu2.o.
16327         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
16328         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
16329         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
16330         * testsuite/tls_test.cc: Include "config.h".
16331         (t_last): Call t11_last.
16332         * testsuite/tls_test.h (t11, t11_last): Declare.
16333         * testsuite/tls_test_c.c: New file.
16334         * testsuite/tls_test_main.cc (thread_routine): Call t11.
16335         * configure.ac: Check for OpenMP support.
16336         * configure, config.in, Makefile.in: Rebuild.
16337         * testsuite/Makefile.in: Rebuild.
16338
16339 2008-04-16  Cary Coutant  <ccoutant@google.com>
16340
16341         * i386.cc (Target_i386::define_tls_base_symbol): New function.
16342         (Target_i386::tls_base_symbol_defined_): New field.
16343         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16344         (Target_i386::Scan::global): Likewise.
16345         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
16346         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
16347         (Target_x86_64::tls_base_symbol_defined_): New field.
16348         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16349         (Target_x86_64::Scan::global): Likewise.
16350
16351 2008-04-16  Cary Coutant  <ccoutant@google.com>
16352
16353         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
16354         (Symbol::needs_plt_entry): Allow weak undefined symbols.
16355         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
16356         building shared libraries.
16357         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
16358         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
16359         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
16360         * testsuite/Makefile.in: Rebuild.
16361         * testsuite/weak_undef.h: New file.
16362         * testsuite/weak_undef_file1.cc: Add extra test cases.
16363         * testsuite/weak_undef_file2.cc: Likewise.
16364         * testsuite/weak_undef_test.cc: Likewise.
16365
16366 2008-04-16  David S. Miller  <davem@davemloft.net>
16367
16368         * sparc.cc (Target_sparc::Scan): Change from struct to class.
16369         Add issued_non_pic_error_ field.  Declare check_non_pic.
16370         (Target_sparc::Scan::check_non_pic): New function.
16371         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
16372         (Target_sparc::Scan::global): Likewise.
16373
16374         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
16375         * configure: Rebuild.
16376
16377         * options.h (DEFINE_enable): New macro.
16378         (new_dtags): New enable option.
16379         (initfirst, interpose, loadfltr, nodefaultlib,
16380         nodelete, nodlopen, nodump): New -z options.
16381         * layout.cc (Layout:finish_dynamic_section): If new
16382         dtags enabled, emit DT_RUNPATH.  Also, emit a
16383         DT_FLAGS_1 containing any specified -z flags.
16384
16385 2008-04-16  Ian Lance Taylor  <iant@google.com>
16386
16387         * copy-relocs.cc: New file.
16388         * copy-relocs.h: New file.
16389         * reloc.cc: Remove Copy_relocs code.
16390         * reloc.h: Likewise.
16391         * reloc-types.h (struct Reloc_types) [both versions]: Add
16392         get_reloc_addend_noerror.
16393         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
16394         variants of add_global which take an addend which must be zero.
16395         * i386.cc: Include "copy-relocs.h".
16396         (class Target_i386): Change type of copy_relocs_ to variable,
16397         update initializer.
16398         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
16399         Change all callers.
16400         (Target_i386::do_finalize_sections): Change handling of
16401         copy_relocs_.
16402         * sparc.cc: Include "copy-relocs.h".
16403         (class Target_sparc): Change type of copy_relocs_ to variable,
16404         update initializer.
16405         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
16406         Change all callers.
16407         (Target_sparc::do_finalize_sections): Change handling of
16408         copy_relocs_.
16409         * x86_64.cc: Include "copy-relocs.h".
16410         (class Target_x86_64): Change type of copy_relocs_ to variable,
16411         update initializer.
16412         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
16413         class.  Change all callers.
16414         (Target_x86_64::do_finalize_sections): Change handling of
16415         copy_relocs_.
16416         * Makefile.am (CCFILES): Add copy-relocs.cc.
16417         (HFILES): Add copy-relocs.h.
16418
16419         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
16420
16421         * testsuite/script_test_4.sh: Permit leading zeroes.
16422
16423 2008-04-15  Ian Lance Taylor  <iant@google.com>
16424
16425         * script-sections.cc (Script_sections::create_segments): Use
16426         header_size_adjustment even when there is enough room for the
16427         headers.
16428         * testsuite/script_test_4.sh: New file.
16429         * testsuite/script_test_4.t: New file.
16430         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
16431         (check_DATA): Add script_test_4.stdout.
16432         (MOSTLYCLEANFILES): Likewise.
16433         (script_test_4): New target.
16434         (script_test_4.stdout): New target.
16435         * testsuite/Makefile.in: Rebuild.
16436
16437         * sparc.cc: Add definitions for Output_data_plt_sparc class
16438         constants.
16439
16440 2008-04-14  David S. Miller  <davem@davemloft.net>
16441
16442         * sparc.cc: New file.
16443         * Makefile.am (TARGETSOURCES): Add sparc.cc
16444         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
16445         * configure.tgt: Document targ_extra_size and
16446         targ_extra_big_endian.  Add entries for sparc-* and
16447         sparc64-*.
16448         * configure.ac: Handle targ_extra_size and
16449         targ_extra_big_endian.
16450         * Makefile.in: Rebuild.
16451         * configure: Likewise.
16452         * po/POTFILES.in: Likewise.
16453         * po/gold.pot: Likewise.
16454
16455 2008-04-14  Ian Lance Taylor  <iant@google.com>
16456
16457         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
16458         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
16459         in the name/type/flags to section mapping.  Don't call
16460         allocate_output_section.
16461         (Layout::choose_output_section): Change parameter from adjust_name
16462         to is_input_section.  Don't permit input sections after sections
16463         are attached to segments.  Don't call allocate_output_section.
16464         (Layout::layout_eh_frame): Call update_flags_for_input_section,
16465         not write_enable_output_section.
16466         (Layout::make_output_section): Don't push to
16467         unattached_section_list_ nor call attach_to_segment.  Call
16468         attach_section_to_segment if sections are attached.
16469         (Layout::attach_sections_to_segments): New function.
16470         (Layout::attach_section_to_segment): New function.
16471         (Layout::attach_allocated_section_to_segment): Rename from
16472         attach_to_segment.  Remove flags parameter.
16473         (Layout::allocate_output_section): Remove function.
16474         (Layout::write_enable_output_section): Remove function.
16475         * layout.h (class Layout): Update for above changes.  Add new
16476         field sections_are_attached_.
16477         * output.h (Output_section::update_flags_for_input_section): New
16478         function.
16479         * output.cc (Output_section::add_input_section): Call
16480         update_flags_for_input_section.
16481         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
16482
16483 2008-04-11  Cary Coutant  <ccoutant@google.com>
16484
16485         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
16486         thought unnecessary.
16487         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
16488
16489 2008-04-11  Ian Lance Taylor  <iant@google.com>
16490
16491         * output.h (class Output_section_data): Remove inline definition
16492         of set_addralign.
16493         * output.cc (Output_section_data::set_addralign): New function.
16494
16495 2008-04-11  Cary Coutant  <ccoutant@google.com>
16496
16497         Add support for TLS descriptors for i386 and x86_64.
16498         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
16499         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
16500         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
16501         GOT_TYPE_TLS_DESC.
16502         (Target_i386::got_mod_index_entry): Remove unnecessary code.
16503         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
16504         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
16505         relocations.
16506         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
16507         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
16508         Fix problem with initial-exec relocations.
16509         (Target_i386::Relocate::relocate_tls): Likewise.
16510         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
16511         relaxation.
16512         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
16513         support for section-plus-offset dynamic table entries.
16514         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
16515         (Output_data_dynamic::Dynamic_entry): Add support for
16516         section-plus-offset dynamic table entries.
16517         (Output_data_dynamic::Classification): Likewise.
16518         (Output_data_dynamic::classification_): Renamed offset_.
16519         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
16520         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
16521         (Target_x86_64::make_plt_section): New function.
16522         (Target_x86_64::reserve_tlsdesc_entries): New function.
16523         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
16524         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
16525         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
16526         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
16527         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
16528         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
16529         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
16530         add extra PLT entry for TLS descriptors.
16531         (Output_data_plt_x86_64::got_): New field.
16532         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
16533         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
16534         fields.
16535         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
16536         descriptors.
16537         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
16538         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
16539         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
16540         R_386_TLS_DESC_CALL relocations.
16541         (Target_x86_64::Scan::global): Likewise.
16542         (Target_x86_64::do_finalize_sections): Add dynamic table entries
16543         for TLS descriptors.
16544         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
16545         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
16546         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
16547         GD-to-IE relaxation.
16548         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
16549         and TLS_DESCRIPTORS.
16550         * Makefile.in: Rebuild.
16551         * configure: Rebuild.
16552         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
16553         (tls_test_shared2.so): New target.
16554         (tls_shared_gd_to_ie_test_SOURCES): New variable.
16555         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
16556         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
16557         (tls_shared_gd_to_ie_test_LDADD): New variable.
16558         (tls_shared_gnu2_gd_to_ie_test): New target.
16559         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
16560         New targets.
16561         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
16562         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
16563         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
16564         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
16565         (tls_shared_gnu2_test): New target.
16566         (tls_test_gnu2_shared.so): New target.
16567         (tls_shared_gnu2_test_SOURCES): New variable.
16568         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
16569         (tls_shared_gnu2_test_LDFLAGS): New variable.
16570         (tls_shared_gnu2_test_LDADD): New variable.
16571         * testsuite/Makefile.in: Rebuild.
16572         * testsuite/Makefile.
16573
16574 2008-04-11  Ian Lance Taylor  <iant@google.com>
16575
16576         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
16577         justsyms.t.
16578         * testsuite/Makefile.in: Rebuild.
16579
16580         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
16581         long.
16582         * testsuite/script_test_2.cc (main): Adjust test.
16583
16584 2008-04-11  David S. Miller  <davem@davemloft.net>
16585             Ian Lance Taylor  <iant@google.com>
16586
16587         * options.h (General_options): Add entries for '-Y' and
16588         '-relax'.
16589         * options.cc (General_options:finalize): If -Y was used, add those
16590         entries to the library path instead of the default "/lib" and
16591         "/usr/lib".
16592
16593 2008-04-11  David S. Miller  <davem@davemloft.net>
16594
16595         * testsuite/justsyms.t: Start at 0x100.
16596         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
16597         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
16598         long.
16599         * testsuite/script_test_2.cc: Adjust string and section length
16600         checks.
16601
16602 2008-04-09  Ian Lance Taylor  <iant@google.com>
16603
16604         PR gold/5996
16605         * script-sections.cc (Sections_element::allocate_to_segment): Add
16606         orphan parameter.
16607         (Output_section_definition::allocate_to_segment): Likewise.
16608         (Orphan_output_section::allocate_to_segment): Likewise.
16609         (Script_sections::attach_sections_using_phdrs_clause): Don't
16610         propagate non-PT_LOAD segments to orphan sections.
16611         * testsuite/Makefile.am (script_test_3.stdout): Generate using
16612         readelf rather than objdump.
16613         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
16614         .interp section and PT_INTERP segment are the same size.
16615         * testsuite/Makefile.in: Rebuild.
16616
16617         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
16618         aliases for symbols defined in the same object.
16619         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
16620         (weak_alias_test_SOURCES): New variable.
16621         (weak_alias_test_DEPENDENCIES): New variable.
16622         (weak_alias_test_LDFLAGS): New variable.
16623         (weak_alias_test_LDADD): New variable.
16624         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
16625         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
16626         (weak_alias_test_3.o): New target.
16627         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
16628         * testsuite/weak_alias_test_main.cc: New file.
16629         * testsuite/weak_alias_test_1.cc: New file.
16630         * testsuite/weak_alias_test_2.cc: New file.
16631         * testsuite/weak_alias_test_3.cc: New file.
16632
16633 2008-04-08  Ian Lance Taylor  <iant@google.com>
16634
16635         * options.h (class General_options): Add --noinhibit-exec option.
16636         * main.cc (main): Check --noinhibit-exec.
16637
16638         * options.h (class General_options): Define --wrap as a special
16639         option.  Add wrap_symbols_ field.
16640         (General_options::any_wrap_symbols): New function.
16641         (General_options::is_wrap_symbol): New function.
16642         * options.cc (General_options::parse_wrap): New function.
16643         (General_options::General_options): Initialize wrap_symbols_.
16644         * symtab.cc (Symbol_table::wrap_symbol): New function.
16645         (Symbol_table::add_from_object): Handle --wrap.
16646         * symtab.h (class Symbol_table): Declare wrap_symbol.
16647         * target.h (Target::wrap_char): New function.
16648         (Target::Target_info): Add wrap_char field.
16649         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
16650         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
16651         * testsuite/testfile.cc (Target_test::test_target_info):
16652         Likewise.
16653
16654         * errors.cc (Errors::undefined_symbol): Mention symbol version if
16655         there is one.
16656
16657         * layout.h (class Layout): Add added_eh_frame_data_ field.
16658         * layout.cc (Layout::Layout): Initialize new field.
16659         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
16660         output section until we find a section we merged successfully.
16661         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
16662         that the size be non-zero.
16663
16664         * merge.cc (Object_merge_map::get_output_offset): Remove inline
16665         qualifier.
16666
16667 2008-04-08  Craig Silverstein  <csilvers@google.com>
16668
16669         * configure.ac: Export new conditional variable HAVE_ZLIB.
16670         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
16671         on HAVE_ZLIB.
16672         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
16673         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16674
16675 2008-04-07  Ian Lance Taylor  <iant@google.com>
16676
16677         * version.cc (version_string): Set to "1.5".
16678
16679         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
16680         Add issued_non_pic_error_ field.  Declare check_non_pic.
16681         (Target_x86_64::Scan::check_non_pic): New function.
16682         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
16683         (Target_x86_64::Scan::global): Likewise.
16684
16685         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
16686         addend parameter.  Change caller.  Handle merge sections.
16687         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
16688         Address to Addend.  Don't add in the result of
16689         local_section_offset, pass down the addend and use the returned
16690         value.
16691         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
16692         Update declarations of local_section_offset and symbol_value.
16693         * testsuite/two_file_test_1.cc (t18): New function.
16694         * testsuite/two_file_test_2.cc (f18): New function.
16695         * testsuite/two_file_test_main.cc (main): Call t18.
16696         * testsuite/two_file_test.h (t18, f18): Declare.
16697
16698         * configure.ac: Don't test for objdump, c++filt, or readelf.
16699         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
16700         conditionals.
16701         (TEST_READELF): New variable.
16702         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
16703         (check_PROGRAMS): Add two_file_strip_test.
16704         (two_file_strip_test): New target.
16705         (check_PROGRAMS): Add two_file_same_shared_strip_test.
16706         (two_file_same_shared_strip_test_SOURCES): New variable.
16707         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
16708         (two_file_same_shared_strip_test_LDFLAGS): New variable.
16709         (two_file_same_shared_strip_test_LDADD): New variable.
16710         (two_file_shared_strip.so): New target.
16711         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
16712         (ver_test_5.syms, ver_test_7.syms): Likewise.
16713         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
16714         (strip_test_3.stdout): Use TEST_OBJDUMP.
16715         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16716
16717 2008-04-04  Cary Coutant  <ccoutant@google.com>
16718
16719         * symtab.h (Symbol::is_weak_undefined): New function.
16720         (Symbol::is_strong_undefined): New function.
16721         (Symbol::is_absolute): New function.
16722         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
16723         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
16724         absolute symbols.
16725         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
16726         (weak_undef_test): New target.
16727         * testsuite/Makefile.in: Rebuild.
16728         * testsuite/weak_undef_file1.cc: New file.
16729         * testsuite/weak_undef_file2.cc: New file.
16730         * testsuite/weak_undef_test.cc: New file.
16731
16732 2008-04-03  Craig Silverstein  <csilvers@google.com>
16733
16734         * compressed_output.h (class Output_compressed_section): Use
16735         unsigned buffer.
16736         * compressed_output.cc (zlib_compress): Use unsigned buffers,
16737         add zlib header.
16738         (zlib_compressed_suffix): Removed.
16739         (Output_compressed_section::set_final_data_size): Use unsigned
16740         buffers.
16741         * testsuite/Makefile.am (flagstest_compress_debug_sections):
16742         Fix linker invocation.
16743         (flagstest_o_specialfile_and_compress_debug_sections):
16744         Likewise.
16745         * testsuite/Makefile.in: Regenerated.
16746
16747 2008-04-02  David S. Miller  <davem@davemloft.net>
16748
16749         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
16750         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
16751
16752 2008-04-02  Craig Silverstein  <csilvers@google.com>
16753
16754         * TODO: New file.
16755
16756 2008-04-02  Ian Lance Taylor  <iant@google.com>
16757
16758         * fileread.cc (File_read::find_view): Add byteshift and vshifted
16759         parameters.  Update for new key type to views_.  Change all
16760         callers.
16761         (File_read::read): Adjust for byteshift in returned view.
16762         (File_read::add_view): New function, broken out of
16763         find_and_make_view.
16764         (File_read::make_view): New function, broken out of
16765         find_and_make_view.
16766         (File_read::find_or_make_view): Add offset and aligned
16767         parameters.  Rewrite accordingly.  Change all callers.
16768         (File_read::get_view): Add offset and aligned parameters.  Adjust
16769         for byteshift in return value.
16770         (File_read::get_lasting_view): Likewise.
16771         * fileread.h (class File_read): Update declarations.
16772         (class File_read::View): Add byteshift_ field.  Add byteshift to
16773         constructor.  Add byteshift method.
16774         * archive.h (Archive::clear_uncached_views): New function.
16775         (Archive::get_view): Add aligned parameter.  Change all callers.
16776         * object.h (Object::get_view): Add aligned parameter.  Change all
16777         callers.
16778         (Object::get_lasting_view): Likewise.
16779
16780         * fileread.cc (File_read::release): Don't call clear_views if
16781         there are multiple objects.
16782         * fileread.h (File_read::clear_uncached_views): New function.
16783         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
16784         on the archive.
16785
16786 2008-03-31  Cary Coutant  <ccoutant@google.com>
16787
16788         Add thin archive support.
16789         * archive.cc (Archive::armagt): New const.
16790         (Archive::setup): Remove task parameter and calls to unlock.
16791         (Archive::unlock_nested_archives): New function.
16792         (Archive::read_header): Add nested_off parameter. Change
16793         all callers.
16794         (Archive::interpret_header): Likewise.
16795         (Archive::include_all_members): Change to handle thin
16796         archives.
16797         (Archive::include_member): Likewise.
16798         * archive.h (Archive::Archive): Add new parameters and
16799         initializers.
16800         (Archive::armagt): New const.
16801         (Archive::setup): Remove task parameter.
16802         (Archive::unlock_nested_archives): New function.
16803         (Archive::read_header): Add nested_off parameter.
16804         (Archive::interpret_header): Likewise.
16805         (Archive::Nested_archive_table): New typedef.
16806         (Archive::is_thin_archive_): New field.
16807         (Archive::nested_archives_): New field.
16808         (Archive::options_): New field.
16809         (Archive::dirpath_): New field.
16810         (Archive::task_): New field.
16811         * readsyms.cc (Read_symbols::do_read_symbols): Add check
16812         for thin archives.  Pass additional parameters to
16813         Archive::Archive.  Unlock the archive file after calling
16814         Archive::setup.
16815
16816 2008-03-29  Ian Lance Taylor  <iant@google.com>
16817
16818         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
16819         version symbol to be local.
16820         * testsuite/ver_test_4.sh: New file.
16821         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
16822         (check_DATA): Add ver_test_4.syms.
16823         (ver_test_4.syms): New target.
16824         * testsuite/Makefile.in: Rebuild.
16825
16826         * output.cc
16827         (Output_section::Input_section_sort_entry::has_priority): New
16828         function.
16829         (Output_section::Input_section_sort_entry::match_file_name): New
16830         function.
16831         (Output_section::Input_section_sort_entry::match_section_name):
16832         Remove.
16833         (Output_section::Input_section_sort_entry::match_section_name_prefix):
16834         Remove.
16835         (Output_section::Input_section_sort_entry::match_section_file):
16836         Remove.
16837         (Output_section::Input_section_sort_compare::operator()): Rewrite
16838         using new Input_section_sort_entry functions.  Sort crtbegin and
16839         crtend first.  Sort sections with no priority before sections with
16840         a priority.
16841         * testsuite/initpri1.c (d3): Check j != 4.
16842         (cd5): New constructor/destructor function.
16843         (main): Check j != 2.
16844
16845         * symtab.cc (Symbol_table::add_from_object): If we don't use the
16846         new symbol when resolving, don't call set_is_default.
16847         * testsuite/ver_test_7.cc: New file.
16848         * testsuite/ver_test_7.sh: New file.
16849         * testsuite/Makefile.am (ver_test_7.so): New target.
16850         (ver_test_7.o): New target.
16851         (check_SCRIPTS): Add ver_test_7.sh.
16852         (check_DATA): Add ver_test_7.syms.
16853         (ver_test_7.syms): New target.
16854
16855 2008-03-28  Ian Lance Taylor  <iant@google.com>
16856
16857         * layout.cc (Layout::layout): If we see an input section with a
16858         name that needs sorting, set the must_sort flag for the output
16859         section.
16860         (Layout::make_output_section): If the name of the output section
16861         indicates that it might require sorting, set the may_sort flag.
16862         * output.h (Output_section::may_sort_attached_input_sections): New
16863         function.
16864         (Output_section::set_may_sort_attached_input_sections): New
16865         function.
16866         (Output_section::must_sort_attached_input_sections): New
16867         function.
16868         (Output_section::set_must_sort_attached_input_sections): New
16869         function.
16870         (class Output_section): Declare Input_section_sort_entry.  Define
16871         Input_section_sort_compare.  Declare
16872         sort_attached_input_sections.  Add new fields:
16873         may_sort_attached_input_sections_,
16874         must_sort_attached_input_sections_,
16875         attached_input_sections_are_sorted_.
16876         * output.cc (Output_section::Output_section): Initialize new
16877         fields.
16878         (Output_section::add_input_section): Add an entry to
16879         input_sections_ if may_sort or must_sort are true.
16880         (Output_section::set_final_data_size): Call
16881         sort_attached_input_sections if necessary.
16882         (Output_section::Input_section_sort_entry): Define new class.
16883         (Output_section::Input_section_sort_compare::operator()): New
16884         function.
16885         (Output_section::sort_attached_input_sections): New function.
16886         * configure.ac: Check whether the compiler supports constructor
16887         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
16888         * testsuite/initpri1.c: New file.
16889         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
16890         CONSTRUCTOR_PRIORITY.
16891         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
16892         (initpri1_LDFLAGS): New variable.
16893         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16894
16895 2008-03-27  Ian Lance Taylor  <iant@google.com>
16896
16897         * common.cc (Sort_commons::operator): Correct sorting algorithm.
16898         * testsuite/common_test_1.c: New file.
16899         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
16900         (common_test_1_SOURCES): New variable.
16901         (common_test_1_DEPENDENCIES): New variable.
16902         (common_test_1_LDFLAGS): New variable.
16903
16904         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
16905         and commons_ correctly when NAME/VERSION does not override
16906         NAME/NULL.
16907         * testsuite/ver_test_6.c: New file.
16908         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
16909         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
16910         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
16911
16912 2008-03-26  Ian Lance Taylor  <iant@google.com>
16913
16914         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
16915         of an undefined symbol from a version script.
16916         * testsuite/Makefile.am (ver_test_5.so): New target.
16917         (ver_test_5.o): New target.
16918         (check_SCRIPTS): Add ver_test_5.sh.
16919         (check_DATA): Add ver_test_5.syms.
16920         (ver_test_5.syms): New target.
16921         * testsuite/ver_test_5.cc: New file.
16922         * testsuite/ver_test_5.script: New file.
16923         * testsuite/ver_test_5.sh: New file.
16924         * Makefile.in, testsuite/Makefile.in: Rebuild.
16925
16926         PR gold/5986
16927         Fix problems building gold with gcc 4.3.0.
16928         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
16929         (gold_error_at_location, gold_warning_at_location): Use it.
16930         * configure.ac: Check whether we can compile and use a template
16931         function with a printf attribute.
16932         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
16933         when jumping over bytes.
16934         * object.cc: Instantiate Object::read_section_data.
16935         * debug.h: Include <cstring>
16936         * dwarf_reader.cc: Include <algorithm>
16937         * main.cc: Include <cstring>.
16938         * options.cc: Include <cstring>.
16939         * output.cc: Include <cstring>.
16940         * script.cc: Include <cstring>.
16941         * script.h: Include <string>.
16942         * symtab.cc: Include <cstring> and <algorithm>.
16943         * target-select.cc: Include <cstring>.
16944         * version.cc: Include <string>.
16945         * testsuite/testmain.cc: Include <cstdlib>.
16946         * configure, config.in: Rebuild.
16947
16948 2008-03-25  Ian Lance Taylor  <iant@google.com>
16949
16950         * options.cc: Include "../bfd/bfdver.h".
16951         (options::help): Print bug reporting address.
16952
16953         * version.cc (print_version): Adjust output for current value of
16954         BFD_VERSION_STRING.
16955
16956         * NEWS: New file.
16957
16958         * options.cc (options::help): Print list of supported targets.
16959         * target-select.h: Include <vector>.
16960         (class Target_selector): Make machine_, size_, and is_big_endian_
16961         fields const.  Add bfd_name_ and instantiated_target_ fields.
16962         (Target_selector::Target_selector): Add bfd_name parameter.
16963         (Target_selector::recognize): Make non-virtual, call
16964         do_recognize.
16965         (Target_selector::recognize_by_name): Make non-virtual, call
16966         do_recognize_by_name.
16967         (Target_selector::supported_names): New function.
16968         (Target_selector::bfd_name): New function.
16969         (Target_selector::do_instantiate_target): New pure virtual
16970         function.
16971         (Target_selector::do_recognize): New virtual function.
16972         (Target_selector::do_recognize_by_name): New virtual function.
16973         (Target_selector::instantiate_target): New private function.
16974         (supported_target_names): Declare.
16975         * target-select.cc (Target_selector::Target_selector): Update for
16976         new parameter and fields.
16977         (select_target_by_name): Check that the name matches before
16978         calling recognize_by_name.
16979         (supported_target_names): New function.
16980         * i386.cc (class Target_selector_i386): Update Target_selector
16981         constructor call.  Remove recognize and recognize_by_name.  Add
16982         do_instantiate_target.
16983         * x86_64.cc (class Target_selector_x86_64): Likewise.
16984         * testsuite/testfile.cc (class Target_selector_test): Update for
16985         changes to Target_selector.
16986
16987         * README: Rewrite, with some notes on unsupported features.
16988
16989 2008-03-24  Cary Coutant  <ccoutant@google.com>
16990
16991         * i386.cc (Target_i386::Got_type): New enum declaration.
16992         (Target_i386::Scan::local): Updated callers of Output_data_got
16993         member functions.
16994         (Target_i386::Scan::global): Likewise.
16995         (Target_i386::Relocate::relocate): Likewise.
16996         (Target_i386::Relocate::relocate_tls): Likewise.
16997         * object.h (Got_offset_list): New class.
16998         (Sized_relobj::local_has_got_offset): Added got_type parameter.
16999         (Sized_relobj::local_got_offset): Likewise.
17000         (Sized_relobj::set_local_got_offset): Likewise.
17001         (Sized_relobj::local_has_tls_got_offset): Removed.
17002         (Sized_relobj::local_tls_got_offset): Removed.
17003         (Sized_relobj::set_local_tls_got_offset): Removed.
17004         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
17005         * output.cc (Output_data_got::add_global): Added got_type parameter.
17006         (Output_data_got::add_global_with_rel): Likewise.
17007         (Output_data_got::add_global_with_rela): Likewise.
17008         (Output_data_got::add_global_pair_with_rel): New function.
17009         (Output_data_got::add_global_pair_with_rela): New function.
17010         (Output_data_got::add_local): Added got_type parameter.
17011         (Output_data_got::add_local_with_rel): Likewise.
17012         (Output_data_got::add_local_with_rela): Likewise.
17013         (Output_data_got::add_local_pair_with_rel): New function.
17014         (Output_data_got::add_local_pair_with_rela): New function.
17015         (Output_data_got::add_global_tls): Removed.
17016         (Output_data_got::add_global_tls_with_rel): Removed.
17017         (Output_data_got::add_global_tls_with_rela): Removed.
17018         (Output_data_got::add_local_tls): Removed.
17019         (Output_data_got::add_local_tls_with_rel): Removed.
17020         (Output_data_got::add_local_tls_with_rela): Removed.
17021         * output.h (Output_data_got::add_global): Added got_type parameter.
17022         (Output_data_got::add_global_with_rel): Likewise.
17023         (Output_data_got::add_global_with_rela): Likewise.
17024         (Output_data_got::add_global_pair_with_rel): New function.
17025         (Output_data_got::add_global_pair_with_rela): New function.
17026         (Output_data_got::add_local): Added got_type parameter.
17027         (Output_data_got::add_local_with_rel): Likewise.
17028         (Output_data_got::add_local_with_rela): Likewise.
17029         (Output_data_got::add_local_pair_with_rel): New function.
17030         (Output_data_got::add_local_pair_with_rela): New function.
17031         (Output_data_got::add_global_tls): Removed.
17032         (Output_data_got::add_global_tls_with_rel): Removed.
17033         (Output_data_got::add_global_tls_with_rela): Removed.
17034         (Output_data_got::add_local_tls): Removed.
17035         (Output_data_got::add_local_tls_with_rel): Removed.
17036         (Output_data_got::add_local_tls_with_rela): Removed.
17037         * resolve.cc (Symbol::override_base_with_special): Removed
17038         reference to has_got_offset_ field.
17039         * symtab.cc (Symbol::init_fields): Replaced initialization
17040         of got_offset_ with got_offsets_.  Removed initialization
17041         of has_got_offset_
17042         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
17043         (Symbol::got_offset): Likewise.
17044         (Symbol::set_got_offset): Likewise.
17045         (Symbol::has_tls_got_offset): Removed.
17046         (Symbol::tls_got_offset): Removed.
17047         (Symbol::set_tls_got_offset): Removed.
17048         (Symbol::got_offset_): Removed.
17049         (Symbol::tls_mod_got_offset_): Removed.
17050         (Symbol::tls_pair_got_offset_): Removed.
17051         (Symbol::got_offsets_): New field.
17052         (Symbol::has_got_offset): Removed.
17053         (Symbol::has_tls_mod_got_offset): Removed.
17054         (Symbol::has_tls_pair_got_offset): Removed.
17055         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
17056         (Target_x86_64::Scan::local): Updated callers of Output_data_got
17057         member functions.
17058         (Target_x86_64::Scan::global): Likewise.
17059         (Target_x86_64::Relocate::relocate): Likewise.
17060         (Target_x86_64::Relocate::relocate_tls): Likewise.
17061
17062 2008-03-25  Ben Elliston  <bje@au.ibm.com>
17063
17064         * yyscript.y: Fix spelling error in comment.
17065
17066 2008-03-24  Ian Lance Taylor  <iant@google.com>
17067
17068         * options.h (class General_options): Define build_id option.
17069         * layout.h (class Layout): Declare write_build_id, create_note,
17070         create_build_id.  Add build_id_note_ member.
17071         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
17072         "libiberty.h", "md5.h", "sha1.h".
17073         (Layout::Layout): Initialize eh_frame_data_,
17074         eh_frame_hdr_section_, and build_id_note_.
17075         (Layout::finalize): Call create_build_id.
17076         (Layout::create_note): New function, broken out of
17077         Layout::create_gold_note.
17078         (Layout::create_gold_note): Call create_note.
17079         (Layout::create_build_id): New function.
17080         (Layout::write_build_id): New function.
17081         (Close_task_runner::run): Call write_build_id.
17082
17083         * x86_64.cc: Correct license to GPLv3.
17084
17085 2008-03-23  Ian Lance Taylor  <iant@google.com>
17086
17087         * options.cc: Include "demangle.h".
17088         (parse_optional_string): New function.
17089         (parse_long_option): Handle takes_optional_argument.
17090         (parse_short_option): Update dash_z initializer.  Handle
17091         takes_optional_argument.
17092         (General_options::General_options): Initialize do_demangle_.
17093         (General_options::finalize): Set do_demangle_.  Handle demangling
17094         style.
17095         * options.h (parse_optional_string): Declare.
17096         (struct One_option): Add optional_arg field.  Update constructor.
17097         Update call constructor calls.  Add takes_optional_argument
17098         function.
17099         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
17100         (DEFINE_optional_string): Define.
17101         (General_options::demangle): Change from DEFINE_bool to
17102         DEFINE_optional_string.
17103         (General_options::no_demangle): New function.
17104         (General_options::do_demangle): New function.
17105         (General_options::set_do_demangle): New function.
17106         (General_options::execstack_status_): Move definition to end of
17107         class definition.
17108         (General_options::static_): Likewise.
17109         (General_options::do_demangle_): New field.
17110         * object.cc (big_endian>::get_symbol_location_info): Call
17111         Options::do_demangle, not Options::demangle.
17112         * symtab.cc (demangle): Likewise.
17113
17114 2008-03-22  Ian Lance Taylor  <iant@google.com>
17115
17116         * gold.h: Include <cstddef> and <sys/types.h>
17117         * options.h: Include <cstring>.
17118
17119 2008-03-21  Ian Lance Taylor  <iant@google.com>
17120
17121         * Added source code to GNU binutils.
17122 \f
17123 Copyright (C) 2008-2015 Free Software Foundation, Inc.
17124
17125 Copying and distribution of this file, with or without modification,
17126 are permitted in any medium without royalty provided the copyright
17127 notice and this notice are preserved.
17128
17129 Local Variables:
17130 mode: change-log
17131 left-margin: 8
17132 fill-column: 74
17133 version-control: never
17134 End: