180aef021a8f0e5cea8c84b7c57887f09fde5b6b
[external/binutils.git] / gold / ChangeLog
1 2015-04-09  Cary Coutant  <ccoutant@google.com>
2
3         * symtab.cc (Symbol::final_value_is_known): Check for TLS symbol
4         in a PIE link.
5         * testsuite/Makefile.am (tls_pie_test.sh): New test.
6         * testsuite/Makefile.in: Regenerate.
7         * testsuite/tls_pie_test.sh: New.
8
9 2015-04-09  Cary Coutant  <ccoutant@google.com>
10
11         * debug.h (DEBUG_LOCATION): New.
12         (DEBUG_ALL): Include DEBUG_LOCATION.
13         (debug_string_to_enum): Add DEBUG_LOCATION.
14         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug
15         output to print correct context.
16         (Sized_dwarf_line_info::do_addr2line): Add debug output. Return
17         up to 4 more locations at the beginning of the function.
18         * symtab.cc (Symbol_table::detect_odr_violations): Get canonical
19         result before sorting list of line numbers.
20         * testsuite/debug_msg.sh: Allow range of line numbers for
21         canonical results on optimized code.
22
23 2015-04-07  HC Yen <hc.yen@mediatek.com>
24
25         Add AArch32 support for gold linker.
26         gold/
27         * arm.cc: Add V8 arch combine table.
28
29 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
30
31         * aarch64.cc (do_reloc_addend): Fix signature to match the parent one.
32
33 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
34
35         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a call
36         to find by using the return value of insert.
37
38 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
39
40         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a copy
41         constructor call.
42
43 2015-04-06  Ilya Tocar  <ilya.tocar@intel.com>
44
45         PR gold/17641
46         * x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
47         (Target_x86_64::Scan::local): Don't create GOT entry, when we
48         can convert mov to lea.
49         (Target_x86_64::Scan::global): Ditto.
50         (Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
51         %reg to lea foo(%rip), %reg if possible.
52         * testsuite/Makefile.am (x86_64_mov_to_lea): New test.
53         * testsuite/x86_64_mov_to_lea1.s: New.
54         * testsuite/x86_64_mov_to_lea2.s: Ditto.
55         * testsuite/x86_64_mov_to_lea3.s: Ditto.
56         * testsuite/x86_64_mov_to_lea4.s: Ditto.
57         * testsuite/x86_64_mov_to_lea.sh: Ditto.
58
59 2015-04-02  H.J. Lu  <hongjiu.lu@intel.com>
60
61         * configure: Regenerated.
62
63 2015-04-01  Ilya Tocar  <ilya.tocar@intel.com>
64
65         PR gold/17640
66         * i386.cc (Target_i386::can_convert_mov_to_lea): New.
67         (Target_i386::Scan::local): Don't create GOT entry, when we
68         can convert GOT to GOTOFF.
69         (Target_i386::Scan::global): Ditto.
70         (Target_i386::Relocate::relocate): Convert  mov foo@GOT(%reg), %reg to
71         lea foo@GOTOFF(%reg), %reg if possible.
72         * testsuite/Makefile.am (i386_mov_to_lea): New test.
73         * testsuite/i386_mov_to_lea1.s: New.
74         * testsuite/i386_mov_to_lea2.s: Ditto.
75         * testsuite/i386_mov_to_lea3.s: Ditto.
76         * testsuite/i386_mov_to_lea4.s: Ditto.
77         * testsuite/i386_mov_to_lea5.s: Ditto.
78         * testsuite/i386_mov_to_lea.sh: Ditto.
79
80 2015-04-01  H.J. Lu  <hongjiu.lu@intel.com>
81
82         * Makefile.am (ZLIB): New.
83         (ZLIBINC): Likewise.
84         (AM_CFLAGS): Add $(ZLIBINC).
85         (AM_CXXFLAGS): Likewise.
86         (ldadd_varldadd_var): Add $(ZLIB).
87         (incremental_dump_LDADD): Likewise.
88         (dwp_LDADD): Likewise.
89         * compressed_output.cc: Don't check HAVE_ZLIB_H to include
90         <zlib.h>.
91         (zlib_compress): Don't check HAVE_ZLIB_H.
92         (zlib_decompress): Likewise.
93         * options.h (compress_debug_sections): Likewise.
94         * configure.ac (AM_CONDITIONAL): Removed.
95         * testsuite/Makefile.am (ZLIB): New.
96         (LDADD): Add $(ZLIB).
97         Don't check HAVE_ZLIB.
98         * Makefile.in: Regenerated.
99         * config.in: Likewise.
100         * configure: Likewise.
101         * testsuite/Makefile.in: Likewise.
102
103 2015-03-30  Jing Yu  <jingyu@google.com>
104
105         * aarch64-reloc.def: New TLSLD_ADD_DTPREL_HI12,
106         TLSLD_ADD_DTPREL_LO12_NC.
107         * aarch64.cc (Target_aarch64::define_tls_base_symbol): Always let
108         _TLS_MODULE_BASE_ point to the start of tls segment.
109         (Target_aarch64::optimize_tls_reloc): Add cases for
110         R_AARCH64_TLSLD_ADD_DTPREL_HI12 and
111         R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
112         (Target_aarch64::Scan::local): Likewise.
113         (Target_aarch64::Scan::global): Likewise.
114         (Target_aarch64::Relocate::relocate): Likewise.
115         (Target_aarch64::Relocate::relocate_tls): Likewise. And remove
116         subtracting tls segment size from symbol value for TLSLD_*_DTPREL
117         relocations.
118
119 2015-03-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
120
121         * merge.cc (Object_merge_map::add_mapping): call
122         Object_merge_map::Input_merge_map::add_mapping.
123         (Object_merge_map::Input_merge_map::add_mapping): New.
124         (Output_merge_data::do_add_input_section): Call
125         get_or_make_input_merge_map before a loop.
126         (Output_merge_string<Char_type>::finalize_merged_data): Call
127         get_or_make_input_merge_map before a loop.
128         * merge.h (Object_merge_map): Make Input_merge_map public.
129         * object.cc (Relobj::add_merge_mapping): Use get_or_create_merge_map.
130         (Relobj::get_or_create_merge_map): New.
131         * object.h (Relobj::get_or_create_merge_map): New.
132
133 2015-03-24  Alan Modra  <amodra@gmail.com>
134
135         PR 18147
136         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
137         relocation errors for branches to strong undefined symbols.
138
139 2015-03-23  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
140
141         * merge.cc (Object_merge_map::get_input_merge_map): Make it const.
142         (Object_merge_map::is_merge_section_for): Remove.
143         (Object_merge_map::find_merge_section): New.
144         * merge.h (Object_merge_map::is_merge_section_for): Remove.
145         (Object_merge_map::find_merge_section): New.
146         (Object_merge_map::get_input_merge_map): Add a const version.
147         * object.cc (Relobj::is_merge_section_for): Remove.
148         (Relobj::find_merge_section): New.
149         * object.h (Relobj::is_merge_section_for): Remove.
150         (Relobj::find_merge_section): New.
151         * output.cc
152         (Output_section::Input_section::is_merge_section_for): Remove.
153         (Output_section::add_merge_input_section): Don't call
154         add_merge_input_section.
155         (Output_section::find_merge_section): Return const. Use
156         object->find_merge_section.
157         (Output_section::build_lookup_maps): Don't build a map for
158         merge sections.
159         (Output_section::is_input_address_mapped): Return false if
160         section is not found.
161         (Output_section::find_starting_output_address): Use
162         find_merge_section instead of is_merge_section_for.
163         (Output_section::add_script_input_section):  Don't build a map for
164         merge sections.
165         * output.h (Output_section_lookup_maps::merge_sections_by_id_): Remove.
166         (Output_section_lookup_maps::find_merge_section): Remove.
167         (Output_section_lookup_maps::add_merge_input_section) Remove.
168         (Output_section::find_merge_section): Return const.
169
170 2015-03-22  Cary Coutant  <cary@google.com>
171
172         PR gold/18106
173         * i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
174         non-SIB form of lea, with nop after the call.
175
176 2015-03-21  Cary Coutant  <cary@google.com>
177
178         PR gold/14217
179         * output.cc (Output_segment::is_first_section_relro): Don't ignore
180         .tdata section.
181         (Output_segment::set_section_addresses): Don't align size of relro
182         segment for .tbss.
183
184 2015-03-21  Cary Coutant  <cary@google.com>
185
186         PR gold/18010
187         * stringpool.cc (Stringpool_template): Don't optimize if section
188         alignment is greater than sizeof(char).
189
190 2015-03-21  Cary Coutant  <cary@google.com>
191
192         PR gold/18048
193         * script-c.h (script_include_directive): Add first_token parameter.
194         * script.cc (script_include_directive): Add first_token parameter, and
195         pass it to read_script_file.
196         * yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
197         (PARSING_MEMORY_DEF): New tokens.
198         (top): Add new productions for INCLUDE files.
199         (file_cmd): Replace file_or_sections_cmd with copy of its productions.
200         Pass PARSING_LINKER_SCRIPT to script_include_directive.
201         (section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
202         (section_cmd): Pass PARSING_SECTION_CMDS.
203         (file_or_sections_cmd): Remove.
204         (memory_def): Pass PARSING_MEMORY_DEF.
205         * testsuite/Makefile.am (memory_test_2): New test.
206         * testsuite/Makefile.in: Regenerate.
207         * testsuite/memory_test_inc.t: New script file.
208         * testsuite/memory_test_inc_1.t.src: New script file.
209         * testsuite/memory_test_inc_2.t.src: New script file.
210         * testsuite/memory_test_inc_3.t.src: New script file.
211
212 2015-03-21  Cary Coutant  <cary@google.com>
213
214         * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
215         (Sized_relobj_dwo::setup): Build compressed section map.
216         (Sized_relobj_dwo::do_decompressed_section_contents): Delete.
217         * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
218         section map.
219         * object.cc (Sized_relobj_file::Sized_relobj_file): Remove
220         compressed_sections_ field.
221         (build_compressed_section_map): Take Object instead of
222         Sized_relobj_file parameter; add decompress_if_needed parameter.
223         (Sized_relobj_file::do_find_special_sections): Store compressed
224         section map in parent Object.
225         (Sized_relobj_file::do_decompressed_section_contents): Move
226         implementation to Object::decompressed_section_contents.
227         (Sized_relobj_file::do_discard_decompressed_sections): Move
228         implementation to Object::discard_decompressed_sections.
229         * object.h (build_compressed_section_map): Declare.
230         (Object::Object): Add compressed_sections_ field.
231         (Object::section_is_compressed): Move implementation here.
232         (Object::decompressed_section_contents): De-virtualize.
233         (Object::discard_decompressed_sections): De-virtualize.
234         (Object::do_section_is_compressed): Delete.
235         (Object::do_decompressed_section_contents): Delete.
236         (Object::set_compressed_sections): New method.
237         (Object::compressed_sections): New method.
238         (Object::compressed_sections_): New data member.
239         (Compressed_section_info, Compressed_section_map): Move to top of file.
240         (Sized_relobj_file::do_section_is_compressed): Delete.
241         (Sized_relobj_file::do_decompressed_section_contents): Delete.
242         (Sized_relobj_file::do_discard_decompressed_sections): Delete.
243         (Sized_relobj_file::compressed_sections_): Move to Object class.
244
245 2015-03-21  Cary Coutant  <ccoutant@google.com>
246
247         PR gold/18152
248         * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
249         deferred objects.
250
251 2015-03-11  Cary Coutant  <ccoutant@google.com>
252
253         * options.cc (General_options::finalize): Don't allow -z relro
254         with incremental linking.
255         * testsuite/Makefile.am (incremental_test): Add -z norelro.
256         (incremental_test_2): Likewise.
257         (incremental_test_3): Likewise.
258         (incremental_test_4): Likewise.
259         (incremental_test_5): Likewise.
260         (incremental_test_6): Likewise.
261         (incremental_copy_test): Likewise.
262         (incremental_common_test_1): Likewise.
263         (incremental_comdat_test_1): Likewise.
264         * testsuite/Makefile.in: Regenerate.
265
266 2015-03-09  Cary Coutant  <ccoutant@google.com>
267
268         PR gold/14675
269         * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
270         return enum indicating whether .eh_frame section is empty, optimizable,
271         unrecognized, or an end marker. Adjust explicit instantiations.
272         * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
273         (Eh_frame::add_ehframe_input_section): Change return type.
274         * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
275         * layout.cc (Layout::layout_eh_frame): Don't add optimized sections
276         to the .eh_frame output section until we see the end marker.
277         (Layout::finalize_eh_frame_section): New.
278         * layout.h: (Layout::finalize_eh_frame_section): New.
279
280 2015-03-05  H.J. Lu  <hongjiu.lu@intel.com>
281
282         * output.cc (Relobj::initialize_input_to_output_map<size>):
283         Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
284
285 2015-03-04  Cary Coutant  <ccoutant@google.com>
286
287         * parameters.cc (Parameters::set_target_once): Call
288         Target::select_as_default_target just once from here...
289         (set_parameters_target): ...instead of from here.
290
291 2015-03-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
292
293         * ehframe.cc (Cie::set_output_offset): Pass in and use a
294         Output_section_data instead of a Merge_map.
295         (Eh_frame::Eh_frame): Don't initialize merge_map_.
296         (Eh_frame::read_cie): Use add_merge_mapping instead of
297         Merge_map::add_mapping.
298         (Eh_frame::read_fde): Ditto.
299         (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
300         (Eh_frame::do_output_offset): Use merge_output_offset istead of
301         merge_map_->get_output_offset.
302         (Eh_frame::do_is_merge_section_for): Delete.
303         * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
304         instead of a Merge_map.
305         (Cie::set_output_offset): Pass in a Output_section_data instead of a
306         Merge_map.
307         (Eh_frame::do_is_merge_section_for): Delete.
308         (Eh_frame::merge_map_): Delete.
309         * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
310         and use a Output_section_data instead of a Merge_map.
311         (Object_merge_map::add_mapping): Ditto.
312         (Object_merge_map::get_output_offset): Remove the merge_map argument.
313         (Object_merge_map::is_merge_section_for): Pass in and use a
314         Output_section_data instead of a Merge_map.
315         (Merge_map): Delete.
316         (Output_merge_base::do_output_offset): Use merge_output_offset instead
317         of merge_map_.get_output_offset.
318         (Output_merge_base::do_is_merge_section_for): Delete.
319         (Output_merge_data::do_add_input_section): Use
320         object->add_merge_mapping instead of add_mapping.
321         (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
322         * merge.h (Merge_map): Delete forward declaration.
323         (Object_merge_map::add_mapping): Pass in and use a Output_section_data
324         instead of a Merge_map.
325         (Object_merge_map::get_output_offset): Remove the merge_map argument.
326         (Object_merge_map::is_merge_section_for): Pass in and use a
327         Output_section_data instead of a Merge_map.
328         (Input_merge_map::Object_merge_map::merge_map): Replace with
329         output_data.
330         (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
331         Output_section_data instead of a Merge_map.
332         (Merge_map): Delete.
333         (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
334         (Output_merge_base::do_is_merge_section_for): Delete.
335         (Output_merge_base::add_mapping): Delete.
336         (Output_merge_base::merge_map_): Delete.
337         * object.cc (Relobj::initialize_input_to_output_map): New.
338         (Relobj::initialize_input_to_output_map): New.
339         (Relobj::merge_output_offset): New.
340         (Relobj::is_merge_section_for): New.
341         (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
342         bits.
343         * object.h (Relobj::merge_map): Delete.
344         (initialize_input_to_output_map): New.
345         (set_merge_map): Delete.
346         (add_merge_mapping): New.
347         (merge_output_offset): New.
348         (is_merge_section_for): New.
349         * output.cc (Output_section::Input_section::is_merge_section_for):
350         Use object->is_merge_section_for.
351         * output.h (Output_section_data::is_merge_section_for): Delete.
352         (Output_section_data::do_is_merge_section_for): Delete.
353         * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
354         Use object->initialize_input_to_output_map.
355         (Merged_symbol_value<size>::value_from_output_section): Use
356         object->merge_output_offset.
357
358 2015-03-02  Peter Collingbourne  <pcc@google.com>
359             Cary Coutant  <ccoutant@google.com>
360
361         * output.cc (Output_section::add_merge_input_section): Do not
362         attempt to merge sections with an entsize of 0.
363
364 2015-03-02  Khem Raj  <raj.khem@gmail.com>
365
366         * attributes.h (class Output_attributes_section_data ): Add
367         do_print_to_mapfile function.
368
369 2015-02-24  Alan Modra  <amodra@gmail.com>
370
371         PR 18010
372         * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
373         complain if value is not a multiple of four.
374         (Target_powerpc::Relocate::relocate): Correct handling of
375         R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
376
377 2015-02-21  H.J. Lu  <hongjiu.lu@intel.com>
378
379         * configure.ac (default_size): Set to 32 for x32.
380         * configure: Regenerated.
381
382 2015-02-18  Alan Modra  <amodra@gmail.com>
383
384         PR 17954
385         * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
386         visibility.
387
388 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
389
390         * gc.h (Garbage_collection::add_reference): Don't use find.
391
392 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
393
394         * object.cc (write_local_symbols): avoid std::vector copy.
395
396 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
397
398         * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
399
400 2015-02-09  Mark Wielaard  <mjw@redhat.com>
401
402         * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
403         DW_LANG_Fortran03 and DW_LANG_Fortran08.
404
405 2015-02-16  Cary Coutant  <ccoutant@google.com>
406
407         PR gold/13577
408         PR gold/16992
409         * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
410         DF_SYMBOLIC if --dynamic-list option is used.
411         * options.cc (General_options::finalize): --dynamic-list is not
412         mutually exclusive with -Bsymbolic.
413         * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
414         listed in --dynamic-list.
415         * testsuite/Makefile.am (dynamic_list_lib2.so): Add
416         -Bsymbolic-functions.
417         * testsuite/Makefile.in: Regenerate.
418
419 2015-02-16  Cary Coutant  <ccoutant@google.com>
420
421         PR gold/17971
422         * incremental.cc: Remove redundant include of "output.h".
423
424 2015-02-12  Jing Yu  <jingyu@google.com>
425
426         * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
427         TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
428         New relocation.
429         * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
430         TLSLE_MOVW_* relocations.
431         (Target_aarch64::Scan::global): Likewise.
432         (Target_aarch64::Relocate::relocate): Likewise.
433         (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
434         for new TLSLE_MOVW_* relocations.
435
436 2015-02-11  Will Newton  <will.newton@linaro.org>
437
438         PR gold/13321
439         * arm.cc (Target_arm::make_plt_section): Create an ARM
440         state mapping symbol at the start of the PLT.
441
442 2015-02-09  H.J. Lu  <hongjiu.lu@intel.com>
443
444         * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
445         Replace two_file_shared_2.so with two_file_shared_1.so.
446         * testsuite/Makefile.in: Regenerated.
447
448 2015-02-09  Alan Modra  <amodra@gmail.com>
449
450         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
451         plugin_test_thin.a and defsym_test.
452         * testsuite/Makefile.in: Regenerate.
453
454 2015-02-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
455
456         * merge.cc (do_add_input_section): Combine loop epilogue into main loop
457         body.
458
459 2015-02-04  Peter Collingbourne  <pcc@google.com>
460
461         * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
462         forwarding symbols when computing symbol resolution info for plugins.
463         * plugin.h (Plugin_manager::symtab): New method.
464         (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
465
466 2015-02-03  Cary Coutant  <ccoutant@google.com>
467             Peter Collingbourne  <pcc@google.com>
468
469         PR gold/15660
470         * archive.cc (Thin_archive_object_unlocker): New class.
471         (Archive::include_member): Unlock external members of thin archives.
472         * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
473         (plugin_test_2): Likewise.
474         (plugin_test_3): Likewise.
475         (plugin_test_4): Likewise.
476         (plugin_test_5): Likewise.
477         (plugin_test_6): Likewise.
478         (plugin_test_7): Likewise.
479         (plugin_test_8): Likewise.
480         (plugin_test_9): Likewise.
481         (plugin_test_10): Likewise.
482         (plugin_test_11): New test case.
483         * testsuite/Makefile.in: Regenerate.
484         * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
485         file to decide whether to claim file.
486         (all_symbols_read_hook): Likewise.
487         * testsuite/plugin_test_1.sh: Adjust expected output.
488         * testsuite/plugin_test_2.sh: Likewise.
489         * testsuite/plugin_test_3.sh: Likewise.
490         * testsuite/plugin_test_6.sh: Likewise.
491         * testsuite/plugin_test_tls.sh: Likewise.
492         * testsuite/plugin_test_11.sh: New testcase.
493
494 2015-02-03  Cary Coutant  <ccoutant@google.com>
495
496         * descriptors.cc (Descriptors::open): Set artificially-low limit for
497         file descriptors when debugging enabled. Add debug output.
498         (Descriptors::release): Add debug output.
499         (Descriptors::close_some_descriptor): Likewise.
500         (Descriptors::close_all): Likewise.
501         * fileread.cc (File_read::lock): Likewise.
502         (File_read::unlock): Likewise.
503
504 2015-02-02  Cary Coutant  <ccoutant@google.com>
505
506         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
507         executable output file.
508
509 2015-01-22  Han Shen  <shenhan@google.com>
510
511         * arm.cc (Target_arm::Target_arm): Add initialization for new members.
512         (Target_arm::do_plt_address_for_global): New method.
513         (Target_arm::do_plt_address_for_local): New method.
514         (Target_arm::rel_irelative_section): New method.
515         (Target_arm::make_data_plt): Add more parameters for plt ctor.
516         (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
517         (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
518         (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
519         (Target_arm::Scan::check_non_pic): Add ifunc support.
520         (Target_arm::Scan::local): Add ifunc support.
521         (Target_arm::Scan::global): Add ifunc support.
522         (Target_arm::make_plt_section): New method.
523         (Target_arm::make_plt_entry): Change to call to make_plt_section.
524         (Target_arm::make_local_ifunc_plt_entry): New method.
525         (Target_arm::got_irelative_): New member.
526         (Target_arm::rel_irelative_): New member.
527         (Target_arm::got_section): Add creation for got_irelative_.
528         (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
529         (Target_arm::Relocate::relocate): Properly set local ifunc address.
530         (Target_arm::do_dynsym_value): Properly set global ifunc address.
531         (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
532         (Output_data_plt_arm::IRelative_data): New type.
533         (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
534         (Output_data_plt_arm::add_entry): Add more parameters.
535         (Output_data_plt_arm::add_relocation): New method.
536         (Output_data_plt_arm::add_local_ifunc_entry): New method.
537         (Output_data_plt_arm::rel_irelative): New method.
538         (Output_data_plt_arm::entry_count): Modified.
539         (Output_data_plt_arm::address_for_global): New method.
540         (Output_data_plt_arm::address_for_local): New method.
541 gold/
542         (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
543         (Output_data_plt_arm::insert_irelative_data): New method.
544         (Output_data_plt_arm::irelative_rel_): New member.
545         (Output_data_plt_arm::got_): New member.
546         (Output_data_plt_arm::got_irelative_): New member.
547         (Output_data_plt_arm::irelative_count_): New member.
548         (Output_data_plt_arm::IRelative_data_vec): New typedef.
549         (Output_data_plt_arm::irelative_data_vec_): New member.
550         (Output_data_plt_arm::do_write): Write out irelative entries.
551         (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
552         more parameters to ctor.
553         (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
554         more parameters to ctor.
555         * output.h (Output_data_reloc::add_local_relative): New method.
556         * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
557
558 2015-01-29  Alan Modra  <amodra@gmail.com>
559
560         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
561         and GOT_TLSGD to LE optimization.
562
563 2015-01-28  Cary Coutant  <ccoutant@google.com>
564
565         * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
566         for undef TLS symbols.
567         (Target_x86_64::Relocate::relocate_tls): Likewise.
568         (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
569
570 2015-01-25  Cary Coutant  <ccoutant@google.com>
571
572         * output.cc (Output_segment::set_section_addresses): Fix calculation
573         of size of relro segment.
574
575 2015-01-22  Alan Modra  <amodra@gmail.com>
576
577         * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
578         condition for need of ifunc plt entry.
579         (Target_powerpc::Scan::global <got relocs>): Likewise.
580
581 2015-01-14  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
582
583         * mips.cc (reloc_high): Add r_sym.
584         (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
585         reloc_high constructor.
586         (Mips_relocate_functions::relgot16_local): Likewise.
587         (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
588         r_type to decide whether LO16 matches HI16.
589         (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
590         rello16 and relgot16_local.
591
592 2015-01-09  Cary Coutant  <ccoutant@google.com>
593
594         * layout.cc (Layout::set_segment_offsets): Don't align start of segment
595         unless alignment is larger than page size.
596
597 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
598             Cary Coutant  <ccoutant@google.com>
599
600         PR gold/17729
601         * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
602         (DEFAULT_TARGET_X32): Set for x32.
603         * x86_64.cc (cmp_insn_32): New.
604         (lea_r10_insn_32): Likewise.
605         (lea_r11_insn_32): Likewise.
606         (cmp_insn_64): Likewise.
607         (lea_r10_insn_64): Likewise.
608         (lea_r11_insn_64): Likewise.
609         (Target_x86_64<size>::do_calls_non_split): Handle x32.
610         * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
611         (check_DATA): Add split_x32 files.
612         (split_x32_[1234n].o): New targets.
613         (split_x32_[124]): New targets.
614         (split_x32_[1234r].stdout): New targets.
615         * testsuite/split_x32.sh: New file.
616         * testsuite/split_x32_1.s: Likewise.
617         * testsuite/split_x32_2.s: Likewise.
618         * testsuite/split_x32_3.s: Likewise.
619         * testsuite/split_x32_4.s: Likewise.
620         * testsuite/split_x32_n.s: Likewise.
621         * configure: Regenerated.
622         * testsuite/Makefile.in: Likewise.
623
624 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
625
626         PR gold/17809
627         * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
628         x32.
629
630 2015-01-02  Alan Modra  <amodra@gmail.com>
631
632         * version.cc (print_version): Just print current year.
633         * dwp.cc (print_version): Likewise.
634
635 2015-01-01  Alan Modra  <amodra@gmail.com>
636
637         Update year range in copyright notice of all files.
638
639 2014-12-25  Alan Modra  <amodra@gmail.com>
640
641         * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
642         new enums.
643         (Target_arm::merge_object_attributes, ): Likewise.
644
645 2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
646
647         * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
648         as hard float only when Tag_ABI_VFP_args is 1, using new enum value
649         AEABI_VFP_args_vfp to check that.
650         (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
651         value and replace hardcoded values by enum values.
652
653 2014-12-22  Cary Coutant  <ccoutant@google.com>
654
655         * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
656
657 2014-12-20  H.J. Lu  <hongjiu.lu@intel.com>
658
659         PR gold/14608
660         * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
661         to "return i * i * 3;".
662
663 2014-12-16  Cary Coutant  <ccoutant@google.com>
664
665         * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
666         (Mapfile::print_output_data): Use current_data_size() to avoid
667         assert for sections requiring postprocessing; if address is not valid,
668         print 0.
669         (Mapfile::print_output_section): Use current_data_size(); print note
670         that addresses and sizes are before compression.
671
672 2014-12-14  H.J. Lu  <hongjiu.lu@intel.com>
673
674         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
675         Cast current_group_size to unsigned long when reporting error.
676
677 2014-12-10  Jing Yu  <jingyu@google.com>
678
679         * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
680         (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
681         Update error message.
682         (Target_aarch64::do_relax): Use absolute value of option
683         stub_group_size. Replace local variable with class member
684         stub_group_size_.
685
686 2014-12-04  Alan Modra  <amodra@gmail.com>
687
688         * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
689         addend of PLTREL24 reloc when not generating a plt stub.  Make
690         max_branch_offset an "Address".
691         (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
692         (Target_powerpc::Relocate::relocate): Likewise.
693
694 2014-12-04  Alan Modra  <amodra@gmail.com>
695
696         PR 17670
697         * symtab.cc (Symbol::set_undefined): Remove assertion.
698         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
699         on symbols defined in discarded sections, instead return false.
700         Rearrange params, update all callers.
701         (Target_powerpc::Branch_info::make_stub): Don't make stubs for
702         branches to syms in discarded sections.
703         (Global_symbol_visitor_opd::operator()): Set discarded opd syms
704         undefined and flag as discarded.
705         (Target_powerpc::Relocate::relocate): Localize variable.
706
707 2014-12-03  H.J. Lu  <hongjiu.lu@intel.com>
708
709         PR gold/17675
710         * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
711         * testsuite/Makefile.in: Regenerated.
712
713 2014-12-03  Alan Modra  <amodra@gmail.com>
714
715         PR 17566
716         * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
717         when adding dynamic relocations against section symbols.
718
719 2014-12-01  Dimitry Ivanov <dimitry@google.com>
720
721         * layout.cc (Layout::finish_dynamic_section): When '-z global'
722         is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
723         * options.h (General_options): New -z option (global).
724
725 2014-12-01  Cary Coutant  <ccoutant@google.com>
726
727         PR gold/17578
728         * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
729         is given.
730         (Layout::create_executable_stack_info): Warn when -z noexecstack is
731         given but some inputs require executable stack.
732
733 2014-11-26  Cary Coutant  <ccoutant@google.com>
734
735         * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
736         .debug_str_offsets; strip .debug_gnu_pubnames and
737         .debug_gnu_pubtypes.
738         (lines_only_debug_sections): Strip all four new sections.
739
740 2014-11-26  Jing Yu  <jingyu@google.com>
741
742         * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
743         register to be x0 when to relax TLSDESC_LD64_LO12.
744
745 2014-11-26  Alan Modra  <amodra@gmail.com>
746
747         * powerpc.cc (struct Stub_table_owner): New.
748         (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
749         unsigned int vector.  Update all references.
750         (powerpc_relobj::set_stub_table): Take an unsigned int param
751         rather than a Stub_table.  Update callers.
752         (Powerpc_relobj::clear_stub_table): New function.
753         (Target_powerpc): Add relax_failed_, relax_fail_count_ and
754         stub_group_size_ vars.
755         (Target_powerpc::new_stub_table): Delete.
756         (max_branch_delta): New function, extracted from..
757         (Target_powerpc::Relocate::relocate): ..here..
758         (Target_powerpc::Branch_info::make_stub): ..and here.  Return
759         status on whether stub created successfully.
760         (Stub_control::Stub_control): Add "no_size_errors" param.  Move
761         default sizing to..
762         (Target_powerpc::do_relax): ..here.  Init stub_group_size_ and
763         reduce on relax failure.
764         (Target_powerpc::group_sections): Add "no_size_errors" param.
765         Use stub_group_size_.  Set up group info in a temp vector,
766         before building Stub_table vector.  Account for input sections
767         possibly already converted to relaxed sections.
768         (Stub_table::init): Delete.  Merge into..
769         (Stub_table::Stub_table): ..here.
770         (Stub_table::can_reach_stub): New function.
771         (Stub_table::add_plt_call_entry): Add "from" parameter and
772         return true iff stub could be reached.
773         (Stub_table::add_long_branch_entry): Similarly.  Add "r_type"
774         param too.
775         (Stub_table::clear_stubs): Add "all" param.
776
777 2014-11-26  Alan Modra  <amodra@gmail.com>
778
779         * powerpc.cc (Stub_control::set_output_and_owner): New function.
780         (Target_powerpc::group_sections): Use it.
781
782 2014-11-25  Cary Coutant  <ccoutant@google.com>
783
784         * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
785         (Binary_to_elf::write_symbol): Add st_size parameter.
786         * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
787
788 2014-11-25  Cary Coutant  <ccoutant@google.com>
789
790         PR gold/17639
791         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
792         (Sized_relobj_file::do_layout): Handle deferred sections properly
793         during GC pass 1. Don't add reloc sections to deferred list twice.
794         * object.h (Sized_relobj_file::is_deferred_layout): New function.
795         (Sized_relobj_file::is_deferred_layout_): New data member.
796
797 2014-11-21  H.J. Lu  <hongjiu.lu@intel.com>
798
799         PR gold/17619
800         * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
801         Check PC-relative offset overflow in PLT entry.
802
803 2014-11-21  Alan Modra  <amodra@gmail.com>
804
805         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
806         for undefined weaks.
807
808 2014-11-20  Alan Modra  <amodra@gmail.com>
809
810         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
811         from --stub-group-size parameter divided by 1024.
812         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
813         template parameter.  Update all uses.
814         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
815         has_stub_value.  Set for long branches.  Don't report overflow for
816         branch to undefined weak symbols.  Print info message on
817         overflowing branch to stub.
818
819 2014-11-20  Alan Modra  <amodra@gmail.com>
820
821         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
822
823 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
824
825         * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
826         entry for R_X86_64_GOTPLT64.
827         (Target_x86_64<size>::Relocate::relocate): Update comments for
828         R_X86_64_GOTPLT64.
829
830 2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>
831
832         * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
833         * plugin.h: add lock definition
834
835 2014-10-29  Han Shen  <shenhan@google.com>
836             Jing Yu   <jingyu@google.com>
837
838         * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
839         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
840         TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
841         Symbol::TLS_REF.
842         * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
843         method.
844         (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
845         (Target_aarch64::tls_ld_to_le): New method.
846         (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
847         for 64bit targets.
848         (Output_data_plt_aarch64::irelative_rel_): New data member.
849         (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
850         (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
851         (Output_data_plt_aarch64::add_relocation): New method.
852         (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
853         offset. Add got_irelative size to got size.
854         (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
855         type string with the new typename.
856         (AArch64_relocate_functions::update_adr): Replace parameter x with
857         immed.
858         (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
859         (AArch64_relocate_functions::reloc_common): New method.
860         (AArch64_relocate_funcsions::rela_general): Extract common part out
861         into reloc_common method.
862         (AArch64_relocate_functions::rela_general): Likewise.
863         (AArch64_relocate_functions::pcrela_general): Likewise.
864         (AArch64_relocate_functions::adr): New method.
865         (AArch64_relocate_functions::adrp): Calculate immed before calling
866         update_adr.
867         (AArch64_relocate_functions::adrp): Likewise.
868         (AArch64_relocate_functions::movnz): Cast x to SignedW type when
869         comparing x to 0. Calculate immed from ~x when x < 0.
870         (Target_aarch64::optimize_tls_reloc): Add new cases for
871         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
872         TLSLD_MOVW_DTPREL_G0_NC.
873         (Target_aarch64::possible_function_pointer_reloc): Implement this
874         method.
875         (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
876         comment.
877         (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
878         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
879         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
880         (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
881         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
882         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
883         (Target_aarch64::make_plt_entry): Call add_entry with two more
884         parameters.
885         (Target_aarch64::make_local_ifunc_plt_entry): New method.
886         (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
887         ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
888         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
889         (Target_aarch64::Relocate::relocate_tls): Add cases for
890         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
891         TLSLD_MOVW_DTPREL_G0_NC.
892         * testsuite/icf_safe_so_test.cc: Correct test comment.
893         * testsuite/icf_safe_test.sh: Add AArch64 arch.
894
895 2014-10-22  Alan Modra  <amodra@gmail.com>
896
897         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
898         thread_starter.
899
900 2014-10-18  Andreas Schwab  <schwab@linux-m68k.org>
901
902         * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
903
904 2014-10-17  Cary Coutant  <ccoutant@google.com>
905
906         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
907         Add "typename" keyword.
908
909 2014-10-15  Han Shen  <shenhan@google.com>
910             Jing Yu   <jingyu@google.com>
911
912         Patch for gold aarch64 backend to support relaxation.
913         * aarch64-reloc.def: Change format.
914         * aarch64.cc (class Reloc_stub): New class.
915         (class Stub_table): New class.
916         (class AArch64_relobj): New class.
917         (class AArch64_input_section): New class.
918         (class AArch64_output_section): New class.
919         (Target_aarch64::new_stub_table): New method.
920         (Target_aarch64::new_aarch64_input_section): New method.
921         (Target_aarch64::find_aarch64_input_section): New method.
922         (Target_aarch64::scan_section_for_stubs): New method.
923         (Target_aarch64::scan_reloc_section_for_stubs): New method.
924         (Target_aarch64::relocate_stub): New method.
925         (Target_aarch64::current_target): New method.
926         (Target_aarch64::do_make_elf_object): New method.
927         (Target_aarch64::do_may_relax): New method.
928         (Target_aarch64::do_relax): New method.
929         (Target_aarch64::group_sections): New method.
930         (Target_aarch64::scan_reloc_for_stub): New method.
931         (Target_aarch64::do_make_output_section): New method.
932         (Target_aarch64::stub_tables_): New data member.
933         (Target_aarch64::aarch64_input_section_map_): New data member.
934         (AArch64_relocate_functions::maybe_apply_stub): New method.
935
936 2014-09-30  Cary Coutant  <ccoutant@google.com>
937
938         PR gold/17432
939         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
940
941 2014-09-30  Kito Cheng  <kito@0xlab.org>
942
943         PR gold/13597
944         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
945         hash table before sysv-style hash table.
946
947 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
948
949         * options.h (--pic-executable): Add negative to alias to -no-pie.
950
951 2014-09-26  Cary Coutant  <ccoutant@google.com>
952
953         PR gold/16773
954         * object.cc (Sized_relobj_file): Compute value of section symbols
955         for TLS sections the same as TLS symbols.
956
957 2014-09-25  Cary Coutant  <ccoutant@google.com>
958
959         PR gold/17432
960         * resolve.cc (Symbol_table::resolve): Override common placeholder
961         symbols, but adjust sizes.
962         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
963         symbols to common lists.
964
965 2014-09-24  Alan Modra  <amodra@gmail.com>
966
967         * po/POTFILES.in: Regenerate.
968
969 2014-09-23  Taiju Tsuiki  <tzik@google.com>
970             Cary Coutant  <ccoutant@google.com>
971
972         PR gold/14860
973         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
974         on input_sections_blocker.
975         * layout.cc (Write_sections_task::locks): Unblock
976         input_sections_blocker_.
977         * layout.h (Write_sections_task::Write_sections_task): Add
978         input_sections_blocker.
979         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
980         to DEPENDENCIES.
981         * testsuite/Makefile.in: Regenerate.
982
983 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
984
985         * testsuite/Makefile.am (plugin_test_10): New test.
986         * testsuite/Makefile.in: Regenerate
987         * testsuite/plugin_common_test_2.c (c1): Align to 8.
988         * testsuite/plugin_test_10.sh: New file.
989
990 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
991
992         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
993         * resolve.cc (Symbol_table::resolve): Don't override common symbols
994         during the replacement phase.
995
996 2014-09-17  Han Shen  <shenhan@google.com>
997             Jing Yu  <jingyu@google.com>
998
999         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
1000         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
1001         * aarch64.cc (Target_aarch64): Add data members
1002         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
1003         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
1004         constructor.
1005         (Target_aarch64::do_reloc_symbol_index): New method.
1006         (Target_aarch64::do_reloc_addend): New method.
1007         (Target_aarch64::add_tlsdesc_info): New method.
1008         (Target_aarch64::do_dynsym_value): New method.
1009         (Target_aarch64::do_make_data_plt): Add new parameters: got,
1010         got_irelative. Pass them to Output_data_plt_aarch64_standard.
1011         (Target_aarch64::make_data_plt): Add new parameters: got,
1012         got_irelative. Pass them to do_make_data_plt.
1013         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
1014         (Target_aarch64::Relocate:tls_gd_to_le): New method.
1015         (Target_aarch64::Relocate:tls_ie_to_le): New method.
1016         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
1017         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
1018         (Target_aarch64::got_tlsdesc_section): New method.
1019         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1020         (Target_aarch64::define_tls_base_symbol): New method.
1021         (Target_aarch64::reserve_tlsdesc_entries): New method.
1022         (Target_aarch64::got_mod_index_entry): New method.
1023         (Target_aarch64::rela_tlsdesc_section): New method.
1024         (Target_aarch64::rela_irelative_section): New method.
1025         (Target_aarch64::Tlsdesc_info): New struct.
1026         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
1027         relocations and tlsdesc relocations.
1028         (Target_aarch64::optimize_tls_reloc): Implement method.
1029         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
1030         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
1031         in constructor.
1032         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
1033         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
1034         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
1035         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
1036         (Output_data_plt_aarch64::rela_tlsdesc): New method.
1037         (Output_data_plt_aarch64::rela_irelative): New method.
1038         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
1039         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
1040         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
1041         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
1042         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
1043         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
1044         (Output_data_plt_aarch64_standard): New member variables:
1045         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
1046         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
1047         New parameter: got, got_irelative.
1048         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
1049         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
1050         (Output_data_plt_aarch64::do_write): Replace got_address with
1051         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
1052         (AArch64_relocate_functions::update_movnz): New method.
1053         (AArch64_relocate_functions): Correct format.
1054         (AArch64_relocate_functions::movnz): New method.
1055         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
1056         before the switch. Add new cases to switch.
1057         Check ie_to_le relaxation on tlsie relocations. Add code handling
1058         tlsgd tlsdesc cases.
1059         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
1060         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
1061         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
1062         Call reloc_name_in_error_message to print unsupported reloc.
1063         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
1064         make_data_plt.
1065         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
1066         relocs. Fill in some more dynamic tags.
1067         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
1068         Skip call tls_get_addr when tlsgd is relaxed.
1069         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
1070         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
1071         tlsdesc->ie relaxation.
1072
1073 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1074
1075         * mips.cc (Target_mips_nacl): New class.
1076         (Target_selector_mips_nacl): New class.
1077         (target_selector_mips32): Rename from target_selector_mips32be and use
1078         Target_selector_mips_nacl instead of Target_selector_mips.
1079         (target_selector_mips32el): Rename from target_selector_mips32 and use
1080         Target_selector_mips_nacl instead of Target_selector_mips.
1081         (target_selector_mips64): Rename from target_selector_mips64be and use
1082         Target_selector_mips_nacl instead of Target_selector_mips.
1083         (target_selector_mips64el): Rename from target_selector_mips64 and use
1084         Target_selector_mips_nacl instead of Target_selector_mips.
1085         (Target_mips::mips_info): Add const attribute.
1086
1087 2014-09-02  Cary Coutant  <ccoutant@google.com>
1088
1089         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
1090         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
1091         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
1092         (Sized_incr_dynobj::do_section_name): Likewise.
1093         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
1094         (Sized_incr_dynobj::do_section_name): Likewise.
1095         * object.h (Object::section_name): Likewise.
1096         (Object::do_section_name): Likewise.
1097         (Sized_relobj_file::do_section_name): Likewise.
1098         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
1099         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
1100
1101 2014-09-02  Cary Coutant  <ccoutant@google.com>
1102
1103         PR gold/17005
1104         * ehframe.cc (Fde::write): Add output_offset parameter.
1105         (Cie::write): Likewise.
1106         (Eh_frame::set_final_data_size): Account for offset within output
1107         section.
1108         (Eh_frame::do_sized_write): Likewise.
1109         * ehframe.h (Fde::write): Add output_offset parameter.
1110         (Cie::write): Likewise.
1111         * output.cc (Output_section::Input_section_sort_entry): Remove
1112         section_has_name_; add output_section_name parameter. Use
1113         output section name for non-input sections.
1114         (Output_section::Input_section_sort_entry::section_has_name): Remove.
1115         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
1116         (Output_section::Input_section_sort_compare): Remove logic for
1117         sections without names.
1118         (Output_section::Input_section_sort_init_fini_compare): Likewise.
1119         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
1120         Likewise.
1121         (Output_section::Input_section_sort_section_name_compare): Likewise.
1122
1123 2014-08-29 Han Shen <shenhan@google.com>
1124            Jing Yu <jingyu@google.com>
1125
1126         * aarch64-reloc-property.cc
1127         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
1128         reference reloc property in the table.
1129         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
1130         3 other entries.
1131         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
1132         2 new overloaded methods.
1133         (Output_data_got_aarch64::do_write): Add code to write out
1134         static relocs.
1135         (class Output_data_got_aarch64::Static_reloc): New class to wrap
1136         static relocs.
1137         (Output_data_got_aarch64::static_relocs): New vector to
1138         hold static relocs.
1139         (Target_aarch64::TCB_SIZE): New const static memeber.
1140         (Target_aarch64::tcb_size): New method.
1141         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
1142         (Target_aarch64::Relocate::relocate_tls): New method.
1143         (Target_aarch64::Scan::local): Add code handling new reloc types.
1144         (Target_aarch64::Scan::global): Add code handling new reloc types.
1145
1146 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
1147
1148         * options.h (-no-pie): Add option.
1149
1150 2014-08-08  Jing Yu  <jingyu@google.com>
1151             Han Shen  <shenhan@google.com>
1152
1153         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
1154         (DEFFILES): add aarch64-reloc.def.
1155         (TARGETSOURCES): Add aarch64-reloc-property.cc.
1156         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
1157         * Makefile.in: Regenerate.
1158         * aarch64-reloc-property.cc: New file.
1159         * aarch64-reloc-property.h: New file.
1160         * aarch64-reloc.def: New file.
1161         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
1162         with tab to make the format consistent.
1163         (Output_data_got_aarch64::symbol_table_): New method.
1164         (Target_aarch64::do_plt_address_for_global): New method.
1165         (Target_aarch64::do_plt_address_for_local): New method.
1166         (Target_aarch64::do_select_as_default_target): New method.
1167         (Target_aarch64::do_make_data_plt): New method.
1168         (Target_aarch64::make_data_plt): New method.
1169         (Output_data_plt_aarch64::has_irelative_section): New method.
1170         (Output_data_plt_aarch64::address_for_global): New method.
1171         (Output_data_plt_aarch64::address_for_local): New method.
1172         (Output_data_plt_aarch64::irelative_rel_): New parameter.
1173         (Output_data_plt_aarch64::add_entry): Implement contents.
1174         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
1175         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
1176         the got_pov entry to plt0.
1177         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
1178         Implement contents.
1179         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
1180         (AArch64_howto): New struct.
1181         (aarch64_howto[]): New static const array.
1182         (AArch64_relocate_functions): New class.
1183         (Target_aarch64::Scan::get_reference_flags): Remove method.
1184         (Target_aarch64::Scan::local): Implement to support a few relocations.
1185         (Target_aarch64::Scan::global): Implement to support a few relocations.
1186         (Target_aarch64::make_plt_section): Implement contents.
1187         (Target_aarch64::make_plt_entry): Implement contents.
1188         (Target_aarch64::do_finalize_sections): Implement contents.
1189         (Target_aarch64::Relocate::relocate): Implement a few relocations.
1190         (Target_aarch64::relocate_section): Implement contents.
1191
1192 2014-08-06  Alan Modra  <amodra@gmail.com>
1193
1194         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
1195
1196 2014-08-06  Alan Modra  <amodra@gmail.com>
1197
1198         PR 13227
1199         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
1200
1201 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
1202
1203         * object.cc (Relobj::is_section_name_included): Add
1204         ".rodata.nptl_version" to not garbage collect this section.
1205
1206 2014-07-08  Cary Coutant  <ccoutant@google.com>
1207
1208         * expression.cc (struct Expression::Expression_eval_info): Add
1209         new fields type_pointer, vis_pointer, and nonvis_pointer.
1210         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
1211         nonvis_pointer parameters. Adjust all calls.
1212         (Symbol_expression::value): Update type, visibility, and nonvis bits
1213         in caller.
1214         * script.cc (Symbol_assignment::sized_finalize): Update type,
1215         visibility, and remaining st_other bits for new symbol.
1216         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
1217         vis_pointer, and nonvis_pointer parameters.
1218         * symtab.h (Symbol::set_type): New method.
1219
1220         * testsuite/Makefile.am (defsym_test): New test.
1221         * testsuite/Makefile.in: Regenerate.
1222         * testsuite/defsym_test.c: New file.
1223         * testsuite/defsym_test.sh: New file.
1224
1225 2014-07-08  Cary Coutant  <ccoutant@google.com>
1226
1227         PR gold/15639
1228         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
1229         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
1230         (Sized_dynobj::base_read_symbols): ...new method.
1231         * object.h (Sized_relobj_file::base_read_symbols): New method.
1232         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
1233         (Sized_relobj_file::base_read_symbols): ...new method.
1234         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
1235         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
1236         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
1237
1238 2014-07-04  Alan Modra  <amodra@gmail.com>
1239
1240         * po/POTFILES.in: Regenerate.
1241
1242 2014-07-02  Jing Yu  <jingyu@google.com>
1243
1244         * aarch64.cc: New file
1245         * Makefile.am (TARGETSOURCES): Add aarch64.cc
1246         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
1247         * Makefile.in: Regenerate.
1248         * configure.tgt: Add entries for aarch64*.
1249         * configure.ac:  Likewise.
1250         * configure: Likewise.
1251
1252 2014-06-27  Alan Modra  <amodra@gmail.com>
1253
1254         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
1255
1256 2014-06-24  Cary Coutant  <ccoutant@google.com>
1257
1258         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
1259         sections.
1260         (Dwo_file::sized_read_unit_index): Likewise.
1261
1262 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1263
1264         * mips.cc: New file.
1265         * Makefile.am (TARGETSOURCES): Add mips.cc
1266         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
1267         * configure.tgt: Add entries for mips*.
1268         * configure.ac: Likewise.
1269         * Makefile.in: Regenerate.
1270         * configure: Likewise.
1271
1272 2014-06-09  Cary Coutant  <ccoutant@google.com>
1273
1274         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
1275         unit_length is within section bounds.
1276
1277 2014-06-09  Cary Coutant  <ccoutant@google.com>
1278
1279         PR gold/16980
1280         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
1281         map.
1282
1283 2014-06-07  Alan Modra  <amodra@gmail.com>
1284
1285         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
1286
1287 2014-06-06  Cary Coutant  <ccoutant@google.com>
1288
1289         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
1290         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
1291         (Dwarf_pubnames_table::read_header): Likewise.
1292         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
1293         .debug_gnu_pubtypes.
1294
1295 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
1296
1297         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
1298         * Makefile.in, configure: Regenerate.
1299
1300 2014-06-03  Alan Modra  <amodra@gmail.com>
1301
1302         * powerpc.cc (addis_12_2): Define.
1303         (Stub_table::do_write): Support fusion on ELFv2 stubs.
1304
1305 2014-06-03  Alan Modra  <amodra@gmail.com>
1306
1307         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
1308         st_other output.
1309
1310 2014-06-02  Alan Modra  <amodra@gmail.com>
1311
1312         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
1313         Only ignore relocs on ELFv1.
1314         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
1315
1316 2014-05-30  Cary Coutant  <ccoutant@google.com>
1317
1318         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
1319         * testsuite/Makefile.in: Regenerate.
1320         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
1321
1322 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
1323
1324         PR gold/16945
1325         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
1326         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
1327
1328 2014-05-15  Alan Modra  <amodra@gmail.com>
1329
1330         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
1331         Compare FDE contents with DW_CFA_nop rather than 0.
1332
1333 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
1334
1335         * symtab.h (may_need_copy_reloc): Remove check for position independent
1336         code.
1337         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
1338         position independence before pc absolute may_need_copy_reloc call.
1339         Add check for executable output befor pc relative may_need_copy_reloc
1340         call.
1341         * i386.cc: Ditto.
1342         * arm.cc: Ditto.
1343         * sparc.cc: Ditto.
1344         * tilegx.cc: Ditto.
1345         * powerpc.cc: Add check for no position independence before
1346         may_need_copy_reloc calls.
1347         * testsuite/pie_copyrelocs_test.cc: New file.
1348         * testsuite/pie_copyrelocs_shared_test.cc: New file.
1349         * Makefile.am (pie_copyrelocs_test): New test.
1350         * Makefile.in: Regenerate.
1351
1352 2014-05-08  Martin Liška  <mliska@suse.cz>
1353
1354         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
1355
1356 2014-05-06  Cary Coutant  <ccoutant@google.com>
1357
1358         PR gold/16900
1359         * i386.cc (Output_data_got_plt_i386): New class.
1360         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
1361         parameter. Change all callers.
1362         (Output_data_plt_i386::layout_): Remove.
1363         (Output_data_plt_i386::got_plt_): Change type.
1364         (Target_i386::got_plt_): Change type. Change all references.
1365         (Target_i386::got_section): Create instance of new class.
1366         (Output_data_got_plt_i386::do_write): New function.
1367         * x86_64.cc (Output_data_got_plt_x86_64): New class.
1368         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
1369         parameter. Change all callers.
1370         (Output_data_plt_x86_64::layout_): Remove.
1371         (Output_data_plt_x86_64::got_plt_): Change type.
1372         (Target_x86_64::got_plt_): Change type. Change all references.
1373         (Target_x86_64::got_section): Create instance of new class.
1374         (Output_data_got_plt_x86_64::do_write): New function.
1375         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
1376         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
1377         class.
1378
1379 2014-05-05  Cary Coutant  <ccoutant@google.com>
1380
1381         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
1382         if we have pubnames/pubtypes.
1383
1384 2014-05-02  Cary Coutant  <ccoutant@google.com>
1385
1386         * defstd.cc (in_segment): Define __ehdr_start here...
1387         * layout.cc (Layout::finalize): ...Instead of here.  Set the
1388         output segment when known.
1389         * resolve.cc (Symbol::override_base_with_special): Remember
1390         the original binding.
1391         * symtab.cc (Symbol::set_output_segment): New function.
1392         (Symbol::set_undefined): New function.
1393         * symtab.h (Symbol::is_weak_undefined): Check original undef
1394         binding.
1395         (Symbol::is_strong_undefined): New function.
1396         (Symbol::set_output_segment): New function.
1397         (Symbol::set_undefined): New function.
1398         * target-reloc.h (is_strong_undefined): Remove.
1399         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
1400         Check for hidden undefs.
1401         (relocate_section): Call Symbol::is_strong_undefined.
1402
1403         * testsuite/Makefile.am (ehdr_start_test_1)
1404         (ehdr_start_test_2, ehdr_start_test_3)
1405         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
1406         * testsuite/Makefile.in: Regenerate.
1407         * testsuite/ehdr_start_def.cc: New source file.
1408         * testsuite/ehdr_start_test.cc: New source file.
1409         * testsuite/ehdr_start_test.t: New linker script.
1410         * testsuite/ehdr_start_test_4.sh: New shell script.
1411
1412 2014-04-23  Cary Coutant  <ccoutant@google.com>
1413
1414         PR gold/16870
1415         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
1416
1417 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1418
1419         * layout.cc (Layout::include_section): Allow a target to decide
1420         whether to include a section.
1421         * target.h (Target::should_include_section): New function.
1422         (Target::do_should_include_section): New function.
1423
1424 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1425
1426         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
1427         inline into ...
1428         (Copy_relocs::emit): ... here.
1429         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
1430         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
1431         (Copy_reloc_entry::entries_): Change from private to protected.
1432
1433 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
1434
1435         * icf.cc (get_section_contents): Replace copies of reloc
1436         vectors with const references.
1437
1438 2014-04-02  Cary Coutant  <ccoutant@google.com>
1439
1440         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
1441         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
1442         * configure: Regenerate.
1443         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
1444         -fno-use-linker-plugin.
1445         (LINK1, CXXLINK1): Add it to the link command.
1446         * testsuite/Makefile.in: Regenerate.
1447
1448 2014-03-12  Alan Modra  <amodra@gmail.com>
1449
1450         * Makefile.in: Regenerate.
1451
1452 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1453
1454         * symtab.h (Symbol::set_nonvis): New function.
1455
1456 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1457
1458         * symtab.cc (Sized_symbol<32>::init_output_data):
1459         Instantiate the template.
1460         (Sized_symbol<64>::init_output_data): Likewise.
1461
1462 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1463
1464         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
1465         adjust dynamic symbol value.
1466         * target.h (Target::adjust_dyn_symbol): New function.
1467         (Target::do_adjust_dyn_symbol): New function.
1468
1469 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1470
1471         * output.cc (Output_data_dynamic::Dynamic_entry::write):
1472         Get the value of DYNAMIC_CUSTOM dynamic entry.
1473         * output.h (Output_data_dynamic::add_custom): New function.
1474         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
1475         dynamic entry.
1476         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
1477         * target.h (Target::dynamic_tag_custom_value): New function.
1478         (Target::do_dynamic_tag_custom_value): New function.
1479
1480 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1481
1482         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
1483         dynsym indexes.
1484         * target.h (Target::has_custom_set_dynsym_indexes): New function.
1485         (Target::do_has_custom_set_dynsym_indexes): New function.
1486         (Target::set_dynsym_indexes): New function.
1487         (Target::do_set_dynsym_indexes): New function.
1488
1489 2014-03-07  Alan Modra  <amodra@gmail.com>
1490
1491         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
1492         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
1493         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
1494         (Powerpc_relocate_functions::has_overflow_bitfield,
1495         overflowed): Use the above.
1496         (Target_powerpc::Relocate::relocate): Correct overflow checking
1497         for a number of relocations.  Modify overflow test for 16-bit
1498         fields in instructions to signed/unsigned according to whether
1499         the field takes a signed or unsigned value.
1500
1501 2014-03-05  Alan Modra  <amodra@gmail.com>
1502
1503         Update copyright years.
1504
1505 2014-03-05  Alan Modra  <amodra@gmail.com>
1506
1507         * powerpc.cc (Target_powerpc::Scan::local, global): Support
1508         R_PPC64_ADDR64_LOCAL.
1509         (Target_powerpc::Relocate::relocate): Likewise.
1510
1511 2014-03-03  Alan Modra  <amodra@gmail.com>
1512
1513         * dwp.cc (print_version): Update copyright year to current.
1514
1515 2014-02-10  Alan Modra  <amodra@gmail.com>
1516
1517         * po/gold.pot: Regenerate.
1518
1519 2014-02-06  Cary Coutant  <ccoutant@google.com>
1520
1521         Fix problem where -u is ignored when a weak undef is seen.
1522
1523         * archive.cc (Library_base::should_include_member): Reorder
1524         code to check for -u option if a weak undef has already been seen.
1525         * testsuite/Makefile.am (weak_undef_test_2): New test case.
1526         * testsuite/Makefile.in: Regenerate.
1527         * testsuite/weak_undef_file3.cc: New file.
1528         * testsuite/weak_undef_file4.cc: New file.
1529         * testsuite/weak_undef_test_2.cc: New file.
1530
1531 2014-02-05  Cary Coutant  <ccoutant@google.com>
1532
1533         Fix issues with gold undefined symbol diagnostics.
1534
1535         PR binutils/15435
1536         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
1537         check to here.
1538         * target-reloc.h (is_strong_undefined): New function.
1539         (relocate_section): Move undef vtable symbol check from here.
1540         Check for is_strong_undefined.
1541
1542 2014-02-05  Cary Coutant  <ccoutant@google.com>
1543
1544         Fix problems with the --dynamic-list option.
1545
1546         PR gold/13577
1547         * options.cc (General_options::parse_dynamic_list):
1548         Set have_dynamic_list_.
1549         (General_options::General_options): Initialize have_dynamic_list_.
1550         (General_options::finalize): Turn off -Bsymbolic and
1551         -Bsymbolic-functions if --dynamic-list provided.
1552         * options.h (General_options::have_dynamic_list): New function.
1553         (General_options::have_dynamic_list_): New data member.
1554         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
1555         correctly.
1556
1557         PR gold/16530
1558         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
1559         in --dynamic-list, mark it.
1560
1561         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
1562         (dynamic_list_2): New test case.
1563         * testsuite/Makefile.in: Regenerate.
1564         * testsuite/dynamic_list_2.cc: New file.
1565         * testsuite/dynamic_list_2.t: New file.
1566         * testsuite/dynamic_list_lib1.cc: New file.
1567         * testsuite/dynamic_list_lib2.cc: New file.
1568         * testsuite/gc_dynamic_list_test.c: New file.
1569         * testsuite/gc_dynamic_list_test.sh: New file.
1570         * testsuite/gc_dynamic_list_test.t: New file.
1571
1572 2014-01-28  Cary Coutant  <ccoutant@google.com>
1573
1574         Add .gdb_index version 7 support.
1575
1576         * gold/dwarf_reader.cc: include <utility> (for make_pair).
1577         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
1578         debug sections.
1579         (Dwarf_ranges_table::read_ranges_table): Likewise.
1580         (Dwarf_pubnames_table::read_section): Check for GNU-style
1581         sections, and for compressed debug sections.
1582         (Dwarf_pubnames_table::read_header): Compute end address of table.
1583         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
1584         for end of list by offset, not by offset == 0.
1585         (Dwarf_info_reader::do_read_string_table): Check for compressed
1586         debug sections.
1587         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1588         Initialize new data members.
1589         (Dwarf_pubnames_table::next_name): return flag_byte.
1590         (Dwarf_pubnames_table::end_of_table_): New data member.
1591         (Dwarf_pubnames_table::is_gnu_style_): New data member.
1592         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
1593         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
1594         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
1595         read skeleton type unit DIEs.
1596         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
1597         (Gdb_index::do_write): Write flag_byte.
1598         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
1599         (Gdb_index::Cu_vector): Store flags along with cu indexes.
1600         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
1601         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
1602
1603 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
1604
1605         * version.cc (print_version): Update copyright year to 2014.
1606
1607 2013-12-19  Dimitry Andric  <dimitry@andric.com>
1608
1609         * stringpool.cc (Stringpool_template::reserve): Add
1610         HAVE_UNORDERED_MAP case.
1611         * stringpool.cc (Stringpool_template::print_stats): Likewise.
1612
1613 2013-12-18  Cary Coutant  <ccoutant@google.com>
1614
1615         * configure.ac: Check for <unordered_set> and <unordered_map>.
1616         * config.in: Regenerate.
1617         * configure: Regenerate.
1618         * system.h: Use <unordered_set> and <unordered_map> if available.
1619
1620 2013-12-10  Roland McGrath  <mcgrathr@google.com>
1621
1622         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
1623         with $(INSTALL_PROGRAM_ENV).
1624         * Makefile.in: Regenerate.
1625
1626 2013-11-22  Cary Coutant  <ccoutant@google.com>
1627
1628         * configure.ac: Add check for which library is needed for
1629         dlopen.
1630         * configure: Regenerate.
1631
1632 2013-11-22  Cary Coutant  <ccoutant@google.com>
1633
1634         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
1635         assembler.
1636         * testsuite/Makefile.in: Regenerate.
1637
1638 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
1639
1640         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
1641         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
1642         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
1643         (Target_x86_64<size>::Scan::local): Likewise.
1644         (Target_x86_64<size>::Scan::global): Likewise.
1645         (Target_x86_64<size>::Relocate::relocate): Likewise.
1646         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
1647         Likewise.
1648         (Target_x86_64<size>::Scan::check_non_pic(): Handle
1649         R_X86_64_PC32_BND.
1650
1651         * testsuite/Makefile.am (check_PROGRAMS): Add
1652         exception_x86_64_bnd_test.
1653         (exception_x86_64_bnd_test_SOURCES): New macro.
1654         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
1655         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
1656         (exception_x86_64_bnd_test_LDADD): Likewise.
1657         (exception_x86_64_bnd_1.o): New rule.
1658         (exception_x86_64_bnd_2.o): Likewise.
1659         * testsuite/Makefile.in: Regenerated.
1660
1661 2013-11-15  Alan Modra  <amodra@gmail.com>
1662
1663         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
1664         accessor.
1665         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
1666         Only call ppc64_local_entry_offset for 64-bit.  Restrict
1667         symval_for_branch lookup to ELFv1.
1668         (Stub_table::add_plt_call_entry): Use unsigned int off.
1669         (Output_data_glink::Address, invalid_address): New.
1670         (Output_data_glink::add_eh_frame): Move out of line.  Add
1671         support for ELFv2.
1672         (Output_data_glink::add_global_entry, find_global_entry,
1673         global_entry_address): New functions.
1674         (Output_data_glink::global_entry_stubs_, end_branch_table_,
1675         ge_size): New variables.
1676         (Output_data_glink::set_final_data_size): Add global entry
1677         stub sizing.
1678         (Output_data_glink::do_write): Write global entry stubs.
1679         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
1680         parameter.  Return true for ELFv2.  Adjust callers.
1681         (Target_powerpc::Scan::local, global): Restrict opd lookup to
1682         ELFv1.  Similarly for ifunc and dynamic relocation processing
1683         specific to ELFv1.  Recognize that symbols are defined on
1684         their plt entries for ELFv2.
1685         (Target_powerpc::symval_for_branch): Assert if called for
1686         ELFv2 or ppc32.
1687         (Target_powerpc::Relocate::relocate): Use global entry plt
1688         stub for symbol value if such exists on ELFv2.
1689         (Target_powerpc::Relocate::relocate): Don't call
1690         symval_for_branch when ELFv2.  Do adjust for local entry
1691         offset when ELFv2.
1692         (Target_powerpc::do_dynsym_value): Set symbols to global entry
1693         plt stub for ELFv2.
1694         (Target_powerpc::do_plt_address_for_global): Similarly.
1695
1696 2013-11-14  Cary Coutant  <ccoutant@google.com>
1697
1698         Revert patch -- this did not fix the problem, and there is
1699         no race there.
1700
1701         2013-11-14  Cary Coutant  <ccoutant@google.com>
1702
1703             PR gold/14860
1704             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1705             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1706             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1707             updating fde_offsets_.
1708             (Eh_frame_hdr::lock_): New data member.
1709
1710 2013-11-14  Cary Coutant  <ccoutant@google.com>
1711
1712         * dwp.cc (Dwo_file_entry): New type.
1713         (File_list): Use Dwo_file_entry.
1714         (Dwo_file::verify): New function.
1715         (Dwo_file::verify_dwo_list): New function.
1716         (Dwo_file::sized_verify_dwo_list): New function.
1717         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
1718         list.
1719         (Dwp_options): New enum type.
1720         (dwp_options): Add --verify-only.
1721         (usage): Likewise.
1722         (main): Likewise.
1723         * dwp.h (gold_info): Add declaration.
1724
1725 2013-11-14  Cary Coutant  <ccoutant@google.com>
1726
1727         PR gold/14860
1728         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1729         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1730         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1731         updating fde_offsets_.
1732         (Eh_frame_hdr::lock_): New data member.
1733
1734 2013-11-06  Cary Coutant  <ccoutant@google.com>
1735
1736         PR gold/15758
1737         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
1738         before reloc sections.
1739
1740 2013-11-04  Alan Modra  <amodra@gmail.com>
1741
1742         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
1743         (Symbol::needs_dynamic_reloc): Test new flag.
1744         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
1745         (Target_powerpc::Scan::get_reference_flags): Add target param.
1746         Return FUNC_DESC_ABI for 64-bit ELFv1.
1747         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
1748         call.
1749         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
1750         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
1751
1752 2013-10-31  Cary Coutant  <ccoutant@google.com>
1753
1754         Restore support for dwp v2 DWARF package file format.
1755
1756         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1757         tu_length parameter.  Adjust all callers.
1758         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1759         * dwp.cc: Include dwarf.h.
1760         (Section_bounds): New struct type.
1761         (Unit_set): New struct type.
1762         (Dwo_file::Dwo_file): Initialize new data member.
1763         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1764         Combine and rename to...
1765         (Dwo_file::read_unit_index): ...this.
1766         (Dwo_file::sized_read_compunit_index)
1767         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1768         (Dwo_file::sized_read_unit_index): ...this.
1769         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1770         parameters; add section_id parameter.
1771         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1772         (Dwo_file::add_unit_set): ...this.
1773         (Dwo_file::shndx_map_): Remove.
1774         (Dwo_file::sect_offsets_): New data member.
1775         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1776         (Dwp_output_file::add_section): Rename to...
1777         (Dwp_output_file::add_contribution): ...this.
1778         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1779         (Dwp_output_file::add_tu_set): Likewise.
1780         (Dwp_output_file::Contribution): New type.
1781         (Dwp_output_file::Section::contributions): New data member.
1782         (Dwp_output_file::Cu_or_tu_set): Remove.
1783         (Dwp_output_file::Section::Section): New ctor.
1784         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1785         (Dwp_output_file::Dwp_index::Section_table): New type.
1786         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1787         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1788         parameter.
1789         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1790         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1791         (Dwp_output_file::Dwp_index::section_table): New member function.
1792         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1793         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1794         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1795         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1796         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1797         (Dwp_output_file::Dwp_index::section_table_): New data member.
1798         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1799         (Dwp_output_file::add_output_section): New member function.
1800         (Dwp_output_file::write_new_section): New member function.
1801         (Dwp_output_file::write_contributions): New member function.
1802         (Dwp_output_file::section_id_map_): New data member.
1803         (class Dwo_id_info_reader): Remove.
1804         (class Unit_reader): New class.
1805         (get_dwarf_section_name): New function.
1806         (Dwo_file::read_executable): Adjust initializations of class data.
1807         (Dwo_file::read): Add support for v2 package file format.
1808         (Dwo_file::read_unit_index): Likewise.
1809         (Dwo_file::sized_read_unit_index): Likewise.
1810         (Dwo_file::copy_section): Likewise.
1811         (Dwo_file::add_unit_set): Likewise.
1812         (Dwp_output_file::add_output_section): Likewise.
1813         (Dwp_output_file::add_contribution): Likewise.
1814         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1815         for empty slot.
1816         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1817         file format.
1818         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1819         slot.
1820         (Dwp_output_file::initialize): Remove unused function.
1821         (Dwp_output_file::finalize): Add support for v2 package file format.
1822         (Dwp_output_file::write_index): Likewise.
1823         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1824         function prototype.
1825
1826 2013-10-31  Cary Coutant  <ccoutant@google.com>
1827
1828         * configure.ac: Fix check for -fmerge-constants.
1829         * configure.ac: Regenerate.
1830
1831 2013-10-30  Roland McGrath  <mcgrathr@google.com>
1832
1833         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
1834         Correct 9-byte nop sequence to match what the assembler generates.
1835
1836 2013-10-30  Alan Modra  <amodra@gmail.com>
1837
1838         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
1839         ppc64_local_entry_offset, ppc64_local_entry_offset,
1840         do_read_symbols): New functions.
1841         (Powerpc_relobj::e_flags_, st_other_): New vars.
1842         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
1843         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
1844         (Powerpc_relobj::e_flags_): New var.
1845         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
1846         and adjust for ELFv2.
1847         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
1848         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
1849         (Powerpc_dynobj::do_find_special_sections): Likewise.
1850         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
1851         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
1852         to ELFv2 local entry.
1853         (Target_powerpc::do_relax): No thread safe barriers needed for
1854         ELFv2.
1855         (Output_data_plt_powerpc::initial_plt_entry_size_,
1856         plt_entry_size): Delete.  Replace all uses with
1857         first_plt_entry_offset() and plt_entry_size().
1858         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
1859         reserved_size parm.  Update callers.
1860         (Output_data_plt_powerpc::entry_count): Update.
1861         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
1862         and use Target_powerpc::first_plt_entry_offset().
1863         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
1864         rename to plt_entry_size.
1865         (Output_data_plt_powerpc::add_ifunc_entry,
1866         add_local_ifunc_entry): Adjust reloc for ELFv2.
1867         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
1868         (glink_eh_frame_fde_64v2): New.
1869         (Stub_table::plt_call_size): Support ELFv2 sizing.
1870         (Output_data_glink::add_eh_frame): Use the new FDE.
1871         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
1872         (Stub_table::do_write): Write ELFv2 stubs and glink.
1873         (Target_powerpc::Relocate::relocate): Replaces nop after call
1874         with ld 2,24(1) and adjust local offset destination for ELFv2.
1875
1876 2013-10-30  Alan Modra  <amodra@gmail.com>
1877
1878         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
1879         (Target_powerpc::Scan::global, local): Likewise.
1880         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
1881         on all ppc64 @h and @ha relocs.
1882
1883 2013-10-14  Alan Modra  <amodra@gmail.com>
1884
1885         * output.h (Output_data_got::add_constant): Tidy.
1886         (Output_data_got::add_constant_pair): New function.
1887         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
1888         methods used so as to first call reserve_ent().
1889
1890 2013-10-11  Roland McGrath  <mcgrathr@google.com>
1891
1892         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
1893         add_got_entry and add_got_entry_pair.
1894
1895         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
1896         (HAVE_PUBNAMES): Likewise.
1897         * configure: Regenerate.
1898
1899         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
1900         * testsuite/Makefile.in: Regenerate.
1901
1902         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
1903         Remove const from declaration.
1904         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
1905         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
1906         * output.h (Output_file_header): Remove const from member target_
1907         and corresponding constructor argument.
1908         * output.cc (Output_file_header::Output_file_header): Update prototype.
1909         (Output_file_header::do_sized_write): Use this->target_ in place
1910         of parameters()->target().
1911
1912         * testsuite/undef_symbol.cc (Foo::get_a): New method.
1913
1914         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
1915         * configure: Regenerate.
1916         * Makefile.in: Regenerate.
1917         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
1918         * testsuite/merge_string_literals_2.c: Likewise.
1919         * testsuite/Makefile.am
1920         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
1921         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
1922         literal -fmerge-constants.
1923         * testsuite/Makefile.in: Regenerate.
1924
1925         * i386.cc (Target_i386): Remove unused member dynbss_.
1926         * arm.cc (Target_arm): Likewise.
1927         * powerpc.cc (Target_powerpc): Likewise.
1928         * sparc.cc (Target_sparc): Likewise.
1929         * tilegx.cc (Target_tilegx): Likewise.
1930         * x86_64.cc (Target_x86_64): Likewise.
1931         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
1932         type_signature_, type_offset_.
1933         * plugin.h (Plugin_hook): Remove unused member layout_.
1934         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
1935         mapfile_.
1936         (Read_member): Remove unused members input_objects_, symtab_,
1937         mapfile_, layout_.
1938         (Check_library): Remove unused member symtab_.
1939         * archive.h (Lib_group): Remove unused member lib_.
1940         * archive.cc (Lib_group::Lib_group): Update initializer.
1941         * incremental.h (Incremental_binary): Remove unused member target_.
1942         (Incremental_script_entry): Removed unused member script_.
1943         * layout.h (Write_symbols_task): Remove unused member input_objects_.
1944         * icf.h (Icf): Remove unused member num_tracked_relocs.
1945
1946         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1947         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1948         its only use.
1949         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1950
1951         * archive.h: Use struct rather than class for forward declaration
1952         of Read_symbols_data.
1953
1954 2013-10-07  Cary Coutant  <ccoutant@google.com>
1955
1956         PR gold/16010
1957         * testsuite/Makefile.am (icf_test): Fix dependencies.
1958         (icf_safe_test): Likewise.
1959         (icf_safe_so_test): Likewise.
1960         (large_symbol_alignment): Add empty _LDADD rule.
1961         * testsuite/Makefile.in: Regenerate.
1962
1963 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
1964
1965         PR gold/15927
1966         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1967         relocation for R_X86_64_32 on x32.
1968
1969 2013-08-27  Roland McGrath  <mcgrathr@google.com>
1970
1971         * output.cc (Output_segment::set_section_addresses): Take new
1972         Target* argument.  If target->isolate_execinstr() and the segment
1973         is executable and starts at a target->abi_pagesize() boundary,
1974         pad its end out to a target->abi_pagesize() boundary with code fill.
1975         * output.h (Output_segment::set_section_addresses): Update decl.
1976         * layout.h (Layout::check_output_data_for_reset_values): Take new
1977         argument RELAX_OUTPUTS.
1978         (Layout): New member relax_output_list_.
1979         (Layout::add_relax_output): New method.
1980         * layout.cc (Layout::Layout): Update constructor.
1981         (Layout::reset_relax_output): New method.
1982         (Layout::clean_up_after_relaxation): Call it.
1983         (Layout::prepare_for_relaxation): Update caller.
1984         (Layout::set_segment_offsets): Update callers of set_section_addresses.
1985         Call reset_relax_output before re-processing segments for
1986         isolate_execinstr case.
1987         (Layout::write_data): Handle relax_output_list_.
1988         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1989         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
1990
1991 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
1992
1993         PR binutils/15834
1994         * object.h: Fix typos.
1995
1996 2013-08-16  Roland McGrath  <mcgrathr@google.com>
1997
1998         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1999         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
2000
2001 2013-08-07  Cary Coutant  <ccoutant@google.com>
2002
2003         Revert support for v2 DWP files:
2004
2005         2013-03-01  Cary Coutant  <ccoutant@google.com>
2006
2007             Add dwp support for v2 DWARF package file format.
2008             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2009             tu_length parameter.  Adjust all callers.
2010             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2011             * dwp.cc: Include dwarf.h.
2012             (Section_bounds): New struct type.
2013             (Unit_set): New struct type.
2014             (Dwo_file::Dwo_file): Initialize new data member.
2015             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2016             Combine and rename to...
2017             (Dwo_file::read_unit_index): ...this.
2018             (Dwo_file::sized_read_compunit_index)
2019             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2020             (Dwo_file::sized_read_unit_index): ...this.
2021             (Dwo_file::copy_section): Remove section_name, is_str_offsets
2022             parameters; add section_id parameter.
2023             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2024             (Dwo_file::add_unit_set): ...this.
2025             (Dwo_file::shndx_map_): Remove.
2026             (Dwo_file::sect_offsets_): New data member.
2027             (Dwp_output_file::Dwp_output_file): Initialize new data members.
2028             (Dwp_output_file::add_section): Rename to...
2029             (Dwp_output_file::add_contribution): ...this.
2030             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2031             (Dwp_output_file::add_tu_set): Likewise.
2032             (Dwp_output_file::Contribution): New type.
2033             (Dwp_output_file::Section::contributions): New data member.
2034             (Dwp_output_file::Cu_or_tu_set): Remove.
2035             (Dwp_output_file::Section::Section): New ctor.
2036             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2037             (Dwp_output_file::Dwp_index::Section_table): New type.
2038             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2039             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2040             parameter.
2041             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2042             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2043             (Dwp_output_file::Dwp_index::section_table): New member function.
2044             (Dwp_output_file::Dwp_index::section_table_end): New member function.
2045             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2046             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2047             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2048             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2049             (Dwp_output_file::Dwp_index::section_table_): New data member.
2050             (Dwp_output_file::Dwp_index::section_mask_): New data member.
2051             (Dwp_output_file::add_output_section): New member function.
2052             (Dwp_output_file::write_new_section): New member function.
2053             (Dwp_output_file::write_contributions): New member function.
2054             (Dwp_output_file::section_id_map_): New data member.
2055             (class Dwo_id_info_reader): Remove.
2056             (class Unit_reader): New class.
2057             (get_dwarf_section_name): New function.
2058             (Dwo_file::read_executable): Adjust initializations of class data.
2059             (Dwo_file::read): Add support for v2 package file format.
2060             (Dwo_file::read_unit_index): Likewise.
2061             (Dwo_file::sized_read_unit_index): Likewise.
2062             (Dwo_file::copy_section): Likewise.
2063             (Dwo_file::add_unit_set): Likewise.
2064             (Dwp_output_file::add_output_section): Likewise.
2065             (Dwp_output_file::add_contribution): Likewise.
2066             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2067             for empty slot.
2068             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2069             file format.
2070             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2071             slot.
2072             (Dwp_output_file::initialize): Remove unused function.
2073             (Dwp_output_file::finalize): Add support for v2 package file format.
2074             (Dwp_output_file::write_index): Likewise.
2075             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2076             function prototype.
2077
2078 2013-07-31  Cary Coutant  <ccoutant@google.com>
2079
2080         * object.cc (Sized_relobj::do_output_section_address): New function.
2081         (Sized_relobj): Instantiate explicitly.
2082         * object.h (Object::output_section_address): New function.
2083         (Object::do_output_section_address): New function.
2084         (Sized_relobj::do_output_section_address): New function.
2085         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
2086
2087 2013-07-30  Cary Coutant  <ccoutant@google.com>
2088             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2089
2090         * parameters.cc (Parameters::entry): Return target-specific entry
2091         symbol name.
2092         * target.h (Target::entry_symbol_name): New function.
2093         (Target_info::entry_symbol_name): New data member.
2094
2095         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
2096         * i386.cc (Target_i386::i386_info): Likewise.
2097         (Target_i386_nacl::i386_nacl_info): Likewise.
2098         * sparc.cc (Target_sparc::sparc_info): Likewise.
2099         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
2100         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
2101         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
2102         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2103
2104 2013-07-22  Sterling Augustine  <saugustine@google.com>
2105
2106         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
2107         Convert parameter shndx to local variable. Add parameters symtab
2108         and symtab_size.  Scan over section names.  Find relocation
2109         section corresponding to current section.  Create and initialize
2110         reloc_mapper_ and reloc_type_.
2111         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
2112         unit_length to off_t.  Initialize member unit_length_.  Fill in field
2113         cu_offset_.
2114         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2115         Initialize new fields unit_length_ and cu_offset_.
2116         (Dwarf_pubnames_table::read_section): Update prototype.
2117         (Dwarf_pubnames_table::cu_offset): New member function.
2118         (Dwarf_pubnames_table::subsection_size): Likewise.
2119         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
2120         New fields.
2121         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
2122         member functions public.
2123         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
2124         Update comment.  Rework logic.  Move repeated parts to...
2125         (Gdb_index_info_reader::read_pubtable): ...here. New function.
2126         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
2127         pubtypes_table_, and stmt_list_offset.
2128         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2129         Gdb_index::find_pubtype_offset,
2130         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
2131         (Gdb_index::pubnames_read): Update prototype and rework logic.
2132         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
2133         Forward declare.
2134         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2135         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
2136         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
2137         Gdb_index::map_pubtable_to_dies):
2138         Declare functions.
2139         (Gdb_index::pubnames_read): Update declaration.
2140         (Gdb_index::Pubname_offset_map): New type.
2141         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
2142         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
2143         Gdb_index::stmt_list_offset): Declare.
2144         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
2145         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
2146         Gdb_index::pubtypes_offset_): Remove.
2147
2148 2013-07-19  Roland McGrath  <mcgrathr@google.com>
2149
2150         * options.h (General_options): Add -Trodata-segment option.
2151         * parameters.cc (Parameters::check_rodata_segment): New function.
2152         (Parameters::set_target_once): Call it.
2153         * parameters.h (Parameters): Declare it (private member function).
2154         * layout.cc (load_seg_unusable_for_headers): New function, broken
2155         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
2156         then validate rodata segment rather than text segment.
2157         (relaxation_loop_body): Call that.
2158         (is_text_segment): New function.  Don't admit a non-executable
2159         segment if TARGET->isolate_execinstr().
2160         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
2161
2162 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
2163
2164         PR gold/15070
2165         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
2166         * nacl.h (Sniff_file::View::View): Request aligned view.
2167
2168 2013-07-11  Cary Coutant  <ccoutant@google.com>
2169
2170         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
2171         correct BRLT entry size.
2172
2173 2013-07-03  Alan Modra  <amodra@gmail.com>
2174
2175         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
2176         comment.
2177
2178 2013-07-01  Cary Coutant  <ccoutant@google.com>
2179
2180         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
2181         reloc_type_.
2182         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
2183         (Dwarf_ranges_table::lookup_reloc): New function.
2184         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
2185         reloc_type_.
2186         (Dwarf_ranges_table::lookup_reloc): New function.
2187         (Dwarf_ranges_table::reloc_type_): New data member.
2188
2189 2013-06-27  Jing Yu  <jingyu@google.com>
2190
2191         PR gold/15662
2192         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
2193         function.
2194         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
2195         (Target_powerpc::do_relax): Call the above.
2196
2197 2013-06-27  Cary Coutant  <ccoutant@google.com>
2198
2199         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
2200         on garbage collected .opd section.
2201
2202 2013-06-27  Alan Modra  <amodra@gmail.com>
2203
2204         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
2205         is non-zero.
2206         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
2207         (Target_powerpc::do_function_location): Likewise for loc->shndx.
2208
2209 2013-06-14  Cary Coutant  <ccoutant@google.com>
2210
2211         * resolve.cc (Symbol::override_base): Don't override st_type
2212         from plugin placeholder symbols.
2213         (Symbol_table::resolve): Likewise.
2214         (Symbol_table::should_override): Don't complain about TLS mismatch
2215         if the TO symbol is a plugin placeholder.
2216         * testsuite/Makefile.am (plugin_test_tls): New test.
2217         * testsuite/Makefile.in: Regenerate.
2218         * testsuite/plugin_test_tls.sh: New test script.
2219         * testsuite/two_file_test_2_tls.cc: New test source.
2220         * testsuite/two_file_test_tls.cc: New test source.
2221
2222 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2223
2224         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
2225         the maximum segment alignment is larger than the page size.
2226         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
2227         correctly aligns the symbols with large alignemnt.
2228         * testsuite/Makefile.in: Regenerate.
2229         * testsuite/large_symbol_alignment.cc: New file.
2230
2231 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2232             Sriraman Tallam  <tmsriram@google.com>
2233
2234         * options.h (sort_section): New option.
2235         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
2236         Rename from Input_section_sort_section_name_special_ordering_compare.
2237         (Input_section_sort_section_name_compare): New struct.
2238         * output.cc (Output_section::Input_section_sort_section_name_compare::
2239         operator()): New function.
2240         (Output_section::sort_attached_input_sections): Use new sort function
2241         for .text if --sort-section=name is specified.
2242         * layout.cc (Layout::make_output_section):
2243         Add sorting by name when --sort-section=name is specified.
2244         * testsuite/Makefile.am (text_section_grouping): Test option
2245         --sort-section=name.
2246         * testsuite/Makefile.in: Regenerate.
2247         * testsuite/section_sorting_name.cc: New file.
2248         * testsuite/section_sorting_name.sh: New file.
2249
2250 2013-05-21  Cary Coutant  <ccoutant@google.com>
2251
2252         * symtab.h (Symbol::is_cxx_vtable): New function.
2253         * target-reloc.h (relocate_section): Check for vtable symbol.
2254         * testsuite/Makefile.am (missing_key_func.sh): New test case.
2255         * testsuite/Makefile.in: Regenerate.
2256         * testsuite/missing_key_func.cc: New test source.
2257         * testsuite/missing_key_func.sh: New test script.
2258
2259 2013-05-21  Cary Coutant  <ccoutant@google.com>
2260
2261         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
2262         type of enclosing symbol.
2263         (Relocate_info::location): Check symbol type when describing symbol.
2264         * object.h (Symbol_location_info): Remove unused line_number;
2265         add enclosing_symbol_type.
2266         * testsuite/debug_msg.sh: Adjust expected output.
2267
2268 2013-05-13  Cary Coutant  <ccoutant@google.com>
2269
2270         * configure.ac: Export DEFAULT_TARGET.
2271         * configure: Regenerate.
2272         * Makefile.in: Regenerate.
2273         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
2274         * testsuite/Makefile.in: Regenerate.
2275         * testsuite/debug_msg.sh: Delete duplicate tests.
2276         Don't check undef_int error message match for powerpc where the
2277         source file and line number aren't available.
2278
2279 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2280
2281         * options.h (General_options): Add --rosegment-gap option.
2282         * options.cc (finalize): --rosegment-gap implies --rosegment.
2283         * layout.cc (set_segment_offsets): Let user option override
2284         target->rosegment_gap().
2285
2286 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2287
2288         * options.h (General_options): Remove leading space from help
2289         messages for -nostdlib and --rosegment.
2290
2291 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
2292
2293         PR ld/15365
2294         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
2295
2296 2013-05-03  Alan Modra  <amodra@gmail.com>
2297
2298         * merge.cc (Output_merge_string::do_add_input_section): Correct
2299         scan for number of strings.  Rename vars to avoid shadowing.
2300         Include missing terminator in input_size_.
2301
2302 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
2303
2304         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
2305         Restore empty string handling.
2306
2307 2013-05-01  Cary Coutant  <ccoutant@google.com>
2308
2309         * stringpool.cc (Stringpool_template::new_key_offset): Fix
2310         uninitialized warning.
2311
2312 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2313
2314         * output.cc (Output_section::add_merge_input_section): Allow
2315         to merge sections if the alignment is more than character size.
2316         * merge.h (Output_merge_string::Output_merge_string): Remove
2317         assert.
2318         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
2319         only not-null strings. Check the alignment of strings.
2320         * stringpool.h
2321         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
2322         alignment as the argument.
2323         (Stringpool_template<Stringpool_char>::addralign_): New class member.
2324         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
2325         Align non-zero length strings according to the addralign_.
2326         (Stringpool_template<Stringpool_char>::set_string_offsets):
2327         Updating offsets according to the given alignment.
2328         * testsuite/Makefile.am (text_section_grouping): Test if string
2329         literals are getting merged.
2330         * testsuite/Makefile.in: Regenerate.
2331         * testsuite/merge_string_literals_1.c: New file.
2332         * testsuite/merge_string_literals_2.c: Ditto.
2333         * testsuite/merge_string_literals.sh: Ditto.
2334
2335 2013-04-26  Ian Lance Taylor  <iant@google.com>
2336
2337         * target-reloc.h (relocate_section): If the reloc offset is out of
2338         range, pass VIEW as NULL to relocate.relocate.
2339         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
2340         * i386.cc (Target_i386::Relocate::relocate): Likewise.
2341         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
2342         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
2343         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
2344         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2345
2346 2013-04-26  Geoff Pike  <gpike@chromium.org>
2347
2348         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
2349         * layout.cc (Hash_task): New class.
2350         (Layout::queue_build_id_tasks): New function.
2351         (Layout::write_build_id): Handle single-thread portion of build ID
2352         computation.  (In some cases, all of it is single-threaded.)  Replace
2353         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
2354         functionality in fewer lines of code.
2355         * layout.h (Layout::queue_build_id_tasks): New function declaration.
2356         * options.h (General_options): make "--build-id" default to tree
2357         rather than sha1.  Add two new options related to --build-id=tree:
2358         --build-id-chunk-size-for-treehash and
2359         --build-id-min-file-size-for-treehash.
2360         * Makefile.am: add testing of --build-id=tree and related new options
2361         (these tests will be invoked by "make check").
2362         * Makefile.in: Regenerate.
2363
2364 2013-04-25  Alan Modra  <amodra@gmail.com>
2365
2366         * configure.tgt: Add powerpcle and powerpc64le.
2367
2368 2013-04-22  Alan Modra  <amodra@gmail.com>
2369
2370         PR gold/15355
2371         * layout.cc (Layout::segment_precedes): Allow more than one
2372         segment with the same type and flags.
2373
2374 2013-04-15  Cary Coutant  <ccoutant@google.com>
2375
2376         * layout.cc (Layout::set_relocatable_section_offsets): Don't
2377         allocate space in file for BSS sections.
2378
2379 2013-04-15  Cary Coutant  <ccoutant@google.com>
2380
2381         * script-sections.cc (Orphan_output_section): Reset address
2382         to zero after each orphaned section for relocatable links.
2383
2384 2013-04-15  Cary Coutant  <ccoutant@google.com>
2385
2386         * symtab.cc (Symbol_table::sized_write_globals): Subtract
2387         section starting address for relocatable link.
2388         * testsuite/Makefile.am (script_test_11): New test.
2389         * testsuite/Makefile.in: Regenerate.
2390         * testsuite/script_test_11.c: New source file.
2391         * testsuite/script_test_11.t: New linker script.
2392
2393 2013-04-13  Alan Modra  <amodra@gmail.com>
2394
2395         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
2396         owner when sections are not adjacent and exceed group size.
2397         (Target_powerpc::group_sections): Handle corner case.
2398         (Target_powerpc::Branch_info::make_stub): Handle case where
2399         stub table doesn't exist due to branches in non-exec sections.
2400         (Target_powerpc::Relocate::relocate): Likewise.
2401
2402 2013-04-11  Alan Modra  <amodra@gmail.com>
2403
2404         PR gold/15354
2405         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
2406         .branch_lt to match bfd ld.  Adjust comments throughout file.
2407
2408 2013-04-04  Ian Lance Taylor  <iant@google.com>
2409
2410         GCC PR c++/56840
2411         * object.cc (do_layout_deferred_sections): Handle .eh_frame
2412         sections before checking whether they are included in the link.
2413
2414 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
2415
2416         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
2417         object before calling the plugin claim_file handler.  Pass the elf
2418         object of the archive to the plugin. Delete the elf object if the
2419         plugin claims the file.
2420
2421 2013-03-21  Alan Modra  <amodra@gmail.com>
2422
2423         * layout.cc (Layout::set_segment_offsets): Accept writable .text
2424         segment when omagic.
2425
2426 2013-03-21  Alan Modra  <amodra@gmail.com>
2427
2428         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
2429         comparison warning.
2430         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
2431         uninitialized" warning.
2432
2433 2013-03-20  Alan Modra  <amodra@gmail.com>
2434
2435         * symtab.h (Symbol::clear_version): New function.
2436         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
2437         is_needed by weak references.  Clear version for symbols defined
2438         in as-needed objects that are not needed.
2439
2440 2013-03-15  Alan Modra  <amodra@gmail.com>
2441
2442         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
2443         static and public.  Add report_err param.  Return false for data refs.
2444         (Target_powerpc::rela_dyn_section): New overloaded function.
2445         (Target_powerpc::plt_, iplt_): Elucidate.
2446         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
2447         (Output_data_plt_powerpc::do_write): Don't write .iplt.
2448         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
2449         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
2450         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
2451         push_branch and make_plt_entry for ifunc syms when
2452         reloc_needs_plt_for_ifunc.
2453         (Target_powerpc::Relocate::relocate): Don't use plt entry value
2454         for ifunc unless reloc_needs_plt_for_ifunc.
2455
2456 2013-03-15  Alan Modra  <amodra@gmail.com>
2457
2458         * gc.h (gc_process_relocs): Don't look through function descriptors.
2459         * icf.cc (get_section_contents): Do so here instead.
2460
2461 2013-03-13  Alan Modra  <amodra@gmail.com>
2462
2463         * powerpc.cc (is_branch_reloc): Forward declare.
2464         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
2465         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
2466         false for 64-bit, true for 32-bit non-branch relocs.
2467         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
2468         * testsuite/Makefile.am (icf_test): Use linker map file instead of
2469         nm output.
2470         (icf_safe_test): Generate linker map file as well as nm output.
2471         (icf_safe_so_test): Likewise.
2472         * testsuite/Makefile.in: Regenerate.
2473         * testsuite/icf_test.sh: Parse linker map file to determine
2474         section folding.
2475         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
2476         * testsuite/icf_safe_so_test.sh: Likewise.
2477         (X86_32_or_ARM_specific_safe_fold): Merge into..
2478         (arch_specific_safe_fold): ..this.
2479         (X86_64_specific_safe_fold): Delete unused function.
2480
2481 2013-03-12  Alan Modra  <amodra@gmail.com>
2482
2483         * gc.h (gc_process_relocs): Look through function descriptors
2484         to determine shndx, symvalue and addend used by ICF.  Tidy
2485         variable duplication.
2486
2487 2013-03-11  Alan Modra  <amodra@gmail.com>
2488
2489         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
2490         * layout.cc (Layout_task_runner::run): ..to here.
2491         * symtab.h (struct Symbol_location): Extract from..
2492         (class Symbol_table): ..here.
2493         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
2494         * target.h (class Target): Add function_location and
2495         do_function_location functions.
2496         (class Sized_target): Add do_function_location.
2497         * object.h (class Sized_relobj_file): Move find_shdr..
2498         (class Object): ..to here.
2499         * object.cc: Likewise.  Update to suit.  Instantiate.
2500         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
2501         * powerpc.cc (class Powerpc_dynobj): New.
2502         (Target_powerpc::do_function_location): New function.
2503         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
2504         (Powerpc_dynobj::do_read_symbols): New function.
2505         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
2506
2507 2013-03-08  Ian Lance Taylor  <iant@google.com>
2508
2509         * options.cc (General_options::string_to_object_format): Accept
2510         "default".
2511
2512 2013-03-08  Alan Modra  <amodra@gmail.com>
2513
2514         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
2515         pointer to Post_fde.
2516         (struct Post_fde): Move definition to here..
2517         * ehframe.cc (struct Post_fde): ..from here.
2518         (Cie::write): Don't alloc Post_fde.
2519         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
2520
2521 2013-03-07  Alan Modra  <amodra@gmail.com>
2522
2523         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
2524         relocation referencing .LC0.
2525         * testsuite/discard_locals_test.sh: Remove FIXMEs.
2526
2527 2013-03-07  Alan Modra  <amodra@gmail.com>
2528
2529         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
2530         always_inline.  Add assembly for powerpc to avoid GOT.
2531
2532 2013-03-07  Alan Modra  <amodra@gmail.com>
2533
2534         * testsuite/script_test_10.sh: Don't test .bss section
2535         header number.
2536
2537 2013-03-06  Alan Modra  <amodra@gmail.com>
2538
2539         * powerpc.cc (class Powerpc_relobj): Move some member functions.
2540         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
2541         all callers.  Handle folded sections.
2542         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
2543         to Powerpc_relobj.
2544         (Global_symbol_visitor_opd::operator()): Likewise.
2545
2546 2013-03-04  Alan Modra  <amodra@gmail.com>
2547
2548         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
2549         * testsuite/Makefile.in: Regenerate.
2550
2551 2013-03-01  Cary Coutant  <ccoutant@google.com>
2552
2553         Add dwp support for v2 DWARF package file format.
2554         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2555         tu_length parameter.  Adjust all callers.
2556         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2557         * dwp.cc: Include dwarf.h.
2558         (Section_bounds): New struct type.
2559         (Unit_set): New struct type.
2560         (Dwo_file::Dwo_file): Initialize new data member.
2561         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2562         Combine and rename to...
2563         (Dwo_file::read_unit_index): ...this.
2564         (Dwo_file::sized_read_compunit_index)
2565         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2566         (Dwo_file::sized_read_unit_index): ...this.
2567         (Dwo_file::copy_section): Remove section_name, is_str_offsets
2568         parameters; add section_id parameter.
2569         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2570         (Dwo_file::add_unit_set): ...this.
2571         (Dwo_file::shndx_map_): Remove.
2572         (Dwo_file::sect_offsets_): New data member.
2573         (Dwp_output_file::Dwp_output_file): Initialize new data members.
2574         (Dwp_output_file::add_section): Rename to...
2575         (Dwp_output_file::add_contribution): ...this.
2576         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2577         (Dwp_output_file::add_tu_set): Likewise.
2578         (Dwp_output_file::Contribution): New type.
2579         (Dwp_output_file::Section::contributions): New data member.
2580         (Dwp_output_file::Cu_or_tu_set): Remove.
2581         (Dwp_output_file::Section::Section): New ctor.
2582         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2583         (Dwp_output_file::Dwp_index::Section_table): New type.
2584         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2585         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2586         parameter.
2587         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2588         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2589         (Dwp_output_file::Dwp_index::section_table): New member function.
2590         (Dwp_output_file::Dwp_index::section_table_end): New member function.
2591         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2592         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2593         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2594         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2595         (Dwp_output_file::Dwp_index::section_table_): New data member.
2596         (Dwp_output_file::Dwp_index::section_mask_): New data member.
2597         (Dwp_output_file::add_output_section): New member function.
2598         (Dwp_output_file::write_new_section): New member function.
2599         (Dwp_output_file::write_contributions): New member function.
2600         (Dwp_output_file::section_id_map_): New data member.
2601         (class Dwo_id_info_reader): Remove.
2602         (class Unit_reader): New class.
2603         (get_dwarf_section_name): New function.
2604         (Dwo_file::read_executable): Adjust initializations of class data.
2605         (Dwo_file::read): Add support for v2 package file format.
2606         (Dwo_file::read_unit_index): Likewise.
2607         (Dwo_file::sized_read_unit_index): Likewise.
2608         (Dwo_file::copy_section): Likewise.
2609         (Dwo_file::add_unit_set): Likewise.
2610         (Dwp_output_file::add_output_section): Likewise.
2611         (Dwp_output_file::add_contribution): Likewise.
2612         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2613         for empty slot.
2614         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2615         file format.
2616         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2617         slot.
2618         (Dwp_output_file::initialize): Remove unused function.
2619         (Dwp_output_file::finalize): Add support for v2 package file format.
2620         (Dwp_output_file::write_index): Likewise.
2621         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2622         function prototype.
2623
2624 2013-03-01  Cary Coutant  <ccoutant@google.com>
2625
2626         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
2627         function into class definition in header file.
2628         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
2629         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
2630         New function.
2631         (Dwarf_info_reader::check_buffer): Move here from .cc file.
2632
2633 2013-02-28  Alan Modra  <amodra@gmail.com>
2634
2635         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
2636         * target.cc (Target::do_plt_fde_location): New function.
2637         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
2638         accessor function, and constructor param.
2639         (struct Post_fde, Post_fdes): Declare.
2640         (Cie::write): Add post_fdes param.
2641         * ehframe.cc (Fde::write): Use plt_fde_location.
2642         (struct Post_fde): Define.
2643         (Cie::write): Stash FDEs added post merge mapping.
2644         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
2645         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
2646         (Eh_frame::do_sized_write): Arrange to write post map FDES after
2647         other FDEs.
2648         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
2649         (Target_powerpc::has_glink): New function.
2650         (Target_powerpc::do_relax): Add eh_frame info for stubs.
2651         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
2652         glink_eh_frame_fde_32, default_fde): New data.
2653         (Stub_table::eh_frame_added_): New var.
2654         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
2655         Make const.
2656         (Stub_table::add_eh_frame): New function.
2657         (Output_data_glink::add_eh_frame): New function.
2658         (Target_powerpc::make_glink_section): Call add_eh_frame.
2659
2660 2013-02-15  Ian Lance Taylor  <iant@google.com>
2661
2662         * options.h (DEFINE_uint64_alias): Define.
2663         (class General_options): Add -Ttext-segment as an alias for
2664         -Ttext.
2665
2666 2013-02-15  Alan Modra  <amodra@gmail.com>
2667
2668         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
2669         (Stub_table::do_write): ..here, two places.
2670         (Stub_table::plt_call_size): Use it here too.
2671
2672 2013-02-11  Ian Lance Taylor  <iant@google.com>
2673
2674         * descriptors.cc (Descriptors::close_all): New function.
2675         * descriptors.h (class Descriptors): Declare close_all.
2676         (close_all_descriptors): New inline function.
2677         * plugin.cc: Include "descriptors.h".
2678         (Plugin_manager::cleanup): Call close_all_descriptors.
2679
2680 2013-02-06  Alan Modra  <amodra@gmail.com>
2681
2682         * README: Update coding style link.
2683
2684 2013-01-28  Cary Coutant  <ccoutant@google.com>
2685
2686         * dwp.cc (File_list): New typedef.
2687         (Dwo_name_info_reader): New class.
2688         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
2689         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
2690         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
2691         (Dwo_file::read_executable): New function.
2692         (Dwo_file::read): Move common setup code to ...
2693         (Dwo_file::make_object): ... here.
2694         (dwp_options): Add --exec/-e.
2695         (usage): Likewise.
2696         (main): Likewise.
2697
2698 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
2699
2700         * layout.cc (Layout::layout): Check for option text_reorder.
2701         (Layout::make_output_section): Ditto.
2702         * options.h (text_reorder): New option.
2703         * output.cc (Input_section_sort_compare): Remove special ordering
2704         of section names.
2705         (Output_section::
2706          Input_section_sort_section_name_special_ordering_compare::
2707          operator()): New function.
2708         (Output_section::sort_attached_input_sections): Use new sort function
2709         for .text.
2710         * output.h (Input_section_sort_section_name_special_ordering_compare):
2711         New struct.
2712         * testsuite/Makefile.am (text_section_grouping): Test option
2713         --no-text-reorder
2714         * testsuite/Makefile.in: Regenerate.
2715         * testsuite/text_section_grouping.sh: Check order of functions without
2716         default text reordering.
2717
2718 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
2719
2720         * options.h (General_options): Change default to true for new_dtags.
2721
2722 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
2723
2724         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
2725         when enable_new_dtags is false.  Only add DT_RUNPATH when
2726         enable_new_dtags is true.
2727
2728 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
2729
2730         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
2731         used in declaration and definition consistent.
2732         (Target_powerpc::symval_for_branch): Ditto.
2733
2734 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
2735
2736         * testsuite/plugin_final_layout.cc: Fix comment.
2737
2738 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
2739
2740         * layout.cc (Layout::layout): Do not do default sorting for
2741         text sections when section ordering is specified.
2742         (make_output_section): Ditto.
2743         * testsuite/plugin_final_layout.cc: Name the function sections
2744         to catch reordering issues.
2745
2746 2013-01-15  Alan Modra  <amodra@gmail.com>
2747
2748         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
2749         plt-thread-safe.
2750
2751 2013-01-15  Alan Modra  <amodra@gmail.com>
2752
2753         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
2754         * testsuite/Makefile.in: Regenerate.
2755
2756 2013-01-14  Alan Modra  <amodra@gmail.com>
2757
2758         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
2759         * testsuite/Makefile.in: Regenerate.
2760
2761 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
2762
2763         PR bfd/14430
2764         Fix mingw gold build with plugins enabled
2765         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
2766         * configure.ac: Export DLOPEN_LIBS and add headers check.
2767         * plugin.cc: Handle non-dlfcn case.
2768         * Makefile.in: Regenerate.
2769         * config.in: Regenerate.
2770         * configure: Regenerate.
2771         * testsuite/Makefile.in: Regenerate.
2772
2773 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
2774
2775         * output.h (sort_attached_input_sections): Change to be public.
2776         * script-sections.cc
2777         (Output_section_definition::set_section_addresses): Sort
2778         attached input sections according to section order before linker
2779         script assigns section addresses.
2780         (Orphan_output_section::set_section_addresses): Sort
2781         attached input sections according to section order before linker
2782         script assigns section addresses.
2783         * Makefile.am (final_layout.sh): Use a simple linker script to
2784         check if section ordering still works.
2785         * Makefile.in: Regenerate.
2786
2787 2013-01-09  Ben Cheng  <bccheng@google.com>
2788
2789         * arm.cc (Target_arm::attributes_accept_div): New function.
2790         (Target_arm::attributes_forbid_div): New function.
2791         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
2792         attribute using the same new functions as what bfd/elf32_arm.c
2793         does.
2794
2795 2013-01-07  Cary Coutant  <ccoutant@google.com>
2796
2797         PR gold/14993
2798         * output.cc (Output_section::add_input_section): For incremental
2799         updates, don't track input sections that are allocated from patch
2800         space.
2801
2802 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
2803             Ian Lance Taylor  <iant@google.com>
2804
2805         PR gold/14897
2806         * configure.ac (--enable-ld): Removed.
2807         (install_as_default): Set to yes only for --enable-gold=default
2808         or --disable-ld.
2809         * configure: Regenerated.
2810
2811 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
2812
2813         * options.h (General_options): Add -fuse-ld= for GCC linker
2814         option compatibility.
2815
2816 2013-01-04  Cary Coutant  <ccoutant@google.com>
2817
2818         * configure.ac: Fix typo restoring CXXFLAGS.
2819         * configure: Regenerate.
2820
2821 2013-01-04  Cary Coutant  <ccoutant@google.com>
2822
2823         * testsuite/Makefile.am (CXXLINK_S): New macro.
2824         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
2825         * testsuite/Makefile.in: Regenerate.
2826
2827 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
2828
2829         * version.cc (print_version): Update copyright year to 2013.
2830
2831 2012-12-20  Ian Lance Taylor  <iant@google.com>
2832
2833         * layout.cc (Layout::special_ordering_of_input_section): New
2834         function.
2835         (Layout::layout): If input section requires special ordering, must
2836         sort input sections.
2837         (Layout::make_output_section): May sort .text input sections.
2838         (Layout::is_section_name_prefix_grouped): Remove.
2839         * layout.h (class Layout): Declare
2840         special_ordering_of_input_section.  Don't declare
2841         is_section_name_prefix_grouped.
2842         * output.cc (Output_section::add_input_section): Revert last
2843         change.
2844         (Output_section::Input_section_sort::match_file_name): Don't crash
2845         if called on output section data.
2846         (Output_section::Input_section_sort_compare): Sort based on
2847         special ordering.
2848         (Output_section::Input_section_sort_section_order_index_compare):
2849         Revert last patch.
2850         (Output_section::sort_attached_input_sections): Likewise.
2851
2852 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
2853
2854         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
2855         * layout.h (Layout::is_section_name_prefix_grouped): New function.
2856         * output.cc (Output_section::add_input_section): Check if section
2857         name contains special prefix.  Keep input sections to sort such
2858         sections.
2859         (Output_section::Input_section_sort_section_order_index_compare
2860          ::operator()): Group sections according to prefixes.
2861         (Output_section::sort_attached_input_sections): Add condition to
2862         Input_section_entry constructor call.
2863         * testsuite/Makefile.am (text_section_grouping): New test.
2864         * testsuite/Makefile.in: Regenerate.
2865         * testsuite/text_section_grouping.cc: New file.
2866         * testsuite/text_section_grouping.sh: New file.
2867
2868 2012-12-17  Nick Clifton  <nickc@redhat.com>
2869
2870         * Makefile.am: Add copyright notice.
2871         * NEWS: Likewise.
2872         * README: Likewise.
2873         * configure.ac: Likewise.
2874         * ftruncate.c: Likewise.
2875         * Makefile.in: Regenerate.
2876
2877 2012-12-14  Cary Coutant  <ccoutant@google.com>
2878
2879         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
2880         --no-as-needed flag.
2881         (exception_separate_shared_12_test): Likewise.
2882         (incremental_copy_test): Likewise.
2883         * testsuite/Makefile.in: Regenerate.
2884
2885 2012-12-14  Cary Coutant  <ccoutant@google.com>
2886
2887         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
2888         (Dwp_output_file::Dwp_index::enter_set): Add assert.
2889
2890 2012-12-12  Alan Modra  <amodra@gmail.com>
2891
2892         * powerpc.cc (class Track_tls): New.
2893         (class Relocate, class Scan): Inherit Track_tls.
2894         (Target_powerpc::Scan::local, global): Track tls optimization
2895         and avoid creating plt entry for __tls_get_addr if all uses
2896         are optimized away.
2897         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
2898
2899 2012-12-12  Alan Modra  <amodra@gmail.com>
2900
2901         * options.h (General_options): Add --toc-sort/--no-toc-sort.
2902         Replace no_toc_optimize with toc_optimize.
2903         * output.h (Output_section::input_sections): Provide non-const variant.
2904         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
2905         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
2906         accessors.
2907         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
2908         (class Sort_toc_sections): New.
2909         (Target_powerpc::do_finalize_sections): Sort toc sections.
2910         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
2911
2912 2012-12-10  Roland McGrath  <mcgrathr@google.com>
2913
2914         * testsuite/binary_unittest.cc (read_all): New function.
2915         (Sized_binary_test): Use it instead of ::read.
2916         * fileread.cc (do_read): Don't assume pread always reads the whole
2917         amount in a single call.
2918
2919 2012-12-10  Alan Modra  <amodra@gmail.com>
2920
2921         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
2922         Set EM_PPC64 or EM_PPC here.
2923         (Target_selector_powerpc::do_recognize): Delete.
2924
2925 2012-12-10  Alan Modra  <amodra@gmail.com>
2926
2927         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
2928         stub_table_.
2929         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
2930
2931 2012-12-07  Roland McGrath  <mcgrathr@google.com>
2932
2933         * testsuite/binary_unittest.cc (Sized_binary_test):
2934         Use open_descriptor rather than ::open.
2935
2936 2012-12-07  Alan Modra  <amodra@gmail.com>
2937
2938         * powerpc.cc (Stub_table::do_write): Delete redundant Address
2939         typedef and invalid_address constant.
2940         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2941         instantiate constants.
2942
2943 2012-12-06  Roland McGrath  <mcgrathr@google.com>
2944
2945         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2946         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2947         * aclocal.m4: Regenerate.
2948         * configure: Regenerate.
2949         * Makefile.in: Regenerate.
2950         * testsuite/Makefile.in: Regenerate.
2951
2952 2012-12-07  Alan Modra  <amodra@gmail.com>
2953
2954         * options.h (General_options): Add no_toc_optimize.
2955         * powerpc.cc (ok_lo_toc_insn): New function.
2956         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2957
2958 2012-12-06  Alan Modra  <amodra@gmail.com>
2959
2960         * options.h (General_options): Add plt_align, plt_static_chain,
2961         plt_thread_safe.  Update stub_group_size help text.
2962         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2963         for new plt_thread_safe_ var.
2964         (use_plt_offset): Correct comments.
2965         (Target_powerpc::do_relax): Look for thread creation symbols to
2966         determine default plt_thread_safe value.  Clear plt call stubs
2967         as well as branch stubs each iteration.
2968         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2969         insn constants.
2970         (l, hi, ha, write_insn): Move earlier.
2971         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2972         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2973         plt stubs too.
2974         (Stub_table::update_size): Adjust.
2975         (Stub_table::prev_size, set_prev_size): Delete.
2976         (Stub_table::stub_align): Let --plt-align affect result.
2977         (Stub_table::plt_call_size): Calculate sizes for various stubs.
2978         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2979         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2980         (Stub_table::do_write): Support more stub variants.
2981
2982 2012-12-04  Alan Modra  <amodra@gmail.com>
2983
2984         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2985         (Target_powerpc::do_define_standard_symbols): New function.
2986
2987 2012-12-03  Alan Modra  <amodra@gmail.com>
2988
2989         * output.h: Formatting, whitespace.
2990
2991 2012-12-03  Alan Modra  <amodra@gmail.com>
2992
2993         * layout.h (Layout::get_executable_sections): Declare.
2994         * layout.cc (Layout::get_executable_sections): New function.
2995         * arm.cc (Target_arm::group_sections): Use it.
2996         (Arm_output_section::group_sections): Delete now redundant test.
2997         * output.cc (Output_reloc::Output_reloc): Add is_relative.
2998         param to handle relative relocs.
2999         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
3000         (Output_data_reloc::add_absolute): Adjust.
3001         (Output_data_reloc::add_relative): New function.
3002         (Output_data::reset_data_size): New function.
3003         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
3004         (Output_section::set_addralign): New function.
3005         (Output_section::checkpoint_set_addralign): New function.
3006         (Output_section::clear_section_offsets_need_adjustment): New function.
3007         (Output_section::input_sections): Make public.
3008         * powerpc.cc (class Output_data_brlt_powerpc): New.
3009         (class Stub_table, class Stub_control): New.
3010         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
3011         stub_table_, set_stub_table, stub_table): New vectors and accessor
3012         functions.
3013         (Target_powerpc::do_may_relax, do_relax, push_branch,
3014         new_stub_table, stub_tables, brlt_section, group_sections,
3015         add_branch_lookup_table, find_branch_lookup_table,
3016         write_branch_lookup_table, make_brlt_section): New functions.
3017         (Target_powerpc::struct Sort_sections, class Branch_info): New.
3018         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
3019         branch_info_): New vars.
3020         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
3021         make call stubs here.
3022         (Output_data_glink): Remove all call stub handling from this class.
3023         (Target_powerpc::Scan::local, global): Save interesting branch
3024         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
3025         (Target_powerpc::do_finalize_sections): Only make reg save/restore
3026         functions on final link.
3027         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
3028         Handle long branch destinations too.
3029         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
3030         do_plt_address_for_local): Adjust lookup of plt call stubs.
3031
3032 2012-11-30  Alan Modra  <amodra@gmail.com>
3033
3034         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
3035         relocs against protected symbols when building 32-bit shared libs.
3036
3037 2012-11-30  Alan Modra  <amodra@gmail.com>
3038
3039         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
3040         param.  Call got_section() to make .got.  Update all callers
3041         and their callers and so on.
3042
3043 2012-11-30  Alan Modra  <amodra@gmail.com>
3044
3045         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
3046         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
3047         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
3048         value if it already exists.
3049
3050 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
3051
3052         PR gold/14858
3053         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
3054
3055 2012-11-14  Roland McGrath  <mcgrathr@google.com>
3056
3057         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
3058         than bfc instruction for data sandboxing.
3059
3060 2012-11-08  Alan Modra  <amodra@gmail.com>
3061
3062         * po/POTFILES.in: Regenerate.
3063
3064 2012-11-05  Alan Modra  <amodra@gmail.com>
3065
3066         * configure.ac: Apply 2012-09-10 change to config.in here.
3067         * configure: Regenerate.
3068
3069 2012-11-05  Alan Modra  <amodra@gmail.com>
3070
3071         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
3072         (struct Opd_ent): Use "Address" rather than "Offset".
3073         (Output_data_got_powerpc::got_base_offset): Return Valtype.
3074         (Target_powerpc::got_section): Make public.
3075         (Target_powerpc::scan_relocs): Move code setting symbols..
3076         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
3077         Create _SDA_BASE_ only when referenced.
3078
3079 2012-11-02  Roland McGrath  <mcgrathr@google.com>
3080
3081         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
3082         from last change.
3083
3084 2012-11-01  Roland McGrath  <mcgrathr@google.com>
3085
3086         * target.h (Sized_target::relocate_relocs): Use Elf_Off
3087         for offset_in_output_section parameter.
3088         (Sized_target::relocate_special_relocatable): Likewise.
3089         * arm.cc (Target_arm::relocate_relocs): Likewise.
3090         (Target_arm::relocate_special_relocatable): Likewise.
3091         * i386.cc (Target_i386::relocate_relocs): Likewise.
3092         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
3093         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
3094         * target-reloc.h (relocate_relocs): Likewise.
3095         * testsuite/testfile.cc (Target_test): Likewise.
3096         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
3097         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
3098
3099         * system.h: Move inclusion of <clocale> to after <libintl.h> in
3100         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
3101
3102         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
3103         parameter, which is unused in the [!F_SETFD] case.
3104
3105         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
3106         SYMNDX to off_t before comparing it to this->data_size().
3107         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
3108         * incremental.cc (Output_section_incremental_inputs::do_write):
3109         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
3110
3111         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
3112
3113 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
3114
3115         * gold.cc (Target_arm::do_adjust_elf_header): Add the
3116         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
3117         in EABI_VER5.
3118
3119 2012-10-29  Cary Coutant  <ccoutant@google.com>
3120
3121         * dwp.cc (usage): Add file and exit status parameters;
3122         add --help and --version options.
3123         (print_version): New function.
3124         (main): Add --help and --version options.
3125
3126 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3127
3128         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
3129         final_layout_sequence.txt.
3130         * testsuite/Makefile.in: Regenerated.
3131
3132 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3133
3134         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
3135         COMPILE generated by automake.
3136         (LINK1): Likewise.
3137         (CXXCOMPILE1): Likewise.
3138         (CXXLINK1): Likewise.
3139         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
3140         (LINK): Likewise.
3141         (CXXCOMPILE): Likewise.
3142         (CXXLINK): Likewise.
3143         * testsuite/Makefile.in: Regenerated.
3144
3145 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3146
3147         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
3148         on bad fwrite return.
3149
3150 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3151
3152         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
3153         on val.
3154
3155 2012-10-23  Cary Coutant  <ccoutant@google.com>
3156
3157         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
3158         * testsuite/Makefile.in: Regenerate.
3159         * testsuite/dwp_test.h: New source file.
3160         * testsuite/dwp_test_1.cc: New source file.
3161         * testsuite/dwp_test_1.s: New source file.
3162         * testsuite/dwp_test_1.sh: New source file.
3163         * testsuite/dwp_test_1b.cc: New source file.
3164         * testsuite/dwp_test_1b.s: New source file.
3165         * testsuite/dwp_test_2.cc: New source file.
3166         * testsuite/dwp_test_2.s: New source file.
3167         * testsuite/dwp_test_2.sh: New source file.
3168         * testsuite/dwp_test_main.cc: New source file.
3169         * testsuite/dwp_test_main.s: New source file.
3170
3171 2012-10-23  Cary Coutant  <ccoutant@google.com>
3172
3173         * dwp.h: New header file.
3174         * dwp.cc: New source file.
3175         * gold.h: Move shared declarations to system.h.
3176         * system.h: New header file.
3177         * Makefile.am: Add dwp.
3178         * Makefile.in: Regenerate.
3179
3180 2012-10-23  Cary Coutant  <ccoutant@google.com>
3181
3182         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
3183         Dwarf_info_reader::read_from_pointer.
3184         (Dwarf_pubnames_table::read_header): Likewise.
3185         (Dwarf_pubnames_table::next_name): Likewise.
3186         (Dwarf_die::read_attributes): Likewise.
3187         (Dwarf_die::skip_attributes): Likewise.
3188         (Dwarf_info_reader::read_from_pointer): New function template.
3189         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
3190         (Dwarf_pubnames_table): Likewise.
3191         (Dwarf_info_reader::read_from_pointer): New function template.
3192         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
3193         Dwarf_pubnames_table ctor.
3194
3195 2012-10-23  Cary Coutant  <ccoutant@google.com>
3196
3197         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
3198         abbrev_shndx.
3199         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
3200         abbrev_shndx_.
3201         (Dwarf_info_reader::set_abbrev_shndx): New method.
3202         (Dwarf_info_reader::abbrev_shndx_): New data member.
3203
3204 2012-10-23  Cary Coutant  <ccoutant@google.com>
3205
3206         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
3207         from object, not parameters.
3208         (Dwarf_info_reader::parse): Likewise.
3209         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
3210         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
3211         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
3212         methods.
3213
3214 2012-10-23  Cary Coutant  <ccoutant@google.com>
3215
3216         * fileread.cc (Input_file::Input_file): New constructor.
3217         * fileread.h (class Input_file): Add new constructor.
3218
3219 2012-10-18  Alan Modra  <amodra@gmail.com>
3220
3221         PR gold/14727
3222         * object.cc (Relobj::is_section_name_included): Also match
3223         .sdata personality section.
3224
3225 2012-10-18  Alan Modra  <amodra@gmail.com>
3226
3227         * target-reloc.h (class Default_comdat_behavior): New, package up..
3228         (get_comdat_behaviour): ..this.
3229         (relocate_section): Add Relocate_comdat_behavior template arg,
3230         adjust code to suit.
3231         * arm.cc (Target_arm::relocate_section): Adjust to suit.
3232         (Target_arm::scan_reloc_section): Likewise.
3233         * i386.cc (Target_i386::relocate_section): Likewise.
3234         * sparc.cc (Target_sparc::relocate_section): Likewise.
3235         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
3236         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
3237         * powerpc.cc (class Relocate_comdat_behavior): New.
3238         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
3239         gold::relocate_section with new template arg.
3240
3241 2012-10-18  Alan Modra  <amodra@gmail.com>
3242
3243         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
3244         dynamic relocs for GOT_TPREL got entries, without symbol if
3245         resolving locally.
3246         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
3247         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
3248         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
3249
3250 2012-10-17  Alan Modra  <amodra@gmail.com>
3251
3252         PR gold/14726
3253         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
3254
3255 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
3256
3257         * layout.cc (Layout::include_section): Keep sections marked
3258         SHF_EXCLUDE when doing relocatable links.
3259
3260 2012-10-16  Alan Modra  <amodra@gmail.com>
3261
3262         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
3263         (Target_powerpc::do_finalize_sections): Call it.
3264         (Output_data_save_res): New class and supporting functions.
3265         (Target_powerpc::symval_for_branch): Only look up .opd entry for
3266         normal symbols defined in object files.
3267
3268 2012-10-12  Alan Modra  <amodra@gmail.com>
3269
3270         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
3271         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
3272         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
3273         section if scan_opd_relocs not yet called.
3274         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
3275
3276 2012-10-12  Alan Modra  <amodra@gmail.com>
3277
3278         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3279         add_local_ifunc_entry): Revert last change.
3280         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
3281
3282 2012-10-05  Alan Modra  <amodra@gmail.com>
3283
3284         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
3285         do_plt_address_for_global): New functions.
3286         (Output_data_got_powerpc::do_write): Don't segfault when linking
3287         statically.
3288         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3289         add_local_ifunc_entry): Return true on adding entry..
3290         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
3291         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
3292         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
3293         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
3294         set up symbols here.
3295         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
3296         syms here.  Do so even when no .iplt.  Don't segfault when linking
3297         statically.
3298         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
3299         new variants without reloc param.
3300         (Glink_sym_ent::Glink_sym_ent): Likewise.
3301         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
3302         reloc when refs will resolve to plt call stub.
3303         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
3304         R_PPC_PLTREL24 to resolve locally.
3305         (Target_powerpc::Scan::global): Correct ifunc handling.
3306         (Target_powerpc::Relocate::relocate): Correct local sym glink
3307         lookup.  Don't destroy "value" when we have a plt call stub,
3308         and when checking plt call validity.
3309         (Target_powerpc::do_dynsym_value): Simplify.
3310
3311 2012-10-05  Alan Modra  <amodra@gmail.com>
3312
3313         * i386.cc (Output_data_plt_i386::address_for_global,
3314         address_for_local): Add plt offset to returned value.  Adjust uses.
3315         * sparc.cc (Output_data_plt_sparc::address_for_global,
3316         address_for_local): Likewise.
3317         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
3318         address_for_local): Likewise.
3319         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
3320         address_for_local): Likewise.
3321         * target.h (Target::plt_address_for_global, plt_address_for_local):
3322         Update comment.
3323         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
3324         (Output_data_got::Got_entry::write): Nor here.
3325         * output.h: Comment fix.
3326
3327 2012-10-02  Jiong Wang  <jiwang@tilera.com>
3328
3329         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
3330         global_offset_table_ value for larget got.
3331         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
3332
3333 2012-09-29  Alan Modra  <amodra@gmail.com>
3334
3335         * powerpc.cc (Target_powerpc::iplt_): New output section.
3336         (Target_powerpc::iplt_section, make_iplt_section,
3337         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
3338         (Target_powerpc::make_plt_entry): Handle ifunc syms.
3339         Target_powerpc::plt_entry_count): Count iplt entries too.
3340         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
3341         reloc section in constructor.  New params.
3342         (Target_powerpc::make_plt_section): Create reloc section here instead.
3343         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
3344         functions.
3345         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
3346         (Output_data_glink::add_entry, find_entry): New functions to
3347         deal with local syms.
3348         (Glink_sym_ent): Add support for local syms.
3349         (Output_data_glink::do_write): Handle ifunc plt entries.
3350         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3351         (Target_powerpc::Scan::local, global): Handle ifunc syms.
3352         (Target_powerpc::Relocate::relocate): Likewise.
3353         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
3354
3355 2012-09-25  Alan Modra  <amodra@gmail.com>
3356
3357         * object.h (Sized_relobj_file::adjust_local_symbol,
3358         do_adjust_local_symbol): New functions.
3359         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
3360         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
3361         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
3362         and irregular opd entry spacing.
3363         (Powerpc_relobj::do_read_relocs): Add opd size checks.
3364         (Global_symbol_visitor_opd): New functor.
3365         (Target_powerpc::do_finalize_sections): Omit global symbols defined
3366         on deleted opd entries.
3367
3368 2012-09-15  Jiong Wang  <jiwang@tilera.com>
3369
3370         * tilegx.cc: New file.
3371         * Makefile.am (TARGETSOURCES): Add tilegx.cc
3372         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
3373         * configure.tgt: Add entries for tilegx*.
3374         * configure.ac: Likewise.
3375         * Makefile.in: Rebuild.
3376         * configure: Likewise.
3377         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
3378         tilegx.
3379
3380 2012-09-13  Alan Modra  <amodra@gmail.com>
3381
3382         * target-reloc.h (scan_relocs): Call scan.local for relocs
3383         against symbols in discarded sections.  Pass is_discarded
3384         param.
3385         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
3386         Add is_discarded param.
3387         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
3388         is_discarded to flag opd entry as discarded.  Don't emit dyn
3389         relocs on such entries.
3390         (Target_powerpc::Scan::global): Similarly detect and handle
3391         such opd entries.
3392         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
3393         opd_ent_.  Update all uses.
3394         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
3395         (Target_powerpc::relocate_section): Zero out discarded opd
3396         entry relocs.
3397
3398 2012-09-12  Ian Lance Taylor  <iant@google.com>
3399
3400         PR gold/14570
3401         * output.cc: Rename Output_data_got template parameter from size
3402         to got_size for all functions.  Compile all variants of
3403         Output_data_got.
3404         (Output_data_got::Got_entry::write): Correct use of size for
3405         symbol value.  Use local_is_tls rather than casting to
3406         Sized_relobj_file.
3407         * object.h (class Object): Add local_is_tls and do_local_is_tls.
3408         (class Sized_relobj_file): Add do_local_is_tls.
3409         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
3410
3411 2012-09-11  Alan Modra  <amodra@gmail.com>
3412
3413         PR gold/14566
3414         * layout.cc (Layout::set_segment_offsets): When using
3415         common-page-size alignment, ensure we are on a new max-page-size
3416         page.
3417         * output.cc (Output_segment::set_section_addresses): Use
3418         abi_pagesize, not common_pagesize for relro boundary.
3419         (Output_segment::set_offset): Likewise.
3420
3421 2012-09-11  Alan Modra  <amodra@gmail.com>
3422
3423         * output.h (Output_data_got::add_global_tls, add_local_tls,
3424         add_local_tls_pair): New functions.
3425         (Output_data_got::add_local_pair_with_rel): Remove second
3426         reloc param.  Expand comment.
3427         (Output_data_got::Got_entry): Rename use_plt_offset_ to
3428         use_plt_or_tls_offset_, similarly for constructor param.
3429         (Output_data_got::Got_entry::write): Add got_index param.
3430         * output.cc (Output_data_got::add_global_tls, add_local_tls,
3431         add_local_tls_pair): New functions.
3432         (Output_data_got::Got_entry::write): Handle tls symbols
3433         with use_plt_or_tls_offset_ set specially.
3434         (Output_data_got::add_local_pair_with_rel): Only one reloc.
3435         (Output_data_got::do_write): Replace iterator with index, pass
3436         index to entry write function.
3437         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
3438         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
3439         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
3440         call.
3441         * i386.cc (Target_i386::Scan::local): Likewise.
3442         * sparc.cc (Target_sparc::Scan::local): Likewise.
3443         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
3444         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
3445         do_tls_offset_for_global): New functions.
3446         (Target_powerpc::Scan::local): Correct TLS relocations and got
3447         entry values.
3448         (Target_powerpc::Scan::global): Don't emit unnecessary
3449         dynamic relocations on TLS GOT entries.
3450
3451 2012-09-10  Matthias Klose  <doko@ubuntu.com>
3452
3453         * config.in: Disable sanity check for kfreebsd.
3454
3455 2012-09-10  Sterling Augustine  <saugustine@google.com>
3456
3457         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
3458         (Gdb_index::pubtypes_read): New parameter.
3459         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
3460         to calls.
3461         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
3462         pubtypes_object_.
3463
3464 2012-09-09  Alan Modra  <amodra@gmail.com>
3465
3466         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
3467         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
3468         * gc.h (gc_process_relocs): Call target gc_add_reference.
3469         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
3470         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
3471         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
3472         unnecessary cast.
3473         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
3474         to cater for when we don't need code offset.  Update use.
3475         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
3476         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
3477         set_opd_valid): New functions.
3478         (Target_powerpc::do_gc_add_reference): New function.
3479         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
3480         stashed refs.
3481         (Target_powerpc::do_gc_mark_symbol): New function.
3482
3483 2012-09-06  Cary Coutant  <ccoutant@google.com>
3484
3485         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
3486         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
3487         (Dwarf_die::skip_attributes): Likewise.
3488         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
3489         * testsuite/gdb_index_test.cc (inline_func_1): New function.
3490         (main): Call it.
3491         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
3492
3493 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
3494
3495         * testsuite/script_test_3.t: Add .got.plt output section
3496         statement.
3497         * testsuite/script_test_4.t: Likewise.
3498
3499 2012-09-05  Alan Modra  <amodra@gmail.com>
3500
3501         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
3502         update all uses and lose "enum" when using type.
3503
3504 2012-09-05  Alan Modra  <amodra@gmail.com>
3505
3506         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
3507         * configure: Regenerate.
3508         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
3509         (plugin_final_layout.stdout): Likewise.
3510         (memory_test): Set page sizes to 0x1000.
3511         * testsuite/Makefile.in: Regenerate.
3512         * testsuite/discard_locals_test.sh: Add FIXME comment.
3513         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
3514         * testsuite/pr14265.t: Add .got output section statement.
3515         * testsuite/script_test_2.t: Likewise.
3516         * testsuite/script_test_3.t: Likewise.
3517         * testsuite/script_test_4.t: Likewise.
3518         * testsuite/script_test_5.t: Likewise.
3519         * testsuite/script_test_6.t: Likewise.
3520         * testsuite/script_test_7.t: Likewise.
3521         * testsuite/script_test_9.t: Likewise.
3522
3523 2012-09-05  Alan Modra  <amodra@gmail.com>
3524
3525         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
3526         (Powerpc_relocate_functions::Status): New typedef.
3527         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3528         (Target_powerpc::Scan::local): Handle REL64.
3529         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
3530         for REL32 and REL64.
3531         (Target_powerpc::symval_for_branch): New function, extracted from..
3532         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
3533         checks.  Report overflow errors.
3534
3535 2012-09-05  Alan Modra  <amodra@gmail.com>
3536
3537         * object.h (Sized_relobj_file::emit_relocs): Delete.
3538         (Sized_relobj_file::emit_relocs_reltype): Delete.
3539         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
3540         relocate_relocs for --emit-relocs.
3541         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
3542         * output.h: Update comment.
3543         (Output_segment::first_section): New function.
3544         (Output_segment::first_section_load_address): Use first_section.
3545         * output.cc (Output_segment::first_section): New function extracted..
3546         (Output_segment::first_section_load_address): ..from here.  Delete.
3547         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
3548         * target.h (Sized_target::relocate_for_relocatable): Likewise.
3549         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
3550         adjust call to target.h function.
3551         * i386.cc (Target_i386): Likewise.
3552         * sparc.cc (Target_sparc): Likewise.
3553         * x86_64.cc (Target_x86_64): Likewise.
3554         * powerpc.cc (Target_powerpc): Likewise.
3555         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
3556         first tls section has section symbol for optimised local dynamic
3557         output relocs.
3558         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
3559         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
3560         optimised tls code.
3561         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
3562         Rename to relocate_relocs.  Update error message.
3563
3564 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
3565
3566         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
3567         --just-symbols.
3568
3569 2012-08-31  Alan Modra  <amodra@gmail.com>
3570
3571         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
3572         (Powerpc_relobj::toc_base_offset): New stub function.
3573         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
3574         got_mod_index_offset to tlsld_got_offset.  Update all refs.
3575         (Target_powerpc::Relocate::enum skip_tls): New.
3576         (Target_powerpc::call_tls_get_addr_): New var.
3577         (Target_powerpc::is_branch_reloc): Move to file scope.
3578         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
3579         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
3580         New functions.
3581         (Target_powerpc::enum Got_type): Delete old values, add new ones.
3582         (powerpc_info): Correct common_pagesize for ppc64.
3583         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
3584         (Powerpc_relocate_functions): Add overflow check enums and functions.
3585         Add non-shift version of rela, rela_ua.  Delete all rel public
3586         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
3587         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
3588         addr16_ha3, addr14 functions.
3589         (Output_data_got_powerpc::add_constant_pair): New function.
3590         (Output_data_got_powerpc::got_base_offset): Likewise.
3591         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
3592         (instruction constants): Sort, add some more.
3593         (Output_data_glink::do_write): Add and use Address typedef.  Use
3594         object->toc_base_offset() stub for 64-bit.
3595         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
3596         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3597         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
3598         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
3599         Always treat .opd relocs as against locally defined symbol.
3600         Correct condition for RELATIVE relocs.
3601         (Target_powerpc::do_finalize_sections): Test for NULL sections.
3602         (Target_powerpc::Relocate::relocate): Use plt call stub as value
3603         for 32-bit syms with a plt entry.  Correct ppc64 toc base
3604         calculations.  Handle TLS relocs, and more.  Add overflow
3605         checking and adjust for Powerpc_relocate_functions changes.
3606         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
3607         Reinstate --emit-relocs code with FIXME.
3608
3609 2012-08-30  Alan Modra  <amodra@gmail.com>
3610
3611         * layout.cc (Layout::set_segment_offsets): Set p_align to
3612         abi_pagesize, not common_pagesize.
3613         (Layout::relaxation_loop_body): Similarly use abi_pagesize
3614         to determine whether file header can go in segment.
3615
3616 2012-08-30  Alan Modra  <amodra@gmail.com>
3617
3618         * output.h (Output_reloc::Output_reloc <output section>): Add
3619         is_relative param.  Adjust calls.
3620         (Output_reloc::add_output_section_relative): New functions.
3621         * output.cc (Output_reloc::Output_reloc <output section>): Handle
3622         is_relative.
3623         (Output_reloc::symbol_value): Handle SECTION_CODE.
3624
3625 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
3626
3627         * gold.cc (queue_middle_tasks): Call layout again when unique
3628         segments for sections is desired.
3629         * layout.cc (Layout::Layout): Initialize new members.
3630         (Layout::get_output_section_flags): New function.
3631         (Layout::choose_output_section): Call get_output_section_flags.
3632         (Layout::layout): Make output section for mapping to a unique segment.
3633         (Layout::insert_section_segment_map): New function.
3634         (Layout::attach_allocated_section_to_segment): Make unique segment for
3635         output sections marked so.
3636         (Layout::segment_precedes): Check for unique segments when sorting.
3637         * layout.h (Layout::Unique_segment_info): New struct.
3638         (Layout::Section_segment_map): New typedef.
3639         (Layout::insert_section_segment_map): New function.
3640         (Layout::get_output_section_flags): New function.
3641         (Layout::is_unique_segment_for_sections_specified): New function.
3642         (Layout::set_unique_segment_for_sections_specified): New function.
3643         (Layout::unique_segment_for_sections_specified_): New member.
3644         (Layout::section_segment_map_): New member.
3645         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
3646         Rename is_gc_pass_one to is_pass_one.
3647         Rename is_gc_pass_two to is_pass_two.
3648         Rename is_gc_or_icf to is_two_pass.
3649         Check for which pass based on whether symbols data is present.
3650         Make it two pass when unique segments for sections is desired.
3651         * output.cc (Output_section::Output_section): Initialize new
3652         members.
3653         * output.h (Output_section::is_unique_segment): New function.
3654         (Output_section::set_is_unique_segment): New function.
3655         (Output_section::is_unique_segment_): New member.
3656         (Output_section::extra_segment_flags): New function.
3657         (Output_section::set_extra_segment_flags): New function.
3658         (Output_section::extra_segment_flags_): New member.
3659         (Output_section::segment_alignment): New function.
3660         (Output_section::set_segment_alignment): New function.
3661         (Output_section::segment_alignment_): New member.
3662         (Output_segment::Output_segment): Initialize is_unique_segment_.
3663         (Output_segment::is_unique_segment): New function.
3664         (Output_segment::set_is_unique_segment): New function.
3665         (Output_segment::is_unique_segment_): New member.
3666         * plugin.cc (allow_unique_segment_for_sections): New function.
3667         (unique_segment_for_sections): New function.
3668         (Plugin::load): Add new functions to transfer vector.
3669         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
3670         * Makefile.in: Regenerate.
3671         * testsuite/plugin_final_layout.sh: Check if unique segment
3672         functionality works.
3673         * testsuite/plugin_section_order.c (onload): Check if new interfaces
3674         are available.
3675         (allow_unique_segment_for_sections): New global.
3676         (unique_segment_for_sections): New global.
3677         (claim_file_hook): Call allow_unique_segment_for_sections.
3678         (all_symbols_read_hook): Call unique_segment_for_sections.
3679
3680 2012-08-22  Cary Coutant  <ccoutant@google.com>
3681
3682         * layout.cc (Layout::include_section): Don't assert on GROUP
3683         sections with --emit-relocs.
3684
3685 2012-08-21  Cary Coutant  <ccoutant@google.com>
3686
3687         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
3688         if --export-dynamic-symbol names an undef symbol.
3689
3690 2012-08-18  Alan Modra  <amodra@gmail.com>
3691
3692         * powerpc.cc: Formatting and white space.
3693         (Powerpc_relobj): Rename got2_section_ to special_.
3694         Add opd_ent_shndx_ and opd_ent_off_ vectors.
3695         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
3696         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
3697         (Target_powerpc): Add Address typedef and invalid_address.  Use
3698         throughout.
3699         (Target_powerpc::is_branch_reloc): New function.
3700         (Powerpc_relocate_functions): Add Address typedef, use throughout.
3701         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
3702         for dst_mask, value and addend.
3703         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
3704         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
3705         (Output_data_glink::do_write): Correct toc base.  Don't try to use
3706         uint16_t for 24-bit offset.  Use get_output_section_offset and
3707         check return.
3708         (Target_powerpc::Scan::local): Handle more relocs.
3709         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
3710         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
3711         Plug in toc restoring insn after plt calls.  Translate branches
3712         to function descriptor symbols to corresponding entry point.
3713         (Target_powerpc::relocate_for_relocatable): Check return from
3714         get_output_section_offset.
3715         * symtab.h: Comment typo.
3716
3717 2012-08-14  Ian Lance Taylor  <iant@google.com>
3718
3719         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
3720         unsupported_relocal_local to call unsupported_reloc_global.
3721
3722 2012-08-14  Nick Clifton  <nickc@redhat.com>
3723
3724         PR ld/14265
3725         * script-sections.cc (Sections_element::output_section_name): Add
3726         keep return parameter.
3727         (Output_section_element::match_name): Add keep return parameter.
3728         Return the value of the keep_ member.
3729         * script-sections.h (class Output_section): Update
3730         output_section_name prototype.
3731         * layout.cc (Layout::keep_input_section): New public member
3732         function.
3733         (Layout::choose_output_section): Pass keep parameter to
3734         output_section_name.
3735         * layout.h (class Layout): Add keep_input_section.
3736         * object.cc (Sized_relobj_file::do_layout): Check for kept input
3737         sections.
3738         * testsuite/Makefile.am: Add a test.
3739         * testsuite/Makefile.in: Regenerate.
3740         * testsuite/pr14265.c: Source file for the test.
3741         * testsuite/pr14265.t: Linker script for the test.
3742         * testsuite/pr14265.sh: Shell script for the test.
3743
3744 2012-08-14  Alan Modra  <amodra@gmail.com>
3745
3746         * target.h (Target::output_section_name): New function.
3747         (Target::do_output_section_name): New function.
3748         * layout.cc (Layout::choose_output_section): Call the above.
3749         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
3750
3751 2012-08-14  Alan Modra  <amodra@gmail.com>
3752
3753         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
3754         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
3755         for replace_constant call.
3756         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
3757         (Output_data_glink::do_print_to_mapfile): New function.
3758         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
3759         (Target_powerpc::Relocate::relocate): Likewise.
3760
3761 2012-08-14  Alan Modra  <amodra@gmail.com>
3762
3763         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
3764         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
3765         (Output_data_glink::add_entry,find_entry): Remove shndx param.
3766         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
3767         all references to shndx_.  Handle special case for R_PPC_PLTREL24
3768         here.
3769         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
3770         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
3771         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
3772         here.
3773         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
3774         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
3775
3776 2012-08-12  Alan Modra  <amodra@gmail.com>
3777
3778         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
3779         (glink insn constants): Use uint32_t.
3780         (Output_data_glink::add_entry): Use insert, not [] operator.
3781
3782 2012-08-11  Alan Modra  <amodra@gmail.com>
3783
3784         * object.h (Sized_relobj_file::find_shdr): New function.
3785         (Sized_relobj_file::find_special_sections): New function.
3786         * object.cc (Sized_relobj_file::find_shdr): New function.
3787         (Sized_relobj_file::find_eh_frame): Use find_shdr.
3788         (Sized_relobj_file::find_special_sections): New function, split out..
3789         (Sized_relobj_file::do_read_symbols): ..from here.
3790         * output.h (Output_data_got::replace_constant): New function.
3791         (Output_data_got::num_entries): New function.
3792         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
3793         (Output_data_got::got_offset): Protected rather than private.
3794         (Output_data_got::replace_got_entry): New function.
3795         * output.cc (Output_data_got::replace_got_entry): New function.
3796         * powerpc.cc (class Powerpc_relobj): New.
3797         (class Powerpc_relocate_functions): Delete all psymval variants or
3798         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
3799         Implement _ha functions using corresponding _hi function.
3800         (Powerpc_relobj::find_special_sections): New function.
3801         (Target_powerpc::do_make_elf_object): New function.
3802         (class Output_data_got_powerpc): New.
3803         (class Output_data_glink): New.
3804         (class Powerpc_scan_relocatable_reloc): New.
3805         Many more changes througout file.
3806
3807 2012-08-09  Nick Clifton  <nickc@redhat.com>
3808
3809         * po/vi.po: Updated Vietnamese translation.
3810
3811 2012-08-07  Ian Lance Taylor  <iant@google.com>
3812
3813         * layout.cc (Layout::add_target_dynamic_tags): If
3814         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
3815         plt_rel.
3816
3817 2012-07-30  Nick Clifton  <nickc@redhat.com>
3818
3819         * po/gold.pot: Updated template.
3820         * po/es.po: Updated Spanish translation.
3821
3822 2012-07-18  Cary Coutant  <ccoutant@google.com>
3823
3824         PR gold/14344
3825         * configure.ac: Add check for -gpubnames support.
3826         * configure: Regenerate.
3827         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
3828         support; force -gno-pubnames.
3829         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
3830         support.
3831         (gdb_index_test_4): New test.
3832         * testsuite/Makefile.in: Regenerate.
3833         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
3834         * testsuite/gdb_index_test_2.sh: Likewise.
3835         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
3836         * testsuite/gdb_index_test_4.sh: New script.
3837         * testsuite/gdb_index_test_comm.sh: New script with common code;
3838         don't look for space after colon.
3839
3840 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
3841
3842         * gold.cc (queue_middle_tasks): Update function order only after
3843         deferred objects due to plugins are processed.
3844
3845 2012-07-11  Ian Lance Taylor  <iant@google.com>
3846
3847         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
3848         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
3849         (Target_arm::scan_reloc_for_stub): Likewise.
3850         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
3851         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
3852         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
3853         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
3854         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
3855
3856 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
3857             Ian Lance Taylor  <iant@google.com>
3858
3859         PR gold/14309
3860         * configure.ac: Test whether std::tr1::hash<off_t> works.
3861         * gold.h: Add a specialization for std::tr1::hash<off_t> if
3862         needed.
3863         * output.h (class Output_fill): Add virtual destructor.
3864         * configure, config.in: Rebuild.
3865
3866 2012-06-22  Roland McGrath  <mcgrathr@google.com>
3867
3868         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
3869
3870 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
3871
3872         * plugin.cc (Plugin::load): Handle position independent executables.
3873
3874 2012-06-06  Cary Coutant  <ccoutant@google.com>
3875
3876         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
3877         add .debug_macro.
3878         (lines_only_debug_sections): Likewise.
3879         (gdb_fast_lookup_sections): New static array.
3880         (is_gdb_debug_section): Rename formal parameter.
3881         (is_lines_only_debug_section): Likewise.
3882         (is_gdb_fast_lookup_section): New function.
3883         (Layout::include_section): Check for ".zdebug_" prefix; pass
3884         section name suffix to is_gdb_debug_section, et al.; check for
3885         fast-lookup sections when building .gdb_index.
3886         * options.h (--strip-debug-gdb): Update GDB version number.
3887
3888 2012-06-06  Cary Coutant  <ccoutant@google.com>
3889
3890         * configure.ac: Add check for fallocate.
3891         * configure: Regenerate.
3892         * config.in: Regenerate.
3893
3894         * options.h (class General_options): Add --mmap-output-file and
3895         --posix-fallocate options.
3896         * output.cc: (posix_fallocate): Remove; replace with...
3897         (gold_fallocate): New function.
3898         (Output_file::map_no_anonymous): Call gold_fallocate.
3899         (Output_file::map): Check --mmap-output-file option.
3900
3901 2012-06-05  Jing Yu  <jingyu@google.com>
3902
3903         * gold.h (textdomain): Add do {} to empty while(0).
3904         (bindtextdomain): Likewise.
3905
3906 2012-06-04  Cary Coutant  <ccoutant@google.com>
3907
3908         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
3909         has_dynsym_index.
3910
3911 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
3912
3913         * symtab.cc (Symbol_table::define_special_symbol):
3914         Initialize *poldsym to prevent uninitialized variable errors.
3915
3916 2012-05-23  Cary Coutant  <ccoutant@google.com>
3917
3918         * layout.cc (Layout::section_name_mapping): Add rules to handle
3919         exact match on .data.rel.ro.local or .data.rel.ro.
3920         (Layout::output_section_name): Check for exact matches.
3921
3922 2012-05-23  Cary Coutant  <ccoutant@google.com>
3923
3924         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
3925         more carefully.
3926
3927 2012-05-22  Cary Coutant  <ccoutant@google.com>
3928
3929         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
3930         object before exporting symbol.
3931
3932 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
3933
3934         * testsuite/tls_test.cc: Include "config.h" first.
3935         * testsuite/tls_test_c.c: Likewise.
3936
3937 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
3938             Nick Clifton  <nickc@redhat.com>
3939
3940         PR 14072
3941         * configure.in: Add check that sysdep.h has been included before
3942         any system header files.
3943         * configure: Regenerate.
3944         * config.in: Regenerate.
3945
3946 2012-05-14  Cary Coutant  <ccoutant@google.com>
3947
3948         * layout.cc (Layout::make_output_section): Mark .tdata section
3949         as RELRO.
3950         * testsuite/relro_test.cc: Add a TLS variable.
3951
3952 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
3953
3954         PR gold/14091
3955         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3956         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3957         R_X86_64_64.
3958
3959 2012-05-08  Cary Coutant  <ccoutant@google.com>
3960
3961         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3962         (lines_only_debug_sections): Likewise.
3963
3964 2012-05-02  Roland McGrath  <mcgrathr@google.com>
3965
3966         * nacl.cc: New file.
3967         * nacl.h: New file.
3968         * Makefile.am (CCFILES, HFILES): Add them.
3969         * Makefile.in: Regenerate.
3970         * i386.cc (Output_data_plt_i386_nacl): New class.
3971         (Output_data_plt_i386_nacl_exec): New class.
3972         (Output_data_plt_i386_nacl_dyn): New class.
3973         (Target_i386_nacl): New class.
3974         (Target_selector_i386_nacl): New class.
3975         (target_selector_i386): Use it instead of Target_selector_i386.
3976         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3977         (Target_x86_64_nacl): New class.
3978         (Target_selector_x86_64_nacl): New class.
3979         (target_selector_x86_64, target_selector_x32): Use it instead of
3980         Target_selector_x86_64.
3981         * arm.cc (Output_data_plt_arm_nacl): New class.
3982         (Target_arm_nacl): New class.
3983         (Target_selector_arm_nacl): New class.
3984         (target_selector_arm, target_selector_armbe): Use it instead of
3985         Target_selector_arm.
3986
3987         * target-select.cc (select_target): Take new Input_file* and off_t
3988         arguments, pass them on to recognize method of selector.
3989         * object.cc (make_elf_sized_object): Update caller.
3990         * parameters.cc (parameters_force_valid_target): Likewise.
3991         * incremental.cc (make_sized_incremental_binary): Likewise.
3992         * target-select.h: Update decl.
3993         (Target_selector::recognize): Take new Input_file* argument,
3994         pass it on to do_recognize.
3995         (Target_selector::do_recognize): Take new Input_file* argument.
3996         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3997         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3998         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3999         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
4000
4001         * target.h (Target::Target_info): New members isolate_execinstr
4002         and rosegment_gap.
4003         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
4004         * arm.cc (Target_arm::arm_info): Update initializer.
4005         * i386.cc (Target_i386::i386_info): Likewise.
4006         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
4007         * sparc.cc (Target_sparc::sparc_info): Likewise.
4008         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4009         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
4010         * layout.cc (Layout::attach_allocated_section_to_segment):
4011         Take new const Target* argument.  If target->isolate_execinstr(), act
4012         like --rosegment.
4013         (Layout::find_first_load_seg): Take new const Target* argument;
4014         if target->isolate_execinstr(), reject PF_X segments.
4015         (Layout::relaxation_loop_body): Update caller.
4016         (Layout::set_segment_offsets): If target->isolate_execinstr(),
4017         reset file offset to zero when we hit LOAD_SEG, and then do a second
4018         loop over the segments before LOAD_SEG to reassign offsets after
4019         addresses have been determined.  Handle target->rosegment_gap().
4020         (Layout::attach_section_to_segment): Take new const Target* argument;
4021         pass it to attach_allocated_section_to_segment.
4022         (Layout::make_output_section): Update caller.
4023         (Layout::attach_sections_to_segments): Take new const Target* argument;
4024         pass it to attach_section_to_segment.
4025         * gold.cc (queue_middle_tasks): Update caller.
4026         * layout.h (Layout): Update method decls with new arguments.
4027
4028         * arm.cc (Target_arm::Target_arm): Take optional argument for the
4029         Target_info pointer to use.
4030         (Target_arm::do_make_data_plt): New virtual method.
4031         (Target_arm::make_data_plt): New method that calls it.
4032         (Target_arm::make_plt_entry): Use it.
4033         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
4034         for the section alignment.
4035         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
4036         method.
4037         (Output_data_plt_arm::first_plt_entry_offset): Call it.
4038         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
4039         method.
4040         (Output_data_plt_arm::get_plt_entry_size): Call it.
4041         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
4042         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
4043         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
4044         method.
4045         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
4046         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
4047         method instead of sizeof(plt_entry).
4048         (Output_data_plt_arm::add_entry): Likewise.
4049         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
4050         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
4051         than static method.
4052         (Target_arm::plt_entry_size): Likewise.
4053         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
4054         Move to ...
4055         (Output_data_plt_arm_standard): ... here, new class.
4056         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
4057         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
4058         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
4059
4060         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4061         Take additional argument for the PLT entry size.
4062         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
4063         Use get_plt_entry_size method rather than plt_entry_size variable.
4064         (Output_data_plt_x86_64::reserve_slot): Likewise.
4065         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
4066         (Output_data_plt_x86_64::add_entry): Likewise.
4067         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
4068         (Output_data_plt_x86_64::address_for_global): Likewise.
4069         (Output_data_plt_x86_64::address_for_local): Likewise.
4070         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4071         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
4072         Make method non-static.
4073         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
4074         method.
4075         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
4076         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
4077         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
4078         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
4079         virtual method.
4080         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
4081         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
4082         virtual method.
4083         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
4084         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
4085         virtual method.
4086         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
4087         (Output_data_plt_x86_64::plt_entry_size)
4088         (Output_data_plt_x86_64::first_plt_entry)
4089         (Output_data_plt_x86_64::plt_entry)
4090         (Output_data_plt_x86_64::tlsdesc_plt_entry)
4091         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
4092         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
4093         (Output_data_plt_x86_64_standard): ... here, new class.
4094         (Target_x86_64::Target_x86_64): Take optional argument for the
4095         Target_info pointer to use.
4096         (Target_x86_64::do_make_data_plt): New virtual method.
4097         (Target_x86_64::make_data_plt): New method to call it.
4098         (Target_x86_64::init_got_plt_for_update): Use that.
4099         Call this->plt_->add_eh_frame method here.
4100         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
4101         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
4102         rather than static method.
4103         (Target_x86_64::plt_entry_size): Likewise.
4104         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
4105         rather than plt_entry_size variable.  Move guts of PLT filling to...
4106         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
4107         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
4108         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
4109
4110         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
4111         additional argument for the section alignment.
4112         Don't do add_eh_frame_for_plt here.
4113         (Output_data_plt_i386::first_plt_entry_offset): Make the method
4114         non-static.  Use get_plt_entry_size method rather than plt_entry_size
4115         variable.
4116         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
4117         method.
4118         (Output_data_plt_i386::get_plt_entry_size): Call it.
4119         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
4120         (Output_data_plt_i386::add_eh_frame): New method to call it.
4121         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
4122         method.
4123         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
4124         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
4125         method.
4126         (Output_data_plt_i386::fill_plt_entry): New method to call it.
4127         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
4128         method instead of plt_entry_size.
4129         (Output_data_plt_i386::plt_entry_size)
4130         (Output_data_plt_i386::plt_eh_frame_fde_size)
4131         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
4132         (Output_data_plt_i386_standard): ... here, new class.
4133         (Output_data_plt_i386_exec): New class.
4134         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
4135         (Output_data_plt_i386_exec::first_plt_entry): ... here.
4136         (Output_data_plt_i386::exec_plt_entry): Move to ...
4137         (Output_data_plt_i386_exec::plt_entry): ... here.
4138         (Output_data_plt_i386_dyn): New class.
4139         (Output_data_plt_i386::first_plt_entry): Move to ...
4140         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
4141         (Output_data_plt_i386::dyn_plt_entry): Move to ...
4142         (Output_data_plt_i386_dyn::plt_entry): ... here.
4143         (Target_i386::Target_i386): Take optional argument for the Target_info
4144         pointer to use.
4145         (Target_i386::do_make_data_plt): New virtual method.
4146         (Target_i386::make_data_plt): New method to call it.
4147         (Target_i386::make_plt_section): Use that.
4148         Call this->plt_->add_eh_frame method here.
4149         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
4150         rather than plt_entry_size variable.
4151         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
4152         (Output_data_plt_i386::address_for_local): Likewise.
4153         (Output_data_plt_i386::do_write): Likewise.
4154         Move guts of PLT filling to...
4155         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
4156         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
4157         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
4158         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
4159
4160 2012-05-01  Cary Coutant  <ccoutant@google.com>
4161
4162         * dwarf_reader.cc (Dwarf_die::read_attributes)
4163         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
4164         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
4165         * reduced_debug_output.cc
4166         (Output_reduced_debug_info_section::get_die_end): Remove
4167         DW_FORM_GNU_ref_index.  Add default case.
4168
4169 2012-04-26  Mark Wielaard  <mjw@redhat.com>
4170
4171         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
4172         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
4173         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
4174         DW_AT_high_pc as offset from DW_AT_low_pc.
4175
4176         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
4177         * testsuite/Makefile.in: Regenerate.
4178         * testsuite/gdb_index_test_3.c: New test source file.
4179         * testsuite/gdb_index_test_3.sh: New test source file.
4180
4181 2012-04-25  Ian Lance Taylor  <iant@google.com>
4182
4183         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
4184         pointer.
4185         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
4186         as a class, not a struct.
4187         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
4188         (Target_arm::apply_cortex_a8_workaround): Likewise.
4189         * gc.h: Declare Reloc_types as a struct, not a class.
4190         * object.h: Declare Symbols_data as a struct.
4191         * reloc.h: Declare Read_relocs_data as a struct.
4192         * target.h: Declare Relocate_info as a struct.
4193
4194 2012-04-24  David S. Miller  <davem@davemloft.net>
4195
4196         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
4197         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
4198         and R_SPARC_WPLT30.
4199
4200 2012-04-24  Cary Coutant  <ccoutant@google.com>
4201
4202         * incremental-dump.cc (find_input_containing_global): Replace
4203         magic number with symbolic constant.
4204         (dump_incremental_inputs): Update version number.
4205         * incremental.cc (Output_section_incremental_inputs): Update version
4206         number; import symbolic constants from Incremental_inputs_reader.
4207         (Incremental_inputs::create_data_sections): Align relocations
4208         section correctly for 64-bit targets.
4209         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
4210         constants; add padding.
4211         (Output_section_incremental_inputs::write_header): Add assert for
4212         header_size.
4213         (Output_section_incremental_inputs::write_input_files): Add assert
4214         for input_entry_size.
4215         (Output_section_incremental_inputs::write_info_blocks): Add padding;
4216         add assert for object_info_size, input_section_entry_size,
4217         global_sym_entry_size.
4218         * incremental.h (Incremental_inputs_reader): Add symbolic constants
4219         for data structure sizes; use them.
4220         (Incremental_input_entry_reader): Import symbolic constants from
4221         Incremental_inputs_reader; use them.
4222
4223 2012-04-23  David S. Miller  <davem@davemloft.net>
4224
4225         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
4226         and elf_flags_set_.
4227         (Target_sparc::Target_sparc): Initialize new fields.
4228         (Target_sparc::do_make_elf_object): New function.
4229         (Target_sparc::do_adjust_elf_header): New function.
4230
4231 2012-04-23  Cary Coutant  <ccoutant@google.com>
4232
4233         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
4234         CU range table of gdb index.
4235
4236 2012-04-20  David S. Miller  <davem@davemloft.net>
4237
4238         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
4239         instead of false.
4240
4241 2012-04-16  David S. Miller  <davem@davemloft.net>
4242
4243         * sparc.cc (Target_sparc::got_address): New function.
4244         (Sparc_relocate_functions::gdop_hix22): New function.
4245         (Sparc_relocate_functions::gdop_lox10): New function.
4246         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
4247         relocs.
4248         (Target_sparc::Scan::local): Likewise if the global symbol is not
4249         preemptible and is not IFUNC.
4250         (Target_sparc::Relocate::relocate): Perform GOTDATA code
4251         transformations for local and non-preemptible non-IFUNC global
4252         symbols.
4253
4254         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
4255         writing out 64-bit part of ranges.
4256
4257         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
4258         -fpic and -fpie respectively.
4259         * Makefile.in: Regenerate.
4260
4261         * sparc.cc (class Target_sparc): Add rela_ifunc_.
4262         (Target_sparc::Target_sparc): Initialize new field.
4263         (Target_sparc::do_plt_section_for_global): New function.
4264         (Target_sparc::do_plt_section_for_local): New function.
4265         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
4266         (Target_sparc::make_plt_section): New function, broken out of
4267         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
4268         (Target_sparc::make_plt_entry): Call make_plt_section.
4269         (Target_sparc::make_local_ifunc_plt_entry): New function.
4270         (Target_sparc::rela_ifunc_section): New function.
4271         (Target_sparc::plt_section): Remove const.
4272         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
4273         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
4274         and ifunc_count_ fields.
4275         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
4276         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
4277         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
4278         (Output_data_plt_sparc::rela_ifunc): New function.
4279         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
4280         (Output_data_plt_sparc::has_ifunc_section): New function.
4281         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
4282         (Output_data_plt_sparc::address_for_global): New function.
4283         (Output_data_plt_sparc::address_for_local): New function.
4284         (Output_data_plt_sparc::plt_index_to_offset): New function.
4285         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
4286         and entry_count.
4287         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
4288         entry_count.
4289         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
4290         R_SPARC_JMP_IREL to switch.
4291         (Target_sparc::Scan::check_non_pic): Likewise.
4292         (Target_sparc::Scan::local): Handle IFUNC symbols.
4293         (Target_sparc::Scan::local): Likewise.
4294         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
4295         and plt_address_for_local.
4296         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
4297         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
4298
4299         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
4300         (class Output_data_reloc): Adjust calls to Output_reloc_type.
4301         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
4302         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
4303         global relocs too.
4304         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
4305         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
4306         calls.
4307         * sparc.cc (Target_sparc::Scan::global): Likewise.
4308         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4309
4310 2012-04-16  Cary Coutant  <ccoutant@google.com>
4311
4312         * archive.cc (Library_base::should_include_member): Check for
4313         --export-dynamic-symbol.
4314         * options.h (class General_options): Add --export-dynamic-symbol.
4315         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
4316         --export-dynamic-symbol.
4317         (Symbol_table::gc_mark_undef_symbols): Likewise.
4318         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
4319
4320 2012-04-12  David S. Miller  <davem@davemloft.net>
4321
4322         * sparc.cc (Reloc::wdisp10): New relocation method.
4323         (Reloc::h34): Likewise.
4324         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
4325         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
4326         R_SPARC_WDISP10.
4327         (Target_sparc::Scan::local): Likewise.
4328         (Target_sparc::Scan::global): Likewise.
4329         (Target_sparc::Relocate::relocate): Likewise.
4330
4331 2012-04-09  Cary Coutant  <ccoutant@google.com>
4332
4333         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
4334         low_pc == 0.
4335
4336 2012-04-06  Ian Lance Taylor  <iant@google.com>
4337
4338         * timer.cc: #include <unistd.h>.
4339
4340 2012-04-06  Roland McGrath  <mcgrathr@google.com>
4341
4342         * configure.in (AC_CHECK_HEADERS): Add locale.h.
4343         * config.in: Regenerate.
4344         * configure: Regenerate.
4345
4346 2012-04-05  Nick Clifton  <nickc@redhat.com>
4347
4348         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
4349         (AM_LC_MESSAGES): Add.
4350         * aclocal.m4: Regenerate.
4351         * config.in: Regenerate.
4352         * configure: Regenerate.
4353
4354 2012-03-21  Cary Coutant  <ccoutant@google.com>
4355
4356         * Makefile.am: Add gdb-index.cc, gdb-index.h.
4357         * Makefile.in: Regenerate.
4358         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
4359         (Sized_elf_reloc_mapper::symbol_section): New function.
4360         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
4361         (make_elf_reloc_mapper): New function.
4362         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
4363         (Dwarf_abbrev_table::do_read_abbrevs): New function.
4364         (Dwarf_abbrev_table::do_get_abbrev): New function.
4365         (Dwarf_ranges_table::read_ranges_table): New function.
4366         (Dwarf_ranges_table::read_range_list): New function.
4367         (Dwarf_pubnames_table::read_section): New function.
4368         (Dwarf_pubnames_table::read_header): New function.
4369         (Dwarf_pubnames_table::next_name): New function.
4370         (Dwarf_die::Dwarf_die): New function.
4371         (Dwarf_die::read_attributes): New function.
4372         (Dwarf_die::skip_attributes): New function.
4373         (Dwarf_die::set_name): New function.
4374         (Dwarf_die::set_linkage_name): New function.
4375         (Dwarf_die::attribute): New function.
4376         (Dwarf_die::string_attribute): New function.
4377         (Dwarf_die::int_attribute): New function.
4378         (Dwarf_die::uint_attribute): New function.
4379         (Dwarf_die::ref_attribute): New function.
4380         (Dwarf_die::child_offset): New function.
4381         (Dwarf_die::sibling_offset): New function.
4382         (Dwarf_info_reader::check_buffer): New function.
4383         (Dwarf_info_reader::parse): New function.
4384         (Dwarf_info_reader::do_parse): New function.
4385         (Dwarf_info_reader::do_read_string_table): New function.
4386         (Dwarf_info_reader::lookup_reloc): New function.
4387         (Dwarf_info_reader::get_string): New function.
4388         (Dwarf_info_reader::visit_compilation_unit): New function.
4389         (Dwarf_info_reader::visit_type_unit): New function.
4390         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
4391         Sized_elf_reloc_mapper.
4392         (Sized_dwarf_line_info::symbol_section): Remove function.
4393         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
4394         (Sized_dwarf_line_info::read_line_mappings): Remove object
4395         parameter, adjust callers.
4396         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
4397         * dwarf_reader.h: Include <sys/types.h>.
4398         (class Track_relocs): Remove forward declaration.
4399         (class Elf_reloc_mapper): New class.
4400         (class Sized_elf_reloc_mapper): New class.
4401         (class Dwarf_abbrev_table): New class.
4402         (class Dwarf_range_list): New class.
4403         (class Dwarf_ranges_table): New class.
4404         (class Dwarf_pubnames_table): New class.
4405         (class Dwarf_die): New class.
4406         (class Dwarf_info_reader): New class.
4407         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
4408         (Sized_dwarf_line_info::symbol_section): Remove member function.
4409         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
4410         base class.
4411         * gdb-index.cc: New source file.
4412         * gdb-index.h: New source file.
4413         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
4414         and .debug_types sections, call Layout::add_to_gdb_index.
4415         (Sized_relobj_incr::do_section_name): Implement.
4416         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
4417         return type; Implement.
4418         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
4419         return type.
4420         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
4421         parameter list and return type.
4422         (Sized_incr_dynobj::do_section_contents): Likewise.
4423         * layout.cc: Include gdb-index.h.
4424         (Layout::Layout): Initialize gdb_index_data_.
4425         (Layout::init_fixed_output_section): Check for .gdb_index section.
4426         (Layout::add_to_gdb_index): New function. Instantiate.
4427         * layout.h: Add forward declaration for class Gdb_index.
4428         (Layout::add_to_gdb_index): New member function.
4429         (Layout::gdb_index_data_): New data member.
4430         * main.cc: Include gdb-index.h.
4431         (main): Print statistics for gdb index.
4432         * object.cc (Object::section_contents): Move code into
4433         do_section_contents.
4434         (need_decompressed_section): Check for sections needed when building
4435         gdb index.
4436         (build_compressed_section_map): Likewise.
4437         (Sized_relobj_file::do_read_symbols): Need local symbols when building
4438         gdb index.
4439         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
4440         sections; call Layout::add_to_gdb_index.
4441         (Sized_relobj_file::do_decompressed_section_contents): Call
4442         do_section_contents directly.
4443         * object.h (Object::do_section_contents): Adjust parameter list and
4444         return type.
4445         (Object::do_decompressed_section_contents): Call do_section_contents
4446         directly.
4447         (Sized_relobj_file::do_section_contents): Adjust parameter list and
4448         return type.
4449         * options.h (class General_options): Add --gdb-index option.
4450         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
4451         list and return type.
4452         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
4453         * reloc.h (Track_relocs::checkpoint): New function.
4454         (Track_relocs::reset): New function.
4455
4456         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
4457         New test cases.
4458         * testsuite/Makefile.in: Regenerate.
4459         * testsuite/gdb_index_test.cc: New test source file.
4460         * testsuite/gdb_index_test_1.sh: New test source file.
4461         * testsuite/gdb_index_test_2.sh: New test source file.
4462
4463 2012-03-19  Doug Kwan  <dougkwan@google.com>
4464
4465         * arm.cc (Target_arm::do_define_standard_symbols): New method.
4466         (Target_arm::do_finalize_sections): Remove code which defines
4467         __exidx_start and __exidx_end.  Make symbol table parameter
4468         anonymous as it is not used.
4469         * gold.cc (queue_middle_tasks): Call target hook to define any
4470         target-specific symbols.
4471         * target.h (Target::define_standard_symbols): New method.
4472         (Target::do_define_standard_symbols): Same.
4473         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
4474         * testsuite/Makefile.in: Regenerate.
4475         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
4476         and __exidx_end.
4477         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
4478         relocations are generated for __exidx_start and __exidx_end.
4479
4480 2012-03-16  Doug Kwan  <dougkwan@google.com>
4481
4482         * testsuite/Makefile.am: Disable test initpri3b.
4483         * testsuite/Makefile.in: Regenerate.
4484
4485 2012-03-15  Doug Kwan  <dougkwan@google.com>
4486
4487         * arm.cc (Target_arm::got_section): Make .got section read-only
4488         if -z now is given.
4489
4490 2012-03-15  Ian Lance Taylor  <iant@google.com>
4491
4492         PR gold/13850
4493         * layout.cc (Layout::make_output_section): Correctly mark
4494         SHT_INIT_ARRAY, et. al., as relro.
4495
4496 2012-03-14  Doug Kwan  <dougkwan@google.com>
4497
4498         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
4499         dynamic relocations for protected symbols in shared objects.
4500
4501 2012-03-13  Ian Lance Taylor  <iant@google.com>
4502
4503         * resolve.cc (Symbol_table::resolve): When merging common symbols,
4504         keep the larger alignment.
4505
4506 2012-03-12  Cary Coutant  <ccoutant@google.com>
4507
4508         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
4509         handling of DW_LNE_define_file.
4510
4511 2012-03-12  Cary Coutant  <ccoutant@google.com>
4512
4513         * reduced_debug_output.cc
4514         (Output_reduced_debug_info_section::get_die_end): Add new FORM
4515         codes to switch.
4516
4517 2012-02-29  Cary Coutant  <ccoutant@google.com>
4518
4519         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
4520
4521 2012-02-29  Cary Coutant  <ccoutant@google.com>
4522
4523         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4524         Call Object::decompressed_section_contents.
4525         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
4526         New dtor.
4527         (Sized_dwarf_line_info::buffer_start_): New data member.
4528         * merge.cc (Output_merge_data::do_add_input_section): Call
4529         Object::decompressed_section_contents.
4530         (Output_merge_string::do_add_input_section): Likewise.
4531         * object.cc (need_decompressed_section): New function.
4532         (build_compressed_section_map): Decompress sections needed later.
4533         (Sized_relobj_file::do_decompressed_section_contents): New function.
4534         (Sized_relobj_file::do_discard_decompressed_sections): New function.
4535         * object.h (Object::decompressed_section_contents): New function.
4536         (Object::discard_decompressed_sections): New function.
4537         (Object::do_decompressed_section_contents): New function.
4538         (Object::do_discard_decompressed_sections): New function.
4539         (Compressed_section_info): New type.
4540         (Compressed_section_map): Include decompressed section contents.
4541         (Sized_relobj_file::do_decompressed_section_contents): New function.
4542         (Sized_relobj_file::do_discard_decompressed_sections): New function.
4543
4544 2012-02-16  Cary Coutant  <ccoutant@google.com>
4545
4546         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
4547         * testsuite/Makefile.in: Regenerate.
4548
4549 2012-02-14  Cary Coutant  <ccoutant@google.com>
4550
4551         * options.cc (General_options::finalize): Disallow -pie and -static.
4552
4553 2012-02-03  Doug Kwan  <dougkwan@google.com>
4554
4555         * arm.cc (Arm_relocate_functions::abs8,
4556         Arm_relocate_functions::abs16): Use
4557         Bits::has_signed_unsigned_overflow32.
4558         (Arm_relocate_functions::thm_abs8): Correct range of
4559         overflow check.
4560         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
4561         in assertions.
4562
4563 2012-02-02  Doug Kwan  <dougkwan@google.com>
4564
4565         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
4566         position independent outputs, not just shared objects.
4567
4568 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
4569
4570         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
4571         * configure: Regenerated.
4572
4573 2012-01-27  Ian Lance Taylor  <iant@google.com>
4574
4575         * reloc.h (Bits): New class with static functions, copied from
4576         namespace utils in arm.cc.
4577         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
4578         instead.
4579
4580 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4581
4582         * incremental.cc (write_info_blocks): Correct relocation offset.
4583
4584 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4585
4586         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
4587         (Relocate::tls_gd_to_le): Likewise.
4588
4589 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4590
4591         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
4592
4593 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4594
4595         * configure.ac: Check if -mcmodel=medium works.
4596         * configure: Regenerated.
4597
4598 2012-01-24  Cary Coutant  <ccoutant@google.com>
4599
4600         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
4601         definition and ...
4602         (read_unsigned_LEB_128_x): ... this new function.
4603         (read_signed_LEB_128): Replaced with inline definition and ...
4604         (read_signed_LEB_128_x): ... this new function.
4605         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
4606         (read_unsigned_LEB_128): Add inline definition.
4607         (read_signed_LEB_128_x): New function.
4608         (read_signed_LEB_128): Add inline definition.
4609         * testsuite/Makefile.am (leb128_unittest): New unit test.
4610         * testsuite/Makefile.in: Regenerate.
4611         * testsuite/leb128_unittest.cc: New unit test.
4612
4613 2012-01-23  Ian Lance Taylor  <iant@google.com>
4614
4615         PR gold/13617
4616         * i386.cc (Target_i386::do_code_fill): When using a jmp
4617         instruction, pad with nop instructions.
4618         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4619
4620 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
4621
4622         * x86_64.cc (gc_process_relocs): Add typename on types used in
4623         template.
4624         (scan_relocs): Likewise.
4625         (relocate_section): Likewise.
4626         (apply_relocation): Likewise.
4627
4628 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
4629
4630         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
4631         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
4632         under x32.
4633
4634 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
4635
4636         * x86_64.cc: Initial support for x32.
4637
4638 2012-01-03  Cary Coutant  <ccoutant@google.com>
4639
4640         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
4641         Use abstract base class for GOT.
4642         * gold/output.h (class Output_data_got_base): New abstract base class.
4643         (class Output_data_got): Derive from new base class, adjust ctors.
4644         (Output_data_got::reserve_slot): Make virtual; rename to
4645         do_reserve_slot; Adjust callers.
4646         * gold/target.h (Sized_target::init_got_plt_for_update): Return
4647         pointer to abstract base class.
4648         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
4649
4650 2011-12-18  Ian Lance Taylor  <iant@google.com>
4651
4652         * object.h (Relobj::local_symbol_value): New function.
4653         (Relobj::local_plt_offset): New function.
4654         (Relobj::local_has_got_offset): New function.
4655         (Relobj::local_got_offset): New function.
4656         (Relobj::set_local_got_offset): New function.
4657         (Relobj::do_local_symbol_value): New pure virtual function.
4658         (Relobj::do_local_plt_offset): Likewise.
4659         (Relobj::do_local_has_got_offset): Likewise.
4660         (Relobj::do_local_got_offset): Likewise.
4661         (Relobj::do_set_local_got_offset): Likewise.
4662         (Sized_relobj::do_local_has_got_offset): Rename from
4663         local_has_got_offset.
4664         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
4665         (Sized_relobj::do_set_local_got_offset): Rename from
4666         set_local_got_offset.
4667         (Sized_relobj_file::do_local_plt_offset): Rename from
4668         local_plt_offset.
4669         (Sized_relobj_file::do_local_symbol_value): New function.
4670         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
4671         local_plt_offset.
4672         * output.cc (Output_data_got::Got_entry::write): Change object to
4673         Relobj.  Use local_symbol_value.
4674         (Output_data_got::add_global_with_rel): Change rel_dyn to
4675         Output_data_reloc_generic*.  Use add_global_generic.
4676         (Output_data_got::add_global_with_rela): Remove.  Change all
4677         callers to use add_global_with_rel.
4678         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
4679         Output_data_reloc_generic*.  Use add_global_generic.
4680         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
4681         callers to use add_global_pair_with_rel.
4682         (Output_data_got::add_local): Change object to Relobj*.
4683         (Output_data_got::add_local_plt): Likewise.
4684         (Output_data_got::add_local_with_rel): Change object to Relobj*,
4685         change rel_dyn to Output_data_reloc_generic*.  Use
4686         add_local_generic.
4687         (Output_data_got::add_local_with_rela): Remove.  Change all
4688         callers to use all_local_with_rel.
4689         (Output_data_got::add_local_pair_with_rel): Change object to
4690         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
4691         add_output_section_generic.
4692         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
4693         callers to use add_local_pair_with_rel.
4694         (Output_data_got::reserve_local): Change object to Relobj*.
4695         * output.h: (class Output_data_reloc_generic): Add pure virtual
4696         declarations for add_global_generic, add_local_generic,
4697         add_output_section_generic.
4698         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
4699         functions for Output_data_reloc_generic.  Update declarations for
4700         changes listed in output.cc.
4701         (class Output_data_got): Change template parameter to got_size.
4702         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
4703         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
4704         function.
4705         (Sized_relobj_incr::do_local_plt_offset): New function.
4706         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
4707         add_global_generic.
4708
4709 2011-12-17  Cary Coutant  <ccoutant@google.com>
4710
4711         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
4712         * resolve.cc (Symbol_table::resolve): Likewise.
4713         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
4714         arrays.
4715         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4716
4717 2011-12-16  Ian Lance Taylor  <iant@google.com>
4718
4719         * output.h (Output_data_reloc_generic::add): Only call
4720         add_dynamic_reloc if this is a dynamic reloc section.
4721
4722 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
4723
4724         PR gold/13505
4725         * target-reloc.h (apply_relocation): Replace <64, false> with
4726         <size, big_endian>.
4727
4728 2011-11-25  Nick Clifton  <nickc@redhat.com>
4729
4730         * po/it.po: New Italian translation.
4731
4732 2011-11-17  Sterling Augustine  <saugustine@google.com>
4733
4734         * script.cc (script_include_directive): Implement.
4735         (read_script_file): New local variables name and search_path. Update
4736         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
4737         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
4738         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
4739
4740 2011-11-11  Sterling Augustine  <saugustine@google.com>
4741
4742         * yyscript.y (section_cmd): Add support for INCLUDE directive.
4743         (file_or_sections_cmd): Likewise.
4744
4745 2011-11-11  Doug Kwan  <dougkwan@google.com>
4746
4747         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
4748         if --just-symbols is given.
4749
4750 2011-11-10  Doug Kwan  <dougkwan@google.com>
4751
4752         PR gold/13362
4753         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
4754         when processing data relocs.
4755         * reloc.h (Relocate_functions::rel_unaligned): New method.
4756         (Relocate_functions::pcrel_unaligned): Ditto.
4757         (Relocate_functions::rel32_unaligned): Ditto.
4758         (Relocate_functions::pcrel32_unaligned): Ditto.
4759
4760 2011-11-09  Doug Kwan  <dougkwan@google.com>
4761
4762         PR gold/13362
4763         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
4764         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
4765         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
4766         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4767         (Relocate_functions::rel_unaligned): New.
4768         (Relocate_functions::rel32_unaligned): New.
4769         * target-reloc.h (relocate_for_relocatable): Add code to handle
4770         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4771         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
4772         arm_unaligned_reloc_r): New targets.
4773         * testsuite/Makefile.in: Regenerate.
4774         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
4775         linking.
4776
4777 2011-11-02  Ian Lance Taylor  <iant@google.com>
4778
4779         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
4780         NATIVE_LINKER.
4781         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
4782         * options.cc (General_options::finalize): Use library search path
4783         from configure script if specified.  If not native and no sysroot,
4784         only search TOOLLIBDIR.
4785         * options.h (Search_directory::Search_directory): Change name to
4786         const std::string&.
4787         (General_options::add_to_library_path_with_sysroot): Change arg to
4788         const std::string&.
4789         * configure, Makefile.in, config.in: Rebuild.
4790
4791 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
4792
4793         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
4794         we are working around the ARM1176 Erratum.
4795         * options.h (General_options::fix_arm1176): Add option.
4796         * testsuite/Makefile.am: Add testcases, and keep current ones
4797         working.
4798         * testsuite/Makefile.in: Regenerate.
4799         * testsuite/arm_fix_1176.s: New file.
4800         * testsuite/arm_fix_1176.sh: Likewise.
4801
4802 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
4803
4804         * arm.cc (Target_arm::Target_arm): Remove initialisation of
4805         may_use_blx_.
4806         (Target_arm::may_use_blx): Remove method.
4807         (Target_arm::set_may_use_blx): Likewise.
4808         (Target_arm::may_use_v4t_interworking): New method.
4809         (Target_arm::may_use_v5t_interworking): Likewise.
4810         (Target_arm::may_use_blx_): Remove member variable.
4811         (Arm_relocate_functions::arm_branch_common): Check for v5T
4812         interworking.
4813         (Arm_relocate_functions::thumb_branch_common): Likewise.
4814         (Reloc_stub::stub_type_for_reloc): Likewise.
4815         (Target_arm::do_finalize_sections): Correct interworking checks.
4816         * testsuite/Makefile.am: Add new tests.
4817         * testsuite/Makefile.in: Regenerate.
4818         * testsuite/arm_farcall_arm_arm.s: New test.
4819         * testsuite/arm_farcall_arm_arm.sh: Likewise.
4820         * testsuite/arm_farcall_arm_thumb.s: Likewise.
4821         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
4822         * testsuite/arm_farcall_thumb_arm.s: Likewise.
4823         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
4824         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
4825         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
4826
4827 2011-10-31  Cary Coutant  <ccoutant@google.com>
4828
4829         PR gold/13023
4830         * expression.cc (Expression::eval_with_dot): Add
4831         is_section_dot_assignment parameter.
4832         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
4833         absolute and assigning to dot within a section.
4834         * script-sections.cc
4835         (Output_section_element_assignment::set_section_addresses): Pass
4836         dot_section to set_if_absolute.
4837         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
4838         as is_section_dot_assignment flag to eval_with_dot.
4839         (Output_section_element_dot_assignment::set_section_addresses):
4840         Likewise.
4841         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
4842         parameter.  Also set value if relative to dot_section; set the
4843         symbol's output_section.
4844         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
4845         parameter.  Adjust all callers.
4846         (Expression::eval_maybe_dot): Likewise.
4847         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
4848         Adjust all callers.
4849         * testsuite/script_test_2.t: Test assignment of an absolute value
4850         to dot within an output section element.
4851
4852 2011-10-31  Cary Coutant  <ccoutant@google.com>
4853
4854         * options.h (class General_options): Add --[no-]gnu-unique options.
4855         * symtab.cc (Symbol_table::sized_write_globals): Convert
4856         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
4857
4858 2011-10-31  Cary Coutant  <ccoutant@google.com>
4859
4860         PR gold/13359
4861         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
4862         unnecessary assertion.
4863         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
4864
4865 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
4866
4867         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4868         gc_mark_symbol.
4869         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4870         gc_mark_symbol.
4871         Change to just keep the section associated with symbol.
4872         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
4873         they are externally visible and --export-dynamic is turned on.
4874         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
4875
4876 2011-10-19  Ian Lance Taylor  <iant@google.com>
4877
4878         PR gold/13163
4879         * script-sections.cc
4880         (Output_section_element_dot_assignment::needs_output_section): New
4881         function.
4882
4883 2011-10-19  Ian Lance Taylor  <iant@google.com>
4884
4885         PR gold/13204
4886         * layout.cc (Layout::segment_precedes): Don't assert failure if a
4887         --section-start option was seen.
4888         * options.h (General_options::any_section_start): New function.
4889
4890 2011-10-18  David S. Miller  <davem@davemloft.net>
4891
4892         PR binutils/13301
4893         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
4894         member to track relocation locations that have moved during TLS
4895         reloc optimizations.
4896         (Target_sparc::Relocate::Relocate): Initialize to NULL.
4897         (Target_sparc::Relocate::relocate): Adjust view down by 4
4898         bytes if it matches reloc_adjust_addr_.
4899         (Target_sparc::Relocate::relocate_tls): Always move the
4900         __tls_get_addr call delay slot instruction forward 4 bytes when
4901         performing relaxation.
4902
4903 2011-10-18  Cary Coutant  <ccoutant@google.com>
4904
4905         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
4906         (Output_file::map_no_anonymous): Check for non-zero
4907         return code from posix_fallocate.
4908
4909 2011-10-17  Cary Coutant  <ccoutant@google.com>
4910
4911         PR gold/13245
4912         * plugin.cc (is_visible_from_outside): Check for symbols
4913         referenced from dynamic objects.
4914         * resolve.cc (Symbol_table::resolve): Don't count references
4915         from dynamic objects as references from real ELF files.
4916         * testsuite/plugin_test_2.sh: Adjust expected result.
4917
4918 2011-10-17  Cary Coutant  <ccoutant@google.com>
4919
4920         * gold.cc: Include timer.h.
4921         (queue_middle_tasks): Stamp time.
4922         (queue_final_tasks): Likewise.
4923         * main.cc (main): Store timer in parameters.  Print timers
4924         for each pass.
4925         * parameters.cc (Parameters::Parameters): Initialize timer_.
4926         (Parameters::set_timer): New function.
4927         (set_parameters_timer): New function.
4928         * parameters.h (Parameters::set_timer): New function.
4929         (Parameters::timer): New function.
4930         (Parameters::timer_): New data member.
4931         (set_parameters_timer): New function.
4932         * timer.cc (Timer::stamp): New function.
4933         (Timer::get_pass_time): New function.
4934         * timer.h (Timer::stamp): New function.
4935         (Timer::get_pass_time): New function.
4936         (Timer::pass_times_): New data member.
4937
4938 2011-10-17  Cary Coutant  <ccoutant@google.com>
4939
4940         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4941         task for members of lib groups.
4942
4943 2011-10-17  Cary Coutant  <ccoutant@google.com>
4944
4945         PR gold/13288
4946         * fileread.cc (File_read::find_view): Add assert.
4947         (File_read::make_view): Move bounds check (replace with assert)...
4948         (File_read::find_or_make_view): ... to here.
4949
4950 2011-10-12  Cary Coutant  <ccoutant@google.com>
4951
4952         * output.cc (Output_file::open_base_file): Handle case where
4953         ::read returns less than requested size.
4954
4955 2011-10-10  Cary Coutant  <ccoutant@google.com>
4956
4957         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4958         Initialize defined_count_.
4959         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4960         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4961         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4962         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4963         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4964         * incremental.h (Sized_relobj_incr::defined_count_): New data
4965         member.
4966         (Sized_incr_dynobj::defined_count_): New data member.
4967         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4968         Return zeroes instead of internal error.
4969
4970 2011-10-10  Cary Coutant  <ccoutant@google.com>
4971
4972         PR gold/13249
4973         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4974         (Output_reloc::symbol_value): Return PLT offset if flag is set.
4975         * output.h (class Output_reloc): Add use_plt_offset flag.
4976         (Output_reloc::type_): Adjust size of bit field.
4977         (Output_reloc::use_plt_offset_): New bit field.
4978         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4979         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4980         flag.  Adjust all callers.
4981         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4982         creating RELATIVE relocations.
4983
4984 2011-10-10  Nick Clifton  <nickc@redhat.com>
4985
4986         * po/es.po: Updated Spanish translation.
4987         * po/fi.po: Updated Finnish translation.
4988
4989 2011-10-03   Diego Novillo  <dnovillo@google.com>
4990
4991         * options.cc (parse_uint): Fix dereference of RETVAL.
4992
4993 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
4994
4995         * layout.h (section_order_map_): New member.
4996         (get_section_order_map): New member function.
4997         * output.cc (Output_section::add_input_section): Check for patterns
4998         only when --section-ordering-file is specified.
4999         * gold.cc (queue_middle_tasks): Delay updating order of sections till
5000         output_sections have been formed.
5001         * layout.cc (Layout_Layout): Initialize section_order_map_.
5002         * plugin.cc (update_section_order): Store order in order_map. Do not
5003         update the order.
5004         * testsuite/Makefile.am: Add test case for plugin_final_layout.
5005         * testsuite/Makefile.in: Regenerate.
5006         * testsuite/plugin_section_order.c: New file.
5007         * testsuite/plugin_final_layout.cc: New file.
5008         * testsuite/plugin_final_layout.sh: New file.
5009
5010 2011-09-29  Cary Coutant  <ccoutant@google.com>
5011
5012         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5013         Check for NULL.
5014         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
5015         symbols during incremental update.
5016         (Symbol_table::add_from_dynobj): Likewise.
5017
5018 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5019             Ian Lance Taylor  <iant@google.com>
5020
5021         * symtab.cc (Symbol_table::define_special_symbol): Always
5022         canonicalize version string.
5023
5024 2011-09-26  Cary Coutant  <ccoutant@google.com>
5025
5026         * gold.cc (queue_initial_tasks): Move option checks ...
5027         * options.cc (General_options::finalize): ... to here. Disable
5028         some options; make others fatal.
5029
5030 2011-09-26  Cary Coutant  <ccoutant@google.com>
5031
5032         gcc PR lto/47247
5033         * plugin.cc (get_symbols_v2): New function.
5034         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
5035         (is_referenced_from_outside): New function.
5036         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
5037         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
5038         (get_symbols): Pass version parameter.
5039         (get_symbols_v2): New function.
5040         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
5041         parameter.
5042         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
5043         (onload): Add LDPT_GET_SYMBOLS_V2.
5044         (all_symbols_read_hook): Use get_symbols_v2; check for
5045         LDPR_PREVAILING_DEF_IRONLY_EXP.
5046         * testsuite/plugin_test_3.sh: Update expected results.
5047
5048 2011-09-23  Simon Baldwin  <simonb@google.com>
5049
5050         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
5051         configuration options.
5052         * configure: Regenerate.
5053         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
5054         * Makefile.in: Regenerate.
5055         * testsuite/Makefile.in: Regenerate.
5056
5057 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
5058
5059         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
5060
5061 2011-09-19  Cary Coutant  <ccoutant@google.com>
5062
5063         * incremental.cc (can_incremental_update): Fix typo in comment.
5064         * incremental.h (can_incremental_update): Likewise.
5065
5066 2011-09-18  Cary Coutant  <ccoutant@google.com>
5067
5068         * incremental.cc (can_incremental_update): New function.
5069         * incremental.h (can_incremental_update): New function.
5070         * layout.cc (Layout::init_fixed_output_section): Call it.
5071         (Layout::make_output_section): Don't allow patch space in .eh_frame.
5072         * object.cc (Sized_relobj_file::do_layout): Call
5073         can_incremental_update.
5074
5075 2011-09-13  Cary Coutant  <ccoutant@google.com>
5076
5077         * configure.ac: Check for glibc support for gnu_indirect_function
5078         support with static linking, setting automake conditional
5079         IFUNC_STATIC.
5080         * Makefile.in: Regenerate.
5081         * configure: Regenerate.
5082
5083         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
5084         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
5085         for IFUNC_STATIC.
5086         * testsuite/Makefile.in: Regenerate.
5087
5088 2011-09-13  Cary Coutant  <ccoutant@google.com>
5089
5090         * incremental.cc (Sized_relobj_incr::do_layout): Call
5091         report_comdat_group for kept comdat sections.
5092         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
5093         * testsuite/Makefile.in: Regenerate.
5094         * testsuite/incr_comdat_test_1.cc: New source file.
5095         * testsuite/incr_comdat_test_2_v1.cc: New source file.
5096         * testsuite/incr_comdat_test_2_v2.cc: New source file.
5097         * testsuite/incr_comdat_test_2_v3.cc: New source file.
5098
5099 2011-09-13  Ian Lance Taylor  <iant@google.com>
5100
5101         * object.cc (Sized_relobj_file::do_layout): Remove unused local
5102         variable external_symbols_offset.
5103
5104 2011-09-12  Ian Lance Taylor  <iant@google.com>
5105
5106         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
5107         triggered if object has no symbols.
5108
5109 2011-09-09  David S. Miller  <davem@davemloft.net>
5110
5111         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
5112         (Output_fill_debug_line::do_write): Likewise.
5113
5114 2011-08-29  Cary Coutant  <ccoutant@google.com>
5115
5116         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
5117         casts to match formatting specs.
5118         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
5119
5120 2011-08-26  Cary Coutant  <ccoutant@google.com>
5121
5122         * layout.cc (Free_list::allocate): Provide guarantee of minimum
5123         remaining hole size when allocating.
5124         (Layout::make_output_section): Set fill methods for debug sections.
5125         * layout.h (Free_list::Free_list_node): Move from private to
5126         public.
5127         (Free_list::set_min_hole_size): New function.
5128         (Free_list::begin, Free_list::end): New functions.
5129         (Free_list::min_hole_): New data member.
5130         * output.cc: Include dwarf.h.
5131         (Output_fill_debug_info::do_minimum_hole_size): New function.
5132         (Output_fill_debug_info::do_write): New function.
5133         (Output_fill_debug_line::do_minimum_hole_size): New function.
5134         (Output_fill_debug_line::do_write): New function.
5135         (Output_section::Output_section): Initialize new data member.
5136         (Output_section::set_final_data_size): Ensure patch space is larger
5137         than minimum hole size.
5138         (Output_section::do_write): Fill holes in debug sections.
5139         * output.h (Output_fill): New class.
5140         (Output_fill_debug_info): New class.
5141         (Output_fill_debug_line): New class.
5142         (Output_section::set_free_space_fill): New function.
5143         (Output_section::free_space_fill_): New data member.
5144         * testsuite/Makefile.am (incremental_test_3): Add
5145         --incremental-patch option.
5146         (incremental_test_4): Likewise.
5147         (incremental_test_5): Likewise.
5148         (incremental_test_6): Likewise.
5149         (incremental_copy_test): Likewise.
5150         (incremental_common_test_1): Likewise.
5151         * testsuite/Makefile.in: Regenerate.
5152
5153 2011-08-26  Nick Clifton  <nickc@redhat.com>
5154
5155         * po/es.po: Updated Spanish translation.
5156
5157 2011-08-01  Cary Coutant  <ccoutant@google.com>
5158
5159         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
5160         * gold/testsuite/Makefile.in: Regenerate.
5161         * gold/testsuite/justsyms_exec.c: New source file.
5162         * gold/testsuite/justsyms_lib.c: New source file.
5163
5164 2011-08-01  Cary Coutant  <ccoutant@google.com>
5165
5166         * layout.cc (Layout::set_segment_offsets): Don't realign text
5167         segment if -Ttext was specified.
5168         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
5169         file type.
5170         * object.h (Sized_relobj_file::e_type): New function.
5171         (Sized_relobj_file::e_type_): New data member.
5172         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
5173         base address for ET_EXEC files.
5174         * target.cc (Target::do_make_elf_object_implementation): Allow
5175         ET_EXEC files with --just-symbols option.
5176
5177 2011-07-28  Cary Coutant  <ccoutant@google.com>
5178
5179         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
5180         Add thread_number parameter.
5181         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
5182         * workqueue-threads.cc
5183         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
5184         current thread if its thread number is greater than desired thread
5185         count.
5186         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
5187         Add thread_number parameter.
5188         (Workqueue::should_cancel_thread): Likewise.
5189         (Workqueue::find_runnable_or_wait): Pass thread_number to
5190         should_cancel_thread.
5191         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
5192         parameter.
5193
5194 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
5195
5196         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
5197         only after checking if it cannot be forced local.
5198         * symtab.h (is_externally_visible): Check if the symbol is not forced
5199         local.
5200
5201 2011-07-15  Ian Lance Taylor  <iant@google.com>
5202
5203         * options.h (class General_options): Add --print-output-format.
5204         Move -EL next to -EB, for  better --help output.
5205         * target-select.cc: Include <cstdio>, "options.h", and
5206         "parameters.h".
5207         (Target_selector::do_target_bfd_name): New function.
5208         (print_output_format): New function.
5209         * target-select.h (class Target_selector): Update declarations.
5210         (Target_selector::target_bfd_name): New function.
5211         (print_output_format): Declare.
5212         * main.cc: Include "target-select.h".
5213         (main): Handle --print-output-format.
5214         * gold.cc: Include "target-select.h".
5215         (queue_initial_tasks): Handle --print-output-format when there are
5216         no input files.
5217         * parameters.cc (parameters_force_valid_target): Give a better
5218         error message if -EB/-EL does not match target.
5219         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
5220         function.
5221
5222 2011-07-15  Ian Lance Taylor  <iant@google.com>
5223
5224         * i386.cc (class Output_data_plt_i386): Add layout_ field.
5225         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
5226         (Output_data_plt_i386::do_write): Write address of .dynamic
5227         section to first entry in .got.plt section.
5228         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
5229         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5230         Initialize layout_.
5231         (Output_data_plt_x86_64::do_write): Write address of .dynamic
5232         section to first entry in .got.plt section.
5233         * layout.h (Layout::dynamic_section): New function.
5234
5235 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
5236
5237         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
5238         to claim_file call.
5239         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
5240         input_section_position_, and input_section_glob_.
5241         (read_layout_from_file): Call function section_ordering_specified.
5242         * layout.h (is_section_ordering_specified): New function.
5243         (section_ordering_specified): New function.
5244         (section_ordering_specified_): New boolean member.
5245         * main.cc(main): Call load_plugins after layout object is defined.
5246         * output.cc (Output_section::add_input_section): Use
5247         function section_ordering_specified to check if section ordering is
5248         needed.
5249         * output.cc (Output_section::add_relaxed_input_section): Use
5250         function section_ordering_specified to check if section ordering is
5251         needed.
5252         (Output_section::update_section_layout): New function.
5253         (Output_section::sort_attached_input_sections): Check if input section
5254         must be reordered.
5255         * output.h (Output_section::update_section_layout): New function.
5256         * plugin.cc (get_section_count): New function.
5257         (get_section_type): New function.
5258         (get_section_name): New function.
5259         (get_section_contents): New function.
5260         (update_section_order): New function.
5261         (allow_section_ordering): New function.
5262         (Plugin::load): Add the new interfaces to the transfer vector.
5263         (Plugin_manager::load_plugins): New parameter.
5264         (Plugin_manager::all_symbols_read): New parameter.
5265         (Plugin_manager::claim_file): New parameter. Save the elf object for
5266         unclaimed objects.
5267         (Plugin_manager::get_elf_object): New function.
5268         (Plugin_manager::get_view): Change to directly use the bool to check
5269         if get_view is called from claim_file_hook.
5270         * plugin.h (input_objects): New function
5271         (Plugin__manager::load_plugins): New parameter.
5272         (Plugin_manager::claim_file): New parameter.
5273         (Plugin_manager::get_elf_object): New function.
5274         (Plugin_manager::in_claim_file_handler): New function.
5275         (Plugin_manager::in_claim_file_handler_): New member.
5276         (layout): New function.
5277         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
5278         handler with an extra parameter. Make the elf object before calling
5279         claim_file handler.
5280         * testsuite/plugin_test.c (get_section_count): New function pointer.
5281         (get_section_type): New function pointer.
5282         (get_section_name): New function pointer.
5283         (get_section_contents): New function pointer.
5284         (update_section_order): New function pointer.
5285         (allow_section_ordering): New function pointer.
5286         (onload): Check if the new interfaces exist.
5287
5288 2011-07-13  Ian Lance Taylor  <iant@google.com>
5289
5290         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
5291         relro section.
5292         * x86_64.cc (Target_x86_64::got_section): Likewise.
5293         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
5294         (relro_now_test_SOURCES): New variable.
5295         (relro_now_test_DEPENDENCIES): New variable.
5296         (relro_now_test_LDFLAGS): New variable.
5297         (relro_now_test_LDADD): New variable.
5298         (relro_now_test.so): New target.
5299         * testsuite/Makefile.in: Rebuild.
5300
5301 2011-07-12  Ian Lance Taylor  <iant@google.com>
5302
5303         PR gold/12980
5304         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
5305         GLOB_DAT relocation rather than a RELATIVE relocation for a
5306         protected symbol when creating a shared library.
5307         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5308         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
5309         * testsuite/protected_main_1.cc (main): Test that protected
5310         function has same address.
5311
5312 2011-07-11  Ian Lance Taylor  <iant@google.com>
5313
5314         PR gold/12979
5315         * options.h (class General_options): Add -Bgroup.
5316         * options.cc (General_options::finalize): If -Bgroup is set,
5317         default to --unresolved-symbols=report-all.
5318         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
5319         * target-reloc.h (issue_undefined_symbol_error): Handle
5320         --unresolved-symbols=report-all.
5321
5322 2011-07-08  Ian Lance Taylor  <iant@google.com>
5323
5324         PR gold/11985
5325         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
5326         if linker script discards key sections.
5327         (Layout::create_dynamic_symtab): Likewise.
5328         (Layout::assign_local_dynsym_offsets): Likewise.
5329         (Layout::sized_create_version_sections): Likewise.
5330         (Layout::create_interp): Likewise.
5331         (Layout::finish_dynamic_section): Likewise.
5332         (Layout::set_dynamic_symbol_size): Likewise.
5333
5334 2011-07-08  Ian Lance Taylor  <iant@google.com>
5335
5336         PR gold/12386
5337         * options.h (class General_options): Add --unresolved-symbols.
5338         * target-reloc.h (issue_undefined_symbol_error): Check
5339         --unresolved-symbols.  Add comments.
5340
5341 2011-07-08  Ian Lance Taylor  <iant@google.com>
5342
5343         * testsuite/odr_violation2.cc (Ordering::operator()): Make
5344         expression more complex.
5345
5346 2011-07-08  Ian Lance Taylor  <iant@google.com>
5347
5348         PR gold/11317
5349         * target-reloc.h (issue_undefined_symbol_error): New inline
5350         function, broken out of relocate_section.
5351         (relocate_section): Call issue_undefined_symbol_error.
5352         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5353         there is no TLS segment if we are about to issue an undefined
5354         symbol error.
5355         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5356
5357 2011-07-08  Ian Lance Taylor  <iant@google.com>
5358
5359         PR gold/12279
5360         * resolve.cc (Symbol_table::should_override): Add fromtype
5361         parameter.  Change all callers.  Give error when linking together
5362         TLS and non-TLS symbol.
5363         (Symbol_table::should_override_with_special): Add fromtype
5364         parameter.  Change all callers.
5365         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5366         there is no TLS segment if we have reported some errors.
5367         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5368
5369 2011-07-08  Ian Lance Taylor  <iant@google.com>
5370
5371         PR gold/12372
5372         * target.h (Target::plt_address_for_global): New function.
5373         (Target::plt_address_for_local): New function.
5374         (Target::plt_section_for_global): Remove.
5375         (Target::plt_section_for_local): Remove.
5376         (Target::do_plt_address_for_global): New virtual function.
5377         (Target::do_plt_address_for_local): New virtual function.
5378         (Target::do_plt_section_for_global): Remove.
5379         (Target::do_plt_section_for_local): Remove.
5380         (Target::register_global_plt_entry): Add Symbol_table and Layout
5381         parameters.
5382         * output.cc (Output_data_got::Got_entry::write): Use
5383         plt_address_for_global and plt_address_for_local.
5384         * layout.cc (Layout::add_target_dynamic_tags): Use size and
5385         address of output section.
5386         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
5387         got_irelative_, and irelative_count_ fields.  Update
5388         declarations.
5389         (Output_data_plt_i386::has_irelative_section): New function.
5390         (Output_data_plt_i386::entry_count): Add irelative_count_.
5391         (Output_data_plt_i386::set_final_data_size): Likewise.
5392         (class Target_i386): Add got_irelative_ and rel_irelative_
5393         fields.  Update declarations.
5394         (Target_i386::Target_i386): Initialize new fields.
5395         (Target_i386::do_plt_address_for_global): New function replacing
5396         do_plt_section_for_global.
5397         (Target_i386::do_plt_address_for_local): New function replacing
5398         do_plt_section_for_local.
5399         (Target_i386::got_section): Create got_irelative_.
5400         (Target_i386::rel_irelative_section): New function.
5401         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
5402         fields.  Don't define __rel_iplt_{start,end}.
5403         (Output_data_plt_i386::add_entry): Add symtab and layout
5404         parameters.  Change all callers.  Use different PLT and GOT for
5405         IFUNC symbols.
5406         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
5407         layout parameters.  Change all callers.  Use different PLT and
5408         GOT.
5409         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
5410         (Output_data_plt_i386::rel_irelative): New function.
5411         (Output_data_plt_i386::address_for_global): New function.
5412         (Output_data_plt_i386::address_for_local): New function.
5413         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
5414         IRELATIVE GOT when changing IFUNC GOT entries.
5415         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
5416         reloc.
5417         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
5418         if we didn't create an IRELATIVE GOT.
5419         (Target_i386::Relocate::relocate): Use plt_address_for_global and
5420         plt_address_for_local.
5421         (Target_i386::do_dynsym_value): Use plt_address_for_global.
5422         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
5423         got_irelative_, and irelative_count_ fields.  Update
5424         declarations.
5425         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5426         Initialize new fields.  Remove symtab parameter.  Change all
5427         callers.
5428         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
5429         irelative_count_.
5430         (Output_data_plt_x86_64::has_irelative_section): New function.
5431         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
5432         (class Target_x86_64): Add got_irelative_ and rel_irelative_
5433         fields.  Update declarations.
5434         (Target_x86_64::Target_x86_64): Initialize new fields.
5435         (Target_x86_64::do_plt_address_for_global): New function replacing
5436         do_plt_section_for_global.
5437         (Target_x86_64::do_plt_address_for_local): New function replacing
5438         do_plt_section_for_local.
5439         (Target_x86_64::got_section): Create got_irelative_.
5440         (Target_x86_64::rela_irelative_section): New function.
5441         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
5442         all callers.  Don't create __rel_iplt_{start,end}.
5443         (Output_data_plt_x86_64::add_entry): Add symtab and layout
5444         parameters.  Change all callers.  Use different PLT and GOT for
5445         IFUNC symbols.
5446         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
5447         layout parameters.  Change all callers.  Use different PLT and
5448         GOT.
5449         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
5450         parameters.  Change all callers.  Use different PLT and GOT for
5451         IFUNC symbols.
5452         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
5453         (Output_data_plt_x86_64::rela_irelative): New function.
5454         (Output_data_plt_x86_64::address_for_global): New function.
5455         (Output_data_plt_x86_64::address_for_local): New function.
5456         (Output_data_plt_x86_64::set_final_data_size): Likewise.
5457         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
5458         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
5459         (Target_x86_64::register_global_plt_entry): Add symtab and layout
5460         parameters.
5461         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
5462         reloc.
5463         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
5464         symbols if we didn't create an IRELATIVE GOT.
5465         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
5466         plt_address_for_local.
5467         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
5468         * testsuite/ifuncvar1.c: New test file.
5469         * testsuite/ifuncvar2.c: New test file.
5470         * testsuite/ifuncvar3.c: New test file.
5471         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
5472         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
5473         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
5474         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
5475         * testsuite/Makefile.in: Rebuild.
5476
5477 2011-07-07  Cary Coutant  <ccoutant@google.com>
5478
5479         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
5480         (two_file_test_1_ndebug.o): Likewise.
5481         (two_file_test_1b_ndebug.o): Likewise.
5482         (two_file_test_2_ndebug.o): Likewise.
5483         (two_file_test_main_ndebug.o): Likewise.
5484         (incremental_test_2): Link with no-debug versions.
5485
5486 2011-07-06  Cary Coutant  <ccoutant@google.com>
5487
5488         * gold/incremental.cc
5489         (Output_section_incremental_inputs::write_info_blocks): Check for
5490         hidden and internal symbols.
5491
5492 2011-07-06  Cary Coutant  <ccoutant@google.com>
5493
5494         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
5495         Check disposition for startup file.
5496         (Incremental_inputs::report_command_line): Ignore
5497         --incremental-startup-unchanged option.
5498         * options.cc (General_options::parse_incremental_startup_unchanged):
5499         New function.
5500         (General_options::General_options): Initialize new data member.
5501         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
5502         (General_options): Add --incremental-startup-unchanged option.
5503         (General_options::incremental_startup_disposition): New function.
5504         (General_options::incremental_startup_disposition_): New data member.
5505
5506 2011-07-06  Cary Coutant  <ccoutant@google.com>
5507
5508         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
5509         input file index to Script_info ctor.
5510         (Sized_incremental_binary::do_file_has_changed): Find the
5511         command-line argument for files named in scripts.
5512         * incremental.h (Script_info::Script_info): New ctor
5513         with input file index.
5514         (Script_info::input_file_index): New function.
5515         (Script_info::input_file_index_): New data member.
5516         (Incremental_binary::get_library): Add const.
5517         (Incremental_binary::get_script_info): Add const.
5518         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
5519         * testsuite/Makefile.am (incremental_test_5): New test case.
5520         (incremental_test_6): New test case.
5521         * testsuite/Makefile.in: Regenerate.
5522
5523 2011-07-06  Cary Coutant  <ccoutant@google.com>
5524
5525         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
5526         debug output when command lines differ.
5527
5528 2011-07-06  Cary Coutant  <ccoutant@google.com>
5529
5530         * incremental.cc (Incremental_inputs::report_command_line): Ignore
5531         --incremental-patch option.
5532         * layout.cc (Free_list::allocate): Extend allocation beyond original
5533         end if enabled.
5534         (Layout::make_output_section): Mark sections that should get
5535         patch space.
5536         * options.cc (parse_percent): New function.
5537         * options.h (parse_percent): New function.
5538         (DEFINE_percent): New macro.
5539         (General_options): Add --incremental-patch option.
5540         * output.cc (Output_section::Output_section): Initialize new data
5541         members.
5542         (Output_section::add_input_section): Print section name when out
5543         of patch space.
5544         (Output_section::add_output_section_data): Likewise.
5545         (Output_section::set_final_data_size): Add patch space when
5546         doing --incremental-full.
5547         (Output_section::do_reset_address_and_file_offset): Remove patch
5548         space.
5549         (Output_segment::set_section_list_addresses): Print debug output
5550         only if --incremental-update.
5551         * output.h (Output_section::set_is_patch_space_allowed): New function.
5552         (Output_section::is_patch_space_allowed_): New data member.
5553         (Output_section::patch_space_): New data member.
5554         * parameters.cc (Parameters::incremental_full): New function.
5555         * parameters.h (Parameters::incremental_full): New function
5556         * testsuite/Makefile.am (incremental_test_2): Add test for
5557         --incremental-patch option.
5558         * testsuite/Makefile.in: Regenerate.
5559         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
5560         (t18): Remove function body.
5561
5562 2011-07-05  Doug Kwan  <dougkwan@google.com>
5563
5564         PR gold/12771
5565         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
5566         Arm_Address type for relocation result.
5567         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
5568         overflow check.
5569         (Arm_relocate_functions::abs32): Use unaligned access.
5570         (Arm_relocate_functions::rel32): Ditto.
5571         (Arm_relocate_functions::prel31): Ditto.
5572         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
5573         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
5574         static data relocations.
5575         * testsuite/Makefile.in: Regnerate.
5576         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
5577
5578 2011-07-05  Ian Lance Taylor  <iant@google.com>
5579
5580         PR gold/12392
5581         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
5582         symbols if necessary.
5583         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5584
5585 2011-07-05  Ian Lance Taylor  <iant@google.com>
5586
5587         PR gold/12952
5588         * resolve.cc (Symbol::override_base_with_special): Simply override
5589         version with special symbol version, ignoring previous version.
5590
5591 2011-07-05  Ian Lance Taylor  <iant@google.com>
5592
5593         * object.cc (Sized_relobj_file::include_section_group): Add
5594         information to comment about signature location.
5595
5596 2011-07-02  Ian Lance Taylor  <iant@google.com>
5597
5598         PR gold/12957
5599         * options.h (class General_options): Add -f and -F.
5600         * options.cc (General_options::finalize): Fatal error if -f/-F
5601         are used without -shared.
5602         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
5603
5604 2011-07-02  Ian Lance Taylor  <iant@google.com>
5605
5606         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
5607
5608 2011-07-01  Ian Lance Taylor  <iant@google.com>
5609
5610         PR gold/12525
5611         PR gold/12952
5612         * resolve.cc (Symbol::override_base_with_special): Don't override
5613         the version if the overriding symbol has a different name.
5614         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
5615         all callers.  If we give an error about an undefined version,
5616         define the base version if necessary.
5617         * dynobj.h (class Versions): Update declaration.
5618         * testsuite/weak_alias_test_5.cc: New file.
5619         * testsuite/weak_alias_test.script: New file.
5620         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
5621         and versioned_alias have the right value, and call t2.
5622         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
5623         weak_alias_test_5.so.
5624         (weak_alias_test_LDADD): Likewise.
5625         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
5626         * testsuite/Makefile.in: Rebuild.
5627
5628 2011-07-01  Ian Lance Taylor  <iant@google.com>
5629
5630         PR gold/12525
5631         * options.h (class General_options): Support -z notext.
5632         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
5633         -Wl,-z,notext.
5634         (two_file_shared_nonpic.so): Likewise.
5635         (two_file_shared_mixed.so): Likewise.
5636         (two_file_shared_mixed_1.so): Likewise.
5637         (weak_undef_lib_nonpic.so): Likewise.
5638         (alt/weak_undef_lib_nonpic.so): Likewise.
5639         (tls_test_shared_nonpic.so): Likewise.
5640         * testsuite/Makefile.in: Rebuild.
5641
5642 2011-07-01  Ian Lance Taylor  <iant@google.com>
5643
5644         PR gold/12525
5645         * configure.ac: Test whether static linking works, setting
5646         the automake conditional HAVE_STATIC.
5647         * testsuite/Makefile.am: Disable tests using -static if
5648         HAVE_STATIC is not true.
5649         * configure, testsuite/Makefile.in: Rebuild.
5650
5651 2011-07-01  Ian Lance Taylor  <iant@google.com>
5652
5653         PR gold/12525
5654         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
5655         Assert if we see DW_EH_PE_indirect.
5656         * target.h (Target::ehframe_datarel_base): New function.
5657         (Target::do_ehframe_datarel_base): New target function.
5658         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
5659         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
5660         function.
5661
5662 2011-07-01  Ian Lance Taylor  <iant@google.com>
5663
5664         PR gold/12571
5665         * options.h (class General_options): Add
5666         --ld-generated-unwind-info.
5667         * ehframe.cc (Fde::write): Add address parameter.  Change all
5668         callers.  If associated with PLT, fill in address and size.
5669         (Cie::set_output_offset): Only add merge mapping if there is an
5670         object.
5671         (Cie::write): Add address parameter.  Change all callers.
5672         (Eh_frame::add_ehframe_for_plt): New function.
5673         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
5674         input_offset_ fields into union u_, with new plt field.
5675         (Fde::Fde): Adjust for new union field.
5676         (Fde::Fde) [Output_data version]: New constructor.
5677         (Fde::add_mapping): Only add merge mapping if there is an object.
5678         (class Cie): Update declarations.
5679         (class Eh_frame): Declare add_ehframe_for_plt.
5680         * layout.cc (Layout::layout_eh_frame): Break out code into
5681         make_eh_frame_section, and call it.
5682         (Layout::make_eh_frame_section): New function.
5683         (Layout::add_eh_frame_for_plt): New function.
5684         * layout.h (class Layout): Update declarations.
5685         * merge.cc (Merge_map::add_mapping): Add assertion.
5686         * i386.cc: Include "dwarf.h".
5687         (class Output_data_plt_i386): Make first_plt_entry,
5688         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
5689         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5690         and plt_eh_frame_fde.
5691         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
5692         boundary.  Call add_eh_frame_for_plt if appropriate.
5693         * x86_64.cc: Include "dwarf.h".
5694         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
5695         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
5696         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5697         and plt_eh_frame_fde.
5698         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
5699         appropriate.
5700
5701 2011-06-29  Ian Lance Taylor  <iant@google.com>
5702
5703         PR gold/12629
5704         * object.cc (Sized_relobj_file::layout_section): Change shdr
5705         parameter to be const.
5706         (Sized_relobj_file::layout_eh_frame_section): New function, broken
5707         out of do_layout.
5708         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
5709         appropriate.  Call layout_eh_frame_section.
5710         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
5711         sections.
5712         * object.h (class Sized_relobj_file): Update declarations.
5713
5714 2011-06-29  Ian Lance Taylor  <iant@google.com>
5715
5716         PR gold/12652
5717         * script.cc (Token::integer_value): Accept trailing M/m/K/k
5718         modifier.
5719         (Lex::gather_token): Accept trailing M/m/K/k for integers.
5720
5721 2011-06-29  Ian Lance Taylor  <iant@google.com>
5722
5723         PR gold/12675
5724         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
5725         SHT_X86_64_UNWIND.
5726         * layout.cc (Layout::layout_eh_frame): Likewise.
5727
5728 2011-06-29  Ian Lance Taylor  <iant@google.com>
5729
5730         PR gold/12695
5731         * layout.cc (Layout::symtab_section_shndx): New function.
5732         * layout.h (class Layout): Declare symtab_section_shndx.
5733         * output.cc (Output_section::write_header): Call it.
5734
5735 2011-06-29  Ian Lance Taylor  <iant@google.com>
5736
5737         PR gold/12818
5738         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
5739         symbols which are not used in a relocation.
5740
5741 2011-06-28  Ian Lance Taylor  <iant@google.com>
5742
5743         PR gold/12898
5744         * layout.cc (Layout::segment_precedes): Don't crash if a linker
5745         script create indistinguishable segments.
5746         (Layout::set_segment_offsets): Use stable_sort when sorting
5747         segments.  Pass this to Compare_segments constructor.
5748         * layout.h (class Layout): Make segment_precedes non-static.
5749         (class Compare_segments): Change from struct to class.  Add
5750         layout_ field.  Add constructor.
5751         * script-sections.cc
5752         (Script_sections::attach_sections_using_phdrs_clause): Rename
5753         local orphan to is_orphan.  Don't report failure to put empty
5754         section in segment.  On attachment failure, report name of
5755         section, and attach to first PT_LOAD segment.
5756
5757 2011-06-28  Ian Lance Taylor  <iant@google.com>
5758
5759         PR gold/12934
5760         * target-select.cc (Target_selector::Target_selector): Add
5761         emulation parameter.  Change all callers.
5762         (select_target_by_bfd_name): Rename from select_target_by_name.
5763         Change all callers.
5764         (select_target_by_emulation): New function.
5765         (supported_emulation_names): New function.
5766         * target-select.h (class Target_selector): Add emulation_ field.
5767         Update declarations.
5768         (Target_selector::recognize_by_bfd_name): Rename from
5769         recognize_by_name.  Change all callers.
5770         (Target_selector::supported_bfd_names): Rename from
5771         supported_names.  Change all callers.
5772         (Target_selector::recognize_by_emulation): New function.
5773         (Target_selector::supported_emulations): New function.
5774         (Target_selector::emulation): New function.
5775         (Target_selector::do_recognize_by_bfd_name): Rename from
5776         do_recognize_by_name.  Change all callers.
5777         (Target_selector::do_supported_bfd_names): Rename from
5778         do_supported_names.  Change all callers.
5779         (Target_selector::do_recognize_by_emulation): New function.
5780         (Target_selector::do_supported_emulations): New function.
5781         (select_target_by_bfd_name): Change name in declaration.
5782         (select_target_by_emulation): Declare.
5783         (supported_emulation_names): Declare.
5784         * parameters.cc (parameters_force_valid_target): Try to find
5785         target based on emulation from -m option.
5786         * options.h (class General_options): Change doc string for -m.
5787         * options.cc (help): Print emulations.
5788         (General_options::parse_V): Likewise.
5789         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
5790         Add emulation parameter.  Change all callers.
5791
5792 2011-06-28  Ian Lance Taylor  <iant@google.com>
5793
5794         * target.h (class Target): Add osabi_ field.
5795         (Target::osabi): New function.
5796         (Target::set_osabi): New function.
5797         (Target::Target): Initialize osabi_.
5798         (Target::do_adjust_elf_header): Make pure virtual.
5799         (Sized_target::do_adjust_elf_header): Declare.
5800         * target.cc (Sized_target::do_adjust_elf_header): New function.
5801         (class Sized_target): Instantiate all versions.
5802         * freebsd.h (class Target_freebsd): Remove.
5803         (Target_selector_freebsd::do_recognize): Call set_osabi on
5804         Target.
5805         (Target_selector_freebsd::do_recognize_by_name): Likewise.
5806         (Target_selector_freebsd::set_osabi): Remove.
5807         * i386.cc (class Target_i386): Inherit from Sized_target rather
5808         than Target_freebsd.
5809         * x86_64.cc (class Target_x86_64): Likewise.
5810
5811 2011-06-28  Ian Lance Taylor  <iant@google.com>
5812
5813         * target.h (Target::can_check_for_function_pointers): Rewrite.
5814         Make non-virtual.
5815         (Target::can_icf_inline_merge_sections): Likewise.
5816         (Target::section_may_have_icf_unsafe_poineters): Likewise.
5817         (Target::Target_info): Add can_icf_inline_merge_sections field.
5818         (Target::do_can_check_for_function_pointers): New virtual
5819         function.
5820         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
5821         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
5822         from can_check_for_function_pointers, move in file.
5823         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
5824         section_may_have_icf_unsafe_poineters, move in file.
5825         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
5826         * i386.cc (Target_i386::do_can_check_for_function_pointers):
5827         Rename from can_check_for_function_pointers, move in file.
5828         (Target_i386::can_icf_inline_merge_sections): Remove.
5829         (Target_i386::i386_info): Initialize
5830         can_icf_inline_merge_sections.
5831         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
5832         Initialize can_icf_inline_merge_sections.
5833         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
5834         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
5835         Rename from can_check_for_function_pointers, move in file.
5836         (Target_x86_64::can_icf_inline_merge_sections): Remove.
5837         (Target_x86_64::x86_64_info): Initialize
5838         can_icf_inline_merge_sections.
5839         * testsuite/testfile.cc (Target_test::test_target_info):
5840         Likewise.
5841         * icf.cc (get_section_contents): Correct formatting.
5842
5843 2011-06-27  Ian Lance Taylor  <iant@google.com>
5844
5845         * symtab.cc (Symbol::versioned_name): New function.
5846         (Symbol_table::add_to_final_symtab): Use versioned_name when
5847         appropriate.
5848         (Symbol_table::sized_write_symbol): Likewise.
5849         * symtab.h (class Symbol): Declare versioned_name.
5850         * stringpool.h (class Stringpool_template): Add variant of add
5851         which takes a std::basic_string.
5852         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
5853         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
5854         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
5855         (ver_test_12.o): New target.
5856         * testsuite/Makefile.in: Rebuild.
5857
5858 2011-06-27  Doug Kwan  <dougkwan@google.com>
5859
5860         * arm.cc (Arm_relocate_functions::thm_jump8,
5861         Arm_relocate_functions::thm_jump11): Use a wider signed
5862         type to compute offset.
5863         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
5864         arm_thm_jump8.
5865         * testsuite/Makefile.in: Regenerate.
5866         * testsuite/arm_branch_in_range.sh: Check test results of
5867         arm_thm_jump11 and arm_thm_jump8.
5868         * testsuite/arm_thm_jump11.s: New test source file.
5869         * testsuite/arm_thm_jump11.t: New linker script.
5870         * testsuite/arm_thm_jump8.s: New test source file.
5871         * testsuite/arm_thm_jump8.t: New linker script.
5872
5873 2011-06-24  Ian Lance Taylor  <iant@google.com>
5874
5875         * layout.cc: Include "object.h".
5876         (ctors_sections_in_init_array): New static variable.
5877         (Layout::is_ctors_in_init_array): New function.
5878         (Layout::layout): Add entry to ctors_sections_in_init_array if
5879         appropriate.
5880         * layout.h (class Layout): Declare is_ctors_in_init_array.
5881         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
5882         is_ctors_reverse_view is set.
5883         (Sized_relobj_file::write_sections): Add layout parameter.  Change
5884         all callers.  Set is_ctors_reverse_view field of View_size.
5885         (Sized_relobj_file::reverse_words): New function.
5886         * object.h (Sized_relobj_file::View_size): Add
5887         is_ctors_reverse_view field.
5888         (class Sized_relobj_file): Update declarations.
5889         * testsuite/initpri3.c: New test.
5890         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
5891         initpri3b.
5892         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
5893         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
5894         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
5895         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
5896         * testsuite/Makefile.in: Rebuild.
5897
5898 2011-06-24  Cary Coutant  <ccoutant@google.com>
5899
5900         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
5901         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
5902         (debug_msg_cdebug.err): New targets.
5903         * testsuite/Makefile.in: Regenerate.
5904         * testsuite/debug_msg.sh: Check output of link with compressed debug.
5905         Fix checks for link with shared library.
5906
5907 2011-06-24  Doug Kwan  <dougkwan@google.com>
5908
5909         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
5910         skip empty text sections.
5911         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
5912
5913 2011-06-22  Ian Lance Taylor  <iant@google.com>
5914
5915         PR gold/12910
5916         * options.h (class General_options): Add --ctors-in-init-array.
5917         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
5918         friends as SHT_PROGBITS for merging sections.
5919         (Layout::layout): Remove special handling of .init_array and
5920         friends.  Don't sort if doing relocatable link.  Sort for .ctors
5921         and .dtors if ctors_in_init_array.
5922         (Layout::make_output_section): Force correct section types for
5923         .init_array and friends.  Don't sort if doing relocatable link,
5924         Don't sort .ctors and .dtors if ctors_in_init_array.
5925         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
5926         (Layout::output_section_name): Add relobj parameter.  Change all
5927         callers.  Handle .ctors. and .dtors. in code rather than table.
5928         Handle .ctors and .dtors if ctors_in_init_array.
5929         (Layout::match_file_name): New function, moved from output.cc.
5930         * layout.h (class Layout): Update declarations.
5931         * output.cc: Include "layout.h".
5932         (Input_section_sort_entry::get_priority): New function.
5933         (Input_section_sort_entry::match_file_name): Just call
5934         Layout::match_file_name.
5935         (Output_section::Input_section_sort_init_fini_compare::operator()):
5936         Handle .ctors and .dtors.  Sort by explicit priority rather than
5937         by name.
5938         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
5939         * testsuite/initpri2.c: New test.
5940         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5941         (check_PROGRAMS): Add initpri2.
5942         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5943         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5944         * configure, testsuite/Makefile.in: Rebuild.
5945
5946 2011-06-19  Ian Lance Taylor  <iant@google.com>
5947
5948         PR gold/12880
5949         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5950         .interp section to a PT_INTERP segment even if we have seen a
5951         --dynamic-linker option.  Don't do it if we have seen a PHDRS
5952         clause in a linker script.
5953         (Layout::finalize): Don't create a .interp section if we've
5954         already create a PT_INTERP segment.
5955         (Layout::create_interp): Always call choose_output_section (revert
5956         patch of 2011-06-17).  Don't create PT_INTERP segment.
5957         * script-sections.cc
5958         (Script_sections::create_note_and_tls_segments): Add a .interp
5959         section to a PT_INTERP segment even if we have seen a
5960         --dynamic-linker option.
5961
5962 2011-06-18  Ian Lance Taylor  <iant@google.com>
5963
5964         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5965         merely because a non-PT_LOAD segment has a dynamic reloc.
5966
5967 2011-06-18  Ian Lance Taylor  <iant@google.com>
5968
5969         * layout.cc (Layout::finish_dynamic_section): Don't create
5970         DT_FLAGS entry if not needed.
5971
5972 2011-06-18  Ian Lance Taylor  <iant@google.com>
5973
5974         PR gold/12745
5975         * layout.cc (Layout::layout_eh_frame): Correct handling of
5976         writable .eh_frame section.
5977
5978 2011-06-17  Ian Lance Taylor  <iant@google.com>
5979
5980         PR gold/12893
5981         * resolve.cc (Symbol_table::resolve): Don't give an error if a
5982         symbol is redefined with the exact same object and value.
5983
5984 2011-06-17  Ian Lance Taylor  <iant@google.com>
5985
5986         PR gold/12880
5987         * layout.h (class Layout): Add interp_segment_ field.
5988         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5989         (Layout::attach_allocated_section_to_segment): If making shared
5990         library, put .interp section in PT_INTERP segment.
5991         (Layout::finalize): Also call create_interp if -dynamic-linker
5992         option was used.
5993         (Layout::create_interp): Assert that there is no PT_INTERP
5994         segment.  If not using a SECTIONS clause, use make_output_section.
5995         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5996         * script-sections.cc
5997         (Script_sections::create_note_and_tls_segments): If making shared
5998         library, put .interp section in PT_INTERP segment.
5999
6000 2011-06-17  Ian Lance Taylor  <iant@google.com>
6001
6002         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
6003         when making a shared library.
6004
6005 2011-06-17  Ian Lance Taylor  <iant@google.com>
6006
6007         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
6008         parameter.  Change all callers.  Don't issue warning about PC32
6009         against locally defined symbol.
6010
6011 2011-06-16  Ian Lance Taylor  <iant@google.com>
6012
6013         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
6014         occurs in same object.
6015
6016 2011-06-14  Alan Modra  <amodra@gmail.com>
6017
6018         * po/POTFILES.in: Regenerate.
6019
6020 2011-06-09  Ian Lance Taylor  <iant@google.com>
6021
6022         * script-sections.cc
6023         (Orphan_output_section::set_section_addresses): For a relocatable
6024         link set address to 0.
6025
6026 2011-06-09  Cary Coutant  <ccoutant@google.com>
6027
6028         PR gold/12804
6029         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
6030         used with --compress-debug-sections.
6031         * gold/object.cc (Sized_relobj_file::do_layout): Report
6032         uncompressed size of compressed input sections.
6033
6034 2011-06-08  Cary Coutant  <ccoutant@google.com>
6035
6036         PR gold/12804
6037         * testsuite/two_file_test_2_v1.cc: Change initialization of
6038         v2 to keep it in .data.
6039
6040 2011-06-07  Cary Coutant  <ccoutant@google.com>
6041
6042         * common.cc (Symbol_table::do_allocate_commons_list): Call
6043         gold_fallback.
6044         * errors.cc (Errors::fatal): Adjust call to gold_exit.
6045         (Errors::fallback): New function.
6046         (gold_fallback): New function.
6047         * errors.h (Errors::fallback): New function.
6048         * gold.cc (gold_exit): Change status parameter to enum; adjust
6049         all callers.
6050         (queue_initial_tasks): Call gold_fallback.
6051         * gold.h: Include cstdlib.
6052         (Exit_status): New enum type.
6053         (gold_exit): Change status parameter to enum.
6054         (gold_fallback): New function.
6055         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
6056         (Layout::create_symtab_sections): Likewise.
6057         (Layout::create_shdrs): Likewise.
6058         * main.cc (main): Adjust call to gold_exit.
6059         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
6060         (Output_data_got::add_got_entry_pair): Likewise.
6061         (Output_section::add_input_section): Likewise.
6062         (Output_section::add_output_section_data): Likewise.
6063         (Output_segment::set_section_list_addresses): Likewise.
6064         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
6065
6066 2011-06-07  Cary Coutant  <ccoutant@google.com>
6067
6068         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
6069         for incremental links.
6070         * output.cc (Output_segment::set_section_list_addresses): Remove
6071         FIXME and test for TLS or BSS.
6072
6073 2011-06-07  Cary Coutant  <ccoutant@google.com>
6074
6075         * testsuite/Makefile.am: Add incremental_copy_test,
6076         incremental_common_test_1.
6077         * testsuite/Makefile.in: Regenerate.
6078         * testsuite/common_test_1_v1.c: New source file.
6079         * testsuite/common_test_1_v2.c: New source file.
6080         * testsuite/copy_test_v1.cc: New source file.
6081
6082 2011-06-07  Cary Coutant  <ccoutant@google.com>
6083
6084         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
6085         update, allocate common from bss section's free list.
6086         * incremental-dump.cc (dump_incremental_inputs): Print flag for
6087         linker-defined symbols.
6088         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
6089         Skip GOT and PLT entries that are no longer referenced.
6090         (Output_section_incremental_inputs::write_info_blocks): Mark
6091         linker-defined symbols.
6092         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
6093         * output.cc (Output_section::allocate): New function.
6094         * output.h (Output_section::allocate): New function.
6095         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
6096         linker-defined symbols.
6097         (Symbol::override_base_with_special): Copy is_predefined_ flag.
6098         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
6099         (Symbol::init_base_output_data): Likewise.
6100         (Symbol::init_base_output_segment): Likewise.
6101         (Symbol::init_base_constant): Likewise.
6102         (Sized_symbol::init_output_data): Likewise.
6103         (Sized_symbol::init_output_segment): Likewise.
6104         (Sized_symbol::init_constant): Likewise.
6105         (Symbol_table::do_define_in_output_data): Likewise.
6106         (Symbol_table::do_define_in_output_segment): Likewise.
6107         (Symbol_table::do_define_as_constant): Likewise.
6108         * symtab.h (Symbol::is_predefined): New function.
6109         (Symbol::init_base_output_data): Add is_predefined parameter.
6110         (Symbol::init_base_output_segment): Likewise.
6111         (Symbol::init_base_constant): Likewise.
6112         (Symbol::is_predefined_): New data member.
6113         (Sized_symbol::init_output_data): Add is_predefined parameter.
6114         (Sized_symbol::init_output_segment): Likewise.
6115         (Sized_symbol::init_constant): Likewise.
6116         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
6117
6118 2011-06-07  Cary Coutant  <ccoutant@google.com>
6119
6120         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
6121         instead of emit_copy_reloc.
6122         (Copy_relocs::emit_copy_reloc): Refactor.
6123         (Copy_relocs::make_copy_reloc): New function.
6124         (Copy_relocs::add_copy_reloc): Remove.
6125         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
6126         section.
6127         (Copy_relocs::make_copy_reloc): New function.
6128         (Copy_relocs::add_copy_reloc): Remove.
6129         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
6130         unchanged input files.
6131         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
6132         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
6133         Reserve BSS space for COPY relocations.
6134         (Sized_incremental_binary::do_emit_copy_relocs): New function.
6135         (Output_section_incremental_inputs::write_info_blocks): Record
6136         whether a symbol is copied from a shared object.
6137         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
6138         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
6139         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
6140         (Incremental_input_entry_reader::get_output_symbol_index): Add
6141         is_copy parameter.
6142         (Incremental_binary::emit_copy_relocs): New function.
6143         (Incremental_binary::do_emit_copy_relocs): New function.
6144         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6145         new data member.
6146         (Sized_incremental_binary::add_copy_reloc): New function.
6147         (Sized_incremental_binary::do_emit_copy_relocs): New function.
6148         (Sized_incremental_binary::Copy_reloc): New struct.
6149         (Sized_incremental_binary::Copy_relocs): New typedef.
6150         (Sized_incremental_binary::copy_relocs_): New data member.
6151         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
6152         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
6153         * target.h (Sized_target::emit_copy_reloc): New function.
6154         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
6155
6156 2011-06-02  Cary Coutant  <ccoutant@google.com>
6157
6158         PR gold/12163
6159         * gold/archive.cc (Archive::Archive): Initialize new data member.
6160         (Archive::include_all_members): Return if archive has already been
6161         included.
6162         * gold/archive.h (Archive::include_all_members_): New data member.
6163
6164 2011-06-02  Nick Clifton  <nickc@redhat.com>
6165
6166         * dynobj.h: Fix spelling mistake in comment.
6167         * output.cc: Likewise.
6168
6169 2011-05-31  Doug Kwan  <dougkwan@google.com>
6170             Asier Llano
6171
6172         PR gold/12826
6173         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
6174         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
6175         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
6176         redundant arm_exidx_test.so.
6177         * testsuite/Makefile.in: Regenerate.
6178         (check_SCRIPTS): Add pr12826.sh
6179         (check_DATA): Add pr12826.stdout
6180         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
6181         * testsuite/pr12826.sh: New file.
6182         * testsuite/pr12826_1.s: Ditto.
6183         * testsuite/pr12826_1.s: Ditto.
6184
6185 2011-05-30  Ian Lance Taylor  <iant@google.com>
6186
6187         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
6188         sections.
6189
6190 2011-05-29  Ian Lance Taylor  <iant@google.com>
6191
6192         PR gold/12804
6193         * testsuite/Makefile.am: Use different file name for two_file_test
6194         temporary file for each incremental test.
6195         * testsuite/Makefile.in: Rebuild.
6196
6197 2011-05-29  Ian Lance Taylor  <iant@google.com>
6198
6199         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
6200         binary input file is empty.
6201
6202 2011-05-27  Ian Lance Taylor  <iant@google.com>
6203
6204         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
6205         (ver_test_9.so): Likewise.
6206         * testsuite/Makefile.in: Rebuild.
6207
6208 2011-05-26 Cary Coutant  <ccoutant@google.com>
6209
6210         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
6211         * incremental.cc (Incremental_inputs::report_input_section): Fix
6212         comment, indentation.
6213         (Incremental_inputs::report_comdat_group): New function.
6214         (Output_section_incremental_inputs::set_final_data_size): Adjust size
6215         of data for incremental input file entry.
6216         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
6217         group count, COMDAT group signatures.
6218         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
6219         an unchanged input file.
6220         * incremental.h (Incremental_object_entry::Incremental_object_entry):
6221         Initialize new data member.
6222         (Incremental_object_entry::add_comdat_group): New function.
6223         (Incremental_object_entry::get_comdat_group_count): New function.
6224         (Incremental_object_entry::get_comdat_signature_key): New function.
6225         (Incremental_object_entry::groups_): New data member.
6226         (Incremental_inputs::report_comdat_group): New function.
6227         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
6228         data for incremental input file entry.
6229         (Incremental_input_entry_reader::get_comdat_group_count): New function.
6230         (Incremental_input_entry_reader::get_input_section): Adjust size of
6231         data for incremental input file entry.
6232         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
6233         (Incremental_input_entry_reader::get_comdat_group_signature): New
6234         function.
6235         * object.cc (Sized_relobj::include_section_group): Report kept
6236         COMDAT groups for incremental links.
6237
6238 2011-05-24  David Meyer  <pdox@google.com>
6239
6240         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
6241         with name parameter.  Add found_name parameter.
6242         * fileread.cc (Input_file::find_file): Adjust code accordingly.
6243         * dirsearch.h (class Dirsearch): Update declaration.
6244
6245 2011-05-24  Ian Lance Taylor  <iant@google.com>
6246
6247         * archive.cc (Library_base::should_include_member): Pull in object
6248         from archive if it defines the entry symbol.
6249         * parameters.cc (Parameters::entry): New function.
6250         * parameters.h (class Parameters): Declare entry.
6251         * output.h (class Output_file_header): Remove entry_ field.
6252         * output.cc (Output_file_header::Output_file_header): Remove entry
6253         parameter.  Change all callers.
6254         (Output_file_header::entry): Use parameters->entry.
6255         * gold.cc (queue_middle_tasks): Likewise.
6256         * plugin.cc (Plugin_hook::run): Likewise.
6257
6258 2011-05-24 Cary Coutant  <ccoutant@google.com>
6259
6260         * gold.cc (queue_initial_tasks): Pass incremental base filename
6261         to Output_file::open_base_file; don't print error message.
6262         * incremental-dump.cc (main): Adjust call to
6263         Output_file::open_for_modification.
6264         * incremental-dump.cc (main): Likewise.
6265         * incremental.cc (Incremental_inputs::report_command_line):
6266         Ignore --incremental-base option when comparing command lines.
6267         Ignore parameter when given as separate argument.
6268         * options.h (class General_options): Add --incremental-base.
6269         * output.cc (Output_file::Output_file):
6270         (Output_file::open_base_file): Add base_name and writable parameters;
6271         read base file into new file; print error message here.
6272         (Output_file::map_no_anonymous): Add writable parameter; adjust all
6273         callers.
6274         * output.h (Output_file::open_for_modification): Rename to...
6275         (Output_file::open_base_file): ...this; add base_name and
6276         writable parameters; adjust all callers.
6277         (Output_file::map_no_anonymous): Add writable parameter; adjust all
6278         callers.
6279         * testsuite/Makefile.am (incremental_test_4): Test
6280         --incremental-base.
6281         * testsuite/Makefile.in: Regenerate.
6282
6283 2011-05-24 Cary Coutant  <ccoutant@google.com>
6284
6285         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
6286         incremental_test_4.
6287         * testsuite/Makefile.in: Regenerate.
6288         * testsuite/two_file_test_1_v1.cc: New test source file.
6289         * testsuite/two_file_test_1b_v1.cc: New test source file.
6290         * testsuite/two_file_test_2_v1.cc: New test source file.
6291
6292 2011-05-24 Cary Coutant  <ccoutant@google.com>
6293
6294         * dynobj.h (Dynobj::do_dynobj): New function.
6295         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
6296         flag and soname for shared objects.
6297         * incremental.cc (Incremental_inputs::report_object): Make
6298         either Incremental_object_entry or Incremental_dynobj_entry; add
6299         soname to string table.
6300         (Incremental_inputs::report_input_section): Add assertion.
6301         (Output_section_incremental_inputs::set_final_data_size): Adjust
6302         type of input file entry for shared libraries; adjust size of
6303         shared library info entry.
6304         (Output_section_incremental_inputs::write_input_files): Write
6305         as_needed flag for shared libraries.
6306         (Output_section_incremental_inputs::write_info_blocks): Adjust type
6307         of input file entry for shared libraries; write soname.
6308         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
6309         soname from incremental info.
6310         * incremental.h (enum Incremental_input_flags): Add
6311         INCREMENTAL_INPUT_AS_NEEDED.
6312         (Incremental_input_entry::Incremental_input_entry): Initialize new
6313         data member.
6314         (Incremental_input_entry::set_as_needed): New function.
6315         (Incremental_input_entry::as_needed): New function.
6316         (Incremental_input_entry::do_dynobj_entry): New function.
6317         (Incremental_input_entry::as_needed_): New data member.
6318         (Incremental_object_entry::Incremental_object_entry): Don't check
6319         for shared library.
6320         (Incremental_object_entry::do_type): Likewise.
6321         (class Incremental_dynobj_entry): New class.
6322         (Incremental_input_entry_reader::as_needed): New function.
6323         (Incremental_input_entry_reader::get_soname): New function.
6324         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
6325         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
6326         size of shared library info entry.
6327         * layout.cc (Layout::finish_dynamic_section): Don't test for
6328         incremental link when adding DT_NEEDED entries.
6329         * object.h (Object::Object): Initialize new data member.
6330         (Object::dynobj): New function.
6331         (Object::set_as_needed): New function.
6332         (Object::as_needed): New function.
6333         (Object::do_dynobj): New function.
6334         (Object::as_needed_): New data member.
6335
6336 2011-05-24 Cary Coutant  <ccoutant@google.com>
6337
6338         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
6339         info; adjust display of GOT entries.
6340         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6341         vector of input objects; remove file_status_.
6342         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
6343         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
6344         got_plt reader; call target hooks to reserve GOT entries.
6345         (Output_section_incremental_inputs::set_final_data_size): Adjust size
6346         of input file info header and GOT info entry.
6347         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
6348         relocation info.
6349         (Got_plt_view_info::got_descriptor): Remove.
6350         (Got_plt_view_info::sym_index): New data member.
6351         (Got_plt_view_info::input_index): New data member.
6352         (Local_got_offset_visitor::visit): Write input file index.
6353         (Global_got_offset_visitor::visit): Write 0 for input file index.
6354         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
6355         with sym_index and input_index.
6356         (Output_section_incremental_inputs::write_got_plt): Adjust size of
6357         incremental info GOT entry; replace got_descriptor with input_index.
6358         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
6359         map from input file index to object.
6360         (Sized_relobj_incr::do_layout): Replace direct data member reference
6361         with accessor function.
6362         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
6363         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
6364         Adjust size of input file info header.
6365         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
6366         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
6367         (Incremental_input_entry_reader::get_input_section): Adjust size of
6368         input file info header.
6369         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
6370         of incremental info GOT entry.
6371         (Incremental_got_plt_reader::get_got_desc): Remove.
6372         (Incremental_got_plt_reader::get_got_symndx): New function.
6373         (Incremental_got_plt_reader::get_got_input_index): New function.
6374         (Sized_incremental_binary::Sized_incremental_binary): Remove
6375         file_status_; add input_objects_.
6376         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
6377         (Sized_incremental_binary::set_file_is_unchanged): Remove.
6378         (Sized_incremental_binary::file_is_unchanged): Remove.
6379         (Sized_incremental_binary::set_input_object): New function.
6380         (Sized_incremental_binary::input_object): New function.
6381         (Sized_incremental_binary::file_status_): Remove.
6382         (Sized_incremental_binary::input_objects_): New data member.
6383         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
6384         references.
6385         (Sized_relobj_incr::invalid_address): Move to base class.
6386         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
6387         class.
6388         (Sized_relobj_incr::do_output_section_offset): Likewise.
6389         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
6390         (Sized_relobj_incr::section_offsets_): Likewise.
6391         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
6392         function.
6393         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
6394         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
6395         with accessor function.
6396         (Sized_relobj_file::do_layout): Likewise.
6397         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
6398         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
6399         (Sized_relobj_file::compute_final_local_value): Replace refs to
6400         section_offsets_ with accessor function.
6401         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
6402         * object.h (Relobj::Relobj): Initialize new data members.
6403         (Relobj::add_dyn_reloc): New function.
6404         (Relobj::first_dyn_reloc): New function.
6405         (Relobj::dyn_reloc_count): New function.
6406         (Relobj::first_dyn_reloc_): New data member.
6407         (Relobj::dyn_reloc_count_): New data member.
6408         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
6409         references.
6410         (Sized_relobj::Address): New typedef.
6411         (Sized_relobj::invalid_address): Move here from child class.
6412         (Sized_relobj::Sized_relobj): Initialize new data members.
6413         (Sized_relobj::sized_relobj): New function.
6414         (Sized_relobj::is_output_section_offset_invalid): Move here from
6415         child class.
6416         (Sized_relobj::get_output_section_offset): Likewise.
6417         (Sized_relobj::local_has_got_offset): Likewise.
6418         (Sized_relobj::local_got_offset): Likewise.
6419         (Sized_relobj::set_local_got_offset): Likewise.
6420         (Sized_relobj::do_for_all_local_got_entries): Likewise.
6421         (Sized_relobj::clear_got_offsets): New function.
6422         (Sized_relobj::section_offsets): Move here from child class.
6423         (Sized_relobj::do_output_section_offset): Likewise.
6424         (Sized_relobj::do_set_section_offset): Likewise.
6425         (Sized_relobj::Local_got_offsets): Likewise.
6426         (Sized_relobj::local_got_offsets_): Likewise.
6427         (Sized_relobj::section_offsets_): Likewise.
6428         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
6429         references.
6430         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
6431         class.
6432         (Sized_relobj_file::sized_relobj): New function
6433         (Sized_relobj_file::local_has_got_offset): Move to base class.
6434         (Sized_relobj_file::local_got_offset): Likewise.
6435         (Sized_relobj_file::set_local_got_offset): Likewise.
6436         (Sized_relobj_file::get_output_section_offset): Likewise.
6437         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
6438         (Sized_relobj_file::do_output_section_offset): Likewise.
6439         (Sized_relobj_file::do_set_section_offset): Likewise.
6440         (Sized_relobj_file::Local_got_offsets): Likewise.
6441         (Sized_relobj_file::local_got_offsets_): Likewise.
6442         (Sized_relobj_file::section_offsets_): Likewise.
6443         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
6444         (all constructors).
6445         (set_needs_dynsym_index): Convert relobj to derived class pointer.
6446         (Output_reloc::get_symbol_index): Likewise.
6447         (Output_reloc::local_section_offset): Likewise.
6448         (Output_reloc::get_address): Likewise.
6449         (Output_reloc::symbol_value): Likewise.
6450         (Output_data_got::reserve_slot): Move to class definition.
6451         (Output_data_got::reserve_local): New function.
6452         (Output_data_got::reserve_slot_for_global): Remove.
6453         (Output_data_got::reserve_global): New function.
6454         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
6455         (all constructors, two instantiations).
6456         (Output_reloc::get_relobj): New function (two instantiations).
6457         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
6458         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
6459         (Output_data_reloc::add_global): Adjust type of relobj.
6460         (Output_data_reloc::add_global_relative): Likewise.
6461         (Output_data_reloc::add_symbolless_global_addend): Likewise.
6462         (Output_data_reloc::add_local): Likewise.
6463         (Output_data_reloc::add_local_relative): Likewise.
6464         (Output_data_reloc::add_symbolless_local_addend): Likewise.
6465         (Output_data_reloc::add_local_section): Likewise.
6466         (Output_data_reloc::add_output_section): Likewise.
6467         (Output_data_reloc::add_absolute): Likewise.
6468         (Output_data_reloc::add_target_specific): Likewise.
6469         (Output_data_got::reserve_slot): Move definition here.
6470         (Output_data_got::reserve_local): New function.
6471         (Output_data_got::reserve_global): New function.
6472         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
6473         section_offsets_ with accessor function.
6474         (Sized_relobj_file::write_sections): Likewise.
6475         (Sized_relobj_file::do_relocate_sections): Likewise.
6476         * target.h (Sized_target::reserve_local_got_entry): New function.
6477         (Sized_target::reserve_global_got_entry): New function.
6478         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
6479         (Target_x86_64::reserve_global_got_entry): New function.
6480         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
6481
6482 2011-05-23 Cary Coutant  <ccoutant@google.com>
6483
6484         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
6485         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
6486         bit when checking got_type.
6487         * incremental.cc (Sized_incremental_binary::setup_readers):
6488         Store symbol table and string table locations; initialize bit vector
6489         of file status flags.
6490         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
6491         unchanged files.
6492         (Sized_incremental_binary::do_process_got_plt): New function.
6493         (Sized_incremental_binary::get_symtab_view): Use stored locations.
6494         (Output_section_incremental_inputs::set_final_data_size): Record
6495         file index for each input file.
6496         (Output_section_incremental_inputs::write_got_plt): Store file index
6497         instead of input entry offset for each GOT entry.
6498         * incremental.h
6499         (Incremental_input_entry::Incremental_input_entry): Initialize new
6500         data member.
6501         (Incremental_input_entry::set_offset): Store file index.
6502         (Incremental_input_entry::get_file_index): New function.
6503         (Incremental_input_entry::file_index_): New data member.
6504         (Incremental_binary::process_got_plt): New function.
6505         (Incremental_binary::do_process_got_plt): New function.
6506         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6507         data members.
6508         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
6509         (Sized_incremental_binary::set_file_is_unchanged): New function.
6510         (Sized_incremental_binary::file_is_unchanged): New function.
6511         (Sized_incremental_binary::do_process_got_plt): New function.
6512         (Sized_incremental_binary::file_status_): New data member.
6513         (Sized_incremental_binary::main_symtab_loc_): New data member.
6514         (Sized_incremental_binary::main_strtab_loc_): New data member.
6515         * output.cc (Output_data_got::Got_entry::write): Add case
6516         RESERVED_CODE.
6517         (Output_data_got::add_global): Call add_got_entry.
6518         (Output_data_got::add_global_plt): Likewise.
6519         (Output_data_got::add_global_with_rel): Likewise.
6520         (Output_data_got::add_global_with_rela): Likewise.
6521         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
6522         (Output_data_got::add_global_pair_with_rela): Likewise.
6523         (Output_data_got::add_local): Call add_got_entry.
6524         (Output_data_got::add_local_plt): Likewise.
6525         (Output_data_got::add_local_with_rel): Likewise.
6526         (Output_data_got::add_local_with_rela): Likewise.
6527         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
6528         (Output_data_got::add_local_pair_with_rela): Likewise.
6529         (Output_data_got::reserve_slot): New function.
6530         (Output_data_got::reserve_slot_for_global): New function.
6531         (Output_data_got::add_got_entry): New function.
6532         (Output_data_got::add_got_entry_pair): New function.
6533         (Output_section::add_output_section_data): Edit FIXME.
6534         * output.h
6535         (Output_section_data_build::Output_section_data_build): New
6536         constructor with size parameter.
6537         (Output_data_space::Output_data_space): Likewise.
6538         (Output_data_got::Output_data_got): Initialize new data member; new
6539         constructor with size parameter.
6540         (Output_data_got::add_constant): Call add_got_entry.
6541         (Output_data_got::reserve_slot): New function.
6542         (Output_data_got::reserve_slot_for_global): New function.
6543         (class Output_data_got::Got_entry): Add RESERVED_CODE.
6544         (Output_data_got::add_got_entry): New function.
6545         (Output_data_got::add_got_entry_pair): New function.
6546         (Output_data_got::free_list_): New data member.
6547         * target.h (Sized_target::init_got_plt_for_update): New function.
6548         (Sized_target::register_global_plt_entry): New function.
6549         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
6550         Initialize new data member; call init; add constructor with PLT count.
6551         (Output_data_plt_x86_64::init): New function.
6552         (Output_data_plt_x86_64::add_relocation): New function.
6553         (Output_data_plt_x86_64::reserve_slot): New function.
6554         (Output_data_plt_x86_64::free_list_): New data member.
6555         (Target_x86_64::init_got_plt_for_update): New function.
6556         (Target_x86_64::register_global_plt_entry): New function.
6557         (Output_data_plt_x86_64::add_entry): Allocate from free list for
6558         incremental updates.
6559         (Output_data_plt_x86_64::add_relocation): New function.
6560         * testsuite/object_unittest.cc (Object_test): Set default options.
6561
6562 2011-05-16  Ian Lance Taylor  <iant@google.com>
6563
6564         * options.h (class General_options): Make -i a synonym for -r.
6565
6566 2011-05-16  Ian Lance Taylor  <iant@google.com>
6567
6568         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
6569
6570 2011-05-10 Cary Coutant  <ccoutant@google.com>
6571
6572         * object.cc (Sized_relobj::do_count_local_symbols): Check for
6573         strip_all (-s).
6574
6575 2011-05-06  Ian Lance Taylor  <iant@google.com>
6576
6577         * layout.cc (Layout::layout): If the output section flags change,
6578         update the ordering.
6579
6580 2011-04-25 Cary Coutant  <ccoutant@google.com>
6581
6582         * incremental-dump.cc (dump_incremental_inputs): Print local
6583         symbol info for each input file.
6584         * incremental.cc
6585         (Output_section_incremental_inputs::set_final_data_size): Add local
6586         symbol info to input file entries in incremental info.
6587         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6588         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
6589         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
6590         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
6591         implementation.
6592         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
6593         (Sized_incr_relobj::do_relocate): Write the local symbols.
6594         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
6595         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
6596         Adjust size of input file header.
6597         (Incremental_inputs_reader::get_local_symbol_offset): New function.
6598         (Incremental_inputs_reader::get_local_symbol_count): New function.
6599         (Incremental_inputs_reader::get_input_section): Adjust size of input
6600         file header.
6601         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
6602         (Sized_incr_relobj::This): New typedef.
6603         (Sized_incr_relobj::sym_size): New const data member.
6604         (Sized_incr_relobj::Local_symbol): New struct.
6605         (Sized_incr_relobj::do_output_local_symbol_count): New function.
6606         (Sized_incr_relobj::do_local_symbol_offset): New function.
6607         (Sized_incr_relobj::local_symbol_count_): New data member.
6608         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
6609         (Sized_incr_relobj::local_symbol_index_): New data member.
6610         (Sized_incr_relobj::local_symbol_offset_): New data member.
6611         (Sized_incr_relobj::local_dynsym_offset_): New data member.
6612         (Sized_incr_relobj::local_symbols_): New data member.
6613         * object.h (Relobj::output_local_symbol_count): New function.
6614         (Relobj::local_symbol_offset): New function.
6615         (Relobj::do_output_local_symbol_count): New function.
6616         (Relobj::do_local_symbol_offset): New function.
6617         (Sized_relobj::do_output_local_symbol_count): New function.
6618         (Sized_relobj::do_local_symbol_offset): New function.
6619
6620 2011-04-22  Vladimir Simonov  <sv@sw.ru>
6621
6622         * descriptors.cc (set_close_on_exec): New function.
6623         (Descriptors::open): Use set_close_on_exec.
6624         * output.cc (S_ISLNK): Define if not defined.
6625
6626 2011-04-22 Cary Coutant  <ccoutant@google.com>
6627
6628         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6629         global symbol map.
6630         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6631         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
6632         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
6633         relocations.
6634         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
6635         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
6636         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
6637         * incremental.h
6638         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
6639         function.
6640         (Incremental_binary::apply_incremental_relocs): New function.
6641         (Incremental_binary::do_apply_incremental_relocs): New function.
6642         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6643         data member.
6644         (Sized_incremental_binary::add_global_symbol): New function.
6645         (Sized_incremental_binary::global_symbol): New function.
6646         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6647         (Sized_incremental_binary::symbol_map_): New data member.
6648         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
6649         * target.h (Sized_target::apply_relocation): New function.
6650         * target-reloc.h (apply_relocation): New function.
6651         * x86_64.cc (Target_x86_64::apply_relocation): New function.
6652
6653 2011-04-22  Doug Kwan  <dougkwan@google.com>
6654
6655         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
6656         flag of a SHT_ARM_EXIDX section.
6657         * testsuite/Makefile.am (arm_exidx_test): New test rules.
6658         * testsuite/Makefile.in: Regenerate.
6659         * testsuite/arm_exidx_test.s: New file.
6660         * testsuite/arm_exidx_test.sh: Same.
6661
6662 2011-04-20 Cary Coutant  <ccoutant@google.com>
6663
6664         PR gold/12689
6665         * archive.h (Incremental_archive_entry::Archive_member):
6666         Initialize arg_serial_ (second constructor).
6667
6668 2011-04-17  Ian Lance Taylor  <iant@google.com>
6669
6670         * object.cc (Relocate_info::location): Simplify location string.
6671         * errors.cc (Errors::error_at_location): Don't print program
6672         name.
6673         (Errors::warning_at_location): Likewise.
6674         (Errors::undefined_symbol): Likewise.
6675         * testsuite/debug_msg.sh: Update accordingly.
6676
6677 2011-04-14 Cary Coutant  <ccoutant@google.com>
6678
6679         * gold/layout.cc (Layout::symtab_section_offset): New function.
6680         * gold/layout.h (Layout::symtab_section_offset): New function.
6681         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
6682
6683 2011-04-12  Ian Lance Taylor  <iant@google.com>
6684
6685         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
6686         with MREMAP_MAYMOVE.
6687         * output.h (class Output_file): Add map_is_allocated_ field.
6688         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
6689         not available, provide stubs.  If mremap is not available, #define
6690         it to gold_mremap.
6691         (MREMAP_MAYMOVE): Define if not defined.
6692         (Output_file::Output_file): Initialize map_is_allocated_.
6693         (Output_file::resize): Check map_is_allocated_.
6694         (Output_file::map_anonymous): If mmap fails, use malloc.
6695         (Output_file::unmap): Don't do anything for an anonymous map.
6696         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
6697         is not available, provide stubs.
6698         (File_read::View::~View): Use free rather than delete[].
6699         (File_read::make_view): Use malloc rather than new[].  If mmap
6700         fails, use malloc.
6701         (File_read::find_or_make_view): Use malloc rather than new[].
6702         * gold.h: Remove HAVE_REMAP code.
6703         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
6704         exists.  Rename mremap to gold_mremap.  If mmap is not available
6705         don't do anything.
6706         * configure, config.in: Rebuild.
6707
6708 2011-04-11  Ian Lance Taylor  <iant@google.com>
6709
6710         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
6711         initialize local variable v.
6712
6713 2011-04-11  Cary Coutant  <ccoutant@google.com>
6714
6715         * archive.cc (Archive::include_member): Adjust call to
6716         report_object.
6717         (Add_archive_symbols::run): Track argument serial numbers.
6718         (Lib_group::include_member): Likewise.
6719         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
6720         * archive.h (Incremental_archive_entry::Archive_member):
6721         Initialize arg_serial_.
6722         (Archive_member::arg_serial_): New data member.
6723         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
6724         (Sized_dynobj::do_add_symbols): Track symbols when doing an
6725         incremental link.
6726         (Sized_dynobj::do_for_all_local_got_entries): New function.
6727         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
6728         function.
6729         * fileread.cc (get_mtime): New function.
6730         * fileread.h (get_mtime): New function.
6731         * gold.cc (queue_initial_tasks): Check for incremental update.
6732         (process_incremental_input): New function.
6733         (queue_middle_tasks): Don't force valid target for incremental
6734         update.
6735         * incremental-dump.cc (find_input_containing_global): Adjust
6736         size of symbol info entry.
6737         (dump_incremental_inputs): Dump argument serial number and
6738         in_system_directory flag; bias shndx by 1; print symbol names
6739         when dumping per-file symbol lists; use new symbol info readers.
6740         * incremental.cc
6741         (Output_section_incremental_inputs:update_data_size): New function.
6742         (Sized_incremental_binary::setup_readers): Setup input readers
6743         for each input file; build maps for files added from libraries
6744         and scripts.
6745         (Sized_incremental_binary::check_input_args): New function.
6746         (Sized_incremental_binary::do_check_inputs): Build map of argument
6747         serial numbers to input arguments.
6748         (Sized_incremental_binary::do_file_has_changed): Rename
6749         do_file_is_unchanged to this; compare file modification times.
6750         (Sized_incremental_binary::do_init_layout): New function.
6751         (Sized_incremental_binary::do_reserve_layout): New function.
6752         (Sized_incremental_binary::do_get_input_reader): Remove.
6753         (Sized_incremental_binary::get_symtab_view): New function.
6754         (Incremental_checker::can_incrementally_link_output_file): Remove.
6755         (Incremental_inputs::report_command_line): Exclude --debug options.
6756         (Incremental_inputs::report_archive_begin): Add parameter; track
6757         argument serial numbers; don't put input file entry for archive
6758         before archive members.
6759         (Incremental_inputs::report_archive_end): Put input file entry
6760         for archive after archive members.
6761         (Incremental_inputs::report_object): Add parameter; track argument
6762         serial numbers and in_system_directory flag.
6763         (Incremental_inputs::report_script): Add parameter; track argument
6764         serial numbers.
6765         (Output_section_incremental_inputs::set_final_data_size): Adjust
6766         size of symbol info entry; check for forwarding symbols.
6767         (Output_section_incremental_inputs::write_input_files): Write
6768         in_system_directory flag and argument serial number.
6769         (Output_section_incremental_inputs::write_info_blocks): Map section
6770         indices between incremental info and original input file; store
6771         input section index for each symbol.
6772         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
6773         change operator() to visit().
6774         (class Global_got_offset_visitor): Likewise.
6775         (class Global_symbol_visitor_got_plt):
6776         (Output_section_incremental_inputs::write_got_plt): Use new visitor
6777         classes.
6778         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
6779         (Sized_incr_relobj::do_read_symbols): New function.
6780         (Sized_incr_relobj::do_layout): New function.
6781         (Sized_incr_relobj::do_layout_deferred_sections): New function.
6782         (Sized_incr_relobj::do_add_symbols): New function.
6783         (Sized_incr_relobj::do_should_include_member): New function.
6784         (Sized_incr_relobj::do_for_all_global_symbols): New function.
6785         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
6786         (Sized_incr_relobj::do_section_size): New function.
6787         (Sized_incr_relobj::do_section_name): New function.
6788         (Sized_incr_relobj::do_section_contents): New function.
6789         (Sized_incr_relobj::do_section_flags): New function.
6790         (Sized_incr_relobj::do_section_entsize): New function.
6791         (Sized_incr_relobj::do_section_address): New function.
6792         (Sized_incr_relobj::do_section_type): New function.
6793         (Sized_incr_relobj::do_section_link): New function.
6794         (Sized_incr_relobj::do_section_info): New function.
6795         (Sized_incr_relobj::do_section_addralign): New function.
6796         (Sized_incr_relobj::do_initialize_xindex): New function.
6797         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
6798         (Sized_incr_relobj::do_read_relocs): New function.
6799         (Sized_incr_relobj::do_gc_process_relocs): New function.
6800         (Sized_incr_relobj::do_scan_relocs): New function.
6801         (Sized_incr_relobj::do_count_local_symbols): New function.
6802         (Sized_incr_relobj::do_finalize_local_symbols): New function.
6803         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
6804         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
6805         (Sized_incr_relobj::do_relocate): New function.
6806         (Sized_incr_relobj::do_set_section_offset): New function.
6807         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
6808         (Sized_incr_dynobj::do_read_symbols): New function.
6809         (Sized_incr_dynobj::do_layout): New function.
6810         (Sized_incr_dynobj::do_add_symbols): New function.
6811         (Sized_incr_dynobj::do_should_include_member): New function.
6812         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
6813         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
6814         (Sized_incr_dynobj::do_section_size): New function.
6815         (Sized_incr_dynobj::do_section_name): New function.
6816         (Sized_incr_dynobj::do_section_contents): New function.
6817         (Sized_incr_dynobj::do_section_flags): New function.
6818         (Sized_incr_dynobj::do_section_entsize): New function.
6819         (Sized_incr_dynobj::do_section_address): New function.
6820         (Sized_incr_dynobj::do_section_type): New function.
6821         (Sized_incr_dynobj::do_section_link): New function.
6822         (Sized_incr_dynobj::do_section_info): New function.
6823         (Sized_incr_dynobj::do_section_addralign): New function.
6824         (Sized_incr_dynobj::do_initialize_xindex): New function.
6825         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
6826         (make_sized_incremental_object): New function.
6827         (Incremental_library::copy_unused_symbols): New function.
6828         (Incremental_library::do_for_all_unused_symbols): New function.
6829         * incremental.h (enum Incremental_input_flags): New type.
6830         (class Incremental_checker): Remove.
6831         (Incremental_input_entry::Incremental_input_entry): Add argument
6832         serial number.
6833         (Incremental_input_entry::arg_serial): New function.
6834         (Incremental_input_entry::set_is_in_system_directory): New function.
6835         (Incremental_input_entry::is_in_system_directory): New function.
6836         (Incremental_input_entry::arg_serial_): New data member.
6837         (Incremental_input_entry::is_in_system_directory_): New data member.
6838         (class Script_info): Move here from script.h.
6839         (Script_info::Script_info): Add filename parameter.
6840         (Script_info::filename): New function.
6841         (Script_info::filename_): New data member.
6842         (Incremental_script_entry::Incremental_script_entry): Add argument
6843         serial number.
6844         (Incremental_object_entry::Incremental_object_entry): Likewise.
6845         (Incremental_object_entry::add_input_section): Build list of input
6846         sections with map to original shndx.
6847         (Incremental_object_entry::get_input_section_index): New function.
6848         (Incremental_object_entry::shndx_): New data member.
6849         (Incremental_object_entry::name_key_): Rename; adjust all refs.
6850         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
6851         (Incremental_archive_entry::Incremental_archive_entry): Add argument
6852         serial number.
6853         (Incremental_inputs::report_archive_begin): Likewise.
6854         (Incremental_inputs::report_object): Likewise.
6855         (Incremental_inputs::report_script): Likewise.
6856         (class Incremental_global_symbol_reader): New class.
6857         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
6858         and store flags and input file type.
6859         (Incremental_input_entry_reader::arg_serial): New function.
6860         (Incremental_input_entry_reader::type): Extract type from flags.
6861         (Incremental_input_entry_reader::is_in_system_directory): New function.
6862         (Incremental_input_entry_reader::get_input_section_count): Call
6863         accessor function for type.
6864         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
6865         function for type; adjust size of global symbol entry.
6866         (Incremental_input_entry_reader::get_global_symbol_count): Call
6867         accessor function for type.
6868         (Incremental_input_entry_reader::get_object_count): Likewise.
6869         (Incremental_input_entry_reader::get_object_offset): Likewise.
6870         (Incremental_input_entry_reader::get_member_count): Likewise.
6871         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
6872         (Incremental_input_entry_reader::get_member_offset): Likewise.
6873         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
6874         (Incremental_input_entry_reader::Global_symbol_info): Remove.
6875         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
6876         (Incremental_input_entry_reader::get_global_symbol_reader): New
6877         function.
6878         (Incremental_input_entry_reader::get_output_symbol_index): New
6879         function.
6880         (Incremental_input_entry_reader::type_): Remove.
6881         (Incremental_input_entry_reader::flags_): New data member.
6882         (Incremental_inputs_reader::input_file_offset): New function.
6883         (Incremental_inputs_reader::input_file_index): New function.
6884         (Incremental_inputs_reader::input_file): Call input_file_offset.
6885         (Incremental_inputs_reader::input_file_at_offset): New function.
6886         (Incremental_relocs_reader::get_r_type): Reformat.
6887         (Incremental_relocs_reader::get_r_shndx): Reformat.
6888         (Incremental_relocs_reader::get_r_offset): Reformat.
6889         (Incremental_relocs_reader::data): New function.
6890         (Incremental_binary::Incremental_binary): Initialize new data members.
6891         (Incremental_binary::check_inputs): Add cmdline parameter.
6892         (Incremental_binary::file_is_unchanged): Remove.
6893         (Input_reader::arg_serial): New function.
6894         (Input_reader::get_unused_symbol_count): New function.
6895         (Input_reader::get_unused_symbol): New function.
6896         (Input_reader::do_arg_serial): New function.
6897         (Input_reader::do_get_unused_symbol_count): New function.
6898         (Input_reader::do_get_unused_symbol): New function.
6899         (Incremental_binary::input_file_count): New function.
6900         (Incremental_binary::get_input_reader): Change signature to use
6901         index instead of filename.
6902         (Incremental_binary::file_has_changed): New function.
6903         (Incremental_binary::get_input_argument): New function.
6904         (Incremental_binary::get_library): New function.
6905         (Incremental_binary::get_script_info): New function.
6906         (Incremental_binary::init_layout): New function.
6907         (Incremental_binary::reserve_layout): New function.
6908         (Incremental_binary::output_file): New function.
6909         (Incremental_binary::do_check_inputs): New function.
6910         (Incremental_binary::do_file_is_unchanged): Remove.
6911         (Incremental_binary::do_file_has_changed): New function.
6912         (Incremental_binary::do_init_layout): New function.
6913         (Incremental_binary::do_reserve_layout): New function.
6914         (Incremental_binary::do_input_file_count): New function.
6915         (Incremental_binary::do_get_input_reader): Change signature.
6916         (Incremental_binary::input_args_map_): New data member.
6917         (Incremental_binary::library_map_): New data member.
6918         (Incremental_binary::script_map_): New data member.
6919         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6920         new data members.
6921         (Sized_incremental_binary::output_section): New function.
6922         (Sized_incremental_binary::inputs_reader): Add const.
6923         (Sized_incremental_binary::symtab_reader): Add const.
6924         (Sized_incremental_binary::relocs_reader): Add const.
6925         (Sized_incremental_binary::got_plt_reader): Add const.
6926         (Sized_incremental_binary::get_symtab_view): New function.
6927         (Sized_incremental_binary::Inputs_reader): New typedef.
6928         (Sized_incremental_binary::Input_entry_reader): New typedef.
6929         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
6930         (Sized_incremental_binary::do_file_is_unchanged): Remove.
6931         (Sized_incremental_binary::do_file_has_changed): New function.
6932         (Sized_incremental_binary::do_init_layout): New function.
6933         (Sized_incremental_binary::do_reserve_layout): New function.
6934         (Sized_input_reader::Inputs_reader): Remove.
6935         (Sized_input_reader::Input_entry_reader): Remove.
6936         (Sized_input_reader::do_arg_serial): New function.
6937         (Sized_input_reader::do_get_unused_symbol_count): New function.
6938         (Sized_input_reader::do_get_unused_symbol): New function.
6939         (Sized_incremental_binary::do_input_file_count): New function.
6940         (Sized_incremental_binary::do_get_input_reader): Change signature;
6941         use index instead of filename.
6942         (Sized_incremental_binary::section_map_): New data member.
6943         (Sized_incremental_binary::input_entry_readers_): New data member.
6944         (class Sized_incr_relobj): New class.
6945         (class Sized_incr_dynobj): New class.
6946         (make_sized_incremental_object): New function.
6947         (class Incremental_library): New class.
6948         * layout.cc (Free_list::num_lists): New static data member.
6949         (Free_list::num_nodes): New static data member.
6950         (Free_list::num_removes): New static data member.
6951         (Free_list::num_remove_visits): New static data member.
6952         (Free_list::num_allocates): New static data member.
6953         (Free_list::num_allocate_visits): New static data member.
6954         (Free_list::init): New function.
6955         (Free_list::remove): New function.
6956         (Free_list::allocate): New function.
6957         (Free_list::dump): New function.
6958         (Free_list::print_stats): New function.
6959         (Layout_task_runner::run): Resize output file for incremental updates.
6960         (Layout::Layout): Initialize new data members.
6961         (Layout::set_incremental_base): New function.
6962         (Layout::init_fixed_output_section): New function.
6963         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6964         incremental updates.
6965         (Layout::create_gold_note): Do not create gold note section for
6966         incremental updates.
6967         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6968         for incremental updates.
6969         (Layout::set_section_offsets): For incremental updates, allocate space
6970         from free list.
6971         (Layout::create_symtab_sections): Layout with offsets relative to
6972         start of section; for incremental updates, allocate space from free
6973         list.
6974         (Layout::create_shdrs): For incremental updates, allocate space from
6975         free list.
6976         (Layout::finish_dynamic_section): For incremental updates, do not
6977         check --as-needed (fixed in subsequent patch).
6978         * layout.h (class Free_list): New class.
6979         (Layout::set_incremental_base): New function.
6980         (Layout::incremental_base): New function.
6981         (Layout::init_fixed_output_section): New function.
6982         (Layout::allocate): New function.
6983         (Layout::incremental_base_): New data member.
6984         (Layout::free_list_): New data member.
6985         * main.cc (main): Print Free_list statistics.
6986         * object.cc (Relobj::finalize_incremental_relocs): Add
6987         clear_counts parameter; clear counts only when clear_counts is set.
6988         (Sized_relobj::Sized_relobj): Initialize new base class.
6989         (Sized_relobj::do_layout): Don't report special sections.
6990         (Sized_relobj::do_for_all_local_got_entries): New function.
6991         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6992         symtab_off to all symbol table offsets.
6993         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6994         * object.h (class Got_offset_list): Move to top of file.
6995         (Object::Object): Allow case where input_file == NULL.
6996         (Object::~Object): Likewise.
6997         (Object::input_file): Assert that input_file != NULL.
6998         (Object::lock): Allow case where input_file == NULL.
6999         (Object::unlock): Likewise.
7000         (Object::is_locked): Likewise.
7001         (Object::token): Likewise.
7002         (Object::release): Likewise.
7003         (Object::is_incremental): New function.
7004         (Object::get_mtime): New function.
7005         (Object::for_all_local_got_entries): New function.
7006         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
7007         (Object::set_is_in_system_directory): New function.
7008         (Object::is_in_system_directory): New function.
7009         (Object::do_is_incremental): New function.
7010         (Object::do_get_mtime): New function.
7011         (Object::do_for_all_local_got_entries): New function.
7012         (Object::is_in_system_directory_): New data member.
7013         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
7014         (class Sized_relobj_base): New class.
7015         (class Sized_relobj): Derive from Sized_relobj_base.
7016         (class Sized_relobj::Symbols): Redeclare from base class.
7017         (class Sized_relobj::local_got_offset_list): Remove.
7018         (class Sized_relobj::Output_sections): Redeclare from base class.
7019         (class Sized_relobj::do_for_all_local_got_entries): New function.
7020         (class Sized_relobj::write_local_symbols): Add offset parameter.
7021         (class Sized_relobj::local_symbol_offset_): Update comment.
7022         (class Sized_relobj::local_dynsym_offset_): Update comment.
7023         * options.cc (Input_arguments::add_file): Remove const.
7024         * options.h (Input_file_argument::Input_file_argument):
7025         Initialize arg_serial_ (all constructors).
7026         (Input_file_argument::set_arg_serial): New function.
7027         (Input_file_argument::arg_serial): New function.
7028         (Input_file_argument::arg_serial_): New data member.
7029         (Input_arguments::Input_arguments): Initialize file_count_.
7030         (Input_arguments::add_file): Remove const.
7031         (Input_arguments::number_of_input_files): New function.
7032         (Input_arguments::file_count_): New data member.
7033         (Command_line::number_of_input_files): Call
7034         Input_arguments::number_of_input_files.
7035         * output.cc (Output_segment_headers::Output_segment_headers):
7036         Set current size.
7037         (Output_section::Input_section::current_data_size): New function.
7038         (Output_section::Output_section): Initialize new data members.
7039         (Output_section::add_input_section): Don't do merge sections for
7040         an incremental link; allocate space from free list for an
7041         incremental update.
7042         (Output_section::add_output_section_data): Allocate space from
7043         free list for an incremental update.
7044         (Output_section::update_data_size): New function.
7045         (Output_section::set_fixed_layout): New function.
7046         (Output_section::reserve): New function.
7047         (Output_segment::set_section_addresses): Remove const.
7048         (Output_segment::set_section_list_addresses): Remove const; allocate
7049         space from free list for an incremental update.
7050         (Output_segment::set_offset): Adjust size of RELRO segment for an
7051         incremental update.
7052         * output.h (Output_data::current_data_size): Move here from
7053         child classes.
7054         (Output_data::pre_finalize_data_size): New function.
7055         (Output_data::update_data_size): New function.
7056         (Output_section_headers::update_data_size): new function.
7057         (Output_section_data_build::current_data_size): Move to Output_data.
7058         (Output_data_strtab::update_data_size): New function.
7059         (Output_section::current_data_size): Move to Output_data.
7060         (Output_section::set_fixed_layout): New function.
7061         (Output_section::has_fixed_layout): New function.
7062         (Output_section::reserve): New function.
7063         (Output_section::update_data_size): New function.
7064         (Output_section::has_fixed_layout_): New data member.
7065         (Output_section::free_list_): New data member.
7066         (Output_segment::set_section_addresses): Remove const.
7067         (Output_segment::set_section_list_addresses): Remove const.
7068         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
7069         New function.
7070         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
7071         New function.
7072         * readsyms.cc (Read_symbols::do_read_symbols): Add library
7073         parameter when calling Add_symbols constructor; store argument
7074         serial number for members of a lib group.
7075         (Add_symbols::locks): Allow case where token == NULL.
7076         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
7077         (Read_member::~Read_member): New function.
7078         (Read_member::is_runnable): New function.
7079         (Read_member::locks): New function.
7080         (Read_member::run): New function.
7081         (Check_script::~Check_script): New function.
7082         (Check_script::is_runnable): New function.
7083         (Check_script::locks): New function.
7084         (Check_script::run): New function.
7085         (Check_library::~Check_library): New function.
7086         (Check_library::is_runnable): New function.
7087         (Check_library::locks): New function.
7088         (Check_library::run): New function.
7089         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
7090         (Add_symbols::library_): New data member.
7091         (class Read_member): New class.
7092         (class Check_script): New class.
7093         (class Check_library): New class.
7094         * reloc.cc (Read_relocs::is_runnable): Allow case where
7095         token == NULL.
7096         (Read_relocs::locks): Likewise.
7097         (Scan_relocs::locks): Likewise.
7098         (Relocate_task::locks): Likewise.
7099         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
7100         to clear counters.
7101         (Sized_relobj::incremental_relocs_scan): Fix comment.
7102         (Sized_relobj::do_relocate): Pass output file offset to
7103         write_local_symbols.
7104         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
7105         from class declaration.
7106         * script.cc (read_input_script): Allocate Script_info; pass
7107         argument serial number to report_script.
7108         * script.h (class Script_info): Move to incremental.h.
7109         * symtab.cc (Symbol_table::add_from_incrobj): New function.
7110         * symtab.h (Symbol_table::add_from_incrobj): New function.
7111         (Symbol_table::set_file_offset): New function.
7112
7113 2011-04-05  Cary Coutant  <ccoutant@google.com>
7114
7115         * incremental-dump.cc (dump_incremental_inputs): Change signature
7116         to take a Sized_incremental_binary; change caller.  Use readers
7117         in Sized_incremental_binary.
7118         * incremental.cc
7119         (Sized_incremental_binary::find_incremental_inputs_sections):
7120         Rename do_find_incremental_inputs_sections to this.
7121         (Sized_incremental_binary::setup_readers): New function.
7122         (Sized_incremental_binary::do_check_inputs): Check
7123         has_incremental_info_ flag; move setup code to setup_readers;
7124         use input readers.
7125         (Sized_incremental_binary::do_file_is_unchanged): New function.
7126         (Sized_incremental_binary::do_get_input_reader): New function.
7127         * incremental.h (class Incremental_binary): Move to end of file.
7128         (Incremental_binary::file_is_unchanged): New function.
7129         (Incremental_binary::do_file_is_unchanged): New function.
7130         (Incremental_binary::Input_reader): New class.
7131         (Incremental_binary::get_input_reader): New function.
7132         (class Sized_incremental_binary): Move to end of file.
7133         (Sized_incremental_binary::Sized_incremental_binary): Setup the
7134         input section reader classes.
7135         (Sized_incremental_binary::has_incremental_info): New function.
7136         (Sized_incremental_binary::inputs_reader): New function.
7137         (Sized_incremental_binary::symtab_reader): New function.
7138         (Sized_incremental_binary::relocs_reader): New function.
7139         (Sized_incremental_binary::got_plt_reader): New function.
7140         (Sized_incremental_binary::do_file_is_unchanged): New function.
7141         (Sized_incremental_binary::Sized_input_reader): New class.
7142         (Sized_incremental_binary::get_input_reader): New function.
7143         (Sized_incremental_binary::find_incremental_inputs_sections):
7144         Rename do_find_incremental_inputs_sections to this.
7145         (Sized_incremental_binary::setup_readers): New function.
7146         (Sized_incremental_binary::has_incremental_info_): New data member.
7147         (Sized_incremental_binary::inputs_reader_): New data member.
7148         (Sized_incremental_binary::symtab_reader_): New data member.
7149         (Sized_incremental_binary::relocs_reader_): New data member.
7150         (Sized_incremental_binary::got_plt_reader_): New data member.
7151         (Sized_incremental_binary::current_input_file_): New data member.
7152
7153 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
7154
7155         PR gold/12640
7156         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
7157         violation.
7158
7159 2011-03-30  Cary Coutant  <ccoutant@google.com>
7160
7161         * archive.cc (Archive::include_member): Adjust call to report_object.
7162         (Add_archive_symbols::run): Add script_info to call to
7163         report_archive_begin.
7164         (Lib_group::include_member): Adjust call to report_object.
7165         (Add_lib_group_symbols::run): Adjust call to report_object.
7166         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
7167         blocks.  Add object count for script input files.
7168         * incremental.cc (Incremental_inputs::report_archive_begin): Add
7169         script_info parameter; change all callers.
7170         (Incremental_inputs::report_object): Add script_info parameter;
7171         change all callers.
7172         (Incremental_inputs::report_script): Store backpointer to
7173         incremental info entry.
7174         (Output_section_incremental_inputs::set_final_data_size): Record
7175         additional information for scripts.
7176         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7177         * incremental.h (Incremental_script_entry::add_object): New function.
7178         (Incremental_script_entry::get_object_count): New function.
7179         (Incremental_script_entry::get_object): New function.
7180         (Incremental_script_entry::objects_): New data member; adjust
7181         constructor.
7182         (Incremental_inputs::report_archive_begin): Add script_info parameter.
7183         (Incremental_inputs::report_object): Add script_info parameter.
7184         (Incremental_inputs_reader::get_object_count): New function.
7185         (Incremental_inputs_reader::get_object_offset): New function.
7186         * options.cc (Input_arguments::add_file): Return reference to
7187         new input argument.
7188         * options.h (Input_argument::set_script_info): New function.
7189         (Input_argument::script_info): New function.
7190         (Input_argument::script_info_): New data member; adjust all
7191         constructors.
7192         (Input_file_group::add_file): Return reference to new input argument.
7193         (Input_file_lib::add_file): Likewise.
7194         (Input_arguments::add_file): Likewise.
7195         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
7196         * script.cc (Parser_closure::Parser_closure): Add script_info
7197         parameter; adjust all callers.
7198         (Parser_closure::script_info): New function.
7199         (Parser_closure::script_info_): New data member.
7200         (read_input_script): Report scripts earlier to incremental info.
7201         (script_add_file): Set script_info in Input_argument.
7202         (script_add_library): Likewise.
7203         * script.h (Script_options::Script_info): Rewrite class.
7204
7205 2011-03-29  Cary Coutant  <ccoutant@google.com>
7206
7207         * archive.cc (Library_base::should_include_member): Move
7208         method here from class Archive.
7209         (Archive::Archive): Initialize base class.
7210         (Archive::should_include_member): Move to base class.
7211         (Archive::do_for_all_unused_symbols): New function.
7212         (Add_archive_symbols::run): Remove redundant access to
7213         incremental_inputs.
7214         (Lib_group::Lib_group): Initialize base class.
7215         (Lib_group::do_filename): New function.
7216         (Lib_group::include_member): Pass pointer to Lib_group to
7217         report_object.
7218         (Lib_group::do_for_all_unused_symbols): New function.
7219         (Add_lib_group_symbols::run): Report archive information for
7220         incremental links.
7221         * archive.h (class Library_base): New base class.
7222         (class Archive): Derive from Library_base.
7223         (Archive::filename): Move to base class.
7224         (Archive::set_incremental_info): Likewise.
7225         (Archive::incremental_info): Likewise.
7226         (Archive::Should_include): Likewise.
7227         (Archive::should_include_member): Likewise.
7228         (Archive::Armap_entry): Remove.
7229         (Archive::Unused_symbol_iterator): Remove.
7230         (Archive::unused_symbols_begin): Remove.
7231         (Archive::unused_symbols_end): Remove.
7232         (Archive::do_filename): New function.
7233         (Archive::do_get_mtime): New function.
7234         (Archive::do_for_all_unused_symbols): New function.
7235         (Archive::task_): Move to base class.
7236         (Archive::incremental_info_): Likewise.
7237         (class Lib_group): Derive from Library_base.
7238         (Lib_group::do_filename): New function.
7239         (Lib_group::do_get_mtime): New function.
7240         (Lib_group::do_for_all_unused_symbols): New function.
7241         (Lib_group::task_): Move to base class.
7242         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
7243         function.
7244         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
7245         function.
7246         * incremental.cc (Incremental_inputs::report_archive_begin):
7247         Use Library_base; call library's get_mtime; add incremental inputs
7248         entry before members.
7249         (class Unused_symbol_visitor): New class.
7250         (Incremental_inputs::report_archive_end): Use Library_base; use
7251         visitor class to record unused symbols; don't add incremental inputs
7252         entry after members.
7253         (Incremental_inputs::report_object): Use Library_base.
7254         * incremental.h
7255         (Incremental_archive_entry::Incremental_archive_entry): Remove
7256         unused Archive parameter.
7257         (Incremental_inputs::report_archive_begin): Use Library_base.
7258         (Incremental_inputs::report_archive_end): Likewise.
7259         (Incremental_inputs::report_object): Likewise.
7260         * object.cc (Sized_relobj::do_for_all_global_symbols): New
7261         function.
7262         * object.h (Object::for_all_global_symbols): New function.
7263         (Object::do_for_all_global_symbols): New function.
7264         (Sized_relobj::do_for_all_global_symbols): New function.
7265         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
7266         function.
7267         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
7268         function.
7269
7270 2011-03-27  Ian Lance Taylor  <iant@google.com>
7271
7272         * archive.cc (Archive::interpret_header): Return -1 if something
7273         goes wrong.  Change callers accordingly.
7274
7275 2011-03-25  Cary Coutant  <ccoutant@google.com>
7276
7277         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
7278         * testsuite/Makefile.in: Regenerate.
7279
7280 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
7281
7282         * plugin.cc (get_view): New.
7283         (Plugin::load): Pass get_view to the plugin.
7284         (Plugin_manager::get_view): New.
7285
7286 2011-03-21  Ian Lance Taylor  <iant@google.com>
7287
7288         * testsuite/final_layout.sh: Rewrite to not use dc.
7289         * testsuite/relro_test.sh: Fail if dc is not present.
7290
7291 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
7292
7293         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
7294         Change == to -eq.
7295         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
7296         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
7297         Change == to -eq.
7298         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
7299         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
7300
7301 2011-03-14  Ian Lance Taylor  <iant@google.com>
7302
7303         * script-sections.cc (Sort_output_sections::script_compare):
7304         Rename from is_before, change return type.
7305         (Sort_output_sections::operator()): Adjust accordingly.
7306
7307 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
7308
7309         PR gold/12572
7310         * testsuite/odr_violation2.cc: Add comment to make all error line
7311         numbers double digits.
7312         * testsuite/debug_msg.sh: Adjust expected errors.
7313
7314 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
7315
7316         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
7317         but mark earlier ones as non-canonical
7318         (offset_to_iterator): Update search target and example
7319         (do_addr2line): Return extra lines in a vector*
7320         (format_file_lineno): Extract from do_addr2line
7321         (one_addr2line): Add vector* out-param
7322         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
7323         when a lineno entry appeared last for its instruction
7324         (Dwarf_line_info): Add vector* out-param
7325         * object.cc (Relocate_info): Pass NULL for the vector* out-param
7326         * symtab.cc (Odr_violation_compare): Include the lineno in the
7327         comparison again.
7328         (linenos_from_loc): New. Combine the canonical line for an
7329         address with its other lines.
7330         (True_if_intersect): New. Helper functor to make
7331         std::set_intersection a query.
7332         (detect_odr_violations): Compare sets of lines instead of just
7333         one line for each function. This became less deterministic, but
7334         has fewer false positives.
7335         * symtab.h: Declarations.
7336         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
7337         mix an optimized and non-optimized object in the same binary
7338         (odr_violation2.so): Same.
7339         * testsuite/Makefile.in: Regenerate from Makefile.am.
7340         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
7341         * testsuite/debug_msg.sh: Update line numbers and add
7342         assertions.
7343         * testsuite/odr_violation1.cc: Use OdrDerived, in a
7344         non-optimized context.
7345         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
7346         isn't inlined, and use OdrDerived in an optimized context.
7347         * testsuite/odr_header1.h: Defines OdrDerived, where
7348         optimization will change the
7349         first-instruction-in-the-destructor's file and line number.
7350         * testsuite/odr_header2.h: Defines OdrBase.
7351
7352 2011-03-09  Ian Lance Taylor  <iant@google.com>
7353
7354         * fileread.cc (File_read::clear_views): Don't delete the whole
7355         file view.
7356
7357 2011-03-08  Ian Lance Taylor  <iant@google.com>
7358
7359         PR gold/12525
7360         * fileread.cc: #include <climits>.
7361         (GOLD_IOV_MAX): Define.
7362         (File_read::read_multiple): Limit number of entries by iov_max.
7363         * fileread.h (class File_read): Always set max_readv_entries to
7364         128.
7365
7366 2011-03-07  Ian Lance Taylor  <iant@google.com>
7367
7368         PR gold/12525
7369         * options.h (class General_options): Add -dy and -dn.
7370
7371 2011-03-02  Cary Coutant  <ccoutant@google.com>
7372
7373         * testsuite/script_test_9.t: Add TLS segment.
7374
7375 2011-03-02  Simon Baldwin  <simonb@google.com>
7376
7377         * configure.ac: Add check for gnu_indirect_function support in
7378         the toolchain building binutils.
7379         * configure: Rebuild.
7380
7381 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
7382
7383         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
7384         plugin only symbols.
7385         (Symbol_table::sized_finalize_symbol) Mark symbol only present
7386         in plugin files as not needed in the symbol table.
7387
7388 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
7389
7390         * output.cc (Output_section::add_input_section): Delay fill
7391         generation for section ordering.
7392
7393 2011-02-09  Ian Lance Taylor  <iant@google.com>
7394
7395         PR gold/12316
7396         * object.h (class Sized_relobj): Remove clear_local_symbols.
7397         * reloc.cc (Sized_relobj::do_relocate): Don't call
7398         clear_local_symbols.
7399
7400 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
7401
7402         * plugin.cc (is_visible_from_outside): Return true for symbols
7403         in the -u option.
7404
7405 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
7406
7407         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
7408         filename.
7409
7410 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
7411
7412         * icf.h (is_section_foldable_candidate): Change type of parameter
7413         to std::string.
7414         * icf.cc (Icf::find_identical_sections): Change type of local variable
7415         section_name to be std::string.
7416         (is_function_ctor_or_dtor): Change type of parameter to std::string.
7417
7418 2011-01-25  Ian Lance Taylor  <iant@google.com>
7419
7420         * script.cc (script_add_extern): Rewrite to use
7421         add_symbol_reference.
7422
7423 2011-01-25  Doug Kwan  <dougkwan@google.com>
7424
7425         * icf.cc (get_section_contents): Always lock section's object.
7426
7427 2011-01-24  Ian Lance Taylor  <iant@google.com>
7428
7429         * options.h (class General_options): Accept
7430         --no-detect-odr-violations.
7431
7432 2011-01-24  Ian Lance Taylor  <iant@google.com>
7433
7434         * version.cc (version_string): Bump to 1.11.
7435
7436 2011-01-24  Ian Lance Taylor  <iant@google.com>
7437
7438         * plugin.cc (class Plugin_rescan): Define new class.
7439         (Plugin_manager::claim_file): Set any_claimed_.
7440         (Plugin_manager::save_archive): New function.
7441         (Plugin_manager::save_input_group): New function.
7442         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
7443         necessary.
7444         (Plugin_manager::new_undefined_symbol): New function.
7445         (Plugin_manager::rescan): New function.
7446         (Plugin_manager::rescannable_defines): New function.
7447         (Plugin_manager::add_input_file): Set any_added_.
7448         * plugin.h (class Plugin_manager): define new fields rescannable_,
7449         undefined_symbols_, any_claimed_, and any_added_.  Declare
7450         Plugin_rescan as friend.  Declare new functions.
7451         (Plugin_manager::Rescannable): Define type.
7452         (Plugin_manager::Rescannable_list): Define type.
7453         (Plugin_manager::Undefined_symbol_list): Define type.
7454         (Plugin_manager::Plugin_manager): Initialize new fields.
7455         * archive.cc (Archive::defines_symbol): New function.
7456         (Add_archive_symbols::run): Pass archive to plugins if any.
7457         * archive.h (class Archive): Declare defines_symbol.
7458         * readsyms.cc (Input_group::~Input_group): New function.
7459         (Finish_group::run): Pass input_group to plugins if any.
7460         * readsyms.h (class Input_group): Declare destructor.
7461         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
7462         any.
7463
7464 2011-01-10  Ian Lance Taylor  <iant@google.com>
7465
7466         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
7467         section as relro.
7468         (Layout::set_segment_offsets): Reset increase_relro before calling
7469         set_section_addresses a second time.
7470
7471 2011-01-04  Cary Coutant  <ccoutant@google.com>
7472
7473         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
7474         sections before NOBITS sections.
7475
7476 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
7477
7478         * version.cc (print_version): Update copyright to 2011.
7479
7480 2010-12-23  Cary Coutant  <ccoutant@google.com>
7481
7482         * output.h (Output_data_reloc::add_output_section): Pass OD instead
7483         of OS to this->add.  Add OD parameter to second form of the function.
7484
7485 2010-12-20  Ian Lance Taylor  <iant@google.com>
7486
7487         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
7488         second of two consecutive entries with same offset.
7489
7490 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7491
7492         * testsuite/Makefile.am (ifuncmain2static_LDADD)
7493         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
7494         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
7495         to avoid unneeded links against $(LDADD).
7496         * testsuite/Makefile.in: Regenerate.
7497
7498 2010-12-15  Ian Lance Taylor  <iant@google.com>
7499
7500         PR gold/12324
7501         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
7502         for R_X86_64_32 and R_X86_64_PC32.
7503         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
7504         ver_matching_def_pic.o.
7505         (ver_matching_def_pic.o): New target.
7506
7507 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7508
7509         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
7510         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
7511         Move definition before File_read::View member definitions.
7512         (File_read::View::~View): Initialize and hold lock before
7513         updating current_mapped_bytes.
7514
7515 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7516
7517         * dwarf_reader.cc: Remove outdated comment.
7518         * gold-threads.cc: Fix typo in error message.
7519         * archive.cc: Fix typos in comments.
7520         * archive.h: Likewise.
7521         * arm-reloc-property.cc: Likewise.
7522         * arm-reloc-property.h: Likewise.
7523         * arm-reloc.def: Likewise.
7524         * arm.cc: Likewise.
7525         * attributes.h: Likewise.
7526         * cref.cc: Likewise.
7527         * ehframe.cc: Likewise.
7528         * fileread.h: Likewise.
7529         * gold.h: Likewise.
7530         * i386.cc: Likewise.
7531         * icf.cc: Likewise.
7532         * incremental.h: Likewise.
7533         * int_encoding.cc: Likewise.
7534         * layout.h: Likewise.
7535         * main.cc: Likewise.
7536         * merge.h: Likewise.
7537         * object.cc: Likewise.
7538         * object.h: Likewise.
7539         * options.cc: Likewise.
7540         * readsyms.cc: Likewise.
7541         * reduced_debug_output.cc: Likewise.
7542         * reloc.cc: Likewise.
7543         * script-sections.cc: Likewise.
7544         * sparc.cc: Likewise.
7545         * symtab.h: Likewise.
7546         * target-reloc.h: Likewise.
7547         * target.cc: Likewise.
7548         * target.h: Likewise.
7549         * timer.cc: Likewise.
7550         * timer.h: Likewise.
7551         * x86_64.cc: Likewise.
7552
7553 2010-12-09  Cary Coutant  <ccoutant@google.com>
7554
7555         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
7556         stack.
7557         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
7558         parameter; change all callers.
7559         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
7560         * options.h (warn_execstack): New option.
7561
7562 2010-12-07  Doug Kwan  <dougkwan@google.com>
7563
7564         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
7565         like function call relocations.
7566
7567 2010-12-07  Ian Lance Taylor  <iant@google.com>
7568
7569         * archive.cc (Archive::get_elf_object_for_member): Permit
7570         punconfigured to be NULL.
7571         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
7572         (Archive::include_member): Pass NULL to get_elf_object_for_member
7573         if we searched for the archive and this is the first included
7574         object.
7575
7576 2010-12-01  Ian Lance Taylor  <iant@google.com>
7577
7578         * dwarf_reader.h (class Sized_dwarf_line_info): Add
7579         track_relocs_type_ field.
7580         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7581         Set track_relocs_type_.
7582         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
7583         contents when using RELA relocs.
7584         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
7585         reloc_map_.
7586         * reloc.cc (Track_relocs::next_addend): New function.
7587         * reloc.h (class Track_relocs): Declare next_addend.
7588
7589 2010-12-01  Ian Lance Taylor  <iant@google.com>
7590
7591         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
7592         virtual destructor.
7593
7594 2010-12-01  Ian Lance Taylor  <iant@google.com>
7595
7596         * README: Update compilers known to work and fail.
7597
7598 2010-11-23  Matthias Klose  <doko@ubuntu.com>
7599
7600         * configure.in: For --enable-gold, handle value `default' instead of
7601         `both*'.  Always install ld as ld.bfd, install as ld if gold is
7602         not the default.
7603         * configure: Regenerate.
7604
7605 2010-11-18  Doug Kwan  <dougkwan@google.com>
7606
7607         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
7608         and right_alignment to be zero.  Store result alignment only if it is
7609         greater than existing alignment.
7610
7611 2010-11-16  Cary Coutant  <ccoutant@google.com>
7612
7613         PR gold/12220
7614         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7615         Check for ".zdebug_line".
7616
7617 2010-11-16  Doug Kwan  <dougkwan@google.com>
7618             Cary Coutant  <ccoutant@google.com>
7619
7620         * output.h (Output_segment::set_section_addresses): Pass increase_relro
7621         by reference; adjust all callers.
7622         * output.cc (Output_segment::set_section_addresses): Adjust references
7623         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
7624         list is empty.
7625         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
7626         end at page boundary.
7627
7628 2010-11-16  Cary Coutant  <ccoutant@google.com>
7629
7630         PR gold/12220
7631         * layout.cc (Layout::choose_output_section): Transform names of
7632         compressed sections even when using a script with a SECTIONS clause.
7633         (Layout::output_section_name): Remove code to transform
7634         compressed debug section names.
7635         * output.cc (Output_section::add_input_section): Use uncompressed
7636         section size when tracking input sections.
7637
7638 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
7639
7640         * symtab.h (Symbol::NON_PIC_REF): Remove.
7641         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
7642         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
7643         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
7644         (Symbol::use_plt_offset): Take a flags argument and pass it
7645         directly to needs_dynamic_reloc.  Restrict check for undefined
7646         weak symbols to function calls.
7647         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
7648         (Target_arm::Scan::global): Use it.
7649         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
7650         (Target_arm::Relocate::relocate): Likewise.
7651         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
7652         parameter with an r_type parameter.  Use get_reference_flags
7653         to get the flags.
7654         (Target_arm::Relocate::relocate): Update accordingly.
7655         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
7656         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
7657         (Target_i386::Scan::global): Likewise.
7658         (Target_i386::Relocate::relocate): Likewise.
7659         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
7660         parameter with an r_type parameter.  Use get_reference_flags
7661         to get the flags.
7662         (Target_i386::Relocate::relocate): Update accordingly.
7663         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
7664         (Target_powerpc::Scan::global): Use it.
7665         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
7666         (Target_powerpc::Relocate::relocate): Likewise.
7667         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
7668         (Target_sparc::Scan::global): Use it.
7669         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
7670         (Target_sparc::Relocate::relocate): Likewise.
7671         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
7672         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
7673         (Target_x86_64::Scan::global): Likewise.
7674         (Target_x86_64::Relocate::relocate): Likewise.
7675
7676 2010-11-08  Doug Kwan  <dougkwan@google.com>
7677             Cary Coutant  <ccoutant@google.com>
7678
7679         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
7680         (Arm_exidx_merge_section::section_contents_): New data member.
7681         (Arm_input_section::Arm_input_section): Initialize original_contents_.
7682         (Arm_input_section::~Arm_input_section): De-allocate memory.
7683         (Arm_input_section::original_contents_): New data member.
7684         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
7685         in parameters instead of calling Object::section_contents without
7686         locking.
7687         (Arm_output_section::group_section): New parameter TASK.  Pass it
7688         to callees that need locking objects.
7689         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
7690         to lock EXIDX input sections.  Fix a formatting issue.  Call
7691         Arm_exidx_merged_section::build_contents to create merged section
7692         contents.
7693         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
7694         to lock object of stub table owner.
7695         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
7696         TEXT_SIZE to initialize data member TEXT_SIZE_.
7697         (Arm_exidx_input_section::addralign): Fix typo in comment.
7698         (Arm_exidx_input_section::text_size): New method.
7699         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
7700         that require locking objects.  Lock objects before scanning for stubs
7701         and updating local symbols.
7702         (Arm_input_section<big_endian>::init): Copy contents of original
7703         input section.
7704         (Arm_input_section<big_endian>::do_write): Use saved contents of
7705         original input section instead of calling Object::section_contents
7706         without locking.
7707         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
7708         size without calling Object::section_size().
7709         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
7710         for size.  Allocate a buffer for merged EXIDX entries.
7711         (Arm_exidx_merged_section::build_contents): New method.
7712         (Arm_exidx_merged_section::do_write): Move merge section contents
7713         building code to Arm_exidx_merged_section::build_contetns.  Write
7714         out contetns in buffer instead of building it on the fly.
7715         (Arm_relobj::make_exidx_input_section): Also pass text section size
7716         to Arm_exidx_input_section constructor.
7717         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
7718         (Arm_dynobj::do_read_symbols): Fix memory leak.
7719         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
7720         * target.h: (class Task): Add forward declaration.
7721         (Target::relax): Add new parameter TASK and pass it to
7722         Target::do_relax().
7723         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
7724
7725 2010-11-05  Cary Coutant  <ccoutant@google.com>
7726
7727         PR gold/10708
7728         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
7729         object when reading from the file.
7730         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
7731         second layout pass.
7732         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
7733         when reading section contents.
7734         (get_section_contents): Likewise.
7735         (icf::find_identical_sections): Likewise.
7736         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
7737         object when reading from the file.
7738         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
7739         the object when doing deferred section layout.
7740
7741 2010-11-03  Nick Clifton  <nickc@redhat.com>
7742
7743         PR gold/12001
7744         * script.h (class Symbol_assignment: name): New member.  Returns
7745         the name of the symbol.
7746         * scrfipt.cc (Script_options::is_pending_assignment): New member.
7747         Returns true if the given symbol name is on the list of
7748         assignments wating to be processed.
7749         * archive.cc (should_incldue_member): If the symbol is undefined,
7750         check to see if it is on the list of symbols pending assignment.
7751
7752 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
7753
7754         * script-sections.cc (Script_sections::find_memory_region): Check
7755         for a NULL output section pointer.
7756
7757 2010-10-29  Doug Kwan  <dougkwan@google.com>
7758
7759         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
7760         Output_section::add_relaxed_input_section.
7761         * output.cc (Output_section::add_relaxed_input_section): Add new
7762         arguments LAYOUT and NAME.  Set section order index.
7763         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7764         Copy section order index.
7765         * output.h (Output_section::add_relaxed_input_section): Add new
7766         arguments LAYOUT and NAME.
7767
7768 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7769
7770         * testsuite/Makefile.am: Move gcctestdir/ld rule to
7771         NATIVE_OR_CROSS_LINKER.
7772         * testsuite/Makefile.in: Regenerate.
7773
7774 2010-10-20  Doug Kwan  <dougkwan@google.com>
7775
7776         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
7777         without SHF_LINK_ORDER flags.
7778         * layout.cc (Layout::choose_output_section): Do not filter
7779         SHF_LINK_ORDER flag in a relocatable link.
7780
7781 2010-10-17  Cary Coutant  <ccoutant@google.com>
7782
7783         * output.h (Output_segment::set_section_addresses): Change function
7784         signature.  Update all callers.
7785         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
7786         sections.
7787         (Output_segment::set_section_addresses): Align after last TLS
7788         section.  Add padding before last relro section instead of after.
7789
7790 2010-10-17  Doug Kwan  <dougkwan@google.com>
7791
7792         * gold/arm.cc (Target_arm::got_section): Use correct order and set
7793         GOT output section to be writable.
7794
7795 2010-10-14  Cary Coutant  <ccoutant@google.com>
7796
7797         * debug.h (DEBUG_INCREMENTAL): New flag.
7798         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
7799         * gold.cc (queue_initial_tasks): Check parameters for incremental link
7800         mode.
7801         * incremental.cc (report_command_line): Ignore all forms of
7802         --incremental.
7803         * layout.cc (Layout::Layout): Check parameters for incremental link
7804         mode.
7805         * options.cc (General_options::parse_incremental): New function.
7806         (General_options::parse_no_incremental): New function.
7807         (General_options::parse_incremental_full): New function.
7808         (General_options::parse_incremental_update): New function.
7809         (General_options::incremental_mode_): New data member.
7810         (General_options::finalize): Check incremental_mode_.
7811         * options.h (General_options): Update help text for --incremental.
7812         Add --no-incremental, --incremental-full, --incremental-update.
7813         (General_options::Incremental_mode): New enum type.
7814         (General_options::incremental_mode): New function.
7815         (General_options::incremental_mode_): New data member.
7816         * parameters.cc (Parameters::incremental_mode_): New data member.
7817         (Parameters::set_options): Set incremental_mode_.
7818         (Parameters::set_incremental_full): New function.
7819         (Parameters::incremental): New function.
7820         (Parameters::incremental_update): New function.
7821         (set_parameters_incremental_full): New function.
7822         * parameters.h (Parameters::set_incremental_full): New function.
7823         (Parameters::incremental): New function.
7824         (Parameters::incremental_update): New function.
7825         (Parameters::incremental_mode_): New data member.
7826         (set_parameters_incremental_full): New function.
7827         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
7828         incremental link mode.
7829         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
7830         (Sized_relobj::do_relocate_sections): Likewise.
7831         * testsuite/Makefile.am (incremental_test): Use --incremental-full
7832         option.
7833         * testsuite/Makefile.in: Regenerate.
7834         * testsuite/incremental_test.sh: Filter all forms of --incremental.
7835
7836 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7837
7838         * script-sections.h (class Script_sections): Make
7839         Sections_elements typedef public.
7840         * script-sections.cc (class Sort_output_sections): Add elements_
7841         field.  Add constructor which sets it; change all callers.
7842         (Sort_output_sections::is_before): New function.
7843         (Sort_output_sections::operator()): Call is_before.
7844         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
7845         conditional.
7846         * testsuite/script_test_10.sh: New test. Test script section
7847         order.
7848         * testsuite/script_test_10.t: Likewise.
7849         * testsuite/script_test_10.s: Likewise.
7850         * testsuite/Makefile.am: Wrap the cross linker tests and the
7851         common tests into NATIVE_OR_CROSS_LINKER.
7852         (check_SCRIPTS): Add script_test_10.sh.
7853         (check_DATA): Add script_test_10.stdout.
7854         (script_test_10.o, script_test_10): New targets.
7855         (script_test_10.stdout): New target.
7856         * configure, testsuite/Makefile.in: Regenerate.
7857
7858 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7859
7860         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
7861         error for the deprecated relocations.
7862         (Target_arm::Scan::global): Likewise.
7863         (Target_arm::Relocate::relocate): Likewise.
7864
7865 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
7866
7867         * fileread.cc (Input_file::find_file): Initialize *found_name
7868         and *namep when using the fallback search for case 4.
7869
7870 2010-10-11  Cary Coutant  <ccoutant@google.com>
7871
7872         * options.h (class General_options): Redefine -z lazy as an alias for
7873         the negation of -z now.
7874
7875 2010-10-11  Ian Lance Taylor  <iant@google.com>
7876
7877         * resolve.cc (symbol_to_bits): Report the value of the unsupported
7878         binding.
7879
7880 2010-10-06  Nick Clifton  <nickc@redhat.com>
7881
7882         * script-sections.cc(class Memory_region): Remove
7883         current_lma_offset_ field.  Rename current_vma_offset_ to
7884         current_offset_.  Add last_section_ field.
7885         (Memory_region::get_current_vma_address): Rename to
7886         get_current_address.
7887         (Memory_region::get_current_lma_address): Delete.
7888         (Memory_region::increment_vma_offset): Rename to
7889         increment_offset.
7890         (Memory_region::increment_lma_offset): Delete.
7891         (Memory_region::attributes_compatible): New method.  Returns
7892         true if the provided section is compatible with the region.
7893         (Memory_region::get_last_section): New method.  Returns the last
7894         section to use the region.
7895         (Memory_region::set_last_section): New method.  Stores the last
7896         section to use the region.
7897         (Script_sections::block_in_region): New method.  Returns true if
7898         a block of memory is contained within a region.
7899         (Script_sections::find_memory_region): New method.  Locates a
7900         memory region to be used to set a VMA or LMA address.
7901         (Output_section_definition::set_section_addresses): Add code to
7902         check for addresses set by memory regions.
7903         (Output_segment::set_section_addresses): Remove memory region
7904         walking code.
7905         (Script_sections::create_segment): Add a warning if a header
7906         segment is created outside of any region.
7907         * script-sections.h (class Script_sections): Add prototypes for
7908         find_memory_region and block_in_region methods.
7909         * testsuite/memory_test.s: Use .long instead of .word.
7910         * testsuite/memory_test.t: Add some more output sections.
7911         * testsuite/memory_test.sh: Update expected output.
7912
7913 2010-10-02  Doug Kwan  <dougkwan@google.com>
7914
7915         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
7916         defintion to symtab.h
7917         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
7918         declaration to defintion.
7919
7920 2010-10-01  Nick Clifton  <nickc@redhat.com>
7921
7922         * expression.cc (eval): Replace dummy argument with NULL.
7923         (eval_maybe_dot): Check for a NULL result section pointer.
7924         (Symbol_expression::value): Likewise.
7925         (Dot_expression::value): Likewise.
7926         (BINARY_EXPRESSION): Likewise.
7927         (Max_expression::value): Likewise.
7928         (Min_expression::value): Likewise.
7929         (Absolute_expression::value): Likewise.
7930         (Addr_expression::value_from_output_section): Likewise.
7931         (Loaddddr_expression::value_from_output_section): Likewise.
7932         (Segment_start_expression::value): Likewise.
7933         * script-sections.cc
7934         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
7935         argument with NULL.
7936         (Sections_elememt_dot_assignment::set_section_addresses):
7937         Likewise.
7938         (Output_data_expression::do_write_to_buffer): Likewise.
7939         (Output_section_definition::finalize_symbols): Likewise.
7940         (Output_section_definition::set_section_addresses): Likewise.
7941
7942 2010-09-30  Doug Kwan  <dougkwan@google.com>
7943
7944         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
7945
7946 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
7947
7948         * target.h (Target::can_icf_inline_merge_sections): New virtual
7949         function.
7950         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7951         virtual function.
7952         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
7953         virtual function.
7954         * icf.cc (get_section_contents): Inline merge sections only when
7955         target allows it.
7956
7957 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7958
7959         * configure: Regenerate.
7960
7961 2010-09-17  Ian Lance Taylor  <iant@google.com>
7962
7963         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7964         * testsuite/Makefile.am (memory_test.o): New target.
7965         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7966         memory_test.t.
7967         * testsuite/Makefile.in: Rebuild.
7968
7969 2010-09-17  Doug Kwan  <dougkwan@google.com>
7970
7971         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7972         defintion if relocation uses GOT entries of the symbol.
7973         * testsuite/icf_safe_test.sh: Fix test.
7974         * testsuite/icf_safe_so_test.sh: Fix test.
7975
7976 2010-09-16  Cary Coutant  <ccoutant@google.com>
7977
7978         * script_sections.cc (class Memory_region): Remove "NULL" from
7979         vector initializations.
7980
7981 2010-09-15  Cary Coutant  <ccoutant@google.com>
7982
7983         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7984         Resolve forwarding symbols.
7985
7986 2010-09-15  Doug Kwan  <dougkwan@google.com>
7987
7988         * gold/testsuite/script_test_3.t: Add ARM special sections.
7989         * gold/testsuite/script_test_4.t: Same.
7990         * gold/testsuite/script_test_5.t: Same.
7991         * gold/testsuite/script_test_6.t: Same.
7992         * gold/testsuite/script_test_7.t: Same.
7993         * gold/testsuite/script_test_7.t: Same.
7994         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7995
7996 2010-09-14  Cary Coutant  <ccoutant@google.com>
7997
7998         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7999         (Target_x86_64::Relocate::relocate_tls): Replace check for
8000         saw_tls_block_reloc_ with test for executable section.
8001
8002 2010-09-12  Cary Coutant  <ccoutant@google.com>
8003
8004         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
8005         position-independent executables to shared libraries need dynamic
8006         relocations.
8007         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
8008         position-independent executables.
8009         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
8010         * testsuite/Makefile.in: Regenerate.
8011
8012 2010-09-10  Nick Clifton  <nickc@redhat.com>
8013
8014         PR gold/11997
8015         * testsuite/memory_test.t: Discard any sections that are not
8016         needed.
8017
8018 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
8019
8020         PR gold/11996
8021         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
8022         "This::" to work around a bug in gcc 4.2.
8023
8024         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
8025
8026 2010-09-09  Rafael Espindola  <espindola@google.com>
8027
8028         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
8029         sections with different PF_X flags in the same segment.
8030         (Layout::find_first_load_seg): Search all segments to find the first
8031         one.
8032         * options.h (rosegment): New.
8033
8034 2010-09-08  Rafael Espindola  <espindola@google.com>
8035
8036         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
8037
8038 2010-09-08  Doug Kwan  <dougkwan@google.com>
8039
8040         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
8041         (Arm_relobj::do_relocate_sections): Add new parameter for output
8042         file to match the parent.
8043         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
8044         of local symbols instead of input values.  Update code to track
8045         changes in gold::relocate_section.
8046         * object.cc (Sized_relobj::compute_final_local_value): New methods.
8047         (Sized_relobj::compute_final_local_value_internal): New methods.
8048         (Sized_relobj::do_finalize_local_symbols): Move code from loop
8049         body into private version of Sized_relobj::compute_final_local_value.
8050         Call the inline method.
8051         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
8052         merged symbol value if there is one.
8053         (Symbol_value::has_output_value): New method defintiion.
8054         (Sized_relobj::Compute_final_local_value_status): New enum type.
8055         (Sized_relobj::compute_final_local_value): New methods.
8056         (Sized_relobj::compute_final_local_value_internal): New methods.
8057         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
8058         and arm_cortex_a8.sh.
8059         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
8060         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
8061         New tests.
8062         * Makefile.in: Regenerate.
8063         * testsuite/arm_bl_out_of_range.s: Update test.
8064         * testsuite/thumb_bl_out_of_range.s: Ditto.
8065         * testsuite/thumb_blx_out_of_range.s: Ditto.
8066         * testsuite/arm_branch_out_of_range.sh: New file.
8067         * testsuite/arm_cortex_a8.sh: Ditto.
8068         * testsuite/arm_cortex_a8_b.s: Ditto.
8069         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
8070         * testsuite/arm_cortex_a8_b_local.s: Ditto.
8071         * testsuite/arm_cortex_a8_bl.s: Ditto.
8072         * testsuite/arm_cortex_a8_blx.s: Ditto.
8073         * testsuite/arm_cortex_a8_local.s: Ditto.
8074         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
8075         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
8076
8077 2010-09-08  Rafael Espindola  <espindola@google.com>
8078
8079         * Makefile.am (memory_test.stdout): Run readelf with -W.
8080         * Makefile.in: Regenerate.
8081         * testsuite/memory_test.sh: Make the regexps accept both 32 and
8082         64 bit output.
8083
8084 2010-09-08  Rafael Espindola  <espindola@google.com>
8085
8086         * script-sections.cc (Script_sections::add_memory_region): Convert
8087         field precision to int.
8088         * script.cc (script_set_section_region, script_set_section_region):
8089         Convert field precision to int.
8090
8091 2010-09-08  Rafael Espindola  <espindola@google.com>
8092
8093         * arm.cc (do_finalize_sections): Create the __exidx_start and
8094         __exdix_end symbols even when the section is missing.
8095
8096 2010-09-08  Nick Clifton  <nickc@redhat.com>
8097
8098         * README: Remove claim that MEMORY is not supported.
8099         * expression.cc (script_exp_function_origin)
8100         (script_exp_function_length): Move from here to ...
8101         * script.cc: ... here.
8102         (script_set_section_region, script_add_memory)
8103         (script_parse_memory_attr, script_include_directive): New
8104         functions.
8105         * script-sections.cc
8106         (class Memory_region): New class.
8107         (class Output_section_definition): Add set_memory_region,
8108         set_section_vma, set_section_lma and get_section_name methods.
8109         (class Script_Sections): Add add_memory_region,
8110         find_memory_region, find_memory_region_origin,
8111         find_memory_region_length and set_memory_region methods.
8112         Have set_section_addresses method walk the list of set memory
8113         regions.
8114         Extend the print methos to display memory regions.
8115         * script-sections.h: Add prototypes for new methods.
8116         Add enum for MEMORY region attributes.
8117         * yyscript.y: Add support for parsing MEMORY regions.
8118         * script-c.h: Add prototypes for new functions.
8119         * testsuite/Makefile.am: Add test of MEMORY region functionality.
8120         * testsuite/Makefile.in: Regenerate.
8121         * testsuite/memory_test.sh: New script.
8122         * testsuite/memory_test.s: New assembler source file.
8123         * testsuite/memory_test.t: New linker script.
8124
8125 2010-08-27  Doug Kwan  <dougkwan@google.com>
8126
8127         * gold/resolve.cc (Symbol_table::should_override): Let a weak
8128         reference override an existing dynamic weak reference.
8129         * testsuite/Makefile.am: Add new test dyn_weak_ref.
8130         * testsuite/Makefile.in: Regenerate.
8131         * testsuite/dyn_weak_ref.sh: New file.
8132         * testsuite/dyn_weak_ref_1.c: Ditto.
8133         * testsuite/dyn_weak_ref_2.c: Ditto.
8134
8135 2010-08-27  Ian Lance Taylor  <iant@google.com>
8136
8137         * incremental.h (class Incremental_input_entry): Add virtual
8138         destructor.
8139
8140 2010-08-27  Ian Lance Taylor  <iant@google.com>
8141
8142         * testsuite/start_lib_test_3.c: Mark t3 as used.
8143
8144 2010-08-27  Nick Clifton  <nickc@redhat.com>
8145
8146         * options.cc (version_script): Fix small typo in previous
8147         whitespace tidyup.
8148
8149 2010-08-25  Nick Clifton  <nickc@redhat.com>
8150
8151         * archive.cc: Formatting fixes: Remove whitespace between
8152         typename and following asterisk.  Remove whitespace between
8153         function name and opening parenthesis.
8154         * archive.h: Likewise.
8155         * arm.cc: Likewise.
8156         * attributes.cc: Likewise.
8157         * attributes.h: Likewise.
8158         * common.cc: Likewise.
8159         * copy-relocs.cc: Likewise.
8160         * dirsearch.h: Likewise.
8161         * dynobj.cc: Likewise.
8162         * ehframe.cc: Likewise.
8163         * ehframe.h: Likewise.
8164         * expression.cc: Likewise.
8165         * fileread.cc: Likewise.
8166         * fileread.h: Likewise.
8167         * gc.h: Likewise.
8168         * gold-threads.cc: Likewise.
8169         * gold.cc: Likewise.
8170         * i386.cc: Likewise.
8171         * icf.h: Likewise.
8172         * incremental-dump.cc: Likewise.
8173         * incremental.cc: Likewise.
8174         * layout.cc: Likewise.
8175         * layout.h: Likewise.
8176         * main.cc: Likewise.
8177         * merge.cc: Likewise.
8178         * merge.h: Likewise.
8179         * object.cc: Likewise.
8180         * object.h: Likewise.
8181         * options.cc: Likewise.
8182         * options.h: Likewise.
8183         * output.cc: Likewise.
8184         * output.h: Likewise.
8185         * plugin.cc: Likewise.
8186         * plugin.h: Likewise.
8187         * powerpc.cc: Likewise.
8188         * reloc.cc: Likewise.
8189         * script-c.h: Likewise.
8190         * script-sections.cc: Likewise.
8191         * script.cc: Likewise.
8192         * stringpool.cc: Likewise.
8193         * symtab.cc: Likewise.
8194         * symtab.h: Likewise.
8195         * target.cc: Likewise.
8196         * timer.cc: Likewise.
8197         * timer.h: Likewise.
8198         * version.cc: Likewise.
8199         * x86_64.cc: Likewise.
8200
8201 2010-08-24  Nick Clifton  <nickc@redhat.com>
8202
8203         PR 11899
8204         * layout.cc (segment_precedes): Sort segments by their physical
8205         addresses, if they have been set.
8206
8207 2010-08-23  Cary Coutant  <ccoutant@google.com>
8208
8209         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
8210         symbols data.
8211         (Lib_group::include_member): Unlock object after deleting its
8212         symbols data.
8213         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
8214         the bug fixed here.
8215
8216 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
8217             Cary Coutant  <ccoutant@google.com>
8218
8219         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
8220         constructor, and set_blocker.
8221         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
8222         readsyms_blocker_.
8223         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
8224         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
8225         * testsuite/Makefile.am (start_lib_test): New test case.
8226         * testsuite/Makefile.in: Regenerate.
8227         * testsuite/start_lib_test_main.c: New file.
8228         * testsuite/start_lib_test_1.c: New file.
8229         * testsuite/start_lib_test_2.c: New file.
8230         * testsuite/start_lib_test_3.c: New file.
8231
8232 2010-08-19  Ian Lance Taylor  <iant@google.com>
8233
8234         * Makefile.in: Rebuild with automake 1.11.1.
8235         * aclocal.m4: Likewise.
8236         * testsuite/Makefile.in: Likewise.
8237
8238 2010-08-19  Ian Lance Taylor  <iant@google.com>
8239
8240         PR 10893
8241         * i386.cc (class Output_data_plt_i386): Update declarations.
8242         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
8243         local_ifuncs_ fields.
8244         (Target_i386::do_plt_section_for_global): New function.
8245         (Target_i386::do_plt_section_for_local): New function.
8246         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
8247         parameter; change all callers.  Initialize global_ifuncs_ and
8248         local_ifuncs_.  If doing a static link define __rel_iplt_start and
8249         __rel_iplt_end.
8250         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
8251         (Output_data_plt_i386::add_local_ifunc_entry): New function.
8252         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
8253         symbols.
8254         (Target_i386::make_plt_section): New function, broken out of
8255         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
8256         (Target_i386::make_plt_entry): Call make_plt_section.
8257         (Target_i386::make_local_ifunc_plt_entry): New function.
8258         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
8259         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
8260         R_386_IRELATIVE to switch.
8261         (Target_i386::Scan::global): Likewise.
8262         (Target_i386::Relocate::relocate): Likewise.
8263         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
8264         switch.
8265         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
8266         (Target_x86_64::do_plt_section_for_global): New function.
8267         (Target_x86_64::do_plt_section_for_local): New function.
8268         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
8269         parameter; change all callers.  If doing a static link define
8270         __rela_iplt_start and __rela_iplt_end.
8271         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
8272         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
8273         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
8274         to point to .plt.
8275         (Target_x86_64::make_local_ifunc_plt_entry): New function.
8276         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
8277         switch.
8278         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
8279         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
8280         R_X86_64_IRELATIVE to switch.
8281         (Target_x86_64::Scan::global): Likewise.
8282         (Target_x86_64::Relocate::relocate): Likewise.
8283         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
8284         switch.
8285         * target.h (class Target): Add plt_section_for_global and
8286         plt_section_for_local functions.  Add do_plt_section_for_global
8287         and do_plt_section_for_local virtual functions.
8288         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
8289         clarifying comments.
8290         (Symbol::use_plt_offset): Handle IFUNC symbol.
8291         * object.cc (Sized_relobj::Sized_relobj): Initialize
8292         local_plt_offsets_.
8293         (Sized_relobj::local_has_plt_offset): New function.
8294         (Sized_relobj::local_plt_offset): New function.
8295         (Sized_relobj::set_local_plt_offset): New function.
8296         (Sized_relobj::do_count): Handle IFUNC symbol.
8297         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
8298         a bit away from input_shndx_ field.  Add set_is_func_symbol and
8299         is_ifunc_symbol functions.
8300         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
8301         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
8302         local_plt_offsets_ field.
8303         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
8304         * output.h (class Output_section_data): Add non-const
8305         output_section function.
8306         (class Output_data_got): Update declarations.
8307         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
8308         Add use_plt_offset parameter to global and local constructors.
8309         Change all callers.  Change local_sym_index_ field to 31 bits.
8310         Change GSYM_CODE and CONSTANT_CODE accordingly.
8311         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
8312         doing a static link don't set sh_link field.
8313         (Output_data_got::Got_entry::write): Use PLT offset if
8314         appropriate.
8315         (Output_data_got::add_global_plt): New function.
8316         (Output_data_got::add_local_plt): New function.
8317         * target-reloc.h (relocate_section): Handle IFUNC symbol.
8318         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
8319         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
8320         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
8321         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
8322         IFUNC conditional.
8323         * testsuite/ifunc-sel.h: New file.
8324         * testsuite/ifuncmain1.c: New file.
8325         * testsuite/ifuncmain1vis.c: New file.
8326         * testsuite/ifuncmod1.c: New file.
8327         * testsuite/ifuncdep2.c: New file.
8328         * testsuite/ifuncmain2.c: New file.
8329         * testsuite/ifuncmain3.c: New file.
8330         * testsuite/ifuncmod3.c: New file.
8331         * testsuite/ifuncmain4.c: New file.
8332         * testsuite/ifuncmain5.c: New file.
8333         * testsuite/ifuncmod5.c: New file.
8334         * testsuite/ifuncmain6pie.c: New file.
8335         * testsuite/ifuncmod6.c: New file.
8336         * testsuite/ifuncmain7.c: New file.
8337         * configure, testsuite/Makefile.in: Rebuild.
8338
8339 2010-08-18  Ian Lance Taylor  <iant@google.com>
8340
8341         * incremental.cc
8342         (Output_section_incremental_inputs::write_input_files): Add cast
8343         to avoid signed/unsigned comparison warning.
8344         (Output_section_incremental_inputs::write_info_blocks): Likewise.
8345
8346 2010-08-12  Cary Coutant  <ccoutant@google.com>
8347
8348         * common.cc (Sort_commons::operator()): Remove unnecessary code.
8349
8350 2010-08-13  Ian Lance Taylor  <iant@google.com>
8351
8352         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
8353
8354 2010-08-12  Cary Coutant  <ccoutant@google.com>
8355             Doug Kwan  <dougkwan@google.com>
8356
8357         * resolve.cc (Symbol_table::should_override): When a weak dynamic
8358         defintion overrides non-weak undef, remember that the original undef
8359         is not weak.
8360         * symtab.cc (Symbol_table::sized_write_global): For undef without
8361         an original weak binding, set binding to global in output.
8362         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
8363         * testsuite/Makefile.in: Regenerate.
8364         * testsuite/strong_ref_weak_def.sh: New file.
8365         * testsuite/strong_ref_weak_def_1.c: Ditto.
8366         * testsuite/strong_ref_weak_def_2.c: Ditto.
8367
8368 2010-08-12  Cary Coutant  <ccoutant@google.com>
8369
8370         * testsuite/incremental_test.sh: Rewrite.
8371         * testsuite/incremental_test_1.c: Rewrite.
8372         * testsuite/incremental_test_2.c: Rewrite.
8373
8374 2010-08-12  Cary Coutant  <ccoutant@google.com>
8375
8376         * arm.cc (Target_arm::got_size): Add const.
8377         (Target_arm::got_entry_count): New function.
8378         (Target_arm::plt_entry_count): New function.
8379         (Target_arm::first_plt_entry_offset): New function.
8380         (Target_arm::plt_entry_size): New function.
8381         (Output_data_plt_arm::entry_count): New function.
8382         (Output_data_plt_arm::first_plt_entry_offset): New function.
8383         (Output_data_plt_arm::get_plt_entry_size): New function.
8384         * i386.cc (Target_i386::got_size): Add const.
8385         (Target_i386::got_entry_count): New function.
8386         (Target_i386::plt_entry_count): New function.
8387         (Target_i386::first_plt_entry_offset): New function.
8388         (Target_i386::plt_entry_size): New function.
8389         (Output_data_plt_i386::entry_count): New function.
8390         (Output_data_plt_i386::first_plt_entry_offset): New function.
8391         (Output_data_plt_i386::get_plt_entry_size): New function.
8392         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
8393         find_incremental_inputs_sections.  Dump incremental_got_plt section.
8394         * incremental.cc: Include target.h.
8395         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
8396         parameter.  Adjust all callers.  Find incremental_got_plt section.
8397         (Incremental_inputs::create_data_sections): Create incremental_got_plt
8398         section.
8399         (Output_section_incremental_inputs::set_final_data_size): Calculate
8400         size of incremental_got_plt section.
8401         (Output_section_incremental_inputs::do_write): Write the
8402         incremental_got_plt section.
8403         (Got_plt_view_info): New struct.
8404         (Local_got_offset_visitor): New class.
8405         (Global_got_offset_visitor): New class.
8406         (Global_symbol_visitor_got_plt): New class.
8407         (Output_section_incremental_inputs::write_got_plt): New function.
8408         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
8409         Add parameter.  Adjust all callers.
8410         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8411         (Incremental_inputs::got_plt_section): New function.
8412         (Incremental_inputs::got_plt_section_): New data member.
8413         (Incremental_got_plt_reader): New class.
8414         * layout.cc (Layout::create_incremental_info_sections): Add the
8415         incremental_got_plt section.
8416         * object.h (Got_offset_list::get_list): New function.
8417         (Got offset_list::for_all_got_offsets): New function.
8418         (Sized_relobj::local_got_offset_list): New function.
8419         * powerpc.cc (Target_powerpc::got_size): Add const.
8420         (Target_powerpc::got_entry_count): New function.
8421         (Target_powerpc::plt_entry_count): New function.
8422         (Target_powerpc::first_plt_entry_offset): New function.
8423         (Target_powerpc::plt_entry_size): New function.
8424         (Output_data_plt_powerpc::entry_count): New function.
8425         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
8426         (Output_data_plt_powerpc::get_plt_entry_size): New function.
8427         * sparc.cc (Target_sparc::got_size): Add const.
8428         (Target_sparc::got_entry_count): New function.
8429         (Target_sparc::plt_entry_count): New function.
8430         (Target_sparc::first_plt_entry_offset): New function.
8431         (Target_sparc::plt_entry_size): New function.
8432         (Output_data_plt_sparc::entry_count): New function.
8433         (Output_data_plt_sparc::first_plt_entry_offset): New function.
8434         (Output_data_plt_sparc::get_plt_entry_size): New function.
8435         * symtab.h (Symbol::got_offset_list): New function.
8436         (Symbol_table::for_all_symbols): New function.
8437         * target.h (Sized_target::got_entry_count): New function.
8438         (Sized_target::plt_entry_count): New function.
8439         (Sized_target::plt_entry_size): New function.
8440         * x86_64.cc (Target_x86_64::got_size): Add const.
8441         (Target_x86_64::got_entry_count): New function.
8442         (Target_x86_64::plt_entry_count): New function.
8443         (Target_x86_64::first_plt_entry_offset): New function.
8444         (Target_x86_64::plt_entry_size): New function.
8445         (Output_data_plt_x86_64::entry_count): New function.
8446         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
8447         (Output_data_plt_x86_64::get_plt_entry_size): New function.
8448
8449 2010-08-12  Cary Coutant  <ccoutant@google.com>
8450
8451         * archive.cc: Include incremental.h.
8452         (Archive::Archive): Initialize incremental_info_.
8453         (Archive::include_member): Record archive members in incremental info.
8454         (Add_archive_symbols::run): Record begin and end of an archive in
8455         incremental info.
8456         (Lib_group::include_member): Record objects in incremental info.
8457         * archive.h (Incremental_archive_entry): Forward declaration.
8458         (Archive::set_incremental_info): New member function.
8459         (Archive::incremental_info): New member function.
8460         (Archive::Unused_symbol_iterator): New class.
8461         (Archive::unused_symbols_begin): New member function.
8462         (Archive::unused_symbols_end): New member function.
8463         (Archive::incremental_info_): New data member.
8464         * incremental-dump.cc (find_input_containing_global): New function.
8465         (dump_incremental_inputs): Dump new incremental info sections.
8466         * incremental.cc: Include symtab.h.
8467         (Output_section_incremental_inputs): New class.
8468         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
8469         new incremental info sections.
8470         (Sized_incremental_binary::do_check_inputs): Likewise.
8471         (Incremental_inputs::report_archive): Remove.
8472         (Incremental_inputs::report_archive_begin): New function.
8473         (Incremental_inputs::report_archive_end): New function.
8474         (Incremental_inputs::report_object): New function.
8475         (Incremental_inputs::finalize_inputs): Remove.
8476         (Incremental_inputs::report_input_section): New function.
8477         (Incremental_inputs::report_script): Rewrite.
8478         (Incremental_inputs::finalize): Do nothing but finalize string table.
8479         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8480         (Incremental_inputs::sized_create_inputs_section_data): Remove.
8481         (Incremental_inputs::create_data_sections): New function.
8482         (Incremental_inputs::relocs_entsize): New function.
8483         (Output_section_incremental_inputs::set_final_data_size): New function.
8484         (Output_section_incremental_inputs::do_write): New function.
8485         (Output_section_incremental_inputs::write_header): New function.
8486         (Output_section_incremental_inputs::write_input_files): New function.
8487         (Output_section_incremental_inputs::write_info_blocks): New function.
8488         (Output_section_incremental_inputs::write_symtab): New function.
8489         * incremental.h (Incremental_script_entry): Forward declaration.
8490         (Incremental_object_entry): Forward declaration.
8491         (Incremental_archive_entry): Forward declaration.
8492         (Incremental_inputs): Forward declaration.
8493         (Incremental_inputs_header_data): Remove.
8494         (Incremental_inputs_header): Remove.
8495         (Incremental_inputs_header_write): Remove.
8496         (Incremental_inputs_entry_data): Remove.
8497         (Incremental_inputs_entry): Remove.
8498         (Incremental_inputs_entry_write): Remove.
8499         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
8500         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
8501         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8502         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
8503         Likewise.
8504         (Incremental_input_entry): New class.
8505         (Incremental_script_entry): New class.
8506         (Incremental_object_entry): New class.
8507         (Incremental_archive_entry): New class.
8508         (Incremental_inputs::Incremental_inputs): Initialize new data members.
8509         (Incremental_inputs::report_inputs): Remove.
8510         (Incremental_inputs::report_archive): Remove.
8511         (Incremental_inputs::report_archive_begin): New function.
8512         (Incremental_inputs::report_archive_end): New function.
8513         (Incremental_inputs::report_object): Change prototype.
8514         (Incremental_inputs::report_input_section): New function.
8515         (Incremental_inputs::report_script): Change prototype.
8516         (Incremental_inputs::get_reloc_count): New function.
8517         (Incremental_inputs::set_reloc_count): New function.
8518         (Incremental_inputs::create_data_sections): New function.
8519         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8520         (Incremental_inputs::inputs_section): New function.
8521         (Incremental_inputs::symtab_section): New function.
8522         (Incremental_inputs::relocs_section): New function.
8523         (Incremental_inputs::get_stringpool): Add const.
8524         (Incremental_inputs::command_line): Add const.
8525         (Incremental_inputs::inputs): Remove.
8526         (Incremental_inputs::command_line_key): New function.
8527         (Incremental_inputs::input_file_count): New function.
8528         (Incremental_inputs::input_files): New function.
8529         (Incremental_inputs::relocs_entsize): New function.
8530         (Incremental_inputs::sized_create_inputs_section_data): Remove.
8531         (Incremental_inputs::finalize_inputs): Remove.
8532         (Incremental_inputs::Input_info): Remove.
8533         (Incremental_inputs::lock_): Remove.
8534         (Incremental_inputs::inputs_): Change type.
8535         (Incremental_inputs::inputs_map_): Remove.
8536         (Incremental_inputs::current_object_entry_): New data member.
8537         (Incremental_inputs::inputs_section_): New data member.
8538         (Incremental_inputs::symtab_section_): New data member.
8539         (Incremental_inputs::relocs_section_): New data member.
8540         (Incremental_inputs::reloc_count_): New data member.
8541         (Incremental_inputs_reader): New class.
8542         (Incremental_symtab_reader): New class.
8543         (Incremental_relocs_reader): New class.
8544         * layout.cc (Layout::finalize): Move finalization of incremental info
8545         and creation of incremental info sections to follow finalization of
8546         symbol table.  Set offsets for postprocessing sections.
8547         (Layout::create_incremental_info_sections): Call
8548         Incremental_inputs::create_data_sections.  Add incremental symtab
8549         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
8550         sections to layout after input sections.
8551         * layout.h (struct Timespec): Forward declaration.
8552         (Layout::incremental_inputs): Add const.
8553         (Layout::create_incremental_info_sections): Add parameter.
8554         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
8555         * object.cc: Include incremental.h.
8556         (Relobj::finalize_incremental_relocs): New function.
8557         (Sized_relobj::do_layout): Record input sections in incremental info.
8558         * object.h (Object::output_section): New function.
8559         (Object::output_section_offset): Moved from Relobj.
8560         (Object::get_incremental_reloc_base): New function.
8561         (Object::get_incremental_reloc_count): New function.
8562         (Object::do_output_section): New function.
8563         (Object::do_output_section_offset): Moved from Relobj.
8564         (Object::do_get_incremental_reloc_base): New function.
8565         (Object::do_get_incremental_reloc_count): New function.
8566         (Object::Object): Initialize new data members.
8567         (Relobj::output_section): Renamed do_output_section and moved to
8568         protected.
8569         (Relobj::output_section_offset): Moved to Object.
8570         (Relobj::do_get_incremental_reloc_base): New function.
8571         (Relobj::do_get_incremental_reloc_count): New function.
8572         (Relobj::allocate_incremental_reloc_counts): New function.
8573         (Relobj::count_incremental_reloc): New function.
8574         (Relobj::finalize_incremental_relocs): New function.
8575         (Relobj::next_incremental_reloc_index): New function.
8576         (Relobj::reloc_counts_): New data member.
8577         (Relobj::reloc_bases_): New data member.
8578         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
8579         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
8580         (Sized_relobj::incremental_relocs_scan): New function.
8581         (Sized_relobj::incremental_relocs_scan_reltype): New function.
8582         (Sized_relobj::incremental_relocs_write): New function.
8583         (Sized_relobj::incremental_relocs_write_reltype): New function.
8584         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
8585         incremental link.
8586         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
8587         archives and object files elsewhere.
8588         (Add_symbols::run): Report object files here.
8589         (Finish_group::run): Report end of archive at end of group.
8590         * reloc.cc: Include layout.h, incremental.h.
8591         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
8592         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
8593         (Sized_relobj::incremental_relocs_scan): New function.
8594         (Sized_relobj::incremental_relocs_scan_reltype): New function.
8595         (Sized_relobj::do_relocate_sections): Write incremental relocations.
8596         (Sized_relobj::incremental_relocs_write): New function.
8597         (Sized_relobj::incremental_relocs_write_reltype): New function.
8598         * script.cc (read_input_script): Rewrite test for incremental link.
8599         Change call to Incremental_inputs::report_script.
8600         * symtab.h (Symbol_table::first_global_index): New function.
8601         (Symbol_table::output_count): New function.
8602
8603 2010-08-12  Doug Kwan  <dougkwan@google.com>
8604
8605         * arm.cc (Target_arm::merge_object_attributes): Check command line
8606         options --no-wchar-size-warning and --no-enum-size-warning.
8607         * options.h (General_options): Add ld-compatible options
8608         --no-enum-size-warning and --no-wchar-size-warning.
8609
8610 2010-08-04  Ian Lance Taylor  <iant@google.com>
8611
8612         * x86_64.cc (Target_x86_64::Scan::local): Use
8613         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
8614         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
8615         (Target_x86_64::Scan::global): Likewise.
8616         (Target_x86_64::Relocate::relocate): Likewise.
8617         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
8618         Likewise.
8619
8620 2010-08-03  Cary Coutant  <ccoutant@google.com>
8621
8622         * merge.cc (Output_merge_string::do_add_input_section): Count strings
8623         to reserve space in merged_strings vector. Keep total input size
8624         for stats.
8625         (Output_merge_string::do_print_merge_stats): Print total input size.
8626         * merge.h (Output_merge_string): Add input_size_ field.
8627         * stringpool.cc (Stringpool_template::string_length): Move
8628         implementations out of Stringpool_template class and place in
8629         stringpool.h.
8630         * stringpool.h (string_length): Move out of Stringpool_template.
8631
8632 2010-08-03  Ian Lance Taylor  <iant@google.com>
8633
8634         PR 11712
8635         * layout.cc (relaxation_loop_body): If address of load segment is
8636         set, adjust address to include headers if possible.
8637
8638 2010-08-03  Ian Lance Taylor  <iant@google.com>
8639
8640         * version.cc (version_string): Bump to 1.10.
8641
8642 2010-08-03  Ian Lance Taylor  <iant@google.com>
8643
8644         PR 11805
8645         * layout.h (enum Output_section_order): Define.
8646         (class Layout): Update declarations.
8647         * layout.cc (Layout::get_output_section): Add order parameter.
8648         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
8649         is_first_non_relro parameters.  Change all callers.
8650         (Layout::choose_output_section): Likewise.
8651         (Layout::add_output_section_data): Likewise.
8652         (Layout::make_output_section): Likewise.  Set order.
8653         (Layout::default_section_order): New function.
8654         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
8655         * output.cc (Output_section::Output_section): Initialize order_.
8656         Don't initialize deleted fields.
8657         (Output_segment::Output_segment): Don't initialize deleted
8658         fields.
8659         (Output_segment::add_output_section_to_load): New function
8660         replacing add_output_section.  Change all callers to call this or
8661         add_output_section_to_nonload.
8662         (Output_segment::add_output_section_to_nonload): New function.
8663         (Output_segment::remove_output_section): Rewrite.
8664         (Output_segment::add_initial_output_data): Likewise.
8665         (Output_segment::has_any_data_sections): Likewise.
8666         (Output_segment::is_first_section_relro): Likewise.
8667         (Output_segment::maximum_alignment): Likewise.
8668         (Output_segment::has_dynamic_reloc): New function replacing
8669         dynamic_reloc_count.  Change all callers.
8670         (Output_segment::has_dynamic_reloc_list): New function replacing
8671         dynamic_reloc_count_list.  Change all callers.
8672         (Output_segment::set_section_addresses): Rewrite.
8673         (Output_segment::set_offset): Rewrite.
8674         (Output_segment::find_first_and_last_list): Remove.
8675         (Output_segment::set_tls_offsets): Rewrite.
8676         (Output_segment::first_section_load_address): Likewise.
8677         (Output_segment::output_section_count): Likewise.
8678         (Output_segment::section_with_lowest_load_address): Likewise.
8679         (Output_segment::write_section_headers): Likewise.
8680         (Output_segment::print_sections_to_map): Likewise.
8681         * output.h (class Output_data): Remove dynamic_reloc_count_
8682         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
8683         (Output_data::add_dynamic_reloc): Rewrite.
8684         (Output_data::has_dynamic_reloc): New function.
8685         (Output_data::dynamic_reloc_count): Remove.
8686         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
8687         is_last_relro_, is_first_non_relro_, is_interp_,
8688         is_dynamic_linker_section_ fields.  Add order and set_order
8689         functions.  Remove is_relro_local, set_is_relro_local,
8690         is_last_relro, set_is_last_relro, is_first_non_relro,
8691         set_is_first_non_relro functions, is_interp, set_is_interp,
8692         is_dynamic_linker_section, and set_is_dynamic_linker_section
8693         functions.
8694         (class Output_segment): Change Output_data_list from std::list to
8695         std:;vector.  Add output_lists_ field.  Remove output_data_ and
8696         output_bss_ fields.  Update declarations.
8697
8698 2010-08-02  Ian Lance Taylor  <iant@google.com>
8699
8700         * arm.cc (Target_arm::gc_process_relocs): Use typename.
8701         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
8702         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
8703
8704 2010-08-02  Ian Lance Taylor  <iant@google.com>
8705
8706         PR 11855
8707         * script.cc (Script_options::Script_options): Initialize
8708         symbol_definitions_ and symbol_references_.
8709         (Script_options::add_symbol_assignment): Update
8710         symbol_definitions_ and symbol_references_.
8711         (Script_options::add_symbol_reference): New function.
8712         (script_symbol): New function.
8713         * script.h (class Script_options): Add symbol_definitions_ and
8714         symbol_references_ fields.
8715         (Script_options::referenced_const_iterator): New type.
8716         (Script_options::referenced_begin): New function.
8717         (Script_options::referenced_end): New function.
8718         (Script_options::is_referenced): New function.
8719         (Script_options::any_unreferenced): New function.
8720         * script-c.h (script_symbol): Declare.
8721         * yyscript.y (exp): Call script_symbol.
8722         * symtab.cc: Include "script.h".
8723         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
8724         Change all callers.  Check symbols referenced by scripts.
8725         (Symbol_table::add_undefined_symbols_from_command_line): Add
8726         layout parameter.  Change all callers.
8727         (Symbol_table::do_add_undefined_symbols_from_command_line):
8728         Likewise.  Break out loop body.  Check symbols referenced by
8729         scripts.
8730         (Symbol_table::add_undefined_symbol_from_command_line): New
8731         function broken out of
8732         do_add_undefined_symbols_from_command_line.
8733         * symtab.h (class Symbol_table): Update declarations.
8734         * archive.cc: Include "layout.h".
8735         (Archive::should_include_member): Add layout parameter.  Change
8736         all callers.  Check for symbol mentioned in expression.
8737         * archive.h (class Archive): Update declaration.
8738         * object.cc (Sized_relobj::do_should_include_member): Add layout
8739         parameter.
8740         * object.h (Object::should_include_member): Add layout parameter.
8741         Change all callers.
8742         (Object::do_should_include_member): Add layout parameter.
8743         (class Sized_relobj): Update declaration.
8744         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
8745         parameter.
8746         * dynobj.h (class Sized_dynobj): Update declaration.
8747         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
8748         layout parameter.
8749         * plugin.h (class Sized_pluginobj): Update declaration.
8750
8751 2010-08-02  Ian Lance Taylor  <iant@google.com>
8752
8753         PR 11866
8754         * output.cc (Output_segment::set_offset): Search for the first and
8755         last sections rather than assuming that the list is in order.
8756         (Output_segment::find_first_and_last_list): New function.
8757         * output.h (class Output_segment): Update declarations.
8758         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
8759         (relro_strip_test_SOURCES): New variable.
8760         (relro_strip_test_DEPENDENCIES): New variable.
8761         (relro_strip_test_LDFLAGS): New variable.
8762         (relro_strip_test_LDADD): New variable.
8763         (relro_strip_test.so): New target.
8764
8765 2010-08-02  Ian Lance Taylor  <iant@google.com>
8766
8767         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
8768         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
8769         (Target_i386::got_tlsdesc_section): New function.
8770         (Target_i386::got_section): Create space for GOT entries for
8771         TLSDESC relocations.
8772         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
8773         R_386_TLS_GOTDESC.
8774         (Target_i386::Scan::global): Likewise.
8775         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
8776         using TLSDESC GOT.
8777         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
8778         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
8779         (Target_x86_64::got_tlsdesc_section): New function.
8780         (Target_x86_64::got_section): Create space for GOT entries for
8781         TLSDESC relocations.
8782         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
8783         R_386_TLS_GOTDESC.
8784         (Target_x86_64::Scan::global): Likewise.
8785         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
8786         using TLSDESC GOT.
8787
8788 2010-08-02  Ian Lance Taylor  <iant@google.com>
8789
8790         * testsuite/final_layout.sh: Use dc to convert from hex to
8791         decimal.
8792
8793 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
8794
8795         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
8796         paramter to the call to gold::gc_process_relocs.
8797         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
8798         paramter to the call to gold::gc_process_relocs.
8799         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
8800         parameter to the call to gold::gc_process_relocs.
8801         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
8802         template parameter to the call to gold::gc_process_relocs.
8803         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
8804         paramter to the call to gold::gc_process_relocs.
8805         * gc.h (get_embedded_addend_size): New function.
8806         (gc_process_relocs): Save the size of the reloc for use by ICF.
8807         * icf.cc (get_section_contents): Get the addend from the text section
8808         for SHT_REL relocation sections.
8809         * icf.h (Icf::Reloc_addend_size_info): New typedef.
8810         (Icf::Reloc_info): Add new member reloc_addend_size_info.
8811         * int_encoding.h (read_from_pointer): New overloaded function.
8812         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
8813         * testsuite/icf_sht_rel_addend_test.sh: New file.
8814         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
8815         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
8816
8817 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8818
8819         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
8820         * Makefile.in: Regenerate.
8821         * testsuite/Makefile.in: Regenerate.
8822
8823 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
8824
8825         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
8826         * gold/testsuite/debug_msg.cc: Likewise.
8827         * gold/testsuite/odr_violation1.cc
8828         * gold/testsuite/odr_violation2.cc
8829
8830 2010-07-21  Cary Coutant  <ccoutant@google.com>
8831
8832         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
8833         string, and length fields.
8834         (Output_merge_string::Merged_strings_list): New type.
8835         (Output_merge_string::Merged_strings_lists): New typedef.
8836         (Output_merge_string): Replace merged_strings_ with
8837         merged_strings_lists_.
8838         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
8839         Merged_strings_list per input object and section.  Don't store pointer
8840         to the string.  Don't store length with each merged string entry.
8841         (Output_merge_string::finalize_merged_data): Loop over list of merged
8842         strings lists.  Recompute length of each merged string.
8843
8844 2010-07-15  Cary Coutant  <ccoutant@google.com>
8845
8846         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
8847         here.
8848
8849 2010-07-14  Ian Lance Taylor  <iant@google.com>
8850
8851         * descriptors.cc (Descriptors::open): Report correct name in error
8852         message.
8853
8854 2010-07-13  Doug Kwan  <dougkwan@google.com>
8855
8856         * arm.cc (Arm_input_section::Arm_input_section): For a
8857         SHT_ARM_EXIDX section, always keeps the input sections.
8858         (Arm_input_section::set_exidx_section_link): New method.
8859         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
8860         has_errors_ to false.
8861         (Arm_exidx_input_section::has_errors,
8862         Arm_exidx_input_section::set_has_errors): New methods.
8863         (Arm_exidx_input_section::has_errors_): New data member.
8864         (Arm_relobj::get_exidx_shndx_list): New method.
8865         (Arm_output_section::append_text_sections_to_list): Do not skip
8866         section without SHF_EXECINSTR.
8867         (Arm_output_section::fix_exidx_coverage): Skip input sections with
8868         errors.
8869         (Arm_relobj::make_exidx_input_section): Add new parameter for text
8870         section header.  Make error messages more verbose.  Check for
8871         a non-executable section linked to an EXIDX section.
8872         (Arm_relobj::do_read_symbols): Remove error checking, which has been
8873         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
8874         check that there is no deferred EXIDX section if we exit early.
8875         Instead of not making an EXIDX section in case of an error, make one
8876         and set the has_errors flag of it.
8877         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
8878         in a relocatable link.
8879         (Target_arm::do_relax): Look for the EXIDX output section instead of
8880         assuming that it is called .ARM.exidx.
8881         (Target_arm::fix_exidx_coverage): Add a new parameter for input
8882         section list.  Do not check for SHF_EXECINSTR section flags but
8883         skip any input section with errors.
8884         * output.cc (Output_section::Output_section): Initialize
8885         always_keeps_input_sections_ to false.
8886         (Output_section::add_input_section): Check for
8887         always_keeps_input_sections_.
8888         *  output.h (Output_section::always_keeps_input_sections,
8889         Output_section::set_always_keeps_input_sections): New methods.
8890         (Output_section::always_keeps_input_sections): New data member.
8891
8892 2010-07-13  Rafael Espindola  <espindola@google.com>
8893
8894         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
8895         * fileread.h (Input_file): Add try_extra_search_path and find_file.
8896
8897 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
8898             Ian Lance Taylor  <iant@google.com>
8899
8900         * output.h (Output_section_lookup_maps::add_merge_section):
8901         Correct check of whether value was inserted.
8902         (Output_section_lookup_maps::add_merge_input_section): Likewise.
8903         (Output_section_lookup_maps::add_relaxed_input_section):
8904         Likewise.
8905         * arm.cc (Target_arm::got_section): Remove used local os.
8906         * i386.cc (Target_i386::got_section): Likewise.
8907         * x86_64.cc (Target_x86_64::got_section): Likewise.
8908         * sparc.cc (Target_sparc::got_section): Likewise.
8909         (Target_sparc::relocate): Remove unused local have_got_offset.
8910         * powerpc.cc (Target_powerpc::relocate): Likewise.
8911
8912 2010-07-13  Ian Lance Taylor  <iant@google.com>
8913
8914         * compressed_output.cc (zlib_decompress): Fix signature in
8915         !HAVE_ZLIB_H case.
8916
8917         * archive.cc (Archive::include_member): Unlock an external member
8918         of a thin archive.  Don't bother to delete an object we know is
8919         NULL.
8920
8921 2010-07-12  Cary Coutant  <ccoutant@google.com>
8922
8923         * compressed_output.cc (zlib_decompress): New function.
8924         (get_uncompressed_size): New function.
8925         (decompress_input_section): New function.
8926         * compressed_output.h (get_uncompressed_size): New function.
8927         (decompress_input_section): New function.
8928         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
8929         Handle compressed debug sections.
8930         * layout.cc (is_compressed_debug_section): New function.
8931         (Layout::output_section_name): Map compressed section names to
8932         canonical names.
8933         * layout.h (is_compressed_debug_section): New function.
8934         (is_debug_info_section): Recognize compressed debug sections.
8935         * merge.cc: Include compressed_output.h.
8936         (Output_merge_data::do_add_input_section): Handle compressed
8937         debug sections.
8938         (Output_merge_string::do_add_input_section): Handle compressed
8939         debug sections.
8940         * object.cc: Include compressed_output.h.
8941         (Sized_relobj::Sized_relobj): Initialize new data members.
8942         (build_compressed_section_map): New function.
8943         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8944         * object.h (Object::section_is_compressed): New method.
8945         (Object::do_section_is_compressed): New method.
8946         (Sized_relobj::Compressed_section_map): New type.
8947         (Sized_relobj::do_section_is_compressed): New method.
8948         (Sized_relobj::compressed_sections_): New data member.
8949         * output.cc (Output_section::add_input_section): Handle compressed
8950         debug sections.
8951         * reloc.cc: Include compressed_output.h.
8952         (Sized_relobj::write_sections): Handle compressed debug sections.
8953
8954 2010-07-08  Cary Coutant  <ccoutant@google.com>
8955
8956         * resolve.cc (Symbol_table::resolve): Remember whether undef was
8957         weak when resolving to a dynamic def.
8958         (Symbol_table::should_override): Add adjust_dyndef flag; set it
8959         for weak undef/dynamic def cases. Adjust callers.
8960         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8961         undef_binding_weak_.
8962         (Symbol_table::sized_write_globals): Adjust symbol binding.
8963         (Symbol_table::sized_write_symbol): Add binding parameter.
8964         * symtab.h (Symbol::set_undef_binding): New method.
8965         (Symbol::is_undef_binding_weak): New method.
8966         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8967         (Symbol_table::should_override): Add new parameter.
8968         (Symbol_table::sized_write_symbol): Add new parameter.
8969
8970         * testsuite/weak_undef_file1.cc: Add new test case.
8971         * testsuite/weak_undef_file2.cc: Fix header comment.
8972         * testsuite/weak_undef_test.cc: Add new test case.
8973
8974 2010-06-29  Doug Kwan  <dougkwan@google.com>
8975
8976         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8977         Initialize USE_SYMBOL_.
8978         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8979         definition.
8980         (Arm_reloc_property::uses_symbol_): New data member declaration.
8981         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8982         uses symbol value and symbol is undefined but not weakly undefined.
8983
8984 2010-06-28  Rafael Espindola  <espindola@google.com>
8985
8986         * plugin.cc (Plugin::load): Use dlerror.
8987
8988 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
8989
8990         * symtab.cc (detect_odr_violations): When reporting an ODR
8991         violation, report an object where the symbol is defined.
8992
8993 2010-06-25  Doug Kwan  <dougkwan@google.com>
8994
8995         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8996         (Target_arm::section_may_have_icf_unsafe_pointers): New method
8997         definition.
8998         (Target_arm::Scan::local_reloc_may_be_function_pointer,
8999         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
9000         target hook to detect function points.
9001         (Target_arm::Scan::possible_function_pointer_reloc): New method.
9002         * icf.h (Icf::check_section_for_function_pointers): Change type of
9003         parameter SECTION_NAME to const reference to std::string.  Use
9004         target hook to determine if section may have unsafe pointers.
9005         * target.h (Target::section_may_have_icf_unsafe_pointers): New
9006         method definition.
9007
9008 2010-06-21  Rafael Espindola  <espindola@google.com>
9009
9010         * fileread.cc (Input_file::find_fie): New
9011         (Input_file::open): Use Input_file::find_fie.
9012         * fileread.h (Input_file::find_fie): New
9013         * plugin.cc (set_extra_library_path): New.
9014         (Plugin::load): Add set_extra_library_path to the transfer vector.
9015         (Plugin_manager::set_extra_library_path): New.
9016         (Plugin_manager::add_input_file): Use the extra search path if set.
9017         (set_extra_library_path(): New.
9018         * plugin.h (Plugin_manager): Add set_extra_library_path and
9019         extra_search_path_.
9020
9021 2010-06-19  Cary Coutant  <ccoutant@google.com>
9022
9023         * layout.cc (gdb_sections): Add .debug_types.
9024         (lines_only_debug_sections): Likewise.
9025
9026 2010-06-18  Rafael Espindola  <espindola@google.com>
9027
9028         * plugin.cc (add_input_file,add_input_library)
9029         (Plugin_manager::add_input_file): Make filename arguments const.
9030         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
9031         const.
9032
9033 2010-06-16  Doug Kwan  <dougkwan@google.com>
9034
9035         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
9036         .ARM.attributes section if we have not merged any input
9037         attributes sections.
9038
9039 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9040
9041         * arm.cc: Allow combining objects with no EABI version
9042         information.
9043
9044 2010-06-15  Rafael Espindola  <espindola@google.com>
9045
9046         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
9047
9048 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9049
9050         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
9051         (struct iovec): Correct !HAVE_READV definition.
9052
9053 2010-06-10  Cary Coutant  <ccoutant@google.com>
9054
9055         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
9056         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
9057         reloc sections.
9058         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
9059
9060         PR 11683
9061         * symtab.h (Symbol::is_placeholder): New member function.
9062         * target-reloc.h (relocate_section): Check for placeholder symbols.
9063
9064         * testsuite/Makefile.am (plugin_test_8): New test.
9065         (plugin_test_9): New test.
9066         * testsuite/Makefile.in: Regenerate.
9067
9068 2010-06-09  Nick Clifton  <nickc@redhat.com>
9069
9070         * yyscript.y (input_list_element): Allow strings prefixed with
9071         the '-' character.  Treat these as libraries.
9072         * script.cc (script_add_library): New function.  Adds a library
9073         specified by "-l<name>" found in an input script.
9074         * script-c.h: Add prototype for script_add_library.
9075
9076 2010-06-07  Doug Kwan  <dougkwan@google.com>
9077
9078         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
9079         Restrict stub-group size to be within long conditional branch
9080         range when working around cortex-A8 erratum.
9081
9082 2010-06-07  Damien Diederen  <dd@crosstwine.com>
9083
9084         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
9085         #ifdef typo.
9086
9087 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
9088
9089         PR gold/11658
9090         * output.cc
9091         (Output_section::Input_section_sort_entry::compare_section_ordering):
9092         Change to return non-zero correctly.
9093         (Output_section::Input_section_sort_section_order_index_compare
9094         ::operator()): Change to fix ambiguity in comparisons.
9095
9096 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
9097
9098         * gold.h (is_wildcard_string): New function.
9099         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
9100         (Layout::layout_eh_frame): Ditto.
9101         (Layout::find_section_order_index): New method.
9102         (Layout::read_layout_from_file): New method.
9103         * layout.h (Layout::find_section_order_index): New method.
9104         (Layout::read_layout_from_file): New method.
9105         (Layout::input_section_position_): New private member.
9106         (Layout::input_section_glob_): New private member.
9107         * main.cc (main): Call read_layout_from_file here.
9108         * options.h (--section-ordering-file): New option.
9109         * output.cc (Output_section::input_section_order_specified_): New
9110         member.
9111         (Output_section::Output_section): Initialize new member.
9112         (Output_section::add_input_section): Add new parameter.
9113         Keep input sections when --section-ordering-file is used.
9114         (Output_section::set_final_data_size): Sort input sections when
9115         section ordering file is specified.
9116         (Output_section::Input_section_sort_entry): Add new parameter.
9117         Check sorting type.
9118         (Output_section::Input_section_sort_entry::compare_section_ordering):
9119         New method.
9120         (Output_section::Input_section_sort_compare::operator()): Change to
9121         consider section_order_index.
9122         (Output_section::Input_section_sort_init_fini_compare::operator()):
9123         Change to consider section_order_index.
9124         (Output_section::Input_section_sort_section_order_index_compare
9125         ::operator()): New method.
9126         (Output_section::sort_attached_input_sections): Change to sort
9127         according to section order when specified.
9128         (Output_section::add_input_section<32, true>): Add new parameter.
9129         (Output_section::add_input_section<64, true>): Add new parameter.
9130         (Output_section::add_input_section<32, false>): Add new parameter.
9131         (Output_section::add_input_section<64, false>): Add new parameter.
9132         * output.h (Output_section::add_input_section): Add new parameter.
9133         (Output_section::input_section_order_specified): New
9134         method.
9135         (Output_section::set_input_section_order_specified): New method.
9136         (Input_section::Input_section): Initialize section_order_index_.
9137         (Input_section::section_order_index): New method.
9138         (Input_section::set_section_order_index): New method.
9139         (Input_section::section_order_index_): New member.
9140         (Input_section::Input_section_sort_section_order_index_compare): New
9141         struct.
9142         (Output_section::input_section_order_specified_): New member.
9143         * script-sections.cc (is_wildcard_string): Delete and move modified
9144         method to gold.h.
9145         (Output_section_element_input::Output_section_element_input): Modify
9146         call to is_wildcard_string.
9147         (Output_section_element_input::Input_section_pattern
9148         ::Input_section_pattern): Ditto.
9149         (Output_section_element_input::Output_section_element_input): Ditto.
9150         * testsuite/Makefile.am (final_layout): New test case.
9151         * testsuite/Makefile.in: Regenerate.
9152         * testsuite/final_layout.cc: New file.
9153         * testsuite/final_layout.sh: New file.
9154
9155 2010-06-01  Rafael Espindola  <espindola@google.com>
9156
9157         * plugin.cc (Plugin::load): Pass the output name to the plugin.
9158
9159 2010-06-01  Rafael Espindola  <espindola@google.com>
9160
9161         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
9162         visibility of symbols.
9163
9164 2010-05-27  Doug Kwan  <dougkwan@google.com>
9165
9166         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
9167         from start of output section instead of address for a local symbol
9168         in a merged or relaxed section when doing a relocatable link.
9169
9170 2010-05-26  Rafael Espindola  <espindola@google.com>
9171
9172         PR 11604
9173         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
9174         adding sections the garbage collector removed.
9175         * gold/testsuite/Makefile.am: Add test.
9176         * gold/testsuite/Makefile.in: Regenerate.
9177         * gold/testsuite/plugin_test_7.sh: New.
9178         * gold/testsuite/plugin_test_7_1.c: New.
9179         * gold/testsuite/plugin_test_7_2.c: New.
9180
9181 2010-05-26  Rafael Espindola  <espindola@google.com>
9182
9183         * script-sections.cc (Output_section_definition::set_section_addresses):
9184         Check for --section-start.
9185
9186 2010-05-26  Doug Kwan  <dougkwan@google.com>
9187
9188         * arm.cc (Arm_scan_relocatable_relocs): New class.
9189         (Target_arm::relocate_special_relocatable): New method.
9190         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
9191         (Arm_relocate_functions::thumb_branch_common): Same.
9192         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
9193         instead of Default_scan_relocatable_relocs.
9194         * target-reloc.h (relocate_for_relocatable): Let target handle
9195         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
9196         * target.h (Sized_target::relocate_special_relocatable): New method.
9197
9198 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9199
9200         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
9201
9202 2010-05-23  Doug Kwan  <dougkwan@google.com>
9203
9204         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
9205         instead of a cast.
9206         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
9207         with a direct branch, not a conditional branch, to a stub.
9208         * merge.cc (Output_merge_base::record_input_section): New method
9209         defintion.
9210         (Output_merge_data::do_add_input_section): Record input section if
9211         keeps-input-sections flag is set.
9212         (Output_merge_string::do_add_input_section): Ditto.
9213         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
9214         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
9215         INPUT_SECTIONS_.
9216         (Output_merge_base::keeps_input_sections,
9217         Output_merge_base::set_keeps_input_sections,
9218         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
9219         method definitions.
9220         (Output_merge_base::Input_sections): New type declaration.
9221         (Output_merge_base::input_sections_begin,
9222         Output_merge_base::input_sections_end,
9223         Output_merge_base::do_set_keeps_input_sections): New method definitions.
9224         (Output_merge_base::bool keeps_input_sections_,
9225         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
9226         Output_merge_base::input_sections_): New data members.
9227         (Output_merge_data::do_set_keeps_input_sections): New method
9228         defintion.
9229         (Output_merge_string::do_set_keeps_input_sections): Ditto.
9230         * output.cc (Output_section::Input_section::relobj): Move method
9231         defintion from class declaration to here and handle merge sections.
9232         (Output_section::Input_section::shndx): Ditto.
9233         (Output_section::Output_section): Remove initializations of removed
9234         data members and initialize new data member LOOKUP_MAPS_.
9235         (Output_section::add_input_section): Set keeps-input-sections flag
9236         for a newly created merge output section as appropriate.  Adjust code
9237         to use Output_section_lookup_maps class.
9238         (Output_section::add_relaxed_input_section): Adjst code for lookup
9239         maps code refactoring.
9240         (Output_section::add_merge_input_section): Add a new parameter
9241         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
9242         class.  If adding input section to a newly created merge output
9243         section fails, remove the new merge section.
9244         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
9245         Adjust code for use of the Output_section_lookup_maps class.
9246         (Output_section::find_merge_section): Ditto.
9247         (Output_section::build_lookup_maps): New method defintion.
9248         (Output_section::find_relaxed_input_section): Adjust code to use
9249         Output_section_lookup_maps class.
9250         (Output_section::get_input_sections): Export merge sections.  Adjust
9251         code to use Output_section_lookup_maps class.
9252         (Output_section:::add_script_input_section): Adjust code to use
9253         Output_section_lookup_maps class.  Update lookup maps for merge
9254         sections also.
9255         (Output_section::discard_states): Use Output_section_lookup_maps.
9256         (Output_section::restore_states): Same.
9257         * output.h (Merge_section_properties): Move class defintion out of
9258         Output_section.
9259         (Output_section_lookup_maps): New class.
9260         (Output_section::Input_section::is_merge_section): New method
9261         defintion.
9262         (Output_section::Input_section::relobj): Move defintion out of class
9263         defintion.  Declare method only.
9264         (Output_section::Input_section::shndx): Ditto.
9265         (Output_section::Input_section::output_merge_base): New method defintion.
9266         (Output_section::Input_section::u2_.pomb): New union field.
9267         (Output_section::Merge_section_by_properties_map,
9268         Output_section::Output_section_data_by_input_section_map,
9269         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
9270         Remove types.
9271         (Output_section::add_merge_input_section): Add new parameter
9272         KEEPS_INPUT_SECTIONS.
9273         (Output_section::build_lookup_maps): New method declaration.
9274         (Output_section::merge_section_map_,
9275         Output_section::merge_section_by_properties_map_,
9276         Output_section::relaxed_input_section_map_,
9277         Output_section::is_relaxed_input_section_map_valid_): Remove data
9278         members.
9279         (Output_section::lookup_maps_): New data member.
9280
9281 2010-05-21  Doug Kwan  <dougkwan@google.com>
9282
9283         PR gold/11619
9284         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
9285         avoid a compilation error.
9286
9287 2010-05-19  Rafael Espindola  <espindola@google.com>
9288
9289         * script-sections.cc (Output_section_definition::allocate_to_segment):
9290         Update the phdrs_list even when the output section is NULL.
9291         * testsuite/Makefile.am: Add test.
9292         * testsuite/Makefile.in: Regenerate.
9293         * testsuite/script_test_9.cc: New.
9294         * testsuite/script_test_9.sh: New.
9295         * testsuite/script_test_9.t: New.
9296
9297 2010-05-19  Doug Kwan  <dougkwan@google.com>
9298
9299         * arm.cc (Arm_input_section::original_size): New method.
9300         (Arm_input_section::do_addralign): Add a cast.
9301         (Arm_input_section::do_output_offset): Remove static cast.
9302         (Arm_input_section::original_addralign,
9303          Arm_input_section::original_size_): Change type to uint32_t.
9304         (Arm_input_section::init): Add safe casts for section alignment
9305         and size.
9306         (Arm_input_section::set_final_data_size): Do not set address and
9307         offset of stub table.
9308         (Arm_output_section::fix_exidx_coverage): Change use of of
9309         Output_section::Simple_input_section to that of
9310         Output_section::Input_section.
9311         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
9312         except for the first pass.
9313         * output.cc (Output_section::get_input_sections): Change type of
9314         input_sections to std::list<Input_section>.
9315         (Output_section::add_script_input_section): Rename from
9316         Output_section::add_simple_input_section.  Change type of SIS
9317         parameter from Simple_input_section to Input_section.
9318         * output.h (Output_section::Simple_input_section): Remove class.
9319         (Output_section::Input_section): Change class visibility to public.
9320         (Output_section::Input_section::addralign): Use stored alignments
9321         for special input sections if set.
9322         (Output_section::Input_section::set_addralign): New method.
9323         (Output_section::get_input_sections): Change parameter type from
9324         list of Simple_input_section to list of Input_section.
9325         (Output_section::add_script_input_section): Rename from
9326         Output_section::add_simple_input_section. Change first parameter's
9327         type from Simple_input_section to Input_section and remove the
9328         second and third parameters.
9329         * script-sections.cc (Input_section::Input_section_list): Change
9330         type to list of Output_section::Input_section/
9331         (Input_section_info::Input_section_info): Change parameter type of
9332         INPUT_SECTION to Output_section::Input_section.
9333         (Input_section_info::input_section): Change return type.
9334         (Input_section_info::input_section_): Change type to
9335         Output_section::Input_section.
9336         (Output_section_element_input::set_section_addresses): Adjust code
9337         to use Output_section::Input_section instead of
9338         Output_section::Simple_input_section.  Adjust code for renaming
9339         of Output_section::add_simple_input_section.
9340         (Orphan_output_section::set_section_addresses): Ditto.
9341
9342 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9343
9344         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
9345         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
9346
9347 2010-05-18  Rafael Espindola  <espindola@google.com>
9348
9349         * options.cc (General_options::finalize): Handle -nostdlib.
9350         * options.h (nostdlib): New option.
9351         * script.cc (script_add_search_dir): Handle -nostdlib.
9352
9353 2010-05-12  Doug Kwan  <dougkwan@google.com>
9354
9355         * arm.cc (Target_arm::do_finalize_sections): Create an empty
9356         attributes section only if there no attributes section after merging.
9357         (Target_arm::merge_object_attributes): Move value of
9358         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
9359         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
9360         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
9361         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
9362         and arm_attr_merge_7.stdout.
9363         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
9364         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
9365         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
9366         arm_attr_merge_7b.o): New rules.
9367         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
9368         arm_attr_merge_7
9369         * testsuite/Makefile.in: Regenerate.
9370         * testsuite/arm_attr_merge.sh: New file.
9371         * testsuite/arm_attr_merge_[67][ab].s: Same.
9372
9373 2010-05-05  Nick Clifton  <nickc@redhat.com>
9374
9375         * po/es.po: Updated Spanish translation.
9376
9377 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
9378
9379         * Makefile.am (install-exec-local): Properly install gold as
9380         default cross linker.
9381         * Makefile.in: Regenerated.
9382
9383 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
9384             Nick Clifton  <nickc@redhat.com>
9385
9386         * configure.ac (install_as_default): Define and set to false
9387         unless --enable-gold or --enable-gold=both/gold has been
9388         specified.
9389         * configure: Regenerate.
9390
9391         * Makefile.am (install-exec-local): Install the executable as
9392         'ld.gold'.  If install_as_default is true then also install it as
9393         'ld'.
9394         * Makefile.in: Regenerated.
9395
9396 2010-04-24  Ian Lance Taylor  <iant@google.com>
9397
9398         * layout.cc (Layout::layout_reloc): In relocatable link don't
9399         combine reloc sections for grouped sections.
9400
9401 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
9402
9403         * gc.h (gc_process_relocs): Pass information on relocs pointing to
9404         sections that are not ordinary to icf.
9405         * icf.cc (get_section_contents): Handle relocation pointing to section
9406         with no object or shndx information.
9407         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
9408         * testsuite/Makefile.in: Regenerate.
9409         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
9410         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
9411
9412 2010-04-22  Ian Lance Taylor  <iant@google.com>
9413
9414         * expression.cc (Expression::Expression_eval_info): Add
9415         result_alignment_pointer field.
9416         (Expression::eval_with_dot): Add result_alignment_pointer
9417         parameter.  Change all callers.
9418         (Expression::eval_maybe_dot): Likewise.
9419         (class Binary_expression): Add alignment_pointer parameter to
9420         left_value and right_value.  Change all callers.
9421         (BINARY_EXPRESSION): Set result alignment.
9422         (class Trinary_expression): Add alignment_pointer parameter to
9423         arg2_value and arg3_value.  Change all callers.
9424         (Trinary_cond::value): Set result alignment.
9425         (Max_expression::value, Min_expression::value): Likewise.
9426         (Align_expression::value): Likewise.
9427         * script-sections.cc (class Sections_element): Add dot_alignment
9428         parameter to set_section_addresses virtual function.  Update
9429         instantiations.
9430         (class Output_section_element): Likewise.
9431         (Script_sections::create_segments): Add dot_alignment parameter.
9432         Change all callers.
9433         (Script_sections::create_segments_from_phdrs_clause): Likewise.
9434         (Script_sections::set_phdrs_clause_addresses): Likewise.
9435         * script-sections.h: Update declarations.
9436         * script.h: Update declarations.
9437         * output.h (Output_segment::set_minimum_p_align): Don't decrease
9438         min_p_align.
9439         * testsuite/script_test_3.t: Set large alignment.
9440         * testsuite/script_test_3.sh: Make sure that at least one LOAD
9441         segment has expected alignment.
9442
9443 2010-04-22  Nick Clifton  <nickc@redhat.com>
9444
9445         * po/gold.pot: Updated by the Translation project.
9446         * po/vi.po: Updated Vietnamese translation.
9447
9448 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
9449
9450         * testsuite/Makefile.am (check_PROGRAMS): Add
9451         icf_virtual_function_folding_test.
9452         * testsuite/Makefile.in: Regenerated.
9453
9454 2010-04-15  Andrew Haley  <aph@redhat.com>
9455
9456         * options.h (merge_exidx_entries): New option.
9457         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
9458         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
9459         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
9460         (Target_arm::merge_exidx_entries): New function.
9461         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
9462         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
9463         to Arm_exidx_fixup constructor.
9464         Add new arg, merge_exidx_entries.
9465         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
9466         Arm_output_section::fix_exidx_coverage.
9467
9468 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
9469
9470         * icf.cc (get_section_contents): Check for preemptible functions.
9471         Ignore addend when appropriate.
9472         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
9473         section folded.
9474         (add_from_relobj): Check for section folded.
9475         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
9476         * symtab.h (should_add_dynsym_entry): Add new parameter.
9477         * target-reloc.h (scan_relocs): Check for section folded.
9478         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
9479         Check reloc types for function pointers in shared objects.
9480         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
9481         case.
9482         (icf_preemptible_functions_test): New test case.
9483         (icf_string_merge_test): New test case.
9484         * testsuite.Makefile.in: Regenerate.
9485         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
9486         bar_glob.  Refactor code.
9487         * testsuite/icf_preemptible_functions_test.cc: New file.
9488         * testsuite/icf_preemptible_functions_test.sh: New file.
9489         * testsuite/icf_string_merge_test.cc: New file.
9490         * testsuite/icf_string_merge_test.sh: New file.
9491         * testsuite/icf_virtual_function_folding_test.cc: New file.
9492         * testsuite/icf_virtual_function_folding_test.sh: New file.
9493
9494 2010-04-14  Doug Kwan  <dougkwan@google.com>
9495
9496         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
9497         for local symbol recounting if we remove a section due to ICF.
9498         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
9499         there are no regular objects in input.
9500
9501 2010-04-13  Doug Kwan  <dougkwan@google.com>
9502
9503         * arm.cc (Arm_input_section::set_final_data_size): Compute
9504         accurate final data size instead of using current data size.
9505
9506 2010-04-09  Doug Kwan  <dougkwan@google.com>
9507
9508         * layout.cc (Layout::choose_output_section): Handle script section
9509         types.
9510         (Layout::make_output_section_for_script): Add section type parameter.
9511         Handle script section types.
9512         * layout.h (Layout::make_output_section_for_script): Add section
9513         type parameter.
9514         * output.cc (Output_section::Output_section): Initialize data member
9515         is_noload_.
9516         (Output_section::do_reset_address_and_file_offset): Do not set address
9517         to 0 if section is a NOLOAD section.
9518         * output.h (Output_section::is_noload): New method.
9519         (Output_section::set_is_noload): Ditto.
9520         (Output_section::is_noload_): New data member.
9521         * script-c.h (Script_section_type): New enum type.
9522         (struct Parser_output_section_header): Add new file section_type.
9523         * script-sections.cc (Sections_element::output_section_name): Add
9524         parameter for returning script section type.
9525         (Output_section_definition::output_section_name): Ditto.
9526         (Output_section_definition::section_type)P; New method.
9527         (Output_section_definiton::script_section_type_name): Ditto.
9528         (Output_section_definition::script_section_type_): New data member.
9529         (Output_section_definition::Output_section_definition): Initialize
9530         data member Output_section_definition::script_section_type_.
9531         (Output_section_definition::create_sections): Pass script section type
9532         to Layout::make_output_section_for_script.
9533         (Output_section_definition::output_section_name): Return script
9534         section type to caller.
9535         (Output_section_definition::set_section_address): Do not advance
9536         dot value and load address if section type is NOLOAD.  Set address
9537         of NOLOAD sections regardless of section flags.
9538         (Output_section_definition::print): Print section type if it is
9539         not SCRIPT_SECTION_TYPE_NONE.
9540         (Output_section_definition::section_type): New method.
9541         (Output_section_definition::script_section_type_name): Ditto.
9542         (Script_sections::output_section_name): Add new parameter
9543         PSECTION_TYPE for returning script section type.  Pass it to
9544         section elements.  Handle discard sections.
9545         (Sort_output_sections::operator()): Handle NOLOAD sections.
9546         * script-sections.h (Script_sections::Section_type): New enum type.
9547         (Script_sections::output_section_name): Add a new parameter for
9548         returning script section type.
9549         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
9550         INFO and NOLOAD.
9551         * yyscript.y (union): Add new field SECTION_TYPE.
9552         (COPY, DSECT, INFO, NOLOAD): New tokens.
9553         (opt_address_and_section_type): Change type to output_section_header.
9554         (section_type): New non-terminal
9555         (section_header): Handle section type.
9556         (opt_address_and_section_type): Return section type value.
9557
9558 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
9559
9560         * testsuite/plugin_common_test_1.c (foo): Add prototype.
9561         * testsuite/plugin_common_test_2.c (foo): Likewise.
9562
9563 2010-04-08  Doug Kwan  <dougkwan@google.com>
9564
9565         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
9566         Output_merge_data.
9567         * output.cc (Output_section::add_merge_input_section): Simplify
9568         code and return status of Output_merge_base::add_input_section.
9569         Update merge section map only if Output_merge_base::add_input_section
9570         returns true.
9571
9572 2010-04-07  Doug Kwan  <dougkwan@google.com>
9573
9574         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
9575         if section is marked as containing instructions but has no mapping
9576         symbols.
9577         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
9578         correct section index.
9579         (Arm_relobj::find_linked_text_section): Ditto.
9580
9581 2010-04-07  Cary Coutant  <ccoutant@google.com>
9582
9583         * archive.cc (include_member): Destroy Read_symbols_data object before
9584         releasing file.
9585         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
9586         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
9587         (Read_symbols_data::~Read_symbols_data) New destructor.
9588         (Section_relocs::Section_relocs) New constructor.
9589         (Section_relocs::~Section_relocs) New destructor.
9590         (Read_relocs_data::Read_relocs_data) New constructor.
9591         (Read_relocs_data::~Read_relocs_data) New destructor.
9592         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
9593         pointers to NULL after deleting.
9594
9595 2010-04-07  Doug Kwan  <dougkwan@google.com>
9596
9597         * arm.cc: Replace "endianity" with "endianness" in comments.
9598         (Arm_exidx_cantunwind): Ditto.
9599         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
9600         (Arm_relobj::merge_flags_and_attributes): New method.
9601         (Arm_relobj::merge_flags_and_attributes_): New data member.
9602         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
9603         (Arm_relobj::scan_sections_for_stubs): Ditto.
9604         (Arm_relobj::do_read_symbols): Check to see if we really want to
9605         merge processor-specific flags and attributes.  Exit early if
9606         an object is empty except for section names and the undefined symbol.
9607         (Target_arm::do_finalize_sections): Move check for ELF format to
9608         Arm_relobj::do_read_symbols.  Merge processor specific flags and
9609         attributes from a regular object only when we have determined that
9610         it is aapropriate.  Do not create an .ARM.attributes section in
9611         output if there is no regular input object.
9612         (Target_arm::merge_processor_specific_flags): Check
9613         --warn-mismatch before printing any error.
9614         (Target_arm::merge_object_attributes): Ditto.
9615         * gold.cc (queue_middle_tasks): Handle the case in which there is
9616         no regular object in input.
9617         * options.cc (General_options::parse_EB): New method.
9618         (General_options::parse_EL): Same.
9619         (General_options::General_options): Initialize endianness_.
9620         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
9621         New options.
9622         (General_options::Endianness): New enum.
9623         (General_options::endianness): New method.
9624         (General_options::endianness_): New data member.
9625         * parameters.cc (Parameters::set_options): Check target endianness.
9626         (Parameters::set_target_once): Ditto.
9627         (Parameters::check_target_endianness): New method.
9628         (parameters_force_valid_target): If either -EL or -EB is specified,
9629         use it to define endianness of default target.
9630         * parameters.h (Parameters::check_target_endianness): New method
9631         declaration.
9632         * target.h (class Target): Change "endianity" to "endianness"
9633         in comments.
9634
9635 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9636
9637         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
9638         * configure: Regenerate.
9639         * Makefile.in: Regenerate.
9640         * testsuite/Makefile.in: Regenerate.
9641
9642 2010-04-06  Cary Coutant  <ccoutant@google.com>
9643
9644         gcc PR lto/42757
9645         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
9646         prevailing definitions of common symbols.
9647         * testsuite/plugin_test_6.sh: New test case.
9648         * testsuite/plugin_common_test_1.c: New test case.
9649         * testsuite/plugin_common_test_2.c: New test case.
9650         * testsuite/Makefile.am (plugin_test_6): New test case.
9651         * testsuite/Makefile.in: Regenerate.
9652
9653 2010-04-06  Nick Clifton  <nickc@redhat.com>
9654
9655         * po/vi.po: New Vietnamese translation.
9656
9657 2010-03-30  Doug Kwan  <dougkwan@google.com>
9658
9659         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
9660
9661 2010-03-25  Doug Kwan  <dougkwan@google.com>
9662
9663         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
9664         to avoid a conversion warning on a 32-bit host.
9665
9666 2010-03-24  Ian Lance Taylor  <iant@google.com>
9667
9668         * testsuite/script_test_3.t: Add a TLS segment.
9669         * testsuite/Makefile.am (check_PROGRAMS): Add
9670         tls_phdrs_script_test.
9671         (tls_phdrs_script_test_SOURCES): Define.
9672         (tls_phdrs_script_test_DEPENDENCIES): Define.
9673         (tls_phdrs_script_test_LDFLAGS): Define.
9674         (tls_phdrs_script_test_LDADD): Define.
9675         * testsuite/Makefile.in: Rebuild.
9676
9677 2010-03-23  Cary Coutant  <ccoutant@google.com>
9678
9679         * fileread.cc (find_or_make_view): Fix comment.
9680
9681 2010-03-23  Ian Lance Taylor  <iant@google.com>
9682
9683         * script-sections.cc (class Orphan_section_placement): Define
9684         PLACE_TLS and PLACE_TLS_BSS.
9685         (Orphan_section_placement::Orphan_section_placement): Initialize
9686         new places.
9687         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
9688         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
9689         (tls_script_test_SOURCES): Define.
9690         (tls_script_test_DEPENDENCIES): Define.
9691         (tls_script_test_LDFLAGS): Define.
9692         (tls_script_test_LDADD): Define.
9693         * testsuite/Makefile.in: Rebuild.
9694
9695 2010-03-22  Doug Kwan  <dougkwan@google.com>
9696
9697         * arm.cc (Arm_relocate_functions::abs8,
9698         Arm_relocate_functions::abs16): Use correct check for overflow
9699         specified in the ARM ELF specs.
9700         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
9701         target of a BLX instruction specially.
9702         (Reloc_stub::stub_type_for_reloc): Ditto.
9703         (Relocate::relocate): Use symbolic names instead of numeric relocation
9704         codes to report error.
9705         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
9706         workaround.
9707         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
9708         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
9709         thumb2_blx_out_of_range.stdout
9710         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
9711         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
9712         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
9713         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
9714         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
9715         thumb2_blx_in_range, thumb2_blx_in_range.o,
9716         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
9717         thumb2_blx_out_of_range.o): New rules.
9718         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
9719         thumb2_blx_in_range and thumb2_blx_out_of_range.
9720         * testsuite/Makefile.in: Regenerate.
9721         * arm_branch_in_range.sh: Add tests for THUMB BLX.
9722         * testsuite/thumb_blx_in_range.s: New file.
9723         * testsuite/thumb_blx_out_of_range.s: New file.
9724
9725 2010-03-22  Rafael Espindola  <espindola@google.com>
9726
9727         * archive.cc (Should_include): Move to archive.h.
9728         (should_include_member): Make it a member of Archive.
9729         (Lib_group): New.
9730         (Add_lib_group_symbols): New.
9731         * archive.h: Include options.h.
9732         (Archive_member): Moved from Archive.
9733         (Should_include): Moved from archive.cc.
9734         (Lib_group): New.
9735         (Add_lib_group_symbols): New.
9736         * dynobj.cc (do_should_include_member): New.
9737         * dynobj.h (do_should_include_member): New.
9738         * gold.cc (queue_initial_tasks): Update call to queue.
9739         * main.cc (main): Print lib group stats.
9740         * object.cc (do_should_include_member): New.
9741         * object.h: Include archive.h.
9742         (Object::should_include_member): New.
9743         (Object::do_should_include_member): New.
9744         (Sized_relobj::do_should_include_member): New.
9745         * options.cc (General_options::parse_start_lib): New.
9746         (General_options::parse_end_lib): New.
9747         (Input_arguments::add_file): Handle lib groups.
9748         (Input_arguments::start_group): Check we are not in a lib.
9749         (Input_arguments::start_lib): New.
9750         (Input_arguments::end_lib): New.
9751         * options.h (General_options): Add start_lib and end_lib.
9752         (Input_argument::lib_): New.
9753         (Input_argument::lib): New.
9754         (Input_argument::is_lib): New.
9755         (Input_file_lib): New.
9756         (Input_arguments::in_lib_): New.
9757         (Input_arguments::in_lib): New.
9758         (Input_arguments::start_lib): New.
9759         (Input_arguments::end_lib_): New.
9760         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
9761         in unused members as preempted.
9762         (Sized_pluginobj::do_should_include_member): New.
9763         * plugin.h (Sized_pluginobj::do_should_include_member): New.
9764         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
9765         return the blocker.
9766         (Read_symbols::do_whole_lib_group): New.
9767         (Read_symbols::do_lib_group): New.
9768         (Read_symbols::do_read_symbols): Handle lib groups.
9769         (Read_symbols::get_name): Handle lib groups.
9770         * readsyms.h (Read_symbols): Add an archive member pointer.
9771         (Read_symbols::do_whole_lib_group): New.
9772         (Read_symbols::do_lib_group): New.
9773         (Read_symbols::member_): New.
9774         * script.cc (read_input_script): Update call to queue_soon.
9775
9776 2010-03-19  Doug Kwan  <dougkwan@google.com>
9777
9778         * arm.cc (Stub_table::Stub_table): Initialize new data members
9779         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9780         (Stub_table::add_reloc_stub): Assign stub offset and update
9781         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9782         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
9783         New data members.
9784         (Stub_table::update_data_size_and_addralign): Use
9785         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
9786         instead of going over all reloc stubs.
9787         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
9788         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9789         Stringpool_template::offset_ to size of Stringpool_char.
9790         (Stringpool_template::new_key_offset): Remove code to initialize
9791         Stringpool_template::offset_.
9792         * stringpool.h (Stringpool_template::set_no_zero_null): Set
9793         Stringpool_template::offset_ to zero.
9794
9795 2010-03-15  Doug Kwan  <dougkwan@google.com>
9796
9797         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9798         offset_.
9799         (Stringpool_template::new_key_offset): New method.
9800         (Stringpool_template::add_string): Assign offsets when adding new
9801         strings.
9802         (Stringpool_template::set_string_offsets): Do not set string offsets
9803         when not optimizing.
9804         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
9805         member size_.
9806         (Chunked_vector::clear): Clear size_.
9807         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
9808         (Chunked_vector::size): Return size_.
9809         (Chunked_vector::push_back): Use size_ to find insert position.
9810         (Chunked_vector::size_): New data member.
9811         (Stringpool_template::set_no_zero_null): Assert string set is empty.
9812         (Stringpool_template::new_key_offset): New method declaration.
9813         (Stringpool_template::offset_): New data member.
9814
9815 2010-03-15   Rafael Espindola  <espindola@google.com>
9816
9817         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
9818         Add_symbols' constructor.
9819         * readsyms.h (Add_symbols): Remove the input_group member.
9820
9821 2010-03-10  Ian Lance Taylor  <iant@google.com>
9822
9823         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
9824         target to ask whether a reference to a symbol requires a stack
9825         split.
9826         * target.h (Target::is_call_to_non_split): New function.
9827         (Target::do_is_call_to_non_split): Declare virtual function.
9828         * target.cc: Include "symtab.h".
9829         (Target::do_is_call_to_non_split): New function.
9830         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
9831
9832 2010-03-10  Cary Coutant  <ccoutant@google.com>
9833
9834         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
9835         (File_read::open[1]): Remove initial mapping of whole_file_view_.
9836         (File_read::open[2]): Add whole_file_view_ to list of views.
9837         (File_read::make_view): Remove test of whole_file_view_.
9838         (File_read::find_or_make_view): Create whole_file_view_ if
9839         necessary.
9840         (File_read::clear_views): Replace bool parameter with enum;
9841         adjust all callers.  Don't delete views with permanent data;
9842         do delete cached views and views from archives if
9843         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
9844         if clearing the corresponding view.
9845         * fileread.h (File_read::Clear_views_mode): New enum.
9846         (File_read::View::is_permanent_view): New method.
9847         (File_read::clear_views): Replace bool parameter
9848         with enum; adjust all callers.
9849         * options.h (General_options): Change keep_files_mapped option;
9850         add map_whole_files.
9851         * readsyms.cc (Add_symbols::run): Delete sd_ object before
9852         releasing the file.
9853         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
9854         the file.
9855
9856 2010-03-10  David S. Miller  <davem@davemloft.net>
9857
9858         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
9859
9860 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
9861
9862         * icf.cc (get_section_contents): Add '@' marker after processing the
9863         merge reloc.
9864
9865 2010-03-08  Doug Kwan  <dougkwan@google.com>
9866
9867         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
9868         due to a conversion warning.
9869         (Arm_relobj::update_output_local_symbol_count): Check for local
9870         symbol with unset output index.
9871
9872 2010-03-05  Ian Lance Taylor  <iant@google.com>
9873
9874         * options.h (class General_options): Add --spare-dynamic-tags.
9875         * output.cc (Output_data_dynamic::set_final_data_size): Implement
9876         --spare-dynamic-tags.
9877
9878 2010-03-05  Ian Lance Taylor  <iant@google.com>
9879
9880         * incremental.cc: Include "libiberty.h".
9881
9882 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
9883
9884         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
9885         function, is_info_ member.
9886         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
9887         (Versions::Versions): Update caller.
9888         (Versions::define_base_version): Likewise.
9889         (Versions::add_def): Likewise.
9890
9891 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
9892
9893         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
9894         (Scan::possible_function_pointer_reloc): New function.
9895         (Scan::local_reloc_may_be_function_pointer): Change to call
9896         possible_function_pointer_reloc.
9897         (Scan::global_reloc_may_be_function_pointer): Ditto.
9898         * icf.h (Icf::check_section_for_function_pointers): Change to reject
9899         relocations in ".data.rel.ro._ZTV" section.
9900         * testsuite/icf_safe_so_test.sh: Change to pass i386.
9901         * testsuite/icf_safe_so_test.cc: Ditto.
9902         * testsuite/icf_safe_test.cc: Ditto.
9903         * testsuite/icf_safe_test.sh: Ditto.
9904
9905 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9906             Ian Lance Taylor  <iant@google.com>
9907
9908         * target-reloc.h (relocate_section): Check the symbol table index
9909         for -1U before setting the local symbol index.
9910         (scan_relocatable_relocs): If copying the relocation, record that
9911         the local symbol is required.
9912         * object.h (Symbol_value::is_output_symtab_index_set): New
9913         function.
9914         (Symbol_value::may_be_discarded_from_output_symtab): New
9915         function.
9916         (Symbol_value::has_output_symtab_entry): New function.
9917         (Symbol_value::needs_output_symtab_entry): Remove.
9918         (Symbol_value::output_symtab_index): Make sure the symbol index is
9919         set.
9920         (Symbol_value::set_output_symtab_index): Make sure the symbol
9921         index is not set.  Make sure the new index is valid.
9922         (Symbol_value::set_must_have_output_symtab_entry): New function.
9923         (Symbol_value::has_output_dynsym_entry): New function.
9924         (Symbol_value::set_output_dynsym_index): Make sure the new index
9925         is valid.
9926         (Sized_relobj::set_must_have_output_symtab_entry): New function.
9927         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
9928         local symbol if permitted.
9929         (Sized_relobj::do_finalize_local_symbols): Call
9930         is_output_symtab_index_set rather than needs_output_symtab_entry.
9931         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
9932         rather than needs_output_symtab_entry.  Call
9933         has_output_dynsym_entry rather than needs_output_dynsym_entry.
9934         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
9935         is_output_symtab_index_set rather than needs_output_symtab_entry.
9936         * testsuite/discard_locals_relocatable_test.c: New file.
9937         * testsuite/discard_locals_test.sh: Test -r.
9938         * testsuite/Makefile.am (check_DATA): Add
9939         discard_locals_relocatable_test1.syms,
9940         discard_local_relocatable_test2.syms.
9941         (MOSTLYCLEANFILES): Likewise.  Also add
9942         discard_locals_relocatable_test1.lout and
9943         discard_locals_relocatable_test2.out.
9944         (discard_locals_relocatable_test1.syms): New target.
9945         (discard_locals_relocatable_test.o): New target.
9946         (discard_locals_relocatable_test1.out): New target.
9947         (discard_locals_relocatable_test2.syms): New target.
9948         (discard_locals_relocatable_test2.out): New target.
9949         (various): Add missing ../ld-new dependencies.
9950         * testsuite/Makefile.in: Rebuild.
9951
9952 2010-03-03  Nick Clifton  <nickc@redhat.com>
9953
9954         * po/fi.po: New Finnish translation.
9955
9956 2010-03-01  Doug Kwan  <dougkwan@google.com>
9957
9958         * layout.cc (Layout::Layout): Force section types of .init_array*,
9959         .preinit_array* and .fini_array* sections.
9960         * output.cc (Output_section::Input_section_sort_entry::has_priority):
9961         Fix check of return value of std::string::find.().
9962         (Output_section::Input_section_sort_compare::operator()): Remove
9963         comment about .init_array.
9964         (Output_section::Input_section_sort_init_fini_compare::operator()):
9965         New method.
9966         (Output_section::sort_attached_input_sections): Handle .init_array
9967         and .fini_array specially.
9968         * output.h (Output_section::Inut_section_sort_compare): Update
9969         comment.
9970         (Output_section::Input_section_sort_init_fini_compare): New struct.
9971
9972 2010-02-26  Doug Kwan  <dougkwan@google.com>
9973
9974         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9975         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9976         * testsuite/debug_msg.sh: Avoid matching source line number for
9977         use of global variable undef_int.
9978
9979 2010-02-26  Doug Kwan  <dougkwan@google.com>
9980
9981         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9982         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9983         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9984         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9985         * options.cc (General_options::General_options): Initialize member
9986         fix_v4bx_.
9987         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9988         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9989         and rm_no_fix_v4bx.stdout
9990         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9991         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9992         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9993         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9994         and arm_no_fix_v4bx.
9995         * Makefile.in: Regenerate.
9996         * testsuite/arm_fix_v4bx.s: New file.
9997         * testsuite/arm_fix_v4bx.sh: Ditto.
9998
9999 2010-02-24  Doug Kwan  <dougkwan@google.com>
10000
10001         * arm.cc (Target_arm::got_section): Make the .got section the first
10002         non RELRO section in the data segment.
10003         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
10004         suffixes of section names.
10005
10006 2010-02-24  Doug Kwan  <dougkwan@google.com>
10007
10008         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
10009         flags and attributes merging if an input file is a binary file.
10010         * fileread.cc (Input_file::open): Record format of original file.
10011         * fileread.h (Input_file::Format): New enum type.
10012         (Input_file::Input_file): Initialize data member format_.
10013         (Input_file::format): New method definition.
10014         (Input_file::format_):: New data member.
10015
10016 2010-02-24  Doug Kwan  <dougkwan@google.com>
10017
10018         * arm.cc (Arm_output_data_got): New class.
10019         (ARM_TCB_SIZE): New constant
10020         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
10021         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
10022         If user uses a script with a SECTIONS clause, issue only a warning
10023         for a misplaced EXIDX input section.  Otherwise, issue an error.
10024         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
10025         garbage collection.
10026         (Target_arm::got_mode_index_entry): Handle static linking.
10027         (Target_arm::Scan::local): Ditto.
10028         (Target_arm::Scan::global): Ditto.
10029         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
10030         all incorrectly implemented relocations.
10031         (Target_arm::fix_exidx_coverage): Pass layout to
10032         Arm_output_section::fix_exidx_coverage.
10033         * layout.cc (Layout::section_name_mapping): Remove trailing dots
10034         from ".ARM.exidx." and ".ARM.extab.".
10035
10036 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10037
10038         * arm.cc (Target_arm::do_finalize_sections): Create attribute
10039         section if it does not already exist.
10040         * attributes.cc (Attributes_section_data::Attributes_section_data):
10041         Don't crash if size is zero.
10042
10043 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10044             Ian Lance Taylor  <iant@google.com>
10045
10046         * gold.cc (queue_middle_tasks): If no input files were opened,
10047         exit.
10048         * workqueue.h (Task_function::Task_function): Assert that there is
10049         a blocker.
10050
10051 2010-02-22  Doug Kwan  <dougkwan@google.com>
10052
10053         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
10054         * icf.cc (get_section_contents): Cast snprintf arguments to long long
10055         types to avoid warnings due to different uint64_t implementations
10056         on different hosts.
10057
10058 2010-02-21  Doug Kwan  <dougkwan@google.com>
10059
10060         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
10061         handling of the maximum backward branch offset.
10062         (Arm_relocate_functions::thumb_branch_common): Ditto.
10063         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
10064         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
10065         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
10066         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
10067         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
10068         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
10069         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
10070         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
10071         thumb_bl_out_of_range thumb_bl_out_of_range.o,
10072         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
10073         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
10074         thumb2_bl_out_of_range.o): New rules.
10075         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
10076         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
10077         thumb2_bl_out_of_range
10078         * testsuite/Makefile.in: Regenerate.
10079         * testsuite/arm_bl_in_range.s: New file.
10080         * testsuite/arm_bl_out_of_range.s: Ditto.
10081         * testsuite/arm_branch_in_range.sh: Ditto.
10082         * testsuite/arm_branch_range.t: Ditto.
10083         * testsuite/thumb2_branch_range.t: Ditto.
10084         * testsuite/thumb_bl_in_range.s: Ditto.
10085         * testsuite/thumb_bl_out_of_range.s: Ditto.
10086         * testsuite/thumb_branch_range.t: Ditto.
10087
10088 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
10089
10090         * gc.h (gc_process_relocs): Change vectors to point to the new list.
10091         Add reloc offset information.
10092         * icf.cc (get_section_contents): Change iterators to point to the new
10093         vectors. Add reloc offset information to the contents.
10094         * icf.h (Icf::Sections_reachable_info): New typedef.
10095         (Icf::Sections_reachable_list): New typedef.
10096         (Icf::Offset_info): New typedef.
10097         (Icf::Reloc_info): New struct typedef.
10098         (Icf::Reloc_info_list): New typedef.
10099         (Icf::symbol_reloc_list): Delete method.
10100         (Icf::addend_reloc_list): Delete method.
10101         (Icf::section_reloc_list): Delete method.
10102         (Icf::reloc_info_list): New method.
10103         (Icf::reloc_info_list_): New member.
10104
10105 2010-02-19  Doug Kwan  <dougkwan@google.com>
10106
10107         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
10108         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
10109         * arm.cc (Arm_relocation_functions): New forward declaration.
10110         (Target_arm::Target_arm): Initialize new data members
10111         got_mod_index_offset_ and tls_base_symbol_defined_.
10112         (Target_arm::Relocate::relocate_tls): New method.
10113         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
10114          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
10115         New methods.
10116         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
10117         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
10118         (Target_arm::got_mod_index_offset_,
10119         Target_arm::tls_base_symbol_defined_): New data members.
10120         (Target_arm::Scan::local, Target::Scan::global,
10121         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
10122         relocations.
10123
10124 2010-02-18  Doug Kwan  <dougkwan@google.com>
10125
10126         * arm.cc (Arm_relobj::find_linked_text_section): New method.
10127         (Arm_relobj::make_exidx_input_section): Pass section index of linked
10128         text section as a parameter becuase some broken tools may not set
10129         the link in section header.
10130         (Target_arm::has_got_section): New method.
10131         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
10132         without any mapping symbol as data only.  Remove warning.
10133         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
10134         link in its section header, try to discover the link by inspecting the
10135         REL31 relocation at the beginning of the section.
10136         (Target_arm::Scan::check_non_pic): Report name of offending relocation
10137         in error message.
10138         (Target_arm::Scan::global): Treat any reference to the symbol
10139         _GLOBAL_OFFSET_TABLE_ as a GOT access.
10140
10141 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
10142
10143         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
10144         (Scan::global_reloc_may_be_function_pointer): New function.
10145         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10146         (Scan::global_reloc_may_be_function_pointer): New function.
10147         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10148         (Scan::global_reloc_may_be_function_pointer): New function.
10149         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
10150         (Scan::global_reloc_may_be_function_pointer): New function.
10151         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
10152         (Scan::global_reloc_may_be_function_pointer): New function.
10153         (Scan::possible_function_pointer_reloc): New function.
10154         (Target_x86_64::can_check_for_function_pointers): New function.
10155         * gc.h (gc_process_relocs): Scan relocation types to determine if
10156         function pointers were taken for targets that support it.
10157         * icf.cc (Icf::find_identical_sections): Include functions for
10158         folding in safe ICF whose pointer is not taken.
10159         * icf.h (Secn_fptr_taken_set): New typedef.
10160         (fptr_section_id_): New member.
10161         (section_has_function_pointers): New function.
10162         (set_section_has_function_pointers): New function.
10163         (check_section_for_function_pointers): New function.
10164         * options.h: Fix comment for safe ICF option.
10165         * target.h (can_check_for_function_pointers): New function.
10166         * testsuite/Makefile.am: Add icf_safe_so_test test case.
10167         Modify icf_safe_test for X86-64.
10168         * testsuite/Makefile.in: Regenerate.
10169         * testsuite/icf_safe_so_test.cc: New file.
10170         * testsuite/icf_safe_so_test.sh: New file.
10171         * testsuite/icf_safe_test.cc (kept_func_3): New function.
10172         (main): Change to take pointer to function kept_func_3.
10173         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
10174         folding is done correctly for X86-64.
10175
10176 2010-02-12  David S. Miller  <davem@davemloft.net>
10177
10178         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
10179         is_symbolless parameter.
10180         (Output_reloc<SHT_REL>::is_symbolless): New.
10181         (Output_reloc<SHT_REL>::is_symbolless_): New.
10182         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
10183         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
10184         (Output_reloc<SHT_RELA>::is_symbolless): New.
10185         (Output_data_reloc::add_global): Handle is_symbolless.
10186         (Output_data_reloc::add_global_relative): Likewise.
10187         (Output_data_reloc::add_local): Likewise.
10188         (Output_data_reloc::add_local_relative): Likewise.
10189         (Output_data_reloc::add_symbolless_global_addend): New.
10190         (Output_data_reloc::add_symbolless_local_addend): New.
10191         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
10192         is_symbolless.
10193         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
10194         instead of ->is_relative_
10195         (Output_reloc::write): Likewise.
10196         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
10197         (Output_reloc::write_rel): Simplify.
10198
10199         * sparc.cc (Target_sparc::Scan::local): Use
10200         ->add_symbolless_local_addend as needed.
10201         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
10202         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
10203         based upon relocation offset.
10204
10205 2010-02-11  Doug Kwan  <dougkwan@google.com>
10206
10207         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
10208         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
10209         beginning of function.
10210         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
10211         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
10212         parameter is_32bit in calls to should_apply_static_reloc.
10213         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
10214         (check_DATA): Add arm_abs_global.stdout.
10215         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
10216         arm_abs_global.stdout): New rules.
10217         (MOSTLLYCLEANFILES): Add arm_abs_global
10218         * Makefile.in: Regenerate.
10219         * testsuite/arm_abs_global.s: New file.
10220         * testsuite/arm_abs_global.sh: Ditto.
10221         * testsuite/arm_abs_lib.s: Ditto.
10222
10223 2010-02-11  Ian Lance Taylor  <iant@google.com>
10224
10225         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
10226         Read_relocs task.
10227         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
10228         Allocate_commons_task first.
10229         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
10230         task, rather than symtab_lock_.
10231         (Gc_process_relocs::~Gc_process_relocs): New function.
10232         (Gc_process_relocs::is_runnable): Check this_blocker_.
10233         (Gc_process_relocs::locks): Use next_blocker_ rather than
10234         blocker_.
10235         (Scan_relocs::~Scan_relocs): New function.
10236         (Scan_relocs::is_runnable): Check this_blocker_ rather than
10237         symtab_lock_.
10238         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
10239         next_blocker_.
10240         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
10241         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
10242         constructor accordingly.
10243         (class Gc_process_relocs): Likewise.
10244         (class Scan_relocs): Likewise.
10245         * common.h (class Allocate_commons_task): Remove symtab_lock_
10246         field, and corresponding constructor parameter.
10247         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
10248         symtab_lock_.
10249         (Allocate_commons_task::locks): Likewise.
10250
10251 2010-02-11  Ian Lance Taylor  <iant@google.com>
10252
10253         * gold-threads.h (class Once): Define.
10254         (class Initialize_lock): Rewrite as child of Once.
10255         * gold-threads.cc (class Once_initialize): Define.
10256         (once_pointer_control): New static variable.
10257         (once_pointer, once_arg): New static variables.
10258         (c_run_once): New static function.
10259         (Once::Once, Once::run_once, Once::internal_run): New functions.
10260         (class Initialize_lock_once): Remove.
10261         (initialize_lock_control): Remove.
10262         (initialize_lock_pointer): Remove.
10263         (initialize_lock_once): Remove.
10264         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
10265         (Initialize_lock::initialize): Rewrite.
10266         (Initialize_lock::do_run_once): New function.
10267         * archive.cc (Archive::interpret_header): Only clear name if it is
10268         not already empty.
10269         * fileread.cc: Include "gold-threads.h"
10270         (file_counts_lock): New static variable.
10271         (file_counts_initialize_lock): Likewise.
10272         (File_read::release): Only increment counts when using --stats.
10273         Use a lock around the increment.
10274         * parameters.cc (class Set_parameters_target_once): Define.
10275         (set_parameters_target_once): New static variable.
10276         (Parameters::Parameters): Move here from parameters.h.
10277         (Parameters::set_target): Rewrite.
10278         (Parameters::set_target_once): New function.
10279         (Parameters::clear_target): Move here and rewrite.
10280         * parameters.h (class Parameters): Update declarations.  Add
10281         set_parameters_target_once_ field.
10282         (Parameters::Parameters): Move to parameters.cc.
10283         (Parameters::clear_target): Likewise.
10284         * readsyms.cc (Read_symbols::do_group): Create a Start_group
10285         task.
10286         (Start_group::~Start_group): New function.
10287         (Start_group::is_runnable): New function.
10288         (Start_group::locks, Start_group::run): New functions.
10289         (Finish_group::run): Change saw_undefined to size_t.
10290         * readsyms.h (class Start_group): Define.
10291         (class Finish_group): Change saw_undefined_ field to size_t.
10292         (Finish_group::Finish_group): Remove saw_undefined and
10293         this_blocker parameters.  Change all callers.
10294         (Finish_group::set_saw_undefined): New function.
10295         (Finish_group::set_blocker): New function.
10296         * symtab.h (class Symbol_table): Change saw_undefined to return
10297         size_t.  Change saw_undefined_ field to size_t.
10298         * target-select.cc (Set_target_once::do_run_once): New function.
10299         (Target_selector::Target_selector): Initialize set_target_once_
10300         field.  Don't initialize lock_ and initialize_lock_ fields.
10301         (Target_selector::instantiate_target): Rewrite.
10302         (Target_selector::set_target): New function.
10303         * target-select.h (class Set_target_once): Define.
10304         (class Target_selector): Update declarations.  Make
10305         Set_target_once a friend.  Remove lock_ and initialize_lock_
10306         fields.  Add set_target_once_ field.
10307
10308 2010-02-10  Ian Lance Taylor  <iant@google.com>
10309
10310         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
10311         queueing any tasks.
10312         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
10313         (queue_middle_tasks): Add all blockers before queueing any tasks.
10314         (queue_final_tasks): Likewise.
10315         * token.h (Task_token::add_blockers): New function.
10316         * object.h (Input_objects::number_of_relobjs): New function.
10317
10318 2010-02-10  Ian Lance Taylor  <iant@google.com>
10319
10320         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
10321         shared, not if not position independent.
10322         * x86_64.cc (Relocate::relocate_tls): Likewise.
10323         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
10324         (tls_pie_pic_test): New target.
10325         * testsuite/Makefile.in: Rebuild.
10326
10327         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
10328         (tls_test_main_pie.o, tls_test_pie.o): New targets.
10329         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
10330         * testsuite/Makefile.in: Rebuild.
10331
10332 2010-02-09  David S. Miller  <davem@davemloft.net>
10333
10334         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
10335         R_SPARC_RELATIVE using ->add_local_relative().
10336         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
10337
10338         * output.h (Output_data_dynamic::add_section_size): New method
10339         that takes two Output_data objects.
10340         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
10341         entry param.  Handle it in initializers.
10342         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
10343         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
10344         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
10345         arg.
10346         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
10347         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
10348         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
10349         for dynrel_includes_plt.
10350         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10351         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10352         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
10353         before .rela.plt
10354         (Target_sparc::do_finalize_sections): Update to pass true for
10355         dynrel_includes_plt.
10356         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
10357         output before .rela.plt
10358         (Target_powerpc::do_finalize_sections): Update to pass true for
10359         dynrel_includes_plt when 32-bit.
10360
10361 2010-02-08  Doug Kwan  <dougkwan@google.com>
10362
10363         * arm.cc (Arm_relobj::simple_input_section_output_address): New
10364         method.
10365         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
10366         Arm_relobj::scan_section_for_cortex_a8_stubs,
10367         Arm_relobj::do_relocation_section): Instead of calling
10368         Output_section::output_address, use faster
10369         Arm_relobj::simple_input_section_output_address.
10370
10371 2010-02-08  David S. Miller  <davem@davemloft.net>
10372
10373         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
10374         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
10375         relocation helper function.
10376
10377         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
10378         just like R_SPARC_GOT{10,13,22}.
10379         (Target_sparc::Scan::local): Likewise.
10380         (Target_sparc::Relocate:relocate): Likewise.
10381
10382 2010-02-06  Ian Lance Taylor  <iant@google.com>
10383
10384         * configure.ac: Rewrite targetobjs duplicate removal code to use
10385         only shell constructs.
10386         * configure: Rebuild.
10387
10388 2010-02-05  Doug Kwan  <dougkwan@google.com>
10389
10390         PR 11247
10391         * arm.cc (Arm_relobj::section_is_scannable): New method.
10392         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
10393         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
10394
10395 2010-02-04  Doug Kwan  <dougkwan@google.com>
10396
10397         PR 11247
10398         * arm-reloc-property.cc (cstdio): Include.
10399         * configure.ac (targetobjs): Remove duplicates.
10400         * configure: Regenerate.
10401         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
10402         big and little endian version for a given address size.
10403
10404 2010-02-03  Doug Kwan  <dougkwan@google.com>
10405
10406         * arm-reloc-property.cc
10407         (Arm_reloc_property_table::reloc_name_in_error_message): New method
10408         definition.
10409         * arm-reloc-property.h
10410         (Arm_reloc_property_table::get_implemented_static_reloc_property):
10411         New method definition.
10412         (Arm_reloc_property_table::reloc_name_in_error_message): New method
10413         declaration.
10414         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
10415         overflow to N.
10416         (GOT_PREL): Change implemented to Y.
10417         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
10418         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
10419         (Arm_relocate_functions::movw_abs_nc): Remove method.
10420         (Arm_relocate_functions::movt_abs): Ditto.
10421         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
10422         (Arm_relocate_functions::thm_movt_abs): Ditto.
10423         (Arm_relocate_functions::movw_rel_nc): Ditto.
10424         (Arm_relocate_functions::movw_rel): Ditto.
10425         (Arm_relocate_functions::movt_rel): Ditto.
10426         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
10427         (Arm_relocate_functions:thm_movw_rel): Ditto.
10428         (Arm_relocate_functions:thm_movt_rel): Ditto.
10429         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
10430         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
10431         New method definitions.
10432         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
10433         (Arm_relocation_functions::arm_grp_ldr): Ditto.
10434         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
10435         (Arm_relocation_functions::arm_grp_ldc): Ditto.
10436         (Target_arm::Relocate::relocate): Check for non-static or
10437         unimplemented relocation code and exit early.  Change calls to
10438         Target_arm::reloc_uses_thumb_bit and
10439         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
10440         instead.  Refactor code to handle similar relocations to increase
10441         code sharing.  Remove check for unsupported relocation code in switch
10442         statement.
10443         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
10444         relocation property table to find out size.  Change error message to
10445         print out the name of a relocation code instead of the numeric value.
10446         (Target_arm::scan_reloc_for_stub): Use relocation property table
10447         instead of calling Target_arm::reloc_uses_thumb_bit().
10448
10449 2010-02-02  Doug Kwan  <dougkwan@google.com>
10450
10451         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
10452         types of relaxed input section.
10453
10454 2010-02-02  Doug Kwan  <dougkwan@google.com>
10455
10456         * Makefile.am (HFILES): Add arm-reloc-property.h.
10457         (DEFFILES): New.
10458         (TARGETSOURCES): Add arm-reloc-property.cc
10459         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
10460         (libgold_a_SOURCES): $(DEFFILES)
10461         * Makefile.in: Regenerate.
10462         * arm-reloc-property.cc: New file.
10463         * arm-reloc-property.h: New file.
10464         * arm-reloc.def: New file.
10465         * arm.cc: Update comments.
10466         (arm-reloc-property.h): New included header.
10467         (arm_reloc_property_table): New global variable.
10468         (Target_arm::do_select_as_default_target): New method definition.
10469         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
10470         arm-reloc-property to targ_extra_obj.
10471         * parameters.cc (set_parameters_target): Call
10472         Target::select_as_default_target().
10473         * target.h (Target::select_as_default_target): New method definition.
10474         (Target::do_select_as_default_target): Same.
10475
10476 2010-02-01  Doug Kwan  <dougkwan@google.com>
10477
10478         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
10479         first_output_text_section_.
10480         (Arm_exidx_fixup::first_output_text_section): New method definition.
10481         (Arm_exidx_fixup::first_output_text_section_): New data member.
10482         (Arm_exidx_fixup::process_exidx_section): Record the first text
10483         output section seen.
10484         (Arm_output_section::fix_exidx_coverage): Set correct linked section
10485         and entsize in output section header.
10486
10487 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10488
10489         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
10490         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
10491         (Arm_relocate_functions::thm_alu11): New Method.
10492         (Arm_relocate_functions::thm_pc8): New Method.
10493         (Arm_relocate_functions::thm_pc12): New Method.
10494         (Target_arm::Scan::local): Handle the relocations.
10495         (Target_arm::Scan::global): Likewise.
10496         (Target_arm::Relocate::relocate): Likewise.
10497         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10498
10499 2010-01-29  Doug Kwan  <dougkwan@google.com>
10500
10501         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
10502         of relocation types as ld.
10503
10504 2010-01-29  Doug Kwan  <dougkwan@google.com>
10505
10506         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
10507         to public.
10508         (Arm_relocate_functions::thumb_branch_common): Ditto.
10509         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
10510         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
10511         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
10512         Arm_relocate_functions::jump24): Remove.
10513         (Target_arm::Relocate::relocate): Adjust code to call
10514         Arm_relocation_functions::arm_branch_common and
10515         Arm_relocation_functions::thumb_branch_common instead of their removed
10516         wrappers.  Merge switch-cases together to reduce source code size.
10517
10518 2010-01-29  Doug Kwan  <dougkwan@google.com>
10519
10520         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
10521         output_local_symbol_count_needs_update_.
10522         (Arm_relobj::output_local_symbol_count_needs_update,
10523          Arm_relobj::set_output_local_symbol_count_needs_update,
10524          Arm_relobj::update_output_local_symbol_count): New methods.
10525         (Arm_relobj::output_local_symbol_count_needs_update_): New data
10526         member.
10527         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
10528         of pointed function as in a R_ARM_PREL31 relocation.
10529         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
10530         for output local symbol count updating.
10531         (Target_arm::do_relax): Update output local symbol counts in objects
10532         if necessary.
10533         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
10534
10535 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10536
10537         * arm.cc: Added support for the ARM relocations:
10538         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
10539         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
10540         (Arm_relocate_functions::movw_rel_nc): Renamed (was
10541         movw_prel_nc).
10542         (Arm_relocate_functions::movw_rel): New method.
10543         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
10544         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
10545         thm_movw_prel_nc).
10546         (Arm_relocate_functions::thm_movw_rel): New method.
10547         (Arm_relocate_functions::thm_movt_rel): Renamed (was
10548         thm_movt_prel).
10549         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
10550         relocations.
10551         (Target_arm::Scan::global): Likewise.
10552         (Target_arm::Relocate::relocate): Likewise.
10553         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10554         Likewise.
10555
10556 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10557
10558         * arm.cc: Added support for ARM group relocations.
10559         (Target_arm::reloc_needs_sym_origin): New method.
10560         (Arm_relocate_functions::calc_grp_kn): New method.
10561         (Arm_relocate_functions::calc_grp_residual): New method.
10562         (Arm_relocate_functions::calc_grp_gn): New method.
10563         (Arm_relocate_functions::arm_grp_alu): New Method.
10564         (Arm_relocate_functions::arm_grp_ldr): New Method.
10565         (Arm_relocate_functions::arm_grp_ldrs): New Method.
10566         (Arm_relocate_functions::arm_grp_ldc): New Method.
10567         (Target_arm::Scan::local): Handle the ARM group relocations.
10568         (Target_arm::Scan::global): Likewise.
10569         (Target_arm::Relocate::relocate): Likewise.
10570         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10571         Likewise.
10572
10573 2010-01-26  Doug Kwan  <dougkwan@google.com>
10574
10575         * arm.cc (set): Include.
10576         (class Arm_exidx_fixup): Change type of last_input_section_ to const
10577         pointer type.
10578         (Arm_output_section::Text_section_list): New type.
10579         (Arm_output_section::append_text_sections_to_list): New method.
10580         (Arm_output_section::fix_exidx_coverage): Ditto.
10581         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
10582         (Arm_relobj::convert_input_section_to_relaxed_section): Use
10583         Relobj::set_section_offset() instead of
10584         Sized_relobj::invalidate_section_offset().
10585         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
10586         parameter for section headers. Ignore relocation sections for
10587         unallocated sections and EXIDX sections.
10588         (Target_arm::fix_exidx_coverage): New method.
10589         (Target_arm::output_section_address_less_than): New type.
10590         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
10591         linked text section instead of the EXIDX section.
10592         (Arm_output_section::create_stub_group): Add an assertion to check
10593         that this is not an EXIDX output section.
10594         (Arm_output_section::append_text_sections_to_list): New method.
10595         (Arm_output_section::fix_exidx_coverage): Ditto.
10596         (Arm_relobj::scan_sections_for_stubs): Adjust call to
10597         Arm_relobj::section_needs_reloc_stub_scanning.
10598         (Target_arm::do_relax): Fix EXIDX output section coverage in the
10599         first pass.
10600         (Target_arm::fix_exidx_coverage): New method.
10601         * object.h (Relobj::set_output_section): New method.
10602         (Sized_relobj::invalidate_section_offset): Remove method.
10603         (Sized_relobj::do_invalidate_section_offset): Remove method.
10604         (Sized_relobj::do_set_section_offset): Handle offset value -1.
10605
10606 2010-01-25  Doug Kwan  <dougkwan@google.com>
10607
10608         * arm.cc (Arm_exidx_merged_section::do_output_offset):
10609         Fix warning due to signed and unsigned comparison on a 32-bit host.
10610
10611 2010-01-22  Doug Kwan  <dougkwan@google.com>
10612
10613         * arm.cc (Target_arm::do_relax): Record an output section for section
10614         offset adjustment it contains any stub table that has changed.
10615         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
10616         offsets in an output section if necessary.
10617         * output.cc (Output_section::Output_section): Initialize
10618         section_offsets_need_adjustments_.
10619         (Output_section::add_input_section_for_script): Renamed to
10620         Output_section::add_simple_input_section.
10621         (Output_section::save_states): Add a comment.
10622         (Output_section::discard_states): New method defintion.
10623         (Output_section::adjust_section_offsets): Same.
10624         * output.h (Output_section::add_input_section_for_script): Renamed to
10625         Output_section::add_simple_input_section.
10626         (Output_section::discard_states): New method declaration.
10627         (Output_section::adjust_section_offsets): Same.
10628         (Output_section::section_offsets_need_adjustment,
10629         Output_section::set_section_offsets_need_adjustment): New method
10630         definitions.
10631         (Output_section::section_offsets_need_adjustment_): New data member.
10632         * script-sections.cc
10633         (Output_section_element_input::set_section_address): Adjust code for
10634         renaming of Output_section::add_input_section_for_script.
10635         (Orphan_output_section::set_section_address): Same.
10636
10637 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10638
10639         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
10640         Fix_v4bx enum values .
10641         * gold/options.h (General_options): New option definitions.
10642         (General_options::fix_v4bx): New method.
10643         (General_options::Fix_v4bx): New enum.
10644         * gold/options.cc (General_options::parse_fix_v4bx): New method.
10645         (General_options::parse_fix_v4bx_interworking): New method.
10646
10647 2010-01-22  Doug Kwan  <dougkwan@google.com>
10648
10649         * arm.cc (Arm_exidx_fixup): New class.
10650
10651 2010-01-21  Doug Kwan  <dougkwan@google.com>
10652
10653         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
10654         classes.
10655         (Arm_exidx_section_offset_map): New type.
10656
10657 2010-01-21  Doug Kwan  <dougkwan@google.com>
10658
10659         * arm.cc (Arm_exidx_input_section): New class.
10660         (Arm_relobj::exidx_input_section_by_link,
10661         Arm_relobj::exidx_input_section_by_shndx,
10662         Arm_relobj::make_exidx_input_section): New methods.
10663         (read_arm_attributes_section): Remove.
10664         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
10665         information about them.
10666         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
10667         to here.
10668
10669 2010-01-20  Doug Kwan  <dougkwan@google.com>
10670
10671         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
10672         Input_section_specifier to Section_id.
10673         (Target_arm::new_arm_input_section: Adjust code for change of key
10674         type.
10675         (Target_arm::find_arm_input_section): Ditto.
10676         * gc.h (object.h): Include for Section_id nand Section_id_hash.
10677         (Section_id): Remove.
10678         (Garbage_collection::Section_id_hash): Remove.
10679         * icf.h (object.h): Include for Section_id nand Section_id_hash.
10680         (Section_id): Remove.
10681         (Icf::Section_id_hash): Remove.
10682         * object.h (Section_id, Const_section_id, Section_id_hash,
10683         Const_section_id_hash): New type definitions.
10684         * output.cc (Output_section::add_relaxed_input_section): Change to
10685         use Const_section_id instead of Input_section_specifier as key type.
10686         (Output_section::add_merge_input_section): Ditto.
10687         (Output_section::build_relaxation_map): Change to use Section_id
10688         instead of Input_section_specifier as key type.
10689         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10690         Ditto.
10691         (Output_section::convert_input_sections_to_relaxed_sections): Change
10692         to use Const_section_id instead of Input_section_specifier as key type.
10693         (Output_section::find_merge_section): Ditto.
10694         (Output_section::find_relaxed_input_section): Ditto.
10695         * output.h (Input_section_specifier): Remove class.
10696         (Output_section::Output_section_data_by_input_section_map): Change
10697         key type to Const_section_id.
10698         (Output_section::Output_relaxed_input_section_by_input_section_map):
10699         Ditto.
10700         (Output_section::Relaxation_map): Change key type to Section_id.
10701
10702 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10703
10704         * gold/arm.cc: Added support for R_ARM_V4BX relocation
10705         (class Arm_v4bx_stub): New class.
10706         (DEF_STUBS): Updated definition to support v4_veneer_bx.
10707         (Stub_factory::make_arm_v4bx_stub): New method.
10708         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
10709         (Stub_table::empty): Handle v4bx stubs.
10710         (Stub_table::add_arm_v4bx_stub): New method.
10711         (Stub_table::find_arm_v4bx_stub): New method.
10712         (Arm_relocate_functions::v4bx): New method.
10713         (Target_arm::fix_v4bx): New method.
10714         (Target_arm::Target_arm): Handle R_ARM_V4BX.
10715         (Stub_table::relocate_stubs): Likewise.
10716         (Stub_table::do_write): Likewise.
10717         (Stub_table::update_data_size_and_addralign): Likewise.
10718         (Stub_table::finalize_stubs):  Likewise.
10719         (Target_arm::Scan::local): Likewise.
10720         (Target_arm::Scan::global): Likewise.
10721         (Target_arm::do_finalize_sections): Likewise.
10722         (Target_arm::Relocate::relocate): Likewise.
10723         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10724         Likewise.
10725         (Target_arm::scan_reloc_for_stub): Likewise.
10726         (Target_arm::scan_reloc_section_for_stubs): Likewise.
10727
10728 2010-01-19  Ian Lance Taylor  <iant@google.com>
10729
10730         * output.cc (Output_section_headers::do_sized_write): Write large
10731         segment count to sh_info field.
10732         (Output_file_header::do_sized_write): For large segment count,
10733         write PN_XNUM to e_phnum field.
10734
10735 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10736
10737         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
10738         (Arm_relocate_functions::thm_jump8): New function.
10739         (Arm_relocate_functions::thm_jump11): New function.
10740         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
10741         R_ARM_THM_JUMP11.
10742         (Target_arm::Scan::global): Likewise.
10743         (Target_arm::Relocate::relocate): Likewise.
10744         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10745         Likewise.
10746
10747 2010-01-14  Doug Kwan  <dougkwan@google.com>
10748
10749         * arm.cc (map, utility): Include headers.
10750         (Target_arm::apply_cortex_a8_workaround): New method.
10751         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
10752         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
10753         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
10754         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
10755         the --[no-]fix-cortex-a8 command line options.
10756         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
10757         (Target_arm::relocate_stub): Use addend in instruction template.
10758         * options.h (DEFINE_bool): Set the user-set flag.
10759         (General_options): Add --[no-]-fix-cortex options.
10760         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
10761         : Update fast look-up map after conversion.
10762
10763 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
10764
10765         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
10766         in the first pass of do_layout.
10767
10768 2010-01-13  Doug Kwan  <dougkwan@google.com>
10769
10770         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10771         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
10772         apparent compiler problem of not folding static constant integral
10773         data members of elfcpp::Elf_sizes<32>.
10774
10775 2010-01-13  Doug Kwan  <dougkwan@google.com>
10776
10777         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10778         Arm_relobj::section_needs_cortex_a8_stub_scanning,
10779         Arm_relobj::scan_section_for_cortex_a8_erratum,
10780         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
10781         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
10782         sections to scan for relocation stubs into a new method
10783         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
10784         relocation and Cortex-A8 stub scanning.
10785         (Target_arm::do_relax): Force stubs to be after stubbed sections
10786         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
10787         the beginning of a new relaxation pass.  Update a comment.
10788         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
10789
10790 2010-01-12  Ian Lance Taylor  <iant@google.com>
10791
10792         * target-reloc.h (visibility_error): New inline function.
10793         (relocate_section): Call visibility_error.
10794         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
10795         (MOSTLYCLEANFILES): Likewise.
10796         (protected_4_pic.o, protected_3.err): New targets.
10797         * testsuite/protected_4.cc: New file.
10798
10799 2010-01-12  Doug Kwan  <dougkwan@google.com>
10800
10801         * arm.cc (Cortex_a8_reloc): New class.
10802         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
10803         and cortex_a8_relocs_info_.
10804         (Target_arm::fix_cortex_a8): New method definition.
10805         (Target_arm::Cortex_a8_relocs_info): New type.
10806         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
10807         New data member declarations.
10808         (Target_arm::scan_reloc_for_stub): Record information about
10809         relocations for THUMB branches that might be exempted from the
10810         Cortex-A8 workaround.
10811         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
10812         at the beginning of a relaxation pass.
10813
10814 2010-01-12  Doug Kwan  <dougkwan@google.com>
10815
10816         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
10817         (Arm_relobj::Mapping_symbol_position,
10818          Arm_reloj::Mapping_symbol_position_less,
10819          Arm_relobj::Mapping_symbols_info): New types.
10820         (Target_arm::is_mapping_symbol_name): New method definition.
10821         (Arm_relobj::do_count_local_symbols): Save information about mapping
10822         symbols.
10823
10824 2010-01-11  Doug Kwan  <dougkwan@google.com>
10825
10826         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
10827         Arm_relocate_functions::thumb32_branch_upper,
10828         Arm_relocate_functions::thumb32_branch_lower,
10829         Arm_relocate_functions::thumb32_cond_branch_offset,
10830         Arm_relocate_functions::thumb32_cond_branch_upper,
10831         Arm_relocate_functions::thumb32_cond_branch_lower,
10832         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
10833         branch offset encoding.
10834         (Arm_relocate_functions::thumb_branch_common): Use new branch
10835         offset encoding methods to avoid code duplication.
10836         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
10837         (Stub_addend_reader::operator()): Use new branch encoding method
10838         to avoid code duplication.
10839
10840 2010-01-11  Doug Kwan  <dougkwan@google.com>
10841
10842         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
10843         (Target_arm::do_finalize_sections): Define special EXIDX section
10844         symbols only if referenced.
10845         * gc.h (Garbage_collection::add_reference): New method.
10846         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
10847         code duplication.
10848
10849 2010-01-11  Ian Lance Taylor  <iant@google.com>
10850
10851         * script.cc (Version_script_info::build_expression_list_lookup):
10852         Change complaing about duplicate wildcard match from error to
10853         warning.
10854
10855         * script.cc (class Lazy_demangler): Recreate--revert part of patch
10856         of 2009-12-30.
10857         (Version_script_info::Version_script_info): Initialize globs_,
10858         default_version_, default_is_global_, and exact_.  Don't
10859         initialize globals_ or locals_.
10860         (Version_script_info::build_lookup_tables): Build local symbols
10861         first.
10862         (Version_script_info::unquote): New function.
10863         (Version_script_info::add_exact_match): New function.
10864         (Version_script_info::build_expression_list_lookup): Remove lookup
10865         parameter.  Add is_global parameter.  Change all callers.  Handle
10866         wildcard pattern specially.  Unquote pattern.  Call
10867         add_exact_match.
10868         (Version_script_info::get_name_to_match): New function.
10869         (Version_script_info::get_symbol_version): New function.
10870         (Version_script_info::get_symbol_version_helper): Remove.
10871         (Version_script_info::check_unmatched_names): Call unquote.
10872         * script.h (class Version_script_info): Change get_symbol_version
10873         to be non-inline and add is_global parameter; change all callers.
10874         Rewrite symbol_is_local.  Update declarations.  Define struct
10875         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
10876         Remove globals_ and locals_ members.  Add exact_, globs_,
10877         default_version_, is_global_.
10878         (Version_script_info::Glob): Remove pattern, add expression and
10879         is_global.  Update constructor.  Change all callers.
10880         * dynobj.cc (Versions::finalize): Mark the version symbol as the
10881         default version.
10882         (Versions::symbol_section_contents): If a symbol is undefined, or
10883         defined in a dynamic object, set the version index to
10884         VER_NDX_LOCAL.
10885         * symtab.cc (Symbol_table::add_from_relobj): Don't call
10886         symbol_is_local.
10887         (Symbol_table::add_from_pluginobj): Likewise.
10888         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
10889
10890 2010-01-11  Doug Kwan  <dougkwan@google.com>
10891
10892         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
10893         (incremental_dump_LDADD): Add linking option for libintl.
10894         * Makefile.in: Regenerate.
10895
10896 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
10897
10898         PR gold/11144
10899         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
10900         instead of -Ds.
10901         * testsuite/Makefile.in: Regenerated.
10902
10903 2010-01-10  Doug Kwan  <dougkwan@google.com>
10904
10905         * options.h (DEFINE_var): Use parentheses around argument varname__
10906         in macro body to avoid any unintended subsequent substitutions.
10907
10908 2010-01-10  Ian Lance Taylor  <iant@google.com>
10909
10910         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
10911         candidates before doing symbol resolution.
10912
10913         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
10914         ODR candidates if only one is weak.
10915
10916 2010-01-08  Ian Lance Taylor  <iant@google.com>
10917
10918         * script.cc (Version_script_info::build_expression_list_lookup):
10919         Don't warn about ambiguous version, just record the ambiguity.
10920         (Version_script_info::get_symbol_version_helper): Give error if
10921         version is ambiguous.
10922
10923 2010-01-08  Doug Kwan  <dougkwan@google.com>
10924
10925         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
10926         prev_data_size_ and prev_addralign_.  Remove initializer for
10927         deleted data member has_been_changed_.
10928         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
10929         to determine if the table is empty.
10930         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
10931         Remove.
10932         (Stub_table::add_reloc_stub): Define method in class definition
10933         instead of just declaring it there.
10934         (Stub_table::add_cortex_a8_stub): New method definition.
10935         (Stub_table::update_data_size_and_addralign): Ditto.
10936         (Stub_table::finalize_stubs): Ditto.
10937         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
10938         (Stub_table::do_addralign_): Return address alignment in the
10939         (Stub_table::do_reset_address_and_file_offset): Define method in
10940         class definition instead of declaring it there.  Set current data
10941         size to be the data size of the previous pass.
10942         (Stub_table::set_final_data_size): Use current data size as the
10943         final data size.
10944         (Stub_table::relocate_stub): Change parameter type of stub from
10945         Reloc_stub pointer to Stub pointer.
10946         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10947         (Stub_table::Cortex_a8_stub_list): New typedef.
10948         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10949          Stub_table::prev_addralign_): New data member.
10950         (Arm_relobj::Arm_relobj): Initialize data member
10951         section_has_cortex_a8_workaround_.
10952         (Arm_relobj::section_has_cortex_a8_workaround,
10953          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
10954          definitions.
10955         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10956         declarations.
10957         (Target_arm::relocate_stub): Change parameter type of stub from
10958         Reloc_stub pointer to Stub pointer.
10959         (Insn_template::size, Insn_template::alignment): Handle
10960         THUMB16_SPECIAL_TYPE.
10961         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10962          Stub_table::update_data_size_and_addralign,
10963          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10964         definitions.
10965         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10966         (Stub_table::do_write): Ditto.
10967         (Target_arm::do_relax): Adjust code for changes in Stub_table.
10968
10969 2010-01-08  Ian Lance Taylor  <iant@google.com>
10970
10971         PR 11108
10972         * symtab.h (class Symbol): Remove fields is_target_special_ and
10973         has_plt_offset_.  Add field is_defined_in_discarded_section_.
10974         (Symbol::is_defined_in_discarded_section): New function.
10975         (Symbol::set_is_defined_in_discarded_section): New function.
10976         (Symbol::has_plt_offset): Rewrite.
10977         (Symbol::set_plt_offset): Verify that new offset is not -1U.
10978         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10979         Don't initialize is_target_special_ or has_plt_offset_.
10980         Initialize is_defined_in_discarded_section_.
10981         (Symbol_table::add_from_relobj): If appropriate, set
10982         is_defined_in_discarded_section.
10983         * resolve.cc (Symbol::override_base_with_special): Don't test
10984         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
10985         * target-reloc.h (relocate_section): Do special handling for
10986         symbols defined in discarded sections for global symbols as well
10987         as local symbols.
10988
10989 2010-01-08  Ian Lance Taylor  <iant@google.com>
10990
10991         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10992         the SHT_SYMTAB case.
10993
10994 2010-01-08  Ian Lance Taylor  <iant@google.com>
10995
10996         * object.cc (Sized_relobj::do_layout): Don't get confused if
10997         layout_eh_frame returns NULL.
10998
10999 2010-01-08  Ian Lance Taylor  <iant@google.com>
11000
11001         PR 11084
11002         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
11003         dynamic symbol table, use the normal symbol table.
11004         (Sized_dynobj::do_read_symbols): Remove assertion about type of
11005         symbol table.
11006
11007 2010-01-08  Ian Lance Taylor  <iant@google.com>
11008
11009         PR 11072
11010         * layout.cc (Layout::include_section): Remove .gnu_debuglink
11011         sections.
11012
11013 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
11014
11015         * version.cc (print_version): Change to "Copyright 2010".
11016
11017 2010-01-08  Ian Lance Taylor  <iant@google.com>
11018
11019         PR 10287
11020         PR 11063
11021         * i386.cc (class Target_i386): Change return type of plt_section
11022         to be non-const.
11023         (class Output_data_plt_i386): Add tls_desc_rel_ field.
11024         (Output_data_plt_i386::Output_data_plt_i386): Initialize
11025         tls_desc_rel_ field.
11026         (Output_data_plt_i386::rel_tls_desc): New function.
11027         (Target_i386::rel_tls_desc_section): New function.
11028         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
11029         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
11030         R_386_TLS_DESC reloc in rel_tls_desc_section.
11031         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
11032         Define struct Tlsdesc_info.
11033         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
11034         (Target_x86_64::do_reloc_symbol_index): New function.
11035         (Target_x86_64::add_tlsdesc_info): New function.
11036         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
11037         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
11038         tlsdesc_rel_ field.
11039         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
11040         all callers.
11041         (Output_data_plt_x86_64::rela_tlsdesc): New function.
11042         (Target_x86_64::rela_tlsdesc_section): New function.
11043         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
11044         handling.
11045         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
11046         (Target_x86_64::do_reloc_addend): New function.
11047         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
11048         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
11049         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
11050         (Output_reloc::type): New function.
11051         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
11052         (Output_reloc::is_target_specific): New function.
11053         (Output_reloc::target_arg): New function.
11054         (class Output_reloc) [SHT_RELA]: Add four new constructors for
11055         absolute relocs and target specific relocs.
11056         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
11057         add_target_specific.
11058         (class Output_data_reloc) [SHT_RELA]: Likewise.
11059         * output.cc (Output_reloc::Output_reloc): Add four new versions
11060         for absolute relocs and target specific relocs.
11061         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
11062         (Output_reloc::get_symbol_index): Likewise.
11063         (Output_reloc::local_section_offset): Check that local_sym_index_
11064         is not TARGET_CODE or 0.
11065         (Output_reloc::symbol_value): Likewise.
11066         (Output_reloc::write) [SHT_RELA]: Call target for target specific
11067         reloc.
11068         * target.h (class Target): Add reloc_symbol_index and reloc_addend
11069         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
11070         functions.
11071         * layout.cc (add_target_dynamic_tags): Use output section for
11072         DT_PLTRELSZ and DT_JMPREL.
11073
11074 2010-01-07  Ian Lance Taylor  <iant@google.com>
11075
11076         PR 11061
11077         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
11078         function.
11079         (class Output_data_reloc_generic): Define.
11080         (class Output_data_reloc_base): Change base class to
11081         Output_data_reloc_generic.  Change add() method to call
11082         bump_relative_reloc_count for a relative reloc.  Remove
11083         sort_relocs_ field.
11084         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
11085         to sort_relocs().
11086         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
11087         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
11088         appropriate.
11089         * layout.h (class Layout): Update declaration.
11090
11091 2010-01-07  Ian Lance Taylor  <iant@google.com>
11092
11093         * output.h (class Output_data): Add const version of
11094         output_section and do_output_section.
11095         (class Output_section_data): Add const version of
11096         do_output_section.
11097         (class Output_section): Likewise.
11098         * layout.cc (Layout::add_target_dynamic_tags): New function.
11099         * layout.h (class Layout): Update declarations.
11100         * arm.cc (Target_arm::do_finalize_sections): Use
11101         add_target_dynamic_tags.
11102         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11103         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11104         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11105         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11106
11107 2010-01-07  Ian Lance Taylor  <iant@google.com>
11108
11109         PR 11042
11110         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
11111         object as needed.
11112
11113 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
11114             Ian Lance Taylor  <iant@google.com>
11115
11116         PR 11019
11117         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
11118         Xindex::read_symtab_xindex.
11119
11120 2010-01-07  Doug Kwan  <dougkwan@google.com>
11121
11122         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
11123         (Insn_template::thumb16_bcond_insn): New method declaration.
11124         (Insn_template): Fix spelling.
11125         (Stub::thumb16_special): New method declaration.
11126         (Stub::do_write): Define virtual method which was previously pure
11127         virtual.
11128         (Stub::do_thumb16_special): New method declaration.
11129         (Stub::do_fixed_endian_write): New template member.
11130         (Reloc_stub::do_write): Remove.
11131         (Reloc_stub::do_fixed_endian_write): Remove.
11132         (Cortex_a8_stub): New class definition.
11133         (Stub_factory::make_cortex_a8_stub): New method definition.
11134         (Stub_factory::Stub_factory): Add missing static storage class
11135         qualifier for elf32_arm_stub_a8_veneer_blx.
11136
11137 2010-01-07  Ian Lance Taylor  <iant@google.com>
11138
11139         PR 10980
11140         * options.h (class General_options): Add --warn-unresolved-symbols
11141         and --error-unresolved-symbols.
11142         * errors.cc (Errors::undefined_symbol): Implement
11143         --warn-unresolved-symbols.
11144
11145         * options.h (class General_options): Add -z text and -z textoff.
11146         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
11147
11148 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
11149
11150         * gc.h (Garbage_collection::Cident_section_map): New typedef.
11151         (Garbage_collection::cident_sections): New function.
11152         (Garbage_collection::add_cident_section): New function.
11153         (Garbage_collection::cident_sections_): New member.
11154         (gc_process_relocs): Add references to sections whose names are C
11155         identifiers.
11156         * gold.h (cident_section_start_prefix): New constant.
11157         (cident_section_stop_prefix): New constant.
11158         (is_cident): New function.
11159         * layout.cc (Layout::define_section_symbols): Replace string constants
11160         with the newly defined constants.
11161         * object.cc (Sized_relobj::do_layout): Track sections whose names are
11162         C identifiers.
11163         * testsuite/Makefile.am: Add gc_orphan_section_test.
11164         * testsuite/Makefile.in: Regenerate.
11165         * testsuite/gc_orphan_section_test.cc: New file.
11166         * testsuite/gc_orphan_section_test.sh: New file.
11167
11168 2010-01-06  Ian Lance Taylor  <iant@google.com>
11169
11170         PR 10980
11171         * options.h (class General_options): Add --warn-shared-textrel.
11172         * layout.cc (Layout::finish_dynamic_section): Implement
11173         --warn-shared-textrel.
11174
11175         PR 10980
11176         * options.h (class General_options): Add --warn-multiple-gp.
11177
11178 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11179
11180         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
11181         $(THREADSLIB) and $(LIBDL).
11182         * Makefile.in: Rebuild.
11183
11184 2010-01-06  Ian Lance Taylor  <iant@google.com>
11185
11186         PR 10980
11187         * options.cc (General_options::parse_section_start): New function.
11188         (General_options::section_start): New function.
11189         (General_options::General_options): Initialize all members.
11190         * options.h: Include <map>
11191         (class General_options): Add --section-start.  Add section_starts_
11192         member.
11193         * layout.cc (Layout::attach_allocated_section_to_segment): If
11194         --section-start was used, set the address of the segment.  Remove
11195         local sort_sections.
11196         (Layout::relaxation_loop_body): If the address of the load segment
11197         has been set by --section-start, don't use it.
11198         * output.h (Output_segment::update_flags_for_output_section): New
11199         function.
11200         * output.cc (Output_segment::add_output_section): Call
11201         update_flags_for_output_section.
11202
11203 2010-01-05  Ian Lance Taylor  <iant@google.com>
11204
11205         PR 10980
11206         * options.h (class General_options): Add --undefined-version.
11207         * script.cc (struct Version_expression): Add was_matched_by_symbol
11208         field.
11209         (Version_script_info::matched_symbol): New function.
11210         (Version_script_info::get_symbol_version_helper): Call
11211         matched_symbol.
11212         (Version_script_info::check_unmatched_names): New function.
11213         * script.h (class Version_script_info): Update declarations.
11214         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
11215
11216         * options.h (class General_options): Use DEFINE_bool_alias for
11217         allow_multiple_definition.
11218         * resolve.cc (Symbol_table::should_override): Don't test
11219         allow_multiple_definition.
11220
11221         PR 10980
11222         * options.h (class General_options): Add --cref.
11223         * main.cc (main): Print cref table if --cref.  Don't close mapfile
11224         until after printing cref table.
11225         * cref.cc: Include "symtab.h".
11226         (class Cref_inputs): Define Cref_table_compare and Cref_table.
11227         (Cref_table_compare::operator()): New function.
11228         (Cref_inputs::gather_cref): New function.
11229         (filecol): New static const.
11230         (Cref_inputs::print_cref): New function.
11231         (Cref::print_cref): New function.
11232         * cref.h: Include <cstdio>.
11233         (class Cref): Update declarations.
11234         * mapfile.h (Mapfile::file): New function.
11235         * object.h (class Object): Define Symbols.  Declare virtual
11236         do_get_global_symbols.
11237         (Object::get_global_symbols): New function.
11238         * object.cc (Input_objects::add_object): Pass object to cref_ if
11239         --cref.
11240         (Input_objects::archive_start): Likewise.
11241         (Input_objects::archive_stop): Likewise.
11242         (Input_objects::print_cref): New function.
11243         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
11244         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
11245         --cref.
11246         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
11247         function.
11248         * plugin.h (class Sized_pluginobj): Update declarations.
11249
11250 2010-01-05  Ian Lance Taylor  <iant@google.com>
11251
11252         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
11253         to is_default_version.  Rename insdef to insdefault.
11254         (Symbol_table::add_from_relobj): Rename def to is_default_version
11255         and local to is_forced_local.
11256         (Symbol_table::add_from_pluginobj): Likewise.
11257         (Symbol_table::add_from_dynobj): Likewise.
11258         (Symbol_table::define_special_symbol): Rename insdef to
11259         insdefault.
11260
11261 2010-01-04  Ian Lance Taylor  <iant@google.com>
11262
11263         PR 10980
11264         * options.h (class General_options): Add
11265         --allow-multiple-definition and -z muldefs.
11266         * resolve.cc (Symbol_table::should_override): Don't warn about a
11267         multiple symbol definition if --allow-multiple-definition or -z
11268         muldefs.
11269
11270         PR 10980
11271         * options.h (class General_options): Add --add-needed and
11272         --copy-dt-needed-entries.  Tweak --as-needed help entry.
11273         * object.cc (Input_objects::check_dynamic_dependencies): Give an
11274         error if --copy-dt-needed-entries aka --add-needed is used and
11275         would cause a change in behaviour.
11276
11277         PR 10980
11278         * options.h (class General_options): Add -G as a short version of
11279         --shared.  Add no-op options -assert, -g, and -i.
11280
11281 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
11282
11283         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
11284         check for .text or .gnu.linkonce.t sections.
11285         * icf.cc (Icf::find_identical_sections): Ditto.
11286         Change the detection for mangled function name within the section
11287         name.
11288         * icf.h (is_section_foldable_candidate): New function.
11289
11290 2009-12-30  Ian Lance Taylor  <iant@google.com>
11291
11292         PR 10980
11293         * options.h (class General_options): Permit two dashes with
11294         --retain-symbols-file.
11295
11296 2009-12-30  Ian Lance Taylor  <iant@google.com>
11297
11298         PR 10979
11299         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
11300         don't put the file header and segment headers in the text
11301         segment.
11302
11303         PR 10979
11304         * common.cc (Sort_commons::operator()): Stabilize sort when both
11305         entries are NULL.
11306         (Symbol_table::do_allocate_commons_list): When allocating common
11307         symbols, skip a symbol which is no longer common.
11308         * symtab.h (Symbol::is_common): Test whether the symbol comes from
11309         an object before checking its type.
11310         * testsuite/common_test_2.c: New file.
11311         * testsuite/common_test_3.c: New file.
11312         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
11313         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
11314         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
11315         (common_test_2_pic.o, common_test_2.so): New targets.
11316         (common_test_3_pic.o, common_test_3.so): New targets.
11317         * testsuite/Makefile.in: Rebuild.
11318
11319         PR 10979
11320         * script.cc (read_input_script): If we see a new SECTIONS clause,
11321         and we have added an input section, give an error.
11322         * layout.h (class Layout): Add have_added_input_section function.
11323         Add have_added_input_section_ field.
11324         * layout.cc (Layout::Layout): Initialize
11325         have_added_input_section_.
11326         (Layout::layout): Set have_added_input_section_.
11327         (Layout::layout_eh_frame): Likewise.
11328
11329 2009-12-30  Ian Lance Taylor  <iant@google.com>
11330
11331         PR 10931
11332         * options.h (class General_options): Add --sort-common option.
11333         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
11334         * common.cc (Sort_common): Add sort_order parameter to
11335         constructor.  Add sort_order_ field.
11336         (Sort_commons::operator): Check sort_order_.
11337         (Symbol_table::allocate_commons): Determine the sort order.
11338         (Symbol_table::do_allocate_commons): Add sort_order parameter.
11339         Change all callers.
11340         (Symbol_table::do_allocate_commons_list): Likewise.
11341
11342 2009-12-30  Ian Lance Taylor  <iant@google.com>
11343
11344         PR 10916
11345         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
11346         symbols from this object, don't change the visibility of an
11347         undefined symbol.
11348         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
11349
11350 2009-12-30  Ian Lance Taylor  <iant@google.com>
11351
11352         PR 10861
11353         * script.h (class Version_script_info): Define Language enum.
11354         Update declarations.  Define Glob, Exact, and Lookup types.  Add
11355         new fields globals_, locals_, and is_finalized_.
11356         * script.cc: Various formatting fixes.
11357         (class Parser_closure): Change language_stack_ from a vector of
11358         std::string to one of Version_script_info::Language.  Adjust all
11359         uses accordingly.
11360         (class Lazy_demangler): Remove.
11361         (struct Version_expression): Change language from std::string to
11362         Version_script_info::Language.
11363         (Version_script_info::Version_script_info): New function.
11364         (Version_script_info::~Version_script_info): Don't call clear.
11365         (Version_script_info::finalize): New function.
11366         (Version_script_info::build_lookup_tables): New function.
11367         (Version_script_info::build_expression_list_lookup): New
11368         function.
11369         (Version_script_info::get_symbol_version_helper): Rewrite to use
11370         lookup tables.
11371         (Version_script_info::print_expression_list): Adjust to use
11372         Version_script_info::Language.
11373         (script_push_lex_into_version_mode): Check that the version script
11374         has not been finalized.
11375         (version_script_push_lang): Change language string to
11376         Version_script_info::Language.
11377         * options.cc (Command_line::version_script): New function.
11378         * options.h (class General_options): Add finalize_dynamic_list
11379         function.  Change version_script from declaration to definition.
11380         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
11381         * testsuite/version_script.map: Remove duplicate def of foo.
11382         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
11383         version_script.map.
11384         * testsuite/Makefile.in: Rebuild.
11385
11386 2009-12-30  Ian Lance Taylor  <iant@google.com>
11387
11388         PR 10843
11389         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
11390         if the input symbol index is 0, make the output symbol index 0.
11391
11392 2009-12-30  Ian Lance Taylor  <iant@google.com>
11393
11394         PR 10670
11395         * options.h (class General_options): Add -x/--discard-all.
11396         * object.cc (Sized_relobj::do_count_local_symbols): Handle
11397         --discard-all.  If the local symbol needs a dynamic entry, check
11398         that before handling --discard-locals.
11399
11400 2009-12-30  Ian Lance Taylor  <iant@google.com>
11401
11402         PR 10450
11403         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
11404         flags to PF_R.
11405         (Output_segment::add_output_section): Don't change the flags if
11406         the type is PT_TLS.
11407
11408         PR 10450
11409         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
11410         GNU hash table if they need a dynamic value.  Otherwise, don't add
11411         them if they are defined in a dynamic object or are forced local.
11412
11413 2009-12-29  Ian Lance Taylor  <iant@google.com>
11414
11415         PR 10450
11416         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
11417         .gnu.hash table for a 32-bit target.
11418
11419         PR 10450
11420         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
11421         regular and a dynamic object only needs a dynamic symbol table
11422         entry if it is externally visible.
11423
11424         PR 10450
11425         * i386.cc (class Target_i386): Initialize global_offset_table_ in
11426         constructor.  Add global_offset_table_ field.
11427         (Target_i386::got_section): Set global_offset_table_.
11428         (Target_i386::do_finalize_sections): Set global_offset_table_
11429         size.
11430         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
11431         in constructor.  Add global_offset_table_ field.
11432         (Target_x86_64::got_section): Set global_offset_table_.
11433         (Target_x86_64::do_finalize_sections): Set global_offset_table_
11434         size.
11435
11436         * layout.cc (Layout::Layout): Initialize increase_relro_.
11437         (Layout::get_output_section): Add is_relro, is_last_relro, and
11438         is_first_non_relro parameters.  Change all callers.
11439         (Layout::choose_output_section): Likewise.
11440         (Layout::add_output_section_data): Likewise.
11441         (Layout::make_output_section): Likewise.
11442         (Layout::set_segment_offsets): Clear increase_relro when using a
11443         linker script.
11444         * layout.h (class Layout): Add increase_relro method.  Add
11445         increase_relro_ field.  Update declarations.
11446         * output.cc (Output_section::Output_section): Initialize
11447         is_last_relro_ and is_first_non_relro_.
11448         (Output_segment::add_output_section): Group relro sections is
11449         do_sort is true.  Handle is_last_relro and is_first_non_relro.
11450         (Output_segment::maximum_alignment): Remove relro handling.
11451         (Output_segment::set_section_addresses): Add increase_relro
11452         parameter.  Change all callers.  Add initial alignment to align
11453         relro sections on separate page.  Remove old relro handling.
11454         (Output_segment::set_section_list_addresses): Remove in_relro
11455         parameter.  Change all callers.
11456         (Output_segment::set_offset): Add increase parameter.  Change all
11457         callers.  Remove old relro handling.
11458         * output.h (class Output_section): Add new methods: is_last_relro,
11459         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
11460         Add is_last_relro_ and is_first_non_relro_ fields.
11461         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
11462         Create separate .got.plt section.  Call increase_relro.
11463         * x86_64.cc (Target_x86_64::got_section): Likewise.
11464         * testsuite/relro_script_test.t: Add .got.plt.
11465
11466         PR 10450
11467         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
11468         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
11469         (Layout::finalize): Call set_dynamic_symbol_size.
11470         (Layout::set_dynamic_symbol_size): New function.
11471         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
11472         set_dynamic_symbol_size.
11473
11474         PR 10450
11475         * output.h (class Output_section): Add is_entsize_zero_ field.
11476         * output.cc (Output_section::Output_section): Initialize
11477         is_entsize_zero_.
11478         (Output_section::set_entsize): If two different entsizes are
11479         requested, force it to zero.
11480         (Output_section::add_input_section): Set flags for .debug_str
11481         before updating section flags.  Set entsize.
11482         (Output_section::update_flags_for_input_section): Set SHF_MERGE
11483         and SHF_STRING if all input sections have those flags.
11484
11485 2009-12-29   Rafael Espindola  <espindola@google.com>
11486
11487         * main.cc (main): Fix the sys time reporting.
11488         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
11489         reporting.
11490
11491 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
11492
11493         * options.cc (General_options::parse_version): Allow -v to exit
11494         without an error if there is nothing to link.
11495
11496 2009-12-29  Ian Lance Taylor  <iant@google.com>
11497
11498         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
11499         using a version of gcc before 4.1.
11500         * configure: Rebuild.
11501
11502 2009-12-28  Chris Demetriou  <cgd@google.com>
11503
11504         * attributes.cc (Output_attributes_section_data::do_write): Use
11505         std::vector::front rather than std::vector::data.
11506
11507 2009-12-28  Ian Lance Taylor  <iant@google.com>
11508
11509         * symtab.h (class Symbol_table): Add enum Defined.
11510         * resolve.cc (Symbol_table::should_override): Add defined
11511         parameter.  Change all callers.  Test whether object is NULL
11512         before calling a method on it.
11513         (Symbol_table::report_resolve_problem): Add defined parameter.
11514         Change all callers.
11515         (Symbol_table::should_override_with_special): Likewise.
11516         * symtab.cc (Symbol_table::define_in_output_data): Add defined
11517         parameter.  Change all callers.
11518         (Symbol_table::do_define_in_output_data): Likewise.
11519         (Symbol_table::define_in_output_segment): Likewise.
11520         (Symbol_table::do_define_in_output_segment): Likewise.
11521         (Symbol_table::define_as_constant): Likewise.
11522         (Symbol_table::do_define_as_constant): Likewise.
11523         * script.h (class Symbol_assignment): Add is_defsym parameter to
11524         constructor; change all callers.
11525         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
11526         parameter.  Change all callers.  Add is_defsym_ field.
11527         (class Parser_closure): Add parsing_defsym parameter to
11528         constructor; change all callers.  Add parsing_defsym accessor
11529         function.  Add parsing_defsym_ field.
11530
11531 2009-12-28  Ian Lance Taylor  <iant@google.com>
11532
11533         * gold.cc (queue_middle_tasks): Fix formatting.
11534         * object.cc (Relobj::is_section_name_included): Likewise.
11535
11536 2009-12-23  Ian Lance Taylor  <iant@google.com>
11537
11538         * i386.cc (Target_i386::do_calls_non_split): Recognize
11539         -fsplit-stack prologue for a function with a static chain.
11540         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
11541         -fsplit-stack prologue when using %r11.
11542
11543 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
11544
11545         * options.cc (General_options::parse_version): Make -v continue and do
11546         the link like GNU ld does.
11547
11548 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
11549
11550         * Makefile.am (CCFILES): Add timer.cc.
11551         (HFILES): Add timer.h.
11552         * configure.ac: Check for sysconf and times.
11553         * main.cc: include timer.h.
11554         (main): Use Timer instead of get_run_time.
11555         * timer.cc: New.
11556         * timer.h: New.
11557         * workqueue.cc: include timer.h.
11558         (Workqueue::find_and_run_task):
11559         Report user, sys and wall time.
11560         * Makefile.in: Regenerate.
11561         * config.in: Regenerate.
11562         * configure: Regenerate.
11563
11564 2009-12-16  Doug Kwan  <dougkwan@google.com>
11565
11566         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
11567         sections.
11568         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
11569         relaxed input sections.
11570         * output.cc (Output_section::find_relaxed_input_section): Change
11571         return type to Output_relaxed_input_section pointer.  Adjust code
11572         for new type of relaxed_input_section_map_.
11573         * output.h (Output_section::find_relaxed_input_section): Change
11574         return type to Output_relaxed_input_section pointer.
11575         (Output_section::Output_relaxed_input_section_by_input_section_map):
11576         New type.
11577         (Output_section::relaxed_input_section_map_): Change type to
11578         Output_section::Output_relaxed_input_section_by_input_section_map.
11579         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
11580         input section.
11581
11582 2009-12-15  Ian Lance Taylor  <iant@google.com>
11583
11584         * layout.cc (Layout::create_shstrtab): Only write out after input
11585         sections if we are compressing debug sections.
11586
11587 2009-12-15  Ian Lance Taylor  <iant@google.com>
11588
11589         * archive.cc (Archive::add_symbols): Only look up a symbol without
11590         a version if there is, in fact, a version.
11591
11592 2009-12-14  Ian Lance Taylor  <iant@google.com>
11593
11594         Revert -Wshadow changes, all changes from:
11595         2009-12-11  Doug Kwan  <dougkwan@google.com>
11596         2009-12-11  Nick Clifton  <nickc@redhat.com>
11597         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
11598
11599 2009-12-11  Doug Kwan  <dougkwan@google.com>
11600
11601         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
11602         due to -Wshadow.
11603         * attributes.cc (Object_attribute::size): Ditto.
11604         (Attributes_section_data::size): Ditto.
11605         (Attributes_section_data::Attributes_section_data): Ditto.
11606         (Output_attributes_section_data::do_write): Ditto.
11607         * attributes.h (Object_attribute::set_type): Ditto.
11608         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
11609
11610 2009-12-11  Nick Clifton  <nickc@redhat.com>
11611
11612         * archive.cc: Fix shadowed variable warnings.
11613         * arm.cc: Likewise.
11614         * compressed_output.cc: Likewise.
11615         * compressed_output.h: Likewise.
11616         * configure: Likewise.
11617         * dwarf_reader.cc: Likewise.
11618         * dynobj.cc: Likewise.
11619         * dynobj.h: Likewise.
11620         * ehframe.cc: Likewise.
11621         * ehframe.h: Likewise.
11622         * errors.cc: Likewise.
11623         * expression.cc: Likewise.
11624         * fileread.cc: Likewise.
11625         * fileread.h: Likewise.
11626         * freebsd.h: Likewise.
11627         * i386.cc: Likewise.
11628         * icf.cc: Likewise.
11629         * incremental.h: Likewise.
11630         * layout.cc: Likewise.
11631         * layout.h: Likewise.
11632         * mapfile.cc: Likewise.
11633         * merge.cc: Likewise.
11634         * merge.h: Likewise.
11635         * object.cc: Likewise.
11636         * object.h: Likewise.
11637         * options.h: Likewise.
11638         * output.cc: Likewise.
11639         * output.h: Likewise.
11640         * parameters.cc: Likewise.
11641         * plugin.cc: Likewise.
11642         * powerpc.cc: Likewise.
11643         * reduced_debug_output.cc: Likewise.
11644         * reduced_debug_output.h: Likewise.
11645         * reloc.cc: Likewise.
11646         * reloc.h: Likewise.
11647         * resolve.cc: Likewise.
11648         * script-sections.cc: Likewise.
11649         * script.cc: Likewise.
11650         * script.h: Likewise.
11651         * sparc.cc: Likewise.
11652         * symtab.cc: Likewise.
11653         * symtab.h: Likewise.
11654         * target-select.cc: Likewise.
11655         * target-select.h: Likewise.
11656         * token.h: Likewise.
11657         * workqueue.cc: Likewise.
11658         * workqueue.h: Likewise.
11659         * x86_64.cc: Likewise.
11660
11661 2009-12-10  Doug Kwan  <dougkwan@google.com>
11662
11663         * arm.cc (attributes.h): New include.
11664         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
11665         (Arm_relobj::~Arm_relobj): Delete object pointed by
11666         attributes_section_data_.
11667         (Arm_relobj::attributes_section_data): New method definition.
11668         (Arm_relobj::attributes_section_data_): New data member declaration.
11669         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
11670         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
11671         attributes_section_data_.
11672         (Arm_dynobj::attributes_section_data): New method definition.
11673         (Arm_dynobj::attributes_section_data_): New data member declaration.
11674         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
11675         initialization value of may_use_blx_ to false.
11676         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
11677         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
11678         object attributes to compute results instead of hard-coding.
11679         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
11680         Target_arm::get_secondary_compatible_arch,
11681         Target_arm::set_secondary_compatible_arch
11682         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11683         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
11684         New method declarations.
11685         (Target_arm::get_aeabi_object_attribute): New method definition.
11686         (Target_arm::attributes_section_data_): New data member declaration.
11687         (read_arm_attributes_section): New template definition.
11688         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
11689         (Arm_dynobj::do_read_symbols): Ditto.
11690         (Target_arm::do_finalize_sections): Merge attributes sections from
11691         input.  Check for BLX use after attributes section merging.
11692         Fix __exidx_start and __exidx_end visibility.  Create an
11693         .ARM.attributes section if necessary.
11694         (Target_arm::get_secondary_compatible_arch,
11695         Target_arm::set_secondary_compatible_arch,
11696         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11697         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
11698         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
11699         New method definitions.
11700
11701 2009-12-09  Ian Lance Taylor  <iant@google.com>
11702
11703         * plugin.cc (Plugin::load): Don't cast from void* to a function
11704         pointer.
11705
11706 2009-12-09  Ian Lance Taylor  <iant@google.com>
11707
11708         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
11709         information fields.
11710
11711 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
11712
11713         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
11714         Replace two_file_shared_1.so with two_file_shared_2.so.
11715         * testsuite/Makefile.in: Regenerated.
11716
11717 2009-12-08  Doug Kwan  <dougkwan@google.com>
11718
11719         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
11720         (HFILES): Add attributes.h and int_encoding.h.
11721         * Makefile.in: Regenerate.
11722         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
11723         function definitions to int_encoding.cc
11724         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
11725         prototypes to int_encoding.h
11726         * reduced_debug_output.cc (int_encoding.h): New include.
11727         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
11728         function definitions to int_encoding.cc
11729         (insert_into_vector, read_from_pointer): Move template definitions to
11730         int_encoding.h
11731         * attributes.cc: New file.
11732         * attributes.h: New file.
11733         * int_encoding.cc: New file.
11734         * int_encoding.h: New file.
11735
11736 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
11737
11738         PR gold/11055
11739         * incremental-dump.cc (dump_incremental_inputs): New.
11740         (main): Use dump_incremental_inputs.
11741
11742 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
11743
11744         PR gold/10893
11745         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
11746         checking elfcpp::STT_FUNC.
11747         (Target_i386::Relocate::relocate): Likewise.
11748         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
11749
11750         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
11751         symbols from shared libraries into normal FUNC symbols.
11752
11753         * symtab.h (Symbol): Add is_func and use it.
11754
11755 2009-12-05  Doug Kwan  <dougkwan@google.com>
11756
11757         * arm.cc (Target_arm::arm_info): Initialize new fields
11758         attributes_section and attributes_vendor.
11759         * i386.cc (Target_i386::i386_info): Same.
11760         * object.cc (Sized_relobj::do_layout): Skip attribute section.
11761         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
11762         fields attributes_section and attributes_vendor.
11763         * sparc.cc (Target_sparc::sparc_info): Same.
11764         * target.h (Target::attributes_section, Target::attributes_vendor,
11765         Target::is_attributes_section, Target::attribute_arg_type,
11766         Target::attributes_order): New method definitions.
11767         (Target::Target_info::attributes_section,
11768         Target::Target_info::attributes_vendor): New fields.
11769         (Target::do_attribute_arg_type, Target::do_attributes_order): New
11770         virtual method definitions.
11771         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
11772         attributes_section and attributes_vendor.
11773         * testsuite/testfile.cc (Target_test::test_target_info): Same.
11774
11775 2009-12-05  Doug Kwan  <dougkwan@google.com>
11776
11777         * arm.cc: Update comments about interworking and stub generation.
11778         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
11779         considered as non-PIC.
11780         (Arm_relocate_functions::base_abs): Fix formatting.
11781         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
11782         of function to use GOT entry address instead of offset.
11783         (Target_arm::Scan::global): Issue an error if a symbol would need a
11784         PLT does not get one because it is untyped.  Remove code to create
11785         dynamic symbols for relative branches.
11786         (Target_arm::Relocate::relocate: Use 0 instead of false since function
11787         takes unsigned integer instead of boolean.
11788
11789 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
11790
11791         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
11792         (two_file_test_LDADD): Likewise.
11793         (common_test_1_LDADD): Likewise.
11794         (exception_test_LDADD) Likewise.
11795         (weak_test_LDADD): Likewise.
11796         (many_sections_test_LDADD): Likewise.
11797         (initpri1_LDADD): Likewise.
11798         (script_test_1_LDADD): Likewise.
11799         (script_test_2_LDADD): Likewise.
11800         (justsyms_LDADD): Likewise.
11801         (binary_test_LDADD): Likewise.
11802         (large_LDADD): Likewise.
11803         * testsuite/Makefile.in: Regenerated.
11804
11805 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
11806
11807         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
11808         (Symbol_table::override_with_special): Likewise.
11809         (Symbol_table::add_from_object): Likewise.
11810
11811 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
11812
11813         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11814         Don't set the data_offset twice.
11815
11816 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
11817
11818         * testsuite/Makefile.in: Regenerate.
11819
11820 2009-12-03  Doug Kwan  <dougkwan@google.com>
11821
11822         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
11823         (Target_arm::do_finalize_sections): Add parameter for symbol table
11824         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
11825         * i386.cc (Target_i386::do_finalize_sections): Add an additional
11826         parameter for symbol table pointer.
11827         * layout.cc (Layout::finalize): Call Target::finalize_sections with
11828         an additional parameter for a pointer to symbol table.
11829         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
11830         parameter for a symbol table pointer.
11831         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
11832         * target.h (Target::finalize_sections, Target::do_finalize_sections):
11833         Ditto.
11834         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
11835         parameter for a symbol table pointer.
11836
11837 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
11838
11839         * incremental.cc (Incremental_inputs_header)
11840         (Incremental_inputs_header_write, Incremental_inputs_entry)
11841         (Incremental_inputs_entry_write): Move ...
11842         * incremental.h (Incremental_inputs_header)
11843         (Incremental_inputs_header_write, Incremental_inputs_entry)
11844         (Incremental_inputs_entry_write): here.
11845
11846 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11847
11848         * incremental.cc (make_sized_incremental_binary): Set the target.
11849         Error if it is incompatible.
11850         * output.h (Output_file): Add filename method.
11851
11852 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11853
11854         * incremental.cc (Incremental_inputs_entry): Remove unused argument
11855         from the get_* methods.
11856
11857 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11858
11859         * incremental-dump.cc (main): Check that the offeset of a script is 0.
11860         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11861         Write 0 for the data_offset of scripts.
11862
11863 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11864
11865         * testsuite/Makefile.am: Add the incremental_test.sh test.
11866         * testsuite/incremental_test.sh: New.
11867         * testsuite/incremental_test_1.c: New.
11868         * testsuite/incremental_test_2.c: New.
11869
11870 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
11871
11872         * incremental-dump.cc (main): Fix typos.
11873
11874 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
11875
11876         PR gold/11025
11877         * incremental-dump.cc (main): Use llu to print 64 bit values.
11878
11879 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
11880             H.J. Lu  <hongjiu.lu@intel.com>
11881
11882         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
11883         $(LIBDL).
11884         (incremental_dump_LDADD): Likewise.
11885         * Makefile.in: Regenerated.
11886
11887 2009-11-25  Doug Kwan  <dougkwan@google.com>
11888
11889         Revert:
11890
11891         2009-11-25  Doug Kwan  <dougkwan@google.com>
11892
11893                 * arm.cc (Target_arm::Target_arm): Move method definition
11894                 outside of class definition.  Add code to handle
11895                 --target1-rel, --target1-abs and --target2= options.
11896                 (Target_arm::get_reloc_reloc_type): Change method to be
11897                 non-static and const.
11898                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
11899                 New data member declaration.
11900                 (Target_arm::Scan::local, Target_arm::Scan::global,
11901                 Target_arm::Relocate::relocate,
11902                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11903                 Adjust call to Target_arm::get_real_reloc_type.
11904                 (Target_arm::get_real_reloc_type): Use command line options
11905                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11906                 * options.h (--target1-rel, --target1-abs, --target2): New
11907                 ARM-only options.
11908
11909 2009-11-25  Doug Kwan  <dougkwan@google.com>
11910
11911         * arm.cc (Target_arm::Target_arm): Move method definition outside of
11912         class definition.  Add code to handle --target1-rel, --target1-abs
11913         and --target2= options.
11914         (Target_arm::get_reloc_reloc_type): Change method to be non-static
11915         and const.
11916         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
11917         member declaration.
11918         (Target_arm::Scan::local, Target_arm::Scan::global,
11919         Target_arm::Relocate::relocate,
11920         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
11921         call to Target_arm::get_real_reloc_type.
11922         (Target_arm::get_real_reloc_type): Use command line options to
11923         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11924         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
11925         options.
11926
11927 2009-11-25  Doug Kwan  <dougkwan@google.com>
11928
11929         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
11930         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
11931         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
11932         formatting.
11933         (Arm_relocate_functions::thm_call): Replace body with a call to
11934         Arm_relocate_functions::thumb_branch_common.
11935         (Arm_relocate_functions::thm_jump24,
11936         Arm_relocate_functions::thm_xpc22): New method definitions.
11937         (Arm_relocate_functions::thumb_branch_common): New method definition.
11938         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
11939         operator.
11940         (Target_arm::Relocate::relocate): Adjust call to thm_call.
11941         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
11942
11943 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11944
11945         * Makefile.am: Build incremental-dump
11946         * Makefile.in: Regenerate.
11947         * incremental-dump.cc: New.
11948         * incremental.cc (Incremental_inputs_header_data,
11949         Incremental_inputs_entry_data): Move to incremental.h
11950         * incremental.h: (Incremental_inputs_header_data,
11951         Incremental_inputs_entry_data): Move from incremental.cc
11952
11953 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11954
11955         * incremental.cc (Incremental_inputs_header,
11956         Incremental_inputs_header_write, Incremental_inputs_entry,
11957         Incremental_inputs_entry_write): Add a typedef with the data type.
11958
11959 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11960
11961         * incremental.cc (Incremental_inputs_header,
11962         Incremental_inputs_header_write, Incremental_inputs_entry,
11963         Incremental_inputs_entry_write): Update comment about which
11964         type has the filed descriptions.
11965
11966 2009-11-15  Doug Kwan  <dougkwan@google.com>
11967
11968         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11969         (Arm_relocate_functions::arm_branch_common): Change method defintion
11970         in class definition to a method declaration and update list of formal
11971         parameters.
11972         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11973         Arm_relocation_functions::jump24): Adjust call to
11974         Arm_relocate_functions::arm_branch_common.  Update list of formal
11975         parameters.
11976         (Arm_relocate_functions::xpc25): New method definition.
11977         (Arm_relocate_functions::arm_branch_common): Move method defintion
11978         out from class definition.  Use stubs for mode-switching and extending
11979         branch ranges.
11980         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11981         specially.  Change code to enable use of stubs in ARM branches.
11982
11983 2009-11-10  Doug Kwan  <dougkwan@google.com>
11984
11985         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11986         in method declaration.
11987         (Target_arm::relocate_stub): New method declaration.
11988         (Target_arm::default_target): Change to return a pointer instead of
11989         a const reference.
11990         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11991         Target_arm::default_target.
11992         (Arm_Relobj::do_relocate_sections): Remove options paramater in
11993         method definition.
11994         (Target_arm::relocate_section): Adjust view.
11995         (Target_arm::relocate_stub): New method definition.
11996
11997 2009-11-10  Doug Kwan  <dougkwan@google.com>
11998
11999         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
12000         a format warning.
12001         * incremental.cc (open_incremental_binary): Initialized local
12002         variables to avoid warnings.
12003         * object.cc (make_elf_object): Ditto.
12004         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
12005         a format warning.
12006
12007 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
12008
12009         PR gold/10930
12010         * testsuite/plugin_test.c: Include "config.h".
12011
12012 2009-11-09  Doug Kwan  <dougkwan@google.com>
12013
12014         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
12015         (arm_symbol_value): Remove.
12016         (Arm_relocate_functions::arm_branch_common,
12017         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
12018         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
12019         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
12020         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
12021         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
12022         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
12023         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
12024         Arm_relocate_functions::thm_mobw_abs_nc,
12025         Arm_relocate_functions::thm_mov_abs,
12026         Arm_relocate_functions::movw_prel_nc,
12027         Arm_relocate_functions::thm_movt_abs,
12028         Arm_relocate_functions::movt_prel,
12029         Arm_relocate_functions::thm_movw_prel_nc,
12030         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
12031         (Target_arm::Relocate::relocate): Only decompose address into two
12032         parts if relocation type uses the thumb-bit and pass the actual
12033         bit instead of a flag indicating that the thumb-bit is used.  Adjust
12034         calls to methods in Arm_relocate_functions for this change.
12035
12036 2009-11-08  Ian Lance Taylor  <iant@google.com>
12037
12038         PR 10925
12039         * reloc.cc: Instantiate
12040         Sized_relobj::initialize_input_to_output_maps and
12041         Sized_relobj:free_input_to_output_maps.
12042
12043 2009-11-06  Ian Lance Taylor  <iant@google.com>
12044
12045         PR 10876
12046         * defstd.cc (in_segment): Set only_if_ref true for "end".
12047
12048 2009-11-06  Doug Kwan  <dougkwan@google.com>
12049
12050         * arm.cc (class Reloc_stub): Correct a comment.
12051         (Target_arm::Target_arm): Initialize arm_input_section_map_.
12052         (Target_arm::scan_section_for_stubs): New method declaration.
12053         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
12054         Change methods from private to protected.
12055         (Target_arm::do_may_relax): New method definition.
12056         (Target_arm::do_relax, Target_arm::group_sections,
12057         Target_arm::scan_reloc_for_stub,
12058         Target_arm::scan_reloc_section_for_stubs): New method declarations.
12059         (Target_arm::arm_input_section_map_): New data member declaration.
12060         (Target_arm::scan_reloc_for_stub,
12061         Target_arm::scan_reloc_section_for_stubs,
12062         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
12063         Target_arm::do_relax): New method definitions.
12064
12065 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
12066
12067         * configure.ac: Check for (struct stat)::st_mtim
12068         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
12069         * config.in: Regenerate.
12070         * configure: Regenerate.
12071
12072 2009-11-05  Ian Lance Taylor  <iant@google.com>
12073
12074         PR 10910
12075         * output.cc (Output_segment::add_output_section): Add missing
12076         return statement.
12077
12078 2009-11-04  Ian Lance Taylor  <iant@google.com>
12079
12080         PR 10880
12081         * object.h (class Object): Add is_needed and set_is_needed
12082         methods.  Add is_needed_ field.  Make bool fields into bitfields.
12083         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
12084         defined in a dynamic object and referenced by a regular object,
12085         set is_needed for the dynamic object.
12086         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
12087         if the file is marked with as_needed and it is not needed.
12088
12089 2009-11-04  Ian Lance Taylor  <iant@google.com>
12090
12091         PR 10887
12092         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
12093         tags if data is discarded by linker script.
12094         * i386.cc (Target_i386::do_finalize_sections): Likewise.
12095         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
12096         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
12097         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
12098
12099 2009-11-04  Ian Lance Taylor  <iant@google.com>
12100
12101         * layout.cc (Layout::get_output_section): Add is_interp and
12102         is_dynamic_linker_section parameters.  Change all callers.
12103         (Layout::choose_output_section): Likewise.
12104         (Layout::make_output_section): Likewise.
12105         (Layout::add_output_section_data): Add is_dynamic_linker_section
12106         parameter.  Change all callers.
12107         * layout.h (class Layout): Update declarations.
12108         * output.h (class Output_section): Add is_interp, set_is_interp,
12109         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
12110         Add is_interp_, is_dynamic_linker_section_ fields.  Change
12111         generate_code_fills_at_write_ to a bitfield.
12112         * output.cc (Output_section::Output_sections): Initialize new
12113         fields.
12114         (Output_segment::add_output_section): Add do_sort parameter.
12115         Change all callers.
12116
12117 2009-11-03  Ian Lance Taylor  <iant@google.com>
12118
12119         PR 10860
12120         * options.h (class General_options): Add --warn-common.
12121         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
12122         merging two common symbols.
12123         (Symbol_table::should_override): Handle --warn-common when merging
12124         a common symbol with a defined symbol.  Use report_resolve_problem
12125         for multiple definitions.
12126         (Symbol_table::report_resolve_problem): New function.
12127         * symtab.h (class Symbol_table): Declare report_resolve_problem.
12128
12129 2009-11-03  Doug Kwan  <dougkwan@google.com>
12130
12131         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
12132         stub_factory_.
12133         (Target_arm::stub_factory): New method definition.
12134         (Target_arm::new_arm_input_section,
12135         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
12136         Target_arm::reloc_uses_thumb_bit): New method declarations.
12137         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
12138         New type definitions.
12139         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
12140         member declarations.
12141         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
12142         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
12143         New method definitions.
12144
12145 2009-11-03  Ian Lance Taylor  <iant@google.com>
12146
12147         * options.h (class General_options): Add --warn_constructors.
12148
12149 2009-11-03  Ian Lance Taylor  <iant@google.com>
12150
12151         PR 10893
12152         * defstd.cc (in_section): Add entries for __rel_iplt_start,
12153         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
12154
12155 2009-11-03  Ian Lance Taylor  <iant@google.com>
12156
12157         PR 10895
12158         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
12159         --msgid-bugs-address.
12160         (install-pdf): New target.
12161         (install-data_yes): Look up one directory to find mkinstalldirs.
12162
12163 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
12164
12165         * po/Make-in (.po.gmo): Don't generate .gmo files in source
12166         tree.
12167
12168 2009-10-30  Doug Kwan  <dougkwan@google.com>
12169
12170         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
12171
12172 2009-10-30  Doug Kwan  <dougkwan@google.com>
12173
12174         * arm.cc (Stub_addend_reader): New struct template definition
12175         and partial specializations.
12176         (Stub_addend_reader::operator()): New method definition for a
12177         partially specialized template.
12178
12179 2009-10-30  Doug Kwan  <dougkwan@google.com>
12180
12181         * arm.cc (Arm_relobj::processor_specific_flags): New method
12182         definition.
12183         (Arm_relobj::do_read_symbols): New method declaration.
12184         (Arm_relobj::processor_specific_flags_): New data member declaration.
12185         (Arm_dynobj): New class definition.
12186         (Target_arm::do_finalize_sections): Add input_objects parameter.
12187         (Target_arm::do_adjust_elf_header): New method declaration.
12188         (Target_arm::are_eabi_versions_compatible,
12189         (Target_arm::merge_processor_specific_flags): New method declaration.
12190         (Target_arm::do_make_elf_object): New overloaded method definitions
12191         and declaration.
12192         (Arm_relobj::do_read_symbols): New method definition.
12193         (Arm_dynobj::do_read_symbols): Ditto.
12194         (Target_arm::do_finalize_sections): Add input_objects parameters.
12195         Merge processor-specific flags from all input objects.
12196         (Target_arm::are_eabi_versions_compatible,
12197         Target_arm::merge_processor_specific_flags,
12198         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
12199         New method definitions.
12200         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
12201         Input_objects pointer type parameter.
12202         * layout.cc (Layout::finalize): Pass input objects to target's.
12203         finalize_sections function.
12204         * output.cc (Output_file_header::do_sized_write): Set ELF file
12205         header's processor-specific flags.
12206         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
12207         Input_objects pointer type parameter.
12208         * sparc.cc (Target_sparc::do_finalize_sections): Same.
12209         * target.h (Input_objects): New forward class declaration.
12210         (Target::processor_specific_flags,
12211         Target::are_processor_specific_flags_sect): New method definitions.
12212         (Target::finalize_sections): Add input_objects parameter.
12213         (Target::Target): Initialize processor_specific_flags_ and
12214         are_processor_specific_flags_set_.
12215         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
12216         parameter.
12217         (Target::set_processor_specific_flags): New method definition.
12218         (Target::processor_specific_flags_,
12219         Target::are_processor_specific_flags_set_): New data member
12220         declarations.
12221         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
12222         Input_objects pointer type parameter.
12223
12224 2009-10-30  Doug Kwan  <dougkwan@google.com>
12225
12226         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
12227
12228 2009-10-28  Ian Lance Taylor  <iant@google.com>
12229
12230         * object.h (class Relobj): Drop options parameter from
12231         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
12232         do_scan_relocs, do_relocate.  Change all callers.
12233         (class Sized_relobj): Drop options parameters from
12234         do_gc_process_relocs, do_scan_relocs, do_relocate,
12235         do_relocate_sections, relocate_sections, emit_relocs_scan,
12236         emit_relocs_scan_reltype.  Change all callers.
12237         (struct Relocate_info): Remove options field and all references to
12238         it.
12239         * reloc.h (class Read_relocs): Remove options constructor
12240         parameter and options_ field.  Change all callers.
12241         (class Gc_process_relocs, class Scan_relocs): Likewise.
12242         (class Relocate_task): Likewise.
12243         * target-reloc.h (scan_relocs): Remove options parameter.  Change
12244         all callers.
12245         (scan_relocatable_relocs): Likewise.
12246         * target.h (class Sized_target): Remove options parameter from
12247         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
12248         all callers.
12249         * gc.h (gc_process_relocs): Remove options parameter.  Change all
12250         callers.
12251         * arm.cc: Update functions to remove options parameters.
12252         * i386.cc: Likewise.
12253         * powerpc.cc: Likewise.
12254         * sparc.cc: Likewise.
12255         * x86_64.cc: Likewise.
12256         * testsuite/testfile.cc: Likewise.
12257
12258 2009-10-28  Doug Kwan  <dougkwan@google.com>
12259
12260         * arm.cc (Arm_relobj): New class definition.
12261         (Arm_relobj::scan_sections_for_stubs,
12262         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
12263         New method definitions.
12264
12265 2009-10-28  Cary Coutant  <ccoutant@google.com>
12266
12267         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
12268         (Plugin::cleanup_done_): New member.
12269         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
12270         (Plugin_manager::cleanup_done_): Remove.
12271         (Plugin_manager::add_input_file): Edit error message.
12272         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
12273         (Plugin_manager::cleanup): Remove use of cleanup_done_.
12274
12275 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
12276
12277         * fileread.cc: (File_read::View::~View): Use the new
12278         data_ownership_ filed.
12279         (File_read::~File_read): Dispose the new whole_file_view_.
12280         (File_read::open): Mmap the whole file if needed.
12281         (File_read::open): Use whole_file_view_ instead of contents_.
12282         (File_read::find_view): Use whole_file_view_ if applicable.
12283         (File_read::do_read): Use whole_file_view_ instead of contents_.
12284         (File_read::make_view): Use whole_file_view_ instead of contents_,
12285         update File_read::View::View call.
12286         (File_read::find_or_make_view): Update File_read::View::View
12287         call.
12288         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
12289         remove contents_
12290         (File_read::View::Data_ownership): New enum.
12291         (File_read::View::View): Replace bool mapped_ with Data_ownership
12292         argument.
12293         (File_read::View::mapped_): Remove (replaced by data_ownership_).
12294         (File_read::View::data_ownership_): New field.
12295         (File_read::contents_): Remove (replaced by whole_file_view_).
12296         (File_read::whole_file_view_): New field.
12297         * options.h (class General_options): Add --keep-files-mapped.
12298
12299 2009-10-27  Cary Coutant  <ccoutant@google.com>
12300
12301         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
12302         * testsuite/Makefile.am (plugin_test_5): New test case.
12303         * testsuite/Makefile.in: Regenerate.
12304
12305 2009-10-25  Doug Kwan  <dougkwan@google.com>
12306
12307         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
12308         from private to protected to allow access by child class.
12309         (Sized_relobj::do_relocate_sections): New method declaration.
12310         (Sized_relobj::relocate_sections): Virtualize.
12311         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
12312         Sized_relobj::relocate_sections.  Instantiate template explicitly
12313         for different target sizes and endianity.
12314
12315 2009-10-24  Doug Kwan  <dougkwan@google.com>
12316
12317         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
12318         (Arm_input_section::as_arm_input_section): New method.
12319         (Arm_output_section): New class definition.
12320         (Arm_output_section::create_stub_group,
12321         Arm_output_section::group_sections): New method definitions.
12322
12323 2009-10-22  Doug Kwan  <dougkwan@google.com>
12324
12325         * arm.cc (Arm_input_section): New class definition.
12326         (Arm_input_section::init, Arm_input_section:do_write,
12327         Arm_input_section::set_final_data_size,
12328         Arm_input_section::do_reset_address_and_file_offset): New method
12329         definitions.
12330
12331 2009-10-21  Doug Kwan  <dougkwan@google.com>
12332
12333         * arm.cc (Stub_table, Arm_input_section): New forward class
12334         declarations.
12335         (Stub_table): New class defintion.
12336         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
12337         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
12338         New method definition.
12339
12340 2009-10-21  Doug Kwan  <dougkwan@google.com>
12341
12342         * arm.cc: Update copyright comments.
12343         (Target_arm): New forward class template declaration.
12344         (Arm_address): New type.
12345         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
12346         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
12347         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
12348         constants.
12349         (Insn_template): Same.
12350         (DEF_STUBS): New macro.
12351         (Stub_type): New enum type.
12352         (Stub_template): New class definition.
12353         (Stub): Same.
12354         (Reloc_stub): Same.
12355         (Stub_factory): Same.
12356         (Target_arm::Target_arm): Initialize may_use_blx_ and
12357         should_force_pic_veneer_.
12358         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
12359         Target_arm::should_force_pic_veneer,
12360         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
12361         Target_arm::using_thumb_only, Target_arm:;default_target): New
12362         method defintions.
12363         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
12364         New data member declarations.
12365         (Insn_template::size, Insn_template::alignment): New method defintions.
12366         (Stub_template::Stub_template): New method definition.
12367         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
12368         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
12369         (Stub_factory::Stub_factory): New method definition.
12370         * gold.h (string_hash): New template.
12371         * output.h (Input_section_specifier::hash_value): Use
12372         gold::string_hash.
12373         (Input_section_specifier::string_hash): Remove.
12374         * stringpool.cc (Stringpool_template::string_hash): Use
12375         gold::string_hash.
12376
12377 2009-10-20  Doug Kwan  <dougkwan@google.com>
12378
12379         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
12380         symbols of relaxed input sections.
12381         * output.h (Output_section::find_relaxed_input_section): Make
12382         method public.
12383
12384 2009-10-16  Doug Kwan  <dougkwan@google.com>
12385
12386         * dynobj.cc (Versions::Versions): Initialize version_script_.
12387         Only insert base version symbol definition for a shared object
12388         if version script defines any version versions.
12389         (Versions::define_base_version): New method definition.
12390         (Versions::add_def): Check that base version is not needed.
12391         (Versions::add_need): Define base version lazily.
12392         * dynobj.h (Versions::define_base_version): New method declaration.
12393         (Versions::needs_base_version_): New data member declaration.
12394         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
12395         (check_DATA): Add no_version_test.stdout.
12396         (libno_version_test.so, no_version_test.o no_version_test.stdout):
12397         New make rules.
12398         * testsuite/Makefile.in: Regenerate.
12399         * testsuite/no_version_test.c: New file.
12400         * testsuite/no_version_test.sh: Ditto.
12401
12402 2009-10-16  Doug Kwan  <dougkwan@google.com>
12403
12404         * expression.cc (class Segment_start_expression): New class definition.
12405         (Segment_start_expression::value): New method definition.
12406         (script_exp_function_segment_start): Return a new
12407         Segment_start_expression.
12408         * gold/script-c.h (script_saw_segment_start_expression): New function
12409         prototype.
12410         * script-sections.cc (Script_sections::Script_sections): Initialize
12411         SAW_SEGMENT_START_EXPRESSION_ to false.
12412         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
12413         and -Tbbs options to specify section addresses if given in
12414         command line and no SEGMENT_START expression is seen in a script.
12415         * script-sections.h (Script_sections::saw_segment_start_expression,
12416         Script_sections::set_saw_segment_start_expression): New method
12417         definition.
12418         (Script_sections::saw_segment_start_expression_): New data member
12419         declaration.
12420         * script.cc (script_saw_segment_start_expression): New function.
12421         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
12422         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
12423         script_test_7.sh and script_test_8.sh.
12424         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
12425         script_test_8.stdout.
12426         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
12427         (script_test_6, script_test_6.stdout, script_test_7,
12428         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
12429         * Makefile.in: Regenerate.
12430         * testsuite/script_test_6.sh: New file.
12431         * testsuite/script_test_6.t: Same.
12432         * testsuite/script_test_7.sh: Same.
12433         * testsuite/script_test_7.t: Same.
12434         * testsuite/script_test_8.sh: Same.
12435
12436 2009-10-16  Doug Kwan  <dougkwan@google.com>
12437
12438         * output.cc (Output_segment::set_section_list_address): Cast
12439         expressions to unsigned long long type to avoid format warnings.
12440
12441 2009-10-15  Ian Lance Taylor  <iant@google.com>
12442
12443         * script.cc (Script_options::add_symbol_assignment): Always add a
12444         dot assignment to script_sections_.
12445         * script-sections.cc (Script_sections::add_dot_assignment):
12446         Initialize if necessary.
12447
12448         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
12449         program headers with no load segment if there is a linker script.
12450
12451         * layout.cc (Layout::set_segment_offsets): Align the file offset
12452         to the segment aligment for -N or -n with no load segment.
12453         * output.cc (Output_segment::add_output_section): Don't crash if
12454         the first section is a TLS section.
12455         (Output_segment::set_section_list_addresses): Print an error
12456         message if the address moves backward in a linker script.
12457         * script-sections.cc
12458         (Output_section_element_input::set_section_addresses): Don't
12459         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
12460         (Orphan_output_section::set_section_addresses): Likewise.
12461
12462 2009-10-15  Doug Kwan  <dougkwan@google.com>
12463
12464         * layout.cc (Layout::finish_dynamic_section): Generate tags
12465         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
12466         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
12467         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
12468
12469 2009-10-14  Ian Lance Taylor  <iant@google.com>
12470
12471         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
12472         fields.
12473         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
12474         data_shdr fields of relinfo.
12475         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
12476         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
12477         R_386_TLS_LDO_32, adjust based on section flags.
12478         (Target_i386::Relocate::fix_up_ldo): Remove.
12479
12480 2009-10-13  Ian Lance Taylor  <iant@google.com>
12481
12482         Add support for -pie.
12483         * options.h (class General_options): Add -pie and
12484         --pic-executable.
12485         (General_options::output_is_position_independent): Test -pie.
12486         (General_options::output_is_executable): Return true if not shared
12487         and not relocatable.
12488         (General_options::output_is_pie): Remove.
12489         * options.cc (General_options::finalize): Reject incompatible uses
12490         of -pie.
12491         * gold.cc (queue_middle_tasks): A -pie link is not static.
12492         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
12493         * symtab.cc (Symbol::final_value_is_known): Return false if
12494         output_is_position_independent.
12495         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
12496         output_is_position_independent.
12497         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
12498         output_is_position_independent.
12499         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
12500         output_is_position_independent.
12501         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
12502         two_file_pie_test.
12503         (basic_pie_test.o, basic_pie_test): New targets.
12504         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
12505         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
12506         (two_file_pie_test): New target.
12507         * testsuite/Makefile.in: Rebuild.
12508         * README: Remove note saying that -pie is not supported.
12509
12510 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
12511
12512         * options.h (class General_options): Add -init and -fini.
12513         * layout.cc (Layout::finish_dynamic_section): Emit
12514         given init and fini functions.
12515
12516 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
12517
12518         * gc.h (gc_process_relocs): Check if icf is enabled using new
12519         function.
12520         * gold.cc (queue_initial_tasks): Likewise.
12521         (queue_middle_tasks): Likewise.
12522         * object.cc (do_layout): Likewise.
12523         * symtab.cc (is_section_folded): Likewise.
12524         * main.cc (main): Likewise.
12525         * reloc.cc (Read_relocs::run): Likewise.
12526         (Sized_relobj::do_scan_relocs): Likewise.
12527         * icf.cc (is_function_ctor_or_dtor): New function.
12528         (Icf::find_identical_sections): Check if function is ctor or dtor when
12529         safe icf is chosen.
12530         * options.h (General_options::icf): Change option to be an enum.
12531         (Icf_status): New enum.
12532         (icf_enabled): New method.
12533         (icf_safe_folding): New method.
12534         (set_icf_status): New method.
12535         (icf_status_): New variable.
12536         * (options.cc) (General_options::finalize): Set icf_status_.
12537         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
12538         icf_test and icf_keep_unique_test to use the --icf enum flag.
12539         * testsuite/icf_safe_test.sh: New file.
12540         * testsuite/icf_safe_test.cc: New file.
12541
12542 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
12543
12544         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
12545         includes to gc.h and icf.h.
12546         * arm.cc: Include gc.h.
12547         * gold.cc: Likewise.
12548         * i386.cc: Likewise.
12549         * powerpc.cc: Likewise.
12550         * sparc.cc: Likewise.
12551         * x86_64.cc: Likewise.
12552         * gc.h: Include icf.h.
12553
12554 2009-10-11  Ian Lance Taylor  <iant@google.com>
12555
12556         * plugin.cc: Include "gold.h" before other header files.
12557
12558 2009-10-10  Chris Demetriou  <cgd@google.com>
12559
12560         * options.h (Input_file_argument::Input_file_type): New enum.
12561         (Input_file_argument::is_lib_): Replace with...
12562         (Input_file_argument::type_): New member.
12563         (Input_file_argument::Input_file_argument): Take Input_file_type
12564         'type' rather than boolean 'is_lib' as second argument.
12565         (Input_file_argument::is_lib): Use type_.
12566         (Input_file_argument::is_searched_file): New function.
12567         (Input_file_argument::may_need_search): Handle is_searched_file.
12568         * options.cc (General_options::parse_library): Support -l:filename.
12569         (General_options::parse_just_symbols): Update for Input_file_argument
12570         changes.
12571         (Command_line::process): Likewise.
12572         * archive.cc (Archive::get_file_and_offset): Likewise.
12573         * plugin.cc (Plugin_manager::release_input_file): Likewise.
12574         * script.cc (read_script_file, script_add_file): Likewise.
12575         * fileread.cc (Input_file::Input_file): Likewise.
12576         (Input_file::will_search_for): Handle is_searched_file.
12577         (Input_file::open): Likewise.
12578         * readsyms.cc (Read_symbols::get_name): Likewise.
12579         * testsuite/Makefile.am (searched_file_test): New test.
12580         * testsuite/Makefile.in: Regenerate.
12581         * testsuite/searched_file_test.cc: New file.
12582         * testsuite/searched_file_test_lib.cc: New file.
12583
12584 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12585             Ian Lance Taylor  <iant@google.com>
12586
12587         * descriptor.cc: Include <cstdio> and "binary-io.h".
12588         (Descriptors::open): Open the files in binary mode always.
12589         * script.cc (Lex::get_token): Treat \r as whitespace.
12590
12591 2009-10-09  Ian Lance Taylor  <iant@google.com>
12592
12593         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
12594
12595 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12596             Ian Lance Taylor  <iant@google.com>
12597
12598         * configure.ac: Check for readv function also.
12599         * fileread.cc (readv): Define if not HAVE_READV.
12600         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
12601         does not exist.
12602         * config.in: Regenerate.
12603         * configure: Regenerate.
12604
12605 2009-10-09  Doug Kwan  <dougkwan@google.com>
12606
12607         * layout.cc (Layout::make_output_section): Call target hook to make
12608         ordinary output section.
12609         (Layout::finalize): Adjust parameter list of call the
12610         Target::may_relax().
12611         * layout.h (class Layout::section_list): New method.
12612         * merge.h (Output_merge_base::entsize): Change visibility to public.
12613         (Output_merge_base::is_string, Output_merge_base::do_is_string):
12614         New methods.
12615         (Output_merge_string::do_is_string): New method.
12616         * object.cc (Sized_relobj::do_setup): renamed from
12617         Sized_relobj::set_up.
12618         * object.h (Sized_relobj::adjust_shndx,
12619         Sized_relobj::initializ_input_to_output_maps,
12620         Sized_relobj::free_input_to_output_maps): Change visibilities to
12621         protected.
12622         (Sized_relobj::setup): Virtualize.
12623         (Sized_relobj::do_setup): New method declaration.
12624         (Sized_relobj::invalidate_section_offset,
12625         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
12626         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
12627         * options.cc (parse_int): New function.
12628         * options.h (parse_int): New declaration.
12629         (DEFINE_int): New macro.
12630         (stub_group_size): New option.
12631         * output.cc (Output_section::Output_section): Initialize memebers
12632         merge_section_map_, merge_section_by_properties_map_,
12633         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
12634         (Output_section::add_input_section): Handled deferred code-fill
12635         generation and remove an old comment.
12636         (Output_section::add_relaxed_input_section): New method definition.
12637         (Output_section::add_merge_input_section): Use merge section by
12638         properties map to speed to search.  Update merge section maps
12639         as appropriate.
12640         (Output_section::build_relaxation_map): New method definition.
12641         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
12642         Same.
12643         (Output_section::relax_input_section): Renamed to
12644         Output_section::convert_input_sections_to_relaxed_sections and change
12645         interface to take a vector of pointers to relaxed sections.
12646         (Output_section::find_merge_section,
12647         Output_section::find_relaxed_input_section): New method definitions.
12648         (Output_section::is_input_address_mapped,
12649         Output_section::output_offset, Output_section::output_address):
12650         Use output section data maps to speed up searching.
12651         (Output_section::find_starting_output_address): Add comments.
12652         (Output_section::do_write,
12653         Output_section::write_to_postprocessing_buffer): Do code-fill
12654         generation as appropriate.
12655         (Output_section::get_input_sections): Invalidate relaxed input section
12656         map.
12657         (Output_section::restore_states): Adjust type of checkpoint .
12658         Invalidate relaxed input section map.
12659         * output.h (Output_merge_base): New class declaration.
12660         (Input_section_specifier): New class defintion.
12661         (class Output_relaxed_input_section) Change base class to
12662         Output_section_data_build.
12663         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
12664         base class initializer.
12665         (Output_section::add_relaxed_input_section): New method declaration.
12666         (Output_section::Input_section): Change visibility to protected.
12667         (Output_section::Input_section::relobj,
12668         Output_section::Input_section::shndx): Handle relaxed input sections.
12669         Output_section::input_sections) Change visibility to protected.  Also
12670         define overload to return a non-const pointer.
12671         (Output_section::Merge_section_properties): New class defintion.
12672         (Output_section::Merge_section_by_properties_map,
12673         Output_section::Output_section_data_by_input_section_map,
12674         Output_section::Relaxation_map): New types.
12675         (Output_section::relax_input_section): Rename method to
12676         Output_section::convert_input_sections_to_relaxed_sections and change
12677         interface to take a vector of relaxed section pointers.
12678         (Output_section::find_merge_section,
12679         Output_section::find_relaxed_input_section,
12680         Output_section::build_relaxation_map,
12681         Output_section::convert_input_sections_in_list_to_relaxed_sections):
12682         New method declarations.
12683         (Output_section::merge_section_map_
12684         Output_section::merge_section_by_properties_map_,
12685         Output_section::relaxed_input_section_map_,
12686         Output_section::is_relaxed_input_section_map_valid_,
12687         Output_section::generate_code_fills_at_write_): New data members.
12688         * script-sections.cc
12689         (Output_section_element_input::set_section_addresses): Call
12690         current_data_size and addralign methods of relaxed input sections.
12691         (Orphan_output_section::set_section_addresses): Call current_data_size
12692         and addralign methods of relaxed input sections.
12693         * symtab.cc (Symbol_table::compute_final_value): Extract template
12694         from the body of Symbol_table::sized_finalize_symbol.
12695         (Symbol_table::sized_finalized_symbol): Call
12696         Symbol_table::compute_final_value.
12697         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
12698         (Symbol_table::compute_final_value): New templated method declaration.
12699         * target.cc (Target::do_make_output_section): New method defintion.
12700         * target.h (Target::make_output_section): New method declaration.
12701         (Target::relax): Add more parameters for input objects, symbol table
12702         and layout.  Adjust call to do_relax.
12703         (Target::do_make_output_section): New method declaration.
12704         (Target::do_relax): Add parameters for input objects, symbol table
12705         and layout.
12706
12707 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12708
12709         * pread.c: Include stdio.h.
12710
12711 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12712
12713         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
12714         defined.
12715
12716 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12717
12718         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
12719         Change read_shndx type to unsigned int.
12720         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12721         int.
12722         (Sized_dwarf_line_info::read_line_mappings): Likewise.
12723         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
12724         Change read_shndx type to unsigned int.
12725         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12726         int.
12727         (Sized_dwarf_line_info::read_line_mappings): Likewise.
12728         * layout.cc (Layout::create_symtab_sections): Cast the result of
12729         local_symcount * symsize to off_t in the gold_assert.
12730
12731 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12732
12733         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
12734         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
12735         R_ARM_BASE_ABS.
12736         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
12737         (Arm_relocate_functions::thm_abs5): New function.
12738         (Arm_relocate_functions::abs12): New function.
12739         (Arm_relocate_functions::abs16): New function.
12740         (Arm_relocate_functions::base_abs): New function.
12741         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
12742         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
12743         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
12744         R_ARM_BASE_ABS.
12745         (Scan::global): Likewise.
12746         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
12747         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
12748         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
12749         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
12750         R_ARM_BASE_ABS.
12751
12752 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12753
12754         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
12755         (Arm_relocate_functions::movt_prel): New function.
12756         (Arm_relocate_functions::thm_movw_prel_nc): New function.
12757         (Arm_relocate_functions::thm_movt_prel): New function.
12758         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
12759         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
12760         (Scan::global, Relocate::relocate): Likewise.
12761         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12762
12763 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
12764
12765         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
12766         Incremental_checker.
12767         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
12768         unsigned int.
12769         (class Incremental_inputs_header): New class.
12770         (Incremental_inputs_header_writer): Edit comment.
12771         (Incremental_inputs_entry): New class.
12772         (Incremental_inputs_entry_writer): Edit comment.
12773         (Sized_incremental_binary::do_find_incremental_inputs_section):
12774         Add *strtab_shndx parameter, fill it.
12775         (Sized_incremental_binary::do_check_inputs): New method.
12776         (Incremental_checker::can_incrementally_link_output_file): Use
12777         Sized_incremental_binary::check_inputs.
12778         (Incremental_inputs::report_command_line): Save command line in
12779         command_line_.
12780         * incremental.h:
12781         (Incremental_binary::find_incremental_inputs_section): New
12782         method.
12783         (Incremental_binary::do_find_incremental_inputs_section): Add
12784         strtab_shndx parameter.
12785         (Incremental_binary::do_check_inputs): New pure virtual method.
12786         (Sized_incremental_binary::do_check_inputs): Declare.
12787         (Incremental_checker::Incremental_checker): Add incremental_inputs
12788         parameter, use it to initialize incremental_inputs_.
12789         (Incremental_checker::incremental_inputs_): New field.
12790         (Incremental_checker::command_line): New method.
12791         (Incremental_checker::inputs): New method.
12792         (Incremental_checker::command_line_): New field.
12793
12794 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
12795
12796         * incremental.cc: Include <cstdarg> and "target-select.h".
12797         (vexplain_no_incremental): New function.
12798         (explain_no_incremental): New function.
12799         (Incremental_binary::error): New method.
12800         (Sized_incremental_binary::do_find_incremental_inputs_section): New
12801         method.
12802         (make_sized_incremental_binary): New function.
12803         (open_incremental_binary): New function.
12804         (can_incrementally_link_file): Add checks if output is ELF and has
12805         inputs section.
12806         * incremental.h: Include "elfcpp_file.h" and "output.h".
12807         (Incremental_binary): New class.
12808         (Sized_incremental_binary): New class.
12809         (open_incremental_binary): Declare.
12810         * object.cc (is_elf_object): Use
12811         elfcpp::Elf_recognizer::is_elf_file.
12812         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
12813         * output.h (Output_file::filesize): New method.
12814
12815 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12816
12817         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
12818         New function.
12819         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
12820         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
12821         function.
12822         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
12823         function.
12824         (Arm_relocate_functions::movw_abs_nc): New function.
12825         (Arm_relocate_functions::movt_abs): New function.
12826         (Arm_relocate_functions::thm_movw_abs_nc): New function.
12827         (Arm_relocate_functions::thm_movt_abs): New function.
12828         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
12829         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
12830         (Scan::global): Likewise.
12831         (Relocate::relocate): Likewise.
12832         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12833
12834 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12835
12836         * arm.cc (Arm_relocate_functions::got_prel) New function.
12837         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
12838         (Relocate::relocate): Likewise.
12839         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12840
12841 2009-10-06  Ian Lance Taylor  <iant@google.com>
12842
12843         * options.h (class General_options): Define
12844         split_stack_adjust_size parameter.
12845         * object.h (class Object): Add uses_split_stack_ and
12846         has_no_split_stack_ fields.  Add uses_split_stack and
12847         has_no_split_stack accessor functions.  Declare
12848         handle_split_stack_section.
12849         (class Reloc_symbol_changes): Define.
12850         (class Sized_relobj): Define Function_offsets.  Declare
12851         split_stack_adjust, split_stack_adjust_reltype, and
12852         find_functions.
12853         * object.cc (Object::handle_split_stack_section): New function.
12854         (Sized_relobj::do_layout): Call handle_split_stack_section.
12855         * dynobj.cc (Sized_dynobj::do_layout): Call
12856         handle_split_stack_section.
12857         * reloc.cc (Sized_relobj::relocate_sections): Call
12858         split_stack_adjust for executable sections in split_stack
12859         objects.  Pass reloc_map to relocate_section.
12860         (Sized_relobj::split_stack_adjust): New function.
12861         (Sized_relobj::split_stack_adjust_reltype): New function.
12862         (Sized_relobj::find_functions): New function.
12863         * target-reloc.h: Include "object.h".
12864         (relocate_section): Add reloc_symbol_changes parameter.  Change
12865         all callers.
12866         * target.h (class Target): Add calls_non_split method.  Declare
12867         do_calls_non_split virtual method.  Declare match_view and
12868         set_view_to_nop.
12869         * target.cc: Include "elfcpp.h".
12870         (Target::do_calls_non_split): New function.
12871         (Target::match_view): New function.
12872         (Target::set_view_to_nop): New function.
12873         * gold.cc (queue_middle_tasks): Give an error if mixing
12874         split-stack and non-split-stack objects with -r.
12875         * i386.cc (Target_i386::relocate_section): Add
12876         reloc_symbol_changes parameter.
12877         (Target_i386::do_calls_non_split): New function.
12878         * x86_64.cc (Target_x86_64::relocate_section): Add
12879         reloc_symbol_changes parameter.
12880         (Target_x86_64::do_calls_non_split): New function.
12881         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
12882         parameter.
12883         * powerpc.cc (Target_powerpc::relocate_section): Add
12884         reloc_symbol_changes parameter.
12885         * sparc.cc (Target_sparc::relocate_section): Add
12886         reloc_symbol_changes parameter.
12887         * configure.ac: Call AM_CONDITIONAL for the default target.
12888         * configure: Rebuild.
12889         * testsuite/Makefile.am (TEST_AS): New variable.
12890         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
12891         (check_DATA): Add split_i386 and split_x86_64 files.
12892         (SPLIT_DEFSYMS): Define.
12893         (split_i386_[1234n].o): New targets.
12894         (split_i386_[124]): New targets.
12895         (split_i386_[1234r].stdout): New targets.
12896         (split_x86_64_[1234n].o): New targets.
12897         (split_x86_64_[124]): New targets.
12898         (split_x86_64_[1234r].stdout): New targets.
12899         (MOSTLYCLEANFILES): Add new executables.
12900         * testsuite/split_i386.sh: New file.
12901         * testsuite/split_x86_64.sh: New file.
12902         * testsuite/split_i386_1.s: New file.
12903         * testsuite/split_i386_2.s: New file.
12904         * testsuite/split_i386_3.s: New file.
12905         * testsuite/split_i386_4.s: New file.
12906         * testsuite/split_i386_n.s: New file.
12907         * testsuite/split_x86_64_1.s: New file.
12908         * testsuite/split_x86_64_2.s: New file.
12909         * testsuite/split_x86_64_3.s: New file.
12910         * testsuite/split_x86_64_4.s: New file.
12911         * testsuite/split_x86_64_n.s: New file.
12912         * testsuite/testfile.cc (Target_test): Update relocation_section
12913         function.
12914         * testsuite/Makefile.in: Rebuild.
12915
12916 2009-10-06  Ian Lance Taylor  <iant@google.com>
12917
12918         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
12919         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
12920         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
12921         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
12922         the address on ldo_addrs_.
12923         (Target_i386::Relocate::fix_up_ldo): New function.
12924
12925 2009-10-06   Rafael Espindola  <espindola@google.com>
12926
12927         * plugin.cc (add_input_library): New.
12928         (Plugin::load): Add add_input_library to tv.
12929         (Plugin_manager::add_input_file): Add the is_lib argument.
12930         (add_input_file): Update call to Plugin_manager::add_input_file.
12931         (add_input_library): New.
12932         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
12933
12934 2009-09-30  Doug Kwan  <dougkwan@google.com>
12935
12936         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
12937         symbol and call Symbol::may_need_copy_reloc to determine if
12938         a copy reloc is needed.
12939         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12940         nocopyreloc is given in command line.
12941         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12942         given in command line.
12943         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12944         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
12945         of the removed Target_i386::may_need_copy_reloc.
12946         * options.h (copyreloc): New option with default value false.
12947         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12948         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12949         instead of the removed Target_powerpc::may_need_copy_reloc.
12950         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12951         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
12952         instead of the removed Target_sparc::may_need_copy_reloc.
12953         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
12954         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
12955         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12956         instead of the removed Target_x86_64::may_need_copy_reloc.
12957
12958 2009-09-30  Ian Lance Taylor  <iant@google.com>
12959
12960         * object.h (class Object): Remove target_ field, and target,
12961         sized_target, and set_target methods.
12962         (Object::sized_target): Remove.
12963         (class Sized_relobj): Update declarations.  Remove sized_target.
12964         * object.cc (Sized_relobj::setup): Remove target parameter.
12965         Change all callers.
12966         (Input_objects::add_object): Don't do anything with the target.
12967         (make_elf_sized_object): Add punconfigured parameter.  Change all
12968         callers.  Set or test parameter target.
12969         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12970         Change all callers.
12971         * parameters.cc (Parameters::set_target): Change parameter type to
12972         be non-const.
12973         (Parameters::default_target): Remove.
12974         (set_parameters_target): Change parameter type to be non-const.
12975         (parameters_force_valid_target): New function.
12976         (parameters_clear_target): New function.
12977         * parameters.h (class Parameters): Update declarations.  Remove
12978         default_target method.  Add sized_target and clear_target
12979         methods.  Change target_ to be non-const.
12980         (set_parameters_target): Update declaration.
12981         (parameters_force_valid_target): Declare.
12982         (parameters_clear_target): Declare.
12983         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12984         as NULL if we aren't searching.
12985         (Add_symbols::run): Don't check for compatible target.
12986         * fileread.cc (Input_file::open_binary): Call
12987         parameters_force_valid_target.
12988         * gold.cc (queue_middle_tasks): Likewise.
12989         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
12990         set_target on object.
12991         * dynobj.h (class Sized_dynobj): Update declarations.
12992         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12993         make_elf_object returns NULL.
12994         (Archive::include_member): Don't check whether object target is
12995         compatible.
12996         * output.cc (Output_section::add_input_section): Get target from
12997         parameters.
12998         (Output_section::relax_input_section): Likewise.
12999         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
13000         parameters.
13001         (Sized_relobj::do_scan_relocs): Likewise.
13002         (Sized_relobj::relocate_sections): Likewise.
13003         * resolve.cc (Symbol_table::resolve): Likewise.
13004         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
13005         parameter.  Change all callers.
13006         (Symbol_table::add_from_object): Get target from parameters.
13007         (Symbol_table::add_from_relobj): Don't check object target.
13008         (Symbol_table::add_from_dynobj): Likewise.
13009         (Symbol_table::define_special_symbol): Get target from
13010         parameters.
13011         * symtab.h (class Symbol_table): Update declaration.
13012         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
13013         parameter.  Change all callers.  Clear parameter target.
13014         (Binary_test): Test target here.
13015         * testsuite/object_unittest.cc (gold_testsuite): Remove
13016         target_test_pointer parameter.  Change all callers.
13017         (Object_test): Test target here.
13018
13019 2009-09-26  Ian Lance Taylor  <iant@google.com>
13020
13021         * testsuite/initpri1.c: Don't try to use constructor priorities if
13022         compiling with gcc before 4.3.
13023
13024 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
13025
13026         * testsuite/retain_symbols_file_test.sh (check_present): Change
13027         output file name to retain_symbols_file_test.stdout.
13028         (check_absent): Likewise.
13029
13030 2009-09-18  Craig Silverstein  <csilvers@google.com>
13031
13032         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
13033         * options.cc: Include <cerrno> and <fstream>.
13034         (General_options::finalize): Parse -retain-symbols-file tag.
13035         * options.h: New flag.
13036         (General_options): New method should_retain_symbol, new
13037         variable symbols_to_retain.
13038         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
13039         should_retain_symbol map.
13040         * testsuite/Makefile.am (retain_symbols_file_test): New test.
13041         * testsuite/Makefile.in: Regenerate.
13042         * testsuite/retain_symbols_file_test.sh: New file.
13043
13044 2009-09-18  Nick Clifton  <nickc@redhat.com>
13045
13046         * po/es.po: Updated Spanish translation.
13047
13048 2009-09-17  Doug Kwan  <dougkwan@google.com>
13049
13050         * debug.h (DEBUG_RELAXATION): New constant.
13051         (DEBUG_ALL): Add DEBUG_RELAXATION.
13052         (debug_string_to_enum): Add relaxation debug option.
13053         * layout.cc
13054         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
13055         Layout::Relaxation_debug_check::read_sections,
13056         Layout::Relaxation_debug_check::read_sections): New method definitions.
13057         (Layout::Layout): Initialize data members
13058         record_output_section_data_from_scrips_,
13059         script_output_section_data_list_ and relaxation_debug_check_.
13060         (Layout::save_segments, Layout::restore_segments,
13061         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13062         Layout::relaxation_loop_body): New method definitions.
13063         (Layout::finalize): Support relaxation.  Move section layout code to
13064         Layout::relaxation_loop_body.
13065         (Layout::set_asection_address_from_script): Move code for orphan
13066         section placement out.
13067         (Layout::place_orphan_sections_in_script): New method definition.
13068         * layout.h (Output_segment_headers, Output_file_header):
13069         New forward class declarations.
13070         (Layout::~Layout): Define.
13071         (Layout::new_output_section_data_from_script): New method definition.
13072         (Layout::place_orphan_sections_in_script): New method declaration.
13073         (Layout::Segment_states): New type declaration.
13074         (Layout::save_segments, Layout::restore_segments,
13075         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13076         Layout::relaxation_loop_body): New method declarations.
13077         (Layout::Output_section_data_list): New type declaration.
13078         (Layout::Relaxation_debug_check): New class definition.
13079         (Layout::record_output_section_data_from_script_,
13080         Layout::script_output_section_data_list_, Layout::segment_states_,
13081         Layout::relaxation_debug_check_): New data members.
13082         * output.cc: (Output_section_headers::do_size): New method definition.
13083         (Output_section_headers::Output_section_headers): Move size
13084         computation to Output_section_headers::do_size.
13085         (Output_segment_headers::do_size): New method definition.
13086         (Output_file_header::Output_file_header): Move size computation to
13087         Output_file_header::do_size and call it.
13088         (Output_file_header::do_size): New method definition.
13089         (Output_data_group::Output_data_group): Adjust call to
13090         Output_section_data.
13091         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
13092         (Output_symtab_xindex::do_write): Add array bound check.
13093         (Output_section::Input_section::print_to_mapfile): Handle
13094         RELAXED_INPUT_SECTION_CODE.
13095         (Output_section::Output_section): Initialize data member checkpoint_.
13096         (Output_section::~Output_section): Delete checkpoint object pointed
13097         by checkpoint_.
13098         (Output_section::add_input_section): Always add an Input_section if
13099         relaxing.
13100         (Output_section::add_merge_input_section): Add assert.
13101         (Output_section::relax_input_section): New method definition.
13102         (Output_section::set_final_data_size): Set load address to zero for
13103         an unallocated section.
13104         (Output_section::do_address_and_file_offset_have_reset_values):
13105         New method definition.
13106         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
13107         Handle relaxed input section.
13108         (Output_section::sort_attached_input_sections): Checkpoint input
13109         section list lazily.
13110         (Output_section::get_input_sections): Change type of input_sections to
13111         list of Simple_input_section pointers.  Checkpoint input section list
13112         lazily.  Also handle relaxed input sections.
13113         (Output_section::add_input_section_for_script): Take a reference to
13114         a Simple_input_section object instead of Relobj pointer and section
13115         index as parameter.  Handle relaxed input sections.
13116         (Output_section::save_states, Output_section::restore_states): New
13117         method definitions.
13118         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
13119         (Output_data::is_data_size_fixed): New method definition.
13120         (Output_data::reset_addresss_and_file_offset): Do not reset data size
13121         if it is fixed.
13122         (Output_data::address_and_file_offset_have_reset_values): New method
13123         definition.
13124         (Output_data::do_address_and_file_offset_have_reset_values): New method
13125         definition.
13126         (Output_data::set_data_size): Check that data size is not fixed.
13127         (Output_data::fix_data_size): New method definition.
13128         (Output_data::is_data_size_fixed_): New data member.
13129         (Output_section_headers::set_final_data_size): New method definition.
13130         (Output_section_headers::do_size): New method declaration.
13131         (Output_segment_headers::set_final_data_size): New method definition.
13132         (Output_segment_headers::do_size): New method declaration.
13133         (Output_file_header::set_final_data_size)::New method definition.
13134         (Output_file_header::do_size)::New method declaration.
13135         (Output_section_data::Output_section_data): Add new parameter
13136         is_data_size_fixed and use it to fix data size.
13137         (Output_data_const::Output_data_const): Adjust call to base class
13138         constructor and fix data size.
13139         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
13140         base class constructor and fix data size.
13141         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
13142         base class constructor and fix data size.
13143         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
13144         class constructor and fix data size.
13145         (Output_data_group::set_final_data_size): New method definition.
13146         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
13147         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
13148         class constructor and fix data size.
13149         (Output_relaxed_input_section): New class definition.
13150         (Output_section::Simple_input_section): New class definition.
13151         (Output_section::get_input_sections): Adjust parameter list.
13152         (Output_section::add_input_section_for_script): Same.
13153         (Output_section::save_states, Output_section::restore_states,
13154         Output_section::do_address_and_file_offset_have_reset_values,
13155         (Output_section::Input_section::Input_section): Handle
13156         RELAXED_INPUT_SECTION_CODE.  Add new overload for
13157         Output_relaxed_input_section.
13158         (Output_section::Input_section::is_input_section,
13159         Output_section::Input_section::set_output_section): Handle relaxed
13160         input section.
13161         (Output_section::Input_section::is_relaxed_input_section,
13162         Output_section::Input_section::output_section_data,
13163         Output_section::Input_section::relaxed_input_section): New method
13164         definitions.
13165         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
13166         value.
13167         (Output_section::Input_section::u1_): Update comments.
13168         (Output_section::Input_section::u2_): Add new union member poris.
13169         (Output_section::Checkpoint_output_section): New classs definition.
13170         (Output_section::relax_input_section): New method declaration.
13171         (Output_section::checkpoint_): New data member.
13172         (Output_segment): Update comments.
13173         (Output_segment::Output_segment): Un-privatize copy constructor.
13174         (Output_segment::operator=): Un-privatize.
13175         * script-sections.cc (Output_section_element::Input_section_list):
13176         Change element type to Output_section::Simple_input_section.
13177         (Output_section_element_dot_assignment::set_section_addresses):
13178         Register output section data for relaxation clean up.
13179         (Output_data_exression::Output_data_expression): Adjust call to base
13180         constructor to fix data size.
13181         (Output_section_element_data::set_section_addresses): Register
13182         Output_data_expression object for relaxation clean up.
13183         (struct Input_section_info): Replace Relobj pointer and section index
13184         pair with Output_section::Simple_input_section and Convert struct to a
13185         class.
13186         (Input_section_sorter::operator()): Adjust access to
13187         Input_section_info data member to use accessors.
13188         (Output_section_element_input::set_section_addresses): Use layout
13189         parameter.  Adjust code to use Output_section::Simple_input_section
13190         and Input_secction_info classes.  Register filler for relaxation
13191         clean up.
13192         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
13193         and section index pair with Output_section::Simple_input_section
13194         class.  Adjust code accordingly.
13195         (Phdrs_element::release_segment): New method definition.
13196         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
13197         segment list.
13198         (Script_sections::release_segments): New method definition.
13199         * gold/script-sections.h (Script_sections::release_segments): New
13200         method declaration.
13201         * gold/target.h (Target::may_relax, Target::relax,
13202         Target::do_may_relax, Target::do_relax): New method definitions.
13203
13204 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13205
13206         * arm.cc (has_signed_unsigned_overflow): New function.
13207         (Arm_relocate_functions::abs8): New function.
13208         (Target_arm::Scan::local): Handle R_ARM_ABS8.
13209         (Target_arm::Scan::global): Likewise.
13210         (Target_arm::relocate::relocate): Likewise.
13211         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
13212         Likewise.
13213
13214 2009-09-16  Cary Coutant  <ccoutant@google.com>
13215
13216         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
13217         * testsuite/Makefile.in: Regenerate.
13218
13219 2009-09-11  Nick Clifton  <nickc@redhat.com>
13220
13221         * po/gold.pot: Updated by the Translation project.
13222
13223 2009-09-08  Cary Coutant  <ccoutant@google.com>
13224
13225         * output.cc (Output_file::open): Add execute permission to empty file.
13226         * testsuite/Makefile.am (permission_test): New test.
13227         * testsuite/Makefile.in: Regenerate.
13228
13229 2009-09-02  Ian Lance Taylor  <iant@google.com>
13230
13231         * output.cc (Output_file::resize): Call map_no_anonymous rather
13232         than map.
13233
13234 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
13235
13236         * gold.cc: Include "incremental.h".
13237         (queue_initial_tasks): Call Incremental_checker methods.
13238         * incremental.cc: Include "output.h".
13239         (Incremental_checker::can_incrementally_link_output_file): New
13240         method.
13241         * incremental.h (Incremental_checker): New class.
13242
13243         * output.cc (Output_file::open_for_modification): New method.
13244         (Output_file::map_anonymous): Changed return type to bool.  Record
13245         map in base_ field.
13246         (Output_file::map_no_anonymous): New method, broken out of map.
13247         (Output_file::map): Use map_no_anonymous and map_anonymous.
13248         * output.h (class Output_file): Update declarations.
13249
13250 2009-08-24  Cary Coutant  <ccoutant@google.com>
13251
13252         * options.h (Command_line::Pre_options): New class.
13253         (Command_line::pre_options): New member.
13254         * options.cc (gold::options::ready_to_register): New variable.
13255         (One_option::register_option): Do nothing if not registering options.
13256         Assert if same short option registered twice.
13257         (General_options::General_options): Turn off option registration when
13258         done constructing.
13259         (Command_line::Pre_options::Pre_options): New constructor.
13260
13261 2009-08-24  Cary Coutant  <ccoutant@google.com>
13262
13263         * options.h (General_options::no_keep_memory): Remove incorrect
13264         short option.
13265
13266 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
13267
13268         * Makefile.am (am__skiplex, am__skipyacc): New.
13269         * Makefile.in: Regenerate.
13270
13271 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
13272
13273         * Makefile.am (AM_CPPFLAGS): Renamed from ...
13274         (INCLUDES): ... this.
13275         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
13276         (AM_CPPFLAGS): Renamed from ...
13277         (INCLUDE): ... this.
13278         * Makefile.in, testsuite/Makefile.in: Regenerate.
13279
13280         * Makefile.in: Regenerate.
13281         * aclocal.m4: Likewise.
13282         * config.in: Likewise.
13283         * configure: Likewise.
13284         * testsuite/Makefile.in: Likewise.
13285
13286         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13287         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13288         * Makefile.in: Regenerate.
13289         * testsuite/Makefile.in: Regenerate.
13290
13291 2009-08-19  Cary Coutant  <ccoutant@google.com>
13292
13293         * resolve.cc (Symbol_table::resolve): Don't complain about defined
13294         symbols in shared libraries overridden by hidden or internal symbols
13295         in the main program.
13296
13297 2009-08-19  Chris Demetriou  <cgd@google.com>
13298
13299         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
13300         checking source file names in error messages.
13301
13302 2009-08-18  Doug Kwan  <dougkwan@google.com>
13303
13304         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
13305         an elcpp::Ehdr as parameter.  Adjust call to set_target.
13306         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
13307         an elfcpp::Ehdr as parameter.
13308         * object.cc (Object::set_target): Remove the version that looks up
13309         a target and sets it.
13310         (Sized_relobj::setup): Take a Target object instead of
13311         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
13312         (make_elf_sized_object): Find target and ask target to
13313         make an ELF object.
13314         * object.h: (Object::set_target): Remove the version that looks up
13315         a target and sets it.
13316         (Sized_relobj::setup): Take a Target object instead of
13317         an elfcpp:Ehdr as parameter.
13318         * target.cc: Include dynobj.h.
13319         (Target::do_make_elf_object_implementation): New.
13320         (Target::do_make_elf_object): New.
13321         * target.h (Target::make_elf_object): New template declaration.
13322         (Target::do_make_elf_object): New method declarations.
13323         (Target::do_make_elf_object_implementation): New template declaration.
13324
13325 2009-08-14  Ian Lance Taylor  <iant@google.com>
13326
13327         * gold.h (FUNCTION_NAME): Define.
13328         (gold_unreachable): Use FUNCTION_NAME.
13329
13330 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
13331
13332         * icf.cc (Icf::find_identical_sections): Issue a warning when a
13333         symbol in the --keep-unique list is not found.
13334
13335 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
13336
13337         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
13338         been maked as --keep-unique.
13339         (Icf::unfold_section): New function.
13340         * icf.h (Icf::unfold_section): New function.
13341         * options.h (General_options::keep_unique): New option.
13342         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
13343         * testsuite/Makefile.in: Regenerate.
13344         * testsuite/icf_keep_unique_test.sh: New file.
13345         * testsuite/icf_keep_unique_test.cc: New file.
13346
13347 2009-08-12  Cary Coutant  <ccoutant@google.com>
13348
13349         PR 10471
13350         * resolve.cc (Symbol_table::resolve): Check for references from
13351         dynamic objects to hidden and internal symbols.
13352         * testsuite/Makefile.am (hidden_test.sh): New test.
13353         * testsuite/Makefile.in: Regenerate.
13354         * testsuite/hidden_test.sh: New script.
13355         * testsuite/hidden_test_1.c: New test source.
13356         * testsuite/hidden_test_main.c: New test source.
13357
13358 2009-08-11  Doug Kwan  <dougkwan@google.com>
13359
13360         * arm.cc: Update comments.
13361         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
13362         segment to locate the .ARM.exidx section if present.
13363
13364 2009-08-09  Doug Kwan  <dougkwan@google.com>
13365
13366         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
13367         patch.
13368
13369 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
13370         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
13371         compiler warnings.
13372
13373 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
13374
13375         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
13376         valid tls_segment only for non-debug-section relocations.
13377         * testsuite/Makefile.am: Add gc_tls_test.
13378         * testsuite/Makefile.in: Regenerate.
13379         * testsuite/gc_tls_test.cc: New file.
13380         * testsuite/gc_tls_test.sh: New file.
13381
13382 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
13383
13384         * icf.cc: New file.
13385         * icf.h: New file.
13386         * Makefile.am (CCFILES): Add icf.cc.
13387         (HFILES): Add icf.h
13388         * Makefile.in: Regenerate.
13389         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
13390         * gc.h (gc_process_relocs): Populate lists used by icf to contain
13391         section, symbol and addend information for the relocs.
13392         * gold.cc (queue_middle_tasks): Call identical code folding.
13393         * gold.h: Add defines for multimap.
13394         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
13395         to the call of finalize_local_symbols.
13396         * main.cc (main): Create object of class Icf.
13397         * object.cc (Sized_relobj::do_layout): Allow this function to be
13398         called twice during icf.
13399         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
13400         to sections marked as identical by icf.
13401         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
13402         when available.
13403         (Sized_relobj::do_section_entsize): New function.
13404         * object.h (Object::section_entsize): New function.
13405         (Object::do_section_entsize): New pure virtual function.
13406         (Relobj::finalize_local_symbols): Add new parameter.
13407         (Relobj::do_section_entsize): New function.
13408         * options.h (General_options::icf): New option.
13409         (General_options::icf_iterations): New option.
13410         (General_options::print_icf_sections): New option.
13411         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
13412         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
13413         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
13414         icf.
13415         * symtab.cc (Symbol_table::is_section_folded): New function.
13416         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
13417         to sections marked as identical by icf.
13418         * symtab.h (Symbol_table::set_icf): New function.
13419         (Symbol_table::icf): New function.
13420         (Symbol_table::is_section_folded): New function.
13421         (Symbol_table::icf_): New data member.
13422         * target-reloc.h (relocate_section): Ignore sections folded by icf.
13423         * testsuite/Makefile.am: Add commands to build icf_test.
13424         * testsuite/Makefile.in: Regenerate.
13425         * testsuite/icf_test.sh: New file.
13426         * testsuite/icf_test.cc: New file.
13427
13428 2009-07-24  Chris Demetriou  <cgd@google.com>
13429
13430         * layout.cc (is_compressible_debug_section): Fix incorrect
13431         comment about compressed section names.
13432
13433 2009-07-20  Ian Lance Taylor  <ian@airs.com>
13434
13435         PR 10419
13436         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
13437
13438 2009-07-16  Ian Lance Taylor  <iant@google.com>
13439
13440         PR 10400
13441         * layout.h: #include <map>.
13442         (class Kept_section): Change from struct to class.  Add accessors
13443         and setters.  Add section size to Comdat_group mapping.  Change
13444         Comdat_group to std::map.  Add is_comdat_ field.  Add
13445         linkonce_size field in union.
13446         (class Layout): Update declaration of find_or_add_kept_section.
13447         Don't declare find_kept_object.
13448         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
13449         parameter.  Add object, shndx, is_comdat, and is_group_name
13450         parameters.  Change all callers.  Adjust for new Kept_section.
13451         (Layout::find_kept_object): Remove.
13452         * object.cc (Sized_relobj::include_section_group): Update use of
13453         Kept_section.  Rename secnum to shndx.  Only record
13454         Kept_comdat_section if sections are the same size.
13455         (Sized_relobj::include_linkonce_section): Update use of
13456         Kept_section.  Only record Kept_comdat_section if sections are the
13457         same size.  Set size of linkonce section.
13458         (Sized_relobj::map_to_kept_section): Update call to
13459         get_kept_comdat_section.
13460         * object.h (class Sized_relobj): Rename fields in
13461         Kept_comdat_section to drop trailing underscores; change object
13462         field to Relobj*.  Change Kept_comdat_section_table to store
13463         struct rather than pointer.
13464         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
13465         Add kept_object and kept_shndx parameters.  Change all callers.
13466         (Sized_relobj::get_kept_comdat_section): Change return type to
13467         bool.  Add kept_object and kept_shndx parameters.  Change all
13468         callers.
13469         * plugin.cc (Pluginobj::include_comdat_group): Update call to
13470         Layout::find_or_add_kept_section.
13471
13472 2009-07-09  Ian Lance Taylor  <iant@google.com>
13473
13474         * merge.cc (Object_merge_map::initialize_input_to_output_map):
13475         Reserve space in the hash table.
13476
13477 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
13478
13479         * fileread.cc (File_read::get_mtime): New method.
13480         * fileread.h (Timespec): New structure.
13481         (File_read::get_mtime): New method.
13482         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
13483         Renamed from timestamp_nsec.
13484         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
13485         Elf_Xword.
13486         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
13487         timestamp_nsec.
13488         (Incremental_inputs::report_archive): Save mtime; style fix.
13489         (Incremental_inputs::report_obejct): Save mtime; style fix.
13490         (Incremental_inputs::report_script): Save mtime; style fix.
13491         (Incremental_inputs::finalize_inputs): Style fix.
13492         (Incremental_inputs::finalize): Style fix.
13493         (Incremental_inputs::create_input_section_data): Store inputs
13494         mtime.
13495         * incremental.h (Incremental_inputs::report_script): Add mtime
13496         argument.
13497         (Incremental_inputs::Input_info::Input_info): Intialize only one
13498         union member.
13499         (Incremental_inputs::Input_info::archive): Move to nameless
13500         union.
13501         (Incremental_inputs::Input_info::obejct): Move to nameless union.
13502         (Incremental_inputs::Input_info::script): Move to nameless union.
13503         (Incremental_inputs::mtime): New field.
13504         * script.cc (read_input_script): Pass file mtime to
13505         Incremental_input.
13506         * script.h (Script_info::inputs): Style fix.
13507
13508 2009-07-01  Ian Lance Taylor  <ian@airs.com>
13509
13510         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
13511         instead of 32.
13512
13513 2009-06-24  Ian Lance Taylor  <iant@google.com>
13514
13515         PR 10156
13516         * layout.cc (Layout::choose_output_section): If we find an
13517         existing section, update the flags.
13518         (Layout::create_notes): New function, broken out of
13519         Layout::finalize.
13520         (Layout::finalize): Don't create note sections.
13521         (Layout::create_note): Don't crash if linker script discards
13522         section.
13523         (Layout::create_gold_note): Likewise.
13524         (Layout::create_build_id): Likewise.  Don't set
13525         after_input_sections on the section.
13526         (Layout::create_executable_stack_info): Remove target parameter.
13527         Change caller.
13528         * layout.h (class Layout): Declare create_notes.  Update
13529         declaration of create_executable_stack_info.
13530         * gold.cc (queue_middle_tasks): Call create_notes.
13531         * output.cc (Output_section::update_flags_for_input_section): Move
13532         here from output.h.  If SHF_ALLOC flag is newly set, mark address
13533         invalid.
13534         * output.h (Output_data::mark_address_invalid): New function.
13535         (class Output_section): Only declare, not define,
13536         update_flags_for_input_section.  Remove set_flags.
13537
13538 2009-06-24  Ian Lance Taylor  <iant@google.com>
13539
13540         * script-sections.cc (Output_section_definition::
13541         set_section_addresses): Rename shadowing local load_address to
13542         laddr.
13543
13544 2009-06-24  Ian Lance Taylor  <iant@google.com>
13545
13546         PR 10244
13547         * reloc.cc (relocate_sections): Skip empty relocation sections.
13548
13549 2009-06-23  Ian Lance Taylor  <iant@google.com>
13550
13551         PR 10156
13552         * layout.cc (Layout::create_note): Use choose_output_section
13553         rather than make_output_section.
13554
13555 2009-06-23  Ian Lance Taylor  <iant@google.com>
13556
13557         PR 10237
13558         * options.cc (General_options::parse_V): Set printed_version_.
13559         (General_options::General_options): Initialize printed_version_.
13560         * options.h (class General_options): Add printed_version_ field.
13561         * gold.cc (queue_initial_tasks): If there are no input files,
13562         don't give a fatal error if we printed the version information.
13563         (queue_middle_tasks): If using -r with a shared object, give a
13564         fatal error rather than an ordinary error.
13565
13566 2009-06-23  Ian Lance Taylor  <iant@google.com>
13567
13568         PR 10219
13569         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
13570         (Layout::make_output_section): Set have_stabstr_section_ if we see
13571         a .stab*str section.
13572         (Layout::finalize): Call link_stabs_sections.
13573         (Layout::link_stabs_sections): New file.
13574         * layout.h (class Layout): Add have_stabstr_section_ field.
13575         Declare link_stabs_sections.
13576
13577 2009-06-23  Doug Kwan  <dougkwan@google.com>
13578
13579         * Makefile.am (libgold_a_LIBADD): New.
13580         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
13581         * Makefile.in: Regenerate.
13582         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
13583         * configure: Regenerate.
13584         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
13585         * fileread.cc: Include sys/state.h
13586         * gold.h: Declare memmem and strndup if found missing.
13587         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
13588
13589 2009-06-23  Ian Lance Taylor  <iant@google.com>
13590
13591         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
13592         * configure: Rebuild.
13593
13594 2009-06-23  Ian Lance Taylor  <iant@google.com>
13595
13596         PR 10147
13597         * object.cc (Object::section_contents): Don't try to get a view if
13598         the section has length zero.
13599         (Object::handle_gnu_warning_section): If the section is empty, use
13600         the name of the section as the warning.
13601
13602 2009-06-23  Ian Lance Taylor  <iant@google.com>
13603
13604         PR 10133
13605         * stringpool.h (class Stringpool_template): Add optimize_ field.
13606         (Stringpool_template::set_optimize): New function.
13607         * stringpool.cc (Stringpool_template::Stringpool_template):
13608         Initialize optimize_ field.
13609         (Stringpool_template::set_string_offsets): Test local optimize
13610         fild rather than parameter.
13611         * layout.cc (Layout::Layout): Call set_optimize on the section
13612         name stringpool.
13613
13614 2009-06-22  Ian Lance Taylor  <iant@google.com>
13615
13616         PR 10030
13617         * yyscript.y: Parse TARGET.
13618         * script.cc (script_set_target): New function.
13619         * script-c.h (script_set_target): Declare.
13620         * options.cc (General_options::string_to_object_format): Rename
13621         from string_to_object_format in anonymous namespace.  Change
13622         callers.
13623         * options.h (class General_options): Declare
13624         string_to_object_format.
13625
13626 2009-06-22  Ian Lance Taylor  <iant@google.com>
13627
13628         * script-sections.cc (Script_sections::create_segments): Don't put
13629         program headers in a PT_LOAD segment if -n or -N.
13630
13631 2009-06-22  Ian Lance Taylor  <iant@google.com>
13632
13633         PR 10141
13634         * options.h (class General_options): Add -z lazy and -z now.  Sort
13635         -z options into alphabetical order.
13636         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
13637
13638 2009-06-21  Ian Lance Taylor  <iant@google.com>
13639
13640         * layout.cc (Layout::make_output_section): Call
13641         Target::new_output_section.
13642         (Layout::attach_allocated_section_to_segment): Put large section
13643         sections in a separate load segment with the large segment flag
13644         set.
13645         (Layout::segment_precedes): Sort large data segments after other
13646         load segments.
13647         (align_file_offset): New static function.
13648         (Layout::set_segment_offsets): Use align_file_offset.
13649         * output.h (class Output_section): Add is_small_section_ and
13650         is_large_section_ fields.
13651         (Output_section::is_small_section): New function.
13652         (Output_section::set_is_small_section):  New function.
13653         (Output_section::is_large_section): New function.
13654         (Output_section::set_is_large_section): New function.
13655         (Output_section::is_large_data_section): New function.
13656         (class Output_segment): Add is_large_data_segment_ field.
13657         (Output_segment::is_large_data_segment): New function.
13658         (Output_segment::set_is_large_data_segment): New function.
13659         * output.cc (Output_section::Output_section): Initialize new
13660         fields.
13661         (Output_segment::Output_segment): Likewise.
13662         (Output_segment::add_output_section): Add assertion that large
13663         data sections always go in large data segments.  Force small data
13664         sections to the end of the list of data sections.  Force small BSS
13665         sections to the start of the list of BSS sections.  For large BSS
13666         sections to the end of the list of BSS sections.
13667         * symtab.h (class Symbol): Declare is_common_shndx.
13668         (Symbol::is_defined): Check Symbol::is_common_shndx.
13669         (Symbol::is_common): Likewise.
13670         (class Symbol_table): Define enum Commons_section_type.  Update
13671         declarations.  Add small_commons_ and large_commons_ fields.
13672         * symtab.cc (Symbol::is_common_shndx): New function.
13673         (Symbol_table::Symbol_table): Initialize new fields.
13674         (Symbol_table::add_from_object): Put small and large common
13675         symbols in the right list.
13676         (Symbol_table::sized_finalized_symbol): Check
13677         Symbol::is_common_shndx.
13678         (Symbol_table::sized_write_globals): Likewise.
13679         * common.cc (Symbol_table::do_allocate_commons): Allocate new
13680         common symbol lists.  Don't call do_allocate_commons_list if the
13681         list is empty.
13682         (Symbol_table::do_allocate_commons_list): Remove is_tls
13683         parameter.  Add comons_section_type parameter.  Change all
13684         callers.  Handle small and large common symbols.
13685         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
13686         Symbol::is_common_shndx.
13687         * resolve.cc (symbol_to_bits): Likewise.
13688         * target.h (Target::small_common_shndx): New function.
13689         (Target::small_common_section_flags): New function.
13690         (Target::large_common_shndx): New function.
13691         (Target::large_common_section_flags): New function.
13692         (Target::new_output_section): New function.
13693         (Target::Target_info): Add small_common_shndx, large_common_shndx,
13694         small_common_section_flags, and large_common_section_flags
13695         fields.
13696         (Target::do_new_output_section): New virtual function.
13697         * arm.cc (Target_arm::arm_info): Initialize new fields.
13698         * i386.cc (Target_i386::i386_info): Likewise.
13699         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
13700         Likewise.
13701         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
13702         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13703         (Target_x86_64::do_new_output_section): New function.
13704         * configure.ac: Define conditional MCMODEL_MEDIUM.
13705         * testsuite/Makefile.am (check_PROGRAMS): Add large.
13706         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
13707         (large_LDFLAGS): Define.
13708         * testsuite/large.c: New file.
13709         * testsuite/testfile.cc (Target_test::test_target_info):
13710         Initialize new fields.
13711         * configure, testsuite/Makefile.in: Rebuild.
13712
13713 2009-06-05  Doug Kwan  <dougkwan@google.com>
13714
13715         * Makefile.am (CCFILES): Add target.cc.
13716         * Makefile.in: Regenerate.
13717         * i386.cc (class Target_i386): Define new virtual method to
13718         override do_is_local_label_name in parent.
13719         * object.cc (Sized_relobj::do_count_local_symbols): Discard
13720         local symbols if --discard-locals or -X is given.
13721         * options.h (class General_options): Declare new options
13722         '--discard-locals' and '-X' for discarding locals.
13723         * target.h (class Target): Define new methods is_local_label_name.
13724         Declare new virtual method do_is_local_label_name.
13725         * target.cc: New file.
13726         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
13727         (check_SCRIPTS): Add discard_locals_test.sh.
13728         (check_DATA): Add discard_local_tests.syms.
13729         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
13730         (discard_local_tests.syms, discard_locals_test.o): New make rules.
13731         * testsuite/Makefile.in: Regenerate.
13732         * testsuite/discard_locals_test.c: New file.
13733         * testsuite/discard_locals_test.sh: Same.
13734
13735 2009-06-05  Doug Kwan  <dougkwan@google.com>
13736
13737         * object.cc (Sized_relobj::Sized_relobj): Initialize
13738         discarded_eh_frame_shndx_ to -1U.
13739         (Sized_relobj::do_layout): Record index of a discard .eh_frame
13740         section.
13741         (Sized_relobj::do_count_local_symbols): Skip local symbols in
13742         a discarded .eh_frame section.
13743         (Sized_relobj::do_finalize_local_symbols): Ditto.
13744         * object.h (class Sized_relobj): Declare new member
13745         discarded_eh_frame_shndx_.
13746         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
13747         (local_labels_test.o, local_labels_test): New rules.
13748         * testsuite/Makefile.in: Regenerate.
13749
13750 2009-06-04  Doug Kwan  <dougkwan@google.com>
13751
13752         * layout.cc (Layout::section_name_mapping): Add mapping for
13753         special ARM sections.
13754
13755 2009-06-03  Doug Kwan  <dougkwan@google.com>
13756
13757         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
13758         (utils::has_overflow): Same.
13759
13760 2009-06-03  Ian Lance Taylor  <iant@google.com>
13761
13762         * layout.cc (Layout::section_name_mapping): New array, replacing
13763         Layout::linkonce_mapping.
13764         (Layout::section_name_mapping_count): New variable, replacing
13765         Layout::linkonce_mapping_count.
13766         (Layout::linkonce_output_name): Remove.
13767         (Layout::output_section_name): Rewrite.
13768         * layout.h (class Layout): Rename Linkonce_mapping to
13769         Section_name_mapping, linkonce_mapping to section_name_mapping,
13770         linkonce_mapping_count to section_name_mapping_count.  Don't
13771         declare linkonce_output_name.
13772
13773 2009-06-03  Doug Kwan  <dougkwan@google.com>
13774
13775         * gold/arm.cc (namespace utils): New.
13776         (Target_arm::reloc_is_non_pic): Define new method.
13777         (class Arm_relocate_functions): New.
13778         (Target_arm::Relocate::relocate): Handle relocation types used by
13779         Android.
13780
13781 2009-06-03  Ian Lance Taylor  <iant@google.com>
13782
13783         * arm.cc (Target_arm::scan::global): Use || instead of |.
13784
13785 2009-06-02  Doug Kwan  <dougkwan@google.com>
13786
13787         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
13788         issued_non_pic_error_.
13789         (class Target_arm::Scan): Declare new method check_non_pic.
13790         Define new method symbol_needs_plt_entry.
13791         Declare new data member issued_non_pic_error_.
13792         (class Target_arm::Relocate): Declare new method
13793         should_apply_static_reloc.
13794         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
13795         (Target_arm::Scan::check_non_pic): Define new method.
13796         (Target_arm::Scan::local): Handle a small subset of reloc types used
13797         by Android.
13798         (Target_arm::Scan::local): Same.
13799         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
13800
13801 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
13802
13803         * incremental.cc (Incremental_inputs::report_command_line): Filter
13804         out --incremental-* options.
13805
13806 2009-05-29  Doug Kwan  <dougkwan@google.com>
13807
13808         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
13809         template class.
13810         (class Target_arm): Update comment.
13811         (Target_arm::Target_arm): Initialize new data members GOT_,
13812         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
13813         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
13814         and Target_arm::rel_dyn_section.
13815         Declare new_enum Target_arm::Got_type.
13816         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
13817         and DYNBSS_.
13818         Update commments for member do_dynsym_value.
13819         (Target_arm::got_size, Target_arm::plt_section,
13820         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
13821         new methods inside class defintion.
13822         (Target_arm::got_section): Define new method.
13823         (Target_arm::rel_dyn_section): Same.
13824         (Output_data_plt_arm): New template class.
13825         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
13826         (Output_data_plt_arm:do_adjust_output_section): Define new method.
13827         (Output_data_plt_arm::add_entry): Same.
13828         (Output_data_plt_arm::first_plt_entry): Define new
13829         static data member for PLT instruction template.
13830         (Output_data_plt_arm::plt_entry): Same.
13831         (Output_data_plt_arm::do_write): Define new method.
13832         (Target_arm::make_plt_entry): Same.
13833         (Target_arm::do_finalize_sections): Same.
13834         (Target_arm::do_dynsym_value): Same.
13835
13836 2009-05-28  Doug Kwan  <dougkwan@google.com>
13837
13838         * Makefile.am (TARGETSOURCES): Add arm.cc.
13839         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
13840         * Makefile.in: Regenerate.
13841         * arm.cc: New file.
13842         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
13843
13844 2009-05-26  Doug Kwan  <dougkwan@google.com>
13845
13846         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
13847         (General_options::check_excluded_libs): Strip off directories in
13848         archive name before matching like GNU ld does.
13849         * testsuite/Makefile.am (MOSTLYCLEANFILES,
13850         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
13851         (exclude_libs_test_LDFLAGS): Add linker option
13852         -Wl,--exclude-libs,libexclude_libs_test_3
13853         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
13854         an explicit archive without using -l.
13855         (alt/libexclude_libs_test_3.a): New make rule.
13856         * testsuite/Makefile.in: Regenerate.
13857         * testsuite/exclude_libs_test.c : Declare lib3_default().
13858         (main): Call it.
13859         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
13860         * exclude_libs_test_3.c: New file.
13861
13862 2009-05-26  Nick Clifton  <nickc@redhat.com>
13863
13864         * po/id.po: New Indonesian translation.
13865         * po/gold.pot: Updated template file.
13866
13867 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
13868
13869         * testsuite/Makefile.am: Add -ffunction-sections to compile
13870         gc_comdat_test files.  Add -Wl,--gc-sections to build
13871         gc_comdat_test.
13872         * testsuite/Makefile.in: Regenerate.
13873         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
13874
13875 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
13876
13877         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
13878         kept comdat section was garbage collected.
13879         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
13880         * testsuite/Makefile.in: Regenerate.
13881         * testsuite/gc_comdat_test.sh: New file.
13882         * testsuite/gc_comdat_test_1.cc: New file.
13883         * testsuite/gc_comdat_test_2.cc: New file.
13884
13885 2009-05-19  Doug Kwan  <dougkwan@google.com>
13886
13887         * archive.cc (Archive::Archive): Move constructor from archive.h
13888         to here.  Initialize no_export_.
13889         (Archive::get_elf_object_for_member): Set no_export flag of object.
13890         * archive.h (Archive::Archive): Move constructor body to
13891         archive.cc.
13892         (Archive::no_export): New method.
13893         (Archive::no_export_): New field.
13894         * object.h (Object::Object): Initialize no_export_ to false.
13895         (Object::no_export, Object::set_no_export): New methods.
13896         (Object::no_export_): New field.
13897         * options.cc (General_options::parse_exclude_libs): New method.
13898         (General_options::check_excluded_libs) Same.
13899         * options.h (exclude_libs): New option.
13900         (General_options::check_excluded_libs): New method declaration.
13901         (General_options::excluded_libs_): New field.
13902         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
13903         default or protected visibility if an object has no-export flag set.
13904         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
13905         (check_SCRIPTS): Add exclude_libs_test.sh.
13906         (check_DATA): Add exclude_libs_test.syms.
13907         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
13908         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
13909         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
13910         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
13911         (exclude_libs_test.syms, libexclude_libs_test_1.a,
13912         libexclude_libs_test_2.a): New rules.
13913         * testsuite/Makefile.in: Regenerate.
13914         * testsuite/exclude_libs_test.c: New file.
13915         * testsuite/exclude_libs_test.sh: Ditto.
13916         * testsuite/exclude_libs_test_1.c: Ditto.
13917         * testsuite/exclude_libs_test_2.c: Ditto.
13918
13919 2009-05-15  Ian Lance Taylor  <iant@google.com>
13920
13921         * configure.ac: Check for declarations for cases where libiberty.h
13922         checks HAVE_DECL_xxx.
13923         * configure, config.in: Rebuild.
13924
13925 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
13926
13927         * gold.h (Incremental_argument_list): Remove (invalid) forward
13928         declaration.
13929         * incremental.cc (Incremental_inputs::report_achive): New method.
13930         (Incremental_inputs::report_object): New method.
13931         (Incremental_inputs::report_script): New method.
13932         (Incremental_inputs::finalize_inputs): New method.
13933         (Incremental_inputs::finalize): Call finalize_inputs().
13934         (Incremental_inputs::sized_create_incremental_inputs_section_data):
13935         Create inputs entries.
13936         * incremental.h (Incremental_input_type): New enum.
13937         (Incremental_inputs::Incremental_input): Initialize new fields.
13938         (Incremental_inputs::report_inputs): New method.
13939         (Incremental_inputs::report_achive): New method.
13940         (Incremental_inputs::report_object): New method.
13941         (Incremental_inputs::report_script): New method.
13942         (Incremental_inputs::finalize_inputs): New method.
13943         (Incremental_inputs::Input_info): New struct.
13944         (Incremental_inputs::Input_info_map): New typedef.
13945         (Incremental_inputs::lock_): New field.
13946         (Incremental_inputs::Inputs_): New field.
13947         (Incremental_inputs::Inputs_map): New field.
13948         * main.cc (main): Call Incremental_input::report_inputs.
13949         * options.h (Input_argument_list): Typedef moved from
13950         Input_arguments.
13951         (Input_file_group::Files): Remove, use ::Input_argument_list.
13952         (Input_file_group::Input_argument_list): Remove, use
13953         ::Input_argument_list.
13954         * plugin.cc (Plugin_manager::add_input_file): Add error in
13955         incremental build.
13956         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13957         functions.
13958         * script.cc (read_input_script): Call
13959         Incremental_input::report_script.
13960         * script.h (Script_info): New class.
13961
13962 2009-04-27  Ian Lance Taylor  <iant@google.com>
13963
13964         * x86_64.cc (do_adjust_output_section): Set entsize to
13965         plt_entry_size.
13966
13967 2009-04-23  Elliott Hughes  <enh@google.com>
13968
13969         * output.cc (Output_file::close): After short writes, continue
13970         writing from the correct offset in the buffer being written.
13971
13972 2009-04-23  Chris Demetriou  <cgd@google.com>
13973
13974         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13975         * configure: Regenerate.
13976         * config.in: Regenerate.
13977         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13978         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13979
13980 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
13981
13982         * incremental.cc (Incremental_inputs_header_data): Renamed from
13983         Incremental_input_header_data.
13984         (Incremental_inputs_header_data::data_size): New field.
13985         (Incremental_inputs_header_data::put_input_file_count): Renamed
13986         from input_file_count.
13987         (Incremental_inputs_header_data::put_command_line_offset): Renamed
13988         from command_line_offset.
13989         (Incremental_inputs_header_data::put_reserved): Renamed from
13990         put_reserved.
13991         (Incremental_inputs_entry_data): Renamed from
13992         Incremental_input_entry_data.
13993         (Incremental_inputs_entry_data::data_size): New field.
13994         (Incremental_inputs::report_command_line): New method.
13995         (Incremental_inputs::finalize): New method.
13996         (Incremental_inputs::create_incremental_inputs_data): New method.
13997         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13998         * incremental.h: New file.
13999         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
14000         (Layout::finalize): Create incremental inputs section in
14001         incremental builds.
14002         (Layout::create_incremental_info_sections): New method.
14003         * layout.h (Layout::incremental_inputs): New method.
14004         (Layout::create_incremental_info_sections): New method.
14005         (Layout::incremental_inputs_): New field.
14006         * main.cc (main): Notify Incremental_input of the command line.
14007
14008 2009-04-01  Ian Lance Taylor  <iant@google.com>
14009             Mikolaj Zalewski  <mikolajz@google.com>
14010
14011         * gold.h (reserve_unordered_map): Define, three versions, one for
14012         each version of Unordered_map.
14013         * layout.cc (Layout::Layout): Remove options parameter.  Add
14014         number_of_input_files parameter.  Don't initialize options_.
14015         Initialize number_of_input_files_ and resized_signatures_.  Move
14016         sections_are_attached_.
14017         (Layout::layout_group): Reserve space for group_signatures_.
14018         (Layout::find_or_add_kept_section): Change name parameter to be a
14019         reference.  Resize signatures_ map when it gets large enough.
14020         (Layout::layout_eh_frame): Use parameters->options() instead of
14021         this->options_.
14022         (Layout::make_output_section): Likewise.
14023         (Layout::attach_allocated_section_to_segment): Likewise.
14024         (Layout::finalize, Layout::create_executable_stack): Likewise.
14025         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
14026         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
14027         * layout.h (class Layout): Update declarations.  Remove options_
14028         field.  Add number_of_input_files_ and resized_signatures_
14029         fields.  Move sections_are_attached_ field.
14030         * main.cc (main): Pass number of input files to Layout
14031         constructor.  Don't pass options.
14032
14033 2009-03-30  Ian Lance Taylor  <iant@google.com>
14034
14035         * ffsll.c (ffsll): Correct implementation.
14036
14037 2009-03-27  Ian Lance Taylor  <iant@google.com>
14038
14039         * ffsll.c: New file.
14040         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
14041         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
14042         * ftruncate.c (ftruncate): Declare before definition.
14043         * mremap.c (mremap): Likewise.
14044         * pread.c (pread): Likewise.
14045         * configure, Makefile.in, config.in: Rebuild.
14046
14047         * mremap.c: New file.
14048         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
14049         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
14050         (mremap): Declare if HAVE_MREMAP is not defined.
14051         * configure, Makefile.in, config.in: Rebuild.
14052
14053 2009-03-27  Cary Coutant  <ccoutant@google.com>
14054
14055         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
14056         position independent.
14057         * sparc.cc (Target_sparc::check_non_pic): Likewise.
14058         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
14059
14060 2009-03-24  Cary Coutant  <ccoutant@google.com>
14061
14062         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
14063         an executable.
14064         (needs_dynamic_reloc): Likewise.
14065
14066 2009-03-24  Ian Lance Taylor  <iant@google.com>
14067
14068         * yyscript.y (file_cmd): Recognize EXTERN.
14069         (extern_name_list, extern_name_list_body): New nonterminals.
14070         * script.cc (script_add_extern): Define.
14071         * script-c.h (script_add_extern): Declare.
14072
14073 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
14074
14075         * object.cc (is_elf_object): Define.
14076         * object.h (is_elf_object): Declare.
14077         * archive.cc (Archive::get_elf_object_for_member): Call
14078         is_elf_object.
14079         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
14080
14081 2009-03-24  Elliott Hughes  <enh@google.com>
14082
14083         * output.cc (Output_file::map_anonymous): Define.
14084         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
14085         try an anonymous one.  Report the size if the mmap fails.
14086         * output.h (class Output_file): Declare map_anonymous.
14087
14088 2009-03-24  Ian Lance Taylor  <iant@google.com>
14089
14090         * target-select.cc (instantiate_target): Don't acquire the lock if
14091         the instantiated_target_ field has already been set.
14092
14093 2009-03-23  Ian Lance Taylor  <iant@google.com>
14094
14095         * gold-threads.h (class Initialize_lock): Define.
14096         * gold-threads.cc (class Initialize_lock_once): Define.
14097         (initialize_lock_control): New static variable.
14098         (initialize_lock_pointer): New static variable.
14099         (initialize_lock_once): New static function.
14100         (Initialize_lock::Initialize_lock): Define.
14101         (Initialize_lock::initialize): Define.
14102         * target-select.h: Include "gold-threads.h".
14103         (class Target_selector): Add lock_ and initialize_lock_ fields.
14104         Don't define instantiate_target, just declare it.
14105         * target-select.cc (Target_selector::Target_selector): Initialize
14106         new fields.
14107         (Target_selector::instantiate_target): Define.
14108         * descriptors.h: Include "gold-threads.h".
14109         (class Descriptors): Add initialize_lock_ field.
14110         * descriptors.cc (Descriptors::Descriptors): Initialize new
14111         field.
14112         (Descriptors::open): Use initialize_lock_ field
14113         * errors.h (class Errors): Add initialize_lock_ field.
14114         * errors.cc (Errors::Errors): Initialize new field.
14115         (Errors::initialize_lock): Use initialize_lock_ field.
14116         * powerpc.cc (class Target_selector_powerpc): Remove
14117         instantiated_target_ field.  In do_recognize call
14118         instantiate_target rather than do_instantiate_target.  In
14119         do_instantiate_target just allocate a new target.
14120         * sparc.cc (class Target_selector_sparc): Likewise.
14121
14122         * freebsd.h: New file.
14123         * i386.cc: Include "freebsd.h".
14124         (Target_i386): Derive from Target_freebsd rather than
14125         Sized_target.
14126         (Target_selector_i386): Derive from Target_selector_freebsd rather
14127         than Target_selector.
14128         * x86_64.cc: Include "freebsd.h".
14129         (Target_x86_64): Derive from Target_freebsd rather than
14130         Sized_target.
14131         (Target_selector_x86_64): Derive from Target_selector_freebsd
14132         rather than Target_selector.
14133         * target.h (class Target): Add adjust_elf_header and
14134         do_adjust_elf_header.
14135         * output.cc (Output_file_header:: do_sized_write): Call target
14136         adjust_elf_header routine.
14137         * configure.tgt: Set targ_osabi.
14138         * configure.ac: Define GOLD_DEFAULT_OSABI.
14139         * parameters.cc (Parameters::default_target): Pass
14140         GOLD_DEFAULT_OSABI to select_target.
14141         * target-select.h (class Target_selector): Make instantiate_target
14142         protected rather than private.
14143         * Makefile.am (HFILES): Add freebsd.h.
14144         * configure, Makefile.in, config.in: Rebuild.
14145
14146         * merge.cc (do_add_input_section): Correct pend value.  Change
14147         message about last entry not being null terminated from error to
14148         warning.
14149
14150 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
14151
14152         * incremental.cc: New file.
14153         * Makefile.am (CCFILES): Add incremental.cc.
14154         * Makefile.in: Rebuild.
14155
14156 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
14157
14158         * layout.cc (Layout::output_section_name): Preserve names
14159         of '.note.' sections.
14160
14161 2009-03-19  Ian Lance Taylor  <iant@google.com>
14162
14163         * descriptors.cc (Descriptors::open): Check that the options are
14164         valid before using them.
14165
14166 2009-03-18  Ian Lance Taylor  <iant@google.com>
14167
14168         * script-sections.h: Include <list>.
14169         (class Script_sections): Change Sections_elements from std::vector
14170         to std::list.  Typedef public Elements_iterator.  Add
14171         orphan_section_placement_, data_segment_align_start_, and
14172         saw_data_segment_align_ fields.  Remove data_segment_align_index_
14173         field.
14174         * script-sections.cc (class Orphan_section_placement): New class.
14175         (class Sections_element): Add virtual functions is_relro and
14176         orphan_section_init.  Remove virtual function place_orphan_here.
14177         (class Output_section_definition): Add is_relro and
14178         orphan_section_init.  Remove place_orphan_here.
14179         (class Orphan_output_section): Likewise.
14180         (Script_sections::Script_sections): Update for field changes.
14181         (Script_sections::data_segment_align): Set saw_data_segment_align_
14182         and data_segment_align_start_, not data_segment_align_index.
14183         (Script_sections::data_segment_relro_end): Check
14184         saw_data_segment_align_.  Use data_segment_align_start_ rather
14185         than data_segment_align_index_.
14186         (Script_sections::place_orphan): Rewrite to use
14187         Orphan_section_placement.
14188
14189 2009-03-17  Ian Lance Taylor  <iant@google.com>
14190
14191         * archive.cc (Archive::add_symbols): Check for a version attached
14192         to the symbol name in the archive map.
14193         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
14194         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
14195         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
14196         (ver_test_11.a): New target.
14197         * testsuite/Makefile.in: Rebuild.
14198
14199         * configure.ac: Check for chsize and posix_fallocate.  Replace
14200         ftruncate.
14201         * ftruncate.c: New file, from gnulib.
14202         * output.cc (posix_fallocate): Define dummy version if not
14203         HAVE_POSIX_FALLOCATE.
14204         (Output_file::map): Call posix_fallocate rather than lseek and
14205         write.
14206         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
14207         * configure, Makefile.in, config.in: Rebuild.
14208
14209 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
14210
14211         * layout.h (Layout::create_note): Add section_name parameter.
14212         * layout.cc (Layout::create_note): Likewise.
14213         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
14214
14215 2009-03-17  Ian Lance Taylor  <iant@google.com>
14216
14217         * descriptors.cc: Include "options.h".
14218         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
14219         (Descriptors::open): Always use O_CLOEXEC when opening a new
14220         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
14221         then set FD_CLOEXEC.
14222
14223         * sparc.cc (class Target_sparc): Add has_got_section.
14224         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
14225         make sure we have a GOT section.
14226
14227         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
14228         (Target_sparc::Scan::local): Likewise.
14229         (Target_sparc::Scan::global): Likewise.
14230         (Target_sparc::Relocate::relocate): Likewise.
14231         (Target_sparc::Relocate::relocate_tls): Likewise.
14232
14233         * symtab.cc (Symbol_table::define_default_version): New function,
14234         broken out of add_from_object.
14235         (Symbol_table::add_from_object): Call define_default_version.
14236         (Symbol_table::define_special_symbol): Add resolve_oldsym
14237         parameter.  Change all callers.  If the version for a symbol comes
14238         from a version script, resolve it with the symbol with the same
14239         name with no version.  Also add the symbol without a version if
14240         appropriate.
14241         (do_define_in_output_data): If resolving with oldsym, don't delete
14242         sym.
14243         (do_define_in_output_segment): Likewise.
14244         (do_define_as_constant): Likewise.
14245         * symtab.h (class Symbol_table): Update declarations.
14246
14247 2009-03-13  Ian Lance Taylor  <iant@google.com>
14248
14249         * readsyms.cc (Read_symbols::incompatible_warning): New function.
14250         (Read_symbols::requeue): New function.
14251         (Read_symbols::do_read_symbols): If make_elf_object fails because
14252         the target type is not configured, and the file was searched for,
14253         issue a warning and retry with the next directory.
14254         (Add_symbols::run): If the file has an incompatible format, and
14255         it was searched for, requeue the Read_symbols task.  On error,
14256         release the object.
14257         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
14258         dirindex parameter to constructor.  Change all callers.  Declare
14259         incompatible_warning and requeue.
14260         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
14261         input_argument_ and input_group_ fields.  Add them to
14262         constructor.  Change all callers.
14263         (class Read_script): Add dirindex_ field.  Add it to constructor.
14264         Change all callers.
14265         * archive.cc (Archive::setup): Remove input_objects parameter.
14266         Change all callers.
14267         (Archive::get_file_and_offset): Likewise.
14268         (Archive::read_all_symbols): Likewise.
14269         (Archive::read_symbols): Likewise.
14270         (Archive::get_elf_object_for_member): Remove input_objects
14271         parameter.  Add punconfigured parameter.  Change all callers.
14272         (Archive::add_symbols): Change return type to bool.  Check return
14273         value of include_member.
14274         (Archive::include_all_members): Likewise.
14275         (Archive::include_member): Change return type to bool.  Return
14276         false if first included object has incompatible target.  Set
14277         included_member_ field.
14278         (Add_archive_symbols::run): If add_symbols returns false, requeue
14279         Read_symbols task.
14280         * archive.h (class Archive): Add included_member_ field.
14281         Initialize it in constructor.  Add input_file and searched_for
14282         methods.  Update declarations.
14283         (class Add_archive_symbols): Add dirpath_, dirindex_, and
14284         input_argument_ fields.  Add them to constructor.  Change all
14285         callers.
14286         * script.cc: Include "target-select.h".
14287         (class Parser_closure): Add skip_on_incompatible_target_ and
14288         found_incompatible_target_ fields.  Add
14289         skip_on_incompatible_target parameter to constructor.  Change all
14290         callers.  Add methods skip_on_incompatible_target,
14291         clear_skip_on_incompatible_target, found_incompatible_target, and
14292         set_found_incompatible_target.
14293         (read_input_script): Add dirindex parameter.  Change all callers.
14294         If parser finds an incompatible target, requeue Read_symbols
14295         task.
14296         (script_set_symbol): Clear skip_on_incompatible_target in
14297         closure.
14298         (script_add_assertion, script_parse_option): Likewise.
14299         (script_start_sections, script_add_phdr): Likewise.
14300         (script_check_output_format): New function.
14301         * script.h (read_input_script): Update declaration.
14302         * script-c.h (script_check_output_format): Declare.
14303         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
14304         (ignore_cmd): Remove OUTPUT_FORMAT.
14305         * fileread.cc (Input_file::Input_file): Add explicit this.
14306         (Input_file::will_search_for): New function.
14307         (Input_file::open): Add pindex parameter.  Change all callers.
14308         * fileread.h (class Input_file): Add input_file_argument method.
14309         Declare will_search_for.  Update declarations.
14310         * object.cc (make_elf_object): Add punconfigured parameter.
14311         Change all callers.
14312         * object.h (class Object): Make input_file public.  Add
14313         searched_for method.
14314         (make_elf_object): Update declaration.
14315         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
14316         restart search.
14317         * dirsearch.h (class Dirsearch): Update declaration.
14318         * options.h (class General_options): Add --warn-search-mismatch.
14319         * parameters.cc (Parameters::is_compatible_target): New function.
14320         * parameters.h (class Parameters): Declare is_compatible_target.
14321         * workqueue.cc (Workqueue::add_blocker): New function.
14322         * workqueue.h (class Workqueue): Declare add_blocker.
14323
14324         * fileread.cc (Input_file::open): Remove options parameter.
14325         Change all callers.
14326         (Input_file::open_binary): Likewise.
14327         * script.cc (read_input_script): Likewise.
14328         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
14329         options parameter from constructor.  Change all callers.
14330         (class Read_script): Likewise.
14331         * fileread.h (class Input_file): Update declarations.
14332         * script.h (read_input_script): Update declaration.
14333
14334 2009-03-10  Nick Clifton  <nickc@redhat.com>
14335
14336         * po/es.po: New Spanish translation.
14337
14338 2009-03-06  Cary Coutant  <ccoutant@google.com>
14339
14340         * options.cc (parse_short_option): Keep dash_z from registering itself.
14341
14342 2009-03-03  Ian Lance Taylor  <iant@google.com>
14343
14344         PR 9918
14345         * target-reloc.h (relocate_section): Pass output_section to
14346         relocate.
14347         * i386.cc (Target_i386::should_apply_static_reloc): Add
14348         output_section parameter.  Change all callers.
14349         (Target_i386::Relocate::relocate): Add output_section parameter.
14350         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14351         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
14352         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
14353         * testsuite/two_file_shared.sh: New script.
14354         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
14355         (check_DATA): Add two_file_shared.dbg.
14356         (two_file_shared.dbg): New target.
14357         * testsuite/Makefile.in: Rebuild.
14358
14359 2009-03-01  Ian Lance Taylor  <iant@google.com>
14360
14361         * configure.ac: Check for byteswap.h.
14362         * configure: Rebuild.
14363         * config.in: Rebuild.
14364
14365 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
14366
14367         * layout.cc (Layout::find_or_add_kept_section): New function.
14368         (Layout::add_comdat): Removed.
14369         * layout.h (struct Kept_section): Move out of class Layout.
14370         Remove trailing underscores from field names.  Add group_sections
14371         field.  Rename group_ field to is_group.  Change all uses.
14372         (class Layout): Declare find_or_add_kept_section, not add_comdat.
14373         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
14374         comdat_groups_ field.
14375         (Sized_relobj::include_section_group): Use
14376         find_or_add_kept_section and Kept_section::group_sections.
14377         (Sized_relobj::include_linkonce_section): Likewise.
14378         * object.cc (class Sized_relobj): Don't define Comdat_group or
14379         Comdat_group_table.  Remove find_comdat_group and
14380         add_comdat_group.  Remove comdat_groups_ field.
14381         * plugin.cc (include_comdat_group): Use
14382         Layout::find_or_add_kept_section.
14383
14384 2009-02-28  Ian Lance Taylor  <iant@google.com>
14385
14386         * README: --gc-sections and map files are now supported.  Document
14387         some build requirements.
14388
14389         PR 6992
14390         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
14391         relocatable link set the value of the section symbol to zero.
14392         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
14393         relocatable link don't include the section address in the local
14394         symbol value.
14395
14396 2009-02-27  Ian Lance Taylor  <iant@google.com>
14397
14398         PR 6811
14399         * options.h (class Search_directory): Add is_system_directory.
14400         (class General_options): Declare is_in_system_directory.
14401         * options.cc (get_relative_sysroot): Make static.
14402         (get_default_sysroot): Make static.
14403         (General_optoins::is_in_system_directory): New function.
14404         * fileread.cc (Input_file::is_in_system_directory): New function.
14405         * fileread.h (class Input_file): Declare is_in_system_directory.
14406         * object.h (class Object): Add is_in_system_directory.
14407         (class Input_objects): Remove system_library_directory_ field.
14408         * object.cc (Input_objects::add_object): Don't set
14409         system_library_directory_.
14410         (input_objects::found_in_system_library_directory): Remove.
14411         * symtab.cc (Symbol_table::write_globals): Remove input_objects
14412         parameter.  Change all callers.
14413         (Symbol_table::sized_write_globals): Likewise.
14414         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
14415         Call Object::is_in_system_directory.
14416         * symtab.h (class Symbol_table): Update declarations.
14417
14418         PR 5990
14419         * descriptors.h (Open_descriptor): Add is_on_stack field.
14420         * descriptors.cc (Descriptors::open): If the descriptor is on the
14421         top of the stack, remove it.  Initialize is_on_stack field.
14422         (Descriptors::release): Only add pod to stack if it is not on the
14423         stack already.
14424         (Descriptors::close_some_descriptor): Clear stack_next and
14425         is_on_stack fields.
14426
14427         PR 7091
14428         * output.cc (Output_section::find_starting_output_address): Rename
14429         from starting_output_address; add PADDR parameter; change return
14430         type.
14431         * output.h (class Output_section): Declare
14432         find_starting_output_address instead of starting_output_address.
14433         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
14434         section symbol for which we can't find a merge section.
14435
14436         PR 9836
14437         * symtab.cc (Symbol_table::add_from_object): If the visibility is
14438         hidden or internal, force the symbol to be local.
14439         * resolve.cc (Symbol::override_visibility): Define.
14440         (Symbol::override_base): Use override_visibility.
14441         (Symbol_table::resolve): Likewise.
14442         (Symbol::override_base_with_special): Likewise.
14443         (Symbol_table::override_with_special): If the visibility is hidden
14444         or internal, force the symbol to be local.
14445         * symtab.h (class Symbol): Add set_visibility and
14446         override_visibility.
14447         * testsuite/ver_test_1.sh: New file.
14448         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
14449         (check_DATA): Add ver_test_1.syms.
14450         (ver_test_1.syms): New target.
14451         * testsuite/Makefile.in: Rebuild.
14452
14453 2009-02-25  Cary Coutant  <ccoutant@google.com>
14454
14455         * layout.cc (Layout::choose_output_section): Don't rename sections
14456         when using a linker script that has a SECTIONS clause.
14457         * Makefile.in: Regenerate.
14458
14459         * testsuite/Makefile.am (script_test_5.sh): New test case.
14460         * testsuite/Makefile.in: Regenerate.
14461         * testsuite/script_test_5.cc: New file.
14462         * testsuite/script_test_5.sh: New file.
14463         * testsuite/script_test_5.t: New file.
14464
14465 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
14466
14467         * archive.cc (Archive::include_member): Update calls to add_symbols.
14468         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
14469         the Layout argument.
14470         * dynobj.h (do_add_symbols): Add the Layout argument.
14471         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
14472         Layout argument.
14473         * object.h (Object::add_symbols): Add the Layout argument.
14474         (Object::do_add_symbols): Add the Layout argument.
14475         (Sized_relobj::do_add_symbols): Add the Layout argument.
14476         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
14477         Unify the two versions.
14478         (Add_plugin_symbols): Remove.
14479         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
14480         (Sized_pluginobj::do_add_symbols): Unify the two versions.
14481         (Add_plugin_symbols): Remove.
14482         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
14483         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
14484         (Add_symbols::run): Make it work with Pulginobj.
14485
14486 2009-02-06  Ian Lance Taylor  <iant@google.com>
14487
14488         * object.cc (Sized_relobj::do_layout): Make info message start
14489         with lower case letter.
14490
14491 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
14492
14493         * binary.cc: Fix file comment.
14494
14495         * options.h (enum Incremental_disposition): Define.
14496         (class General_options): Add new options: --incremental,
14497         --incremental_changed, --incremental_unchanged,
14498         --incremental_unknown.  Add incremental_disposition_ and
14499         implicit_incremental_ fields.
14500         (General_options::incremental_disposition): New function.
14501         (class Position_dependent_options): Add incremental_disposition
14502         option.
14503         (Position_dependent_options::copy_from_options): Set incremental
14504         dispositions.
14505         * options.cc (General_options::parse_incremental_changed): New
14506         function.
14507         (General_options::parse_incremental_unchanged): New function.
14508         (General_options::parse_incremental_unknown): New function.
14509         (General_options::General_options): Initialize new fields
14510         incremental_disposition_ and implicit_incremental_.
14511         (General_options::finalize): Check for uasge of --incremental-*
14512         without --incremental.
14513
14514 2009-02-06  Chris Demetriou  <cgd@google.com>
14515
14516         * gold.h (gold_undefined_symbol): Change to take only a Symbol
14517         pointer and to report location as the file name associated with
14518         the symbol.
14519         (gold_undefined_symbol_at_location): New function to replace the
14520         old gold_undefined_symbol functionality.
14521         * target-reloc.h (relocate_section): Update to use
14522         gold_undefined_symbol_at_location.
14523         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14524         Call gold_undefined_symbol function rather than gold_error.
14525         * errors.h (Errors::undefined_symbol): Take location as a
14526         string, rather than calculating it from a relocation.
14527         * errors.cc (Errors::fatal): Print "fatal error:" before the
14528         formatted message.
14529         (Errors::error, Errors::error_at_location): Print "error: "
14530         before the formatted message.
14531         (Errors::undefined_symbol): Take location as a string, rather
14532         than calculating it from a relocation.
14533         (gold_undefined_symbol_at_location): New function akin to
14534         old gold_undefined_symbol, calculates location from relocation.
14535         (gold_undefined_symbol): Change to take only a Symbol pointer
14536         and to report location as the file name associated with the symbol.
14537         * testsuite/debug_msg.sh: Update for changed error messages.
14538         * testsuite/undef_symbol.sh: Likewise.
14539
14540 2009-02-04  Duncan Sands  <baldrick@free.fr>
14541
14542         PR 9812
14543         * reduced_debug_output.h
14544         (Output_reduced_debug_abbrev_section::failed): Use format for
14545         gold_warning.
14546         (Output_reduced_debug_info_section::faild): Likewise.
14547
14548 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
14549
14550         * script.cc (Lazy_demangler): New class.
14551         (Version_script_info::get_symbol_version_helper): Demangle a
14552         symbol only once.
14553
14554 2009-01-29  Cary Coutant  <ccoutant@google.com>
14555
14556         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
14557         to __tls_get_addr.
14558         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14559
14560 2009-01-28  Ian Lance Taylor  <iant@google.com>
14561
14562         * version.cc (version_string): Bump to 1.9.
14563
14564         * gold.h: Include <cstring> and <stdint.h>.
14565         * version.cc: Include <cstdio>.
14566         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
14567         warning.
14568         * reduced_debug_output.cc (insert_into_vector): Rename from
14569         Insert_into_vector; change all callers.  Use Swap_unaligned to
14570         avoid aliasing issue; remove union since it is unnecessary.
14571
14572 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
14573
14574         * Makefile.am (CCFILES): Add gc.cc.
14575         (HFILES): Add gc.h.
14576         * Makefile.in: Regenerate.
14577         * gold.cc (Gc_runner): New class.
14578         (queue_initial_tasks): Call garbage collection related tasks
14579         when corresponding options are invoked.
14580         (queue_middle_gc_tasks): New function.
14581         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
14582         processed early before laying out sections during garbage collection.
14583         * gold.h (queue_middle_gc_tasks): New function.
14584         (is_prefix_of): Move from "layout.cc".
14585         * i386.cc (Target_i386::gc_process_relocs): New function.
14586         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
14587         * main.cc (main): Create object of class "Garbage_collection".
14588         * object.cc (Relobj::copy_symbols_data): New function.
14589         (Relobj::is_section_name_included): New function.
14590         (Sized_relobj::do_layout): Allow this function to be called twice
14591         during garbage collection and defer layout of section during the
14592         first call.
14593         * object.h (Relobj::get_symbols_data): New function.
14594         (Relobj::is_section_name_included): New function.
14595         (Relobj::copy_symbols_data): New function.
14596         (Relobj::set_symbols_data): New function.
14597         (Relobj::get_relocs_data): New function.
14598         (Relobj::set_relocs_data): New function.
14599         (Relobj::is_output_section_offset_invalid): New pure virtual function.
14600         (Relobj::gc_process_relocs): New function.
14601         (Relobj::do_gc_process_relocs): New pure virtual function.
14602         (Relobj::sd_): New data member.
14603         (Sized_relobj::is_output_section_offset_invalid): New function.
14604         (Sized_relobj::do_gc_process_relocs): New function.
14605         * options.h (General_options::gc_sections): Modify to not be a no-op.
14606         (General_options::print_gc_sections): New option.
14607         * plugin.cc (Plugin_finish::run): Remove function call to
14608         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
14609         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
14610         * reloc.cc (Read_relocs::run): Add task to process relocs and
14611         determine unreferenced sections when doing garbage collection.
14612         (Gc_process_relocs): New class.
14613         (Sized_relobj::do_gc_process_relocs): New function.
14614         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
14615         sections that are garbage collected.
14616         * reloc.h (Gc_process_relocs): New class.
14617         * sparc.cc (Target_sparc::gc_process_relocs): New function.
14618         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
14619         symbols whose corresponding sections are garbage collected.
14620         (Symbol_table::Symbol_table): Add new parameter for the garbage
14621         collection object.
14622         (Symbol_table::gc_mark_undef_symbols): New function.
14623         (Symbol_table::gc_mark_symbol_for_shlib): New function.
14624         (Symbol_table::gc_mark_dyn_syms): New function.
14625         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
14626         as garbage.
14627         (Symbol_table::add_from_object): Likewise.
14628         (Symbol_table::add_from_relobj): When building shared objects, do not
14629         treat externally visible symbols as garbage.
14630         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
14631         table information for static and relocatable links.
14632         * symtab.h (Symbol_table::set_gc): New function.
14633         (Symbol_table::gc): New function.
14634         (Symbol_table::gc_mark_undef_symbols): New function.
14635         (Symbol_table::gc_mark_symbol_for_shlib): New function.
14636         (Symbol_table::gc_mark_dyn_syms): New function.
14637         (Symbol_table::gc_): New data member.
14638         * target.h (Sized_target::gc_process_relocs): New pure virtual
14639         function.
14640         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
14641         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
14642
14643 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
14644
14645         * options.h (General_options::gc_sections): Define as a no-op for now.
14646         (General_options::no_keep_memory): Ditto.
14647         (General_options::Bshareable): Define.
14648         * options.cc (General_options::finalize): Honor -Bshareable.
14649
14650 2009-01-20  Andreas Schwab  <schwab@suse.de>
14651
14652         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
14653         read the value in the contents, since we don't use it.  Use the
14654         template endianness when writing.
14655         (Relocate::relocate): Use it for R_PPC_REL16_HA.
14656
14657 2009-01-19  Andreas Schwab  <schwab@suse.de>
14658
14659         * configure.tgt (powerpc64-*): Fix targ_obj.
14660
14661 2009-01-15  Ian Lance Taylor  <iant@google.com>
14662
14663         * object.cc (Sized_relobj::write_local_symbols): Don't write out
14664         local symbols when stripping all symbols.
14665
14666 2009-01-14  Cary Coutant  <ccoutant@google.com>
14667
14668         * output.cc (Output_reloc): Add explicit instantiations.
14669
14670 2009-01-14  Cary Coutant  <ccoutant@google.com>
14671
14672         * archive.cc (Archive::get_elf_object_for_member): Remove call
14673         to File_read::claim_for_plugin.
14674         * descriptors.cc (Descriptors::open): Remove reference to
14675         is_claimed.
14676         (Descriptors::claim_for_plugin): Remove.
14677         * descriptors.h (Descriptors::claim_for_plugin): Remove.
14678         (Descriptors::is_claimed): Remove.
14679         (claim_descriptor_for_plugin): Remove.
14680         * fileread.cc (File_read::claim_for_plugin): Remove.
14681         * fileread.h (File_read::claim_for_plugin): Remove.
14682         (File_read::descriptor): Reopen descriptor if necessary.
14683         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
14684         (Plugin_manager::all_symbols_read): Add task parameter. Change
14685         all callers.
14686         (Plugin_manager::get_input_file): New function.
14687         (Plugin_manager::release_input_file): New function.
14688         (Pluginobj::Pluginobj): Add filesize parameter and initialize
14689         corresponding data member.
14690         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
14691         and pass to base constructor. Change all callers.
14692         (get_input_file, release_input_file): New functions.
14693         (make_sized_plugin_object): Add filesize parameter. Change all callers.
14694         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
14695         (Plugin_manager::all_symbols_read): Add task parameter.
14696         (Plugin_manager::get_input_file): New function.
14697         (Plugin_manager::release_input_file): New function.
14698         (Plugin_manager::task_): New data member.
14699         (Pluginobj::Pluginobj): Add filesize parameter.
14700         (Pluginobj::filename): New function.
14701         (Pluginobj::descriptor): New function.
14702         (Pluginobj::filesize): New function.
14703         (Pluginobj::filesize_): New data member.
14704         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
14705         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
14706         File_read::claim_for_plugin; use Object::unlock to unlock the file.
14707
14708         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
14709         with archive libraries.
14710         * testsuite/Makefile.in: Regenerate.
14711         * testsuite/plugin_test.c (struct sym_info): New type.
14712         (get_input_file, release_input_file): New static variables.
14713         (onload): Capture new transfer vector entries.
14714         (claim_file_hook): Stop reading at end of file according to filesize.
14715         Factor out parsing of readelf output into separate function.
14716         (all_symbols_read_hook): Exercise get_input_file and release_input_file
14717         APIs and get the source file name from the symbol table.  Convert
14718         source file name to corresponding object file name.  Print info
14719         message when adding new input files.
14720         (parse_readelf_line): New function.
14721         * testsuite/plugin_test_1.sh: Add checks for new info messages.
14722         * testsuite/plugin_test_2.sh: Likewise.
14723         * testsuite/plugin_test_3.sh: Likewise.
14724         * testsuite/plugin_test_4.sh: New test case.
14725
14726 2009-01-07  Ian Lance Taylor  <iant@google.com>
14727
14728         * version.cc (version_string): Bump to 1.8.
14729
14730 2008-12-23  Cary Coutant  <ccoutant@google.com>
14731
14732         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
14733         * plugin.cc (Plugin_manager::finish): Rename as
14734         layout_deferred_objects.  Move cleanup to separate function.
14735         (Plugin_manager::cleanup): New function.
14736         (Plugin_finish::run): Call layout_deferred_objects and cleanup
14737         separately.
14738         * plugin.h (Plugin_manager::finish): Rename as
14739         layout_deferred_objects.
14740         (Plugin_manager::cleanup): New function.
14741         (Plugin_manager::cleanup_done): New field.
14742
14743 2008-12-23  Cary Coutant  <ccoutant@google.com>
14744
14745         * plugin.cc (is_visible_from_outside): New function.
14746         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
14747         so we don't return "IR only" status for exported symbols or -r links.
14748
14749         * testsuite/Makefile.am (plugin_test_3): New test case.
14750         * testsuite/Makefile.in: Regenerate.
14751         * testsuite/plugin_test_3.sh: New file.
14752
14753 2008-12-22  Cary Coutant  <ccoutant@google.com>
14754
14755         * object.cc (Sized_relobj::layout_section): New function.
14756         (Sized_relobj::do_layout): Defer layout of input sections until after
14757         plugin has provided replacement files.
14758         (Sized_relobj::do_layout_deferred_sections): New function.
14759         * object.h (Relobj::set_section_offset): Remove virtual keyword.
14760         (Relobj::layout_deferred_sections): New function.
14761         (Relobj::do_layout_deferred_sections): New function.
14762         (Sized_relobj::do_layout_deferred_sections): New function.
14763         (Sized_relobj::layout_section): New function.
14764         (Sized_relobj::Deferred_layout): New structure.
14765         (Sized_relobj::deferred_layout_): New field.
14766         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
14767         Change all callers.  Layout deferred sections.
14768         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
14769         references.
14770         (Plugin_hook::run): Move code from do_plugin_hook inline.
14771         (Plugin_hook::do_plugin_hook): Remove.
14772         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
14773         (Plugin_manager::finish): Renamed, was cleanup.
14774         (Plugin_manager::should_defer_layout): New function.
14775         (Plugin_manager::add_deferred_layout_object): New function.
14776         (Plugin_manager::Deferred_layout_list): New type.
14777         (Plugin_manager::deferred_layout_objects_): New field.
14778         (Plugin_hook::do_plugin_hook): Remove.
14779
14780 2008-12-17  Ian Lance Taylor  <iant@google.com>
14781
14782         * options.h (class General_options): Add --no case for
14783         --export-dynamic.
14784
14785 2008-12-16  Cary Coutant  <ccoutant@google.com>
14786
14787         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
14788         vector.
14789         (Plugin_manager::claim_file): Create plugin object even if
14790         plugin did not call the add_symbols callback.
14791         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
14792         asking for more symbols than were added.
14793         * testsuite/Makefile.am (plugin_test_1): Add test case with
14794         no global symbols.
14795         (empty.syms): New target.
14796         * testsuite/Makefile.in: Regenerate.
14797         * testsuite/plugin_test.c (claim_file_hook): Add new debug
14798         message. Don't call add_symbols if no globals.
14799         (all_symbols_read_hook): Don't provide replacement for empty
14800         claimed file.
14801
14802 2008-12-12  Ian Lance Taylor  <iant@google.com>
14803
14804         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
14805         r_type == 0 for a local symbol with r_sym == 0.
14806         (scan_relocatable_relocs): Pass r_sym to
14807         local_non_section_strategy.
14808         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
14809         r_sym parameter.
14810
14811         * configure.ac: Update test for TLS descriptors: they are
14812         supported as of glibc 2.9.
14813         * configure: Rebuild.
14814
14815 2008-12-11  Ian Lance Taylor  <iant@google.com>
14816
14817         PR 7091
14818         * target-reloc.h (Default_scan_relocatable_relocs): For each
14819         function, map r_type == 0 to RELOC_DISCARD.
14820
14821 2008-12-10  Cary Coutant  <ccoutant@google.com>
14822
14823         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
14824         object to override a kept COMDAT group from a plugin object.
14825
14826 2008-12-09  Ian Lance Taylor  <iant@google.com>
14827
14828         PR 7088
14829         * yyscript.y (file_cmd): Handle INPUT.
14830
14831         * testsuite/initpri1.c: Change all declarations to be full
14832         prototypes by adding void, to avoid compiler warnings.
14833
14834 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
14835
14836         * options.cc (General_options::parse_plugin_opt): New.
14837         (General_options::add_plugin): The argument now is just the filename.
14838         (General_options::add_plugin_option): New.
14839         * options.h (plugin_opt): New.
14840         (add_plugin): Change argument name.
14841         (add_plugin_option): New.
14842         * plugin.cc (Plugin::load): Don't parse the plugin option.
14843         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
14844         (Plugin::add_option): New.
14845         (Plugin::args_): Change type.
14846         (Plugin::filename_): New.
14847         (Plugin_manager::add_plugin_option): New.
14848         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
14849         * testsuite/Makefile.in: Regenerate.
14850
14851 2008-12-05  Cary Coutant  <ccoutant@google.com>
14852
14853         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
14854         Handle --strip-lto-sections option.
14855         * options.h (strip_lto_sections): New option.
14856
14857 2008-12-01  Cary Coutant  <ccoutant@google.com>
14858
14859         * plugin.cc (ld_plugin_message): Change format parameter to const.
14860         Fix mismatch between new[] and delete.
14861
14862 2008-11-14  Cary Coutant  <ccoutant@google.com>
14863
14864         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
14865         instead of -1U.
14866
14867 2008-11-05  Craig Silverstein  <csilvers@google.com>
14868
14869         * options.cc (General_options::parse_dynamic_list): New function.
14870         * options.h (General_options): New flags dynamic_list,
14871         dynamic_list_data, dynamic_list_cpp_new, and
14872         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
14873         (General_options::in_dynamic_list): New function.
14874         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
14875         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
14876         (Lex::can_continue_name): Likewise.
14877         (yylex): Likewise.
14878         (read_script_file): New parameter script_options.
14879         (read_dynamic_list): New function.
14880         (Script_options::define_dynamic_list): New function.
14881         (dynamic_list_keyword_parsecodes): New variable.
14882         (dynamic_list_keywords): New variable.
14883         * script.h (Script_options::define_dynamic_list): New function
14884         prototype.
14885         (read_dynamic_list): New function prototype.
14886         * symtab.cc (strprefix): New macro.
14887         (Symbol::should_add_dynsym_entry): Support dynamic_list,
14888         dynamic_list_data, dynamic_list_cpp_new, and
14889         dynamic_list_cpp_typeinfo.
14890         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
14891         (dynamic_list_expr): New rule.
14892         (dynamic_list_nodes): Likewise.
14893         (dynamic_list_node): Likewise.
14894         * testsuite/Makefile.am (dynamic_list): New test.
14895         * testsuite/Makefile.in: Regenerated.
14896         * testsuite/dynamic_list.t: New file.
14897         * testsuite/dynamic_list.sh: New file.
14898
14899 2008-11-05  Craig Silverstein  <csilvers@google.com>
14900
14901         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
14902         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
14903         (t11_last): Likewise.
14904         * testsuite/ver_test_6.c (main): Likewise.
14905
14906 2008-10-07  Cary Coutant  <ccoutant@google.com>
14907
14908         * options.c (General_options::finalize): Add check for -static and
14909         -shared.
14910         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
14911         is not empty.
14912
14913 2008-10-02  Cary Coutant  <ccoutant@google.com>
14914
14915         * plugin.cc (make_sized_plugin_object): Fix conditional
14916         compilation to work when not all targets are enabled.
14917
14918 2008-09-29  Cary Coutant  <ccoutant@google.com>
14919
14920         * archive.cc (Archive::get_file_and_offset): Use filename instead
14921         of name to get library path.
14922         (Archive::include_member): Unlock external member of a thin archive.
14923
14924         * testsuite/Makefile.am (TEST_AR): New variable.
14925         (thin_archive_test_1): New test.
14926         (thin_archive_test_2): New test.
14927         * testsuite/Makefile.in: Regenerate.
14928         * testsuite/thin_archive_main.cc: New file.
14929         * testsuite/thin_archive_test_1.cc: New file.
14930         * testsuite/thin_archive_test_2.cc: New file.
14931         * testsuite/thin_archive_test_3.cc: New file.
14932         * testsuite/thin_archive_test_4.cc: New file.
14933
14934 2008-09-29  Cary Coutant  <ccoutant@google.com>
14935
14936         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
14937         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
14938         instead of -1U.
14939         (Sized_relobj::do_finalize_local_symbols): Likewise.
14940         (Sized_relobj::map_to_kept_section): Likewise.
14941         * object.h (Sized_relobj::invalid_address): New constant.
14942         (Sized_relobj::do_output_section_offset): Check for invalid_address
14943         and return -1ULL.
14944         * output.cc (Output_reloc::local_section_offset): Use constant
14945         invalid_address instead of -1U.
14946         (Output_reloc::get_address): Likewise.
14947         (Output_section::output_address): Change -1U to -1ULL.
14948         * output.h (Output_reloc::invalid_address): New constant.
14949         * reloc.cc (Sized_relobj::write_sections): Use constant
14950         invalid_address instead of -1U.
14951         (Sized_relobj::relocate_sections): Likewise.
14952         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
14953         values for merge sections.
14954         * target-reloc.h (relocate_for_relocatable): Use constant
14955         invalid_address instead of -1U.
14956
14957 2008-09-19  Cary Coutant  <ccoutant@google.com>
14958
14959         Add plugin functionality for link-time optimization (LTO).
14960         * configure.ac (plugins): Add --enable-plugins option.
14961         * configure: Regenerate.
14962         * config.in: Regenerate.
14963         * Makefile.am (LIBDL): New variable.
14964         (CCFILES): Add plugin.cc.
14965         (HFILES): Add plugin.h.
14966         (ldadd_var): Add LIBDL.
14967         * Makefile.in: Regenerate.
14968
14969         * archive.cc: Include "plugin.h".
14970         (Archive::setup): Don't preread archive symbols when using a plugin.
14971         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
14972         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14973         files.
14974         (Archive::include_member): Add symbols from plugin objects.
14975         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14976         * descriptors.cc (Descriptors::open): Check for file descriptors
14977         abandoned by plugins.
14978         (Descriptors::claim_for_plugin): New function.
14979         * descriptors.h (Descriptors::claim_for_plugin): New function.
14980         (Open_descriptor::is_claimed): New field.
14981         (claim_descriptor_for_plugin): New function.
14982         * fileread.cc (File_read::claim_for_plugin): New function.
14983         * fileread.h (File_read::claim_for_plugin): New function.
14984         (File_read::descriptor): New function.
14985         * gold.cc: Include "plugin.h".
14986         (queue_initial_tasks): Add task to call plugin hooks for generating
14987         new object files.
14988         * main.cc: Include "plugin.h".
14989         (main): Load plugin libraries.
14990         * object.h (Pluginobj): Declare.
14991         (Object::pluginobj): New function.
14992         (Object::do_pluginobj): New function.
14993         (Object::set_target): New function.
14994         * options.cc: Include "plugin.h".
14995         (General_options::parse_plugin): New function.
14996         (General_options::General_options): Initialize plugins_ field.
14997         (General_options::add_plugin): New function.
14998         * options.h (Plugin_manager): Declare.
14999         (General_options): Add --plugin option.
15000         (General_options::has_plugins): New function.
15001         (General_options::plugins): New function.
15002         (General_options::add_plugin): New function.
15003         (General_options::plugins_): New field.
15004         * plugin.cc: New file.
15005         * plugin.h: New file.
15006         * readsyms.cc: Include "plugin.h".
15007         (Read_symbols::do_read_symbols): Check for archive before checking
15008         for ELF file.  Call plugin hooks to claim files.
15009         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
15010         from a real object file; force override when processing replacement
15011         files.
15012         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
15013         (Symbol::init_base_object): Likewise.
15014         (Symbol::init_base_output_data): Likewise.
15015         (Symbol::init_base_output_segment): Likewise.
15016         (Symbol::init_base_constant): Likewise.
15017         (Symbol::init_base_undefined): Likewise.
15018         (Symbol::output_section): Assert that object is not a plugin.
15019         (Symbol_table::add_from_pluginobj): New function.
15020         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
15021         undefined.
15022         (Symbol_table::sized_write_globals): Likewise.
15023         (Symbol_table::add_from_pluginobj): Instantiate template.
15024         * symtab.h (Sized_pluginobj): Declare.
15025         (Symbol::in_real_elf): New function.
15026         (Symbol::set_in_real_elf): New function.
15027         (Symbol::in_real_elf_): New field.
15028         (Symbol_table::add_from_pluginobj): New function.
15029
15030         * testsuite/Makefile.am (AM_CFLAGS): New variable.
15031         (LIBDL): New variable.
15032         (LDADD): Add LIBDL.
15033         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
15034         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
15035         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
15036         (MOSTLYCLEANFILES): Likewise.
15037         * testsuite/Makefile.in: Regenerate.
15038         * testsuite/plugin_test.c: New file.
15039         * testsuite/plugin_test_1.sh: New file.
15040         * testsuite/plugin_test_2.sh: New file.
15041
15042 2008-09-16  Ian Lance Taylor  <iant@google.com>
15043
15044         * target-reloc.h (relocate_section): Check whether a symbol is
15045         defined by the ABI before reporting an undefined symbol error.
15046         * target.h (Target::is_defined_by_abi): Make parameter const.
15047         (Target::do_is_defined_by_abi): Likewise.
15048         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
15049         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
15050         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
15051         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
15052         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
15053         * testsuite/Makefile.in: Rebuild.
15054
15055         * fileread.cc (make_view): Add casts to avoid warning.
15056
15057 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15058
15059         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
15060         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15061
15062 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15063
15064         * options.h (General_options::output_is_executable): New.
15065         (General_options::output_is_pie): New.
15066         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
15067         for shared libraries.
15068         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15069
15070 2008-09-11  Chris Demetriou  <cgd@google.com>
15071
15072         * options.h (origin): New -z option.
15073         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
15074         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
15075         in DT_FLAGS_1.
15076
15077 2008-09-05  Cary Coutant  <ccoutant@google.com>
15078
15079         * fileread.cc (File_read::make_view): Add check for attempt to map
15080         beyond end of file.
15081
15082 2008-09-05  Cary Coutant  <ccoutant@google.com>
15083
15084         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
15085         explicit instantiations.
15086
15087 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
15088
15089         PR gold/6858
15090         * options.cc (General_options::finalize): Allow undefined symbols
15091         in shlibs if linking -shared.
15092
15093         PR gold/6859
15094         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
15095         symbols as not needing a dynsym entry.
15096
15097 2008-08-20  Craig Silverstein  <csilvers@google.com>
15098
15099         * fileread.cc (File_read::open): Do not lock the file unless it
15100         was successfully opened.
15101
15102 2008-08-14  Cary Coutant  <ccoutant@google.com>
15103
15104         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
15105         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
15106         * testsuite/tls_test.cc (struct int128): 128-bit struct
15107         for testing TLS relocs with non-zero addend.
15108         (v12): New TLS variable.
15109         (t12): New test.
15110         (t_last): Add check for v12.
15111         * testsuite/tls_test.h (t12): New function.
15112         * testsuite/tls_test_main.cc (thread_routine): Call new test.
15113
15114 2008-08-13  Ian Lance Taylor  <iant@google.com>
15115
15116         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
15117         set tls_segment_ or relro_segment_.
15118         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
15119         when appropriate.
15120         * output.h (Output_section::clear_is_relro): New function.
15121         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
15122         sections specially even when output_data_ is empty.
15123         (Output_segment::maximum_alignment): When first section is relro,
15124         only force alignment for PT_LOAD segments.
15125         * script.cc (script_data_segment_align): New function.
15126         (script_data_segment_relro_end): New function.
15127         * script-c.h (script_data_segment_align): Declare.
15128         (script_data_segment_relro_end): Declare.
15129         * script-sections.h (class Script_sections): Declare
15130         data_segment_align and data_segment_relro_end.  Add fields
15131         segment_align_index_ and saw_relro_end_.
15132         * script-sections.cc (class Sections_element): Add set_is_relro
15133         virtual function.  Add new bool* parameter to place_orphan_here.
15134         Add get_output_section virtual function.
15135         (class Output_section_definition): Add set_is_relro.  Add new
15136         bool* parameter to place_orphan_here.  Add get_output_section.
15137         Add is_relro_ field.
15138         (Output_section_definition::Output_section_definition): Initialize
15139         evaluated_address_, evaluated_load_address, evaluated_addralign_,
15140         and is_relro_ fields.
15141         (Output_section_definition::place_orphan_here): Add is_relro
15142         parameter.
15143         (Output_section_definition::set_section_addresses): Set relro for
15144         output section.
15145         (Output_section_definition::alternate_constraint): Likewise.
15146         (class Orphan_output_section): Add new bool* parameter to
15147         place_orphan_here.  Add get_output_section.
15148         (Orphan_output_section::place_orphan_here): Add is_relro
15149         parameter.
15150         (Script_sections::Script_sections): Initialize
15151         data_segment_align_index_ and saw_relro_end_.
15152         (Script_sections::data_segment_align): New function.
15153         (Script_sections::data_segment_relro_end): New function.
15154         (Script_sections::place_orphan): Set or clear is_relro.
15155         (Script_sections::set_section_addresses): Force alignment of first
15156         TLS section.
15157         * yyscript.y (exp): Call script_data_segment_align and
15158         script_data_segment_relro_end.
15159         * testsuite/relro_script_test.t: New file.
15160         * testsuite/relro_test.cc (using_script): Declare.
15161         (t1, t2): Test using_script.
15162         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
15163         (relro_script_test_SOURCES): Define.
15164         (relro_script_test_DEPENDENCIES): Define.
15165         (relro_script_test_LDFLAGS): Define.
15166         (relro_script_test_LDADD): Define.
15167         (relro_script_test.so): New target.
15168         * testsuite/Makefile.in: Rebuild.
15169
15170 2008-08-06  Cary Coutant <ccoutant@google.com>
15171
15172         * archive.cc (Archive::total_archives, Archive::total_members)
15173         (Archive::total_members_loaded): New variables.
15174         (Archive::setup): Add parameter.  Add option to preread
15175         archive symbols.
15176         (Archive::read_armap): Add counter.
15177         (Archive::get_file_and_offset): New function.
15178         (Archive::get_elf_object_for_member): New function.
15179         (Archive::read_all_symbols): New function.
15180         (Archive::read_symbols): New function.
15181         (Archive::add_symbols): Add counters.
15182         (Archive::include_all_members): Use armap to find members if it's
15183         already built.
15184         (Archive::include_member): Skip reading symbols if already read.
15185         Factored code into Archive::get_file_and_offset and
15186         Archive::get_elf_object_for_member.  Changed call to
15187         Mapfile::report_include_archive_member.
15188         (Archive::print_stats): New function.
15189         * archive.h: Declare Object and Read_symbols_data classes.
15190         (Archive::Archive): Add initializers for new members.
15191         (Archive::setup): Add parameter.
15192         (Archive::print_stats): New function.
15193         (Archive::total_archives, Archive::total_members)
15194         (Archive::total_members_loaded): New variables.
15195         (Archive::get_file_and_offset): New function.
15196         (Archive::get_elf_object_for_member): New function.
15197         (Archive::read_all_symbols): New function.
15198         (Archive::read_symbols): New function.
15199         (Archive::Archive_member): New class.
15200         (Archive::members_): New member.
15201         (Archive::num_members_): New member.
15202         * main.cc: Include archive.h.
15203         (main): Call Archive::print_stats.
15204         * mapfile.cc (Mapfile::report_include_archive_member): Delete
15205         archive parameter; member_name is now the fully-decorated name.
15206         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
15207         * options.h: (General_options): Add --preread-archive-symbols option.
15208         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
15209         Archive::setup.
15210
15211 2008-08-04  Ian Lance Taylor  <iant@google.com>
15212
15213         * symtab.h (Symbol::use_plt_offset): New function.
15214         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
15215         * powerpc.cc (Relocate::relocate): Likewise.
15216         * sparc.cc (Relocate::relocate): Likewise.
15217         * x86_64.cc (Relocate::relocate): Likewise.
15218         * testsuite/weak_plt.sh: New test.
15219         * testsuite/weak_plt_main.cc: New test.
15220         * testsuite/weak_plt_shared.cc: New test.
15221         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
15222         (check_PROGRAMS): Add weak_plt.
15223         (check_DATA): Add weak_plt_shared.so.
15224         (weak_plt_main_pic.o, weak_plt): New targets.
15225         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
15226         * testsuite/Makefile.in: Rebuild.
15227
15228         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
15229         gcctestdir/ld.
15230         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
15231         * testsuite/Makefile.in: Rebuild.
15232
15233 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
15234
15235         * Makefile.am (POTFILES.in): Set LC_ALL=C.
15236         * Makefile.in: Regenerate.
15237         * po/POTFILES.in: Regenerate.
15238
15239 2008-07-29  Ian Lance Taylor  <iant@google.com>
15240
15241         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
15242         symbols before other symbols.
15243         * testsuite/script_test_2.cc (test_addr): Declare.
15244         (test_addr_alias): Declare.
15245         (main): Check that test_addr and test_addr_alias have the right
15246         values.
15247         * testsuite/script_test_2.t: Define test_addr_alias and
15248         test_addr.
15249
15250 2008-07-24  Ian Lance Taylor  <iant@google.com>
15251
15252         PR 5990
15253         * descriptors.cc: New file.
15254         * descriptors.h: New file.
15255         * gold-threads.h (class Hold_optional_lock): New class.
15256         * fileread.cc: Include "descriptors.h".
15257         (File_read::~File_read): Release descriptor rather than closing
15258         it.
15259         (File_read::open) [file]: Call open_descriptor rather than open.
15260         Set is_descriptor_opened_.
15261         (File_read::open) [memory]: Assert that descriptor is not open.
15262         (File_read::reopen_descriptor): New function.
15263         (File_read::release): Release descriptor.
15264         (File_read::do_read): Make non-const.  Reopen descriptor.
15265         (File_read::read): Make non-const.
15266         (File_read::make_view): Reopen descriptor.
15267         (File_read::do_readv): Likewise.
15268         * fileread.h (class File_read): Add is_descriptor_opened_ field.
15269         Update declarations.
15270         * layout.cc: Include "descriptors.h".
15271         (Layout::create_build_id): Use open_descriptor rather than open.
15272         * output.cc: Include "descriptors.h".
15273         (Output_file::open): Use open_descriptor rather than open.
15274         * archive.cc (Archive::const_iterator): Change Archive to be
15275         non-const.
15276         (Archive::begin, Archive::end): Make non-const.
15277         (Archive::count_members): Likewise.
15278         * archive.h (class Archive): Update declarations.
15279         * object.h (Object::read): Make non-const.
15280         * Makefile.am (CCFILES): Add descriptors.cc.
15281         (HFILES): Add descriptors.h.
15282         * Makefile.in: Rebuild.
15283
15284         PR 6716
15285         * gold.h: Always include <clocale>.  Add Solaris workarounds
15286         following code in binutils/sysdep.h.
15287
15288         PR 6048
15289         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
15290         this->eh_frame_hdr_ is NULL before using it.
15291
15292         * dynobj.cc (Versions::Versions): Update comment.
15293
15294         * dynobj.cc (Versions::Versions): If there is an soname, use it as
15295         the base version name.
15296
15297         * stringpool.cc (Stringpool_template::add_with_length): Set key to
15298         array size plus one.
15299         (Stringpool_template::set_string_offsets): Subtract one from key
15300         before using it as an array index.
15301         (Stringpool_template::get_offset_with_length): Likewise.
15302         (Stringpool_template::write_to_buffer): Likewise.
15303         * stringpool.h (Stringpool_template::get_offset_from_key):
15304         Likewise.
15305
15306 2008-07-23  Ian Lance Taylor  <iant@google.com>
15307
15308         PR 6658
15309         * object.h (Merged_symbol_value::value): Do our best to handle a
15310         negative addend.
15311
15312         PR 6647
15313         * script.cc (Version_script_info::get_versions): Don't add empty
15314         version tag to return value.
15315         (Version_script_info::get_symbol_version_helper): Change return
15316         type to bool.  Add pversion parameter.  Change all callers.
15317         (script_register_vers_node): Don't require a non-NULL tag.
15318         * script.h (class Version_script_info): Update declarations.
15319         (Version_script_info::get_symbol_version): Change return type to
15320         bool.  Add version parameter.  Change all callers.
15321         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
15322         handling.  Handle an empty version from a version script.
15323         (Symbol_table::define_special_symbol): Likewise.
15324         * testsuite/ver_test_10.script: New file.
15325         * testsuite/ver_test_10.sh: New file.
15326         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
15327         (check_DATA): Add ver_test_10.syms.
15328         (ver_test_10.syms, ver_test_10.so): New target.
15329         * testsuite/Makefile.in: Rebuild.
15330
15331 2008-07-23  Simon Baldwin  <simonb@google.com>
15332
15333         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
15334         to zero for undefined symbols from dynamic libraries.
15335
15336 2008-07-23  Ian Lance Taylor  <iant@google.com>
15337
15338         * symtab.cc (Symbol_table::resolve): Remove version parameter.
15339         Change all callers.
15340         * symtab.h (class Symbol_table): Update declaration.
15341         * testsuite/ver_test_9.cc: New file.
15342         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
15343         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
15344         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
15345         (ver_test_9.so, ver_test_9.o): New targets.
15346         * testsuite/Makefile.in: Rebuild.
15347
15348 2008-07-22  Ian Lance Taylor  <iant@google.com>
15349
15350         * options.h (class General_options): Define --check-sections.
15351         * layout.cc (Layout::set_segment_offsets): Handle
15352         --check-sections.
15353
15354         * options.h (class General_options): Define -n/--nmagic and
15355         -N/--omagic.
15356         * options.cc (General_options::finalize): For -n/--nmagic or
15357         -N/--omagic, set -static.
15358         * layout.cc (Layout::attach_allocated_section_to_segment): If
15359         -N/--omagic, don't put read-only and read-write sections in
15360         different segments.
15361         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
15362         finding a read-only segment.
15363         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
15364         don't set the minimum segment alignment to the common page size,
15365         and don't set the file offset to the address modulo the page size.
15366         * script-sections.cc (Script_sections::create_segments): If
15367         -n/--omagic, don't put read-only and read-write sections in
15368         different segments.
15369
15370         * cref.cc: New file.
15371         * cref.h: New file.
15372         * options.h (class General_options): Add --print-symbol-counts.
15373         * main.cc (main): Issue defined symbol report if requested.
15374         * archive.cc (Archive::interpret_header): Make into a const member
15375         function.
15376         (Archive::add_symbols): Call Input_objects::archive_start and
15377         archive_stop.
15378         (Archive::const_iterator): Define new class.
15379         (Archive::begin, Archive::end): New functions.
15380         (Archive::include_all_members): Rewrite to use iterator.
15381         (Archive::count_members): New function.
15382         * archive.h (class Archive): Update declarations.
15383         (Archive::filename): New function.
15384         * object.cc: Include "cref.h".
15385         (Sized_relobj::Sized_relobj): Initialize defined_count_.
15386         (Sized_relobj::do_get_global_symbol_counts): New function.
15387         (Input_objects::add_object): Add object to cross-referencer.
15388         (Input_objects::archive_start): New function.
15389         (Input_objects::archive_stop): New function.
15390         (Input_objects::print_symbol_counts): New function.
15391         * object.h: Declare Cref and Archive.
15392         (Object::get_global_symbol_counts): New function.
15393         (Object::do_get_global_symbol_counts): New pure virtual function.
15394         (class Sized_relobj): Add defined_count_ field.  Update
15395         declarations.
15396         (class Input_objects): Add cref_ field.  Update constructor.
15397         Update declarations.
15398         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
15399         defined_count_.
15400         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
15401         symbol counts.
15402         (Sized_dynobj::do_get_global_symbol_counts): New function.
15403         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
15404         defined_count_.  Update declarations.  Define Symbols typedef.
15405         * symtab.cc (Symbol_table::add_from_relobj): Add defined
15406         parameter.  Change all callers.
15407         (Symbol_table::add_from_dynobj): Add sympointers and defined
15408         parameters.  Change all callers.
15409         * symtab.h (class Symbol_table): Update declarations.
15410         * Makefile.am (CCFILES): Add cref.cc.
15411         (HFILES): Add cref.h.
15412         * Makefile.in: Rebuild.
15413
15414 2008-07-22  Simon Baldwin  <simonb@google.com>
15415
15416         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
15417         to zero when writing undefined symbols.
15418
15419 2008-07-22  Ian Lance Taylor  <iant@google.com>
15420
15421         * output.cc (Output_section::add_input_section): Don't try to
15422         merge empty merge sections.
15423
15424 2008-07-21  Craig Silverstein  <csilvers@google.com>
15425
15426         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15427         Include symbol version in error message.
15428
15429 2008-07-20  Chris Demetriou  <cgd@google.com>
15430
15431         * configure.ac (gold_cv_c_random_seed): New configured variable.
15432         (RANDOM_SEED_CFLAGS): New substituted variable.
15433         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
15434         * configure: Rebuild.
15435         * Makefile.in: Likewise.
15436         * testsuite/Makefile.in: Likewise.
15437
15438 2008-07-18  Ian Lance Taylor  <iant@google.com>
15439
15440         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
15441         where we see NAME/NULL and NAME/VERSION  as separate symbols.
15442         * testsuite/ver_test_main.cc (main): Call t4.
15443         (t4, t4_2a): Define.
15444         * testsuite/ver_test_2.cc (t4_2): Define.
15445         * testsuite/ver_test_2.script: Put t4_2a in VER2.
15446         * testsuite/ver_test_4.cc (t4_2a): Define.
15447         * testsuite/ver_test_4.script: Put t4_2a in VER2.
15448         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
15449
15450 2008-07-17  Ian Lance Taylor  <iant@google.com>
15451
15452         * dynobj.cc (Versions::add_def): If we give an error about a
15453         missing version, go ahead and create the version anyhow.
15454
15455 2008-07-10  Ian Lance Taylor  <iant@google.com>
15456
15457         Handle output sections with more than 0x7fffffff bytes.
15458         * object.h (class Relobj): Change map_to_output_ to
15459         output_sections_, and just keep a section pointer.  Change all
15460         uses.  Move comdat group support to Sized_relobj.
15461         (Relobj::is_section_specially_mapped): Remove.
15462         (Relobj::output_section): Remove poff parameter.  Change all
15463         callers.
15464         (Relobj::output_section_offset): New function.
15465         (Relobj::set_section_offset): Rewrite.
15466         (Relobj::map_to_output): Remove.
15467         (Relobj::output_sections): New function.
15468         (Relobj::do_output_section_offset): New pure virtual function.
15469         (Relobj::do_set_section_offset): Likewise.
15470         (class Sized_relobj): Add section_offsets_ field.  Add comdat
15471         group support from Relobj.  Update declarations.
15472         (Sized_relobj::get_output_section_offset): New function.
15473         (Sized_relobj::do_output_section_offset): New function.
15474         (Sized_relobj::do_set_section_offset): New function.
15475         * object.cc (Relobj::output_section_address): Remove.
15476         (Sized_relobj::Sized_relobj): Initialize new fields.
15477         (Sized_relobj::include_section_group): Cast find_kept_object to
15478         Sized_relobj.
15479         (Sized_relobj::include_linkonce_section): Likewise.
15480         (Sized_relobj::do_layout): Use separate arrays for output section
15481         and output offset.
15482         (Sized_relobj::do_count_local_symbols): Change map_to_output to
15483         output_sections.
15484         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
15485         output_sections and section_offsets.
15486         (Sized_relobj::write_local_symbols): Likewise.
15487         (map_to_kept_section): Compute output address directly.
15488         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
15489         output_sections and section_offsets.
15490         (Sized_relobj::write_sections): Likewise.
15491         (Sized_relobj::relocate_sections): Likewise.
15492         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
15493         * output.h (class Output_reloc): Update declarations.  Change
15494         u2_.relobj to Sized_relobj*.
15495         (class Output_data_reloc): Change add functions to use
15496         Sized_relobj*.
15497         * output.cc (Output_reloc::Output_reloc): Change relobj to
15498         Sized_relobj*.
15499         (Output_reloc::local_section_offset): Change return type to
15500         Elf_Addr.  Use get_output_section_offset.
15501         (Output_reloc::get_address): Likewise.
15502         (Output_section::is_input_address_mapped): Don't call
15503         is_section_specially_mapped.
15504         (Output_section::output_offset): Likewise.
15505         (Output_section::output_address): Likewise.
15506         (Output_section::starting_output_address): Likewise.
15507         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
15508         parameter to Sized_relobj*.
15509         (Copy_relocs::need_copy_reloc): Likewise.
15510         (Copy_relocs::save): Likewise.
15511         * copy-relocs.h (class Copy_relocs): Update declarations.
15512         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
15513         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
15514         * target-reloc.h (relocate_for_relocatable): Change
15515         offset_in_output_section type to Elf_Addr.  Change code that uses
15516         it as well.
15517         * layout.cc (Layout::layout): Always set *off.
15518         * mapfile.cc (Mapfile::print_input_section): Use
15519         output_section_offset.
15520         * i386.cc (Target_i386::copy_reloc): Change object parameter to
15521         Sized_relobj*.
15522         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
15523         * sparc.cc (Target_sparc::copy_reloc): Likewise.
15524         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
15525
15526 2008-07-03  Ian Lance Taylor  <iant@google.com>
15527
15528         * layout.cc (Layout::include_section): Do not discard unrecognized
15529         SHT_STRTAB sections.
15530
15531 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
15532
15533         * script.cc (Lex::can_continue_name): Make '?' allowable in
15534         version-script names.
15535         * testsuite/version_script.map: Change glob pattern to use '?'
15536
15537 2008-06-30  Manish Singh  <yosh@gimp.org>
15538
15539         PR 6585
15540         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
15541         Correct typo.
15542
15543 2008-06-30  Ian Lance Taylor  <iant@google.com>
15544
15545         PR 6660
15546         PR 6682
15547         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
15548         versions]: Don't try to read the value in the contents, since we
15549         don't use it.  Use the template endianness when writing.
15550
15551 2008-06-25  Cary Coutant  <ccoutant@google.com>
15552
15553         * fileread.cc (File_read::make_view): Assert on zero-length view.
15554         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
15555         symbol table when there are no symbols to read.
15556
15557 2008-06-23  Craig Silverstein  <csilvers@google.com>
15558
15559         * version.cc (version_string): Bump to 1.7
15560
15561 2008-06-18  Craig Silverstein  <csilvers@google.com>
15562
15563         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
15564         constant 0xFFFF to type Valtype.
15565         (Powerpc_relocate_functions::rel16_ha): Likewise.
15566
15567 2008-06-17  Ian Lance Taylor  <iant@google.com>
15568
15569         * output.h (Output_section::Input_section): Initialize p2align_ to
15570         zero for Output_section_data constructors.
15571         (Output_section::Input_section::addralign): If not an input
15572         section, return the alignment of the Output_section_data.
15573         * testsuite/copy_test.cc: New file.
15574         * testsuite/copy_test_1.cc: New file.
15575         * testsuite/copy_test_2.cc: New file.
15576         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
15577         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
15578         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
15579         (copy_test_1_pic.o, copy_test_1.so): New targets.
15580         (copy_test_2_pic.o, copy_test_2.so): New targets.
15581         * testsuite/Makefile.in: Rebuild.
15582
15583         * script-sections.cc (Script_sections::place_orphan): Initialize
15584         local variable exact.
15585
15586 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
15587
15588         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
15589
15590 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
15591             David S. Miller  <davem@davemloft.net>
15592
15593         * powerpc.cc: New file.
15594         * Makefile.am (TARGETSOURCES): Add powerpc.cc
15595         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
15596         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
15597         * Makefile.in: Rebuild.
15598
15599 2008-06-09  Ian Lance Taylor  <iant@google.com>
15600
15601         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
15602         <exception>.
15603         (throwing, orig_terminate): New static variables.
15604         (terminate_handler): New static function.
15605         (t2): Set terminate handler.
15606
15607 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
15608
15609         PR 6584
15610         * binary.cc (Binary_to_elf::sized_convert): Fix .data
15611         alignment.
15612
15613 2008-05-30  Cary Coutant  <ccoutant@google.com>
15614
15615         * archive.cc (Archive::include_all_members) Correct to step
15616         over symbol table and extended name table in thin archives.
15617
15618 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
15619
15620         PR 6407
15621         * target-reloc.h (relocate_for_relocatable): Fix new_offset
15622         calculation.
15623
15624 2008-05-28  Caleb Howe  <cshowe@google.com>
15625
15626         * reduced_debug_output.cc: New file.
15627         * reduced_debug_output.h: New file.
15628         * options.h (class General_options): Add --strip-debug-non-line.
15629         * options.cc (General_options::finalize): Add strip_debug_non_line
15630         to the strip heirarchy.
15631         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
15632         fields.
15633         * layout.cc: Include "reduced_debug_output.h".
15634         (Layout::Layout): Initialize new fields.
15635         (line_only_debug_sections): New static array.
15636         (is_lines_only_debug_sections): New static inline function.
15637         (Layout::include_section): Handle --strip-debug-non-line.
15638         (Layout::make_output_section): If --strip-debug-non-line, build
15639         new output sections for .debug_abbrev and .debug_info.
15640         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
15641         gold.  Warn about possible overflow.
15642         (read_signed_LEB_128): Likewise.
15643         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
15644         (read_signed_LEB_128): Declare.
15645         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
15646         (HFILES): Add reduced_debug_output.h.
15647         * Makefile.in: Rebuild.
15648
15649 2008-05-21  Ian Lance Taylor  <iant@google.com>
15650
15651         * mapfile.cc: New file.
15652         * mapfile.h: New file.
15653         * options.h (class General_options): Add -M/--print-map and -Map.
15654         * options.cc (General_options::finalize): Make -M equivalent to
15655         -Map -.
15656         * main.cc: Include <cstdio> and "mapfile.h".
15657         (main): Open mapfile if requested.
15658         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
15659         constructor.  Change caller.
15660         (queue_initial_tasks): Add mapfile parameter.  Change caller.
15661         (queue_middle_tasks): Likewise.
15662         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
15663         declarations.
15664         * archive.cc: Include "mapfile.h".
15665         (Archive::add_symbols): Add mapfile parameter.  Change all
15666         callers.  Pass mapfile, symbol, and reason to include_member.
15667         (Archive::include_all_members): Add mapfile parameter.  Change all
15668         callers.
15669         (Archive::include_member): Add mapfile, sym, and why parameters.
15670         Change all callers.  Report inclusion to map file.
15671         * archive.h: Include "fileread.h".
15672         (class Archive): Update declarations.
15673         (Archive::file): New const method.
15674         (class Add_archive_symbols): Add mapfile_ field.  Update
15675         constructor.  Change all callers.
15676         * readsyms.h (class Read_symbols): Likewise.
15677         (class Finish_group): Likewise.
15678         (class Read_script): Likewise.
15679         * common.cc: Include "mapfile.h".
15680         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
15681         all callers.
15682         (Symbol_table::do_allocate_commons): Likewise.
15683         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
15684         symbol allocation to mapfile.
15685         * common.h (class Allocate_commons_task): Add mapfile_ field.
15686         Update constructor.  Change all callers.
15687         * symtab.h (class Symbol_table): Update declarations.
15688         * layout.cc: Include "mapfile.h".
15689         (Layout_task_runner::run): Print information to mapfile.
15690         (Layout::create_gold_note): Change Output_data_fixed_space to
15691         Output_data_zero_fill.
15692         (Layout::create_build_id): Likewise.
15693         (Layout::print_to_mapfile): New function.
15694         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
15695         constructor.  Change caller.
15696         (class Layout): Declare print_to_mapfile.
15697         * output.cc (Output_section::Input_section::print_to_mapfile): New
15698         function.
15699         (Output_section::add_input_section): If producing a map, always
15700         add to input_sections_ list.
15701         (Output_section::do_print_to_mapfile): New function.
15702         (Output_segment::print_sections_to_mapfile): New function.
15703         (Output_segment::print_section_list_to_mapfile): New function.
15704         * output.h: Include "mapfile.h".
15705         (Output_data::print_to_mapfile): New function.
15706         (Output_data::do_print_to_mapfile): New virtual function.
15707         (Output_segment_headers::do_print_to_mapfile): New function.
15708         (Output_file_header::do_print_to_mapfile): New function.
15709         (Output_data_const::do_print_to_mapfile): New function.
15710         (class Output_data_const_buffer): Add map_name_ field.  Update
15711         constructor.  Change all callers.  Add do_print_to_mapfile
15712         function.
15713         (class Output_data_fixed_space): Likewise.
15714         (class Output_data_space): Likewise.
15715         (class Output_data_zero_fill): New class.
15716         (Output_data_strtab::do_print_to_mapfile): New function.
15717         (Output_data_reloc_base::do_print_to_mapfile): New function.
15718         (Output_relocatable_relocs::do_print_to_mapfile): New function.
15719         (Output_data_group::do_print_to_mapfile): New function.
15720         (Output_data_got::do_print_to_mapfile): New function.
15721         (Output_data_dynamic::do_print_to_mapfile): New function.
15722         (Output_symtab_xindex::do_print_to_mapfile): New function.
15723         (class Output_section): Declare do_print_to_mapflie.  Declare
15724         print_to_mapfile in Input_section.
15725         (class Output_segment): Declare new functions.
15726         * object.h (Sized_relobj::symbol_count): New function.
15727         * script-sections.cc
15728         (Output_section_element_dot_assignment::set_section_addresses):
15729         Change Output_data_fixed_space to Output_data_zero_fill.
15730         (Output_data_expression::do_print_to_mapfile): New function.
15731         * script.cc (read_input_script): Add mapfile parameter.  Change
15732         all callers.
15733         * script.h (read_input_script): Update declaration.
15734         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
15735         (Eh_frame::do_print_to_mapfile): New function.
15736         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
15737         (Output_merge_string::do_print_to_mapfile): New function.
15738         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
15739         function.
15740         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
15741         function.
15742         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
15743         function.
15744         * Makefile.am (CCFILES): Add mapfile.cc.
15745         (HFILES): Add mapfile.h.
15746         * Makefile.in: Rebuild.
15747
15748 2008-05-19  Ian Lance Taylor  <iant@google.com>
15749
15750         * options.h (class General_options): Add -z relro.
15751         * layout.cc (Layout::Layout): Initialize relro_segment_.
15752         (Layout::add_output_section_data): Return the output section.
15753         (Layout::make_output_section): Rcognize relro sections and mark
15754         them appropriately.
15755         (Layout::attach_allocated_section_to_segment): Put relro sections
15756         in a PT_GNU_RELRO segment.
15757         (Layout::create_initial_dynamic_sections): Mark the .dynamic
15758         section as relro.
15759         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
15760         PT_TLS segments.
15761         (Layout::linkonce_mapping): Map d.rel.ro.local to
15762         .data.rel.ro.local.
15763         (Layout::output_section_name): Us .data.rel.ro.local for any
15764         section which begins with that.
15765         * layout.h (class Layout): Update add_output_section_data
15766         declaration.  Add relro_segment_ field.
15767         * output.cc (Output_section::Output_section): Initialize is_relro_
15768         and is_relro_local_ fields.
15769         (Output_segment::add_output_section): Group relro sections.
15770         (Output_segment::is_first_section_relro): New function.
15771         (Output_segment::maximum_alignment): If there is a relro section,
15772         align the segment to the common page size.
15773         (Output_segment::set_section_addresses): Track whether we are
15774         looking at relro sections.  If the last section is a relro
15775         section, align to the common page size.
15776         (Output_segment::set_section_list_addresses): Add in_relro
15777         parameter.  Change all callers.  Align to the page size when
15778         moving from relro to non-relro section.
15779         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
15780         segment.
15781         * output.h (class Output_section): Add is_relro_ and
15782         is_relro_local_ fields.
15783         (Output_section::is_relro): New function.
15784         (Output_section::set_is_relro): New function.
15785         (Output_section::is_relro_local): New function.
15786         (Output_section::set_is_relro_local): New function.
15787         (class Output_segment): Update declarations.
15788         * i386.cc (Target_i386::got_section): Mark .got section as relro.
15789         * sparc.cc (Target_sparc::got_section): Likewise.
15790         * x86_64.cc (Target_x86_64::got_section): Likewise.
15791         * testsuite/relro_test_main.cc: New file.
15792         * testsuite/relro_test.cc: New file.
15793         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
15794         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
15795         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
15796         (relro_test.so, relro_test_pic.o): New targets.
15797         * testsuite/Makefile.in: Rebuild.
15798
15799 2008-05-16  Ian Lance Taylor  <iant@google.com>
15800
15801         * output.cc (Output_segment::add_output_section): Remove front
15802         parameter.
15803         * output.h (class Output_segment): Remove
15804         add_initial_output_section and overloaded add_output_section.
15805         Update declaration of remaining add_output_section.
15806         * layout.cc (Layout::create_interp): Call add_output_section
15807         rather than add_initial_output_section.
15808         (Layout::finish_dynamic_section): Likewise.
15809
15810         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
15811         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
15812         know the dynamic type.
15813         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
15814         field.  Initialize it in constructor.
15815         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
15816         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
15817         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
15818         reloc.
15819
15820         * output.cc (Output_reloc::get_address): Change return type to
15821         Elf_Addr.
15822         * output.h (class Output_reloc): Update get_address declaration.
15823         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
15824         for section addresses.
15825
15826 2008-05-09  Ian Lance Taylor  <iant@google.com>
15827
15828         PR 6493
15829         * gold.cc (gold_nomem): Use return value of write.
15830
15831 2008-05-08  Ian Lance Taylor  <iant@google.com>
15832
15833         * symtab.c (Symbol::init_base_output_data): Add version
15834         parameter.  Change all callers.
15835         (Symbol::init_base_output_segment): Likewise.
15836         (Symbol::init_base_constant): Likewise.
15837         (Symbol::init_base_undefined): Likewise.
15838         (Sized_symbol::init_output_data): Likewise.
15839         (Sized_symbol::init_output_segment): Likewise.
15840         (Sized_symbol::init_constant): Likewise.
15841         (Sized_symbol::init_undefined): Likewise.
15842         (Symbol_table::do_define_in_output_data): If the new symbol has a
15843         version, mark it as the default.
15844         (Symbol_table::do_define_in_output_segment): Likewise.
15845         (Symbol_table::do_define_as_constant): Likewise.
15846         * symtab.h (class Symbol): Update declarations.
15847         (class Sized_symbol): Likewise.
15848         * resolve.cc (Symbol::override_version): New function.
15849         (Symbol::override_base): Call override_version.
15850         (Symbol::override_base_with_special): Likewise.
15851         * testsuite/ver_script_8.script: New file.
15852         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
15853         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
15854         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
15855         (ver_test_8_1.so, ver_test_8_2.so): New targets.
15856
15857 2008-05-06  Ian Lance Taylor  <iant@google.com>
15858
15859         PR 6049
15860         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
15861         functions.
15862         (class General_options): Remove existing --undefined, and add
15863         --no-undefined instead.  Add new --undefined as synonym for -u.
15864         * archive.cc (Archive::add_symbols): Check whether symbol was
15865         named with -u.
15866         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
15867         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
15868         all uses.  Add IS_UNDEFINED.  Update declarations to split
15869         different versions of init_base.  Declare init_base_undefined.
15870         (Symbol::is_defined): Handle IS_UNDEFINED.
15871         (Symbol::is_undefined): Likewise.
15872         (Symbol::is_weak_undefined): Call is_undefined.
15873         (Symbol::is_absolute): Handle IS_CONSTANT.
15874         (class Sized_symbol): Update declarations to split different
15875         versions of init.  Declare init_undefined.
15876         (class Symbol_table): Declare new functions.
15877         * symtab.cc (Symbol::init_base_object): Rename from init_base.
15878         Change all callers.
15879         (Symbol::init_base_output_data): Likewise.
15880         (Symbol::init_base_output_segment): Likewise.
15881         (Symbol::init_base_constant): Likewise.
15882         (Symbol::init_base_undefined): New function.
15883         (Sized_symbol::init_object): Rename from init.  Change all
15884         callers.
15885         (Sized_symbol::init_output_data): Likewise.
15886         (Sized_symbol::init_output_segment): Likewise.
15887         (Sized_symbol::init_constant): Likewise.
15888         (Sized_symbol::init_undefined): New function.
15889         (Symbol_table::add_undefined_symbols_from_command_line): New
15890         function.
15891         (Symbol_table::do_add_undefined_symbols_from_command_line): New
15892         function.
15893         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
15894         (Symbol::output_section): Likewise.
15895         (Symbol::set_output_section): Likewise.
15896         (Symbol_table::sized_finalize_symbol): Likewise.
15897         (Symbol_table::sized_write_globals): Likewise.
15898         * resolve.cc (Symbol_table::should_override): Likewise.
15899         (Symbol::override_base_with_special): Likewise.
15900
15901         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
15902         symbol, change it to have default visibility.
15903         * testsuite/protected_1.cc: New file.
15904         * testsuite/protected_2.cc: New file.
15905         * testsuite/protected_3.cc: New file.
15906         * testsuite/protected_main_1.cc: New file.
15907         * testsuite/protected_main_2.cc: New file.
15908         * testsuite/protected_main_3.cc: New file.
15909         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
15910         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
15911         (protected_1_LDFLAGS, protected_1_LDADD): Define.
15912         (protected_1.so): New target.
15913         (protected_1_pic.o, protected_2_pic.o): New targets.
15914         (protected_3_pic.o): New target.
15915         (check_PROGRAMS): Add protected_2.
15916         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
15917         (protected_2_LDFLAGS, protected_2_LDADD): Define.
15918         * testsuite/Makefile.in: Rebuild.
15919
15920         * options.h (DEFINE_var): Add set_user_set_##varname__.
15921         (DEFINE_bool_alias): New macro.
15922         (class General_options): Define -Bstatic using DEFINE_bool_alias
15923         rather than DEFINE_special.  Add --undefined as an alias for -z
15924         defs.
15925         * options.cc (General_options::parse_Bstatic): Remove.
15926
15927         * options.h (class General_options): Add --fatal-warnings.
15928         * main.cc (main): Implement --fatal-warnings.
15929         * errors.h (Errors::warning_count): New function.
15930
15931         * options.h (class General_options): Add -Bsymbolic-functions.
15932         * symtab.h (Symbol::is_preemptible): Check for
15933         -Bsymbolic-functions.
15934
15935 2008-05-05  Ian Lance Taylor  <iant@google.com>
15936
15937         * options.h (DEFINE_bool): For DASH_Z, create the negative option
15938         as noVARNAME rather than no-VARNAME.
15939         (class General_options): Add option -z combreloc.
15940         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15941         get_address.
15942         (Output_reloc::sort_before) [SHT_REL]: New function.
15943         (Output_reloc::sort_before) [SHT_RELA]: New function.
15944         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
15945         Sort_relocs_comparison.
15946         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15947         parameter.  Change all callers.
15948         (Output_data_reloc::Output_data_reloc) [both versions]: Add
15949         sort_relocs parameter.  Change all callers.
15950         * output.cc (Output_reloc::get_address): New function, broken out
15951         of write_rel.
15952         (Output_reloc::write_rel): Call it.
15953         (Output_reloc::compare): New function.
15954         (Output_data_reloc_base::do_write): Optionally sort relocs.
15955
15956         * configure.ac: If targ_extra_obj is set, link it in.
15957         * configure.tgt: Initialize all variables.
15958         (x86_64*): Set targ_extra_obj and targ_extra_size.
15959         * configure: Rebuild.
15960
15961         * object.cc (Sized_relobj::include_section_group): Adjust section
15962         indexes read from group data.  Build vector to pass to
15963         layout_group.
15964         * layout.cc (Layout::layout_group): Add flags and shndxes
15965         parameters.  Remove contents parameter.  Change caller.  Update
15966         explicit instantiations.
15967         * layout.h (class Layout): Update layout_group declaration.
15968         * output.cc (Output_data_group::Output_data_group): Add flags and
15969         input_shndxes parameters.  Remove contents parameter.  Change
15970         caller.
15971         (Output_data_group::do_write): Change input_sections_ to
15972         input_shndxes_.
15973         * output.h (class Output_data_group): Update constructor
15974         declaration.  Rename input_sections_ to input_shndxes_.
15975         * testsuite/many_sections_test.cc: Add template.
15976
15977 2008-04-30  Cary Coutant  <ccoutant@google.com>
15978
15979         * target-reloc.h (relocate_section): Fix dead-pointer bug.
15980
15981         * layout.cc (Layout::include_section): Refactored check for debug
15982         info section.
15983         (Layout::add_comdat): Add new parameters.  Change type
15984         of signature parameter.  Add object and shndx to signatures table.
15985         (Layout::find_kept_object): New function.
15986         * layout.h: Include <cstring>.
15987         (Layout::is_debug_info_section): New function.
15988         (Layout::add_comdat): Add new parameters.
15989         (Layout::find_kept_object): New function.
15990         (Layout::Kept_section): New struct.
15991         (Layout::Signatures): Change type of map range.
15992         * object.cc (Relobj::output_section_address): New function.
15993         (Sized_relobj::include_section_group): Add new parameters.  Change
15994         calls to Layout::add_comdat.  Change to build table of kept comdat
15995         groups and table mapping discarded sections to kept sections.
15996         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
15997         (Sized_relobj::do_layout): Change calls to include_section_group and
15998         include_linkonce_section.
15999         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
16000         value to zero when section is discarded.
16001         (Sized_relobj::map_to_kept_section): New function.
16002         * object.h (Relobj::output_section_address): New function.
16003         (Relobj::Comdat_group): New type.
16004         (Relobj::find_comdat_group): New function.
16005         (Relobj::Comdat_group_table): New type.
16006         (Relobj::Kept_comdat_section): New type.
16007         (Relobj::Kept_comdat_section_table): New type.
16008         (Relobj::add_comdat_group): New function.
16009         (Relobj::set_kept_comdat_section): New function.
16010         (Relobj::get_kept_comdat_section): New function.
16011         (Relobj::comdat_groups_): New field.
16012         (Relobj::kept_comdat_sections_): New field.
16013         (Symbol_value::input_value): Update comment.
16014         (Sized_relobj::map_to_kept_section) New function.
16015         (Sized_relobj::include_linkonce_section): Add new parameter.
16016         * target-reloc.h (Comdat_behavior): New type.
16017         (get_comdat_behavior): New function.
16018         (relocate_section): Add code to map a discarded section to the
16019         corresponding kept section when applying a relocation.
16020
16021 2008-04-30  Craig Silverstein  <csilvers@google.com>
16022
16023         * dwarf_reader.cc (next_generation_count): New static var.
16024         (Addr2line_cache_entry): New struct.
16025         (addr2line_cache): New static var.
16026         (Dwarf_line_info::one_addr2line): Added caching.
16027         (Dwarf_line_info::clear_addr2line_cache): New function.
16028         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
16029         cache-size parameter.
16030         (Dwarf_line_info::one_addr2line_cache): New function.
16031         * symtab.cc (Symbol_table::detect_odr_violations): Pass
16032         new cache-size argument to one_addr2line(), and clear cache.
16033
16034 2008-04-28  Cary Coutant  <ccoutant@google.com>
16035
16036         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
16037         R_386_PC8 relocations.
16038
16039 2008-04-23  Ian Lance Taylor  <iant@google.com>
16040
16041         * object.cc (Sized_relobj::include_section_group): Check for
16042         invalid section group.
16043
16044         * object.cc (make_elf_object): Correct test for 64-bit ELF file
16045         header size.
16046
16047         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
16048         than read for file header.
16049         * archive.cc (Archive::include_member): Likewise.
16050
16051 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
16052
16053         * aclocal.m4: Regenerate.
16054         * configure: Regenerate.
16055
16056 2008-04-19  Ian Lance Taylor  <iant@google.com>
16057
16058         * version.cc (version_string): Bump to 1.6.
16059
16060         * testsuite/Makefile.am (many_sections_r_test): New target.
16061         (many_sections_r_test_SOURCES): Remove.
16062         (many_sections_r_test_DEPENDENCIES): Remove.
16063         (many_sections_r_test_LDFLAGS): Remove.
16064         (many_sections_r_test_LDADD): Remove.
16065
16066         * object.cc (Sized_relobj::do_add_symbols): Always pass
16067         local_symbol_count_ to add_from_relobj.
16068
16069         * testsuite/Makefile.am (many_sections_check.h): Only check one in
16070         every thousand variables.
16071         * testsuite/Makefile.in: Rebuild.
16072
16073         * object.cc (Xindex::initialize_symtab_xindex): New function.
16074         (Xindex::read_symtab_xindex): New function.
16075         (Xindex::sym_xindex_to_shndx): New function.
16076         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
16077         available.
16078         (Sized_relobj::do_initialize_xindex): New function.
16079         (Sized_relobj::do_read_symbols): Adjust section links.
16080         (Sized_relobj::symbol_section_and_value): Add is_ordinary
16081         parameter.  Change all callers.
16082         (Sized_relobj::include_section_group): Adjust section links and
16083         symbol section indexes.
16084         (Sized_relobj::do_layout): Adjust section links.
16085         (Sized_relobj::do_count_local_symbols): Adjust section links and
16086         symbol section indexes.
16087         (Sized_relobj::do_finalize_local_symbols): Distinguish between
16088         ordinary and special symbols.
16089         (Sized_relobj::write_local_symbols): Add symtab_xindex and
16090         dynsym_xindex parameters.  Change all callers.  Adjust section
16091         links.  Use SHN_XINDEX when needed.
16092         (Sized_relobj::get_symbol_location_info): Adjust section links.
16093         Don't get fooled by special symbols.
16094         * object.h (class Xindex): Define.
16095         (class Object): Add xindex_ parameter.  Declare virtual functoin
16096         do_initialize_xindex.
16097         (Object::adjust_sym_shndx): New function.
16098         (Object::set_xindex): New protected function.
16099         (class Symbol_value): Add is_ordinary_shndx_ field.
16100         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
16101         (Symbol_value::value): Assert ordinary section.
16102         (Symbol_value::initialize_input_to_output_map): Likewise.
16103         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
16104         Change all callers.
16105         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
16106         all callers.
16107         (class Sized_relobj): Update declarations.
16108         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
16109         parameter.  Change all callers.
16110         (Sized_relobj::adjust_shndx): New function.
16111         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
16112         field.
16113         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
16114         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
16115         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
16116         (Sized_dynobj::read_dynsym_section): Adjust section links.
16117         (Sized_dynobj::read_dynamic): Likewise.
16118         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
16119         section links.
16120         (Sized_dynobj::do_initialize_xindex): New function.
16121         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
16122         do_initialize_xindex.
16123         (Sized_dynobj::adjust_shndx): New function.
16124         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
16125         dynsym_xindex_ fields.
16126         (Layout::finalize): Add a call to set_section_indexes before
16127         creating the symtab sections.
16128         (Layout::set_section_indexes): Don't do anything if the section
16129         already has a section index.
16130         (Layout::create_symtab_sections): Add shnum parameter.  Change
16131         caller.  Create .symtab_shndx section if needed.
16132         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
16133         caller.
16134         (Layout::allocated_output_section_count): New function.
16135         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
16136         needed.
16137         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
16138         fields.  Update declarations.
16139         (Layout::symtab_xindex): New function.
16140         (Layout::dynsym_xindex): New function.
16141         (class Write_symbols_task): Add layout_ field.
16142         (Write_symbols_task::Write_symbols_task): Add layout parameter.
16143         Change caller.
16144         * output.cc (Output_section_headers::Output_section_headers): Add
16145         shstrtab_section parameter.  Change all callers.
16146         (Output_section_headers::do_sized_write): Store overflow values
16147         for section count and section string table section index in
16148         section header zero.
16149         (Output_file_header::do_sized_write): Check for overflow of
16150         section count and section string table section index.
16151         (Output_symtab_xindex::do_write): New function.
16152         (Output_symtab_xindex::endian_do_write): New function.
16153         * output.h (class Output_section_headers): Add shstrtab_section_.
16154         Update declarations.
16155         (class Output_symtab_xindex): Define.
16156         (Output_section::has_out_shndx): New function.
16157         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
16158         field.
16159         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
16160         Change all callers.
16161         (Sized_symbol::init): Likewise.
16162         (Symbol::output_section): Check for ordinary symbol.
16163         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
16164         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
16165         callers.
16166         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
16167         Change all callers.  Simplify handling of symbols from sections
16168         not included in the link.
16169         (Symbol_table::add_from_dynobj): Handle ordinary symbol
16170         distinction.
16171         (Weak_alias_sorter::operator()): Assert that symbols are
16172         ordinary.
16173         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
16174         distinction.
16175         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
16176         parameters.  Change all callers.
16177         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
16178         symbol distinction.  Use SHN_XINDEX when needed.
16179         (Symbol_table::write_section_symbol): Add symtab_xindex
16180         parameter.  Change all callers.
16181         (Symbol_table::sized_write_section_symbol): Likewise.  Use
16182         SHN_XINDEX when needed.
16183         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
16184         declarations.
16185         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
16186         (Symbol::is_defined): Check is_ordinary.
16187         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
16188         (Symbol::is_absolute, Symbol::is_common): Likewise.
16189         (class Sized_symbol): Update declarations.
16190         (class Symbol_table): Update declarations.
16191         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
16192         parameters.  Change all callers.
16193         (Sized_symbol::override): Likewise.
16194         (Symbol_table::override): Likewise.
16195         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
16196         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
16197         is_ordinary, and orig_st_shndx parameters.  Change all callers.
16198         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
16199         to be in an ordinary section.
16200         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
16201         object and is_ordinary parameters.  Change all callers.
16202         (Sized_dwarf_line_info::read_relocs): Add object parameter.
16203         Change all callers.  Don't add undefined or non-ordinary symbols
16204         to reloc_map_.
16205         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
16206         Change all callers.
16207         * dwarf_reader.h (class Sized_dwarf_line_info): Update
16208         declarations.
16209         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
16210         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
16211         (Sized_relobj::relocate_sections): Likewise.
16212         * target-reloc.h (scan_relocs): Adjust section symbol index.
16213         (scan_relocatable_relocs): Likewise.
16214         * i386.cc (Scan::local): Check for ordinary symbols.
16215         * sparc.cc (Scan::local): Likewise.
16216         * x86_64.cc (Scan::local): Likewise.
16217         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
16218         to symbol_section_and_value.
16219         * testsuite/many_sections_test.cc: New file.
16220         * testsuite/Makefile.am (BUILT_SOURCES): Define.
16221         (check_PROGRAMS): Add many_sections_test.
16222         (many_sections_test_SOURCES): Define.
16223         (many_sections_test_DEPENDENCIES): Define.
16224         (many_sections_test_LDFLAGS): Define.
16225         (BUILT_SOURCES): Add many_sections_define.h.
16226         (many_sections_define.h): New target.
16227         (BUILT_SOURCES): Add many_sections_check.h.
16228         (many_sections_check.h): New target.
16229         (check_PROGRAMS): Add many_sections_r_test.
16230         (many_sections_r_test_SOURCES): Define.
16231         (many_sections_r_test_DEPENDENCIES): Define.
16232         (many_sections_r_test_LDFLAGS): Define.
16233         (many_sections_r_test_LDADD): Define.
16234         (many_sections_r_test.o): New target.
16235         * testsuite/Makefile.in: Rebuild.
16236
16237 2008-04-17  Cary Coutant  <ccoutant@google.com>
16238
16239         * errors.cc (Errors::info): New function.
16240         (gold_info): New function.
16241         * errors.h (Errors::info): New function.
16242         * gold.h (gold_info): New function.
16243         * object.cc (Input_objects::add_object): Print trace output.
16244         * options.cc (options::parse_set): New function.
16245         (General_options::parse_wrap): Deleted.
16246         (General_options::General_options): Deleted initializer.
16247         * options.h (options::String_set): New typedef.
16248         (options::parse_set): New function.
16249         (DEFINE_set): New macro.
16250         (General_options::wrap): Changed to use DEFINE_set. Changed
16251         callers of any_wrap_symbols and is_wrap_symbol.
16252         (General_options::trace, General_options::trace_symbol):
16253         New options.
16254         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
16255         (General_options::wrap_symbols_): Deleted.
16256         * symtab.cc (Symbol_table::add_from_object): Print trace output.
16257
16258 2008-04-17  David S. Miller  <davem@davemloft.net>
16259
16260         * options.cc (General_options::parse_V): New function.
16261         * options.h: Add entries for -V and -Qy.
16262
16263 2008-04-17  Ian Lance Taylor  <iant@google.com>
16264
16265         * common.cc (Symbol_table::allocate_commons): Remove options
16266         parameter.  Change caller.
16267         (Symbol_table::do_allocate_commons): Remove options parameter.
16268         Change caller.  Just call do_allocate_commons_list twice.
16269         (Symbol_table::do_allocate_commons_list): New function, broken out
16270         of do_allocate_commons.
16271         * common.h (class Allocate_commons_task): Remove options_ field.
16272         Update constructor.
16273         * symtab.cc (Symbol_table::Symbol_table): Initialize
16274         tls_commons_.
16275         (Symbol_table::add_from_object): Put TLS common symbols on
16276         tls_commons_ list.
16277         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
16278         which are IN_OUTPUT_DATA.
16279         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
16280         allocate_commons and do_allocate_commons declarations.  Declare
16281         do_allocate_commons_list.
16282         * gold.cc (queue_middle_tasks): Update creation of
16283         Allocate_commons_task to not pass options.
16284         * testsuite/Makefile.am (INCLUDES): Add -I.. .
16285         (TLS_TEST_C_FLAGS): New variable.
16286         (tls_test_c_pic.o): New target.
16287         (tls_test_shared.so): Link in tls_test_c_pic.o.
16288         (tls_test_c_pic_ie.o): New target.
16289         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
16290         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
16291         (tls_test_c.o): New target.
16292         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
16293         (tls_pic_test_LDADD): Likewise.
16294         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
16295         (tls_shared_gd_to_ie_test_LDADD): Likewise.
16296         (tls_test_c_gnu2.o): New target.
16297         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
16298         tls_test_c_gnu2.o.
16299         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
16300         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
16301         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
16302         * testsuite/tls_test.cc: Include "config.h".
16303         (t_last): Call t11_last.
16304         * testsuite/tls_test.h (t11, t11_last): Declare.
16305         * testsuite/tls_test_c.c: New file.
16306         * testsuite/tls_test_main.cc (thread_routine): Call t11.
16307         * configure.ac: Check for OpenMP support.
16308         * configure, config.in, Makefile.in: Rebuild.
16309         * testsuite/Makefile.in: Rebuild.
16310
16311 2008-04-16  Cary Coutant  <ccoutant@google.com>
16312
16313         * i386.cc (Target_i386::define_tls_base_symbol): New function.
16314         (Target_i386::tls_base_symbol_defined_): New field.
16315         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16316         (Target_i386::Scan::global): Likewise.
16317         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
16318         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
16319         (Target_x86_64::tls_base_symbol_defined_): New field.
16320         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16321         (Target_x86_64::Scan::global): Likewise.
16322
16323 2008-04-16  Cary Coutant  <ccoutant@google.com>
16324
16325         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
16326         (Symbol::needs_plt_entry): Allow weak undefined symbols.
16327         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
16328         building shared libraries.
16329         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
16330         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
16331         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
16332         * testsuite/Makefile.in: Rebuild.
16333         * testsuite/weak_undef.h: New file.
16334         * testsuite/weak_undef_file1.cc: Add extra test cases.
16335         * testsuite/weak_undef_file2.cc: Likewise.
16336         * testsuite/weak_undef_test.cc: Likewise.
16337
16338 2008-04-16  David S. Miller  <davem@davemloft.net>
16339
16340         * sparc.cc (Target_sparc::Scan): Change from struct to class.
16341         Add issued_non_pic_error_ field.  Declare check_non_pic.
16342         (Target_sparc::Scan::check_non_pic): New function.
16343         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
16344         (Target_sparc::Scan::global): Likewise.
16345
16346         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
16347         * configure: Rebuild.
16348
16349         * options.h (DEFINE_enable): New macro.
16350         (new_dtags): New enable option.
16351         (initfirst, interpose, loadfltr, nodefaultlib,
16352         nodelete, nodlopen, nodump): New -z options.
16353         * layout.cc (Layout:finish_dynamic_section): If new
16354         dtags enabled, emit DT_RUNPATH.  Also, emit a
16355         DT_FLAGS_1 containing any specified -z flags.
16356
16357 2008-04-16  Ian Lance Taylor  <iant@google.com>
16358
16359         * copy-relocs.cc: New file.
16360         * copy-relocs.h: New file.
16361         * reloc.cc: Remove Copy_relocs code.
16362         * reloc.h: Likewise.
16363         * reloc-types.h (struct Reloc_types) [both versions]: Add
16364         get_reloc_addend_noerror.
16365         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
16366         variants of add_global which take an addend which must be zero.
16367         * i386.cc: Include "copy-relocs.h".
16368         (class Target_i386): Change type of copy_relocs_ to variable,
16369         update initializer.
16370         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
16371         Change all callers.
16372         (Target_i386::do_finalize_sections): Change handling of
16373         copy_relocs_.
16374         * sparc.cc: Include "copy-relocs.h".
16375         (class Target_sparc): Change type of copy_relocs_ to variable,
16376         update initializer.
16377         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
16378         Change all callers.
16379         (Target_sparc::do_finalize_sections): Change handling of
16380         copy_relocs_.
16381         * x86_64.cc: Include "copy-relocs.h".
16382         (class Target_x86_64): Change type of copy_relocs_ to variable,
16383         update initializer.
16384         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
16385         class.  Change all callers.
16386         (Target_x86_64::do_finalize_sections): Change handling of
16387         copy_relocs_.
16388         * Makefile.am (CCFILES): Add copy-relocs.cc.
16389         (HFILES): Add copy-relocs.h.
16390
16391         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
16392
16393         * testsuite/script_test_4.sh: Permit leading zeroes.
16394
16395 2008-04-15  Ian Lance Taylor  <iant@google.com>
16396
16397         * script-sections.cc (Script_sections::create_segments): Use
16398         header_size_adjustment even when there is enough room for the
16399         headers.
16400         * testsuite/script_test_4.sh: New file.
16401         * testsuite/script_test_4.t: New file.
16402         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
16403         (check_DATA): Add script_test_4.stdout.
16404         (MOSTLYCLEANFILES): Likewise.
16405         (script_test_4): New target.
16406         (script_test_4.stdout): New target.
16407         * testsuite/Makefile.in: Rebuild.
16408
16409         * sparc.cc: Add definitions for Output_data_plt_sparc class
16410         constants.
16411
16412 2008-04-14  David S. Miller  <davem@davemloft.net>
16413
16414         * sparc.cc: New file.
16415         * Makefile.am (TARGETSOURCES): Add sparc.cc
16416         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
16417         * configure.tgt: Document targ_extra_size and
16418         targ_extra_big_endian.  Add entries for sparc-* and
16419         sparc64-*.
16420         * configure.ac: Handle targ_extra_size and
16421         targ_extra_big_endian.
16422         * Makefile.in: Rebuild.
16423         * configure: Likewise.
16424         * po/POTFILES.in: Likewise.
16425         * po/gold.pot: Likewise.
16426
16427 2008-04-14  Ian Lance Taylor  <iant@google.com>
16428
16429         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
16430         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
16431         in the name/type/flags to section mapping.  Don't call
16432         allocate_output_section.
16433         (Layout::choose_output_section): Change parameter from adjust_name
16434         to is_input_section.  Don't permit input sections after sections
16435         are attached to segments.  Don't call allocate_output_section.
16436         (Layout::layout_eh_frame): Call update_flags_for_input_section,
16437         not write_enable_output_section.
16438         (Layout::make_output_section): Don't push to
16439         unattached_section_list_ nor call attach_to_segment.  Call
16440         attach_section_to_segment if sections are attached.
16441         (Layout::attach_sections_to_segments): New function.
16442         (Layout::attach_section_to_segment): New function.
16443         (Layout::attach_allocated_section_to_segment): Rename from
16444         attach_to_segment.  Remove flags parameter.
16445         (Layout::allocate_output_section): Remove function.
16446         (Layout::write_enable_output_section): Remove function.
16447         * layout.h (class Layout): Update for above changes.  Add new
16448         field sections_are_attached_.
16449         * output.h (Output_section::update_flags_for_input_section): New
16450         function.
16451         * output.cc (Output_section::add_input_section): Call
16452         update_flags_for_input_section.
16453         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
16454
16455 2008-04-11  Cary Coutant  <ccoutant@google.com>
16456
16457         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
16458         thought unnecessary.
16459         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
16460
16461 2008-04-11  Ian Lance Taylor  <iant@google.com>
16462
16463         * output.h (class Output_section_data): Remove inline definition
16464         of set_addralign.
16465         * output.cc (Output_section_data::set_addralign): New function.
16466
16467 2008-04-11  Cary Coutant  <ccoutant@google.com>
16468
16469         Add support for TLS descriptors for i386 and x86_64.
16470         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
16471         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
16472         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
16473         GOT_TYPE_TLS_DESC.
16474         (Target_i386::got_mod_index_entry): Remove unnecessary code.
16475         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
16476         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
16477         relocations.
16478         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
16479         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
16480         Fix problem with initial-exec relocations.
16481         (Target_i386::Relocate::relocate_tls): Likewise.
16482         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
16483         relaxation.
16484         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
16485         support for section-plus-offset dynamic table entries.
16486         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
16487         (Output_data_dynamic::Dynamic_entry): Add support for
16488         section-plus-offset dynamic table entries.
16489         (Output_data_dynamic::Classification): Likewise.
16490         (Output_data_dynamic::classification_): Renamed offset_.
16491         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
16492         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
16493         (Target_x86_64::make_plt_section): New function.
16494         (Target_x86_64::reserve_tlsdesc_entries): New function.
16495         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
16496         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
16497         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
16498         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
16499         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
16500         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
16501         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
16502         add extra PLT entry for TLS descriptors.
16503         (Output_data_plt_x86_64::got_): New field.
16504         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
16505         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
16506         fields.
16507         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
16508         descriptors.
16509         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
16510         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
16511         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
16512         R_386_TLS_DESC_CALL relocations.
16513         (Target_x86_64::Scan::global): Likewise.
16514         (Target_x86_64::do_finalize_sections): Add dynamic table entries
16515         for TLS descriptors.
16516         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
16517         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
16518         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
16519         GD-to-IE relaxation.
16520         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
16521         and TLS_DESCRIPTORS.
16522         * Makefile.in: Rebuild.
16523         * configure: Rebuild.
16524         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
16525         (tls_test_shared2.so): New target.
16526         (tls_shared_gd_to_ie_test_SOURCES): New variable.
16527         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
16528         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
16529         (tls_shared_gd_to_ie_test_LDADD): New variable.
16530         (tls_shared_gnu2_gd_to_ie_test): New target.
16531         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
16532         New targets.
16533         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
16534         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
16535         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
16536         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
16537         (tls_shared_gnu2_test): New target.
16538         (tls_test_gnu2_shared.so): New target.
16539         (tls_shared_gnu2_test_SOURCES): New variable.
16540         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
16541         (tls_shared_gnu2_test_LDFLAGS): New variable.
16542         (tls_shared_gnu2_test_LDADD): New variable.
16543         * testsuite/Makefile.in: Rebuild.
16544         * testsuite/Makefile.
16545
16546 2008-04-11  Ian Lance Taylor  <iant@google.com>
16547
16548         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
16549         justsyms.t.
16550         * testsuite/Makefile.in: Rebuild.
16551
16552         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
16553         long.
16554         * testsuite/script_test_2.cc (main): Adjust test.
16555
16556 2008-04-11  David S. Miller  <davem@davemloft.net>
16557             Ian Lance Taylor  <iant@google.com>
16558
16559         * options.h (General_options): Add entries for '-Y' and
16560         '-relax'.
16561         * options.cc (General_options:finalize): If -Y was used, add those
16562         entries to the library path instead of the default "/lib" and
16563         "/usr/lib".
16564
16565 2008-04-11  David S. Miller  <davem@davemloft.net>
16566
16567         * testsuite/justsyms.t: Start at 0x100.
16568         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
16569         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
16570         long.
16571         * testsuite/script_test_2.cc: Adjust string and section length
16572         checks.
16573
16574 2008-04-09  Ian Lance Taylor  <iant@google.com>
16575
16576         PR gold/5996
16577         * script-sections.cc (Sections_element::allocate_to_segment): Add
16578         orphan parameter.
16579         (Output_section_definition::allocate_to_segment): Likewise.
16580         (Orphan_output_section::allocate_to_segment): Likewise.
16581         (Script_sections::attach_sections_using_phdrs_clause): Don't
16582         propagate non-PT_LOAD segments to orphan sections.
16583         * testsuite/Makefile.am (script_test_3.stdout): Generate using
16584         readelf rather than objdump.
16585         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
16586         .interp section and PT_INTERP segment are the same size.
16587         * testsuite/Makefile.in: Rebuild.
16588
16589         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
16590         aliases for symbols defined in the same object.
16591         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
16592         (weak_alias_test_SOURCES): New variable.
16593         (weak_alias_test_DEPENDENCIES): New variable.
16594         (weak_alias_test_LDFLAGS): New variable.
16595         (weak_alias_test_LDADD): New variable.
16596         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
16597         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
16598         (weak_alias_test_3.o): New target.
16599         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
16600         * testsuite/weak_alias_test_main.cc: New file.
16601         * testsuite/weak_alias_test_1.cc: New file.
16602         * testsuite/weak_alias_test_2.cc: New file.
16603         * testsuite/weak_alias_test_3.cc: New file.
16604
16605 2008-04-08  Ian Lance Taylor  <iant@google.com>
16606
16607         * options.h (class General_options): Add --noinhibit-exec option.
16608         * main.cc (main): Check --noinhibit-exec.
16609
16610         * options.h (class General_options): Define --wrap as a special
16611         option.  Add wrap_symbols_ field.
16612         (General_options::any_wrap_symbols): New function.
16613         (General_options::is_wrap_symbol): New function.
16614         * options.cc (General_options::parse_wrap): New function.
16615         (General_options::General_options): Initialize wrap_symbols_.
16616         * symtab.cc (Symbol_table::wrap_symbol): New function.
16617         (Symbol_table::add_from_object): Handle --wrap.
16618         * symtab.h (class Symbol_table): Declare wrap_symbol.
16619         * target.h (Target::wrap_char): New function.
16620         (Target::Target_info): Add wrap_char field.
16621         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
16622         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
16623         * testsuite/testfile.cc (Target_test::test_target_info):
16624         Likewise.
16625
16626         * errors.cc (Errors::undefined_symbol): Mention symbol version if
16627         there is one.
16628
16629         * layout.h (class Layout): Add added_eh_frame_data_ field.
16630         * layout.cc (Layout::Layout): Initialize new field.
16631         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
16632         output section until we find a section we merged successfully.
16633         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
16634         that the size be non-zero.
16635
16636         * merge.cc (Object_merge_map::get_output_offset): Remove inline
16637         qualifier.
16638
16639 2008-04-08  Craig Silverstein  <csilvers@google.com>
16640
16641         * configure.ac: Export new conditional variable HAVE_ZLIB.
16642         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
16643         on HAVE_ZLIB.
16644         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
16645         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16646
16647 2008-04-07  Ian Lance Taylor  <iant@google.com>
16648
16649         * version.cc (version_string): Set to "1.5".
16650
16651         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
16652         Add issued_non_pic_error_ field.  Declare check_non_pic.
16653         (Target_x86_64::Scan::check_non_pic): New function.
16654         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
16655         (Target_x86_64::Scan::global): Likewise.
16656
16657         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
16658         addend parameter.  Change caller.  Handle merge sections.
16659         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
16660         Address to Addend.  Don't add in the result of
16661         local_section_offset, pass down the addend and use the returned
16662         value.
16663         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
16664         Update declarations of local_section_offset and symbol_value.
16665         * testsuite/two_file_test_1.cc (t18): New function.
16666         * testsuite/two_file_test_2.cc (f18): New function.
16667         * testsuite/two_file_test_main.cc (main): Call t18.
16668         * testsuite/two_file_test.h (t18, f18): Declare.
16669
16670         * configure.ac: Don't test for objdump, c++filt, or readelf.
16671         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
16672         conditionals.
16673         (TEST_READELF): New variable.
16674         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
16675         (check_PROGRAMS): Add two_file_strip_test.
16676         (two_file_strip_test): New target.
16677         (check_PROGRAMS): Add two_file_same_shared_strip_test.
16678         (two_file_same_shared_strip_test_SOURCES): New variable.
16679         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
16680         (two_file_same_shared_strip_test_LDFLAGS): New variable.
16681         (two_file_same_shared_strip_test_LDADD): New variable.
16682         (two_file_shared_strip.so): New target.
16683         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
16684         (ver_test_5.syms, ver_test_7.syms): Likewise.
16685         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
16686         (strip_test_3.stdout): Use TEST_OBJDUMP.
16687         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16688
16689 2008-04-04  Cary Coutant  <ccoutant@google.com>
16690
16691         * symtab.h (Symbol::is_weak_undefined): New function.
16692         (Symbol::is_strong_undefined): New function.
16693         (Symbol::is_absolute): New function.
16694         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
16695         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
16696         absolute symbols.
16697         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
16698         (weak_undef_test): New target.
16699         * testsuite/Makefile.in: Rebuild.
16700         * testsuite/weak_undef_file1.cc: New file.
16701         * testsuite/weak_undef_file2.cc: New file.
16702         * testsuite/weak_undef_test.cc: New file.
16703
16704 2008-04-03  Craig Silverstein  <csilvers@google.com>
16705
16706         * compressed_output.h (class Output_compressed_section): Use
16707         unsigned buffer.
16708         * compressed_output.cc (zlib_compress): Use unsigned buffers,
16709         add zlib header.
16710         (zlib_compressed_suffix): Removed.
16711         (Output_compressed_section::set_final_data_size): Use unsigned
16712         buffers.
16713         * testsuite/Makefile.am (flagstest_compress_debug_sections):
16714         Fix linker invocation.
16715         (flagstest_o_specialfile_and_compress_debug_sections):
16716         Likewise.
16717         * testsuite/Makefile.in: Regenerated.
16718
16719 2008-04-02  David S. Miller  <davem@davemloft.net>
16720
16721         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
16722         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
16723
16724 2008-04-02  Craig Silverstein  <csilvers@google.com>
16725
16726         * TODO: New file.
16727
16728 2008-04-02  Ian Lance Taylor  <iant@google.com>
16729
16730         * fileread.cc (File_read::find_view): Add byteshift and vshifted
16731         parameters.  Update for new key type to views_.  Change all
16732         callers.
16733         (File_read::read): Adjust for byteshift in returned view.
16734         (File_read::add_view): New function, broken out of
16735         find_and_make_view.
16736         (File_read::make_view): New function, broken out of
16737         find_and_make_view.
16738         (File_read::find_or_make_view): Add offset and aligned
16739         parameters.  Rewrite accordingly.  Change all callers.
16740         (File_read::get_view): Add offset and aligned parameters.  Adjust
16741         for byteshift in return value.
16742         (File_read::get_lasting_view): Likewise.
16743         * fileread.h (class File_read): Update declarations.
16744         (class File_read::View): Add byteshift_ field.  Add byteshift to
16745         constructor.  Add byteshift method.
16746         * archive.h (Archive::clear_uncached_views): New function.
16747         (Archive::get_view): Add aligned parameter.  Change all callers.
16748         * object.h (Object::get_view): Add aligned parameter.  Change all
16749         callers.
16750         (Object::get_lasting_view): Likewise.
16751
16752         * fileread.cc (File_read::release): Don't call clear_views if
16753         there are multiple objects.
16754         * fileread.h (File_read::clear_uncached_views): New function.
16755         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
16756         on the archive.
16757
16758 2008-03-31  Cary Coutant  <ccoutant@google.com>
16759
16760         Add thin archive support.
16761         * archive.cc (Archive::armagt): New const.
16762         (Archive::setup): Remove task parameter and calls to unlock.
16763         (Archive::unlock_nested_archives): New function.
16764         (Archive::read_header): Add nested_off parameter. Change
16765         all callers.
16766         (Archive::interpret_header): Likewise.
16767         (Archive::include_all_members): Change to handle thin
16768         archives.
16769         (Archive::include_member): Likewise.
16770         * archive.h (Archive::Archive): Add new parameters and
16771         initializers.
16772         (Archive::armagt): New const.
16773         (Archive::setup): Remove task parameter.
16774         (Archive::unlock_nested_archives): New function.
16775         (Archive::read_header): Add nested_off parameter.
16776         (Archive::interpret_header): Likewise.
16777         (Archive::Nested_archive_table): New typedef.
16778         (Archive::is_thin_archive_): New field.
16779         (Archive::nested_archives_): New field.
16780         (Archive::options_): New field.
16781         (Archive::dirpath_): New field.
16782         (Archive::task_): New field.
16783         * readsyms.cc (Read_symbols::do_read_symbols): Add check
16784         for thin archives.  Pass additional parameters to
16785         Archive::Archive.  Unlock the archive file after calling
16786         Archive::setup.
16787
16788 2008-03-29  Ian Lance Taylor  <iant@google.com>
16789
16790         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
16791         version symbol to be local.
16792         * testsuite/ver_test_4.sh: New file.
16793         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
16794         (check_DATA): Add ver_test_4.syms.
16795         (ver_test_4.syms): New target.
16796         * testsuite/Makefile.in: Rebuild.
16797
16798         * output.cc
16799         (Output_section::Input_section_sort_entry::has_priority): New
16800         function.
16801         (Output_section::Input_section_sort_entry::match_file_name): New
16802         function.
16803         (Output_section::Input_section_sort_entry::match_section_name):
16804         Remove.
16805         (Output_section::Input_section_sort_entry::match_section_name_prefix):
16806         Remove.
16807         (Output_section::Input_section_sort_entry::match_section_file):
16808         Remove.
16809         (Output_section::Input_section_sort_compare::operator()): Rewrite
16810         using new Input_section_sort_entry functions.  Sort crtbegin and
16811         crtend first.  Sort sections with no priority before sections with
16812         a priority.
16813         * testsuite/initpri1.c (d3): Check j != 4.
16814         (cd5): New constructor/destructor function.
16815         (main): Check j != 2.
16816
16817         * symtab.cc (Symbol_table::add_from_object): If we don't use the
16818         new symbol when resolving, don't call set_is_default.
16819         * testsuite/ver_test_7.cc: New file.
16820         * testsuite/ver_test_7.sh: New file.
16821         * testsuite/Makefile.am (ver_test_7.so): New target.
16822         (ver_test_7.o): New target.
16823         (check_SCRIPTS): Add ver_test_7.sh.
16824         (check_DATA): Add ver_test_7.syms.
16825         (ver_test_7.syms): New target.
16826
16827 2008-03-28  Ian Lance Taylor  <iant@google.com>
16828
16829         * layout.cc (Layout::layout): If we see an input section with a
16830         name that needs sorting, set the must_sort flag for the output
16831         section.
16832         (Layout::make_output_section): If the name of the output section
16833         indicates that it might require sorting, set the may_sort flag.
16834         * output.h (Output_section::may_sort_attached_input_sections): New
16835         function.
16836         (Output_section::set_may_sort_attached_input_sections): New
16837         function.
16838         (Output_section::must_sort_attached_input_sections): New
16839         function.
16840         (Output_section::set_must_sort_attached_input_sections): New
16841         function.
16842         (class Output_section): Declare Input_section_sort_entry.  Define
16843         Input_section_sort_compare.  Declare
16844         sort_attached_input_sections.  Add new fields:
16845         may_sort_attached_input_sections_,
16846         must_sort_attached_input_sections_,
16847         attached_input_sections_are_sorted_.
16848         * output.cc (Output_section::Output_section): Initialize new
16849         fields.
16850         (Output_section::add_input_section): Add an entry to
16851         input_sections_ if may_sort or must_sort are true.
16852         (Output_section::set_final_data_size): Call
16853         sort_attached_input_sections if necessary.
16854         (Output_section::Input_section_sort_entry): Define new class.
16855         (Output_section::Input_section_sort_compare::operator()): New
16856         function.
16857         (Output_section::sort_attached_input_sections): New function.
16858         * configure.ac: Check whether the compiler supports constructor
16859         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
16860         * testsuite/initpri1.c: New file.
16861         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
16862         CONSTRUCTOR_PRIORITY.
16863         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
16864         (initpri1_LDFLAGS): New variable.
16865         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16866
16867 2008-03-27  Ian Lance Taylor  <iant@google.com>
16868
16869         * common.cc (Sort_commons::operator): Correct sorting algorithm.
16870         * testsuite/common_test_1.c: New file.
16871         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
16872         (common_test_1_SOURCES): New variable.
16873         (common_test_1_DEPENDENCIES): New variable.
16874         (common_test_1_LDFLAGS): New variable.
16875
16876         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
16877         and commons_ correctly when NAME/VERSION does not override
16878         NAME/NULL.
16879         * testsuite/ver_test_6.c: New file.
16880         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
16881         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
16882         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
16883
16884 2008-03-26  Ian Lance Taylor  <iant@google.com>
16885
16886         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
16887         of an undefined symbol from a version script.
16888         * testsuite/Makefile.am (ver_test_5.so): New target.
16889         (ver_test_5.o): New target.
16890         (check_SCRIPTS): Add ver_test_5.sh.
16891         (check_DATA): Add ver_test_5.syms.
16892         (ver_test_5.syms): New target.
16893         * testsuite/ver_test_5.cc: New file.
16894         * testsuite/ver_test_5.script: New file.
16895         * testsuite/ver_test_5.sh: New file.
16896         * Makefile.in, testsuite/Makefile.in: Rebuild.
16897
16898         PR gold/5986
16899         Fix problems building gold with gcc 4.3.0.
16900         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
16901         (gold_error_at_location, gold_warning_at_location): Use it.
16902         * configure.ac: Check whether we can compile and use a template
16903         function with a printf attribute.
16904         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
16905         when jumping over bytes.
16906         * object.cc: Instantiate Object::read_section_data.
16907         * debug.h: Include <cstring>
16908         * dwarf_reader.cc: Include <algorithm>
16909         * main.cc: Include <cstring>.
16910         * options.cc: Include <cstring>.
16911         * output.cc: Include <cstring>.
16912         * script.cc: Include <cstring>.
16913         * script.h: Include <string>.
16914         * symtab.cc: Include <cstring> and <algorithm>.
16915         * target-select.cc: Include <cstring>.
16916         * version.cc: Include <string>.
16917         * testsuite/testmain.cc: Include <cstdlib>.
16918         * configure, config.in: Rebuild.
16919
16920 2008-03-25  Ian Lance Taylor  <iant@google.com>
16921
16922         * options.cc: Include "../bfd/bfdver.h".
16923         (options::help): Print bug reporting address.
16924
16925         * version.cc (print_version): Adjust output for current value of
16926         BFD_VERSION_STRING.
16927
16928         * NEWS: New file.
16929
16930         * options.cc (options::help): Print list of supported targets.
16931         * target-select.h: Include <vector>.
16932         (class Target_selector): Make machine_, size_, and is_big_endian_
16933         fields const.  Add bfd_name_ and instantiated_target_ fields.
16934         (Target_selector::Target_selector): Add bfd_name parameter.
16935         (Target_selector::recognize): Make non-virtual, call
16936         do_recognize.
16937         (Target_selector::recognize_by_name): Make non-virtual, call
16938         do_recognize_by_name.
16939         (Target_selector::supported_names): New function.
16940         (Target_selector::bfd_name): New function.
16941         (Target_selector::do_instantiate_target): New pure virtual
16942         function.
16943         (Target_selector::do_recognize): New virtual function.
16944         (Target_selector::do_recognize_by_name): New virtual function.
16945         (Target_selector::instantiate_target): New private function.
16946         (supported_target_names): Declare.
16947         * target-select.cc (Target_selector::Target_selector): Update for
16948         new parameter and fields.
16949         (select_target_by_name): Check that the name matches before
16950         calling recognize_by_name.
16951         (supported_target_names): New function.
16952         * i386.cc (class Target_selector_i386): Update Target_selector
16953         constructor call.  Remove recognize and recognize_by_name.  Add
16954         do_instantiate_target.
16955         * x86_64.cc (class Target_selector_x86_64): Likewise.
16956         * testsuite/testfile.cc (class Target_selector_test): Update for
16957         changes to Target_selector.
16958
16959         * README: Rewrite, with some notes on unsupported features.
16960
16961 2008-03-24  Cary Coutant  <ccoutant@google.com>
16962
16963         * i386.cc (Target_i386::Got_type): New enum declaration.
16964         (Target_i386::Scan::local): Updated callers of Output_data_got
16965         member functions.
16966         (Target_i386::Scan::global): Likewise.
16967         (Target_i386::Relocate::relocate): Likewise.
16968         (Target_i386::Relocate::relocate_tls): Likewise.
16969         * object.h (Got_offset_list): New class.
16970         (Sized_relobj::local_has_got_offset): Added got_type parameter.
16971         (Sized_relobj::local_got_offset): Likewise.
16972         (Sized_relobj::set_local_got_offset): Likewise.
16973         (Sized_relobj::local_has_tls_got_offset): Removed.
16974         (Sized_relobj::local_tls_got_offset): Removed.
16975         (Sized_relobj::set_local_tls_got_offset): Removed.
16976         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16977         * output.cc (Output_data_got::add_global): Added got_type parameter.
16978         (Output_data_got::add_global_with_rel): Likewise.
16979         (Output_data_got::add_global_with_rela): Likewise.
16980         (Output_data_got::add_global_pair_with_rel): New function.
16981         (Output_data_got::add_global_pair_with_rela): New function.
16982         (Output_data_got::add_local): Added got_type parameter.
16983         (Output_data_got::add_local_with_rel): Likewise.
16984         (Output_data_got::add_local_with_rela): Likewise.
16985         (Output_data_got::add_local_pair_with_rel): New function.
16986         (Output_data_got::add_local_pair_with_rela): New function.
16987         (Output_data_got::add_global_tls): Removed.
16988         (Output_data_got::add_global_tls_with_rel): Removed.
16989         (Output_data_got::add_global_tls_with_rela): Removed.
16990         (Output_data_got::add_local_tls): Removed.
16991         (Output_data_got::add_local_tls_with_rel): Removed.
16992         (Output_data_got::add_local_tls_with_rela): Removed.
16993         * output.h (Output_data_got::add_global): Added got_type parameter.
16994         (Output_data_got::add_global_with_rel): Likewise.
16995         (Output_data_got::add_global_with_rela): Likewise.
16996         (Output_data_got::add_global_pair_with_rel): New function.
16997         (Output_data_got::add_global_pair_with_rela): New function.
16998         (Output_data_got::add_local): Added got_type parameter.
16999         (Output_data_got::add_local_with_rel): Likewise.
17000         (Output_data_got::add_local_with_rela): Likewise.
17001         (Output_data_got::add_local_pair_with_rel): New function.
17002         (Output_data_got::add_local_pair_with_rela): New function.
17003         (Output_data_got::add_global_tls): Removed.
17004         (Output_data_got::add_global_tls_with_rel): Removed.
17005         (Output_data_got::add_global_tls_with_rela): Removed.
17006         (Output_data_got::add_local_tls): Removed.
17007         (Output_data_got::add_local_tls_with_rel): Removed.
17008         (Output_data_got::add_local_tls_with_rela): Removed.
17009         * resolve.cc (Symbol::override_base_with_special): Removed
17010         reference to has_got_offset_ field.
17011         * symtab.cc (Symbol::init_fields): Replaced initialization
17012         of got_offset_ with got_offsets_.  Removed initialization
17013         of has_got_offset_
17014         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
17015         (Symbol::got_offset): Likewise.
17016         (Symbol::set_got_offset): Likewise.
17017         (Symbol::has_tls_got_offset): Removed.
17018         (Symbol::tls_got_offset): Removed.
17019         (Symbol::set_tls_got_offset): Removed.
17020         (Symbol::got_offset_): Removed.
17021         (Symbol::tls_mod_got_offset_): Removed.
17022         (Symbol::tls_pair_got_offset_): Removed.
17023         (Symbol::got_offsets_): New field.
17024         (Symbol::has_got_offset): Removed.
17025         (Symbol::has_tls_mod_got_offset): Removed.
17026         (Symbol::has_tls_pair_got_offset): Removed.
17027         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
17028         (Target_x86_64::Scan::local): Updated callers of Output_data_got
17029         member functions.
17030         (Target_x86_64::Scan::global): Likewise.
17031         (Target_x86_64::Relocate::relocate): Likewise.
17032         (Target_x86_64::Relocate::relocate_tls): Likewise.
17033
17034 2008-03-25  Ben Elliston  <bje@au.ibm.com>
17035
17036         * yyscript.y: Fix spelling error in comment.
17037
17038 2008-03-24  Ian Lance Taylor  <iant@google.com>
17039
17040         * options.h (class General_options): Define build_id option.
17041         * layout.h (class Layout): Declare write_build_id, create_note,
17042         create_build_id.  Add build_id_note_ member.
17043         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
17044         "libiberty.h", "md5.h", "sha1.h".
17045         (Layout::Layout): Initialize eh_frame_data_,
17046         eh_frame_hdr_section_, and build_id_note_.
17047         (Layout::finalize): Call create_build_id.
17048         (Layout::create_note): New function, broken out of
17049         Layout::create_gold_note.
17050         (Layout::create_gold_note): Call create_note.
17051         (Layout::create_build_id): New function.
17052         (Layout::write_build_id): New function.
17053         (Close_task_runner::run): Call write_build_id.
17054
17055         * x86_64.cc: Correct license to GPLv3.
17056
17057 2008-03-23  Ian Lance Taylor  <iant@google.com>
17058
17059         * options.cc: Include "demangle.h".
17060         (parse_optional_string): New function.
17061         (parse_long_option): Handle takes_optional_argument.
17062         (parse_short_option): Update dash_z initializer.  Handle
17063         takes_optional_argument.
17064         (General_options::General_options): Initialize do_demangle_.
17065         (General_options::finalize): Set do_demangle_.  Handle demangling
17066         style.
17067         * options.h (parse_optional_string): Declare.
17068         (struct One_option): Add optional_arg field.  Update constructor.
17069         Update call constructor calls.  Add takes_optional_argument
17070         function.
17071         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
17072         (DEFINE_optional_string): Define.
17073         (General_options::demangle): Change from DEFINE_bool to
17074         DEFINE_optional_string.
17075         (General_options::no_demangle): New function.
17076         (General_options::do_demangle): New function.
17077         (General_options::set_do_demangle): New function.
17078         (General_options::execstack_status_): Move definition to end of
17079         class definition.
17080         (General_options::static_): Likewise.
17081         (General_options::do_demangle_): New field.
17082         * object.cc (big_endian>::get_symbol_location_info): Call
17083         Options::do_demangle, not Options::demangle.
17084         * symtab.cc (demangle): Likewise.
17085
17086 2008-03-22  Ian Lance Taylor  <iant@google.com>
17087
17088         * gold.h: Include <cstddef> and <sys/types.h>
17089         * options.h: Include <cstring>.
17090
17091 2008-03-21  Ian Lance Taylor  <iant@google.com>
17092
17093         * Added source code to GNU binutils.
17094 \f
17095 Copyright (C) 2008-2015 Free Software Foundation, Inc.
17096
17097 Copying and distribution of this file, with or without modification,
17098 are permitted in any medium without royalty provided the copyright
17099 notice and this notice are preserved.
17100
17101 Local Variables:
17102 mode: change-log
17103 left-margin: 8
17104 fill-column: 74
17105 version-control: never
17106 End: