9943cf50a1ee814e38f3b8520cc36f5f50097f07
[external/binutils.git] / gold / ChangeLog
1 2015-04-09  Cary Coutant  <ccoutant@google.com>
2
3         * debug.h (DEBUG_LOCATION): New.
4         (DEBUG_ALL): Include DEBUG_LOCATION.
5         (debug_string_to_enum): Add DEBUG_LOCATION.
6         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug
7         output to print correct context.
8         (Sized_dwarf_line_info::do_addr2line): Add debug output. Return
9         up to 4 more locations at the beginning of the function.
10         * symtab.cc (Symbol_table::detect_odr_violations): Get canonical
11         result before sorting list of line numbers.
12         * testsuite/debug_msg.sh: Allow range of line numbers for
13         canonical results on optimized code.
14
15 2015-04-07  HC Yen <hc.yen@mediatek.com>
16
17         Add AArch32 support for gold linker.
18         gold/
19         * arm.cc: Add V8 arch combine table.
20
21 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
22
23         * aarch64.cc (do_reloc_addend): Fix signature to match the parent one.
24
25 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
26
27         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a call
28         to find by using the return value of insert.
29
30 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
31
32         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a copy
33         constructor call.
34
35 2015-04-06  Ilya Tocar  <ilya.tocar@intel.com>
36
37         PR gold/17641
38         * x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
39         (Target_x86_64::Scan::local): Don't create GOT entry, when we
40         can convert mov to lea.
41         (Target_x86_64::Scan::global): Ditto.
42         (Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
43         %reg to lea foo(%rip), %reg if possible.
44         * testsuite/Makefile.am (x86_64_mov_to_lea): New test.
45         * testsuite/x86_64_mov_to_lea1.s: New.
46         * testsuite/x86_64_mov_to_lea2.s: Ditto.
47         * testsuite/x86_64_mov_to_lea3.s: Ditto.
48         * testsuite/x86_64_mov_to_lea4.s: Ditto.
49         * testsuite/x86_64_mov_to_lea.sh: Ditto.
50
51 2015-04-02  H.J. Lu  <hongjiu.lu@intel.com>
52
53         * configure: Regenerated.
54
55 2015-04-01  Ilya Tocar  <ilya.tocar@intel.com>
56
57         PR gold/17640
58         * i386.cc (Target_i386::can_convert_mov_to_lea): New.
59         (Target_i386::Scan::local): Don't create GOT entry, when we
60         can convert GOT to GOTOFF.
61         (Target_i386::Scan::global): Ditto.
62         (Target_i386::Relocate::relocate): Convert  mov foo@GOT(%reg), %reg to
63         lea foo@GOTOFF(%reg), %reg if possible.
64         * testsuite/Makefile.am (i386_mov_to_lea): New test.
65         * testsuite/i386_mov_to_lea1.s: New.
66         * testsuite/i386_mov_to_lea2.s: Ditto.
67         * testsuite/i386_mov_to_lea3.s: Ditto.
68         * testsuite/i386_mov_to_lea4.s: Ditto.
69         * testsuite/i386_mov_to_lea5.s: Ditto.
70         * testsuite/i386_mov_to_lea.sh: Ditto.
71
72 2015-04-01  H.J. Lu  <hongjiu.lu@intel.com>
73
74         * Makefile.am (ZLIB): New.
75         (ZLIBINC): Likewise.
76         (AM_CFLAGS): Add $(ZLIBINC).
77         (AM_CXXFLAGS): Likewise.
78         (ldadd_varldadd_var): Add $(ZLIB).
79         (incremental_dump_LDADD): Likewise.
80         (dwp_LDADD): Likewise.
81         * compressed_output.cc: Don't check HAVE_ZLIB_H to include
82         <zlib.h>.
83         (zlib_compress): Don't check HAVE_ZLIB_H.
84         (zlib_decompress): Likewise.
85         * options.h (compress_debug_sections): Likewise.
86         * configure.ac (AM_CONDITIONAL): Removed.
87         * testsuite/Makefile.am (ZLIB): New.
88         (LDADD): Add $(ZLIB).
89         Don't check HAVE_ZLIB.
90         * Makefile.in: Regenerated.
91         * config.in: Likewise.
92         * configure: Likewise.
93         * testsuite/Makefile.in: Likewise.
94
95 2015-03-30  Jing Yu  <jingyu@google.com>
96
97         * aarch64-reloc.def: New TLSLD_ADD_DTPREL_HI12,
98         TLSLD_ADD_DTPREL_LO12_NC.
99         * aarch64.cc (Target_aarch64::define_tls_base_symbol): Always let
100         _TLS_MODULE_BASE_ point to the start of tls segment.
101         (Target_aarch64::optimize_tls_reloc): Add cases for
102         R_AARCH64_TLSLD_ADD_DTPREL_HI12 and
103         R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
104         (Target_aarch64::Scan::local): Likewise.
105         (Target_aarch64::Scan::global): Likewise.
106         (Target_aarch64::Relocate::relocate): Likewise.
107         (Target_aarch64::Relocate::relocate_tls): Likewise. And remove
108         subtracting tls segment size from symbol value for TLSLD_*_DTPREL
109         relocations.
110
111 2015-03-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
112
113         * merge.cc (Object_merge_map::add_mapping): call
114         Object_merge_map::Input_merge_map::add_mapping.
115         (Object_merge_map::Input_merge_map::add_mapping): New.
116         (Output_merge_data::do_add_input_section): Call
117         get_or_make_input_merge_map before a loop.
118         (Output_merge_string<Char_type>::finalize_merged_data): Call
119         get_or_make_input_merge_map before a loop.
120         * merge.h (Object_merge_map): Make Input_merge_map public.
121         * object.cc (Relobj::add_merge_mapping): Use get_or_create_merge_map.
122         (Relobj::get_or_create_merge_map): New.
123         * object.h (Relobj::get_or_create_merge_map): New.
124
125 2015-03-24  Alan Modra  <amodra@gmail.com>
126
127         PR 18147
128         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
129         relocation errors for branches to strong undefined symbols.
130
131 2015-03-23  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
132
133         * merge.cc (Object_merge_map::get_input_merge_map): Make it const.
134         (Object_merge_map::is_merge_section_for): Remove.
135         (Object_merge_map::find_merge_section): New.
136         * merge.h (Object_merge_map::is_merge_section_for): Remove.
137         (Object_merge_map::find_merge_section): New.
138         (Object_merge_map::get_input_merge_map): Add a const version.
139         * object.cc (Relobj::is_merge_section_for): Remove.
140         (Relobj::find_merge_section): New.
141         * object.h (Relobj::is_merge_section_for): Remove.
142         (Relobj::find_merge_section): New.
143         * output.cc
144         (Output_section::Input_section::is_merge_section_for): Remove.
145         (Output_section::add_merge_input_section): Don't call
146         add_merge_input_section.
147         (Output_section::find_merge_section): Return const. Use
148         object->find_merge_section.
149         (Output_section::build_lookup_maps): Don't build a map for
150         merge sections.
151         (Output_section::is_input_address_mapped): Return false if
152         section is not found.
153         (Output_section::find_starting_output_address): Use
154         find_merge_section instead of is_merge_section_for.
155         (Output_section::add_script_input_section):  Don't build a map for
156         merge sections.
157         * output.h (Output_section_lookup_maps::merge_sections_by_id_): Remove.
158         (Output_section_lookup_maps::find_merge_section): Remove.
159         (Output_section_lookup_maps::add_merge_input_section) Remove.
160         (Output_section::find_merge_section): Return const.
161
162 2015-03-22  Cary Coutant  <cary@google.com>
163
164         PR gold/18106
165         * i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
166         non-SIB form of lea, with nop after the call.
167
168 2015-03-21  Cary Coutant  <cary@google.com>
169
170         PR gold/14217
171         * output.cc (Output_segment::is_first_section_relro): Don't ignore
172         .tdata section.
173         (Output_segment::set_section_addresses): Don't align size of relro
174         segment for .tbss.
175
176 2015-03-21  Cary Coutant  <cary@google.com>
177
178         PR gold/18010
179         * stringpool.cc (Stringpool_template): Don't optimize if section
180         alignment is greater than sizeof(char).
181
182 2015-03-21  Cary Coutant  <cary@google.com>
183
184         PR gold/18048
185         * script-c.h (script_include_directive): Add first_token parameter.
186         * script.cc (script_include_directive): Add first_token parameter, and
187         pass it to read_script_file.
188         * yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
189         (PARSING_MEMORY_DEF): New tokens.
190         (top): Add new productions for INCLUDE files.
191         (file_cmd): Replace file_or_sections_cmd with copy of its productions.
192         Pass PARSING_LINKER_SCRIPT to script_include_directive.
193         (section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
194         (section_cmd): Pass PARSING_SECTION_CMDS.
195         (file_or_sections_cmd): Remove.
196         (memory_def): Pass PARSING_MEMORY_DEF.
197         * testsuite/Makefile.am (memory_test_2): New test.
198         * testsuite/Makefile.in: Regenerate.
199         * testsuite/memory_test_inc.t: New script file.
200         * testsuite/memory_test_inc_1.t.src: New script file.
201         * testsuite/memory_test_inc_2.t.src: New script file.
202         * testsuite/memory_test_inc_3.t.src: New script file.
203
204 2015-03-21  Cary Coutant  <cary@google.com>
205
206         * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
207         (Sized_relobj_dwo::setup): Build compressed section map.
208         (Sized_relobj_dwo::do_decompressed_section_contents): Delete.
209         * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
210         section map.
211         * object.cc (Sized_relobj_file::Sized_relobj_file): Remove
212         compressed_sections_ field.
213         (build_compressed_section_map): Take Object instead of
214         Sized_relobj_file parameter; add decompress_if_needed parameter.
215         (Sized_relobj_file::do_find_special_sections): Store compressed
216         section map in parent Object.
217         (Sized_relobj_file::do_decompressed_section_contents): Move
218         implementation to Object::decompressed_section_contents.
219         (Sized_relobj_file::do_discard_decompressed_sections): Move
220         implementation to Object::discard_decompressed_sections.
221         * object.h (build_compressed_section_map): Declare.
222         (Object::Object): Add compressed_sections_ field.
223         (Object::section_is_compressed): Move implementation here.
224         (Object::decompressed_section_contents): De-virtualize.
225         (Object::discard_decompressed_sections): De-virtualize.
226         (Object::do_section_is_compressed): Delete.
227         (Object::do_decompressed_section_contents): Delete.
228         (Object::set_compressed_sections): New method.
229         (Object::compressed_sections): New method.
230         (Object::compressed_sections_): New data member.
231         (Compressed_section_info, Compressed_section_map): Move to top of file.
232         (Sized_relobj_file::do_section_is_compressed): Delete.
233         (Sized_relobj_file::do_decompressed_section_contents): Delete.
234         (Sized_relobj_file::do_discard_decompressed_sections): Delete.
235         (Sized_relobj_file::compressed_sections_): Move to Object class.
236
237 2015-03-21  Cary Coutant  <ccoutant@google.com>
238
239         PR gold/18152
240         * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
241         deferred objects.
242
243 2015-03-11  Cary Coutant  <ccoutant@google.com>
244
245         * options.cc (General_options::finalize): Don't allow -z relro
246         with incremental linking.
247         * testsuite/Makefile.am (incremental_test): Add -z norelro.
248         (incremental_test_2): Likewise.
249         (incremental_test_3): Likewise.
250         (incremental_test_4): Likewise.
251         (incremental_test_5): Likewise.
252         (incremental_test_6): Likewise.
253         (incremental_copy_test): Likewise.
254         (incremental_common_test_1): Likewise.
255         (incremental_comdat_test_1): Likewise.
256         * testsuite/Makefile.in: Regenerate.
257
258 2015-03-09  Cary Coutant  <ccoutant@google.com>
259
260         PR gold/14675
261         * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
262         return enum indicating whether .eh_frame section is empty, optimizable,
263         unrecognized, or an end marker. Adjust explicit instantiations.
264         * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
265         (Eh_frame::add_ehframe_input_section): Change return type.
266         * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
267         * layout.cc (Layout::layout_eh_frame): Don't add optimized sections
268         to the .eh_frame output section until we see the end marker.
269         (Layout::finalize_eh_frame_section): New.
270         * layout.h: (Layout::finalize_eh_frame_section): New.
271
272 2015-03-05  H.J. Lu  <hongjiu.lu@intel.com>
273
274         * output.cc (Relobj::initialize_input_to_output_map<size>):
275         Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
276
277 2015-03-04  Cary Coutant  <ccoutant@google.com>
278
279         * parameters.cc (Parameters::set_target_once): Call
280         Target::select_as_default_target just once from here...
281         (set_parameters_target): ...instead of from here.
282
283 2015-03-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
284
285         * ehframe.cc (Cie::set_output_offset): Pass in and use a
286         Output_section_data instead of a Merge_map.
287         (Eh_frame::Eh_frame): Don't initialize merge_map_.
288         (Eh_frame::read_cie): Use add_merge_mapping instead of
289         Merge_map::add_mapping.
290         (Eh_frame::read_fde): Ditto.
291         (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
292         (Eh_frame::do_output_offset): Use merge_output_offset istead of
293         merge_map_->get_output_offset.
294         (Eh_frame::do_is_merge_section_for): Delete.
295         * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
296         instead of a Merge_map.
297         (Cie::set_output_offset): Pass in a Output_section_data instead of a
298         Merge_map.
299         (Eh_frame::do_is_merge_section_for): Delete.
300         (Eh_frame::merge_map_): Delete.
301         * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
302         and use a Output_section_data instead of a Merge_map.
303         (Object_merge_map::add_mapping): Ditto.
304         (Object_merge_map::get_output_offset): Remove the merge_map argument.
305         (Object_merge_map::is_merge_section_for): Pass in and use a
306         Output_section_data instead of a Merge_map.
307         (Merge_map): Delete.
308         (Output_merge_base::do_output_offset): Use merge_output_offset instead
309         of merge_map_.get_output_offset.
310         (Output_merge_base::do_is_merge_section_for): Delete.
311         (Output_merge_data::do_add_input_section): Use
312         object->add_merge_mapping instead of add_mapping.
313         (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
314         * merge.h (Merge_map): Delete forward declaration.
315         (Object_merge_map::add_mapping): Pass in and use a Output_section_data
316         instead of a Merge_map.
317         (Object_merge_map::get_output_offset): Remove the merge_map argument.
318         (Object_merge_map::is_merge_section_for): Pass in and use a
319         Output_section_data instead of a Merge_map.
320         (Input_merge_map::Object_merge_map::merge_map): Replace with
321         output_data.
322         (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
323         Output_section_data instead of a Merge_map.
324         (Merge_map): Delete.
325         (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
326         (Output_merge_base::do_is_merge_section_for): Delete.
327         (Output_merge_base::add_mapping): Delete.
328         (Output_merge_base::merge_map_): Delete.
329         * object.cc (Relobj::initialize_input_to_output_map): New.
330         (Relobj::initialize_input_to_output_map): New.
331         (Relobj::merge_output_offset): New.
332         (Relobj::is_merge_section_for): New.
333         (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
334         bits.
335         * object.h (Relobj::merge_map): Delete.
336         (initialize_input_to_output_map): New.
337         (set_merge_map): Delete.
338         (add_merge_mapping): New.
339         (merge_output_offset): New.
340         (is_merge_section_for): New.
341         * output.cc (Output_section::Input_section::is_merge_section_for):
342         Use object->is_merge_section_for.
343         * output.h (Output_section_data::is_merge_section_for): Delete.
344         (Output_section_data::do_is_merge_section_for): Delete.
345         * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
346         Use object->initialize_input_to_output_map.
347         (Merged_symbol_value<size>::value_from_output_section): Use
348         object->merge_output_offset.
349
350 2015-03-02  Peter Collingbourne  <pcc@google.com>
351             Cary Coutant  <ccoutant@google.com>
352
353         * output.cc (Output_section::add_merge_input_section): Do not
354         attempt to merge sections with an entsize of 0.
355
356 2015-03-02  Khem Raj  <raj.khem@gmail.com>
357
358         * attributes.h (class Output_attributes_section_data ): Add
359         do_print_to_mapfile function.
360
361 2015-02-24  Alan Modra  <amodra@gmail.com>
362
363         PR 18010
364         * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
365         complain if value is not a multiple of four.
366         (Target_powerpc::Relocate::relocate): Correct handling of
367         R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
368
369 2015-02-21  H.J. Lu  <hongjiu.lu@intel.com>
370
371         * configure.ac (default_size): Set to 32 for x32.
372         * configure: Regenerated.
373
374 2015-02-18  Alan Modra  <amodra@gmail.com>
375
376         PR 17954
377         * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
378         visibility.
379
380 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
381
382         * gc.h (Garbage_collection::add_reference): Don't use find.
383
384 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
385
386         * object.cc (write_local_symbols): avoid std::vector copy.
387
388 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
389
390         * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
391
392 2015-02-09  Mark Wielaard  <mjw@redhat.com>
393
394         * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
395         DW_LANG_Fortran03 and DW_LANG_Fortran08.
396
397 2015-02-16  Cary Coutant  <ccoutant@google.com>
398
399         PR gold/13577
400         PR gold/16992
401         * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
402         DF_SYMBOLIC if --dynamic-list option is used.
403         * options.cc (General_options::finalize): --dynamic-list is not
404         mutually exclusive with -Bsymbolic.
405         * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
406         listed in --dynamic-list.
407         * testsuite/Makefile.am (dynamic_list_lib2.so): Add
408         -Bsymbolic-functions.
409         * testsuite/Makefile.in: Regenerate.
410
411 2015-02-16  Cary Coutant  <ccoutant@google.com>
412
413         PR gold/17971
414         * incremental.cc: Remove redundant include of "output.h".
415
416 2015-02-12  Jing Yu  <jingyu@google.com>
417
418         * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
419         TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
420         New relocation.
421         * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
422         TLSLE_MOVW_* relocations.
423         (Target_aarch64::Scan::global): Likewise.
424         (Target_aarch64::Relocate::relocate): Likewise.
425         (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
426         for new TLSLE_MOVW_* relocations.
427
428 2015-02-11  Will Newton  <will.newton@linaro.org>
429
430         PR gold/13321
431         * arm.cc (Target_arm::make_plt_section): Create an ARM
432         state mapping symbol at the start of the PLT.
433
434 2015-02-09  H.J. Lu  <hongjiu.lu@intel.com>
435
436         * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
437         Replace two_file_shared_2.so with two_file_shared_1.so.
438         * testsuite/Makefile.in: Regenerated.
439
440 2015-02-09  Alan Modra  <amodra@gmail.com>
441
442         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
443         plugin_test_thin.a and defsym_test.
444         * testsuite/Makefile.in: Regenerate.
445
446 2015-02-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
447
448         * merge.cc (do_add_input_section): Combine loop epilogue into main loop
449         body.
450
451 2015-02-04  Peter Collingbourne  <pcc@google.com>
452
453         * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
454         forwarding symbols when computing symbol resolution info for plugins.
455         * plugin.h (Plugin_manager::symtab): New method.
456         (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
457
458 2015-02-03  Cary Coutant  <ccoutant@google.com>
459             Peter Collingbourne  <pcc@google.com>
460
461         PR gold/15660
462         * archive.cc (Thin_archive_object_unlocker): New class.
463         (Archive::include_member): Unlock external members of thin archives.
464         * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
465         (plugin_test_2): Likewise.
466         (plugin_test_3): Likewise.
467         (plugin_test_4): Likewise.
468         (plugin_test_5): Likewise.
469         (plugin_test_6): Likewise.
470         (plugin_test_7): Likewise.
471         (plugin_test_8): Likewise.
472         (plugin_test_9): Likewise.
473         (plugin_test_10): Likewise.
474         (plugin_test_11): New test case.
475         * testsuite/Makefile.in: Regenerate.
476         * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
477         file to decide whether to claim file.
478         (all_symbols_read_hook): Likewise.
479         * testsuite/plugin_test_1.sh: Adjust expected output.
480         * testsuite/plugin_test_2.sh: Likewise.
481         * testsuite/plugin_test_3.sh: Likewise.
482         * testsuite/plugin_test_6.sh: Likewise.
483         * testsuite/plugin_test_tls.sh: Likewise.
484         * testsuite/plugin_test_11.sh: New testcase.
485
486 2015-02-03  Cary Coutant  <ccoutant@google.com>
487
488         * descriptors.cc (Descriptors::open): Set artificially-low limit for
489         file descriptors when debugging enabled. Add debug output.
490         (Descriptors::release): Add debug output.
491         (Descriptors::close_some_descriptor): Likewise.
492         (Descriptors::close_all): Likewise.
493         * fileread.cc (File_read::lock): Likewise.
494         (File_read::unlock): Likewise.
495
496 2015-02-02  Cary Coutant  <ccoutant@google.com>
497
498         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
499         executable output file.
500
501 2015-01-22  Han Shen  <shenhan@google.com>
502
503         * arm.cc (Target_arm::Target_arm): Add initialization for new members.
504         (Target_arm::do_plt_address_for_global): New method.
505         (Target_arm::do_plt_address_for_local): New method.
506         (Target_arm::rel_irelative_section): New method.
507         (Target_arm::make_data_plt): Add more parameters for plt ctor.
508         (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
509         (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
510         (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
511         (Target_arm::Scan::check_non_pic): Add ifunc support.
512         (Target_arm::Scan::local): Add ifunc support.
513         (Target_arm::Scan::global): Add ifunc support.
514         (Target_arm::make_plt_section): New method.
515         (Target_arm::make_plt_entry): Change to call to make_plt_section.
516         (Target_arm::make_local_ifunc_plt_entry): New method.
517         (Target_arm::got_irelative_): New member.
518         (Target_arm::rel_irelative_): New member.
519         (Target_arm::got_section): Add creation for got_irelative_.
520         (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
521         (Target_arm::Relocate::relocate): Properly set local ifunc address.
522         (Target_arm::do_dynsym_value): Properly set global ifunc address.
523         (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
524         (Output_data_plt_arm::IRelative_data): New type.
525         (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
526         (Output_data_plt_arm::add_entry): Add more parameters.
527         (Output_data_plt_arm::add_relocation): New method.
528         (Output_data_plt_arm::add_local_ifunc_entry): New method.
529         (Output_data_plt_arm::rel_irelative): New method.
530         (Output_data_plt_arm::entry_count): Modified.
531         (Output_data_plt_arm::address_for_global): New method.
532         (Output_data_plt_arm::address_for_local): New method.
533 gold/
534         (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
535         (Output_data_plt_arm::insert_irelative_data): New method.
536         (Output_data_plt_arm::irelative_rel_): New member.
537         (Output_data_plt_arm::got_): New member.
538         (Output_data_plt_arm::got_irelative_): New member.
539         (Output_data_plt_arm::irelative_count_): New member.
540         (Output_data_plt_arm::IRelative_data_vec): New typedef.
541         (Output_data_plt_arm::irelative_data_vec_): New member.
542         (Output_data_plt_arm::do_write): Write out irelative entries.
543         (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
544         more parameters to ctor.
545         (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
546         more parameters to ctor.
547         * output.h (Output_data_reloc::add_local_relative): New method.
548         * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
549
550 2015-01-29  Alan Modra  <amodra@gmail.com>
551
552         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
553         and GOT_TLSGD to LE optimization.
554
555 2015-01-28  Cary Coutant  <ccoutant@google.com>
556
557         * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
558         for undef TLS symbols.
559         (Target_x86_64::Relocate::relocate_tls): Likewise.
560         (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
561
562 2015-01-25  Cary Coutant  <ccoutant@google.com>
563
564         * output.cc (Output_segment::set_section_addresses): Fix calculation
565         of size of relro segment.
566
567 2015-01-22  Alan Modra  <amodra@gmail.com>
568
569         * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
570         condition for need of ifunc plt entry.
571         (Target_powerpc::Scan::global <got relocs>): Likewise.
572
573 2015-01-14  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
574
575         * mips.cc (reloc_high): Add r_sym.
576         (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
577         reloc_high constructor.
578         (Mips_relocate_functions::relgot16_local): Likewise.
579         (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
580         r_type to decide whether LO16 matches HI16.
581         (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
582         rello16 and relgot16_local.
583
584 2015-01-09  Cary Coutant  <ccoutant@google.com>
585
586         * layout.cc (Layout::set_segment_offsets): Don't align start of segment
587         unless alignment is larger than page size.
588
589 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
590             Cary Coutant  <ccoutant@google.com>
591
592         PR gold/17729
593         * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
594         (DEFAULT_TARGET_X32): Set for x32.
595         * x86_64.cc (cmp_insn_32): New.
596         (lea_r10_insn_32): Likewise.
597         (lea_r11_insn_32): Likewise.
598         (cmp_insn_64): Likewise.
599         (lea_r10_insn_64): Likewise.
600         (lea_r11_insn_64): Likewise.
601         (Target_x86_64<size>::do_calls_non_split): Handle x32.
602         * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
603         (check_DATA): Add split_x32 files.
604         (split_x32_[1234n].o): New targets.
605         (split_x32_[124]): New targets.
606         (split_x32_[1234r].stdout): New targets.
607         * testsuite/split_x32.sh: New file.
608         * testsuite/split_x32_1.s: Likewise.
609         * testsuite/split_x32_2.s: Likewise.
610         * testsuite/split_x32_3.s: Likewise.
611         * testsuite/split_x32_4.s: Likewise.
612         * testsuite/split_x32_n.s: Likewise.
613         * configure: Regenerated.
614         * testsuite/Makefile.in: Likewise.
615
616 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
617
618         PR gold/17809
619         * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
620         x32.
621
622 2015-01-02  Alan Modra  <amodra@gmail.com>
623
624         * version.cc (print_version): Just print current year.
625         * dwp.cc (print_version): Likewise.
626
627 2015-01-01  Alan Modra  <amodra@gmail.com>
628
629         Update year range in copyright notice of all files.
630
631 2014-12-25  Alan Modra  <amodra@gmail.com>
632
633         * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
634         new enums.
635         (Target_arm::merge_object_attributes, ): Likewise.
636
637 2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
638
639         * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
640         as hard float only when Tag_ABI_VFP_args is 1, using new enum value
641         AEABI_VFP_args_vfp to check that.
642         (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
643         value and replace hardcoded values by enum values.
644
645 2014-12-22  Cary Coutant  <ccoutant@google.com>
646
647         * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
648
649 2014-12-20  H.J. Lu  <hongjiu.lu@intel.com>
650
651         PR gold/14608
652         * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
653         to "return i * i * 3;".
654
655 2014-12-16  Cary Coutant  <ccoutant@google.com>
656
657         * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
658         (Mapfile::print_output_data): Use current_data_size() to avoid
659         assert for sections requiring postprocessing; if address is not valid,
660         print 0.
661         (Mapfile::print_output_section): Use current_data_size(); print note
662         that addresses and sizes are before compression.
663
664 2014-12-14  H.J. Lu  <hongjiu.lu@intel.com>
665
666         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
667         Cast current_group_size to unsigned long when reporting error.
668
669 2014-12-10  Jing Yu  <jingyu@google.com>
670
671         * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
672         (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
673         Update error message.
674         (Target_aarch64::do_relax): Use absolute value of option
675         stub_group_size. Replace local variable with class member
676         stub_group_size_.
677
678 2014-12-04  Alan Modra  <amodra@gmail.com>
679
680         * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
681         addend of PLTREL24 reloc when not generating a plt stub.  Make
682         max_branch_offset an "Address".
683         (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
684         (Target_powerpc::Relocate::relocate): Likewise.
685
686 2014-12-04  Alan Modra  <amodra@gmail.com>
687
688         PR 17670
689         * symtab.cc (Symbol::set_undefined): Remove assertion.
690         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
691         on symbols defined in discarded sections, instead return false.
692         Rearrange params, update all callers.
693         (Target_powerpc::Branch_info::make_stub): Don't make stubs for
694         branches to syms in discarded sections.
695         (Global_symbol_visitor_opd::operator()): Set discarded opd syms
696         undefined and flag as discarded.
697         (Target_powerpc::Relocate::relocate): Localize variable.
698
699 2014-12-03  H.J. Lu  <hongjiu.lu@intel.com>
700
701         PR gold/17675
702         * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
703         * testsuite/Makefile.in: Regenerated.
704
705 2014-12-03  Alan Modra  <amodra@gmail.com>
706
707         PR 17566
708         * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
709         when adding dynamic relocations against section symbols.
710
711 2014-12-01  Dimitry Ivanov <dimitry@google.com>
712
713         * layout.cc (Layout::finish_dynamic_section): When '-z global'
714         is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
715         * options.h (General_options): New -z option (global).
716
717 2014-12-01  Cary Coutant  <ccoutant@google.com>
718
719         PR gold/17578
720         * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
721         is given.
722         (Layout::create_executable_stack_info): Warn when -z noexecstack is
723         given but some inputs require executable stack.
724
725 2014-11-26  Cary Coutant  <ccoutant@google.com>
726
727         * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
728         .debug_str_offsets; strip .debug_gnu_pubnames and
729         .debug_gnu_pubtypes.
730         (lines_only_debug_sections): Strip all four new sections.
731
732 2014-11-26  Jing Yu  <jingyu@google.com>
733
734         * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
735         register to be x0 when to relax TLSDESC_LD64_LO12.
736
737 2014-11-26  Alan Modra  <amodra@gmail.com>
738
739         * powerpc.cc (struct Stub_table_owner): New.
740         (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
741         unsigned int vector.  Update all references.
742         (powerpc_relobj::set_stub_table): Take an unsigned int param
743         rather than a Stub_table.  Update callers.
744         (Powerpc_relobj::clear_stub_table): New function.
745         (Target_powerpc): Add relax_failed_, relax_fail_count_ and
746         stub_group_size_ vars.
747         (Target_powerpc::new_stub_table): Delete.
748         (max_branch_delta): New function, extracted from..
749         (Target_powerpc::Relocate::relocate): ..here..
750         (Target_powerpc::Branch_info::make_stub): ..and here.  Return
751         status on whether stub created successfully.
752         (Stub_control::Stub_control): Add "no_size_errors" param.  Move
753         default sizing to..
754         (Target_powerpc::do_relax): ..here.  Init stub_group_size_ and
755         reduce on relax failure.
756         (Target_powerpc::group_sections): Add "no_size_errors" param.
757         Use stub_group_size_.  Set up group info in a temp vector,
758         before building Stub_table vector.  Account for input sections
759         possibly already converted to relaxed sections.
760         (Stub_table::init): Delete.  Merge into..
761         (Stub_table::Stub_table): ..here.
762         (Stub_table::can_reach_stub): New function.
763         (Stub_table::add_plt_call_entry): Add "from" parameter and
764         return true iff stub could be reached.
765         (Stub_table::add_long_branch_entry): Similarly.  Add "r_type"
766         param too.
767         (Stub_table::clear_stubs): Add "all" param.
768
769 2014-11-26  Alan Modra  <amodra@gmail.com>
770
771         * powerpc.cc (Stub_control::set_output_and_owner): New function.
772         (Target_powerpc::group_sections): Use it.
773
774 2014-11-25  Cary Coutant  <ccoutant@google.com>
775
776         * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
777         (Binary_to_elf::write_symbol): Add st_size parameter.
778         * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
779
780 2014-11-25  Cary Coutant  <ccoutant@google.com>
781
782         PR gold/17639
783         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
784         (Sized_relobj_file::do_layout): Handle deferred sections properly
785         during GC pass 1. Don't add reloc sections to deferred list twice.
786         * object.h (Sized_relobj_file::is_deferred_layout): New function.
787         (Sized_relobj_file::is_deferred_layout_): New data member.
788
789 2014-11-21  H.J. Lu  <hongjiu.lu@intel.com>
790
791         PR gold/17619
792         * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
793         Check PC-relative offset overflow in PLT entry.
794
795 2014-11-21  Alan Modra  <amodra@gmail.com>
796
797         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
798         for undefined weaks.
799
800 2014-11-20  Alan Modra  <amodra@gmail.com>
801
802         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
803         from --stub-group-size parameter divided by 1024.
804         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
805         template parameter.  Update all uses.
806         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
807         has_stub_value.  Set for long branches.  Don't report overflow for
808         branch to undefined weak symbols.  Print info message on
809         overflowing branch to stub.
810
811 2014-11-20  Alan Modra  <amodra@gmail.com>
812
813         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
814
815 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
816
817         * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
818         entry for R_X86_64_GOTPLT64.
819         (Target_x86_64<size>::Relocate::relocate): Update comments for
820         R_X86_64_GOTPLT64.
821
822 2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>
823
824         * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
825         * plugin.h: add lock definition
826
827 2014-10-29  Han Shen  <shenhan@google.com>
828             Jing Yu   <jingyu@google.com>
829
830         * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
831         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
832         TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
833         Symbol::TLS_REF.
834         * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
835         method.
836         (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
837         (Target_aarch64::tls_ld_to_le): New method.
838         (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
839         for 64bit targets.
840         (Output_data_plt_aarch64::irelative_rel_): New data member.
841         (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
842         (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
843         (Output_data_plt_aarch64::add_relocation): New method.
844         (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
845         offset. Add got_irelative size to got size.
846         (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
847         type string with the new typename.
848         (AArch64_relocate_functions::update_adr): Replace parameter x with
849         immed.
850         (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
851         (AArch64_relocate_functions::reloc_common): New method.
852         (AArch64_relocate_funcsions::rela_general): Extract common part out
853         into reloc_common method.
854         (AArch64_relocate_functions::rela_general): Likewise.
855         (AArch64_relocate_functions::pcrela_general): Likewise.
856         (AArch64_relocate_functions::adr): New method.
857         (AArch64_relocate_functions::adrp): Calculate immed before calling
858         update_adr.
859         (AArch64_relocate_functions::adrp): Likewise.
860         (AArch64_relocate_functions::movnz): Cast x to SignedW type when
861         comparing x to 0. Calculate immed from ~x when x < 0.
862         (Target_aarch64::optimize_tls_reloc): Add new cases for
863         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
864         TLSLD_MOVW_DTPREL_G0_NC.
865         (Target_aarch64::possible_function_pointer_reloc): Implement this
866         method.
867         (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
868         comment.
869         (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
870         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
871         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
872         (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
873         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
874         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
875         (Target_aarch64::make_plt_entry): Call add_entry with two more
876         parameters.
877         (Target_aarch64::make_local_ifunc_plt_entry): New method.
878         (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
879         ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
880         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
881         (Target_aarch64::Relocate::relocate_tls): Add cases for
882         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
883         TLSLD_MOVW_DTPREL_G0_NC.
884         * testsuite/icf_safe_so_test.cc: Correct test comment.
885         * testsuite/icf_safe_test.sh: Add AArch64 arch.
886
887 2014-10-22  Alan Modra  <amodra@gmail.com>
888
889         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
890         thread_starter.
891
892 2014-10-18  Andreas Schwab  <schwab@linux-m68k.org>
893
894         * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
895
896 2014-10-17  Cary Coutant  <ccoutant@google.com>
897
898         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
899         Add "typename" keyword.
900
901 2014-10-15  Han Shen  <shenhan@google.com>
902             Jing Yu   <jingyu@google.com>
903
904         Patch for gold aarch64 backend to support relaxation.
905         * aarch64-reloc.def: Change format.
906         * aarch64.cc (class Reloc_stub): New class.
907         (class Stub_table): New class.
908         (class AArch64_relobj): New class.
909         (class AArch64_input_section): New class.
910         (class AArch64_output_section): New class.
911         (Target_aarch64::new_stub_table): New method.
912         (Target_aarch64::new_aarch64_input_section): New method.
913         (Target_aarch64::find_aarch64_input_section): New method.
914         (Target_aarch64::scan_section_for_stubs): New method.
915         (Target_aarch64::scan_reloc_section_for_stubs): New method.
916         (Target_aarch64::relocate_stub): New method.
917         (Target_aarch64::current_target): New method.
918         (Target_aarch64::do_make_elf_object): New method.
919         (Target_aarch64::do_may_relax): New method.
920         (Target_aarch64::do_relax): New method.
921         (Target_aarch64::group_sections): New method.
922         (Target_aarch64::scan_reloc_for_stub): New method.
923         (Target_aarch64::do_make_output_section): New method.
924         (Target_aarch64::stub_tables_): New data member.
925         (Target_aarch64::aarch64_input_section_map_): New data member.
926         (AArch64_relocate_functions::maybe_apply_stub): New method.
927
928 2014-09-30  Cary Coutant  <ccoutant@google.com>
929
930         PR gold/17432
931         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
932
933 2014-09-30  Kito Cheng  <kito@0xlab.org>
934
935         PR gold/13597
936         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
937         hash table before sysv-style hash table.
938
939 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
940
941         * options.h (--pic-executable): Add negative to alias to -no-pie.
942
943 2014-09-26  Cary Coutant  <ccoutant@google.com>
944
945         PR gold/16773
946         * object.cc (Sized_relobj_file): Compute value of section symbols
947         for TLS sections the same as TLS symbols.
948
949 2014-09-25  Cary Coutant  <ccoutant@google.com>
950
951         PR gold/17432
952         * resolve.cc (Symbol_table::resolve): Override common placeholder
953         symbols, but adjust sizes.
954         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
955         symbols to common lists.
956
957 2014-09-24  Alan Modra  <amodra@gmail.com>
958
959         * po/POTFILES.in: Regenerate.
960
961 2014-09-23  Taiju Tsuiki  <tzik@google.com>
962             Cary Coutant  <ccoutant@google.com>
963
964         PR gold/14860
965         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
966         on input_sections_blocker.
967         * layout.cc (Write_sections_task::locks): Unblock
968         input_sections_blocker_.
969         * layout.h (Write_sections_task::Write_sections_task): Add
970         input_sections_blocker.
971         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
972         to DEPENDENCIES.
973         * testsuite/Makefile.in: Regenerate.
974
975 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
976
977         * testsuite/Makefile.am (plugin_test_10): New test.
978         * testsuite/Makefile.in: Regenerate
979         * testsuite/plugin_common_test_2.c (c1): Align to 8.
980         * testsuite/plugin_test_10.sh: New file.
981
982 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
983
984         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
985         * resolve.cc (Symbol_table::resolve): Don't override common symbols
986         during the replacement phase.
987
988 2014-09-17  Han Shen  <shenhan@google.com>
989             Jing Yu  <jingyu@google.com>
990
991         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
992         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
993         * aarch64.cc (Target_aarch64): Add data members
994         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
995         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
996         constructor.
997         (Target_aarch64::do_reloc_symbol_index): New method.
998         (Target_aarch64::do_reloc_addend): New method.
999         (Target_aarch64::add_tlsdesc_info): New method.
1000         (Target_aarch64::do_dynsym_value): New method.
1001         (Target_aarch64::do_make_data_plt): Add new parameters: got,
1002         got_irelative. Pass them to Output_data_plt_aarch64_standard.
1003         (Target_aarch64::make_data_plt): Add new parameters: got,
1004         got_irelative. Pass them to do_make_data_plt.
1005         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
1006         (Target_aarch64::Relocate:tls_gd_to_le): New method.
1007         (Target_aarch64::Relocate:tls_ie_to_le): New method.
1008         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
1009         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
1010         (Target_aarch64::got_tlsdesc_section): New method.
1011         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1012         (Target_aarch64::define_tls_base_symbol): New method.
1013         (Target_aarch64::reserve_tlsdesc_entries): New method.
1014         (Target_aarch64::got_mod_index_entry): New method.
1015         (Target_aarch64::rela_tlsdesc_section): New method.
1016         (Target_aarch64::rela_irelative_section): New method.
1017         (Target_aarch64::Tlsdesc_info): New struct.
1018         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
1019         relocations and tlsdesc relocations.
1020         (Target_aarch64::optimize_tls_reloc): Implement method.
1021         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
1022         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
1023         in constructor.
1024         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
1025         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
1026         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
1027         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
1028         (Output_data_plt_aarch64::rela_tlsdesc): New method.
1029         (Output_data_plt_aarch64::rela_irelative): New method.
1030         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
1031         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
1032         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
1033         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
1034         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
1035         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
1036         (Output_data_plt_aarch64_standard): New member variables:
1037         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
1038         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
1039         New parameter: got, got_irelative.
1040         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
1041         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
1042         (Output_data_plt_aarch64::do_write): Replace got_address with
1043         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
1044         (AArch64_relocate_functions::update_movnz): New method.
1045         (AArch64_relocate_functions): Correct format.
1046         (AArch64_relocate_functions::movnz): New method.
1047         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
1048         before the switch. Add new cases to switch.
1049         Check ie_to_le relaxation on tlsie relocations. Add code handling
1050         tlsgd tlsdesc cases.
1051         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
1052         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
1053         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
1054         Call reloc_name_in_error_message to print unsupported reloc.
1055         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
1056         make_data_plt.
1057         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
1058         relocs. Fill in some more dynamic tags.
1059         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
1060         Skip call tls_get_addr when tlsgd is relaxed.
1061         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
1062         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
1063         tlsdesc->ie relaxation.
1064
1065 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1066
1067         * mips.cc (Target_mips_nacl): New class.
1068         (Target_selector_mips_nacl): New class.
1069         (target_selector_mips32): Rename from target_selector_mips32be and use
1070         Target_selector_mips_nacl instead of Target_selector_mips.
1071         (target_selector_mips32el): Rename from target_selector_mips32 and use
1072         Target_selector_mips_nacl instead of Target_selector_mips.
1073         (target_selector_mips64): Rename from target_selector_mips64be and use
1074         Target_selector_mips_nacl instead of Target_selector_mips.
1075         (target_selector_mips64el): Rename from target_selector_mips64 and use
1076         Target_selector_mips_nacl instead of Target_selector_mips.
1077         (Target_mips::mips_info): Add const attribute.
1078
1079 2014-09-02  Cary Coutant  <ccoutant@google.com>
1080
1081         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
1082         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
1083         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
1084         (Sized_incr_dynobj::do_section_name): Likewise.
1085         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
1086         (Sized_incr_dynobj::do_section_name): Likewise.
1087         * object.h (Object::section_name): Likewise.
1088         (Object::do_section_name): Likewise.
1089         (Sized_relobj_file::do_section_name): Likewise.
1090         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
1091         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
1092
1093 2014-09-02  Cary Coutant  <ccoutant@google.com>
1094
1095         PR gold/17005
1096         * ehframe.cc (Fde::write): Add output_offset parameter.
1097         (Cie::write): Likewise.
1098         (Eh_frame::set_final_data_size): Account for offset within output
1099         section.
1100         (Eh_frame::do_sized_write): Likewise.
1101         * ehframe.h (Fde::write): Add output_offset parameter.
1102         (Cie::write): Likewise.
1103         * output.cc (Output_section::Input_section_sort_entry): Remove
1104         section_has_name_; add output_section_name parameter. Use
1105         output section name for non-input sections.
1106         (Output_section::Input_section_sort_entry::section_has_name): Remove.
1107         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
1108         (Output_section::Input_section_sort_compare): Remove logic for
1109         sections without names.
1110         (Output_section::Input_section_sort_init_fini_compare): Likewise.
1111         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
1112         Likewise.
1113         (Output_section::Input_section_sort_section_name_compare): Likewise.
1114
1115 2014-08-29 Han Shen <shenhan@google.com>
1116            Jing Yu <jingyu@google.com>
1117
1118         * aarch64-reloc-property.cc
1119         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
1120         reference reloc property in the table.
1121         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
1122         3 other entries.
1123         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
1124         2 new overloaded methods.
1125         (Output_data_got_aarch64::do_write): Add code to write out
1126         static relocs.
1127         (class Output_data_got_aarch64::Static_reloc): New class to wrap
1128         static relocs.
1129         (Output_data_got_aarch64::static_relocs): New vector to
1130         hold static relocs.
1131         (Target_aarch64::TCB_SIZE): New const static memeber.
1132         (Target_aarch64::tcb_size): New method.
1133         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
1134         (Target_aarch64::Relocate::relocate_tls): New method.
1135         (Target_aarch64::Scan::local): Add code handling new reloc types.
1136         (Target_aarch64::Scan::global): Add code handling new reloc types.
1137
1138 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
1139
1140         * options.h (-no-pie): Add option.
1141
1142 2014-08-08  Jing Yu  <jingyu@google.com>
1143             Han Shen  <shenhan@google.com>
1144
1145         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
1146         (DEFFILES): add aarch64-reloc.def.
1147         (TARGETSOURCES): Add aarch64-reloc-property.cc.
1148         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
1149         * Makefile.in: Regenerate.
1150         * aarch64-reloc-property.cc: New file.
1151         * aarch64-reloc-property.h: New file.
1152         * aarch64-reloc.def: New file.
1153         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
1154         with tab to make the format consistent.
1155         (Output_data_got_aarch64::symbol_table_): New method.
1156         (Target_aarch64::do_plt_address_for_global): New method.
1157         (Target_aarch64::do_plt_address_for_local): New method.
1158         (Target_aarch64::do_select_as_default_target): New method.
1159         (Target_aarch64::do_make_data_plt): New method.
1160         (Target_aarch64::make_data_plt): New method.
1161         (Output_data_plt_aarch64::has_irelative_section): New method.
1162         (Output_data_plt_aarch64::address_for_global): New method.
1163         (Output_data_plt_aarch64::address_for_local): New method.
1164         (Output_data_plt_aarch64::irelative_rel_): New parameter.
1165         (Output_data_plt_aarch64::add_entry): Implement contents.
1166         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
1167         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
1168         the got_pov entry to plt0.
1169         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
1170         Implement contents.
1171         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
1172         (AArch64_howto): New struct.
1173         (aarch64_howto[]): New static const array.
1174         (AArch64_relocate_functions): New class.
1175         (Target_aarch64::Scan::get_reference_flags): Remove method.
1176         (Target_aarch64::Scan::local): Implement to support a few relocations.
1177         (Target_aarch64::Scan::global): Implement to support a few relocations.
1178         (Target_aarch64::make_plt_section): Implement contents.
1179         (Target_aarch64::make_plt_entry): Implement contents.
1180         (Target_aarch64::do_finalize_sections): Implement contents.
1181         (Target_aarch64::Relocate::relocate): Implement a few relocations.
1182         (Target_aarch64::relocate_section): Implement contents.
1183
1184 2014-08-06  Alan Modra  <amodra@gmail.com>
1185
1186         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
1187
1188 2014-08-06  Alan Modra  <amodra@gmail.com>
1189
1190         PR 13227
1191         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
1192
1193 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
1194
1195         * object.cc (Relobj::is_section_name_included): Add
1196         ".rodata.nptl_version" to not garbage collect this section.
1197
1198 2014-07-08  Cary Coutant  <ccoutant@google.com>
1199
1200         * expression.cc (struct Expression::Expression_eval_info): Add
1201         new fields type_pointer, vis_pointer, and nonvis_pointer.
1202         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
1203         nonvis_pointer parameters. Adjust all calls.
1204         (Symbol_expression::value): Update type, visibility, and nonvis bits
1205         in caller.
1206         * script.cc (Symbol_assignment::sized_finalize): Update type,
1207         visibility, and remaining st_other bits for new symbol.
1208         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
1209         vis_pointer, and nonvis_pointer parameters.
1210         * symtab.h (Symbol::set_type): New method.
1211
1212         * testsuite/Makefile.am (defsym_test): New test.
1213         * testsuite/Makefile.in: Regenerate.
1214         * testsuite/defsym_test.c: New file.
1215         * testsuite/defsym_test.sh: New file.
1216
1217 2014-07-08  Cary Coutant  <ccoutant@google.com>
1218
1219         PR gold/15639
1220         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
1221         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
1222         (Sized_dynobj::base_read_symbols): ...new method.
1223         * object.h (Sized_relobj_file::base_read_symbols): New method.
1224         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
1225         (Sized_relobj_file::base_read_symbols): ...new method.
1226         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
1227         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
1228         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
1229
1230 2014-07-04  Alan Modra  <amodra@gmail.com>
1231
1232         * po/POTFILES.in: Regenerate.
1233
1234 2014-07-02  Jing Yu  <jingyu@google.com>
1235
1236         * aarch64.cc: New file
1237         * Makefile.am (TARGETSOURCES): Add aarch64.cc
1238         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
1239         * Makefile.in: Regenerate.
1240         * configure.tgt: Add entries for aarch64*.
1241         * configure.ac:  Likewise.
1242         * configure: Likewise.
1243
1244 2014-06-27  Alan Modra  <amodra@gmail.com>
1245
1246         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
1247
1248 2014-06-24  Cary Coutant  <ccoutant@google.com>
1249
1250         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
1251         sections.
1252         (Dwo_file::sized_read_unit_index): Likewise.
1253
1254 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1255
1256         * mips.cc: New file.
1257         * Makefile.am (TARGETSOURCES): Add mips.cc
1258         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
1259         * configure.tgt: Add entries for mips*.
1260         * configure.ac: Likewise.
1261         * Makefile.in: Regenerate.
1262         * configure: Likewise.
1263
1264 2014-06-09  Cary Coutant  <ccoutant@google.com>
1265
1266         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
1267         unit_length is within section bounds.
1268
1269 2014-06-09  Cary Coutant  <ccoutant@google.com>
1270
1271         PR gold/16980
1272         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
1273         map.
1274
1275 2014-06-07  Alan Modra  <amodra@gmail.com>
1276
1277         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
1278
1279 2014-06-06  Cary Coutant  <ccoutant@google.com>
1280
1281         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
1282         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
1283         (Dwarf_pubnames_table::read_header): Likewise.
1284         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
1285         .debug_gnu_pubtypes.
1286
1287 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
1288
1289         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
1290         * Makefile.in, configure: Regenerate.
1291
1292 2014-06-03  Alan Modra  <amodra@gmail.com>
1293
1294         * powerpc.cc (addis_12_2): Define.
1295         (Stub_table::do_write): Support fusion on ELFv2 stubs.
1296
1297 2014-06-03  Alan Modra  <amodra@gmail.com>
1298
1299         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
1300         st_other output.
1301
1302 2014-06-02  Alan Modra  <amodra@gmail.com>
1303
1304         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
1305         Only ignore relocs on ELFv1.
1306         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
1307
1308 2014-05-30  Cary Coutant  <ccoutant@google.com>
1309
1310         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
1311         * testsuite/Makefile.in: Regenerate.
1312         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
1313
1314 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
1315
1316         PR gold/16945
1317         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
1318         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
1319
1320 2014-05-15  Alan Modra  <amodra@gmail.com>
1321
1322         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
1323         Compare FDE contents with DW_CFA_nop rather than 0.
1324
1325 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
1326
1327         * symtab.h (may_need_copy_reloc): Remove check for position independent
1328         code.
1329         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
1330         position independence before pc absolute may_need_copy_reloc call.
1331         Add check for executable output befor pc relative may_need_copy_reloc
1332         call.
1333         * i386.cc: Ditto.
1334         * arm.cc: Ditto.
1335         * sparc.cc: Ditto.
1336         * tilegx.cc: Ditto.
1337         * powerpc.cc: Add check for no position independence before
1338         may_need_copy_reloc calls.
1339         * testsuite/pie_copyrelocs_test.cc: New file.
1340         * testsuite/pie_copyrelocs_shared_test.cc: New file.
1341         * Makefile.am (pie_copyrelocs_test): New test.
1342         * Makefile.in: Regenerate.
1343
1344 2014-05-08  Martin Liška  <mliska@suse.cz>
1345
1346         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
1347
1348 2014-05-06  Cary Coutant  <ccoutant@google.com>
1349
1350         PR gold/16900
1351         * i386.cc (Output_data_got_plt_i386): New class.
1352         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
1353         parameter. Change all callers.
1354         (Output_data_plt_i386::layout_): Remove.
1355         (Output_data_plt_i386::got_plt_): Change type.
1356         (Target_i386::got_plt_): Change type. Change all references.
1357         (Target_i386::got_section): Create instance of new class.
1358         (Output_data_got_plt_i386::do_write): New function.
1359         * x86_64.cc (Output_data_got_plt_x86_64): New class.
1360         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
1361         parameter. Change all callers.
1362         (Output_data_plt_x86_64::layout_): Remove.
1363         (Output_data_plt_x86_64::got_plt_): Change type.
1364         (Target_x86_64::got_plt_): Change type. Change all references.
1365         (Target_x86_64::got_section): Create instance of new class.
1366         (Output_data_got_plt_x86_64::do_write): New function.
1367         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
1368         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
1369         class.
1370
1371 2014-05-05  Cary Coutant  <ccoutant@google.com>
1372
1373         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
1374         if we have pubnames/pubtypes.
1375
1376 2014-05-02  Cary Coutant  <ccoutant@google.com>
1377
1378         * defstd.cc (in_segment): Define __ehdr_start here...
1379         * layout.cc (Layout::finalize): ...Instead of here.  Set the
1380         output segment when known.
1381         * resolve.cc (Symbol::override_base_with_special): Remember
1382         the original binding.
1383         * symtab.cc (Symbol::set_output_segment): New function.
1384         (Symbol::set_undefined): New function.
1385         * symtab.h (Symbol::is_weak_undefined): Check original undef
1386         binding.
1387         (Symbol::is_strong_undefined): New function.
1388         (Symbol::set_output_segment): New function.
1389         (Symbol::set_undefined): New function.
1390         * target-reloc.h (is_strong_undefined): Remove.
1391         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
1392         Check for hidden undefs.
1393         (relocate_section): Call Symbol::is_strong_undefined.
1394
1395         * testsuite/Makefile.am (ehdr_start_test_1)
1396         (ehdr_start_test_2, ehdr_start_test_3)
1397         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
1398         * testsuite/Makefile.in: Regenerate.
1399         * testsuite/ehdr_start_def.cc: New source file.
1400         * testsuite/ehdr_start_test.cc: New source file.
1401         * testsuite/ehdr_start_test.t: New linker script.
1402         * testsuite/ehdr_start_test_4.sh: New shell script.
1403
1404 2014-04-23  Cary Coutant  <ccoutant@google.com>
1405
1406         PR gold/16870
1407         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
1408
1409 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1410
1411         * layout.cc (Layout::include_section): Allow a target to decide
1412         whether to include a section.
1413         * target.h (Target::should_include_section): New function.
1414         (Target::do_should_include_section): New function.
1415
1416 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1417
1418         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
1419         inline into ...
1420         (Copy_relocs::emit): ... here.
1421         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
1422         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
1423         (Copy_reloc_entry::entries_): Change from private to protected.
1424
1425 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
1426
1427         * icf.cc (get_section_contents): Replace copies of reloc
1428         vectors with const references.
1429
1430 2014-04-02  Cary Coutant  <ccoutant@google.com>
1431
1432         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
1433         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
1434         * configure: Regenerate.
1435         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
1436         -fno-use-linker-plugin.
1437         (LINK1, CXXLINK1): Add it to the link command.
1438         * testsuite/Makefile.in: Regenerate.
1439
1440 2014-03-12  Alan Modra  <amodra@gmail.com>
1441
1442         * Makefile.in: Regenerate.
1443
1444 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1445
1446         * symtab.h (Symbol::set_nonvis): New function.
1447
1448 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1449
1450         * symtab.cc (Sized_symbol<32>::init_output_data):
1451         Instantiate the template.
1452         (Sized_symbol<64>::init_output_data): Likewise.
1453
1454 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1455
1456         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
1457         adjust dynamic symbol value.
1458         * target.h (Target::adjust_dyn_symbol): New function.
1459         (Target::do_adjust_dyn_symbol): New function.
1460
1461 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1462
1463         * output.cc (Output_data_dynamic::Dynamic_entry::write):
1464         Get the value of DYNAMIC_CUSTOM dynamic entry.
1465         * output.h (Output_data_dynamic::add_custom): New function.
1466         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
1467         dynamic entry.
1468         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
1469         * target.h (Target::dynamic_tag_custom_value): New function.
1470         (Target::do_dynamic_tag_custom_value): New function.
1471
1472 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1473
1474         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
1475         dynsym indexes.
1476         * target.h (Target::has_custom_set_dynsym_indexes): New function.
1477         (Target::do_has_custom_set_dynsym_indexes): New function.
1478         (Target::set_dynsym_indexes): New function.
1479         (Target::do_set_dynsym_indexes): New function.
1480
1481 2014-03-07  Alan Modra  <amodra@gmail.com>
1482
1483         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
1484         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
1485         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
1486         (Powerpc_relocate_functions::has_overflow_bitfield,
1487         overflowed): Use the above.
1488         (Target_powerpc::Relocate::relocate): Correct overflow checking
1489         for a number of relocations.  Modify overflow test for 16-bit
1490         fields in instructions to signed/unsigned according to whether
1491         the field takes a signed or unsigned value.
1492
1493 2014-03-05  Alan Modra  <amodra@gmail.com>
1494
1495         Update copyright years.
1496
1497 2014-03-05  Alan Modra  <amodra@gmail.com>
1498
1499         * powerpc.cc (Target_powerpc::Scan::local, global): Support
1500         R_PPC64_ADDR64_LOCAL.
1501         (Target_powerpc::Relocate::relocate): Likewise.
1502
1503 2014-03-03  Alan Modra  <amodra@gmail.com>
1504
1505         * dwp.cc (print_version): Update copyright year to current.
1506
1507 2014-02-10  Alan Modra  <amodra@gmail.com>
1508
1509         * po/gold.pot: Regenerate.
1510
1511 2014-02-06  Cary Coutant  <ccoutant@google.com>
1512
1513         Fix problem where -u is ignored when a weak undef is seen.
1514
1515         * archive.cc (Library_base::should_include_member): Reorder
1516         code to check for -u option if a weak undef has already been seen.
1517         * testsuite/Makefile.am (weak_undef_test_2): New test case.
1518         * testsuite/Makefile.in: Regenerate.
1519         * testsuite/weak_undef_file3.cc: New file.
1520         * testsuite/weak_undef_file4.cc: New file.
1521         * testsuite/weak_undef_test_2.cc: New file.
1522
1523 2014-02-05  Cary Coutant  <ccoutant@google.com>
1524
1525         Fix issues with gold undefined symbol diagnostics.
1526
1527         PR binutils/15435
1528         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
1529         check to here.
1530         * target-reloc.h (is_strong_undefined): New function.
1531         (relocate_section): Move undef vtable symbol check from here.
1532         Check for is_strong_undefined.
1533
1534 2014-02-05  Cary Coutant  <ccoutant@google.com>
1535
1536         Fix problems with the --dynamic-list option.
1537
1538         PR gold/13577
1539         * options.cc (General_options::parse_dynamic_list):
1540         Set have_dynamic_list_.
1541         (General_options::General_options): Initialize have_dynamic_list_.
1542         (General_options::finalize): Turn off -Bsymbolic and
1543         -Bsymbolic-functions if --dynamic-list provided.
1544         * options.h (General_options::have_dynamic_list): New function.
1545         (General_options::have_dynamic_list_): New data member.
1546         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
1547         correctly.
1548
1549         PR gold/16530
1550         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
1551         in --dynamic-list, mark it.
1552
1553         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
1554         (dynamic_list_2): New test case.
1555         * testsuite/Makefile.in: Regenerate.
1556         * testsuite/dynamic_list_2.cc: New file.
1557         * testsuite/dynamic_list_2.t: New file.
1558         * testsuite/dynamic_list_lib1.cc: New file.
1559         * testsuite/dynamic_list_lib2.cc: New file.
1560         * testsuite/gc_dynamic_list_test.c: New file.
1561         * testsuite/gc_dynamic_list_test.sh: New file.
1562         * testsuite/gc_dynamic_list_test.t: New file.
1563
1564 2014-01-28  Cary Coutant  <ccoutant@google.com>
1565
1566         Add .gdb_index version 7 support.
1567
1568         * gold/dwarf_reader.cc: include <utility> (for make_pair).
1569         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
1570         debug sections.
1571         (Dwarf_ranges_table::read_ranges_table): Likewise.
1572         (Dwarf_pubnames_table::read_section): Check for GNU-style
1573         sections, and for compressed debug sections.
1574         (Dwarf_pubnames_table::read_header): Compute end address of table.
1575         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
1576         for end of list by offset, not by offset == 0.
1577         (Dwarf_info_reader::do_read_string_table): Check for compressed
1578         debug sections.
1579         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1580         Initialize new data members.
1581         (Dwarf_pubnames_table::next_name): return flag_byte.
1582         (Dwarf_pubnames_table::end_of_table_): New data member.
1583         (Dwarf_pubnames_table::is_gnu_style_): New data member.
1584         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
1585         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
1586         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
1587         read skeleton type unit DIEs.
1588         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
1589         (Gdb_index::do_write): Write flag_byte.
1590         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
1591         (Gdb_index::Cu_vector): Store flags along with cu indexes.
1592         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
1593         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
1594
1595 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
1596
1597         * version.cc (print_version): Update copyright year to 2014.
1598
1599 2013-12-19  Dimitry Andric  <dimitry@andric.com>
1600
1601         * stringpool.cc (Stringpool_template::reserve): Add
1602         HAVE_UNORDERED_MAP case.
1603         * stringpool.cc (Stringpool_template::print_stats): Likewise.
1604
1605 2013-12-18  Cary Coutant  <ccoutant@google.com>
1606
1607         * configure.ac: Check for <unordered_set> and <unordered_map>.
1608         * config.in: Regenerate.
1609         * configure: Regenerate.
1610         * system.h: Use <unordered_set> and <unordered_map> if available.
1611
1612 2013-12-10  Roland McGrath  <mcgrathr@google.com>
1613
1614         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
1615         with $(INSTALL_PROGRAM_ENV).
1616         * Makefile.in: Regenerate.
1617
1618 2013-11-22  Cary Coutant  <ccoutant@google.com>
1619
1620         * configure.ac: Add check for which library is needed for
1621         dlopen.
1622         * configure: Regenerate.
1623
1624 2013-11-22  Cary Coutant  <ccoutant@google.com>
1625
1626         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
1627         assembler.
1628         * testsuite/Makefile.in: Regenerate.
1629
1630 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
1631
1632         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
1633         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
1634         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
1635         (Target_x86_64<size>::Scan::local): Likewise.
1636         (Target_x86_64<size>::Scan::global): Likewise.
1637         (Target_x86_64<size>::Relocate::relocate): Likewise.
1638         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
1639         Likewise.
1640         (Target_x86_64<size>::Scan::check_non_pic(): Handle
1641         R_X86_64_PC32_BND.
1642
1643         * testsuite/Makefile.am (check_PROGRAMS): Add
1644         exception_x86_64_bnd_test.
1645         (exception_x86_64_bnd_test_SOURCES): New macro.
1646         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
1647         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
1648         (exception_x86_64_bnd_test_LDADD): Likewise.
1649         (exception_x86_64_bnd_1.o): New rule.
1650         (exception_x86_64_bnd_2.o): Likewise.
1651         * testsuite/Makefile.in: Regenerated.
1652
1653 2013-11-15  Alan Modra  <amodra@gmail.com>
1654
1655         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
1656         accessor.
1657         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
1658         Only call ppc64_local_entry_offset for 64-bit.  Restrict
1659         symval_for_branch lookup to ELFv1.
1660         (Stub_table::add_plt_call_entry): Use unsigned int off.
1661         (Output_data_glink::Address, invalid_address): New.
1662         (Output_data_glink::add_eh_frame): Move out of line.  Add
1663         support for ELFv2.
1664         (Output_data_glink::add_global_entry, find_global_entry,
1665         global_entry_address): New functions.
1666         (Output_data_glink::global_entry_stubs_, end_branch_table_,
1667         ge_size): New variables.
1668         (Output_data_glink::set_final_data_size): Add global entry
1669         stub sizing.
1670         (Output_data_glink::do_write): Write global entry stubs.
1671         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
1672         parameter.  Return true for ELFv2.  Adjust callers.
1673         (Target_powerpc::Scan::local, global): Restrict opd lookup to
1674         ELFv1.  Similarly for ifunc and dynamic relocation processing
1675         specific to ELFv1.  Recognize that symbols are defined on
1676         their plt entries for ELFv2.
1677         (Target_powerpc::symval_for_branch): Assert if called for
1678         ELFv2 or ppc32.
1679         (Target_powerpc::Relocate::relocate): Use global entry plt
1680         stub for symbol value if such exists on ELFv2.
1681         (Target_powerpc::Relocate::relocate): Don't call
1682         symval_for_branch when ELFv2.  Do adjust for local entry
1683         offset when ELFv2.
1684         (Target_powerpc::do_dynsym_value): Set symbols to global entry
1685         plt stub for ELFv2.
1686         (Target_powerpc::do_plt_address_for_global): Similarly.
1687
1688 2013-11-14  Cary Coutant  <ccoutant@google.com>
1689
1690         Revert patch -- this did not fix the problem, and there is
1691         no race there.
1692
1693         2013-11-14  Cary Coutant  <ccoutant@google.com>
1694
1695             PR gold/14860
1696             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1697             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1698             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1699             updating fde_offsets_.
1700             (Eh_frame_hdr::lock_): New data member.
1701
1702 2013-11-14  Cary Coutant  <ccoutant@google.com>
1703
1704         * dwp.cc (Dwo_file_entry): New type.
1705         (File_list): Use Dwo_file_entry.
1706         (Dwo_file::verify): New function.
1707         (Dwo_file::verify_dwo_list): New function.
1708         (Dwo_file::sized_verify_dwo_list): New function.
1709         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
1710         list.
1711         (Dwp_options): New enum type.
1712         (dwp_options): Add --verify-only.
1713         (usage): Likewise.
1714         (main): Likewise.
1715         * dwp.h (gold_info): Add declaration.
1716
1717 2013-11-14  Cary Coutant  <ccoutant@google.com>
1718
1719         PR gold/14860
1720         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1721         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1722         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1723         updating fde_offsets_.
1724         (Eh_frame_hdr::lock_): New data member.
1725
1726 2013-11-06  Cary Coutant  <ccoutant@google.com>
1727
1728         PR gold/15758
1729         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
1730         before reloc sections.
1731
1732 2013-11-04  Alan Modra  <amodra@gmail.com>
1733
1734         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
1735         (Symbol::needs_dynamic_reloc): Test new flag.
1736         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
1737         (Target_powerpc::Scan::get_reference_flags): Add target param.
1738         Return FUNC_DESC_ABI for 64-bit ELFv1.
1739         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
1740         call.
1741         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
1742         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
1743
1744 2013-10-31  Cary Coutant  <ccoutant@google.com>
1745
1746         Restore support for dwp v2 DWARF package file format.
1747
1748         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1749         tu_length parameter.  Adjust all callers.
1750         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1751         * dwp.cc: Include dwarf.h.
1752         (Section_bounds): New struct type.
1753         (Unit_set): New struct type.
1754         (Dwo_file::Dwo_file): Initialize new data member.
1755         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1756         Combine and rename to...
1757         (Dwo_file::read_unit_index): ...this.
1758         (Dwo_file::sized_read_compunit_index)
1759         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1760         (Dwo_file::sized_read_unit_index): ...this.
1761         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1762         parameters; add section_id parameter.
1763         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1764         (Dwo_file::add_unit_set): ...this.
1765         (Dwo_file::shndx_map_): Remove.
1766         (Dwo_file::sect_offsets_): New data member.
1767         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1768         (Dwp_output_file::add_section): Rename to...
1769         (Dwp_output_file::add_contribution): ...this.
1770         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1771         (Dwp_output_file::add_tu_set): Likewise.
1772         (Dwp_output_file::Contribution): New type.
1773         (Dwp_output_file::Section::contributions): New data member.
1774         (Dwp_output_file::Cu_or_tu_set): Remove.
1775         (Dwp_output_file::Section::Section): New ctor.
1776         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1777         (Dwp_output_file::Dwp_index::Section_table): New type.
1778         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1779         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1780         parameter.
1781         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1782         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1783         (Dwp_output_file::Dwp_index::section_table): New member function.
1784         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1785         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1786         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1787         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1788         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1789         (Dwp_output_file::Dwp_index::section_table_): New data member.
1790         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1791         (Dwp_output_file::add_output_section): New member function.
1792         (Dwp_output_file::write_new_section): New member function.
1793         (Dwp_output_file::write_contributions): New member function.
1794         (Dwp_output_file::section_id_map_): New data member.
1795         (class Dwo_id_info_reader): Remove.
1796         (class Unit_reader): New class.
1797         (get_dwarf_section_name): New function.
1798         (Dwo_file::read_executable): Adjust initializations of class data.
1799         (Dwo_file::read): Add support for v2 package file format.
1800         (Dwo_file::read_unit_index): Likewise.
1801         (Dwo_file::sized_read_unit_index): Likewise.
1802         (Dwo_file::copy_section): Likewise.
1803         (Dwo_file::add_unit_set): Likewise.
1804         (Dwp_output_file::add_output_section): Likewise.
1805         (Dwp_output_file::add_contribution): Likewise.
1806         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1807         for empty slot.
1808         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1809         file format.
1810         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1811         slot.
1812         (Dwp_output_file::initialize): Remove unused function.
1813         (Dwp_output_file::finalize): Add support for v2 package file format.
1814         (Dwp_output_file::write_index): Likewise.
1815         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1816         function prototype.
1817
1818 2013-10-31  Cary Coutant  <ccoutant@google.com>
1819
1820         * configure.ac: Fix check for -fmerge-constants.
1821         * configure.ac: Regenerate.
1822
1823 2013-10-30  Roland McGrath  <mcgrathr@google.com>
1824
1825         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
1826         Correct 9-byte nop sequence to match what the assembler generates.
1827
1828 2013-10-30  Alan Modra  <amodra@gmail.com>
1829
1830         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
1831         ppc64_local_entry_offset, ppc64_local_entry_offset,
1832         do_read_symbols): New functions.
1833         (Powerpc_relobj::e_flags_, st_other_): New vars.
1834         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
1835         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
1836         (Powerpc_relobj::e_flags_): New var.
1837         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
1838         and adjust for ELFv2.
1839         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
1840         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
1841         (Powerpc_dynobj::do_find_special_sections): Likewise.
1842         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
1843         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
1844         to ELFv2 local entry.
1845         (Target_powerpc::do_relax): No thread safe barriers needed for
1846         ELFv2.
1847         (Output_data_plt_powerpc::initial_plt_entry_size_,
1848         plt_entry_size): Delete.  Replace all uses with
1849         first_plt_entry_offset() and plt_entry_size().
1850         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
1851         reserved_size parm.  Update callers.
1852         (Output_data_plt_powerpc::entry_count): Update.
1853         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
1854         and use Target_powerpc::first_plt_entry_offset().
1855         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
1856         rename to plt_entry_size.
1857         (Output_data_plt_powerpc::add_ifunc_entry,
1858         add_local_ifunc_entry): Adjust reloc for ELFv2.
1859         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
1860         (glink_eh_frame_fde_64v2): New.
1861         (Stub_table::plt_call_size): Support ELFv2 sizing.
1862         (Output_data_glink::add_eh_frame): Use the new FDE.
1863         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
1864         (Stub_table::do_write): Write ELFv2 stubs and glink.
1865         (Target_powerpc::Relocate::relocate): Replaces nop after call
1866         with ld 2,24(1) and adjust local offset destination for ELFv2.
1867
1868 2013-10-30  Alan Modra  <amodra@gmail.com>
1869
1870         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
1871         (Target_powerpc::Scan::global, local): Likewise.
1872         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
1873         on all ppc64 @h and @ha relocs.
1874
1875 2013-10-14  Alan Modra  <amodra@gmail.com>
1876
1877         * output.h (Output_data_got::add_constant): Tidy.
1878         (Output_data_got::add_constant_pair): New function.
1879         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
1880         methods used so as to first call reserve_ent().
1881
1882 2013-10-11  Roland McGrath  <mcgrathr@google.com>
1883
1884         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
1885         add_got_entry and add_got_entry_pair.
1886
1887         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
1888         (HAVE_PUBNAMES): Likewise.
1889         * configure: Regenerate.
1890
1891         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
1892         * testsuite/Makefile.in: Regenerate.
1893
1894         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
1895         Remove const from declaration.
1896         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
1897         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
1898         * output.h (Output_file_header): Remove const from member target_
1899         and corresponding constructor argument.
1900         * output.cc (Output_file_header::Output_file_header): Update prototype.
1901         (Output_file_header::do_sized_write): Use this->target_ in place
1902         of parameters()->target().
1903
1904         * testsuite/undef_symbol.cc (Foo::get_a): New method.
1905
1906         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
1907         * configure: Regenerate.
1908         * Makefile.in: Regenerate.
1909         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
1910         * testsuite/merge_string_literals_2.c: Likewise.
1911         * testsuite/Makefile.am
1912         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
1913         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
1914         literal -fmerge-constants.
1915         * testsuite/Makefile.in: Regenerate.
1916
1917         * i386.cc (Target_i386): Remove unused member dynbss_.
1918         * arm.cc (Target_arm): Likewise.
1919         * powerpc.cc (Target_powerpc): Likewise.
1920         * sparc.cc (Target_sparc): Likewise.
1921         * tilegx.cc (Target_tilegx): Likewise.
1922         * x86_64.cc (Target_x86_64): Likewise.
1923         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
1924         type_signature_, type_offset_.
1925         * plugin.h (Plugin_hook): Remove unused member layout_.
1926         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
1927         mapfile_.
1928         (Read_member): Remove unused members input_objects_, symtab_,
1929         mapfile_, layout_.
1930         (Check_library): Remove unused member symtab_.
1931         * archive.h (Lib_group): Remove unused member lib_.
1932         * archive.cc (Lib_group::Lib_group): Update initializer.
1933         * incremental.h (Incremental_binary): Remove unused member target_.
1934         (Incremental_script_entry): Removed unused member script_.
1935         * layout.h (Write_symbols_task): Remove unused member input_objects_.
1936         * icf.h (Icf): Remove unused member num_tracked_relocs.
1937
1938         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1939         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1940         its only use.
1941         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1942
1943         * archive.h: Use struct rather than class for forward declaration
1944         of Read_symbols_data.
1945
1946 2013-10-07  Cary Coutant  <ccoutant@google.com>
1947
1948         PR gold/16010
1949         * testsuite/Makefile.am (icf_test): Fix dependencies.
1950         (icf_safe_test): Likewise.
1951         (icf_safe_so_test): Likewise.
1952         (large_symbol_alignment): Add empty _LDADD rule.
1953         * testsuite/Makefile.in: Regenerate.
1954
1955 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
1956
1957         PR gold/15927
1958         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1959         relocation for R_X86_64_32 on x32.
1960
1961 2013-08-27  Roland McGrath  <mcgrathr@google.com>
1962
1963         * output.cc (Output_segment::set_section_addresses): Take new
1964         Target* argument.  If target->isolate_execinstr() and the segment
1965         is executable and starts at a target->abi_pagesize() boundary,
1966         pad its end out to a target->abi_pagesize() boundary with code fill.
1967         * output.h (Output_segment::set_section_addresses): Update decl.
1968         * layout.h (Layout::check_output_data_for_reset_values): Take new
1969         argument RELAX_OUTPUTS.
1970         (Layout): New member relax_output_list_.
1971         (Layout::add_relax_output): New method.
1972         * layout.cc (Layout::Layout): Update constructor.
1973         (Layout::reset_relax_output): New method.
1974         (Layout::clean_up_after_relaxation): Call it.
1975         (Layout::prepare_for_relaxation): Update caller.
1976         (Layout::set_segment_offsets): Update callers of set_section_addresses.
1977         Call reset_relax_output before re-processing segments for
1978         isolate_execinstr case.
1979         (Layout::write_data): Handle relax_output_list_.
1980         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1981         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
1982
1983 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
1984
1985         PR binutils/15834
1986         * object.h: Fix typos.
1987
1988 2013-08-16  Roland McGrath  <mcgrathr@google.com>
1989
1990         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1991         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1992
1993 2013-08-07  Cary Coutant  <ccoutant@google.com>
1994
1995         Revert support for v2 DWP files:
1996
1997         2013-03-01  Cary Coutant  <ccoutant@google.com>
1998
1999             Add dwp support for v2 DWARF package file format.
2000             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2001             tu_length parameter.  Adjust all callers.
2002             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2003             * dwp.cc: Include dwarf.h.
2004             (Section_bounds): New struct type.
2005             (Unit_set): New struct type.
2006             (Dwo_file::Dwo_file): Initialize new data member.
2007             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2008             Combine and rename to...
2009             (Dwo_file::read_unit_index): ...this.
2010             (Dwo_file::sized_read_compunit_index)
2011             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2012             (Dwo_file::sized_read_unit_index): ...this.
2013             (Dwo_file::copy_section): Remove section_name, is_str_offsets
2014             parameters; add section_id parameter.
2015             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2016             (Dwo_file::add_unit_set): ...this.
2017             (Dwo_file::shndx_map_): Remove.
2018             (Dwo_file::sect_offsets_): New data member.
2019             (Dwp_output_file::Dwp_output_file): Initialize new data members.
2020             (Dwp_output_file::add_section): Rename to...
2021             (Dwp_output_file::add_contribution): ...this.
2022             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2023             (Dwp_output_file::add_tu_set): Likewise.
2024             (Dwp_output_file::Contribution): New type.
2025             (Dwp_output_file::Section::contributions): New data member.
2026             (Dwp_output_file::Cu_or_tu_set): Remove.
2027             (Dwp_output_file::Section::Section): New ctor.
2028             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2029             (Dwp_output_file::Dwp_index::Section_table): New type.
2030             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2031             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2032             parameter.
2033             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2034             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2035             (Dwp_output_file::Dwp_index::section_table): New member function.
2036             (Dwp_output_file::Dwp_index::section_table_end): New member function.
2037             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2038             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2039             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2040             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2041             (Dwp_output_file::Dwp_index::section_table_): New data member.
2042             (Dwp_output_file::Dwp_index::section_mask_): New data member.
2043             (Dwp_output_file::add_output_section): New member function.
2044             (Dwp_output_file::write_new_section): New member function.
2045             (Dwp_output_file::write_contributions): New member function.
2046             (Dwp_output_file::section_id_map_): New data member.
2047             (class Dwo_id_info_reader): Remove.
2048             (class Unit_reader): New class.
2049             (get_dwarf_section_name): New function.
2050             (Dwo_file::read_executable): Adjust initializations of class data.
2051             (Dwo_file::read): Add support for v2 package file format.
2052             (Dwo_file::read_unit_index): Likewise.
2053             (Dwo_file::sized_read_unit_index): Likewise.
2054             (Dwo_file::copy_section): Likewise.
2055             (Dwo_file::add_unit_set): Likewise.
2056             (Dwp_output_file::add_output_section): Likewise.
2057             (Dwp_output_file::add_contribution): Likewise.
2058             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2059             for empty slot.
2060             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2061             file format.
2062             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2063             slot.
2064             (Dwp_output_file::initialize): Remove unused function.
2065             (Dwp_output_file::finalize): Add support for v2 package file format.
2066             (Dwp_output_file::write_index): Likewise.
2067             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2068             function prototype.
2069
2070 2013-07-31  Cary Coutant  <ccoutant@google.com>
2071
2072         * object.cc (Sized_relobj::do_output_section_address): New function.
2073         (Sized_relobj): Instantiate explicitly.
2074         * object.h (Object::output_section_address): New function.
2075         (Object::do_output_section_address): New function.
2076         (Sized_relobj::do_output_section_address): New function.
2077         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
2078
2079 2013-07-30  Cary Coutant  <ccoutant@google.com>
2080             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2081
2082         * parameters.cc (Parameters::entry): Return target-specific entry
2083         symbol name.
2084         * target.h (Target::entry_symbol_name): New function.
2085         (Target_info::entry_symbol_name): New data member.
2086
2087         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
2088         * i386.cc (Target_i386::i386_info): Likewise.
2089         (Target_i386_nacl::i386_nacl_info): Likewise.
2090         * sparc.cc (Target_sparc::sparc_info): Likewise.
2091         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
2092         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
2093         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
2094         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2095
2096 2013-07-22  Sterling Augustine  <saugustine@google.com>
2097
2098         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
2099         Convert parameter shndx to local variable. Add parameters symtab
2100         and symtab_size.  Scan over section names.  Find relocation
2101         section corresponding to current section.  Create and initialize
2102         reloc_mapper_ and reloc_type_.
2103         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
2104         unit_length to off_t.  Initialize member unit_length_.  Fill in field
2105         cu_offset_.
2106         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2107         Initialize new fields unit_length_ and cu_offset_.
2108         (Dwarf_pubnames_table::read_section): Update prototype.
2109         (Dwarf_pubnames_table::cu_offset): New member function.
2110         (Dwarf_pubnames_table::subsection_size): Likewise.
2111         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
2112         New fields.
2113         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
2114         member functions public.
2115         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
2116         Update comment.  Rework logic.  Move repeated parts to...
2117         (Gdb_index_info_reader::read_pubtable): ...here. New function.
2118         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
2119         pubtypes_table_, and stmt_list_offset.
2120         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2121         Gdb_index::find_pubtype_offset,
2122         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
2123         (Gdb_index::pubnames_read): Update prototype and rework logic.
2124         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
2125         Forward declare.
2126         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2127         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
2128         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
2129         Gdb_index::map_pubtable_to_dies):
2130         Declare functions.
2131         (Gdb_index::pubnames_read): Update declaration.
2132         (Gdb_index::Pubname_offset_map): New type.
2133         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
2134         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
2135         Gdb_index::stmt_list_offset): Declare.
2136         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
2137         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
2138         Gdb_index::pubtypes_offset_): Remove.
2139
2140 2013-07-19  Roland McGrath  <mcgrathr@google.com>
2141
2142         * options.h (General_options): Add -Trodata-segment option.
2143         * parameters.cc (Parameters::check_rodata_segment): New function.
2144         (Parameters::set_target_once): Call it.
2145         * parameters.h (Parameters): Declare it (private member function).
2146         * layout.cc (load_seg_unusable_for_headers): New function, broken
2147         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
2148         then validate rodata segment rather than text segment.
2149         (relaxation_loop_body): Call that.
2150         (is_text_segment): New function.  Don't admit a non-executable
2151         segment if TARGET->isolate_execinstr().
2152         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
2153
2154 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
2155
2156         PR gold/15070
2157         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
2158         * nacl.h (Sniff_file::View::View): Request aligned view.
2159
2160 2013-07-11  Cary Coutant  <ccoutant@google.com>
2161
2162         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
2163         correct BRLT entry size.
2164
2165 2013-07-03  Alan Modra  <amodra@gmail.com>
2166
2167         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
2168         comment.
2169
2170 2013-07-01  Cary Coutant  <ccoutant@google.com>
2171
2172         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
2173         reloc_type_.
2174         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
2175         (Dwarf_ranges_table::lookup_reloc): New function.
2176         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
2177         reloc_type_.
2178         (Dwarf_ranges_table::lookup_reloc): New function.
2179         (Dwarf_ranges_table::reloc_type_): New data member.
2180
2181 2013-06-27  Jing Yu  <jingyu@google.com>
2182
2183         PR gold/15662
2184         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
2185         function.
2186         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
2187         (Target_powerpc::do_relax): Call the above.
2188
2189 2013-06-27  Cary Coutant  <ccoutant@google.com>
2190
2191         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
2192         on garbage collected .opd section.
2193
2194 2013-06-27  Alan Modra  <amodra@gmail.com>
2195
2196         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
2197         is non-zero.
2198         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
2199         (Target_powerpc::do_function_location): Likewise for loc->shndx.
2200
2201 2013-06-14  Cary Coutant  <ccoutant@google.com>
2202
2203         * resolve.cc (Symbol::override_base): Don't override st_type
2204         from plugin placeholder symbols.
2205         (Symbol_table::resolve): Likewise.
2206         (Symbol_table::should_override): Don't complain about TLS mismatch
2207         if the TO symbol is a plugin placeholder.
2208         * testsuite/Makefile.am (plugin_test_tls): New test.
2209         * testsuite/Makefile.in: Regenerate.
2210         * testsuite/plugin_test_tls.sh: New test script.
2211         * testsuite/two_file_test_2_tls.cc: New test source.
2212         * testsuite/two_file_test_tls.cc: New test source.
2213
2214 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2215
2216         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
2217         the maximum segment alignment is larger than the page size.
2218         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
2219         correctly aligns the symbols with large alignemnt.
2220         * testsuite/Makefile.in: Regenerate.
2221         * testsuite/large_symbol_alignment.cc: New file.
2222
2223 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2224             Sriraman Tallam  <tmsriram@google.com>
2225
2226         * options.h (sort_section): New option.
2227         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
2228         Rename from Input_section_sort_section_name_special_ordering_compare.
2229         (Input_section_sort_section_name_compare): New struct.
2230         * output.cc (Output_section::Input_section_sort_section_name_compare::
2231         operator()): New function.
2232         (Output_section::sort_attached_input_sections): Use new sort function
2233         for .text if --sort-section=name is specified.
2234         * layout.cc (Layout::make_output_section):
2235         Add sorting by name when --sort-section=name is specified.
2236         * testsuite/Makefile.am (text_section_grouping): Test option
2237         --sort-section=name.
2238         * testsuite/Makefile.in: Regenerate.
2239         * testsuite/section_sorting_name.cc: New file.
2240         * testsuite/section_sorting_name.sh: New file.
2241
2242 2013-05-21  Cary Coutant  <ccoutant@google.com>
2243
2244         * symtab.h (Symbol::is_cxx_vtable): New function.
2245         * target-reloc.h (relocate_section): Check for vtable symbol.
2246         * testsuite/Makefile.am (missing_key_func.sh): New test case.
2247         * testsuite/Makefile.in: Regenerate.
2248         * testsuite/missing_key_func.cc: New test source.
2249         * testsuite/missing_key_func.sh: New test script.
2250
2251 2013-05-21  Cary Coutant  <ccoutant@google.com>
2252
2253         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
2254         type of enclosing symbol.
2255         (Relocate_info::location): Check symbol type when describing symbol.
2256         * object.h (Symbol_location_info): Remove unused line_number;
2257         add enclosing_symbol_type.
2258         * testsuite/debug_msg.sh: Adjust expected output.
2259
2260 2013-05-13  Cary Coutant  <ccoutant@google.com>
2261
2262         * configure.ac: Export DEFAULT_TARGET.
2263         * configure: Regenerate.
2264         * Makefile.in: Regenerate.
2265         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
2266         * testsuite/Makefile.in: Regenerate.
2267         * testsuite/debug_msg.sh: Delete duplicate tests.
2268         Don't check undef_int error message match for powerpc where the
2269         source file and line number aren't available.
2270
2271 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2272
2273         * options.h (General_options): Add --rosegment-gap option.
2274         * options.cc (finalize): --rosegment-gap implies --rosegment.
2275         * layout.cc (set_segment_offsets): Let user option override
2276         target->rosegment_gap().
2277
2278 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2279
2280         * options.h (General_options): Remove leading space from help
2281         messages for -nostdlib and --rosegment.
2282
2283 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
2284
2285         PR ld/15365
2286         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
2287
2288 2013-05-03  Alan Modra  <amodra@gmail.com>
2289
2290         * merge.cc (Output_merge_string::do_add_input_section): Correct
2291         scan for number of strings.  Rename vars to avoid shadowing.
2292         Include missing terminator in input_size_.
2293
2294 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
2295
2296         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
2297         Restore empty string handling.
2298
2299 2013-05-01  Cary Coutant  <ccoutant@google.com>
2300
2301         * stringpool.cc (Stringpool_template::new_key_offset): Fix
2302         uninitialized warning.
2303
2304 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2305
2306         * output.cc (Output_section::add_merge_input_section): Allow
2307         to merge sections if the alignment is more than character size.
2308         * merge.h (Output_merge_string::Output_merge_string): Remove
2309         assert.
2310         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
2311         only not-null strings. Check the alignment of strings.
2312         * stringpool.h
2313         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
2314         alignment as the argument.
2315         (Stringpool_template<Stringpool_char>::addralign_): New class member.
2316         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
2317         Align non-zero length strings according to the addralign_.
2318         (Stringpool_template<Stringpool_char>::set_string_offsets):
2319         Updating offsets according to the given alignment.
2320         * testsuite/Makefile.am (text_section_grouping): Test if string
2321         literals are getting merged.
2322         * testsuite/Makefile.in: Regenerate.
2323         * testsuite/merge_string_literals_1.c: New file.
2324         * testsuite/merge_string_literals_2.c: Ditto.
2325         * testsuite/merge_string_literals.sh: Ditto.
2326
2327 2013-04-26  Ian Lance Taylor  <iant@google.com>
2328
2329         * target-reloc.h (relocate_section): If the reloc offset is out of
2330         range, pass VIEW as NULL to relocate.relocate.
2331         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
2332         * i386.cc (Target_i386::Relocate::relocate): Likewise.
2333         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
2334         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
2335         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
2336         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2337
2338 2013-04-26  Geoff Pike  <gpike@chromium.org>
2339
2340         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
2341         * layout.cc (Hash_task): New class.
2342         (Layout::queue_build_id_tasks): New function.
2343         (Layout::write_build_id): Handle single-thread portion of build ID
2344         computation.  (In some cases, all of it is single-threaded.)  Replace
2345         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
2346         functionality in fewer lines of code.
2347         * layout.h (Layout::queue_build_id_tasks): New function declaration.
2348         * options.h (General_options): make "--build-id" default to tree
2349         rather than sha1.  Add two new options related to --build-id=tree:
2350         --build-id-chunk-size-for-treehash and
2351         --build-id-min-file-size-for-treehash.
2352         * Makefile.am: add testing of --build-id=tree and related new options
2353         (these tests will be invoked by "make check").
2354         * Makefile.in: Regenerate.
2355
2356 2013-04-25  Alan Modra  <amodra@gmail.com>
2357
2358         * configure.tgt: Add powerpcle and powerpc64le.
2359
2360 2013-04-22  Alan Modra  <amodra@gmail.com>
2361
2362         PR gold/15355
2363         * layout.cc (Layout::segment_precedes): Allow more than one
2364         segment with the same type and flags.
2365
2366 2013-04-15  Cary Coutant  <ccoutant@google.com>
2367
2368         * layout.cc (Layout::set_relocatable_section_offsets): Don't
2369         allocate space in file for BSS sections.
2370
2371 2013-04-15  Cary Coutant  <ccoutant@google.com>
2372
2373         * script-sections.cc (Orphan_output_section): Reset address
2374         to zero after each orphaned section for relocatable links.
2375
2376 2013-04-15  Cary Coutant  <ccoutant@google.com>
2377
2378         * symtab.cc (Symbol_table::sized_write_globals): Subtract
2379         section starting address for relocatable link.
2380         * testsuite/Makefile.am (script_test_11): New test.
2381         * testsuite/Makefile.in: Regenerate.
2382         * testsuite/script_test_11.c: New source file.
2383         * testsuite/script_test_11.t: New linker script.
2384
2385 2013-04-13  Alan Modra  <amodra@gmail.com>
2386
2387         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
2388         owner when sections are not adjacent and exceed group size.
2389         (Target_powerpc::group_sections): Handle corner case.
2390         (Target_powerpc::Branch_info::make_stub): Handle case where
2391         stub table doesn't exist due to branches in non-exec sections.
2392         (Target_powerpc::Relocate::relocate): Likewise.
2393
2394 2013-04-11  Alan Modra  <amodra@gmail.com>
2395
2396         PR gold/15354
2397         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
2398         .branch_lt to match bfd ld.  Adjust comments throughout file.
2399
2400 2013-04-04  Ian Lance Taylor  <iant@google.com>
2401
2402         GCC PR c++/56840
2403         * object.cc (do_layout_deferred_sections): Handle .eh_frame
2404         sections before checking whether they are included in the link.
2405
2406 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
2407
2408         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
2409         object before calling the plugin claim_file handler.  Pass the elf
2410         object of the archive to the plugin. Delete the elf object if the
2411         plugin claims the file.
2412
2413 2013-03-21  Alan Modra  <amodra@gmail.com>
2414
2415         * layout.cc (Layout::set_segment_offsets): Accept writable .text
2416         segment when omagic.
2417
2418 2013-03-21  Alan Modra  <amodra@gmail.com>
2419
2420         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
2421         comparison warning.
2422         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
2423         uninitialized" warning.
2424
2425 2013-03-20  Alan Modra  <amodra@gmail.com>
2426
2427         * symtab.h (Symbol::clear_version): New function.
2428         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
2429         is_needed by weak references.  Clear version for symbols defined
2430         in as-needed objects that are not needed.
2431
2432 2013-03-15  Alan Modra  <amodra@gmail.com>
2433
2434         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
2435         static and public.  Add report_err param.  Return false for data refs.
2436         (Target_powerpc::rela_dyn_section): New overloaded function.
2437         (Target_powerpc::plt_, iplt_): Elucidate.
2438         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
2439         (Output_data_plt_powerpc::do_write): Don't write .iplt.
2440         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
2441         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
2442         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
2443         push_branch and make_plt_entry for ifunc syms when
2444         reloc_needs_plt_for_ifunc.
2445         (Target_powerpc::Relocate::relocate): Don't use plt entry value
2446         for ifunc unless reloc_needs_plt_for_ifunc.
2447
2448 2013-03-15  Alan Modra  <amodra@gmail.com>
2449
2450         * gc.h (gc_process_relocs): Don't look through function descriptors.
2451         * icf.cc (get_section_contents): Do so here instead.
2452
2453 2013-03-13  Alan Modra  <amodra@gmail.com>
2454
2455         * powerpc.cc (is_branch_reloc): Forward declare.
2456         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
2457         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
2458         false for 64-bit, true for 32-bit non-branch relocs.
2459         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
2460         * testsuite/Makefile.am (icf_test): Use linker map file instead of
2461         nm output.
2462         (icf_safe_test): Generate linker map file as well as nm output.
2463         (icf_safe_so_test): Likewise.
2464         * testsuite/Makefile.in: Regenerate.
2465         * testsuite/icf_test.sh: Parse linker map file to determine
2466         section folding.
2467         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
2468         * testsuite/icf_safe_so_test.sh: Likewise.
2469         (X86_32_or_ARM_specific_safe_fold): Merge into..
2470         (arch_specific_safe_fold): ..this.
2471         (X86_64_specific_safe_fold): Delete unused function.
2472
2473 2013-03-12  Alan Modra  <amodra@gmail.com>
2474
2475         * gc.h (gc_process_relocs): Look through function descriptors
2476         to determine shndx, symvalue and addend used by ICF.  Tidy
2477         variable duplication.
2478
2479 2013-03-11  Alan Modra  <amodra@gmail.com>
2480
2481         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
2482         * layout.cc (Layout_task_runner::run): ..to here.
2483         * symtab.h (struct Symbol_location): Extract from..
2484         (class Symbol_table): ..here.
2485         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
2486         * target.h (class Target): Add function_location and
2487         do_function_location functions.
2488         (class Sized_target): Add do_function_location.
2489         * object.h (class Sized_relobj_file): Move find_shdr..
2490         (class Object): ..to here.
2491         * object.cc: Likewise.  Update to suit.  Instantiate.
2492         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
2493         * powerpc.cc (class Powerpc_dynobj): New.
2494         (Target_powerpc::do_function_location): New function.
2495         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
2496         (Powerpc_dynobj::do_read_symbols): New function.
2497         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
2498
2499 2013-03-08  Ian Lance Taylor  <iant@google.com>
2500
2501         * options.cc (General_options::string_to_object_format): Accept
2502         "default".
2503
2504 2013-03-08  Alan Modra  <amodra@gmail.com>
2505
2506         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
2507         pointer to Post_fde.
2508         (struct Post_fde): Move definition to here..
2509         * ehframe.cc (struct Post_fde): ..from here.
2510         (Cie::write): Don't alloc Post_fde.
2511         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
2512
2513 2013-03-07  Alan Modra  <amodra@gmail.com>
2514
2515         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
2516         relocation referencing .LC0.
2517         * testsuite/discard_locals_test.sh: Remove FIXMEs.
2518
2519 2013-03-07  Alan Modra  <amodra@gmail.com>
2520
2521         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
2522         always_inline.  Add assembly for powerpc to avoid GOT.
2523
2524 2013-03-07  Alan Modra  <amodra@gmail.com>
2525
2526         * testsuite/script_test_10.sh: Don't test .bss section
2527         header number.
2528
2529 2013-03-06  Alan Modra  <amodra@gmail.com>
2530
2531         * powerpc.cc (class Powerpc_relobj): Move some member functions.
2532         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
2533         all callers.  Handle folded sections.
2534         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
2535         to Powerpc_relobj.
2536         (Global_symbol_visitor_opd::operator()): Likewise.
2537
2538 2013-03-04  Alan Modra  <amodra@gmail.com>
2539
2540         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
2541         * testsuite/Makefile.in: Regenerate.
2542
2543 2013-03-01  Cary Coutant  <ccoutant@google.com>
2544
2545         Add dwp support for v2 DWARF package file format.
2546         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2547         tu_length parameter.  Adjust all callers.
2548         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2549         * dwp.cc: Include dwarf.h.
2550         (Section_bounds): New struct type.
2551         (Unit_set): New struct type.
2552         (Dwo_file::Dwo_file): Initialize new data member.
2553         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2554         Combine and rename to...
2555         (Dwo_file::read_unit_index): ...this.
2556         (Dwo_file::sized_read_compunit_index)
2557         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2558         (Dwo_file::sized_read_unit_index): ...this.
2559         (Dwo_file::copy_section): Remove section_name, is_str_offsets
2560         parameters; add section_id parameter.
2561         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2562         (Dwo_file::add_unit_set): ...this.
2563         (Dwo_file::shndx_map_): Remove.
2564         (Dwo_file::sect_offsets_): New data member.
2565         (Dwp_output_file::Dwp_output_file): Initialize new data members.
2566         (Dwp_output_file::add_section): Rename to...
2567         (Dwp_output_file::add_contribution): ...this.
2568         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2569         (Dwp_output_file::add_tu_set): Likewise.
2570         (Dwp_output_file::Contribution): New type.
2571         (Dwp_output_file::Section::contributions): New data member.
2572         (Dwp_output_file::Cu_or_tu_set): Remove.
2573         (Dwp_output_file::Section::Section): New ctor.
2574         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2575         (Dwp_output_file::Dwp_index::Section_table): New type.
2576         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2577         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2578         parameter.
2579         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2580         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2581         (Dwp_output_file::Dwp_index::section_table): New member function.
2582         (Dwp_output_file::Dwp_index::section_table_end): New member function.
2583         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2584         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2585         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2586         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2587         (Dwp_output_file::Dwp_index::section_table_): New data member.
2588         (Dwp_output_file::Dwp_index::section_mask_): New data member.
2589         (Dwp_output_file::add_output_section): New member function.
2590         (Dwp_output_file::write_new_section): New member function.
2591         (Dwp_output_file::write_contributions): New member function.
2592         (Dwp_output_file::section_id_map_): New data member.
2593         (class Dwo_id_info_reader): Remove.
2594         (class Unit_reader): New class.
2595         (get_dwarf_section_name): New function.
2596         (Dwo_file::read_executable): Adjust initializations of class data.
2597         (Dwo_file::read): Add support for v2 package file format.
2598         (Dwo_file::read_unit_index): Likewise.
2599         (Dwo_file::sized_read_unit_index): Likewise.
2600         (Dwo_file::copy_section): Likewise.
2601         (Dwo_file::add_unit_set): Likewise.
2602         (Dwp_output_file::add_output_section): Likewise.
2603         (Dwp_output_file::add_contribution): Likewise.
2604         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2605         for empty slot.
2606         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2607         file format.
2608         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2609         slot.
2610         (Dwp_output_file::initialize): Remove unused function.
2611         (Dwp_output_file::finalize): Add support for v2 package file format.
2612         (Dwp_output_file::write_index): Likewise.
2613         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2614         function prototype.
2615
2616 2013-03-01  Cary Coutant  <ccoutant@google.com>
2617
2618         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
2619         function into class definition in header file.
2620         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
2621         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
2622         New function.
2623         (Dwarf_info_reader::check_buffer): Move here from .cc file.
2624
2625 2013-02-28  Alan Modra  <amodra@gmail.com>
2626
2627         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
2628         * target.cc (Target::do_plt_fde_location): New function.
2629         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
2630         accessor function, and constructor param.
2631         (struct Post_fde, Post_fdes): Declare.
2632         (Cie::write): Add post_fdes param.
2633         * ehframe.cc (Fde::write): Use plt_fde_location.
2634         (struct Post_fde): Define.
2635         (Cie::write): Stash FDEs added post merge mapping.
2636         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
2637         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
2638         (Eh_frame::do_sized_write): Arrange to write post map FDES after
2639         other FDEs.
2640         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
2641         (Target_powerpc::has_glink): New function.
2642         (Target_powerpc::do_relax): Add eh_frame info for stubs.
2643         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
2644         glink_eh_frame_fde_32, default_fde): New data.
2645         (Stub_table::eh_frame_added_): New var.
2646         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
2647         Make const.
2648         (Stub_table::add_eh_frame): New function.
2649         (Output_data_glink::add_eh_frame): New function.
2650         (Target_powerpc::make_glink_section): Call add_eh_frame.
2651
2652 2013-02-15  Ian Lance Taylor  <iant@google.com>
2653
2654         * options.h (DEFINE_uint64_alias): Define.
2655         (class General_options): Add -Ttext-segment as an alias for
2656         -Ttext.
2657
2658 2013-02-15  Alan Modra  <amodra@gmail.com>
2659
2660         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
2661         (Stub_table::do_write): ..here, two places.
2662         (Stub_table::plt_call_size): Use it here too.
2663
2664 2013-02-11  Ian Lance Taylor  <iant@google.com>
2665
2666         * descriptors.cc (Descriptors::close_all): New function.
2667         * descriptors.h (class Descriptors): Declare close_all.
2668         (close_all_descriptors): New inline function.
2669         * plugin.cc: Include "descriptors.h".
2670         (Plugin_manager::cleanup): Call close_all_descriptors.
2671
2672 2013-02-06  Alan Modra  <amodra@gmail.com>
2673
2674         * README: Update coding style link.
2675
2676 2013-01-28  Cary Coutant  <ccoutant@google.com>
2677
2678         * dwp.cc (File_list): New typedef.
2679         (Dwo_name_info_reader): New class.
2680         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
2681         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
2682         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
2683         (Dwo_file::read_executable): New function.
2684         (Dwo_file::read): Move common setup code to ...
2685         (Dwo_file::make_object): ... here.
2686         (dwp_options): Add --exec/-e.
2687         (usage): Likewise.
2688         (main): Likewise.
2689
2690 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
2691
2692         * layout.cc (Layout::layout): Check for option text_reorder.
2693         (Layout::make_output_section): Ditto.
2694         * options.h (text_reorder): New option.
2695         * output.cc (Input_section_sort_compare): Remove special ordering
2696         of section names.
2697         (Output_section::
2698          Input_section_sort_section_name_special_ordering_compare::
2699          operator()): New function.
2700         (Output_section::sort_attached_input_sections): Use new sort function
2701         for .text.
2702         * output.h (Input_section_sort_section_name_special_ordering_compare):
2703         New struct.
2704         * testsuite/Makefile.am (text_section_grouping): Test option
2705         --no-text-reorder
2706         * testsuite/Makefile.in: Regenerate.
2707         * testsuite/text_section_grouping.sh: Check order of functions without
2708         default text reordering.
2709
2710 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
2711
2712         * options.h (General_options): Change default to true for new_dtags.
2713
2714 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
2715
2716         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
2717         when enable_new_dtags is false.  Only add DT_RUNPATH when
2718         enable_new_dtags is true.
2719
2720 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
2721
2722         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
2723         used in declaration and definition consistent.
2724         (Target_powerpc::symval_for_branch): Ditto.
2725
2726 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
2727
2728         * testsuite/plugin_final_layout.cc: Fix comment.
2729
2730 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
2731
2732         * layout.cc (Layout::layout): Do not do default sorting for
2733         text sections when section ordering is specified.
2734         (make_output_section): Ditto.
2735         * testsuite/plugin_final_layout.cc: Name the function sections
2736         to catch reordering issues.
2737
2738 2013-01-15  Alan Modra  <amodra@gmail.com>
2739
2740         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
2741         plt-thread-safe.
2742
2743 2013-01-15  Alan Modra  <amodra@gmail.com>
2744
2745         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
2746         * testsuite/Makefile.in: Regenerate.
2747
2748 2013-01-14  Alan Modra  <amodra@gmail.com>
2749
2750         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
2751         * testsuite/Makefile.in: Regenerate.
2752
2753 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
2754
2755         PR bfd/14430
2756         Fix mingw gold build with plugins enabled
2757         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
2758         * configure.ac: Export DLOPEN_LIBS and add headers check.
2759         * plugin.cc: Handle non-dlfcn case.
2760         * Makefile.in: Regenerate.
2761         * config.in: Regenerate.
2762         * configure: Regenerate.
2763         * testsuite/Makefile.in: Regenerate.
2764
2765 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
2766
2767         * output.h (sort_attached_input_sections): Change to be public.
2768         * script-sections.cc
2769         (Output_section_definition::set_section_addresses): Sort
2770         attached input sections according to section order before linker
2771         script assigns section addresses.
2772         (Orphan_output_section::set_section_addresses): Sort
2773         attached input sections according to section order before linker
2774         script assigns section addresses.
2775         * Makefile.am (final_layout.sh): Use a simple linker script to
2776         check if section ordering still works.
2777         * Makefile.in: Regenerate.
2778
2779 2013-01-09  Ben Cheng  <bccheng@google.com>
2780
2781         * arm.cc (Target_arm::attributes_accept_div): New function.
2782         (Target_arm::attributes_forbid_div): New function.
2783         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
2784         attribute using the same new functions as what bfd/elf32_arm.c
2785         does.
2786
2787 2013-01-07  Cary Coutant  <ccoutant@google.com>
2788
2789         PR gold/14993
2790         * output.cc (Output_section::add_input_section): For incremental
2791         updates, don't track input sections that are allocated from patch
2792         space.
2793
2794 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
2795             Ian Lance Taylor  <iant@google.com>
2796
2797         PR gold/14897
2798         * configure.ac (--enable-ld): Removed.
2799         (install_as_default): Set to yes only for --enable-gold=default
2800         or --disable-ld.
2801         * configure: Regenerated.
2802
2803 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
2804
2805         * options.h (General_options): Add -fuse-ld= for GCC linker
2806         option compatibility.
2807
2808 2013-01-04  Cary Coutant  <ccoutant@google.com>
2809
2810         * configure.ac: Fix typo restoring CXXFLAGS.
2811         * configure: Regenerate.
2812
2813 2013-01-04  Cary Coutant  <ccoutant@google.com>
2814
2815         * testsuite/Makefile.am (CXXLINK_S): New macro.
2816         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
2817         * testsuite/Makefile.in: Regenerate.
2818
2819 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
2820
2821         * version.cc (print_version): Update copyright year to 2013.
2822
2823 2012-12-20  Ian Lance Taylor  <iant@google.com>
2824
2825         * layout.cc (Layout::special_ordering_of_input_section): New
2826         function.
2827         (Layout::layout): If input section requires special ordering, must
2828         sort input sections.
2829         (Layout::make_output_section): May sort .text input sections.
2830         (Layout::is_section_name_prefix_grouped): Remove.
2831         * layout.h (class Layout): Declare
2832         special_ordering_of_input_section.  Don't declare
2833         is_section_name_prefix_grouped.
2834         * output.cc (Output_section::add_input_section): Revert last
2835         change.
2836         (Output_section::Input_section_sort::match_file_name): Don't crash
2837         if called on output section data.
2838         (Output_section::Input_section_sort_compare): Sort based on
2839         special ordering.
2840         (Output_section::Input_section_sort_section_order_index_compare):
2841         Revert last patch.
2842         (Output_section::sort_attached_input_sections): Likewise.
2843
2844 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
2845
2846         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
2847         * layout.h (Layout::is_section_name_prefix_grouped): New function.
2848         * output.cc (Output_section::add_input_section): Check if section
2849         name contains special prefix.  Keep input sections to sort such
2850         sections.
2851         (Output_section::Input_section_sort_section_order_index_compare
2852          ::operator()): Group sections according to prefixes.
2853         (Output_section::sort_attached_input_sections): Add condition to
2854         Input_section_entry constructor call.
2855         * testsuite/Makefile.am (text_section_grouping): New test.
2856         * testsuite/Makefile.in: Regenerate.
2857         * testsuite/text_section_grouping.cc: New file.
2858         * testsuite/text_section_grouping.sh: New file.
2859
2860 2012-12-17  Nick Clifton  <nickc@redhat.com>
2861
2862         * Makefile.am: Add copyright notice.
2863         * NEWS: Likewise.
2864         * README: Likewise.
2865         * configure.ac: Likewise.
2866         * ftruncate.c: Likewise.
2867         * Makefile.in: Regenerate.
2868
2869 2012-12-14  Cary Coutant  <ccoutant@google.com>
2870
2871         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
2872         --no-as-needed flag.
2873         (exception_separate_shared_12_test): Likewise.
2874         (incremental_copy_test): Likewise.
2875         * testsuite/Makefile.in: Regenerate.
2876
2877 2012-12-14  Cary Coutant  <ccoutant@google.com>
2878
2879         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
2880         (Dwp_output_file::Dwp_index::enter_set): Add assert.
2881
2882 2012-12-12  Alan Modra  <amodra@gmail.com>
2883
2884         * powerpc.cc (class Track_tls): New.
2885         (class Relocate, class Scan): Inherit Track_tls.
2886         (Target_powerpc::Scan::local, global): Track tls optimization
2887         and avoid creating plt entry for __tls_get_addr if all uses
2888         are optimized away.
2889         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
2890
2891 2012-12-12  Alan Modra  <amodra@gmail.com>
2892
2893         * options.h (General_options): Add --toc-sort/--no-toc-sort.
2894         Replace no_toc_optimize with toc_optimize.
2895         * output.h (Output_section::input_sections): Provide non-const variant.
2896         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
2897         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
2898         accessors.
2899         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
2900         (class Sort_toc_sections): New.
2901         (Target_powerpc::do_finalize_sections): Sort toc sections.
2902         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
2903
2904 2012-12-10  Roland McGrath  <mcgrathr@google.com>
2905
2906         * testsuite/binary_unittest.cc (read_all): New function.
2907         (Sized_binary_test): Use it instead of ::read.
2908         * fileread.cc (do_read): Don't assume pread always reads the whole
2909         amount in a single call.
2910
2911 2012-12-10  Alan Modra  <amodra@gmail.com>
2912
2913         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
2914         Set EM_PPC64 or EM_PPC here.
2915         (Target_selector_powerpc::do_recognize): Delete.
2916
2917 2012-12-10  Alan Modra  <amodra@gmail.com>
2918
2919         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
2920         stub_table_.
2921         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
2922
2923 2012-12-07  Roland McGrath  <mcgrathr@google.com>
2924
2925         * testsuite/binary_unittest.cc (Sized_binary_test):
2926         Use open_descriptor rather than ::open.
2927
2928 2012-12-07  Alan Modra  <amodra@gmail.com>
2929
2930         * powerpc.cc (Stub_table::do_write): Delete redundant Address
2931         typedef and invalid_address constant.
2932         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2933         instantiate constants.
2934
2935 2012-12-06  Roland McGrath  <mcgrathr@google.com>
2936
2937         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2938         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2939         * aclocal.m4: Regenerate.
2940         * configure: Regenerate.
2941         * Makefile.in: Regenerate.
2942         * testsuite/Makefile.in: Regenerate.
2943
2944 2012-12-07  Alan Modra  <amodra@gmail.com>
2945
2946         * options.h (General_options): Add no_toc_optimize.
2947         * powerpc.cc (ok_lo_toc_insn): New function.
2948         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2949
2950 2012-12-06  Alan Modra  <amodra@gmail.com>
2951
2952         * options.h (General_options): Add plt_align, plt_static_chain,
2953         plt_thread_safe.  Update stub_group_size help text.
2954         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2955         for new plt_thread_safe_ var.
2956         (use_plt_offset): Correct comments.
2957         (Target_powerpc::do_relax): Look for thread creation symbols to
2958         determine default plt_thread_safe value.  Clear plt call stubs
2959         as well as branch stubs each iteration.
2960         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2961         insn constants.
2962         (l, hi, ha, write_insn): Move earlier.
2963         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2964         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2965         plt stubs too.
2966         (Stub_table::update_size): Adjust.
2967         (Stub_table::prev_size, set_prev_size): Delete.
2968         (Stub_table::stub_align): Let --plt-align affect result.
2969         (Stub_table::plt_call_size): Calculate sizes for various stubs.
2970         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2971         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2972         (Stub_table::do_write): Support more stub variants.
2973
2974 2012-12-04  Alan Modra  <amodra@gmail.com>
2975
2976         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2977         (Target_powerpc::do_define_standard_symbols): New function.
2978
2979 2012-12-03  Alan Modra  <amodra@gmail.com>
2980
2981         * output.h: Formatting, whitespace.
2982
2983 2012-12-03  Alan Modra  <amodra@gmail.com>
2984
2985         * layout.h (Layout::get_executable_sections): Declare.
2986         * layout.cc (Layout::get_executable_sections): New function.
2987         * arm.cc (Target_arm::group_sections): Use it.
2988         (Arm_output_section::group_sections): Delete now redundant test.
2989         * output.cc (Output_reloc::Output_reloc): Add is_relative.
2990         param to handle relative relocs.
2991         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2992         (Output_data_reloc::add_absolute): Adjust.
2993         (Output_data_reloc::add_relative): New function.
2994         (Output_data::reset_data_size): New function.
2995         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2996         (Output_section::set_addralign): New function.
2997         (Output_section::checkpoint_set_addralign): New function.
2998         (Output_section::clear_section_offsets_need_adjustment): New function.
2999         (Output_section::input_sections): Make public.
3000         * powerpc.cc (class Output_data_brlt_powerpc): New.
3001         (class Stub_table, class Stub_control): New.
3002         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
3003         stub_table_, set_stub_table, stub_table): New vectors and accessor
3004         functions.
3005         (Target_powerpc::do_may_relax, do_relax, push_branch,
3006         new_stub_table, stub_tables, brlt_section, group_sections,
3007         add_branch_lookup_table, find_branch_lookup_table,
3008         write_branch_lookup_table, make_brlt_section): New functions.
3009         (Target_powerpc::struct Sort_sections, class Branch_info): New.
3010         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
3011         branch_info_): New vars.
3012         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
3013         make call stubs here.
3014         (Output_data_glink): Remove all call stub handling from this class.
3015         (Target_powerpc::Scan::local, global): Save interesting branch
3016         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
3017         (Target_powerpc::do_finalize_sections): Only make reg save/restore
3018         functions on final link.
3019         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
3020         Handle long branch destinations too.
3021         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
3022         do_plt_address_for_local): Adjust lookup of plt call stubs.
3023
3024 2012-11-30  Alan Modra  <amodra@gmail.com>
3025
3026         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
3027         relocs against protected symbols when building 32-bit shared libs.
3028
3029 2012-11-30  Alan Modra  <amodra@gmail.com>
3030
3031         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
3032         param.  Call got_section() to make .got.  Update all callers
3033         and their callers and so on.
3034
3035 2012-11-30  Alan Modra  <amodra@gmail.com>
3036
3037         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
3038         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
3039         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
3040         value if it already exists.
3041
3042 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
3043
3044         PR gold/14858
3045         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
3046
3047 2012-11-14  Roland McGrath  <mcgrathr@google.com>
3048
3049         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
3050         than bfc instruction for data sandboxing.
3051
3052 2012-11-08  Alan Modra  <amodra@gmail.com>
3053
3054         * po/POTFILES.in: Regenerate.
3055
3056 2012-11-05  Alan Modra  <amodra@gmail.com>
3057
3058         * configure.ac: Apply 2012-09-10 change to config.in here.
3059         * configure: Regenerate.
3060
3061 2012-11-05  Alan Modra  <amodra@gmail.com>
3062
3063         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
3064         (struct Opd_ent): Use "Address" rather than "Offset".
3065         (Output_data_got_powerpc::got_base_offset): Return Valtype.
3066         (Target_powerpc::got_section): Make public.
3067         (Target_powerpc::scan_relocs): Move code setting symbols..
3068         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
3069         Create _SDA_BASE_ only when referenced.
3070
3071 2012-11-02  Roland McGrath  <mcgrathr@google.com>
3072
3073         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
3074         from last change.
3075
3076 2012-11-01  Roland McGrath  <mcgrathr@google.com>
3077
3078         * target.h (Sized_target::relocate_relocs): Use Elf_Off
3079         for offset_in_output_section parameter.
3080         (Sized_target::relocate_special_relocatable): Likewise.
3081         * arm.cc (Target_arm::relocate_relocs): Likewise.
3082         (Target_arm::relocate_special_relocatable): Likewise.
3083         * i386.cc (Target_i386::relocate_relocs): Likewise.
3084         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
3085         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
3086         * target-reloc.h (relocate_relocs): Likewise.
3087         * testsuite/testfile.cc (Target_test): Likewise.
3088         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
3089         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
3090
3091         * system.h: Move inclusion of <clocale> to after <libintl.h> in
3092         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
3093
3094         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
3095         parameter, which is unused in the [!F_SETFD] case.
3096
3097         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
3098         SYMNDX to off_t before comparing it to this->data_size().
3099         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
3100         * incremental.cc (Output_section_incremental_inputs::do_write):
3101         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
3102
3103         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
3104
3105 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
3106
3107         * gold.cc (Target_arm::do_adjust_elf_header): Add the
3108         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
3109         in EABI_VER5.
3110
3111 2012-10-29  Cary Coutant  <ccoutant@google.com>
3112
3113         * dwp.cc (usage): Add file and exit status parameters;
3114         add --help and --version options.
3115         (print_version): New function.
3116         (main): Add --help and --version options.
3117
3118 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3119
3120         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
3121         final_layout_sequence.txt.
3122         * testsuite/Makefile.in: Regenerated.
3123
3124 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3125
3126         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
3127         COMPILE generated by automake.
3128         (LINK1): Likewise.
3129         (CXXCOMPILE1): Likewise.
3130         (CXXLINK1): Likewise.
3131         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
3132         (LINK): Likewise.
3133         (CXXCOMPILE): Likewise.
3134         (CXXLINK): Likewise.
3135         * testsuite/Makefile.in: Regenerated.
3136
3137 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3138
3139         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
3140         on bad fwrite return.
3141
3142 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3143
3144         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
3145         on val.
3146
3147 2012-10-23  Cary Coutant  <ccoutant@google.com>
3148
3149         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
3150         * testsuite/Makefile.in: Regenerate.
3151         * testsuite/dwp_test.h: New source file.
3152         * testsuite/dwp_test_1.cc: New source file.
3153         * testsuite/dwp_test_1.s: New source file.
3154         * testsuite/dwp_test_1.sh: New source file.
3155         * testsuite/dwp_test_1b.cc: New source file.
3156         * testsuite/dwp_test_1b.s: New source file.
3157         * testsuite/dwp_test_2.cc: New source file.
3158         * testsuite/dwp_test_2.s: New source file.
3159         * testsuite/dwp_test_2.sh: New source file.
3160         * testsuite/dwp_test_main.cc: New source file.
3161         * testsuite/dwp_test_main.s: New source file.
3162
3163 2012-10-23  Cary Coutant  <ccoutant@google.com>
3164
3165         * dwp.h: New header file.
3166         * dwp.cc: New source file.
3167         * gold.h: Move shared declarations to system.h.
3168         * system.h: New header file.
3169         * Makefile.am: Add dwp.
3170         * Makefile.in: Regenerate.
3171
3172 2012-10-23  Cary Coutant  <ccoutant@google.com>
3173
3174         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
3175         Dwarf_info_reader::read_from_pointer.
3176         (Dwarf_pubnames_table::read_header): Likewise.
3177         (Dwarf_pubnames_table::next_name): Likewise.
3178         (Dwarf_die::read_attributes): Likewise.
3179         (Dwarf_die::skip_attributes): Likewise.
3180         (Dwarf_info_reader::read_from_pointer): New function template.
3181         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
3182         (Dwarf_pubnames_table): Likewise.
3183         (Dwarf_info_reader::read_from_pointer): New function template.
3184         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
3185         Dwarf_pubnames_table ctor.
3186
3187 2012-10-23  Cary Coutant  <ccoutant@google.com>
3188
3189         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
3190         abbrev_shndx.
3191         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
3192         abbrev_shndx_.
3193         (Dwarf_info_reader::set_abbrev_shndx): New method.
3194         (Dwarf_info_reader::abbrev_shndx_): New data member.
3195
3196 2012-10-23  Cary Coutant  <ccoutant@google.com>
3197
3198         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
3199         from object, not parameters.
3200         (Dwarf_info_reader::parse): Likewise.
3201         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
3202         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
3203         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
3204         methods.
3205
3206 2012-10-23  Cary Coutant  <ccoutant@google.com>
3207
3208         * fileread.cc (Input_file::Input_file): New constructor.
3209         * fileread.h (class Input_file): Add new constructor.
3210
3211 2012-10-18  Alan Modra  <amodra@gmail.com>
3212
3213         PR gold/14727
3214         * object.cc (Relobj::is_section_name_included): Also match
3215         .sdata personality section.
3216
3217 2012-10-18  Alan Modra  <amodra@gmail.com>
3218
3219         * target-reloc.h (class Default_comdat_behavior): New, package up..
3220         (get_comdat_behaviour): ..this.
3221         (relocate_section): Add Relocate_comdat_behavior template arg,
3222         adjust code to suit.
3223         * arm.cc (Target_arm::relocate_section): Adjust to suit.
3224         (Target_arm::scan_reloc_section): Likewise.
3225         * i386.cc (Target_i386::relocate_section): Likewise.
3226         * sparc.cc (Target_sparc::relocate_section): Likewise.
3227         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
3228         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
3229         * powerpc.cc (class Relocate_comdat_behavior): New.
3230         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
3231         gold::relocate_section with new template arg.
3232
3233 2012-10-18  Alan Modra  <amodra@gmail.com>
3234
3235         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
3236         dynamic relocs for GOT_TPREL got entries, without symbol if
3237         resolving locally.
3238         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
3239         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
3240         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
3241
3242 2012-10-17  Alan Modra  <amodra@gmail.com>
3243
3244         PR gold/14726
3245         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
3246
3247 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
3248
3249         * layout.cc (Layout::include_section): Keep sections marked
3250         SHF_EXCLUDE when doing relocatable links.
3251
3252 2012-10-16  Alan Modra  <amodra@gmail.com>
3253
3254         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
3255         (Target_powerpc::do_finalize_sections): Call it.
3256         (Output_data_save_res): New class and supporting functions.
3257         (Target_powerpc::symval_for_branch): Only look up .opd entry for
3258         normal symbols defined in object files.
3259
3260 2012-10-12  Alan Modra  <amodra@gmail.com>
3261
3262         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
3263         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
3264         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
3265         section if scan_opd_relocs not yet called.
3266         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
3267
3268 2012-10-12  Alan Modra  <amodra@gmail.com>
3269
3270         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3271         add_local_ifunc_entry): Revert last change.
3272         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
3273
3274 2012-10-05  Alan Modra  <amodra@gmail.com>
3275
3276         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
3277         do_plt_address_for_global): New functions.
3278         (Output_data_got_powerpc::do_write): Don't segfault when linking
3279         statically.
3280         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3281         add_local_ifunc_entry): Return true on adding entry..
3282         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
3283         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
3284         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
3285         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
3286         set up symbols here.
3287         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
3288         syms here.  Do so even when no .iplt.  Don't segfault when linking
3289         statically.
3290         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
3291         new variants without reloc param.
3292         (Glink_sym_ent::Glink_sym_ent): Likewise.
3293         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
3294         reloc when refs will resolve to plt call stub.
3295         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
3296         R_PPC_PLTREL24 to resolve locally.
3297         (Target_powerpc::Scan::global): Correct ifunc handling.
3298         (Target_powerpc::Relocate::relocate): Correct local sym glink
3299         lookup.  Don't destroy "value" when we have a plt call stub,
3300         and when checking plt call validity.
3301         (Target_powerpc::do_dynsym_value): Simplify.
3302
3303 2012-10-05  Alan Modra  <amodra@gmail.com>
3304
3305         * i386.cc (Output_data_plt_i386::address_for_global,
3306         address_for_local): Add plt offset to returned value.  Adjust uses.
3307         * sparc.cc (Output_data_plt_sparc::address_for_global,
3308         address_for_local): Likewise.
3309         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
3310         address_for_local): Likewise.
3311         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
3312         address_for_local): Likewise.
3313         * target.h (Target::plt_address_for_global, plt_address_for_local):
3314         Update comment.
3315         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
3316         (Output_data_got::Got_entry::write): Nor here.
3317         * output.h: Comment fix.
3318
3319 2012-10-02  Jiong Wang  <jiwang@tilera.com>
3320
3321         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
3322         global_offset_table_ value for larget got.
3323         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
3324
3325 2012-09-29  Alan Modra  <amodra@gmail.com>
3326
3327         * powerpc.cc (Target_powerpc::iplt_): New output section.
3328         (Target_powerpc::iplt_section, make_iplt_section,
3329         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
3330         (Target_powerpc::make_plt_entry): Handle ifunc syms.
3331         Target_powerpc::plt_entry_count): Count iplt entries too.
3332         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
3333         reloc section in constructor.  New params.
3334         (Target_powerpc::make_plt_section): Create reloc section here instead.
3335         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
3336         functions.
3337         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
3338         (Output_data_glink::add_entry, find_entry): New functions to
3339         deal with local syms.
3340         (Glink_sym_ent): Add support for local syms.
3341         (Output_data_glink::do_write): Handle ifunc plt entries.
3342         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3343         (Target_powerpc::Scan::local, global): Handle ifunc syms.
3344         (Target_powerpc::Relocate::relocate): Likewise.
3345         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
3346
3347 2012-09-25  Alan Modra  <amodra@gmail.com>
3348
3349         * object.h (Sized_relobj_file::adjust_local_symbol,
3350         do_adjust_local_symbol): New functions.
3351         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
3352         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
3353         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
3354         and irregular opd entry spacing.
3355         (Powerpc_relobj::do_read_relocs): Add opd size checks.
3356         (Global_symbol_visitor_opd): New functor.
3357         (Target_powerpc::do_finalize_sections): Omit global symbols defined
3358         on deleted opd entries.
3359
3360 2012-09-15  Jiong Wang  <jiwang@tilera.com>
3361
3362         * tilegx.cc: New file.
3363         * Makefile.am (TARGETSOURCES): Add tilegx.cc
3364         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
3365         * configure.tgt: Add entries for tilegx*.
3366         * configure.ac: Likewise.
3367         * Makefile.in: Rebuild.
3368         * configure: Likewise.
3369         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
3370         tilegx.
3371
3372 2012-09-13  Alan Modra  <amodra@gmail.com>
3373
3374         * target-reloc.h (scan_relocs): Call scan.local for relocs
3375         against symbols in discarded sections.  Pass is_discarded
3376         param.
3377         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
3378         Add is_discarded param.
3379         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
3380         is_discarded to flag opd entry as discarded.  Don't emit dyn
3381         relocs on such entries.
3382         (Target_powerpc::Scan::global): Similarly detect and handle
3383         such opd entries.
3384         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
3385         opd_ent_.  Update all uses.
3386         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
3387         (Target_powerpc::relocate_section): Zero out discarded opd
3388         entry relocs.
3389
3390 2012-09-12  Ian Lance Taylor  <iant@google.com>
3391
3392         PR gold/14570
3393         * output.cc: Rename Output_data_got template parameter from size
3394         to got_size for all functions.  Compile all variants of
3395         Output_data_got.
3396         (Output_data_got::Got_entry::write): Correct use of size for
3397         symbol value.  Use local_is_tls rather than casting to
3398         Sized_relobj_file.
3399         * object.h (class Object): Add local_is_tls and do_local_is_tls.
3400         (class Sized_relobj_file): Add do_local_is_tls.
3401         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
3402
3403 2012-09-11  Alan Modra  <amodra@gmail.com>
3404
3405         PR gold/14566
3406         * layout.cc (Layout::set_segment_offsets): When using
3407         common-page-size alignment, ensure we are on a new max-page-size
3408         page.
3409         * output.cc (Output_segment::set_section_addresses): Use
3410         abi_pagesize, not common_pagesize for relro boundary.
3411         (Output_segment::set_offset): Likewise.
3412
3413 2012-09-11  Alan Modra  <amodra@gmail.com>
3414
3415         * output.h (Output_data_got::add_global_tls, add_local_tls,
3416         add_local_tls_pair): New functions.
3417         (Output_data_got::add_local_pair_with_rel): Remove second
3418         reloc param.  Expand comment.
3419         (Output_data_got::Got_entry): Rename use_plt_offset_ to
3420         use_plt_or_tls_offset_, similarly for constructor param.
3421         (Output_data_got::Got_entry::write): Add got_index param.
3422         * output.cc (Output_data_got::add_global_tls, add_local_tls,
3423         add_local_tls_pair): New functions.
3424         (Output_data_got::Got_entry::write): Handle tls symbols
3425         with use_plt_or_tls_offset_ set specially.
3426         (Output_data_got::add_local_pair_with_rel): Only one reloc.
3427         (Output_data_got::do_write): Replace iterator with index, pass
3428         index to entry write function.
3429         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
3430         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
3431         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
3432         call.
3433         * i386.cc (Target_i386::Scan::local): Likewise.
3434         * sparc.cc (Target_sparc::Scan::local): Likewise.
3435         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
3436         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
3437         do_tls_offset_for_global): New functions.
3438         (Target_powerpc::Scan::local): Correct TLS relocations and got
3439         entry values.
3440         (Target_powerpc::Scan::global): Don't emit unnecessary
3441         dynamic relocations on TLS GOT entries.
3442
3443 2012-09-10  Matthias Klose  <doko@ubuntu.com>
3444
3445         * config.in: Disable sanity check for kfreebsd.
3446
3447 2012-09-10  Sterling Augustine  <saugustine@google.com>
3448
3449         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
3450         (Gdb_index::pubtypes_read): New parameter.
3451         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
3452         to calls.
3453         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
3454         pubtypes_object_.
3455
3456 2012-09-09  Alan Modra  <amodra@gmail.com>
3457
3458         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
3459         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
3460         * gc.h (gc_process_relocs): Call target gc_add_reference.
3461         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
3462         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
3463         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
3464         unnecessary cast.
3465         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
3466         to cater for when we don't need code offset.  Update use.
3467         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
3468         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
3469         set_opd_valid): New functions.
3470         (Target_powerpc::do_gc_add_reference): New function.
3471         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
3472         stashed refs.
3473         (Target_powerpc::do_gc_mark_symbol): New function.
3474
3475 2012-09-06  Cary Coutant  <ccoutant@google.com>
3476
3477         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
3478         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
3479         (Dwarf_die::skip_attributes): Likewise.
3480         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
3481         * testsuite/gdb_index_test.cc (inline_func_1): New function.
3482         (main): Call it.
3483         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
3484
3485 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
3486
3487         * testsuite/script_test_3.t: Add .got.plt output section
3488         statement.
3489         * testsuite/script_test_4.t: Likewise.
3490
3491 2012-09-05  Alan Modra  <amodra@gmail.com>
3492
3493         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
3494         update all uses and lose "enum" when using type.
3495
3496 2012-09-05  Alan Modra  <amodra@gmail.com>
3497
3498         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
3499         * configure: Regenerate.
3500         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
3501         (plugin_final_layout.stdout): Likewise.
3502         (memory_test): Set page sizes to 0x1000.
3503         * testsuite/Makefile.in: Regenerate.
3504         * testsuite/discard_locals_test.sh: Add FIXME comment.
3505         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
3506         * testsuite/pr14265.t: Add .got output section statement.
3507         * testsuite/script_test_2.t: Likewise.
3508         * testsuite/script_test_3.t: Likewise.
3509         * testsuite/script_test_4.t: Likewise.
3510         * testsuite/script_test_5.t: Likewise.
3511         * testsuite/script_test_6.t: Likewise.
3512         * testsuite/script_test_7.t: Likewise.
3513         * testsuite/script_test_9.t: Likewise.
3514
3515 2012-09-05  Alan Modra  <amodra@gmail.com>
3516
3517         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
3518         (Powerpc_relocate_functions::Status): New typedef.
3519         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3520         (Target_powerpc::Scan::local): Handle REL64.
3521         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
3522         for REL32 and REL64.
3523         (Target_powerpc::symval_for_branch): New function, extracted from..
3524         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
3525         checks.  Report overflow errors.
3526
3527 2012-09-05  Alan Modra  <amodra@gmail.com>
3528
3529         * object.h (Sized_relobj_file::emit_relocs): Delete.
3530         (Sized_relobj_file::emit_relocs_reltype): Delete.
3531         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
3532         relocate_relocs for --emit-relocs.
3533         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
3534         * output.h: Update comment.
3535         (Output_segment::first_section): New function.
3536         (Output_segment::first_section_load_address): Use first_section.
3537         * output.cc (Output_segment::first_section): New function extracted..
3538         (Output_segment::first_section_load_address): ..from here.  Delete.
3539         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
3540         * target.h (Sized_target::relocate_for_relocatable): Likewise.
3541         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
3542         adjust call to target.h function.
3543         * i386.cc (Target_i386): Likewise.
3544         * sparc.cc (Target_sparc): Likewise.
3545         * x86_64.cc (Target_x86_64): Likewise.
3546         * powerpc.cc (Target_powerpc): Likewise.
3547         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
3548         first tls section has section symbol for optimised local dynamic
3549         output relocs.
3550         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
3551         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
3552         optimised tls code.
3553         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
3554         Rename to relocate_relocs.  Update error message.
3555
3556 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
3557
3558         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
3559         --just-symbols.
3560
3561 2012-08-31  Alan Modra  <amodra@gmail.com>
3562
3563         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
3564         (Powerpc_relobj::toc_base_offset): New stub function.
3565         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
3566         got_mod_index_offset to tlsld_got_offset.  Update all refs.
3567         (Target_powerpc::Relocate::enum skip_tls): New.
3568         (Target_powerpc::call_tls_get_addr_): New var.
3569         (Target_powerpc::is_branch_reloc): Move to file scope.
3570         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
3571         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
3572         New functions.
3573         (Target_powerpc::enum Got_type): Delete old values, add new ones.
3574         (powerpc_info): Correct common_pagesize for ppc64.
3575         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
3576         (Powerpc_relocate_functions): Add overflow check enums and functions.
3577         Add non-shift version of rela, rela_ua.  Delete all rel public
3578         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
3579         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
3580         addr16_ha3, addr14 functions.
3581         (Output_data_got_powerpc::add_constant_pair): New function.
3582         (Output_data_got_powerpc::got_base_offset): Likewise.
3583         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
3584         (instruction constants): Sort, add some more.
3585         (Output_data_glink::do_write): Add and use Address typedef.  Use
3586         object->toc_base_offset() stub for 64-bit.
3587         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
3588         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3589         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
3590         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
3591         Always treat .opd relocs as against locally defined symbol.
3592         Correct condition for RELATIVE relocs.
3593         (Target_powerpc::do_finalize_sections): Test for NULL sections.
3594         (Target_powerpc::Relocate::relocate): Use plt call stub as value
3595         for 32-bit syms with a plt entry.  Correct ppc64 toc base
3596         calculations.  Handle TLS relocs, and more.  Add overflow
3597         checking and adjust for Powerpc_relocate_functions changes.
3598         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
3599         Reinstate --emit-relocs code with FIXME.
3600
3601 2012-08-30  Alan Modra  <amodra@gmail.com>
3602
3603         * layout.cc (Layout::set_segment_offsets): Set p_align to
3604         abi_pagesize, not common_pagesize.
3605         (Layout::relaxation_loop_body): Similarly use abi_pagesize
3606         to determine whether file header can go in segment.
3607
3608 2012-08-30  Alan Modra  <amodra@gmail.com>
3609
3610         * output.h (Output_reloc::Output_reloc <output section>): Add
3611         is_relative param.  Adjust calls.
3612         (Output_reloc::add_output_section_relative): New functions.
3613         * output.cc (Output_reloc::Output_reloc <output section>): Handle
3614         is_relative.
3615         (Output_reloc::symbol_value): Handle SECTION_CODE.
3616
3617 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
3618
3619         * gold.cc (queue_middle_tasks): Call layout again when unique
3620         segments for sections is desired.
3621         * layout.cc (Layout::Layout): Initialize new members.
3622         (Layout::get_output_section_flags): New function.
3623         (Layout::choose_output_section): Call get_output_section_flags.
3624         (Layout::layout): Make output section for mapping to a unique segment.
3625         (Layout::insert_section_segment_map): New function.
3626         (Layout::attach_allocated_section_to_segment): Make unique segment for
3627         output sections marked so.
3628         (Layout::segment_precedes): Check for unique segments when sorting.
3629         * layout.h (Layout::Unique_segment_info): New struct.
3630         (Layout::Section_segment_map): New typedef.
3631         (Layout::insert_section_segment_map): New function.
3632         (Layout::get_output_section_flags): New function.
3633         (Layout::is_unique_segment_for_sections_specified): New function.
3634         (Layout::set_unique_segment_for_sections_specified): New function.
3635         (Layout::unique_segment_for_sections_specified_): New member.
3636         (Layout::section_segment_map_): New member.
3637         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
3638         Rename is_gc_pass_one to is_pass_one.
3639         Rename is_gc_pass_two to is_pass_two.
3640         Rename is_gc_or_icf to is_two_pass.
3641         Check for which pass based on whether symbols data is present.
3642         Make it two pass when unique segments for sections is desired.
3643         * output.cc (Output_section::Output_section): Initialize new
3644         members.
3645         * output.h (Output_section::is_unique_segment): New function.
3646         (Output_section::set_is_unique_segment): New function.
3647         (Output_section::is_unique_segment_): New member.
3648         (Output_section::extra_segment_flags): New function.
3649         (Output_section::set_extra_segment_flags): New function.
3650         (Output_section::extra_segment_flags_): New member.
3651         (Output_section::segment_alignment): New function.
3652         (Output_section::set_segment_alignment): New function.
3653         (Output_section::segment_alignment_): New member.
3654         (Output_segment::Output_segment): Initialize is_unique_segment_.
3655         (Output_segment::is_unique_segment): New function.
3656         (Output_segment::set_is_unique_segment): New function.
3657         (Output_segment::is_unique_segment_): New member.
3658         * plugin.cc (allow_unique_segment_for_sections): New function.
3659         (unique_segment_for_sections): New function.
3660         (Plugin::load): Add new functions to transfer vector.
3661         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
3662         * Makefile.in: Regenerate.
3663         * testsuite/plugin_final_layout.sh: Check if unique segment
3664         functionality works.
3665         * testsuite/plugin_section_order.c (onload): Check if new interfaces
3666         are available.
3667         (allow_unique_segment_for_sections): New global.
3668         (unique_segment_for_sections): New global.
3669         (claim_file_hook): Call allow_unique_segment_for_sections.
3670         (all_symbols_read_hook): Call unique_segment_for_sections.
3671
3672 2012-08-22  Cary Coutant  <ccoutant@google.com>
3673
3674         * layout.cc (Layout::include_section): Don't assert on GROUP
3675         sections with --emit-relocs.
3676
3677 2012-08-21  Cary Coutant  <ccoutant@google.com>
3678
3679         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
3680         if --export-dynamic-symbol names an undef symbol.
3681
3682 2012-08-18  Alan Modra  <amodra@gmail.com>
3683
3684         * powerpc.cc: Formatting and white space.
3685         (Powerpc_relobj): Rename got2_section_ to special_.
3686         Add opd_ent_shndx_ and opd_ent_off_ vectors.
3687         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
3688         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
3689         (Target_powerpc): Add Address typedef and invalid_address.  Use
3690         throughout.
3691         (Target_powerpc::is_branch_reloc): New function.
3692         (Powerpc_relocate_functions): Add Address typedef, use throughout.
3693         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
3694         for dst_mask, value and addend.
3695         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
3696         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
3697         (Output_data_glink::do_write): Correct toc base.  Don't try to use
3698         uint16_t for 24-bit offset.  Use get_output_section_offset and
3699         check return.
3700         (Target_powerpc::Scan::local): Handle more relocs.
3701         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
3702         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
3703         Plug in toc restoring insn after plt calls.  Translate branches
3704         to function descriptor symbols to corresponding entry point.
3705         (Target_powerpc::relocate_for_relocatable): Check return from
3706         get_output_section_offset.
3707         * symtab.h: Comment typo.
3708
3709 2012-08-14  Ian Lance Taylor  <iant@google.com>
3710
3711         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
3712         unsupported_relocal_local to call unsupported_reloc_global.
3713
3714 2012-08-14  Nick Clifton  <nickc@redhat.com>
3715
3716         PR ld/14265
3717         * script-sections.cc (Sections_element::output_section_name): Add
3718         keep return parameter.
3719         (Output_section_element::match_name): Add keep return parameter.
3720         Return the value of the keep_ member.
3721         * script-sections.h (class Output_section): Update
3722         output_section_name prototype.
3723         * layout.cc (Layout::keep_input_section): New public member
3724         function.
3725         (Layout::choose_output_section): Pass keep parameter to
3726         output_section_name.
3727         * layout.h (class Layout): Add keep_input_section.
3728         * object.cc (Sized_relobj_file::do_layout): Check for kept input
3729         sections.
3730         * testsuite/Makefile.am: Add a test.
3731         * testsuite/Makefile.in: Regenerate.
3732         * testsuite/pr14265.c: Source file for the test.
3733         * testsuite/pr14265.t: Linker script for the test.
3734         * testsuite/pr14265.sh: Shell script for the test.
3735
3736 2012-08-14  Alan Modra  <amodra@gmail.com>
3737
3738         * target.h (Target::output_section_name): New function.
3739         (Target::do_output_section_name): New function.
3740         * layout.cc (Layout::choose_output_section): Call the above.
3741         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
3742
3743 2012-08-14  Alan Modra  <amodra@gmail.com>
3744
3745         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
3746         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
3747         for replace_constant call.
3748         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
3749         (Output_data_glink::do_print_to_mapfile): New function.
3750         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
3751         (Target_powerpc::Relocate::relocate): Likewise.
3752
3753 2012-08-14  Alan Modra  <amodra@gmail.com>
3754
3755         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
3756         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
3757         (Output_data_glink::add_entry,find_entry): Remove shndx param.
3758         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
3759         all references to shndx_.  Handle special case for R_PPC_PLTREL24
3760         here.
3761         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
3762         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
3763         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
3764         here.
3765         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
3766         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
3767
3768 2012-08-12  Alan Modra  <amodra@gmail.com>
3769
3770         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
3771         (glink insn constants): Use uint32_t.
3772         (Output_data_glink::add_entry): Use insert, not [] operator.
3773
3774 2012-08-11  Alan Modra  <amodra@gmail.com>
3775
3776         * object.h (Sized_relobj_file::find_shdr): New function.
3777         (Sized_relobj_file::find_special_sections): New function.
3778         * object.cc (Sized_relobj_file::find_shdr): New function.
3779         (Sized_relobj_file::find_eh_frame): Use find_shdr.
3780         (Sized_relobj_file::find_special_sections): New function, split out..
3781         (Sized_relobj_file::do_read_symbols): ..from here.
3782         * output.h (Output_data_got::replace_constant): New function.
3783         (Output_data_got::num_entries): New function.
3784         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
3785         (Output_data_got::got_offset): Protected rather than private.
3786         (Output_data_got::replace_got_entry): New function.
3787         * output.cc (Output_data_got::replace_got_entry): New function.
3788         * powerpc.cc (class Powerpc_relobj): New.
3789         (class Powerpc_relocate_functions): Delete all psymval variants or
3790         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
3791         Implement _ha functions using corresponding _hi function.
3792         (Powerpc_relobj::find_special_sections): New function.
3793         (Target_powerpc::do_make_elf_object): New function.
3794         (class Output_data_got_powerpc): New.
3795         (class Output_data_glink): New.
3796         (class Powerpc_scan_relocatable_reloc): New.
3797         Many more changes througout file.
3798
3799 2012-08-09  Nick Clifton  <nickc@redhat.com>
3800
3801         * po/vi.po: Updated Vietnamese translation.
3802
3803 2012-08-07  Ian Lance Taylor  <iant@google.com>
3804
3805         * layout.cc (Layout::add_target_dynamic_tags): If
3806         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
3807         plt_rel.
3808
3809 2012-07-30  Nick Clifton  <nickc@redhat.com>
3810
3811         * po/gold.pot: Updated template.
3812         * po/es.po: Updated Spanish translation.
3813
3814 2012-07-18  Cary Coutant  <ccoutant@google.com>
3815
3816         PR gold/14344
3817         * configure.ac: Add check for -gpubnames support.
3818         * configure: Regenerate.
3819         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
3820         support; force -gno-pubnames.
3821         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
3822         support.
3823         (gdb_index_test_4): New test.
3824         * testsuite/Makefile.in: Regenerate.
3825         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
3826         * testsuite/gdb_index_test_2.sh: Likewise.
3827         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
3828         * testsuite/gdb_index_test_4.sh: New script.
3829         * testsuite/gdb_index_test_comm.sh: New script with common code;
3830         don't look for space after colon.
3831
3832 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
3833
3834         * gold.cc (queue_middle_tasks): Update function order only after
3835         deferred objects due to plugins are processed.
3836
3837 2012-07-11  Ian Lance Taylor  <iant@google.com>
3838
3839         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
3840         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
3841         (Target_arm::scan_reloc_for_stub): Likewise.
3842         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
3843         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
3844         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
3845         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
3846         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
3847
3848 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
3849             Ian Lance Taylor  <iant@google.com>
3850
3851         PR gold/14309
3852         * configure.ac: Test whether std::tr1::hash<off_t> works.
3853         * gold.h: Add a specialization for std::tr1::hash<off_t> if
3854         needed.
3855         * output.h (class Output_fill): Add virtual destructor.
3856         * configure, config.in: Rebuild.
3857
3858 2012-06-22  Roland McGrath  <mcgrathr@google.com>
3859
3860         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
3861
3862 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
3863
3864         * plugin.cc (Plugin::load): Handle position independent executables.
3865
3866 2012-06-06  Cary Coutant  <ccoutant@google.com>
3867
3868         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
3869         add .debug_macro.
3870         (lines_only_debug_sections): Likewise.
3871         (gdb_fast_lookup_sections): New static array.
3872         (is_gdb_debug_section): Rename formal parameter.
3873         (is_lines_only_debug_section): Likewise.
3874         (is_gdb_fast_lookup_section): New function.
3875         (Layout::include_section): Check for ".zdebug_" prefix; pass
3876         section name suffix to is_gdb_debug_section, et al.; check for
3877         fast-lookup sections when building .gdb_index.
3878         * options.h (--strip-debug-gdb): Update GDB version number.
3879
3880 2012-06-06  Cary Coutant  <ccoutant@google.com>
3881
3882         * configure.ac: Add check for fallocate.
3883         * configure: Regenerate.
3884         * config.in: Regenerate.
3885
3886         * options.h (class General_options): Add --mmap-output-file and
3887         --posix-fallocate options.
3888         * output.cc: (posix_fallocate): Remove; replace with...
3889         (gold_fallocate): New function.
3890         (Output_file::map_no_anonymous): Call gold_fallocate.
3891         (Output_file::map): Check --mmap-output-file option.
3892
3893 2012-06-05  Jing Yu  <jingyu@google.com>
3894
3895         * gold.h (textdomain): Add do {} to empty while(0).
3896         (bindtextdomain): Likewise.
3897
3898 2012-06-04  Cary Coutant  <ccoutant@google.com>
3899
3900         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
3901         has_dynsym_index.
3902
3903 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
3904
3905         * symtab.cc (Symbol_table::define_special_symbol):
3906         Initialize *poldsym to prevent uninitialized variable errors.
3907
3908 2012-05-23  Cary Coutant  <ccoutant@google.com>
3909
3910         * layout.cc (Layout::section_name_mapping): Add rules to handle
3911         exact match on .data.rel.ro.local or .data.rel.ro.
3912         (Layout::output_section_name): Check for exact matches.
3913
3914 2012-05-23  Cary Coutant  <ccoutant@google.com>
3915
3916         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
3917         more carefully.
3918
3919 2012-05-22  Cary Coutant  <ccoutant@google.com>
3920
3921         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
3922         object before exporting symbol.
3923
3924 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
3925
3926         * testsuite/tls_test.cc: Include "config.h" first.
3927         * testsuite/tls_test_c.c: Likewise.
3928
3929 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
3930             Nick Clifton  <nickc@redhat.com>
3931
3932         PR 14072
3933         * configure.in: Add check that sysdep.h has been included before
3934         any system header files.
3935         * configure: Regenerate.
3936         * config.in: Regenerate.
3937
3938 2012-05-14  Cary Coutant  <ccoutant@google.com>
3939
3940         * layout.cc (Layout::make_output_section): Mark .tdata section
3941         as RELRO.
3942         * testsuite/relro_test.cc: Add a TLS variable.
3943
3944 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
3945
3946         PR gold/14091
3947         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3948         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3949         R_X86_64_64.
3950
3951 2012-05-08  Cary Coutant  <ccoutant@google.com>
3952
3953         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3954         (lines_only_debug_sections): Likewise.
3955
3956 2012-05-02  Roland McGrath  <mcgrathr@google.com>
3957
3958         * nacl.cc: New file.
3959         * nacl.h: New file.
3960         * Makefile.am (CCFILES, HFILES): Add them.
3961         * Makefile.in: Regenerate.
3962         * i386.cc (Output_data_plt_i386_nacl): New class.
3963         (Output_data_plt_i386_nacl_exec): New class.
3964         (Output_data_plt_i386_nacl_dyn): New class.
3965         (Target_i386_nacl): New class.
3966         (Target_selector_i386_nacl): New class.
3967         (target_selector_i386): Use it instead of Target_selector_i386.
3968         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3969         (Target_x86_64_nacl): New class.
3970         (Target_selector_x86_64_nacl): New class.
3971         (target_selector_x86_64, target_selector_x32): Use it instead of
3972         Target_selector_x86_64.
3973         * arm.cc (Output_data_plt_arm_nacl): New class.
3974         (Target_arm_nacl): New class.
3975         (Target_selector_arm_nacl): New class.
3976         (target_selector_arm, target_selector_armbe): Use it instead of
3977         Target_selector_arm.
3978
3979         * target-select.cc (select_target): Take new Input_file* and off_t
3980         arguments, pass them on to recognize method of selector.
3981         * object.cc (make_elf_sized_object): Update caller.
3982         * parameters.cc (parameters_force_valid_target): Likewise.
3983         * incremental.cc (make_sized_incremental_binary): Likewise.
3984         * target-select.h: Update decl.
3985         (Target_selector::recognize): Take new Input_file* argument,
3986         pass it on to do_recognize.
3987         (Target_selector::do_recognize): Take new Input_file* argument.
3988         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3989         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3990         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3991         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3992
3993         * target.h (Target::Target_info): New members isolate_execinstr
3994         and rosegment_gap.
3995         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3996         * arm.cc (Target_arm::arm_info): Update initializer.
3997         * i386.cc (Target_i386::i386_info): Likewise.
3998         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3999         * sparc.cc (Target_sparc::sparc_info): Likewise.
4000         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4001         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
4002         * layout.cc (Layout::attach_allocated_section_to_segment):
4003         Take new const Target* argument.  If target->isolate_execinstr(), act
4004         like --rosegment.
4005         (Layout::find_first_load_seg): Take new const Target* argument;
4006         if target->isolate_execinstr(), reject PF_X segments.
4007         (Layout::relaxation_loop_body): Update caller.
4008         (Layout::set_segment_offsets): If target->isolate_execinstr(),
4009         reset file offset to zero when we hit LOAD_SEG, and then do a second
4010         loop over the segments before LOAD_SEG to reassign offsets after
4011         addresses have been determined.  Handle target->rosegment_gap().
4012         (Layout::attach_section_to_segment): Take new const Target* argument;
4013         pass it to attach_allocated_section_to_segment.
4014         (Layout::make_output_section): Update caller.
4015         (Layout::attach_sections_to_segments): Take new const Target* argument;
4016         pass it to attach_section_to_segment.
4017         * gold.cc (queue_middle_tasks): Update caller.
4018         * layout.h (Layout): Update method decls with new arguments.
4019
4020         * arm.cc (Target_arm::Target_arm): Take optional argument for the
4021         Target_info pointer to use.
4022         (Target_arm::do_make_data_plt): New virtual method.
4023         (Target_arm::make_data_plt): New method that calls it.
4024         (Target_arm::make_plt_entry): Use it.
4025         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
4026         for the section alignment.
4027         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
4028         method.
4029         (Output_data_plt_arm::first_plt_entry_offset): Call it.
4030         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
4031         method.
4032         (Output_data_plt_arm::get_plt_entry_size): Call it.
4033         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
4034         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
4035         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
4036         method.
4037         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
4038         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
4039         method instead of sizeof(plt_entry).
4040         (Output_data_plt_arm::add_entry): Likewise.
4041         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
4042         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
4043         than static method.
4044         (Target_arm::plt_entry_size): Likewise.
4045         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
4046         Move to ...
4047         (Output_data_plt_arm_standard): ... here, new class.
4048         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
4049         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
4050         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
4051
4052         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4053         Take additional argument for the PLT entry size.
4054         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
4055         Use get_plt_entry_size method rather than plt_entry_size variable.
4056         (Output_data_plt_x86_64::reserve_slot): Likewise.
4057         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
4058         (Output_data_plt_x86_64::add_entry): Likewise.
4059         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
4060         (Output_data_plt_x86_64::address_for_global): Likewise.
4061         (Output_data_plt_x86_64::address_for_local): Likewise.
4062         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4063         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
4064         Make method non-static.
4065         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
4066         method.
4067         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
4068         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
4069         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
4070         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
4071         virtual method.
4072         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
4073         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
4074         virtual method.
4075         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
4076         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
4077         virtual method.
4078         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
4079         (Output_data_plt_x86_64::plt_entry_size)
4080         (Output_data_plt_x86_64::first_plt_entry)
4081         (Output_data_plt_x86_64::plt_entry)
4082         (Output_data_plt_x86_64::tlsdesc_plt_entry)
4083         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
4084         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
4085         (Output_data_plt_x86_64_standard): ... here, new class.
4086         (Target_x86_64::Target_x86_64): Take optional argument for the
4087         Target_info pointer to use.
4088         (Target_x86_64::do_make_data_plt): New virtual method.
4089         (Target_x86_64::make_data_plt): New method to call it.
4090         (Target_x86_64::init_got_plt_for_update): Use that.
4091         Call this->plt_->add_eh_frame method here.
4092         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
4093         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
4094         rather than static method.
4095         (Target_x86_64::plt_entry_size): Likewise.
4096         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
4097         rather than plt_entry_size variable.  Move guts of PLT filling to...
4098         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
4099         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
4100         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
4101
4102         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
4103         additional argument for the section alignment.
4104         Don't do add_eh_frame_for_plt here.
4105         (Output_data_plt_i386::first_plt_entry_offset): Make the method
4106         non-static.  Use get_plt_entry_size method rather than plt_entry_size
4107         variable.
4108         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
4109         method.
4110         (Output_data_plt_i386::get_plt_entry_size): Call it.
4111         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
4112         (Output_data_plt_i386::add_eh_frame): New method to call it.
4113         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
4114         method.
4115         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
4116         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
4117         method.
4118         (Output_data_plt_i386::fill_plt_entry): New method to call it.
4119         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
4120         method instead of plt_entry_size.
4121         (Output_data_plt_i386::plt_entry_size)
4122         (Output_data_plt_i386::plt_eh_frame_fde_size)
4123         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
4124         (Output_data_plt_i386_standard): ... here, new class.
4125         (Output_data_plt_i386_exec): New class.
4126         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
4127         (Output_data_plt_i386_exec::first_plt_entry): ... here.
4128         (Output_data_plt_i386::exec_plt_entry): Move to ...
4129         (Output_data_plt_i386_exec::plt_entry): ... here.
4130         (Output_data_plt_i386_dyn): New class.
4131         (Output_data_plt_i386::first_plt_entry): Move to ...
4132         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
4133         (Output_data_plt_i386::dyn_plt_entry): Move to ...
4134         (Output_data_plt_i386_dyn::plt_entry): ... here.
4135         (Target_i386::Target_i386): Take optional argument for the Target_info
4136         pointer to use.
4137         (Target_i386::do_make_data_plt): New virtual method.
4138         (Target_i386::make_data_plt): New method to call it.
4139         (Target_i386::make_plt_section): Use that.
4140         Call this->plt_->add_eh_frame method here.
4141         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
4142         rather than plt_entry_size variable.
4143         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
4144         (Output_data_plt_i386::address_for_local): Likewise.
4145         (Output_data_plt_i386::do_write): Likewise.
4146         Move guts of PLT filling to...
4147         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
4148         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
4149         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
4150         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
4151
4152 2012-05-01  Cary Coutant  <ccoutant@google.com>
4153
4154         * dwarf_reader.cc (Dwarf_die::read_attributes)
4155         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
4156         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
4157         * reduced_debug_output.cc
4158         (Output_reduced_debug_info_section::get_die_end): Remove
4159         DW_FORM_GNU_ref_index.  Add default case.
4160
4161 2012-04-26  Mark Wielaard  <mjw@redhat.com>
4162
4163         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
4164         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
4165         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
4166         DW_AT_high_pc as offset from DW_AT_low_pc.
4167
4168         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
4169         * testsuite/Makefile.in: Regenerate.
4170         * testsuite/gdb_index_test_3.c: New test source file.
4171         * testsuite/gdb_index_test_3.sh: New test source file.
4172
4173 2012-04-25  Ian Lance Taylor  <iant@google.com>
4174
4175         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
4176         pointer.
4177         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
4178         as a class, not a struct.
4179         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
4180         (Target_arm::apply_cortex_a8_workaround): Likewise.
4181         * gc.h: Declare Reloc_types as a struct, not a class.
4182         * object.h: Declare Symbols_data as a struct.
4183         * reloc.h: Declare Read_relocs_data as a struct.
4184         * target.h: Declare Relocate_info as a struct.
4185
4186 2012-04-24  David S. Miller  <davem@davemloft.net>
4187
4188         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
4189         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
4190         and R_SPARC_WPLT30.
4191
4192 2012-04-24  Cary Coutant  <ccoutant@google.com>
4193
4194         * incremental-dump.cc (find_input_containing_global): Replace
4195         magic number with symbolic constant.
4196         (dump_incremental_inputs): Update version number.
4197         * incremental.cc (Output_section_incremental_inputs): Update version
4198         number; import symbolic constants from Incremental_inputs_reader.
4199         (Incremental_inputs::create_data_sections): Align relocations
4200         section correctly for 64-bit targets.
4201         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
4202         constants; add padding.
4203         (Output_section_incremental_inputs::write_header): Add assert for
4204         header_size.
4205         (Output_section_incremental_inputs::write_input_files): Add assert
4206         for input_entry_size.
4207         (Output_section_incremental_inputs::write_info_blocks): Add padding;
4208         add assert for object_info_size, input_section_entry_size,
4209         global_sym_entry_size.
4210         * incremental.h (Incremental_inputs_reader): Add symbolic constants
4211         for data structure sizes; use them.
4212         (Incremental_input_entry_reader): Import symbolic constants from
4213         Incremental_inputs_reader; use them.
4214
4215 2012-04-23  David S. Miller  <davem@davemloft.net>
4216
4217         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
4218         and elf_flags_set_.
4219         (Target_sparc::Target_sparc): Initialize new fields.
4220         (Target_sparc::do_make_elf_object): New function.
4221         (Target_sparc::do_adjust_elf_header): New function.
4222
4223 2012-04-23  Cary Coutant  <ccoutant@google.com>
4224
4225         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
4226         CU range table of gdb index.
4227
4228 2012-04-20  David S. Miller  <davem@davemloft.net>
4229
4230         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
4231         instead of false.
4232
4233 2012-04-16  David S. Miller  <davem@davemloft.net>
4234
4235         * sparc.cc (Target_sparc::got_address): New function.
4236         (Sparc_relocate_functions::gdop_hix22): New function.
4237         (Sparc_relocate_functions::gdop_lox10): New function.
4238         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
4239         relocs.
4240         (Target_sparc::Scan::local): Likewise if the global symbol is not
4241         preemptible and is not IFUNC.
4242         (Target_sparc::Relocate::relocate): Perform GOTDATA code
4243         transformations for local and non-preemptible non-IFUNC global
4244         symbols.
4245
4246         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
4247         writing out 64-bit part of ranges.
4248
4249         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
4250         -fpic and -fpie respectively.
4251         * Makefile.in: Regenerate.
4252
4253         * sparc.cc (class Target_sparc): Add rela_ifunc_.
4254         (Target_sparc::Target_sparc): Initialize new field.
4255         (Target_sparc::do_plt_section_for_global): New function.
4256         (Target_sparc::do_plt_section_for_local): New function.
4257         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
4258         (Target_sparc::make_plt_section): New function, broken out of
4259         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
4260         (Target_sparc::make_plt_entry): Call make_plt_section.
4261         (Target_sparc::make_local_ifunc_plt_entry): New function.
4262         (Target_sparc::rela_ifunc_section): New function.
4263         (Target_sparc::plt_section): Remove const.
4264         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
4265         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
4266         and ifunc_count_ fields.
4267         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
4268         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
4269         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
4270         (Output_data_plt_sparc::rela_ifunc): New function.
4271         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
4272         (Output_data_plt_sparc::has_ifunc_section): New function.
4273         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
4274         (Output_data_plt_sparc::address_for_global): New function.
4275         (Output_data_plt_sparc::address_for_local): New function.
4276         (Output_data_plt_sparc::plt_index_to_offset): New function.
4277         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
4278         and entry_count.
4279         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
4280         entry_count.
4281         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
4282         R_SPARC_JMP_IREL to switch.
4283         (Target_sparc::Scan::check_non_pic): Likewise.
4284         (Target_sparc::Scan::local): Handle IFUNC symbols.
4285         (Target_sparc::Scan::local): Likewise.
4286         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
4287         and plt_address_for_local.
4288         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
4289         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
4290
4291         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
4292         (class Output_data_reloc): Adjust calls to Output_reloc_type.
4293         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
4294         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
4295         global relocs too.
4296         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
4297         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
4298         calls.
4299         * sparc.cc (Target_sparc::Scan::global): Likewise.
4300         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4301
4302 2012-04-16  Cary Coutant  <ccoutant@google.com>
4303
4304         * archive.cc (Library_base::should_include_member): Check for
4305         --export-dynamic-symbol.
4306         * options.h (class General_options): Add --export-dynamic-symbol.
4307         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
4308         --export-dynamic-symbol.
4309         (Symbol_table::gc_mark_undef_symbols): Likewise.
4310         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
4311
4312 2012-04-12  David S. Miller  <davem@davemloft.net>
4313
4314         * sparc.cc (Reloc::wdisp10): New relocation method.
4315         (Reloc::h34): Likewise.
4316         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
4317         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
4318         R_SPARC_WDISP10.
4319         (Target_sparc::Scan::local): Likewise.
4320         (Target_sparc::Scan::global): Likewise.
4321         (Target_sparc::Relocate::relocate): Likewise.
4322
4323 2012-04-09  Cary Coutant  <ccoutant@google.com>
4324
4325         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
4326         low_pc == 0.
4327
4328 2012-04-06  Ian Lance Taylor  <iant@google.com>
4329
4330         * timer.cc: #include <unistd.h>.
4331
4332 2012-04-06  Roland McGrath  <mcgrathr@google.com>
4333
4334         * configure.in (AC_CHECK_HEADERS): Add locale.h.
4335         * config.in: Regenerate.
4336         * configure: Regenerate.
4337
4338 2012-04-05  Nick Clifton  <nickc@redhat.com>
4339
4340         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
4341         (AM_LC_MESSAGES): Add.
4342         * aclocal.m4: Regenerate.
4343         * config.in: Regenerate.
4344         * configure: Regenerate.
4345
4346 2012-03-21  Cary Coutant  <ccoutant@google.com>
4347
4348         * Makefile.am: Add gdb-index.cc, gdb-index.h.
4349         * Makefile.in: Regenerate.
4350         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
4351         (Sized_elf_reloc_mapper::symbol_section): New function.
4352         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
4353         (make_elf_reloc_mapper): New function.
4354         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
4355         (Dwarf_abbrev_table::do_read_abbrevs): New function.
4356         (Dwarf_abbrev_table::do_get_abbrev): New function.
4357         (Dwarf_ranges_table::read_ranges_table): New function.
4358         (Dwarf_ranges_table::read_range_list): New function.
4359         (Dwarf_pubnames_table::read_section): New function.
4360         (Dwarf_pubnames_table::read_header): New function.
4361         (Dwarf_pubnames_table::next_name): New function.
4362         (Dwarf_die::Dwarf_die): New function.
4363         (Dwarf_die::read_attributes): New function.
4364         (Dwarf_die::skip_attributes): New function.
4365         (Dwarf_die::set_name): New function.
4366         (Dwarf_die::set_linkage_name): New function.
4367         (Dwarf_die::attribute): New function.
4368         (Dwarf_die::string_attribute): New function.
4369         (Dwarf_die::int_attribute): New function.
4370         (Dwarf_die::uint_attribute): New function.
4371         (Dwarf_die::ref_attribute): New function.
4372         (Dwarf_die::child_offset): New function.
4373         (Dwarf_die::sibling_offset): New function.
4374         (Dwarf_info_reader::check_buffer): New function.
4375         (Dwarf_info_reader::parse): New function.
4376         (Dwarf_info_reader::do_parse): New function.
4377         (Dwarf_info_reader::do_read_string_table): New function.
4378         (Dwarf_info_reader::lookup_reloc): New function.
4379         (Dwarf_info_reader::get_string): New function.
4380         (Dwarf_info_reader::visit_compilation_unit): New function.
4381         (Dwarf_info_reader::visit_type_unit): New function.
4382         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
4383         Sized_elf_reloc_mapper.
4384         (Sized_dwarf_line_info::symbol_section): Remove function.
4385         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
4386         (Sized_dwarf_line_info::read_line_mappings): Remove object
4387         parameter, adjust callers.
4388         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
4389         * dwarf_reader.h: Include <sys/types.h>.
4390         (class Track_relocs): Remove forward declaration.
4391         (class Elf_reloc_mapper): New class.
4392         (class Sized_elf_reloc_mapper): New class.
4393         (class Dwarf_abbrev_table): New class.
4394         (class Dwarf_range_list): New class.
4395         (class Dwarf_ranges_table): New class.
4396         (class Dwarf_pubnames_table): New class.
4397         (class Dwarf_die): New class.
4398         (class Dwarf_info_reader): New class.
4399         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
4400         (Sized_dwarf_line_info::symbol_section): Remove member function.
4401         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
4402         base class.
4403         * gdb-index.cc: New source file.
4404         * gdb-index.h: New source file.
4405         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
4406         and .debug_types sections, call Layout::add_to_gdb_index.
4407         (Sized_relobj_incr::do_section_name): Implement.
4408         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
4409         return type; Implement.
4410         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
4411         return type.
4412         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
4413         parameter list and return type.
4414         (Sized_incr_dynobj::do_section_contents): Likewise.
4415         * layout.cc: Include gdb-index.h.
4416         (Layout::Layout): Initialize gdb_index_data_.
4417         (Layout::init_fixed_output_section): Check for .gdb_index section.
4418         (Layout::add_to_gdb_index): New function. Instantiate.
4419         * layout.h: Add forward declaration for class Gdb_index.
4420         (Layout::add_to_gdb_index): New member function.
4421         (Layout::gdb_index_data_): New data member.
4422         * main.cc: Include gdb-index.h.
4423         (main): Print statistics for gdb index.
4424         * object.cc (Object::section_contents): Move code into
4425         do_section_contents.
4426         (need_decompressed_section): Check for sections needed when building
4427         gdb index.
4428         (build_compressed_section_map): Likewise.
4429         (Sized_relobj_file::do_read_symbols): Need local symbols when building
4430         gdb index.
4431         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
4432         sections; call Layout::add_to_gdb_index.
4433         (Sized_relobj_file::do_decompressed_section_contents): Call
4434         do_section_contents directly.
4435         * object.h (Object::do_section_contents): Adjust parameter list and
4436         return type.
4437         (Object::do_decompressed_section_contents): Call do_section_contents
4438         directly.
4439         (Sized_relobj_file::do_section_contents): Adjust parameter list and
4440         return type.
4441         * options.h (class General_options): Add --gdb-index option.
4442         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
4443         list and return type.
4444         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
4445         * reloc.h (Track_relocs::checkpoint): New function.
4446         (Track_relocs::reset): New function.
4447
4448         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
4449         New test cases.
4450         * testsuite/Makefile.in: Regenerate.
4451         * testsuite/gdb_index_test.cc: New test source file.
4452         * testsuite/gdb_index_test_1.sh: New test source file.
4453         * testsuite/gdb_index_test_2.sh: New test source file.
4454
4455 2012-03-19  Doug Kwan  <dougkwan@google.com>
4456
4457         * arm.cc (Target_arm::do_define_standard_symbols): New method.
4458         (Target_arm::do_finalize_sections): Remove code which defines
4459         __exidx_start and __exidx_end.  Make symbol table parameter
4460         anonymous as it is not used.
4461         * gold.cc (queue_middle_tasks): Call target hook to define any
4462         target-specific symbols.
4463         * target.h (Target::define_standard_symbols): New method.
4464         (Target::do_define_standard_symbols): Same.
4465         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
4466         * testsuite/Makefile.in: Regenerate.
4467         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
4468         and __exidx_end.
4469         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
4470         relocations are generated for __exidx_start and __exidx_end.
4471
4472 2012-03-16  Doug Kwan  <dougkwan@google.com>
4473
4474         * testsuite/Makefile.am: Disable test initpri3b.
4475         * testsuite/Makefile.in: Regenerate.
4476
4477 2012-03-15  Doug Kwan  <dougkwan@google.com>
4478
4479         * arm.cc (Target_arm::got_section): Make .got section read-only
4480         if -z now is given.
4481
4482 2012-03-15  Ian Lance Taylor  <iant@google.com>
4483
4484         PR gold/13850
4485         * layout.cc (Layout::make_output_section): Correctly mark
4486         SHT_INIT_ARRAY, et. al., as relro.
4487
4488 2012-03-14  Doug Kwan  <dougkwan@google.com>
4489
4490         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
4491         dynamic relocations for protected symbols in shared objects.
4492
4493 2012-03-13  Ian Lance Taylor  <iant@google.com>
4494
4495         * resolve.cc (Symbol_table::resolve): When merging common symbols,
4496         keep the larger alignment.
4497
4498 2012-03-12  Cary Coutant  <ccoutant@google.com>
4499
4500         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
4501         handling of DW_LNE_define_file.
4502
4503 2012-03-12  Cary Coutant  <ccoutant@google.com>
4504
4505         * reduced_debug_output.cc
4506         (Output_reduced_debug_info_section::get_die_end): Add new FORM
4507         codes to switch.
4508
4509 2012-02-29  Cary Coutant  <ccoutant@google.com>
4510
4511         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
4512
4513 2012-02-29  Cary Coutant  <ccoutant@google.com>
4514
4515         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4516         Call Object::decompressed_section_contents.
4517         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
4518         New dtor.
4519         (Sized_dwarf_line_info::buffer_start_): New data member.
4520         * merge.cc (Output_merge_data::do_add_input_section): Call
4521         Object::decompressed_section_contents.
4522         (Output_merge_string::do_add_input_section): Likewise.
4523         * object.cc (need_decompressed_section): New function.
4524         (build_compressed_section_map): Decompress sections needed later.
4525         (Sized_relobj_file::do_decompressed_section_contents): New function.
4526         (Sized_relobj_file::do_discard_decompressed_sections): New function.
4527         * object.h (Object::decompressed_section_contents): New function.
4528         (Object::discard_decompressed_sections): New function.
4529         (Object::do_decompressed_section_contents): New function.
4530         (Object::do_discard_decompressed_sections): New function.
4531         (Compressed_section_info): New type.
4532         (Compressed_section_map): Include decompressed section contents.
4533         (Sized_relobj_file::do_decompressed_section_contents): New function.
4534         (Sized_relobj_file::do_discard_decompressed_sections): New function.
4535
4536 2012-02-16  Cary Coutant  <ccoutant@google.com>
4537
4538         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
4539         * testsuite/Makefile.in: Regenerate.
4540
4541 2012-02-14  Cary Coutant  <ccoutant@google.com>
4542
4543         * options.cc (General_options::finalize): Disallow -pie and -static.
4544
4545 2012-02-03  Doug Kwan  <dougkwan@google.com>
4546
4547         * arm.cc (Arm_relocate_functions::abs8,
4548         Arm_relocate_functions::abs16): Use
4549         Bits::has_signed_unsigned_overflow32.
4550         (Arm_relocate_functions::thm_abs8): Correct range of
4551         overflow check.
4552         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
4553         in assertions.
4554
4555 2012-02-02  Doug Kwan  <dougkwan@google.com>
4556
4557         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
4558         position independent outputs, not just shared objects.
4559
4560 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
4561
4562         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
4563         * configure: Regenerated.
4564
4565 2012-01-27  Ian Lance Taylor  <iant@google.com>
4566
4567         * reloc.h (Bits): New class with static functions, copied from
4568         namespace utils in arm.cc.
4569         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
4570         instead.
4571
4572 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4573
4574         * incremental.cc (write_info_blocks): Correct relocation offset.
4575
4576 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4577
4578         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
4579         (Relocate::tls_gd_to_le): Likewise.
4580
4581 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4582
4583         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
4584
4585 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4586
4587         * configure.ac: Check if -mcmodel=medium works.
4588         * configure: Regenerated.
4589
4590 2012-01-24  Cary Coutant  <ccoutant@google.com>
4591
4592         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
4593         definition and ...
4594         (read_unsigned_LEB_128_x): ... this new function.
4595         (read_signed_LEB_128): Replaced with inline definition and ...
4596         (read_signed_LEB_128_x): ... this new function.
4597         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
4598         (read_unsigned_LEB_128): Add inline definition.
4599         (read_signed_LEB_128_x): New function.
4600         (read_signed_LEB_128): Add inline definition.
4601         * testsuite/Makefile.am (leb128_unittest): New unit test.
4602         * testsuite/Makefile.in: Regenerate.
4603         * testsuite/leb128_unittest.cc: New unit test.
4604
4605 2012-01-23  Ian Lance Taylor  <iant@google.com>
4606
4607         PR gold/13617
4608         * i386.cc (Target_i386::do_code_fill): When using a jmp
4609         instruction, pad with nop instructions.
4610         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4611
4612 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
4613
4614         * x86_64.cc (gc_process_relocs): Add typename on types used in
4615         template.
4616         (scan_relocs): Likewise.
4617         (relocate_section): Likewise.
4618         (apply_relocation): Likewise.
4619
4620 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
4621
4622         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
4623         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
4624         under x32.
4625
4626 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
4627
4628         * x86_64.cc: Initial support for x32.
4629
4630 2012-01-03  Cary Coutant  <ccoutant@google.com>
4631
4632         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
4633         Use abstract base class for GOT.
4634         * gold/output.h (class Output_data_got_base): New abstract base class.
4635         (class Output_data_got): Derive from new base class, adjust ctors.
4636         (Output_data_got::reserve_slot): Make virtual; rename to
4637         do_reserve_slot; Adjust callers.
4638         * gold/target.h (Sized_target::init_got_plt_for_update): Return
4639         pointer to abstract base class.
4640         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
4641
4642 2011-12-18  Ian Lance Taylor  <iant@google.com>
4643
4644         * object.h (Relobj::local_symbol_value): New function.
4645         (Relobj::local_plt_offset): New function.
4646         (Relobj::local_has_got_offset): New function.
4647         (Relobj::local_got_offset): New function.
4648         (Relobj::set_local_got_offset): New function.
4649         (Relobj::do_local_symbol_value): New pure virtual function.
4650         (Relobj::do_local_plt_offset): Likewise.
4651         (Relobj::do_local_has_got_offset): Likewise.
4652         (Relobj::do_local_got_offset): Likewise.
4653         (Relobj::do_set_local_got_offset): Likewise.
4654         (Sized_relobj::do_local_has_got_offset): Rename from
4655         local_has_got_offset.
4656         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
4657         (Sized_relobj::do_set_local_got_offset): Rename from
4658         set_local_got_offset.
4659         (Sized_relobj_file::do_local_plt_offset): Rename from
4660         local_plt_offset.
4661         (Sized_relobj_file::do_local_symbol_value): New function.
4662         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
4663         local_plt_offset.
4664         * output.cc (Output_data_got::Got_entry::write): Change object to
4665         Relobj.  Use local_symbol_value.
4666         (Output_data_got::add_global_with_rel): Change rel_dyn to
4667         Output_data_reloc_generic*.  Use add_global_generic.
4668         (Output_data_got::add_global_with_rela): Remove.  Change all
4669         callers to use add_global_with_rel.
4670         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
4671         Output_data_reloc_generic*.  Use add_global_generic.
4672         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
4673         callers to use add_global_pair_with_rel.
4674         (Output_data_got::add_local): Change object to Relobj*.
4675         (Output_data_got::add_local_plt): Likewise.
4676         (Output_data_got::add_local_with_rel): Change object to Relobj*,
4677         change rel_dyn to Output_data_reloc_generic*.  Use
4678         add_local_generic.
4679         (Output_data_got::add_local_with_rela): Remove.  Change all
4680         callers to use all_local_with_rel.
4681         (Output_data_got::add_local_pair_with_rel): Change object to
4682         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
4683         add_output_section_generic.
4684         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
4685         callers to use add_local_pair_with_rel.
4686         (Output_data_got::reserve_local): Change object to Relobj*.
4687         * output.h: (class Output_data_reloc_generic): Add pure virtual
4688         declarations for add_global_generic, add_local_generic,
4689         add_output_section_generic.
4690         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
4691         functions for Output_data_reloc_generic.  Update declarations for
4692         changes listed in output.cc.
4693         (class Output_data_got): Change template parameter to got_size.
4694         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
4695         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
4696         function.
4697         (Sized_relobj_incr::do_local_plt_offset): New function.
4698         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
4699         add_global_generic.
4700
4701 2011-12-17  Cary Coutant  <ccoutant@google.com>
4702
4703         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
4704         * resolve.cc (Symbol_table::resolve): Likewise.
4705         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
4706         arrays.
4707         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4708
4709 2011-12-16  Ian Lance Taylor  <iant@google.com>
4710
4711         * output.h (Output_data_reloc_generic::add): Only call
4712         add_dynamic_reloc if this is a dynamic reloc section.
4713
4714 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
4715
4716         PR gold/13505
4717         * target-reloc.h (apply_relocation): Replace <64, false> with
4718         <size, big_endian>.
4719
4720 2011-11-25  Nick Clifton  <nickc@redhat.com>
4721
4722         * po/it.po: New Italian translation.
4723
4724 2011-11-17  Sterling Augustine  <saugustine@google.com>
4725
4726         * script.cc (script_include_directive): Implement.
4727         (read_script_file): New local variables name and search_path. Update
4728         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
4729         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
4730         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
4731
4732 2011-11-11  Sterling Augustine  <saugustine@google.com>
4733
4734         * yyscript.y (section_cmd): Add support for INCLUDE directive.
4735         (file_or_sections_cmd): Likewise.
4736
4737 2011-11-11  Doug Kwan  <dougkwan@google.com>
4738
4739         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
4740         if --just-symbols is given.
4741
4742 2011-11-10  Doug Kwan  <dougkwan@google.com>
4743
4744         PR gold/13362
4745         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
4746         when processing data relocs.
4747         * reloc.h (Relocate_functions::rel_unaligned): New method.
4748         (Relocate_functions::pcrel_unaligned): Ditto.
4749         (Relocate_functions::rel32_unaligned): Ditto.
4750         (Relocate_functions::pcrel32_unaligned): Ditto.
4751
4752 2011-11-09  Doug Kwan  <dougkwan@google.com>
4753
4754         PR gold/13362
4755         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
4756         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
4757         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
4758         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4759         (Relocate_functions::rel_unaligned): New.
4760         (Relocate_functions::rel32_unaligned): New.
4761         * target-reloc.h (relocate_for_relocatable): Add code to handle
4762         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4763         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
4764         arm_unaligned_reloc_r): New targets.
4765         * testsuite/Makefile.in: Regenerate.
4766         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
4767         linking.
4768
4769 2011-11-02  Ian Lance Taylor  <iant@google.com>
4770
4771         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
4772         NATIVE_LINKER.
4773         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
4774         * options.cc (General_options::finalize): Use library search path
4775         from configure script if specified.  If not native and no sysroot,
4776         only search TOOLLIBDIR.
4777         * options.h (Search_directory::Search_directory): Change name to
4778         const std::string&.
4779         (General_options::add_to_library_path_with_sysroot): Change arg to
4780         const std::string&.
4781         * configure, Makefile.in, config.in: Rebuild.
4782
4783 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
4784
4785         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
4786         we are working around the ARM1176 Erratum.
4787         * options.h (General_options::fix_arm1176): Add option.
4788         * testsuite/Makefile.am: Add testcases, and keep current ones
4789         working.
4790         * testsuite/Makefile.in: Regenerate.
4791         * testsuite/arm_fix_1176.s: New file.
4792         * testsuite/arm_fix_1176.sh: Likewise.
4793
4794 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
4795
4796         * arm.cc (Target_arm::Target_arm): Remove initialisation of
4797         may_use_blx_.
4798         (Target_arm::may_use_blx): Remove method.
4799         (Target_arm::set_may_use_blx): Likewise.
4800         (Target_arm::may_use_v4t_interworking): New method.
4801         (Target_arm::may_use_v5t_interworking): Likewise.
4802         (Target_arm::may_use_blx_): Remove member variable.
4803         (Arm_relocate_functions::arm_branch_common): Check for v5T
4804         interworking.
4805         (Arm_relocate_functions::thumb_branch_common): Likewise.
4806         (Reloc_stub::stub_type_for_reloc): Likewise.
4807         (Target_arm::do_finalize_sections): Correct interworking checks.
4808         * testsuite/Makefile.am: Add new tests.
4809         * testsuite/Makefile.in: Regenerate.
4810         * testsuite/arm_farcall_arm_arm.s: New test.
4811         * testsuite/arm_farcall_arm_arm.sh: Likewise.
4812         * testsuite/arm_farcall_arm_thumb.s: Likewise.
4813         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
4814         * testsuite/arm_farcall_thumb_arm.s: Likewise.
4815         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
4816         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
4817         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
4818
4819 2011-10-31  Cary Coutant  <ccoutant@google.com>
4820
4821         PR gold/13023
4822         * expression.cc (Expression::eval_with_dot): Add
4823         is_section_dot_assignment parameter.
4824         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
4825         absolute and assigning to dot within a section.
4826         * script-sections.cc
4827         (Output_section_element_assignment::set_section_addresses): Pass
4828         dot_section to set_if_absolute.
4829         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
4830         as is_section_dot_assignment flag to eval_with_dot.
4831         (Output_section_element_dot_assignment::set_section_addresses):
4832         Likewise.
4833         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
4834         parameter.  Also set value if relative to dot_section; set the
4835         symbol's output_section.
4836         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
4837         parameter.  Adjust all callers.
4838         (Expression::eval_maybe_dot): Likewise.
4839         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
4840         Adjust all callers.
4841         * testsuite/script_test_2.t: Test assignment of an absolute value
4842         to dot within an output section element.
4843
4844 2011-10-31  Cary Coutant  <ccoutant@google.com>
4845
4846         * options.h (class General_options): Add --[no-]gnu-unique options.
4847         * symtab.cc (Symbol_table::sized_write_globals): Convert
4848         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
4849
4850 2011-10-31  Cary Coutant  <ccoutant@google.com>
4851
4852         PR gold/13359
4853         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
4854         unnecessary assertion.
4855         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
4856
4857 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
4858
4859         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4860         gc_mark_symbol.
4861         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4862         gc_mark_symbol.
4863         Change to just keep the section associated with symbol.
4864         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
4865         they are externally visible and --export-dynamic is turned on.
4866         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
4867
4868 2011-10-19  Ian Lance Taylor  <iant@google.com>
4869
4870         PR gold/13163
4871         * script-sections.cc
4872         (Output_section_element_dot_assignment::needs_output_section): New
4873         function.
4874
4875 2011-10-19  Ian Lance Taylor  <iant@google.com>
4876
4877         PR gold/13204
4878         * layout.cc (Layout::segment_precedes): Don't assert failure if a
4879         --section-start option was seen.
4880         * options.h (General_options::any_section_start): New function.
4881
4882 2011-10-18  David S. Miller  <davem@davemloft.net>
4883
4884         PR binutils/13301
4885         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
4886         member to track relocation locations that have moved during TLS
4887         reloc optimizations.
4888         (Target_sparc::Relocate::Relocate): Initialize to NULL.
4889         (Target_sparc::Relocate::relocate): Adjust view down by 4
4890         bytes if it matches reloc_adjust_addr_.
4891         (Target_sparc::Relocate::relocate_tls): Always move the
4892         __tls_get_addr call delay slot instruction forward 4 bytes when
4893         performing relaxation.
4894
4895 2011-10-18  Cary Coutant  <ccoutant@google.com>
4896
4897         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
4898         (Output_file::map_no_anonymous): Check for non-zero
4899         return code from posix_fallocate.
4900
4901 2011-10-17  Cary Coutant  <ccoutant@google.com>
4902
4903         PR gold/13245
4904         * plugin.cc (is_visible_from_outside): Check for symbols
4905         referenced from dynamic objects.
4906         * resolve.cc (Symbol_table::resolve): Don't count references
4907         from dynamic objects as references from real ELF files.
4908         * testsuite/plugin_test_2.sh: Adjust expected result.
4909
4910 2011-10-17  Cary Coutant  <ccoutant@google.com>
4911
4912         * gold.cc: Include timer.h.
4913         (queue_middle_tasks): Stamp time.
4914         (queue_final_tasks): Likewise.
4915         * main.cc (main): Store timer in parameters.  Print timers
4916         for each pass.
4917         * parameters.cc (Parameters::Parameters): Initialize timer_.
4918         (Parameters::set_timer): New function.
4919         (set_parameters_timer): New function.
4920         * parameters.h (Parameters::set_timer): New function.
4921         (Parameters::timer): New function.
4922         (Parameters::timer_): New data member.
4923         (set_parameters_timer): New function.
4924         * timer.cc (Timer::stamp): New function.
4925         (Timer::get_pass_time): New function.
4926         * timer.h (Timer::stamp): New function.
4927         (Timer::get_pass_time): New function.
4928         (Timer::pass_times_): New data member.
4929
4930 2011-10-17  Cary Coutant  <ccoutant@google.com>
4931
4932         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4933         task for members of lib groups.
4934
4935 2011-10-17  Cary Coutant  <ccoutant@google.com>
4936
4937         PR gold/13288
4938         * fileread.cc (File_read::find_view): Add assert.
4939         (File_read::make_view): Move bounds check (replace with assert)...
4940         (File_read::find_or_make_view): ... to here.
4941
4942 2011-10-12  Cary Coutant  <ccoutant@google.com>
4943
4944         * output.cc (Output_file::open_base_file): Handle case where
4945         ::read returns less than requested size.
4946
4947 2011-10-10  Cary Coutant  <ccoutant@google.com>
4948
4949         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4950         Initialize defined_count_.
4951         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4952         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4953         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4954         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4955         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4956         * incremental.h (Sized_relobj_incr::defined_count_): New data
4957         member.
4958         (Sized_incr_dynobj::defined_count_): New data member.
4959         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4960         Return zeroes instead of internal error.
4961
4962 2011-10-10  Cary Coutant  <ccoutant@google.com>
4963
4964         PR gold/13249
4965         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4966         (Output_reloc::symbol_value): Return PLT offset if flag is set.
4967         * output.h (class Output_reloc): Add use_plt_offset flag.
4968         (Output_reloc::type_): Adjust size of bit field.
4969         (Output_reloc::use_plt_offset_): New bit field.
4970         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4971         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4972         flag.  Adjust all callers.
4973         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4974         creating RELATIVE relocations.
4975
4976 2011-10-10  Nick Clifton  <nickc@redhat.com>
4977
4978         * po/es.po: Updated Spanish translation.
4979         * po/fi.po: Updated Finnish translation.
4980
4981 2011-10-03   Diego Novillo  <dnovillo@google.com>
4982
4983         * options.cc (parse_uint): Fix dereference of RETVAL.
4984
4985 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
4986
4987         * layout.h (section_order_map_): New member.
4988         (get_section_order_map): New member function.
4989         * output.cc (Output_section::add_input_section): Check for patterns
4990         only when --section-ordering-file is specified.
4991         * gold.cc (queue_middle_tasks): Delay updating order of sections till
4992         output_sections have been formed.
4993         * layout.cc (Layout_Layout): Initialize section_order_map_.
4994         * plugin.cc (update_section_order): Store order in order_map. Do not
4995         update the order.
4996         * testsuite/Makefile.am: Add test case for plugin_final_layout.
4997         * testsuite/Makefile.in: Regenerate.
4998         * testsuite/plugin_section_order.c: New file.
4999         * testsuite/plugin_final_layout.cc: New file.
5000         * testsuite/plugin_final_layout.sh: New file.
5001
5002 2011-09-29  Cary Coutant  <ccoutant@google.com>
5003
5004         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5005         Check for NULL.
5006         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
5007         symbols during incremental update.
5008         (Symbol_table::add_from_dynobj): Likewise.
5009
5010 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5011             Ian Lance Taylor  <iant@google.com>
5012
5013         * symtab.cc (Symbol_table::define_special_symbol): Always
5014         canonicalize version string.
5015
5016 2011-09-26  Cary Coutant  <ccoutant@google.com>
5017
5018         * gold.cc (queue_initial_tasks): Move option checks ...
5019         * options.cc (General_options::finalize): ... to here. Disable
5020         some options; make others fatal.
5021
5022 2011-09-26  Cary Coutant  <ccoutant@google.com>
5023
5024         gcc PR lto/47247
5025         * plugin.cc (get_symbols_v2): New function.
5026         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
5027         (is_referenced_from_outside): New function.
5028         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
5029         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
5030         (get_symbols): Pass version parameter.
5031         (get_symbols_v2): New function.
5032         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
5033         parameter.
5034         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
5035         (onload): Add LDPT_GET_SYMBOLS_V2.
5036         (all_symbols_read_hook): Use get_symbols_v2; check for
5037         LDPR_PREVAILING_DEF_IRONLY_EXP.
5038         * testsuite/plugin_test_3.sh: Update expected results.
5039
5040 2011-09-23  Simon Baldwin  <simonb@google.com>
5041
5042         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
5043         configuration options.
5044         * configure: Regenerate.
5045         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
5046         * Makefile.in: Regenerate.
5047         * testsuite/Makefile.in: Regenerate.
5048
5049 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
5050
5051         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
5052
5053 2011-09-19  Cary Coutant  <ccoutant@google.com>
5054
5055         * incremental.cc (can_incremental_update): Fix typo in comment.
5056         * incremental.h (can_incremental_update): Likewise.
5057
5058 2011-09-18  Cary Coutant  <ccoutant@google.com>
5059
5060         * incremental.cc (can_incremental_update): New function.
5061         * incremental.h (can_incremental_update): New function.
5062         * layout.cc (Layout::init_fixed_output_section): Call it.
5063         (Layout::make_output_section): Don't allow patch space in .eh_frame.
5064         * object.cc (Sized_relobj_file::do_layout): Call
5065         can_incremental_update.
5066
5067 2011-09-13  Cary Coutant  <ccoutant@google.com>
5068
5069         * configure.ac: Check for glibc support for gnu_indirect_function
5070         support with static linking, setting automake conditional
5071         IFUNC_STATIC.
5072         * Makefile.in: Regenerate.
5073         * configure: Regenerate.
5074
5075         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
5076         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
5077         for IFUNC_STATIC.
5078         * testsuite/Makefile.in: Regenerate.
5079
5080 2011-09-13  Cary Coutant  <ccoutant@google.com>
5081
5082         * incremental.cc (Sized_relobj_incr::do_layout): Call
5083         report_comdat_group for kept comdat sections.
5084         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
5085         * testsuite/Makefile.in: Regenerate.
5086         * testsuite/incr_comdat_test_1.cc: New source file.
5087         * testsuite/incr_comdat_test_2_v1.cc: New source file.
5088         * testsuite/incr_comdat_test_2_v2.cc: New source file.
5089         * testsuite/incr_comdat_test_2_v3.cc: New source file.
5090
5091 2011-09-13  Ian Lance Taylor  <iant@google.com>
5092
5093         * object.cc (Sized_relobj_file::do_layout): Remove unused local
5094         variable external_symbols_offset.
5095
5096 2011-09-12  Ian Lance Taylor  <iant@google.com>
5097
5098         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
5099         triggered if object has no symbols.
5100
5101 2011-09-09  David S. Miller  <davem@davemloft.net>
5102
5103         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
5104         (Output_fill_debug_line::do_write): Likewise.
5105
5106 2011-08-29  Cary Coutant  <ccoutant@google.com>
5107
5108         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
5109         casts to match formatting specs.
5110         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
5111
5112 2011-08-26  Cary Coutant  <ccoutant@google.com>
5113
5114         * layout.cc (Free_list::allocate): Provide guarantee of minimum
5115         remaining hole size when allocating.
5116         (Layout::make_output_section): Set fill methods for debug sections.
5117         * layout.h (Free_list::Free_list_node): Move from private to
5118         public.
5119         (Free_list::set_min_hole_size): New function.
5120         (Free_list::begin, Free_list::end): New functions.
5121         (Free_list::min_hole_): New data member.
5122         * output.cc: Include dwarf.h.
5123         (Output_fill_debug_info::do_minimum_hole_size): New function.
5124         (Output_fill_debug_info::do_write): New function.
5125         (Output_fill_debug_line::do_minimum_hole_size): New function.
5126         (Output_fill_debug_line::do_write): New function.
5127         (Output_section::Output_section): Initialize new data member.
5128         (Output_section::set_final_data_size): Ensure patch space is larger
5129         than minimum hole size.
5130         (Output_section::do_write): Fill holes in debug sections.
5131         * output.h (Output_fill): New class.
5132         (Output_fill_debug_info): New class.
5133         (Output_fill_debug_line): New class.
5134         (Output_section::set_free_space_fill): New function.
5135         (Output_section::free_space_fill_): New data member.
5136         * testsuite/Makefile.am (incremental_test_3): Add
5137         --incremental-patch option.
5138         (incremental_test_4): Likewise.
5139         (incremental_test_5): Likewise.
5140         (incremental_test_6): Likewise.
5141         (incremental_copy_test): Likewise.
5142         (incremental_common_test_1): Likewise.
5143         * testsuite/Makefile.in: Regenerate.
5144
5145 2011-08-26  Nick Clifton  <nickc@redhat.com>
5146
5147         * po/es.po: Updated Spanish translation.
5148
5149 2011-08-01  Cary Coutant  <ccoutant@google.com>
5150
5151         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
5152         * gold/testsuite/Makefile.in: Regenerate.
5153         * gold/testsuite/justsyms_exec.c: New source file.
5154         * gold/testsuite/justsyms_lib.c: New source file.
5155
5156 2011-08-01  Cary Coutant  <ccoutant@google.com>
5157
5158         * layout.cc (Layout::set_segment_offsets): Don't realign text
5159         segment if -Ttext was specified.
5160         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
5161         file type.
5162         * object.h (Sized_relobj_file::e_type): New function.
5163         (Sized_relobj_file::e_type_): New data member.
5164         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
5165         base address for ET_EXEC files.
5166         * target.cc (Target::do_make_elf_object_implementation): Allow
5167         ET_EXEC files with --just-symbols option.
5168
5169 2011-07-28  Cary Coutant  <ccoutant@google.com>
5170
5171         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
5172         Add thread_number parameter.
5173         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
5174         * workqueue-threads.cc
5175         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
5176         current thread if its thread number is greater than desired thread
5177         count.
5178         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
5179         Add thread_number parameter.
5180         (Workqueue::should_cancel_thread): Likewise.
5181         (Workqueue::find_runnable_or_wait): Pass thread_number to
5182         should_cancel_thread.
5183         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
5184         parameter.
5185
5186 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
5187
5188         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
5189         only after checking if it cannot be forced local.
5190         * symtab.h (is_externally_visible): Check if the symbol is not forced
5191         local.
5192
5193 2011-07-15  Ian Lance Taylor  <iant@google.com>
5194
5195         * options.h (class General_options): Add --print-output-format.
5196         Move -EL next to -EB, for  better --help output.
5197         * target-select.cc: Include <cstdio>, "options.h", and
5198         "parameters.h".
5199         (Target_selector::do_target_bfd_name): New function.
5200         (print_output_format): New function.
5201         * target-select.h (class Target_selector): Update declarations.
5202         (Target_selector::target_bfd_name): New function.
5203         (print_output_format): Declare.
5204         * main.cc: Include "target-select.h".
5205         (main): Handle --print-output-format.
5206         * gold.cc: Include "target-select.h".
5207         (queue_initial_tasks): Handle --print-output-format when there are
5208         no input files.
5209         * parameters.cc (parameters_force_valid_target): Give a better
5210         error message if -EB/-EL does not match target.
5211         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
5212         function.
5213
5214 2011-07-15  Ian Lance Taylor  <iant@google.com>
5215
5216         * i386.cc (class Output_data_plt_i386): Add layout_ field.
5217         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
5218         (Output_data_plt_i386::do_write): Write address of .dynamic
5219         section to first entry in .got.plt section.
5220         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
5221         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5222         Initialize layout_.
5223         (Output_data_plt_x86_64::do_write): Write address of .dynamic
5224         section to first entry in .got.plt section.
5225         * layout.h (Layout::dynamic_section): New function.
5226
5227 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
5228
5229         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
5230         to claim_file call.
5231         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
5232         input_section_position_, and input_section_glob_.
5233         (read_layout_from_file): Call function section_ordering_specified.
5234         * layout.h (is_section_ordering_specified): New function.
5235         (section_ordering_specified): New function.
5236         (section_ordering_specified_): New boolean member.
5237         * main.cc(main): Call load_plugins after layout object is defined.
5238         * output.cc (Output_section::add_input_section): Use
5239         function section_ordering_specified to check if section ordering is
5240         needed.
5241         * output.cc (Output_section::add_relaxed_input_section): Use
5242         function section_ordering_specified to check if section ordering is
5243         needed.
5244         (Output_section::update_section_layout): New function.
5245         (Output_section::sort_attached_input_sections): Check if input section
5246         must be reordered.
5247         * output.h (Output_section::update_section_layout): New function.
5248         * plugin.cc (get_section_count): New function.
5249         (get_section_type): New function.
5250         (get_section_name): New function.
5251         (get_section_contents): New function.
5252         (update_section_order): New function.
5253         (allow_section_ordering): New function.
5254         (Plugin::load): Add the new interfaces to the transfer vector.
5255         (Plugin_manager::load_plugins): New parameter.
5256         (Plugin_manager::all_symbols_read): New parameter.
5257         (Plugin_manager::claim_file): New parameter. Save the elf object for
5258         unclaimed objects.
5259         (Plugin_manager::get_elf_object): New function.
5260         (Plugin_manager::get_view): Change to directly use the bool to check
5261         if get_view is called from claim_file_hook.
5262         * plugin.h (input_objects): New function
5263         (Plugin__manager::load_plugins): New parameter.
5264         (Plugin_manager::claim_file): New parameter.
5265         (Plugin_manager::get_elf_object): New function.
5266         (Plugin_manager::in_claim_file_handler): New function.
5267         (Plugin_manager::in_claim_file_handler_): New member.
5268         (layout): New function.
5269         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
5270         handler with an extra parameter. Make the elf object before calling
5271         claim_file handler.
5272         * testsuite/plugin_test.c (get_section_count): New function pointer.
5273         (get_section_type): New function pointer.
5274         (get_section_name): New function pointer.
5275         (get_section_contents): New function pointer.
5276         (update_section_order): New function pointer.
5277         (allow_section_ordering): New function pointer.
5278         (onload): Check if the new interfaces exist.
5279
5280 2011-07-13  Ian Lance Taylor  <iant@google.com>
5281
5282         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
5283         relro section.
5284         * x86_64.cc (Target_x86_64::got_section): Likewise.
5285         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
5286         (relro_now_test_SOURCES): New variable.
5287         (relro_now_test_DEPENDENCIES): New variable.
5288         (relro_now_test_LDFLAGS): New variable.
5289         (relro_now_test_LDADD): New variable.
5290         (relro_now_test.so): New target.
5291         * testsuite/Makefile.in: Rebuild.
5292
5293 2011-07-12  Ian Lance Taylor  <iant@google.com>
5294
5295         PR gold/12980
5296         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
5297         GLOB_DAT relocation rather than a RELATIVE relocation for a
5298         protected symbol when creating a shared library.
5299         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5300         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
5301         * testsuite/protected_main_1.cc (main): Test that protected
5302         function has same address.
5303
5304 2011-07-11  Ian Lance Taylor  <iant@google.com>
5305
5306         PR gold/12979
5307         * options.h (class General_options): Add -Bgroup.
5308         * options.cc (General_options::finalize): If -Bgroup is set,
5309         default to --unresolved-symbols=report-all.
5310         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
5311         * target-reloc.h (issue_undefined_symbol_error): Handle
5312         --unresolved-symbols=report-all.
5313
5314 2011-07-08  Ian Lance Taylor  <iant@google.com>
5315
5316         PR gold/11985
5317         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
5318         if linker script discards key sections.
5319         (Layout::create_dynamic_symtab): Likewise.
5320         (Layout::assign_local_dynsym_offsets): Likewise.
5321         (Layout::sized_create_version_sections): Likewise.
5322         (Layout::create_interp): Likewise.
5323         (Layout::finish_dynamic_section): Likewise.
5324         (Layout::set_dynamic_symbol_size): Likewise.
5325
5326 2011-07-08  Ian Lance Taylor  <iant@google.com>
5327
5328         PR gold/12386
5329         * options.h (class General_options): Add --unresolved-symbols.
5330         * target-reloc.h (issue_undefined_symbol_error): Check
5331         --unresolved-symbols.  Add comments.
5332
5333 2011-07-08  Ian Lance Taylor  <iant@google.com>
5334
5335         * testsuite/odr_violation2.cc (Ordering::operator()): Make
5336         expression more complex.
5337
5338 2011-07-08  Ian Lance Taylor  <iant@google.com>
5339
5340         PR gold/11317
5341         * target-reloc.h (issue_undefined_symbol_error): New inline
5342         function, broken out of relocate_section.
5343         (relocate_section): Call issue_undefined_symbol_error.
5344         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5345         there is no TLS segment if we are about to issue an undefined
5346         symbol error.
5347         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5348
5349 2011-07-08  Ian Lance Taylor  <iant@google.com>
5350
5351         PR gold/12279
5352         * resolve.cc (Symbol_table::should_override): Add fromtype
5353         parameter.  Change all callers.  Give error when linking together
5354         TLS and non-TLS symbol.
5355         (Symbol_table::should_override_with_special): Add fromtype
5356         parameter.  Change all callers.
5357         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5358         there is no TLS segment if we have reported some errors.
5359         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5360
5361 2011-07-08  Ian Lance Taylor  <iant@google.com>
5362
5363         PR gold/12372
5364         * target.h (Target::plt_address_for_global): New function.
5365         (Target::plt_address_for_local): New function.
5366         (Target::plt_section_for_global): Remove.
5367         (Target::plt_section_for_local): Remove.
5368         (Target::do_plt_address_for_global): New virtual function.
5369         (Target::do_plt_address_for_local): New virtual function.
5370         (Target::do_plt_section_for_global): Remove.
5371         (Target::do_plt_section_for_local): Remove.
5372         (Target::register_global_plt_entry): Add Symbol_table and Layout
5373         parameters.
5374         * output.cc (Output_data_got::Got_entry::write): Use
5375         plt_address_for_global and plt_address_for_local.
5376         * layout.cc (Layout::add_target_dynamic_tags): Use size and
5377         address of output section.
5378         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
5379         got_irelative_, and irelative_count_ fields.  Update
5380         declarations.
5381         (Output_data_plt_i386::has_irelative_section): New function.
5382         (Output_data_plt_i386::entry_count): Add irelative_count_.
5383         (Output_data_plt_i386::set_final_data_size): Likewise.
5384         (class Target_i386): Add got_irelative_ and rel_irelative_
5385         fields.  Update declarations.
5386         (Target_i386::Target_i386): Initialize new fields.
5387         (Target_i386::do_plt_address_for_global): New function replacing
5388         do_plt_section_for_global.
5389         (Target_i386::do_plt_address_for_local): New function replacing
5390         do_plt_section_for_local.
5391         (Target_i386::got_section): Create got_irelative_.
5392         (Target_i386::rel_irelative_section): New function.
5393         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
5394         fields.  Don't define __rel_iplt_{start,end}.
5395         (Output_data_plt_i386::add_entry): Add symtab and layout
5396         parameters.  Change all callers.  Use different PLT and GOT for
5397         IFUNC symbols.
5398         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
5399         layout parameters.  Change all callers.  Use different PLT and
5400         GOT.
5401         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
5402         (Output_data_plt_i386::rel_irelative): New function.
5403         (Output_data_plt_i386::address_for_global): New function.
5404         (Output_data_plt_i386::address_for_local): New function.
5405         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
5406         IRELATIVE GOT when changing IFUNC GOT entries.
5407         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
5408         reloc.
5409         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
5410         if we didn't create an IRELATIVE GOT.
5411         (Target_i386::Relocate::relocate): Use plt_address_for_global and
5412         plt_address_for_local.
5413         (Target_i386::do_dynsym_value): Use plt_address_for_global.
5414         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
5415         got_irelative_, and irelative_count_ fields.  Update
5416         declarations.
5417         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5418         Initialize new fields.  Remove symtab parameter.  Change all
5419         callers.
5420         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
5421         irelative_count_.
5422         (Output_data_plt_x86_64::has_irelative_section): New function.
5423         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
5424         (class Target_x86_64): Add got_irelative_ and rel_irelative_
5425         fields.  Update declarations.
5426         (Target_x86_64::Target_x86_64): Initialize new fields.
5427         (Target_x86_64::do_plt_address_for_global): New function replacing
5428         do_plt_section_for_global.
5429         (Target_x86_64::do_plt_address_for_local): New function replacing
5430         do_plt_section_for_local.
5431         (Target_x86_64::got_section): Create got_irelative_.
5432         (Target_x86_64::rela_irelative_section): New function.
5433         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
5434         all callers.  Don't create __rel_iplt_{start,end}.
5435         (Output_data_plt_x86_64::add_entry): Add symtab and layout
5436         parameters.  Change all callers.  Use different PLT and GOT for
5437         IFUNC symbols.
5438         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
5439         layout parameters.  Change all callers.  Use different PLT and
5440         GOT.
5441         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
5442         parameters.  Change all callers.  Use different PLT and GOT for
5443         IFUNC symbols.
5444         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
5445         (Output_data_plt_x86_64::rela_irelative): New function.
5446         (Output_data_plt_x86_64::address_for_global): New function.
5447         (Output_data_plt_x86_64::address_for_local): New function.
5448         (Output_data_plt_x86_64::set_final_data_size): Likewise.
5449         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
5450         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
5451         (Target_x86_64::register_global_plt_entry): Add symtab and layout
5452         parameters.
5453         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
5454         reloc.
5455         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
5456         symbols if we didn't create an IRELATIVE GOT.
5457         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
5458         plt_address_for_local.
5459         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
5460         * testsuite/ifuncvar1.c: New test file.
5461         * testsuite/ifuncvar2.c: New test file.
5462         * testsuite/ifuncvar3.c: New test file.
5463         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
5464         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
5465         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
5466         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
5467         * testsuite/Makefile.in: Rebuild.
5468
5469 2011-07-07  Cary Coutant  <ccoutant@google.com>
5470
5471         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
5472         (two_file_test_1_ndebug.o): Likewise.
5473         (two_file_test_1b_ndebug.o): Likewise.
5474         (two_file_test_2_ndebug.o): Likewise.
5475         (two_file_test_main_ndebug.o): Likewise.
5476         (incremental_test_2): Link with no-debug versions.
5477
5478 2011-07-06  Cary Coutant  <ccoutant@google.com>
5479
5480         * gold/incremental.cc
5481         (Output_section_incremental_inputs::write_info_blocks): Check for
5482         hidden and internal symbols.
5483
5484 2011-07-06  Cary Coutant  <ccoutant@google.com>
5485
5486         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
5487         Check disposition for startup file.
5488         (Incremental_inputs::report_command_line): Ignore
5489         --incremental-startup-unchanged option.
5490         * options.cc (General_options::parse_incremental_startup_unchanged):
5491         New function.
5492         (General_options::General_options): Initialize new data member.
5493         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
5494         (General_options): Add --incremental-startup-unchanged option.
5495         (General_options::incremental_startup_disposition): New function.
5496         (General_options::incremental_startup_disposition_): New data member.
5497
5498 2011-07-06  Cary Coutant  <ccoutant@google.com>
5499
5500         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
5501         input file index to Script_info ctor.
5502         (Sized_incremental_binary::do_file_has_changed): Find the
5503         command-line argument for files named in scripts.
5504         * incremental.h (Script_info::Script_info): New ctor
5505         with input file index.
5506         (Script_info::input_file_index): New function.
5507         (Script_info::input_file_index_): New data member.
5508         (Incremental_binary::get_library): Add const.
5509         (Incremental_binary::get_script_info): Add const.
5510         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
5511         * testsuite/Makefile.am (incremental_test_5): New test case.
5512         (incremental_test_6): New test case.
5513         * testsuite/Makefile.in: Regenerate.
5514
5515 2011-07-06  Cary Coutant  <ccoutant@google.com>
5516
5517         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
5518         debug output when command lines differ.
5519
5520 2011-07-06  Cary Coutant  <ccoutant@google.com>
5521
5522         * incremental.cc (Incremental_inputs::report_command_line): Ignore
5523         --incremental-patch option.
5524         * layout.cc (Free_list::allocate): Extend allocation beyond original
5525         end if enabled.
5526         (Layout::make_output_section): Mark sections that should get
5527         patch space.
5528         * options.cc (parse_percent): New function.
5529         * options.h (parse_percent): New function.
5530         (DEFINE_percent): New macro.
5531         (General_options): Add --incremental-patch option.
5532         * output.cc (Output_section::Output_section): Initialize new data
5533         members.
5534         (Output_section::add_input_section): Print section name when out
5535         of patch space.
5536         (Output_section::add_output_section_data): Likewise.
5537         (Output_section::set_final_data_size): Add patch space when
5538         doing --incremental-full.
5539         (Output_section::do_reset_address_and_file_offset): Remove patch
5540         space.
5541         (Output_segment::set_section_list_addresses): Print debug output
5542         only if --incremental-update.
5543         * output.h (Output_section::set_is_patch_space_allowed): New function.
5544         (Output_section::is_patch_space_allowed_): New data member.
5545         (Output_section::patch_space_): New data member.
5546         * parameters.cc (Parameters::incremental_full): New function.
5547         * parameters.h (Parameters::incremental_full): New function
5548         * testsuite/Makefile.am (incremental_test_2): Add test for
5549         --incremental-patch option.
5550         * testsuite/Makefile.in: Regenerate.
5551         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
5552         (t18): Remove function body.
5553
5554 2011-07-05  Doug Kwan  <dougkwan@google.com>
5555
5556         PR gold/12771
5557         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
5558         Arm_Address type for relocation result.
5559         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
5560         overflow check.
5561         (Arm_relocate_functions::abs32): Use unaligned access.
5562         (Arm_relocate_functions::rel32): Ditto.
5563         (Arm_relocate_functions::prel31): Ditto.
5564         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
5565         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
5566         static data relocations.
5567         * testsuite/Makefile.in: Regnerate.
5568         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
5569
5570 2011-07-05  Ian Lance Taylor  <iant@google.com>
5571
5572         PR gold/12392
5573         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
5574         symbols if necessary.
5575         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5576
5577 2011-07-05  Ian Lance Taylor  <iant@google.com>
5578
5579         PR gold/12952
5580         * resolve.cc (Symbol::override_base_with_special): Simply override
5581         version with special symbol version, ignoring previous version.
5582
5583 2011-07-05  Ian Lance Taylor  <iant@google.com>
5584
5585         * object.cc (Sized_relobj_file::include_section_group): Add
5586         information to comment about signature location.
5587
5588 2011-07-02  Ian Lance Taylor  <iant@google.com>
5589
5590         PR gold/12957
5591         * options.h (class General_options): Add -f and -F.
5592         * options.cc (General_options::finalize): Fatal error if -f/-F
5593         are used without -shared.
5594         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
5595
5596 2011-07-02  Ian Lance Taylor  <iant@google.com>
5597
5598         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
5599
5600 2011-07-01  Ian Lance Taylor  <iant@google.com>
5601
5602         PR gold/12525
5603         PR gold/12952
5604         * resolve.cc (Symbol::override_base_with_special): Don't override
5605         the version if the overriding symbol has a different name.
5606         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
5607         all callers.  If we give an error about an undefined version,
5608         define the base version if necessary.
5609         * dynobj.h (class Versions): Update declaration.
5610         * testsuite/weak_alias_test_5.cc: New file.
5611         * testsuite/weak_alias_test.script: New file.
5612         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
5613         and versioned_alias have the right value, and call t2.
5614         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
5615         weak_alias_test_5.so.
5616         (weak_alias_test_LDADD): Likewise.
5617         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
5618         * testsuite/Makefile.in: Rebuild.
5619
5620 2011-07-01  Ian Lance Taylor  <iant@google.com>
5621
5622         PR gold/12525
5623         * options.h (class General_options): Support -z notext.
5624         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
5625         -Wl,-z,notext.
5626         (two_file_shared_nonpic.so): Likewise.
5627         (two_file_shared_mixed.so): Likewise.
5628         (two_file_shared_mixed_1.so): Likewise.
5629         (weak_undef_lib_nonpic.so): Likewise.
5630         (alt/weak_undef_lib_nonpic.so): Likewise.
5631         (tls_test_shared_nonpic.so): Likewise.
5632         * testsuite/Makefile.in: Rebuild.
5633
5634 2011-07-01  Ian Lance Taylor  <iant@google.com>
5635
5636         PR gold/12525
5637         * configure.ac: Test whether static linking works, setting
5638         the automake conditional HAVE_STATIC.
5639         * testsuite/Makefile.am: Disable tests using -static if
5640         HAVE_STATIC is not true.
5641         * configure, testsuite/Makefile.in: Rebuild.
5642
5643 2011-07-01  Ian Lance Taylor  <iant@google.com>
5644
5645         PR gold/12525
5646         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
5647         Assert if we see DW_EH_PE_indirect.
5648         * target.h (Target::ehframe_datarel_base): New function.
5649         (Target::do_ehframe_datarel_base): New target function.
5650         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
5651         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
5652         function.
5653
5654 2011-07-01  Ian Lance Taylor  <iant@google.com>
5655
5656         PR gold/12571
5657         * options.h (class General_options): Add
5658         --ld-generated-unwind-info.
5659         * ehframe.cc (Fde::write): Add address parameter.  Change all
5660         callers.  If associated with PLT, fill in address and size.
5661         (Cie::set_output_offset): Only add merge mapping if there is an
5662         object.
5663         (Cie::write): Add address parameter.  Change all callers.
5664         (Eh_frame::add_ehframe_for_plt): New function.
5665         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
5666         input_offset_ fields into union u_, with new plt field.
5667         (Fde::Fde): Adjust for new union field.
5668         (Fde::Fde) [Output_data version]: New constructor.
5669         (Fde::add_mapping): Only add merge mapping if there is an object.
5670         (class Cie): Update declarations.
5671         (class Eh_frame): Declare add_ehframe_for_plt.
5672         * layout.cc (Layout::layout_eh_frame): Break out code into
5673         make_eh_frame_section, and call it.
5674         (Layout::make_eh_frame_section): New function.
5675         (Layout::add_eh_frame_for_plt): New function.
5676         * layout.h (class Layout): Update declarations.
5677         * merge.cc (Merge_map::add_mapping): Add assertion.
5678         * i386.cc: Include "dwarf.h".
5679         (class Output_data_plt_i386): Make first_plt_entry,
5680         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
5681         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5682         and plt_eh_frame_fde.
5683         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
5684         boundary.  Call add_eh_frame_for_plt if appropriate.
5685         * x86_64.cc: Include "dwarf.h".
5686         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
5687         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
5688         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5689         and plt_eh_frame_fde.
5690         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
5691         appropriate.
5692
5693 2011-06-29  Ian Lance Taylor  <iant@google.com>
5694
5695         PR gold/12629
5696         * object.cc (Sized_relobj_file::layout_section): Change shdr
5697         parameter to be const.
5698         (Sized_relobj_file::layout_eh_frame_section): New function, broken
5699         out of do_layout.
5700         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
5701         appropriate.  Call layout_eh_frame_section.
5702         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
5703         sections.
5704         * object.h (class Sized_relobj_file): Update declarations.
5705
5706 2011-06-29  Ian Lance Taylor  <iant@google.com>
5707
5708         PR gold/12652
5709         * script.cc (Token::integer_value): Accept trailing M/m/K/k
5710         modifier.
5711         (Lex::gather_token): Accept trailing M/m/K/k for integers.
5712
5713 2011-06-29  Ian Lance Taylor  <iant@google.com>
5714
5715         PR gold/12675
5716         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
5717         SHT_X86_64_UNWIND.
5718         * layout.cc (Layout::layout_eh_frame): Likewise.
5719
5720 2011-06-29  Ian Lance Taylor  <iant@google.com>
5721
5722         PR gold/12695
5723         * layout.cc (Layout::symtab_section_shndx): New function.
5724         * layout.h (class Layout): Declare symtab_section_shndx.
5725         * output.cc (Output_section::write_header): Call it.
5726
5727 2011-06-29  Ian Lance Taylor  <iant@google.com>
5728
5729         PR gold/12818
5730         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
5731         symbols which are not used in a relocation.
5732
5733 2011-06-28  Ian Lance Taylor  <iant@google.com>
5734
5735         PR gold/12898
5736         * layout.cc (Layout::segment_precedes): Don't crash if a linker
5737         script create indistinguishable segments.
5738         (Layout::set_segment_offsets): Use stable_sort when sorting
5739         segments.  Pass this to Compare_segments constructor.
5740         * layout.h (class Layout): Make segment_precedes non-static.
5741         (class Compare_segments): Change from struct to class.  Add
5742         layout_ field.  Add constructor.
5743         * script-sections.cc
5744         (Script_sections::attach_sections_using_phdrs_clause): Rename
5745         local orphan to is_orphan.  Don't report failure to put empty
5746         section in segment.  On attachment failure, report name of
5747         section, and attach to first PT_LOAD segment.
5748
5749 2011-06-28  Ian Lance Taylor  <iant@google.com>
5750
5751         PR gold/12934
5752         * target-select.cc (Target_selector::Target_selector): Add
5753         emulation parameter.  Change all callers.
5754         (select_target_by_bfd_name): Rename from select_target_by_name.
5755         Change all callers.
5756         (select_target_by_emulation): New function.
5757         (supported_emulation_names): New function.
5758         * target-select.h (class Target_selector): Add emulation_ field.
5759         Update declarations.
5760         (Target_selector::recognize_by_bfd_name): Rename from
5761         recognize_by_name.  Change all callers.
5762         (Target_selector::supported_bfd_names): Rename from
5763         supported_names.  Change all callers.
5764         (Target_selector::recognize_by_emulation): New function.
5765         (Target_selector::supported_emulations): New function.
5766         (Target_selector::emulation): New function.
5767         (Target_selector::do_recognize_by_bfd_name): Rename from
5768         do_recognize_by_name.  Change all callers.
5769         (Target_selector::do_supported_bfd_names): Rename from
5770         do_supported_names.  Change all callers.
5771         (Target_selector::do_recognize_by_emulation): New function.
5772         (Target_selector::do_supported_emulations): New function.
5773         (select_target_by_bfd_name): Change name in declaration.
5774         (select_target_by_emulation): Declare.
5775         (supported_emulation_names): Declare.
5776         * parameters.cc (parameters_force_valid_target): Try to find
5777         target based on emulation from -m option.
5778         * options.h (class General_options): Change doc string for -m.
5779         * options.cc (help): Print emulations.
5780         (General_options::parse_V): Likewise.
5781         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
5782         Add emulation parameter.  Change all callers.
5783
5784 2011-06-28  Ian Lance Taylor  <iant@google.com>
5785
5786         * target.h (class Target): Add osabi_ field.
5787         (Target::osabi): New function.
5788         (Target::set_osabi): New function.
5789         (Target::Target): Initialize osabi_.
5790         (Target::do_adjust_elf_header): Make pure virtual.
5791         (Sized_target::do_adjust_elf_header): Declare.
5792         * target.cc (Sized_target::do_adjust_elf_header): New function.
5793         (class Sized_target): Instantiate all versions.
5794         * freebsd.h (class Target_freebsd): Remove.
5795         (Target_selector_freebsd::do_recognize): Call set_osabi on
5796         Target.
5797         (Target_selector_freebsd::do_recognize_by_name): Likewise.
5798         (Target_selector_freebsd::set_osabi): Remove.
5799         * i386.cc (class Target_i386): Inherit from Sized_target rather
5800         than Target_freebsd.
5801         * x86_64.cc (class Target_x86_64): Likewise.
5802
5803 2011-06-28  Ian Lance Taylor  <iant@google.com>
5804
5805         * target.h (Target::can_check_for_function_pointers): Rewrite.
5806         Make non-virtual.
5807         (Target::can_icf_inline_merge_sections): Likewise.
5808         (Target::section_may_have_icf_unsafe_poineters): Likewise.
5809         (Target::Target_info): Add can_icf_inline_merge_sections field.
5810         (Target::do_can_check_for_function_pointers): New virtual
5811         function.
5812         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
5813         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
5814         from can_check_for_function_pointers, move in file.
5815         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
5816         section_may_have_icf_unsafe_poineters, move in file.
5817         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
5818         * i386.cc (Target_i386::do_can_check_for_function_pointers):
5819         Rename from can_check_for_function_pointers, move in file.
5820         (Target_i386::can_icf_inline_merge_sections): Remove.
5821         (Target_i386::i386_info): Initialize
5822         can_icf_inline_merge_sections.
5823         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
5824         Initialize can_icf_inline_merge_sections.
5825         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
5826         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
5827         Rename from can_check_for_function_pointers, move in file.
5828         (Target_x86_64::can_icf_inline_merge_sections): Remove.
5829         (Target_x86_64::x86_64_info): Initialize
5830         can_icf_inline_merge_sections.
5831         * testsuite/testfile.cc (Target_test::test_target_info):
5832         Likewise.
5833         * icf.cc (get_section_contents): Correct formatting.
5834
5835 2011-06-27  Ian Lance Taylor  <iant@google.com>
5836
5837         * symtab.cc (Symbol::versioned_name): New function.
5838         (Symbol_table::add_to_final_symtab): Use versioned_name when
5839         appropriate.
5840         (Symbol_table::sized_write_symbol): Likewise.
5841         * symtab.h (class Symbol): Declare versioned_name.
5842         * stringpool.h (class Stringpool_template): Add variant of add
5843         which takes a std::basic_string.
5844         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
5845         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
5846         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
5847         (ver_test_12.o): New target.
5848         * testsuite/Makefile.in: Rebuild.
5849
5850 2011-06-27  Doug Kwan  <dougkwan@google.com>
5851
5852         * arm.cc (Arm_relocate_functions::thm_jump8,
5853         Arm_relocate_functions::thm_jump11): Use a wider signed
5854         type to compute offset.
5855         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
5856         arm_thm_jump8.
5857         * testsuite/Makefile.in: Regenerate.
5858         * testsuite/arm_branch_in_range.sh: Check test results of
5859         arm_thm_jump11 and arm_thm_jump8.
5860         * testsuite/arm_thm_jump11.s: New test source file.
5861         * testsuite/arm_thm_jump11.t: New linker script.
5862         * testsuite/arm_thm_jump8.s: New test source file.
5863         * testsuite/arm_thm_jump8.t: New linker script.
5864
5865 2011-06-24  Ian Lance Taylor  <iant@google.com>
5866
5867         * layout.cc: Include "object.h".
5868         (ctors_sections_in_init_array): New static variable.
5869         (Layout::is_ctors_in_init_array): New function.
5870         (Layout::layout): Add entry to ctors_sections_in_init_array if
5871         appropriate.
5872         * layout.h (class Layout): Declare is_ctors_in_init_array.
5873         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
5874         is_ctors_reverse_view is set.
5875         (Sized_relobj_file::write_sections): Add layout parameter.  Change
5876         all callers.  Set is_ctors_reverse_view field of View_size.
5877         (Sized_relobj_file::reverse_words): New function.
5878         * object.h (Sized_relobj_file::View_size): Add
5879         is_ctors_reverse_view field.
5880         (class Sized_relobj_file): Update declarations.
5881         * testsuite/initpri3.c: New test.
5882         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
5883         initpri3b.
5884         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
5885         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
5886         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
5887         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
5888         * testsuite/Makefile.in: Rebuild.
5889
5890 2011-06-24  Cary Coutant  <ccoutant@google.com>
5891
5892         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
5893         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
5894         (debug_msg_cdebug.err): New targets.
5895         * testsuite/Makefile.in: Regenerate.
5896         * testsuite/debug_msg.sh: Check output of link with compressed debug.
5897         Fix checks for link with shared library.
5898
5899 2011-06-24  Doug Kwan  <dougkwan@google.com>
5900
5901         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
5902         skip empty text sections.
5903         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
5904
5905 2011-06-22  Ian Lance Taylor  <iant@google.com>
5906
5907         PR gold/12910
5908         * options.h (class General_options): Add --ctors-in-init-array.
5909         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
5910         friends as SHT_PROGBITS for merging sections.
5911         (Layout::layout): Remove special handling of .init_array and
5912         friends.  Don't sort if doing relocatable link.  Sort for .ctors
5913         and .dtors if ctors_in_init_array.
5914         (Layout::make_output_section): Force correct section types for
5915         .init_array and friends.  Don't sort if doing relocatable link,
5916         Don't sort .ctors and .dtors if ctors_in_init_array.
5917         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
5918         (Layout::output_section_name): Add relobj parameter.  Change all
5919         callers.  Handle .ctors. and .dtors. in code rather than table.
5920         Handle .ctors and .dtors if ctors_in_init_array.
5921         (Layout::match_file_name): New function, moved from output.cc.
5922         * layout.h (class Layout): Update declarations.
5923         * output.cc: Include "layout.h".
5924         (Input_section_sort_entry::get_priority): New function.
5925         (Input_section_sort_entry::match_file_name): Just call
5926         Layout::match_file_name.
5927         (Output_section::Input_section_sort_init_fini_compare::operator()):
5928         Handle .ctors and .dtors.  Sort by explicit priority rather than
5929         by name.
5930         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
5931         * testsuite/initpri2.c: New test.
5932         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5933         (check_PROGRAMS): Add initpri2.
5934         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5935         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5936         * configure, testsuite/Makefile.in: Rebuild.
5937
5938 2011-06-19  Ian Lance Taylor  <iant@google.com>
5939
5940         PR gold/12880
5941         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5942         .interp section to a PT_INTERP segment even if we have seen a
5943         --dynamic-linker option.  Don't do it if we have seen a PHDRS
5944         clause in a linker script.
5945         (Layout::finalize): Don't create a .interp section if we've
5946         already create a PT_INTERP segment.
5947         (Layout::create_interp): Always call choose_output_section (revert
5948         patch of 2011-06-17).  Don't create PT_INTERP segment.
5949         * script-sections.cc
5950         (Script_sections::create_note_and_tls_segments): Add a .interp
5951         section to a PT_INTERP segment even if we have seen a
5952         --dynamic-linker option.
5953
5954 2011-06-18  Ian Lance Taylor  <iant@google.com>
5955
5956         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5957         merely because a non-PT_LOAD segment has a dynamic reloc.
5958
5959 2011-06-18  Ian Lance Taylor  <iant@google.com>
5960
5961         * layout.cc (Layout::finish_dynamic_section): Don't create
5962         DT_FLAGS entry if not needed.
5963
5964 2011-06-18  Ian Lance Taylor  <iant@google.com>
5965
5966         PR gold/12745
5967         * layout.cc (Layout::layout_eh_frame): Correct handling of
5968         writable .eh_frame section.
5969
5970 2011-06-17  Ian Lance Taylor  <iant@google.com>
5971
5972         PR gold/12893
5973         * resolve.cc (Symbol_table::resolve): Don't give an error if a
5974         symbol is redefined with the exact same object and value.
5975
5976 2011-06-17  Ian Lance Taylor  <iant@google.com>
5977
5978         PR gold/12880
5979         * layout.h (class Layout): Add interp_segment_ field.
5980         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5981         (Layout::attach_allocated_section_to_segment): If making shared
5982         library, put .interp section in PT_INTERP segment.
5983         (Layout::finalize): Also call create_interp if -dynamic-linker
5984         option was used.
5985         (Layout::create_interp): Assert that there is no PT_INTERP
5986         segment.  If not using a SECTIONS clause, use make_output_section.
5987         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5988         * script-sections.cc
5989         (Script_sections::create_note_and_tls_segments): If making shared
5990         library, put .interp section in PT_INTERP segment.
5991
5992 2011-06-17  Ian Lance Taylor  <iant@google.com>
5993
5994         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5995         when making a shared library.
5996
5997 2011-06-17  Ian Lance Taylor  <iant@google.com>
5998
5999         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
6000         parameter.  Change all callers.  Don't issue warning about PC32
6001         against locally defined symbol.
6002
6003 2011-06-16  Ian Lance Taylor  <iant@google.com>
6004
6005         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
6006         occurs in same object.
6007
6008 2011-06-14  Alan Modra  <amodra@gmail.com>
6009
6010         * po/POTFILES.in: Regenerate.
6011
6012 2011-06-09  Ian Lance Taylor  <iant@google.com>
6013
6014         * script-sections.cc
6015         (Orphan_output_section::set_section_addresses): For a relocatable
6016         link set address to 0.
6017
6018 2011-06-09  Cary Coutant  <ccoutant@google.com>
6019
6020         PR gold/12804
6021         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
6022         used with --compress-debug-sections.
6023         * gold/object.cc (Sized_relobj_file::do_layout): Report
6024         uncompressed size of compressed input sections.
6025
6026 2011-06-08  Cary Coutant  <ccoutant@google.com>
6027
6028         PR gold/12804
6029         * testsuite/two_file_test_2_v1.cc: Change initialization of
6030         v2 to keep it in .data.
6031
6032 2011-06-07  Cary Coutant  <ccoutant@google.com>
6033
6034         * common.cc (Symbol_table::do_allocate_commons_list): Call
6035         gold_fallback.
6036         * errors.cc (Errors::fatal): Adjust call to gold_exit.
6037         (Errors::fallback): New function.
6038         (gold_fallback): New function.
6039         * errors.h (Errors::fallback): New function.
6040         * gold.cc (gold_exit): Change status parameter to enum; adjust
6041         all callers.
6042         (queue_initial_tasks): Call gold_fallback.
6043         * gold.h: Include cstdlib.
6044         (Exit_status): New enum type.
6045         (gold_exit): Change status parameter to enum.
6046         (gold_fallback): New function.
6047         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
6048         (Layout::create_symtab_sections): Likewise.
6049         (Layout::create_shdrs): Likewise.
6050         * main.cc (main): Adjust call to gold_exit.
6051         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
6052         (Output_data_got::add_got_entry_pair): Likewise.
6053         (Output_section::add_input_section): Likewise.
6054         (Output_section::add_output_section_data): Likewise.
6055         (Output_segment::set_section_list_addresses): Likewise.
6056         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
6057
6058 2011-06-07  Cary Coutant  <ccoutant@google.com>
6059
6060         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
6061         for incremental links.
6062         * output.cc (Output_segment::set_section_list_addresses): Remove
6063         FIXME and test for TLS or BSS.
6064
6065 2011-06-07  Cary Coutant  <ccoutant@google.com>
6066
6067         * testsuite/Makefile.am: Add incremental_copy_test,
6068         incremental_common_test_1.
6069         * testsuite/Makefile.in: Regenerate.
6070         * testsuite/common_test_1_v1.c: New source file.
6071         * testsuite/common_test_1_v2.c: New source file.
6072         * testsuite/copy_test_v1.cc: New source file.
6073
6074 2011-06-07  Cary Coutant  <ccoutant@google.com>
6075
6076         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
6077         update, allocate common from bss section's free list.
6078         * incremental-dump.cc (dump_incremental_inputs): Print flag for
6079         linker-defined symbols.
6080         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
6081         Skip GOT and PLT entries that are no longer referenced.
6082         (Output_section_incremental_inputs::write_info_blocks): Mark
6083         linker-defined symbols.
6084         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
6085         * output.cc (Output_section::allocate): New function.
6086         * output.h (Output_section::allocate): New function.
6087         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
6088         linker-defined symbols.
6089         (Symbol::override_base_with_special): Copy is_predefined_ flag.
6090         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
6091         (Symbol::init_base_output_data): Likewise.
6092         (Symbol::init_base_output_segment): Likewise.
6093         (Symbol::init_base_constant): Likewise.
6094         (Sized_symbol::init_output_data): Likewise.
6095         (Sized_symbol::init_output_segment): Likewise.
6096         (Sized_symbol::init_constant): Likewise.
6097         (Symbol_table::do_define_in_output_data): Likewise.
6098         (Symbol_table::do_define_in_output_segment): Likewise.
6099         (Symbol_table::do_define_as_constant): Likewise.
6100         * symtab.h (Symbol::is_predefined): New function.
6101         (Symbol::init_base_output_data): Add is_predefined parameter.
6102         (Symbol::init_base_output_segment): Likewise.
6103         (Symbol::init_base_constant): Likewise.
6104         (Symbol::is_predefined_): New data member.
6105         (Sized_symbol::init_output_data): Add is_predefined parameter.
6106         (Sized_symbol::init_output_segment): Likewise.
6107         (Sized_symbol::init_constant): Likewise.
6108         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
6109
6110 2011-06-07  Cary Coutant  <ccoutant@google.com>
6111
6112         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
6113         instead of emit_copy_reloc.
6114         (Copy_relocs::emit_copy_reloc): Refactor.
6115         (Copy_relocs::make_copy_reloc): New function.
6116         (Copy_relocs::add_copy_reloc): Remove.
6117         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
6118         section.
6119         (Copy_relocs::make_copy_reloc): New function.
6120         (Copy_relocs::add_copy_reloc): Remove.
6121         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
6122         unchanged input files.
6123         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
6124         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
6125         Reserve BSS space for COPY relocations.
6126         (Sized_incremental_binary::do_emit_copy_relocs): New function.
6127         (Output_section_incremental_inputs::write_info_blocks): Record
6128         whether a symbol is copied from a shared object.
6129         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
6130         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
6131         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
6132         (Incremental_input_entry_reader::get_output_symbol_index): Add
6133         is_copy parameter.
6134         (Incremental_binary::emit_copy_relocs): New function.
6135         (Incremental_binary::do_emit_copy_relocs): New function.
6136         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6137         new data member.
6138         (Sized_incremental_binary::add_copy_reloc): New function.
6139         (Sized_incremental_binary::do_emit_copy_relocs): New function.
6140         (Sized_incremental_binary::Copy_reloc): New struct.
6141         (Sized_incremental_binary::Copy_relocs): New typedef.
6142         (Sized_incremental_binary::copy_relocs_): New data member.
6143         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
6144         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
6145         * target.h (Sized_target::emit_copy_reloc): New function.
6146         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
6147
6148 2011-06-02  Cary Coutant  <ccoutant@google.com>
6149
6150         PR gold/12163
6151         * gold/archive.cc (Archive::Archive): Initialize new data member.
6152         (Archive::include_all_members): Return if archive has already been
6153         included.
6154         * gold/archive.h (Archive::include_all_members_): New data member.
6155
6156 2011-06-02  Nick Clifton  <nickc@redhat.com>
6157
6158         * dynobj.h: Fix spelling mistake in comment.
6159         * output.cc: Likewise.
6160
6161 2011-05-31  Doug Kwan  <dougkwan@google.com>
6162             Asier Llano
6163
6164         PR gold/12826
6165         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
6166         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
6167         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
6168         redundant arm_exidx_test.so.
6169         * testsuite/Makefile.in: Regenerate.
6170         (check_SCRIPTS): Add pr12826.sh
6171         (check_DATA): Add pr12826.stdout
6172         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
6173         * testsuite/pr12826.sh: New file.
6174         * testsuite/pr12826_1.s: Ditto.
6175         * testsuite/pr12826_1.s: Ditto.
6176
6177 2011-05-30  Ian Lance Taylor  <iant@google.com>
6178
6179         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
6180         sections.
6181
6182 2011-05-29  Ian Lance Taylor  <iant@google.com>
6183
6184         PR gold/12804
6185         * testsuite/Makefile.am: Use different file name for two_file_test
6186         temporary file for each incremental test.
6187         * testsuite/Makefile.in: Rebuild.
6188
6189 2011-05-29  Ian Lance Taylor  <iant@google.com>
6190
6191         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
6192         binary input file is empty.
6193
6194 2011-05-27  Ian Lance Taylor  <iant@google.com>
6195
6196         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
6197         (ver_test_9.so): Likewise.
6198         * testsuite/Makefile.in: Rebuild.
6199
6200 2011-05-26 Cary Coutant  <ccoutant@google.com>
6201
6202         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
6203         * incremental.cc (Incremental_inputs::report_input_section): Fix
6204         comment, indentation.
6205         (Incremental_inputs::report_comdat_group): New function.
6206         (Output_section_incremental_inputs::set_final_data_size): Adjust size
6207         of data for incremental input file entry.
6208         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
6209         group count, COMDAT group signatures.
6210         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
6211         an unchanged input file.
6212         * incremental.h (Incremental_object_entry::Incremental_object_entry):
6213         Initialize new data member.
6214         (Incremental_object_entry::add_comdat_group): New function.
6215         (Incremental_object_entry::get_comdat_group_count): New function.
6216         (Incremental_object_entry::get_comdat_signature_key): New function.
6217         (Incremental_object_entry::groups_): New data member.
6218         (Incremental_inputs::report_comdat_group): New function.
6219         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
6220         data for incremental input file entry.
6221         (Incremental_input_entry_reader::get_comdat_group_count): New function.
6222         (Incremental_input_entry_reader::get_input_section): Adjust size of
6223         data for incremental input file entry.
6224         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
6225         (Incremental_input_entry_reader::get_comdat_group_signature): New
6226         function.
6227         * object.cc (Sized_relobj::include_section_group): Report kept
6228         COMDAT groups for incremental links.
6229
6230 2011-05-24  David Meyer  <pdox@google.com>
6231
6232         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
6233         with name parameter.  Add found_name parameter.
6234         * fileread.cc (Input_file::find_file): Adjust code accordingly.
6235         * dirsearch.h (class Dirsearch): Update declaration.
6236
6237 2011-05-24  Ian Lance Taylor  <iant@google.com>
6238
6239         * archive.cc (Library_base::should_include_member): Pull in object
6240         from archive if it defines the entry symbol.
6241         * parameters.cc (Parameters::entry): New function.
6242         * parameters.h (class Parameters): Declare entry.
6243         * output.h (class Output_file_header): Remove entry_ field.
6244         * output.cc (Output_file_header::Output_file_header): Remove entry
6245         parameter.  Change all callers.
6246         (Output_file_header::entry): Use parameters->entry.
6247         * gold.cc (queue_middle_tasks): Likewise.
6248         * plugin.cc (Plugin_hook::run): Likewise.
6249
6250 2011-05-24 Cary Coutant  <ccoutant@google.com>
6251
6252         * gold.cc (queue_initial_tasks): Pass incremental base filename
6253         to Output_file::open_base_file; don't print error message.
6254         * incremental-dump.cc (main): Adjust call to
6255         Output_file::open_for_modification.
6256         * incremental-dump.cc (main): Likewise.
6257         * incremental.cc (Incremental_inputs::report_command_line):
6258         Ignore --incremental-base option when comparing command lines.
6259         Ignore parameter when given as separate argument.
6260         * options.h (class General_options): Add --incremental-base.
6261         * output.cc (Output_file::Output_file):
6262         (Output_file::open_base_file): Add base_name and writable parameters;
6263         read base file into new file; print error message here.
6264         (Output_file::map_no_anonymous): Add writable parameter; adjust all
6265         callers.
6266         * output.h (Output_file::open_for_modification): Rename to...
6267         (Output_file::open_base_file): ...this; add base_name and
6268         writable parameters; adjust all callers.
6269         (Output_file::map_no_anonymous): Add writable parameter; adjust all
6270         callers.
6271         * testsuite/Makefile.am (incremental_test_4): Test
6272         --incremental-base.
6273         * testsuite/Makefile.in: Regenerate.
6274
6275 2011-05-24 Cary Coutant  <ccoutant@google.com>
6276
6277         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
6278         incremental_test_4.
6279         * testsuite/Makefile.in: Regenerate.
6280         * testsuite/two_file_test_1_v1.cc: New test source file.
6281         * testsuite/two_file_test_1b_v1.cc: New test source file.
6282         * testsuite/two_file_test_2_v1.cc: New test source file.
6283
6284 2011-05-24 Cary Coutant  <ccoutant@google.com>
6285
6286         * dynobj.h (Dynobj::do_dynobj): New function.
6287         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
6288         flag and soname for shared objects.
6289         * incremental.cc (Incremental_inputs::report_object): Make
6290         either Incremental_object_entry or Incremental_dynobj_entry; add
6291         soname to string table.
6292         (Incremental_inputs::report_input_section): Add assertion.
6293         (Output_section_incremental_inputs::set_final_data_size): Adjust
6294         type of input file entry for shared libraries; adjust size of
6295         shared library info entry.
6296         (Output_section_incremental_inputs::write_input_files): Write
6297         as_needed flag for shared libraries.
6298         (Output_section_incremental_inputs::write_info_blocks): Adjust type
6299         of input file entry for shared libraries; write soname.
6300         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
6301         soname from incremental info.
6302         * incremental.h (enum Incremental_input_flags): Add
6303         INCREMENTAL_INPUT_AS_NEEDED.
6304         (Incremental_input_entry::Incremental_input_entry): Initialize new
6305         data member.
6306         (Incremental_input_entry::set_as_needed): New function.
6307         (Incremental_input_entry::as_needed): New function.
6308         (Incremental_input_entry::do_dynobj_entry): New function.
6309         (Incremental_input_entry::as_needed_): New data member.
6310         (Incremental_object_entry::Incremental_object_entry): Don't check
6311         for shared library.
6312         (Incremental_object_entry::do_type): Likewise.
6313         (class Incremental_dynobj_entry): New class.
6314         (Incremental_input_entry_reader::as_needed): New function.
6315         (Incremental_input_entry_reader::get_soname): New function.
6316         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
6317         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
6318         size of shared library info entry.
6319         * layout.cc (Layout::finish_dynamic_section): Don't test for
6320         incremental link when adding DT_NEEDED entries.
6321         * object.h (Object::Object): Initialize new data member.
6322         (Object::dynobj): New function.
6323         (Object::set_as_needed): New function.
6324         (Object::as_needed): New function.
6325         (Object::do_dynobj): New function.
6326         (Object::as_needed_): New data member.
6327
6328 2011-05-24 Cary Coutant  <ccoutant@google.com>
6329
6330         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
6331         info; adjust display of GOT entries.
6332         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6333         vector of input objects; remove file_status_.
6334         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
6335         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
6336         got_plt reader; call target hooks to reserve GOT entries.
6337         (Output_section_incremental_inputs::set_final_data_size): Adjust size
6338         of input file info header and GOT info entry.
6339         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
6340         relocation info.
6341         (Got_plt_view_info::got_descriptor): Remove.
6342         (Got_plt_view_info::sym_index): New data member.
6343         (Got_plt_view_info::input_index): New data member.
6344         (Local_got_offset_visitor::visit): Write input file index.
6345         (Global_got_offset_visitor::visit): Write 0 for input file index.
6346         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
6347         with sym_index and input_index.
6348         (Output_section_incremental_inputs::write_got_plt): Adjust size of
6349         incremental info GOT entry; replace got_descriptor with input_index.
6350         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
6351         map from input file index to object.
6352         (Sized_relobj_incr::do_layout): Replace direct data member reference
6353         with accessor function.
6354         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
6355         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
6356         Adjust size of input file info header.
6357         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
6358         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
6359         (Incremental_input_entry_reader::get_input_section): Adjust size of
6360         input file info header.
6361         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
6362         of incremental info GOT entry.
6363         (Incremental_got_plt_reader::get_got_desc): Remove.
6364         (Incremental_got_plt_reader::get_got_symndx): New function.
6365         (Incremental_got_plt_reader::get_got_input_index): New function.
6366         (Sized_incremental_binary::Sized_incremental_binary): Remove
6367         file_status_; add input_objects_.
6368         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
6369         (Sized_incremental_binary::set_file_is_unchanged): Remove.
6370         (Sized_incremental_binary::file_is_unchanged): Remove.
6371         (Sized_incremental_binary::set_input_object): New function.
6372         (Sized_incremental_binary::input_object): New function.
6373         (Sized_incremental_binary::file_status_): Remove.
6374         (Sized_incremental_binary::input_objects_): New data member.
6375         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
6376         references.
6377         (Sized_relobj_incr::invalid_address): Move to base class.
6378         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
6379         class.
6380         (Sized_relobj_incr::do_output_section_offset): Likewise.
6381         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
6382         (Sized_relobj_incr::section_offsets_): Likewise.
6383         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
6384         function.
6385         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
6386         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
6387         with accessor function.
6388         (Sized_relobj_file::do_layout): Likewise.
6389         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
6390         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
6391         (Sized_relobj_file::compute_final_local_value): Replace refs to
6392         section_offsets_ with accessor function.
6393         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
6394         * object.h (Relobj::Relobj): Initialize new data members.
6395         (Relobj::add_dyn_reloc): New function.
6396         (Relobj::first_dyn_reloc): New function.
6397         (Relobj::dyn_reloc_count): New function.
6398         (Relobj::first_dyn_reloc_): New data member.
6399         (Relobj::dyn_reloc_count_): New data member.
6400         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
6401         references.
6402         (Sized_relobj::Address): New typedef.
6403         (Sized_relobj::invalid_address): Move here from child class.
6404         (Sized_relobj::Sized_relobj): Initialize new data members.
6405         (Sized_relobj::sized_relobj): New function.
6406         (Sized_relobj::is_output_section_offset_invalid): Move here from
6407         child class.
6408         (Sized_relobj::get_output_section_offset): Likewise.
6409         (Sized_relobj::local_has_got_offset): Likewise.
6410         (Sized_relobj::local_got_offset): Likewise.
6411         (Sized_relobj::set_local_got_offset): Likewise.
6412         (Sized_relobj::do_for_all_local_got_entries): Likewise.
6413         (Sized_relobj::clear_got_offsets): New function.
6414         (Sized_relobj::section_offsets): Move here from child class.
6415         (Sized_relobj::do_output_section_offset): Likewise.
6416         (Sized_relobj::do_set_section_offset): Likewise.
6417         (Sized_relobj::Local_got_offsets): Likewise.
6418         (Sized_relobj::local_got_offsets_): Likewise.
6419         (Sized_relobj::section_offsets_): Likewise.
6420         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
6421         references.
6422         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
6423         class.
6424         (Sized_relobj_file::sized_relobj): New function
6425         (Sized_relobj_file::local_has_got_offset): Move to base class.
6426         (Sized_relobj_file::local_got_offset): Likewise.
6427         (Sized_relobj_file::set_local_got_offset): Likewise.
6428         (Sized_relobj_file::get_output_section_offset): Likewise.
6429         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
6430         (Sized_relobj_file::do_output_section_offset): Likewise.
6431         (Sized_relobj_file::do_set_section_offset): Likewise.
6432         (Sized_relobj_file::Local_got_offsets): Likewise.
6433         (Sized_relobj_file::local_got_offsets_): Likewise.
6434         (Sized_relobj_file::section_offsets_): Likewise.
6435         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
6436         (all constructors).
6437         (set_needs_dynsym_index): Convert relobj to derived class pointer.
6438         (Output_reloc::get_symbol_index): Likewise.
6439         (Output_reloc::local_section_offset): Likewise.
6440         (Output_reloc::get_address): Likewise.
6441         (Output_reloc::symbol_value): Likewise.
6442         (Output_data_got::reserve_slot): Move to class definition.
6443         (Output_data_got::reserve_local): New function.
6444         (Output_data_got::reserve_slot_for_global): Remove.
6445         (Output_data_got::reserve_global): New function.
6446         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
6447         (all constructors, two instantiations).
6448         (Output_reloc::get_relobj): New function (two instantiations).
6449         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
6450         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
6451         (Output_data_reloc::add_global): Adjust type of relobj.
6452         (Output_data_reloc::add_global_relative): Likewise.
6453         (Output_data_reloc::add_symbolless_global_addend): Likewise.
6454         (Output_data_reloc::add_local): Likewise.
6455         (Output_data_reloc::add_local_relative): Likewise.
6456         (Output_data_reloc::add_symbolless_local_addend): Likewise.
6457         (Output_data_reloc::add_local_section): Likewise.
6458         (Output_data_reloc::add_output_section): Likewise.
6459         (Output_data_reloc::add_absolute): Likewise.
6460         (Output_data_reloc::add_target_specific): Likewise.
6461         (Output_data_got::reserve_slot): Move definition here.
6462         (Output_data_got::reserve_local): New function.
6463         (Output_data_got::reserve_global): New function.
6464         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
6465         section_offsets_ with accessor function.
6466         (Sized_relobj_file::write_sections): Likewise.
6467         (Sized_relobj_file::do_relocate_sections): Likewise.
6468         * target.h (Sized_target::reserve_local_got_entry): New function.
6469         (Sized_target::reserve_global_got_entry): New function.
6470         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
6471         (Target_x86_64::reserve_global_got_entry): New function.
6472         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
6473
6474 2011-05-23 Cary Coutant  <ccoutant@google.com>
6475
6476         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
6477         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
6478         bit when checking got_type.
6479         * incremental.cc (Sized_incremental_binary::setup_readers):
6480         Store symbol table and string table locations; initialize bit vector
6481         of file status flags.
6482         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
6483         unchanged files.
6484         (Sized_incremental_binary::do_process_got_plt): New function.
6485         (Sized_incremental_binary::get_symtab_view): Use stored locations.
6486         (Output_section_incremental_inputs::set_final_data_size): Record
6487         file index for each input file.
6488         (Output_section_incremental_inputs::write_got_plt): Store file index
6489         instead of input entry offset for each GOT entry.
6490         * incremental.h
6491         (Incremental_input_entry::Incremental_input_entry): Initialize new
6492         data member.
6493         (Incremental_input_entry::set_offset): Store file index.
6494         (Incremental_input_entry::get_file_index): New function.
6495         (Incremental_input_entry::file_index_): New data member.
6496         (Incremental_binary::process_got_plt): New function.
6497         (Incremental_binary::do_process_got_plt): New function.
6498         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6499         data members.
6500         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
6501         (Sized_incremental_binary::set_file_is_unchanged): New function.
6502         (Sized_incremental_binary::file_is_unchanged): New function.
6503         (Sized_incremental_binary::do_process_got_plt): New function.
6504         (Sized_incremental_binary::file_status_): New data member.
6505         (Sized_incremental_binary::main_symtab_loc_): New data member.
6506         (Sized_incremental_binary::main_strtab_loc_): New data member.
6507         * output.cc (Output_data_got::Got_entry::write): Add case
6508         RESERVED_CODE.
6509         (Output_data_got::add_global): Call add_got_entry.
6510         (Output_data_got::add_global_plt): Likewise.
6511         (Output_data_got::add_global_with_rel): Likewise.
6512         (Output_data_got::add_global_with_rela): Likewise.
6513         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
6514         (Output_data_got::add_global_pair_with_rela): Likewise.
6515         (Output_data_got::add_local): Call add_got_entry.
6516         (Output_data_got::add_local_plt): Likewise.
6517         (Output_data_got::add_local_with_rel): Likewise.
6518         (Output_data_got::add_local_with_rela): Likewise.
6519         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
6520         (Output_data_got::add_local_pair_with_rela): Likewise.
6521         (Output_data_got::reserve_slot): New function.
6522         (Output_data_got::reserve_slot_for_global): New function.
6523         (Output_data_got::add_got_entry): New function.
6524         (Output_data_got::add_got_entry_pair): New function.
6525         (Output_section::add_output_section_data): Edit FIXME.
6526         * output.h
6527         (Output_section_data_build::Output_section_data_build): New
6528         constructor with size parameter.
6529         (Output_data_space::Output_data_space): Likewise.
6530         (Output_data_got::Output_data_got): Initialize new data member; new
6531         constructor with size parameter.
6532         (Output_data_got::add_constant): Call add_got_entry.
6533         (Output_data_got::reserve_slot): New function.
6534         (Output_data_got::reserve_slot_for_global): New function.
6535         (class Output_data_got::Got_entry): Add RESERVED_CODE.
6536         (Output_data_got::add_got_entry): New function.
6537         (Output_data_got::add_got_entry_pair): New function.
6538         (Output_data_got::free_list_): New data member.
6539         * target.h (Sized_target::init_got_plt_for_update): New function.
6540         (Sized_target::register_global_plt_entry): New function.
6541         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
6542         Initialize new data member; call init; add constructor with PLT count.
6543         (Output_data_plt_x86_64::init): New function.
6544         (Output_data_plt_x86_64::add_relocation): New function.
6545         (Output_data_plt_x86_64::reserve_slot): New function.
6546         (Output_data_plt_x86_64::free_list_): New data member.
6547         (Target_x86_64::init_got_plt_for_update): New function.
6548         (Target_x86_64::register_global_plt_entry): New function.
6549         (Output_data_plt_x86_64::add_entry): Allocate from free list for
6550         incremental updates.
6551         (Output_data_plt_x86_64::add_relocation): New function.
6552         * testsuite/object_unittest.cc (Object_test): Set default options.
6553
6554 2011-05-16  Ian Lance Taylor  <iant@google.com>
6555
6556         * options.h (class General_options): Make -i a synonym for -r.
6557
6558 2011-05-16  Ian Lance Taylor  <iant@google.com>
6559
6560         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
6561
6562 2011-05-10 Cary Coutant  <ccoutant@google.com>
6563
6564         * object.cc (Sized_relobj::do_count_local_symbols): Check for
6565         strip_all (-s).
6566
6567 2011-05-06  Ian Lance Taylor  <iant@google.com>
6568
6569         * layout.cc (Layout::layout): If the output section flags change,
6570         update the ordering.
6571
6572 2011-04-25 Cary Coutant  <ccoutant@google.com>
6573
6574         * incremental-dump.cc (dump_incremental_inputs): Print local
6575         symbol info for each input file.
6576         * incremental.cc
6577         (Output_section_incremental_inputs::set_final_data_size): Add local
6578         symbol info to input file entries in incremental info.
6579         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6580         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
6581         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
6582         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
6583         implementation.
6584         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
6585         (Sized_incr_relobj::do_relocate): Write the local symbols.
6586         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
6587         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
6588         Adjust size of input file header.
6589         (Incremental_inputs_reader::get_local_symbol_offset): New function.
6590         (Incremental_inputs_reader::get_local_symbol_count): New function.
6591         (Incremental_inputs_reader::get_input_section): Adjust size of input
6592         file header.
6593         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
6594         (Sized_incr_relobj::This): New typedef.
6595         (Sized_incr_relobj::sym_size): New const data member.
6596         (Sized_incr_relobj::Local_symbol): New struct.
6597         (Sized_incr_relobj::do_output_local_symbol_count): New function.
6598         (Sized_incr_relobj::do_local_symbol_offset): New function.
6599         (Sized_incr_relobj::local_symbol_count_): New data member.
6600         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
6601         (Sized_incr_relobj::local_symbol_index_): New data member.
6602         (Sized_incr_relobj::local_symbol_offset_): New data member.
6603         (Sized_incr_relobj::local_dynsym_offset_): New data member.
6604         (Sized_incr_relobj::local_symbols_): New data member.
6605         * object.h (Relobj::output_local_symbol_count): New function.
6606         (Relobj::local_symbol_offset): New function.
6607         (Relobj::do_output_local_symbol_count): New function.
6608         (Relobj::do_local_symbol_offset): New function.
6609         (Sized_relobj::do_output_local_symbol_count): New function.
6610         (Sized_relobj::do_local_symbol_offset): New function.
6611
6612 2011-04-22  Vladimir Simonov  <sv@sw.ru>
6613
6614         * descriptors.cc (set_close_on_exec): New function.
6615         (Descriptors::open): Use set_close_on_exec.
6616         * output.cc (S_ISLNK): Define if not defined.
6617
6618 2011-04-22 Cary Coutant  <ccoutant@google.com>
6619
6620         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6621         global symbol map.
6622         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6623         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
6624         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
6625         relocations.
6626         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
6627         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
6628         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
6629         * incremental.h
6630         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
6631         function.
6632         (Incremental_binary::apply_incremental_relocs): New function.
6633         (Incremental_binary::do_apply_incremental_relocs): New function.
6634         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6635         data member.
6636         (Sized_incremental_binary::add_global_symbol): New function.
6637         (Sized_incremental_binary::global_symbol): New function.
6638         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6639         (Sized_incremental_binary::symbol_map_): New data member.
6640         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
6641         * target.h (Sized_target::apply_relocation): New function.
6642         * target-reloc.h (apply_relocation): New function.
6643         * x86_64.cc (Target_x86_64::apply_relocation): New function.
6644
6645 2011-04-22  Doug Kwan  <dougkwan@google.com>
6646
6647         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
6648         flag of a SHT_ARM_EXIDX section.
6649         * testsuite/Makefile.am (arm_exidx_test): New test rules.
6650         * testsuite/Makefile.in: Regenerate.
6651         * testsuite/arm_exidx_test.s: New file.
6652         * testsuite/arm_exidx_test.sh: Same.
6653
6654 2011-04-20 Cary Coutant  <ccoutant@google.com>
6655
6656         PR gold/12689
6657         * archive.h (Incremental_archive_entry::Archive_member):
6658         Initialize arg_serial_ (second constructor).
6659
6660 2011-04-17  Ian Lance Taylor  <iant@google.com>
6661
6662         * object.cc (Relocate_info::location): Simplify location string.
6663         * errors.cc (Errors::error_at_location): Don't print program
6664         name.
6665         (Errors::warning_at_location): Likewise.
6666         (Errors::undefined_symbol): Likewise.
6667         * testsuite/debug_msg.sh: Update accordingly.
6668
6669 2011-04-14 Cary Coutant  <ccoutant@google.com>
6670
6671         * gold/layout.cc (Layout::symtab_section_offset): New function.
6672         * gold/layout.h (Layout::symtab_section_offset): New function.
6673         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
6674
6675 2011-04-12  Ian Lance Taylor  <iant@google.com>
6676
6677         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
6678         with MREMAP_MAYMOVE.
6679         * output.h (class Output_file): Add map_is_allocated_ field.
6680         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
6681         not available, provide stubs.  If mremap is not available, #define
6682         it to gold_mremap.
6683         (MREMAP_MAYMOVE): Define if not defined.
6684         (Output_file::Output_file): Initialize map_is_allocated_.
6685         (Output_file::resize): Check map_is_allocated_.
6686         (Output_file::map_anonymous): If mmap fails, use malloc.
6687         (Output_file::unmap): Don't do anything for an anonymous map.
6688         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
6689         is not available, provide stubs.
6690         (File_read::View::~View): Use free rather than delete[].
6691         (File_read::make_view): Use malloc rather than new[].  If mmap
6692         fails, use malloc.
6693         (File_read::find_or_make_view): Use malloc rather than new[].
6694         * gold.h: Remove HAVE_REMAP code.
6695         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
6696         exists.  Rename mremap to gold_mremap.  If mmap is not available
6697         don't do anything.
6698         * configure, config.in: Rebuild.
6699
6700 2011-04-11  Ian Lance Taylor  <iant@google.com>
6701
6702         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
6703         initialize local variable v.
6704
6705 2011-04-11  Cary Coutant  <ccoutant@google.com>
6706
6707         * archive.cc (Archive::include_member): Adjust call to
6708         report_object.
6709         (Add_archive_symbols::run): Track argument serial numbers.
6710         (Lib_group::include_member): Likewise.
6711         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
6712         * archive.h (Incremental_archive_entry::Archive_member):
6713         Initialize arg_serial_.
6714         (Archive_member::arg_serial_): New data member.
6715         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
6716         (Sized_dynobj::do_add_symbols): Track symbols when doing an
6717         incremental link.
6718         (Sized_dynobj::do_for_all_local_got_entries): New function.
6719         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
6720         function.
6721         * fileread.cc (get_mtime): New function.
6722         * fileread.h (get_mtime): New function.
6723         * gold.cc (queue_initial_tasks): Check for incremental update.
6724         (process_incremental_input): New function.
6725         (queue_middle_tasks): Don't force valid target for incremental
6726         update.
6727         * incremental-dump.cc (find_input_containing_global): Adjust
6728         size of symbol info entry.
6729         (dump_incremental_inputs): Dump argument serial number and
6730         in_system_directory flag; bias shndx by 1; print symbol names
6731         when dumping per-file symbol lists; use new symbol info readers.
6732         * incremental.cc
6733         (Output_section_incremental_inputs:update_data_size): New function.
6734         (Sized_incremental_binary::setup_readers): Setup input readers
6735         for each input file; build maps for files added from libraries
6736         and scripts.
6737         (Sized_incremental_binary::check_input_args): New function.
6738         (Sized_incremental_binary::do_check_inputs): Build map of argument
6739         serial numbers to input arguments.
6740         (Sized_incremental_binary::do_file_has_changed): Rename
6741         do_file_is_unchanged to this; compare file modification times.
6742         (Sized_incremental_binary::do_init_layout): New function.
6743         (Sized_incremental_binary::do_reserve_layout): New function.
6744         (Sized_incremental_binary::do_get_input_reader): Remove.
6745         (Sized_incremental_binary::get_symtab_view): New function.
6746         (Incremental_checker::can_incrementally_link_output_file): Remove.
6747         (Incremental_inputs::report_command_line): Exclude --debug options.
6748         (Incremental_inputs::report_archive_begin): Add parameter; track
6749         argument serial numbers; don't put input file entry for archive
6750         before archive members.
6751         (Incremental_inputs::report_archive_end): Put input file entry
6752         for archive after archive members.
6753         (Incremental_inputs::report_object): Add parameter; track argument
6754         serial numbers and in_system_directory flag.
6755         (Incremental_inputs::report_script): Add parameter; track argument
6756         serial numbers.
6757         (Output_section_incremental_inputs::set_final_data_size): Adjust
6758         size of symbol info entry; check for forwarding symbols.
6759         (Output_section_incremental_inputs::write_input_files): Write
6760         in_system_directory flag and argument serial number.
6761         (Output_section_incremental_inputs::write_info_blocks): Map section
6762         indices between incremental info and original input file; store
6763         input section index for each symbol.
6764         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
6765         change operator() to visit().
6766         (class Global_got_offset_visitor): Likewise.
6767         (class Global_symbol_visitor_got_plt):
6768         (Output_section_incremental_inputs::write_got_plt): Use new visitor
6769         classes.
6770         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
6771         (Sized_incr_relobj::do_read_symbols): New function.
6772         (Sized_incr_relobj::do_layout): New function.
6773         (Sized_incr_relobj::do_layout_deferred_sections): New function.
6774         (Sized_incr_relobj::do_add_symbols): New function.
6775         (Sized_incr_relobj::do_should_include_member): New function.
6776         (Sized_incr_relobj::do_for_all_global_symbols): New function.
6777         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
6778         (Sized_incr_relobj::do_section_size): New function.
6779         (Sized_incr_relobj::do_section_name): New function.
6780         (Sized_incr_relobj::do_section_contents): New function.
6781         (Sized_incr_relobj::do_section_flags): New function.
6782         (Sized_incr_relobj::do_section_entsize): New function.
6783         (Sized_incr_relobj::do_section_address): New function.
6784         (Sized_incr_relobj::do_section_type): New function.
6785         (Sized_incr_relobj::do_section_link): New function.
6786         (Sized_incr_relobj::do_section_info): New function.
6787         (Sized_incr_relobj::do_section_addralign): New function.
6788         (Sized_incr_relobj::do_initialize_xindex): New function.
6789         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
6790         (Sized_incr_relobj::do_read_relocs): New function.
6791         (Sized_incr_relobj::do_gc_process_relocs): New function.
6792         (Sized_incr_relobj::do_scan_relocs): New function.
6793         (Sized_incr_relobj::do_count_local_symbols): New function.
6794         (Sized_incr_relobj::do_finalize_local_symbols): New function.
6795         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
6796         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
6797         (Sized_incr_relobj::do_relocate): New function.
6798         (Sized_incr_relobj::do_set_section_offset): New function.
6799         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
6800         (Sized_incr_dynobj::do_read_symbols): New function.
6801         (Sized_incr_dynobj::do_layout): New function.
6802         (Sized_incr_dynobj::do_add_symbols): New function.
6803         (Sized_incr_dynobj::do_should_include_member): New function.
6804         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
6805         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
6806         (Sized_incr_dynobj::do_section_size): New function.
6807         (Sized_incr_dynobj::do_section_name): New function.
6808         (Sized_incr_dynobj::do_section_contents): New function.
6809         (Sized_incr_dynobj::do_section_flags): New function.
6810         (Sized_incr_dynobj::do_section_entsize): New function.
6811         (Sized_incr_dynobj::do_section_address): New function.
6812         (Sized_incr_dynobj::do_section_type): New function.
6813         (Sized_incr_dynobj::do_section_link): New function.
6814         (Sized_incr_dynobj::do_section_info): New function.
6815         (Sized_incr_dynobj::do_section_addralign): New function.
6816         (Sized_incr_dynobj::do_initialize_xindex): New function.
6817         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
6818         (make_sized_incremental_object): New function.
6819         (Incremental_library::copy_unused_symbols): New function.
6820         (Incremental_library::do_for_all_unused_symbols): New function.
6821         * incremental.h (enum Incremental_input_flags): New type.
6822         (class Incremental_checker): Remove.
6823         (Incremental_input_entry::Incremental_input_entry): Add argument
6824         serial number.
6825         (Incremental_input_entry::arg_serial): New function.
6826         (Incremental_input_entry::set_is_in_system_directory): New function.
6827         (Incremental_input_entry::is_in_system_directory): New function.
6828         (Incremental_input_entry::arg_serial_): New data member.
6829         (Incremental_input_entry::is_in_system_directory_): New data member.
6830         (class Script_info): Move here from script.h.
6831         (Script_info::Script_info): Add filename parameter.
6832         (Script_info::filename): New function.
6833         (Script_info::filename_): New data member.
6834         (Incremental_script_entry::Incremental_script_entry): Add argument
6835         serial number.
6836         (Incremental_object_entry::Incremental_object_entry): Likewise.
6837         (Incremental_object_entry::add_input_section): Build list of input
6838         sections with map to original shndx.
6839         (Incremental_object_entry::get_input_section_index): New function.
6840         (Incremental_object_entry::shndx_): New data member.
6841         (Incremental_object_entry::name_key_): Rename; adjust all refs.
6842         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
6843         (Incremental_archive_entry::Incremental_archive_entry): Add argument
6844         serial number.
6845         (Incremental_inputs::report_archive_begin): Likewise.
6846         (Incremental_inputs::report_object): Likewise.
6847         (Incremental_inputs::report_script): Likewise.
6848         (class Incremental_global_symbol_reader): New class.
6849         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
6850         and store flags and input file type.
6851         (Incremental_input_entry_reader::arg_serial): New function.
6852         (Incremental_input_entry_reader::type): Extract type from flags.
6853         (Incremental_input_entry_reader::is_in_system_directory): New function.
6854         (Incremental_input_entry_reader::get_input_section_count): Call
6855         accessor function for type.
6856         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
6857         function for type; adjust size of global symbol entry.
6858         (Incremental_input_entry_reader::get_global_symbol_count): Call
6859         accessor function for type.
6860         (Incremental_input_entry_reader::get_object_count): Likewise.
6861         (Incremental_input_entry_reader::get_object_offset): Likewise.
6862         (Incremental_input_entry_reader::get_member_count): Likewise.
6863         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
6864         (Incremental_input_entry_reader::get_member_offset): Likewise.
6865         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
6866         (Incremental_input_entry_reader::Global_symbol_info): Remove.
6867         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
6868         (Incremental_input_entry_reader::get_global_symbol_reader): New
6869         function.
6870         (Incremental_input_entry_reader::get_output_symbol_index): New
6871         function.
6872         (Incremental_input_entry_reader::type_): Remove.
6873         (Incremental_input_entry_reader::flags_): New data member.
6874         (Incremental_inputs_reader::input_file_offset): New function.
6875         (Incremental_inputs_reader::input_file_index): New function.
6876         (Incremental_inputs_reader::input_file): Call input_file_offset.
6877         (Incremental_inputs_reader::input_file_at_offset): New function.
6878         (Incremental_relocs_reader::get_r_type): Reformat.
6879         (Incremental_relocs_reader::get_r_shndx): Reformat.
6880         (Incremental_relocs_reader::get_r_offset): Reformat.
6881         (Incremental_relocs_reader::data): New function.
6882         (Incremental_binary::Incremental_binary): Initialize new data members.
6883         (Incremental_binary::check_inputs): Add cmdline parameter.
6884         (Incremental_binary::file_is_unchanged): Remove.
6885         (Input_reader::arg_serial): New function.
6886         (Input_reader::get_unused_symbol_count): New function.
6887         (Input_reader::get_unused_symbol): New function.
6888         (Input_reader::do_arg_serial): New function.
6889         (Input_reader::do_get_unused_symbol_count): New function.
6890         (Input_reader::do_get_unused_symbol): New function.
6891         (Incremental_binary::input_file_count): New function.
6892         (Incremental_binary::get_input_reader): Change signature to use
6893         index instead of filename.
6894         (Incremental_binary::file_has_changed): New function.
6895         (Incremental_binary::get_input_argument): New function.
6896         (Incremental_binary::get_library): New function.
6897         (Incremental_binary::get_script_info): New function.
6898         (Incremental_binary::init_layout): New function.
6899         (Incremental_binary::reserve_layout): New function.
6900         (Incremental_binary::output_file): New function.
6901         (Incremental_binary::do_check_inputs): New function.
6902         (Incremental_binary::do_file_is_unchanged): Remove.
6903         (Incremental_binary::do_file_has_changed): New function.
6904         (Incremental_binary::do_init_layout): New function.
6905         (Incremental_binary::do_reserve_layout): New function.
6906         (Incremental_binary::do_input_file_count): New function.
6907         (Incremental_binary::do_get_input_reader): Change signature.
6908         (Incremental_binary::input_args_map_): New data member.
6909         (Incremental_binary::library_map_): New data member.
6910         (Incremental_binary::script_map_): New data member.
6911         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6912         new data members.
6913         (Sized_incremental_binary::output_section): New function.
6914         (Sized_incremental_binary::inputs_reader): Add const.
6915         (Sized_incremental_binary::symtab_reader): Add const.
6916         (Sized_incremental_binary::relocs_reader): Add const.
6917         (Sized_incremental_binary::got_plt_reader): Add const.
6918         (Sized_incremental_binary::get_symtab_view): New function.
6919         (Sized_incremental_binary::Inputs_reader): New typedef.
6920         (Sized_incremental_binary::Input_entry_reader): New typedef.
6921         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
6922         (Sized_incremental_binary::do_file_is_unchanged): Remove.
6923         (Sized_incremental_binary::do_file_has_changed): New function.
6924         (Sized_incremental_binary::do_init_layout): New function.
6925         (Sized_incremental_binary::do_reserve_layout): New function.
6926         (Sized_input_reader::Inputs_reader): Remove.
6927         (Sized_input_reader::Input_entry_reader): Remove.
6928         (Sized_input_reader::do_arg_serial): New function.
6929         (Sized_input_reader::do_get_unused_symbol_count): New function.
6930         (Sized_input_reader::do_get_unused_symbol): New function.
6931         (Sized_incremental_binary::do_input_file_count): New function.
6932         (Sized_incremental_binary::do_get_input_reader): Change signature;
6933         use index instead of filename.
6934         (Sized_incremental_binary::section_map_): New data member.
6935         (Sized_incremental_binary::input_entry_readers_): New data member.
6936         (class Sized_incr_relobj): New class.
6937         (class Sized_incr_dynobj): New class.
6938         (make_sized_incremental_object): New function.
6939         (class Incremental_library): New class.
6940         * layout.cc (Free_list::num_lists): New static data member.
6941         (Free_list::num_nodes): New static data member.
6942         (Free_list::num_removes): New static data member.
6943         (Free_list::num_remove_visits): New static data member.
6944         (Free_list::num_allocates): New static data member.
6945         (Free_list::num_allocate_visits): New static data member.
6946         (Free_list::init): New function.
6947         (Free_list::remove): New function.
6948         (Free_list::allocate): New function.
6949         (Free_list::dump): New function.
6950         (Free_list::print_stats): New function.
6951         (Layout_task_runner::run): Resize output file for incremental updates.
6952         (Layout::Layout): Initialize new data members.
6953         (Layout::set_incremental_base): New function.
6954         (Layout::init_fixed_output_section): New function.
6955         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6956         incremental updates.
6957         (Layout::create_gold_note): Do not create gold note section for
6958         incremental updates.
6959         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6960         for incremental updates.
6961         (Layout::set_section_offsets): For incremental updates, allocate space
6962         from free list.
6963         (Layout::create_symtab_sections): Layout with offsets relative to
6964         start of section; for incremental updates, allocate space from free
6965         list.
6966         (Layout::create_shdrs): For incremental updates, allocate space from
6967         free list.
6968         (Layout::finish_dynamic_section): For incremental updates, do not
6969         check --as-needed (fixed in subsequent patch).
6970         * layout.h (class Free_list): New class.
6971         (Layout::set_incremental_base): New function.
6972         (Layout::incremental_base): New function.
6973         (Layout::init_fixed_output_section): New function.
6974         (Layout::allocate): New function.
6975         (Layout::incremental_base_): New data member.
6976         (Layout::free_list_): New data member.
6977         * main.cc (main): Print Free_list statistics.
6978         * object.cc (Relobj::finalize_incremental_relocs): Add
6979         clear_counts parameter; clear counts only when clear_counts is set.
6980         (Sized_relobj::Sized_relobj): Initialize new base class.
6981         (Sized_relobj::do_layout): Don't report special sections.
6982         (Sized_relobj::do_for_all_local_got_entries): New function.
6983         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6984         symtab_off to all symbol table offsets.
6985         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6986         * object.h (class Got_offset_list): Move to top of file.
6987         (Object::Object): Allow case where input_file == NULL.
6988         (Object::~Object): Likewise.
6989         (Object::input_file): Assert that input_file != NULL.
6990         (Object::lock): Allow case where input_file == NULL.
6991         (Object::unlock): Likewise.
6992         (Object::is_locked): Likewise.
6993         (Object::token): Likewise.
6994         (Object::release): Likewise.
6995         (Object::is_incremental): New function.
6996         (Object::get_mtime): New function.
6997         (Object::for_all_local_got_entries): New function.
6998         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6999         (Object::set_is_in_system_directory): New function.
7000         (Object::is_in_system_directory): New function.
7001         (Object::do_is_incremental): New function.
7002         (Object::do_get_mtime): New function.
7003         (Object::do_for_all_local_got_entries): New function.
7004         (Object::is_in_system_directory_): New data member.
7005         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
7006         (class Sized_relobj_base): New class.
7007         (class Sized_relobj): Derive from Sized_relobj_base.
7008         (class Sized_relobj::Symbols): Redeclare from base class.
7009         (class Sized_relobj::local_got_offset_list): Remove.
7010         (class Sized_relobj::Output_sections): Redeclare from base class.
7011         (class Sized_relobj::do_for_all_local_got_entries): New function.
7012         (class Sized_relobj::write_local_symbols): Add offset parameter.
7013         (class Sized_relobj::local_symbol_offset_): Update comment.
7014         (class Sized_relobj::local_dynsym_offset_): Update comment.
7015         * options.cc (Input_arguments::add_file): Remove const.
7016         * options.h (Input_file_argument::Input_file_argument):
7017         Initialize arg_serial_ (all constructors).
7018         (Input_file_argument::set_arg_serial): New function.
7019         (Input_file_argument::arg_serial): New function.
7020         (Input_file_argument::arg_serial_): New data member.
7021         (Input_arguments::Input_arguments): Initialize file_count_.
7022         (Input_arguments::add_file): Remove const.
7023         (Input_arguments::number_of_input_files): New function.
7024         (Input_arguments::file_count_): New data member.
7025         (Command_line::number_of_input_files): Call
7026         Input_arguments::number_of_input_files.
7027         * output.cc (Output_segment_headers::Output_segment_headers):
7028         Set current size.
7029         (Output_section::Input_section::current_data_size): New function.
7030         (Output_section::Output_section): Initialize new data members.
7031         (Output_section::add_input_section): Don't do merge sections for
7032         an incremental link; allocate space from free list for an
7033         incremental update.
7034         (Output_section::add_output_section_data): Allocate space from
7035         free list for an incremental update.
7036         (Output_section::update_data_size): New function.
7037         (Output_section::set_fixed_layout): New function.
7038         (Output_section::reserve): New function.
7039         (Output_segment::set_section_addresses): Remove const.
7040         (Output_segment::set_section_list_addresses): Remove const; allocate
7041         space from free list for an incremental update.
7042         (Output_segment::set_offset): Adjust size of RELRO segment for an
7043         incremental update.
7044         * output.h (Output_data::current_data_size): Move here from
7045         child classes.
7046         (Output_data::pre_finalize_data_size): New function.
7047         (Output_data::update_data_size): New function.
7048         (Output_section_headers::update_data_size): new function.
7049         (Output_section_data_build::current_data_size): Move to Output_data.
7050         (Output_data_strtab::update_data_size): New function.
7051         (Output_section::current_data_size): Move to Output_data.
7052         (Output_section::set_fixed_layout): New function.
7053         (Output_section::has_fixed_layout): New function.
7054         (Output_section::reserve): New function.
7055         (Output_section::update_data_size): New function.
7056         (Output_section::has_fixed_layout_): New data member.
7057         (Output_section::free_list_): New data member.
7058         (Output_segment::set_section_addresses): Remove const.
7059         (Output_segment::set_section_list_addresses): Remove const.
7060         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
7061         New function.
7062         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
7063         New function.
7064         * readsyms.cc (Read_symbols::do_read_symbols): Add library
7065         parameter when calling Add_symbols constructor; store argument
7066         serial number for members of a lib group.
7067         (Add_symbols::locks): Allow case where token == NULL.
7068         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
7069         (Read_member::~Read_member): New function.
7070         (Read_member::is_runnable): New function.
7071         (Read_member::locks): New function.
7072         (Read_member::run): New function.
7073         (Check_script::~Check_script): New function.
7074         (Check_script::is_runnable): New function.
7075         (Check_script::locks): New function.
7076         (Check_script::run): New function.
7077         (Check_library::~Check_library): New function.
7078         (Check_library::is_runnable): New function.
7079         (Check_library::locks): New function.
7080         (Check_library::run): New function.
7081         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
7082         (Add_symbols::library_): New data member.
7083         (class Read_member): New class.
7084         (class Check_script): New class.
7085         (class Check_library): New class.
7086         * reloc.cc (Read_relocs::is_runnable): Allow case where
7087         token == NULL.
7088         (Read_relocs::locks): Likewise.
7089         (Scan_relocs::locks): Likewise.
7090         (Relocate_task::locks): Likewise.
7091         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
7092         to clear counters.
7093         (Sized_relobj::incremental_relocs_scan): Fix comment.
7094         (Sized_relobj::do_relocate): Pass output file offset to
7095         write_local_symbols.
7096         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
7097         from class declaration.
7098         * script.cc (read_input_script): Allocate Script_info; pass
7099         argument serial number to report_script.
7100         * script.h (class Script_info): Move to incremental.h.
7101         * symtab.cc (Symbol_table::add_from_incrobj): New function.
7102         * symtab.h (Symbol_table::add_from_incrobj): New function.
7103         (Symbol_table::set_file_offset): New function.
7104
7105 2011-04-05  Cary Coutant  <ccoutant@google.com>
7106
7107         * incremental-dump.cc (dump_incremental_inputs): Change signature
7108         to take a Sized_incremental_binary; change caller.  Use readers
7109         in Sized_incremental_binary.
7110         * incremental.cc
7111         (Sized_incremental_binary::find_incremental_inputs_sections):
7112         Rename do_find_incremental_inputs_sections to this.
7113         (Sized_incremental_binary::setup_readers): New function.
7114         (Sized_incremental_binary::do_check_inputs): Check
7115         has_incremental_info_ flag; move setup code to setup_readers;
7116         use input readers.
7117         (Sized_incremental_binary::do_file_is_unchanged): New function.
7118         (Sized_incremental_binary::do_get_input_reader): New function.
7119         * incremental.h (class Incremental_binary): Move to end of file.
7120         (Incremental_binary::file_is_unchanged): New function.
7121         (Incremental_binary::do_file_is_unchanged): New function.
7122         (Incremental_binary::Input_reader): New class.
7123         (Incremental_binary::get_input_reader): New function.
7124         (class Sized_incremental_binary): Move to end of file.
7125         (Sized_incremental_binary::Sized_incremental_binary): Setup the
7126         input section reader classes.
7127         (Sized_incremental_binary::has_incremental_info): New function.
7128         (Sized_incremental_binary::inputs_reader): New function.
7129         (Sized_incremental_binary::symtab_reader): New function.
7130         (Sized_incremental_binary::relocs_reader): New function.
7131         (Sized_incremental_binary::got_plt_reader): New function.
7132         (Sized_incremental_binary::do_file_is_unchanged): New function.
7133         (Sized_incremental_binary::Sized_input_reader): New class.
7134         (Sized_incremental_binary::get_input_reader): New function.
7135         (Sized_incremental_binary::find_incremental_inputs_sections):
7136         Rename do_find_incremental_inputs_sections to this.
7137         (Sized_incremental_binary::setup_readers): New function.
7138         (Sized_incremental_binary::has_incremental_info_): New data member.
7139         (Sized_incremental_binary::inputs_reader_): New data member.
7140         (Sized_incremental_binary::symtab_reader_): New data member.
7141         (Sized_incremental_binary::relocs_reader_): New data member.
7142         (Sized_incremental_binary::got_plt_reader_): New data member.
7143         (Sized_incremental_binary::current_input_file_): New data member.
7144
7145 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
7146
7147         PR gold/12640
7148         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
7149         violation.
7150
7151 2011-03-30  Cary Coutant  <ccoutant@google.com>
7152
7153         * archive.cc (Archive::include_member): Adjust call to report_object.
7154         (Add_archive_symbols::run): Add script_info to call to
7155         report_archive_begin.
7156         (Lib_group::include_member): Adjust call to report_object.
7157         (Add_lib_group_symbols::run): Adjust call to report_object.
7158         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
7159         blocks.  Add object count for script input files.
7160         * incremental.cc (Incremental_inputs::report_archive_begin): Add
7161         script_info parameter; change all callers.
7162         (Incremental_inputs::report_object): Add script_info parameter;
7163         change all callers.
7164         (Incremental_inputs::report_script): Store backpointer to
7165         incremental info entry.
7166         (Output_section_incremental_inputs::set_final_data_size): Record
7167         additional information for scripts.
7168         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7169         * incremental.h (Incremental_script_entry::add_object): New function.
7170         (Incremental_script_entry::get_object_count): New function.
7171         (Incremental_script_entry::get_object): New function.
7172         (Incremental_script_entry::objects_): New data member; adjust
7173         constructor.
7174         (Incremental_inputs::report_archive_begin): Add script_info parameter.
7175         (Incremental_inputs::report_object): Add script_info parameter.
7176         (Incremental_inputs_reader::get_object_count): New function.
7177         (Incremental_inputs_reader::get_object_offset): New function.
7178         * options.cc (Input_arguments::add_file): Return reference to
7179         new input argument.
7180         * options.h (Input_argument::set_script_info): New function.
7181         (Input_argument::script_info): New function.
7182         (Input_argument::script_info_): New data member; adjust all
7183         constructors.
7184         (Input_file_group::add_file): Return reference to new input argument.
7185         (Input_file_lib::add_file): Likewise.
7186         (Input_arguments::add_file): Likewise.
7187         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
7188         * script.cc (Parser_closure::Parser_closure): Add script_info
7189         parameter; adjust all callers.
7190         (Parser_closure::script_info): New function.
7191         (Parser_closure::script_info_): New data member.
7192         (read_input_script): Report scripts earlier to incremental info.
7193         (script_add_file): Set script_info in Input_argument.
7194         (script_add_library): Likewise.
7195         * script.h (Script_options::Script_info): Rewrite class.
7196
7197 2011-03-29  Cary Coutant  <ccoutant@google.com>
7198
7199         * archive.cc (Library_base::should_include_member): Move
7200         method here from class Archive.
7201         (Archive::Archive): Initialize base class.
7202         (Archive::should_include_member): Move to base class.
7203         (Archive::do_for_all_unused_symbols): New function.
7204         (Add_archive_symbols::run): Remove redundant access to
7205         incremental_inputs.
7206         (Lib_group::Lib_group): Initialize base class.
7207         (Lib_group::do_filename): New function.
7208         (Lib_group::include_member): Pass pointer to Lib_group to
7209         report_object.
7210         (Lib_group::do_for_all_unused_symbols): New function.
7211         (Add_lib_group_symbols::run): Report archive information for
7212         incremental links.
7213         * archive.h (class Library_base): New base class.
7214         (class Archive): Derive from Library_base.
7215         (Archive::filename): Move to base class.
7216         (Archive::set_incremental_info): Likewise.
7217         (Archive::incremental_info): Likewise.
7218         (Archive::Should_include): Likewise.
7219         (Archive::should_include_member): Likewise.
7220         (Archive::Armap_entry): Remove.
7221         (Archive::Unused_symbol_iterator): Remove.
7222         (Archive::unused_symbols_begin): Remove.
7223         (Archive::unused_symbols_end): Remove.
7224         (Archive::do_filename): New function.
7225         (Archive::do_get_mtime): New function.
7226         (Archive::do_for_all_unused_symbols): New function.
7227         (Archive::task_): Move to base class.
7228         (Archive::incremental_info_): Likewise.
7229         (class Lib_group): Derive from Library_base.
7230         (Lib_group::do_filename): New function.
7231         (Lib_group::do_get_mtime): New function.
7232         (Lib_group::do_for_all_unused_symbols): New function.
7233         (Lib_group::task_): Move to base class.
7234         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
7235         function.
7236         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
7237         function.
7238         * incremental.cc (Incremental_inputs::report_archive_begin):
7239         Use Library_base; call library's get_mtime; add incremental inputs
7240         entry before members.
7241         (class Unused_symbol_visitor): New class.
7242         (Incremental_inputs::report_archive_end): Use Library_base; use
7243         visitor class to record unused symbols; don't add incremental inputs
7244         entry after members.
7245         (Incremental_inputs::report_object): Use Library_base.
7246         * incremental.h
7247         (Incremental_archive_entry::Incremental_archive_entry): Remove
7248         unused Archive parameter.
7249         (Incremental_inputs::report_archive_begin): Use Library_base.
7250         (Incremental_inputs::report_archive_end): Likewise.
7251         (Incremental_inputs::report_object): Likewise.
7252         * object.cc (Sized_relobj::do_for_all_global_symbols): New
7253         function.
7254         * object.h (Object::for_all_global_symbols): New function.
7255         (Object::do_for_all_global_symbols): New function.
7256         (Sized_relobj::do_for_all_global_symbols): New function.
7257         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
7258         function.
7259         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
7260         function.
7261
7262 2011-03-27  Ian Lance Taylor  <iant@google.com>
7263
7264         * archive.cc (Archive::interpret_header): Return -1 if something
7265         goes wrong.  Change callers accordingly.
7266
7267 2011-03-25  Cary Coutant  <ccoutant@google.com>
7268
7269         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
7270         * testsuite/Makefile.in: Regenerate.
7271
7272 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
7273
7274         * plugin.cc (get_view): New.
7275         (Plugin::load): Pass get_view to the plugin.
7276         (Plugin_manager::get_view): New.
7277
7278 2011-03-21  Ian Lance Taylor  <iant@google.com>
7279
7280         * testsuite/final_layout.sh: Rewrite to not use dc.
7281         * testsuite/relro_test.sh: Fail if dc is not present.
7282
7283 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
7284
7285         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
7286         Change == to -eq.
7287         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
7288         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
7289         Change == to -eq.
7290         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
7291         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
7292
7293 2011-03-14  Ian Lance Taylor  <iant@google.com>
7294
7295         * script-sections.cc (Sort_output_sections::script_compare):
7296         Rename from is_before, change return type.
7297         (Sort_output_sections::operator()): Adjust accordingly.
7298
7299 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
7300
7301         PR gold/12572
7302         * testsuite/odr_violation2.cc: Add comment to make all error line
7303         numbers double digits.
7304         * testsuite/debug_msg.sh: Adjust expected errors.
7305
7306 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
7307
7308         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
7309         but mark earlier ones as non-canonical
7310         (offset_to_iterator): Update search target and example
7311         (do_addr2line): Return extra lines in a vector*
7312         (format_file_lineno): Extract from do_addr2line
7313         (one_addr2line): Add vector* out-param
7314         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
7315         when a lineno entry appeared last for its instruction
7316         (Dwarf_line_info): Add vector* out-param
7317         * object.cc (Relocate_info): Pass NULL for the vector* out-param
7318         * symtab.cc (Odr_violation_compare): Include the lineno in the
7319         comparison again.
7320         (linenos_from_loc): New. Combine the canonical line for an
7321         address with its other lines.
7322         (True_if_intersect): New. Helper functor to make
7323         std::set_intersection a query.
7324         (detect_odr_violations): Compare sets of lines instead of just
7325         one line for each function. This became less deterministic, but
7326         has fewer false positives.
7327         * symtab.h: Declarations.
7328         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
7329         mix an optimized and non-optimized object in the same binary
7330         (odr_violation2.so): Same.
7331         * testsuite/Makefile.in: Regenerate from Makefile.am.
7332         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
7333         * testsuite/debug_msg.sh: Update line numbers and add
7334         assertions.
7335         * testsuite/odr_violation1.cc: Use OdrDerived, in a
7336         non-optimized context.
7337         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
7338         isn't inlined, and use OdrDerived in an optimized context.
7339         * testsuite/odr_header1.h: Defines OdrDerived, where
7340         optimization will change the
7341         first-instruction-in-the-destructor's file and line number.
7342         * testsuite/odr_header2.h: Defines OdrBase.
7343
7344 2011-03-09  Ian Lance Taylor  <iant@google.com>
7345
7346         * fileread.cc (File_read::clear_views): Don't delete the whole
7347         file view.
7348
7349 2011-03-08  Ian Lance Taylor  <iant@google.com>
7350
7351         PR gold/12525
7352         * fileread.cc: #include <climits>.
7353         (GOLD_IOV_MAX): Define.
7354         (File_read::read_multiple): Limit number of entries by iov_max.
7355         * fileread.h (class File_read): Always set max_readv_entries to
7356         128.
7357
7358 2011-03-07  Ian Lance Taylor  <iant@google.com>
7359
7360         PR gold/12525
7361         * options.h (class General_options): Add -dy and -dn.
7362
7363 2011-03-02  Cary Coutant  <ccoutant@google.com>
7364
7365         * testsuite/script_test_9.t: Add TLS segment.
7366
7367 2011-03-02  Simon Baldwin  <simonb@google.com>
7368
7369         * configure.ac: Add check for gnu_indirect_function support in
7370         the toolchain building binutils.
7371         * configure: Rebuild.
7372
7373 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
7374
7375         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
7376         plugin only symbols.
7377         (Symbol_table::sized_finalize_symbol) Mark symbol only present
7378         in plugin files as not needed in the symbol table.
7379
7380 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
7381
7382         * output.cc (Output_section::add_input_section): Delay fill
7383         generation for section ordering.
7384
7385 2011-02-09  Ian Lance Taylor  <iant@google.com>
7386
7387         PR gold/12316
7388         * object.h (class Sized_relobj): Remove clear_local_symbols.
7389         * reloc.cc (Sized_relobj::do_relocate): Don't call
7390         clear_local_symbols.
7391
7392 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
7393
7394         * plugin.cc (is_visible_from_outside): Return true for symbols
7395         in the -u option.
7396
7397 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
7398
7399         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
7400         filename.
7401
7402 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
7403
7404         * icf.h (is_section_foldable_candidate): Change type of parameter
7405         to std::string.
7406         * icf.cc (Icf::find_identical_sections): Change type of local variable
7407         section_name to be std::string.
7408         (is_function_ctor_or_dtor): Change type of parameter to std::string.
7409
7410 2011-01-25  Ian Lance Taylor  <iant@google.com>
7411
7412         * script.cc (script_add_extern): Rewrite to use
7413         add_symbol_reference.
7414
7415 2011-01-25  Doug Kwan  <dougkwan@google.com>
7416
7417         * icf.cc (get_section_contents): Always lock section's object.
7418
7419 2011-01-24  Ian Lance Taylor  <iant@google.com>
7420
7421         * options.h (class General_options): Accept
7422         --no-detect-odr-violations.
7423
7424 2011-01-24  Ian Lance Taylor  <iant@google.com>
7425
7426         * version.cc (version_string): Bump to 1.11.
7427
7428 2011-01-24  Ian Lance Taylor  <iant@google.com>
7429
7430         * plugin.cc (class Plugin_rescan): Define new class.
7431         (Plugin_manager::claim_file): Set any_claimed_.
7432         (Plugin_manager::save_archive): New function.
7433         (Plugin_manager::save_input_group): New function.
7434         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
7435         necessary.
7436         (Plugin_manager::new_undefined_symbol): New function.
7437         (Plugin_manager::rescan): New function.
7438         (Plugin_manager::rescannable_defines): New function.
7439         (Plugin_manager::add_input_file): Set any_added_.
7440         * plugin.h (class Plugin_manager): define new fields rescannable_,
7441         undefined_symbols_, any_claimed_, and any_added_.  Declare
7442         Plugin_rescan as friend.  Declare new functions.
7443         (Plugin_manager::Rescannable): Define type.
7444         (Plugin_manager::Rescannable_list): Define type.
7445         (Plugin_manager::Undefined_symbol_list): Define type.
7446         (Plugin_manager::Plugin_manager): Initialize new fields.
7447         * archive.cc (Archive::defines_symbol): New function.
7448         (Add_archive_symbols::run): Pass archive to plugins if any.
7449         * archive.h (class Archive): Declare defines_symbol.
7450         * readsyms.cc (Input_group::~Input_group): New function.
7451         (Finish_group::run): Pass input_group to plugins if any.
7452         * readsyms.h (class Input_group): Declare destructor.
7453         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
7454         any.
7455
7456 2011-01-10  Ian Lance Taylor  <iant@google.com>
7457
7458         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
7459         section as relro.
7460         (Layout::set_segment_offsets): Reset increase_relro before calling
7461         set_section_addresses a second time.
7462
7463 2011-01-04  Cary Coutant  <ccoutant@google.com>
7464
7465         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
7466         sections before NOBITS sections.
7467
7468 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
7469
7470         * version.cc (print_version): Update copyright to 2011.
7471
7472 2010-12-23  Cary Coutant  <ccoutant@google.com>
7473
7474         * output.h (Output_data_reloc::add_output_section): Pass OD instead
7475         of OS to this->add.  Add OD parameter to second form of the function.
7476
7477 2010-12-20  Ian Lance Taylor  <iant@google.com>
7478
7479         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
7480         second of two consecutive entries with same offset.
7481
7482 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7483
7484         * testsuite/Makefile.am (ifuncmain2static_LDADD)
7485         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
7486         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
7487         to avoid unneeded links against $(LDADD).
7488         * testsuite/Makefile.in: Regenerate.
7489
7490 2010-12-15  Ian Lance Taylor  <iant@google.com>
7491
7492         PR gold/12324
7493         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
7494         for R_X86_64_32 and R_X86_64_PC32.
7495         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
7496         ver_matching_def_pic.o.
7497         (ver_matching_def_pic.o): New target.
7498
7499 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7500
7501         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
7502         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
7503         Move definition before File_read::View member definitions.
7504         (File_read::View::~View): Initialize and hold lock before
7505         updating current_mapped_bytes.
7506
7507 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7508
7509         * dwarf_reader.cc: Remove outdated comment.
7510         * gold-threads.cc: Fix typo in error message.
7511         * archive.cc: Fix typos in comments.
7512         * archive.h: Likewise.
7513         * arm-reloc-property.cc: Likewise.
7514         * arm-reloc-property.h: Likewise.
7515         * arm-reloc.def: Likewise.
7516         * arm.cc: Likewise.
7517         * attributes.h: Likewise.
7518         * cref.cc: Likewise.
7519         * ehframe.cc: Likewise.
7520         * fileread.h: Likewise.
7521         * gold.h: Likewise.
7522         * i386.cc: Likewise.
7523         * icf.cc: Likewise.
7524         * incremental.h: Likewise.
7525         * int_encoding.cc: Likewise.
7526         * layout.h: Likewise.
7527         * main.cc: Likewise.
7528         * merge.h: Likewise.
7529         * object.cc: Likewise.
7530         * object.h: Likewise.
7531         * options.cc: Likewise.
7532         * readsyms.cc: Likewise.
7533         * reduced_debug_output.cc: Likewise.
7534         * reloc.cc: Likewise.
7535         * script-sections.cc: Likewise.
7536         * sparc.cc: Likewise.
7537         * symtab.h: Likewise.
7538         * target-reloc.h: Likewise.
7539         * target.cc: Likewise.
7540         * target.h: Likewise.
7541         * timer.cc: Likewise.
7542         * timer.h: Likewise.
7543         * x86_64.cc: Likewise.
7544
7545 2010-12-09  Cary Coutant  <ccoutant@google.com>
7546
7547         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
7548         stack.
7549         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
7550         parameter; change all callers.
7551         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
7552         * options.h (warn_execstack): New option.
7553
7554 2010-12-07  Doug Kwan  <dougkwan@google.com>
7555
7556         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
7557         like function call relocations.
7558
7559 2010-12-07  Ian Lance Taylor  <iant@google.com>
7560
7561         * archive.cc (Archive::get_elf_object_for_member): Permit
7562         punconfigured to be NULL.
7563         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
7564         (Archive::include_member): Pass NULL to get_elf_object_for_member
7565         if we searched for the archive and this is the first included
7566         object.
7567
7568 2010-12-01  Ian Lance Taylor  <iant@google.com>
7569
7570         * dwarf_reader.h (class Sized_dwarf_line_info): Add
7571         track_relocs_type_ field.
7572         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7573         Set track_relocs_type_.
7574         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
7575         contents when using RELA relocs.
7576         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
7577         reloc_map_.
7578         * reloc.cc (Track_relocs::next_addend): New function.
7579         * reloc.h (class Track_relocs): Declare next_addend.
7580
7581 2010-12-01  Ian Lance Taylor  <iant@google.com>
7582
7583         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
7584         virtual destructor.
7585
7586 2010-12-01  Ian Lance Taylor  <iant@google.com>
7587
7588         * README: Update compilers known to work and fail.
7589
7590 2010-11-23  Matthias Klose  <doko@ubuntu.com>
7591
7592         * configure.in: For --enable-gold, handle value `default' instead of
7593         `both*'.  Always install ld as ld.bfd, install as ld if gold is
7594         not the default.
7595         * configure: Regenerate.
7596
7597 2010-11-18  Doug Kwan  <dougkwan@google.com>
7598
7599         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
7600         and right_alignment to be zero.  Store result alignment only if it is
7601         greater than existing alignment.
7602
7603 2010-11-16  Cary Coutant  <ccoutant@google.com>
7604
7605         PR gold/12220
7606         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7607         Check for ".zdebug_line".
7608
7609 2010-11-16  Doug Kwan  <dougkwan@google.com>
7610             Cary Coutant  <ccoutant@google.com>
7611
7612         * output.h (Output_segment::set_section_addresses): Pass increase_relro
7613         by reference; adjust all callers.
7614         * output.cc (Output_segment::set_section_addresses): Adjust references
7615         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
7616         list is empty.
7617         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
7618         end at page boundary.
7619
7620 2010-11-16  Cary Coutant  <ccoutant@google.com>
7621
7622         PR gold/12220
7623         * layout.cc (Layout::choose_output_section): Transform names of
7624         compressed sections even when using a script with a SECTIONS clause.
7625         (Layout::output_section_name): Remove code to transform
7626         compressed debug section names.
7627         * output.cc (Output_section::add_input_section): Use uncompressed
7628         section size when tracking input sections.
7629
7630 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
7631
7632         * symtab.h (Symbol::NON_PIC_REF): Remove.
7633         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
7634         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
7635         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
7636         (Symbol::use_plt_offset): Take a flags argument and pass it
7637         directly to needs_dynamic_reloc.  Restrict check for undefined
7638         weak symbols to function calls.
7639         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
7640         (Target_arm::Scan::global): Use it.
7641         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
7642         (Target_arm::Relocate::relocate): Likewise.
7643         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
7644         parameter with an r_type parameter.  Use get_reference_flags
7645         to get the flags.
7646         (Target_arm::Relocate::relocate): Update accordingly.
7647         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
7648         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
7649         (Target_i386::Scan::global): Likewise.
7650         (Target_i386::Relocate::relocate): Likewise.
7651         (Target_i386::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_i386::Relocate::relocate): Update accordingly.
7655         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
7656         (Target_powerpc::Scan::global): Use it.
7657         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
7658         (Target_powerpc::Relocate::relocate): Likewise.
7659         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
7660         (Target_sparc::Scan::global): Use it.
7661         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
7662         (Target_sparc::Relocate::relocate): Likewise.
7663         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
7664         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
7665         (Target_x86_64::Scan::global): Likewise.
7666         (Target_x86_64::Relocate::relocate): Likewise.
7667
7668 2010-11-08  Doug Kwan  <dougkwan@google.com>
7669             Cary Coutant  <ccoutant@google.com>
7670
7671         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
7672         (Arm_exidx_merge_section::section_contents_): New data member.
7673         (Arm_input_section::Arm_input_section): Initialize original_contents_.
7674         (Arm_input_section::~Arm_input_section): De-allocate memory.
7675         (Arm_input_section::original_contents_): New data member.
7676         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
7677         in parameters instead of calling Object::section_contents without
7678         locking.
7679         (Arm_output_section::group_section): New parameter TASK.  Pass it
7680         to callees that need locking objects.
7681         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
7682         to lock EXIDX input sections.  Fix a formatting issue.  Call
7683         Arm_exidx_merged_section::build_contents to create merged section
7684         contents.
7685         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
7686         to lock object of stub table owner.
7687         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
7688         TEXT_SIZE to initialize data member TEXT_SIZE_.
7689         (Arm_exidx_input_section::addralign): Fix typo in comment.
7690         (Arm_exidx_input_section::text_size): New method.
7691         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
7692         that require locking objects.  Lock objects before scanning for stubs
7693         and updating local symbols.
7694         (Arm_input_section<big_endian>::init): Copy contents of original
7695         input section.
7696         (Arm_input_section<big_endian>::do_write): Use saved contents of
7697         original input section instead of calling Object::section_contents
7698         without locking.
7699         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
7700         size without calling Object::section_size().
7701         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
7702         for size.  Allocate a buffer for merged EXIDX entries.
7703         (Arm_exidx_merged_section::build_contents): New method.
7704         (Arm_exidx_merged_section::do_write): Move merge section contents
7705         building code to Arm_exidx_merged_section::build_contetns.  Write
7706         out contetns in buffer instead of building it on the fly.
7707         (Arm_relobj::make_exidx_input_section): Also pass text section size
7708         to Arm_exidx_input_section constructor.
7709         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
7710         (Arm_dynobj::do_read_symbols): Fix memory leak.
7711         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
7712         * target.h: (class Task): Add forward declaration.
7713         (Target::relax): Add new parameter TASK and pass it to
7714         Target::do_relax().
7715         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
7716
7717 2010-11-05  Cary Coutant  <ccoutant@google.com>
7718
7719         PR gold/10708
7720         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
7721         object when reading from the file.
7722         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
7723         second layout pass.
7724         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
7725         when reading section contents.
7726         (get_section_contents): Likewise.
7727         (icf::find_identical_sections): Likewise.
7728         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
7729         object when reading from the file.
7730         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
7731         the object when doing deferred section layout.
7732
7733 2010-11-03  Nick Clifton  <nickc@redhat.com>
7734
7735         PR gold/12001
7736         * script.h (class Symbol_assignment: name): New member.  Returns
7737         the name of the symbol.
7738         * scrfipt.cc (Script_options::is_pending_assignment): New member.
7739         Returns true if the given symbol name is on the list of
7740         assignments wating to be processed.
7741         * archive.cc (should_incldue_member): If the symbol is undefined,
7742         check to see if it is on the list of symbols pending assignment.
7743
7744 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
7745
7746         * script-sections.cc (Script_sections::find_memory_region): Check
7747         for a NULL output section pointer.
7748
7749 2010-10-29  Doug Kwan  <dougkwan@google.com>
7750
7751         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
7752         Output_section::add_relaxed_input_section.
7753         * output.cc (Output_section::add_relaxed_input_section): Add new
7754         arguments LAYOUT and NAME.  Set section order index.
7755         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7756         Copy section order index.
7757         * output.h (Output_section::add_relaxed_input_section): Add new
7758         arguments LAYOUT and NAME.
7759
7760 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7761
7762         * testsuite/Makefile.am: Move gcctestdir/ld rule to
7763         NATIVE_OR_CROSS_LINKER.
7764         * testsuite/Makefile.in: Regenerate.
7765
7766 2010-10-20  Doug Kwan  <dougkwan@google.com>
7767
7768         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
7769         without SHF_LINK_ORDER flags.
7770         * layout.cc (Layout::choose_output_section): Do not filter
7771         SHF_LINK_ORDER flag in a relocatable link.
7772
7773 2010-10-17  Cary Coutant  <ccoutant@google.com>
7774
7775         * output.h (Output_segment::set_section_addresses): Change function
7776         signature.  Update all callers.
7777         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
7778         sections.
7779         (Output_segment::set_section_addresses): Align after last TLS
7780         section.  Add padding before last relro section instead of after.
7781
7782 2010-10-17  Doug Kwan  <dougkwan@google.com>
7783
7784         * gold/arm.cc (Target_arm::got_section): Use correct order and set
7785         GOT output section to be writable.
7786
7787 2010-10-14  Cary Coutant  <ccoutant@google.com>
7788
7789         * debug.h (DEBUG_INCREMENTAL): New flag.
7790         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
7791         * gold.cc (queue_initial_tasks): Check parameters for incremental link
7792         mode.
7793         * incremental.cc (report_command_line): Ignore all forms of
7794         --incremental.
7795         * layout.cc (Layout::Layout): Check parameters for incremental link
7796         mode.
7797         * options.cc (General_options::parse_incremental): New function.
7798         (General_options::parse_no_incremental): New function.
7799         (General_options::parse_incremental_full): New function.
7800         (General_options::parse_incremental_update): New function.
7801         (General_options::incremental_mode_): New data member.
7802         (General_options::finalize): Check incremental_mode_.
7803         * options.h (General_options): Update help text for --incremental.
7804         Add --no-incremental, --incremental-full, --incremental-update.
7805         (General_options::Incremental_mode): New enum type.
7806         (General_options::incremental_mode): New function.
7807         (General_options::incremental_mode_): New data member.
7808         * parameters.cc (Parameters::incremental_mode_): New data member.
7809         (Parameters::set_options): Set incremental_mode_.
7810         (Parameters::set_incremental_full): New function.
7811         (Parameters::incremental): New function.
7812         (Parameters::incremental_update): New function.
7813         (set_parameters_incremental_full): New function.
7814         * parameters.h (Parameters::set_incremental_full): New function.
7815         (Parameters::incremental): New function.
7816         (Parameters::incremental_update): New function.
7817         (Parameters::incremental_mode_): New data member.
7818         (set_parameters_incremental_full): New function.
7819         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
7820         incremental link mode.
7821         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
7822         (Sized_relobj::do_relocate_sections): Likewise.
7823         * testsuite/Makefile.am (incremental_test): Use --incremental-full
7824         option.
7825         * testsuite/Makefile.in: Regenerate.
7826         * testsuite/incremental_test.sh: Filter all forms of --incremental.
7827
7828 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7829
7830         * script-sections.h (class Script_sections): Make
7831         Sections_elements typedef public.
7832         * script-sections.cc (class Sort_output_sections): Add elements_
7833         field.  Add constructor which sets it; change all callers.
7834         (Sort_output_sections::is_before): New function.
7835         (Sort_output_sections::operator()): Call is_before.
7836         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
7837         conditional.
7838         * testsuite/script_test_10.sh: New test. Test script section
7839         order.
7840         * testsuite/script_test_10.t: Likewise.
7841         * testsuite/script_test_10.s: Likewise.
7842         * testsuite/Makefile.am: Wrap the cross linker tests and the
7843         common tests into NATIVE_OR_CROSS_LINKER.
7844         (check_SCRIPTS): Add script_test_10.sh.
7845         (check_DATA): Add script_test_10.stdout.
7846         (script_test_10.o, script_test_10): New targets.
7847         (script_test_10.stdout): New target.
7848         * configure, testsuite/Makefile.in: Regenerate.
7849
7850 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7851
7852         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
7853         error for the deprecated relocations.
7854         (Target_arm::Scan::global): Likewise.
7855         (Target_arm::Relocate::relocate): Likewise.
7856
7857 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
7858
7859         * fileread.cc (Input_file::find_file): Initialize *found_name
7860         and *namep when using the fallback search for case 4.
7861
7862 2010-10-11  Cary Coutant  <ccoutant@google.com>
7863
7864         * options.h (class General_options): Redefine -z lazy as an alias for
7865         the negation of -z now.
7866
7867 2010-10-11  Ian Lance Taylor  <iant@google.com>
7868
7869         * resolve.cc (symbol_to_bits): Report the value of the unsupported
7870         binding.
7871
7872 2010-10-06  Nick Clifton  <nickc@redhat.com>
7873
7874         * script-sections.cc(class Memory_region): Remove
7875         current_lma_offset_ field.  Rename current_vma_offset_ to
7876         current_offset_.  Add last_section_ field.
7877         (Memory_region::get_current_vma_address): Rename to
7878         get_current_address.
7879         (Memory_region::get_current_lma_address): Delete.
7880         (Memory_region::increment_vma_offset): Rename to
7881         increment_offset.
7882         (Memory_region::increment_lma_offset): Delete.
7883         (Memory_region::attributes_compatible): New method.  Returns
7884         true if the provided section is compatible with the region.
7885         (Memory_region::get_last_section): New method.  Returns the last
7886         section to use the region.
7887         (Memory_region::set_last_section): New method.  Stores the last
7888         section to use the region.
7889         (Script_sections::block_in_region): New method.  Returns true if
7890         a block of memory is contained within a region.
7891         (Script_sections::find_memory_region): New method.  Locates a
7892         memory region to be used to set a VMA or LMA address.
7893         (Output_section_definition::set_section_addresses): Add code to
7894         check for addresses set by memory regions.
7895         (Output_segment::set_section_addresses): Remove memory region
7896         walking code.
7897         (Script_sections::create_segment): Add a warning if a header
7898         segment is created outside of any region.
7899         * script-sections.h (class Script_sections): Add prototypes for
7900         find_memory_region and block_in_region methods.
7901         * testsuite/memory_test.s: Use .long instead of .word.
7902         * testsuite/memory_test.t: Add some more output sections.
7903         * testsuite/memory_test.sh: Update expected output.
7904
7905 2010-10-02  Doug Kwan  <dougkwan@google.com>
7906
7907         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
7908         defintion to symtab.h
7909         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
7910         declaration to defintion.
7911
7912 2010-10-01  Nick Clifton  <nickc@redhat.com>
7913
7914         * expression.cc (eval): Replace dummy argument with NULL.
7915         (eval_maybe_dot): Check for a NULL result section pointer.
7916         (Symbol_expression::value): Likewise.
7917         (Dot_expression::value): Likewise.
7918         (BINARY_EXPRESSION): Likewise.
7919         (Max_expression::value): Likewise.
7920         (Min_expression::value): Likewise.
7921         (Absolute_expression::value): Likewise.
7922         (Addr_expression::value_from_output_section): Likewise.
7923         (Loaddddr_expression::value_from_output_section): Likewise.
7924         (Segment_start_expression::value): Likewise.
7925         * script-sections.cc
7926         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
7927         argument with NULL.
7928         (Sections_elememt_dot_assignment::set_section_addresses):
7929         Likewise.
7930         (Output_data_expression::do_write_to_buffer): Likewise.
7931         (Output_section_definition::finalize_symbols): Likewise.
7932         (Output_section_definition::set_section_addresses): Likewise.
7933
7934 2010-09-30  Doug Kwan  <dougkwan@google.com>
7935
7936         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
7937
7938 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
7939
7940         * target.h (Target::can_icf_inline_merge_sections): New virtual
7941         function.
7942         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7943         virtual function.
7944         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
7945         virtual function.
7946         * icf.cc (get_section_contents): Inline merge sections only when
7947         target allows it.
7948
7949 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7950
7951         * configure: Regenerate.
7952
7953 2010-09-17  Ian Lance Taylor  <iant@google.com>
7954
7955         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7956         * testsuite/Makefile.am (memory_test.o): New target.
7957         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7958         memory_test.t.
7959         * testsuite/Makefile.in: Rebuild.
7960
7961 2010-09-17  Doug Kwan  <dougkwan@google.com>
7962
7963         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7964         defintion if relocation uses GOT entries of the symbol.
7965         * testsuite/icf_safe_test.sh: Fix test.
7966         * testsuite/icf_safe_so_test.sh: Fix test.
7967
7968 2010-09-16  Cary Coutant  <ccoutant@google.com>
7969
7970         * script_sections.cc (class Memory_region): Remove "NULL" from
7971         vector initializations.
7972
7973 2010-09-15  Cary Coutant  <ccoutant@google.com>
7974
7975         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7976         Resolve forwarding symbols.
7977
7978 2010-09-15  Doug Kwan  <dougkwan@google.com>
7979
7980         * gold/testsuite/script_test_3.t: Add ARM special sections.
7981         * gold/testsuite/script_test_4.t: Same.
7982         * gold/testsuite/script_test_5.t: Same.
7983         * gold/testsuite/script_test_6.t: Same.
7984         * gold/testsuite/script_test_7.t: Same.
7985         * gold/testsuite/script_test_7.t: Same.
7986         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7987
7988 2010-09-14  Cary Coutant  <ccoutant@google.com>
7989
7990         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7991         (Target_x86_64::Relocate::relocate_tls): Replace check for
7992         saw_tls_block_reloc_ with test for executable section.
7993
7994 2010-09-12  Cary Coutant  <ccoutant@google.com>
7995
7996         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7997         position-independent executables to shared libraries need dynamic
7998         relocations.
7999         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
8000         position-independent executables.
8001         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
8002         * testsuite/Makefile.in: Regenerate.
8003
8004 2010-09-10  Nick Clifton  <nickc@redhat.com>
8005
8006         PR gold/11997
8007         * testsuite/memory_test.t: Discard any sections that are not
8008         needed.
8009
8010 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
8011
8012         PR gold/11996
8013         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
8014         "This::" to work around a bug in gcc 4.2.
8015
8016         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
8017
8018 2010-09-09  Rafael Espindola  <espindola@google.com>
8019
8020         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
8021         sections with different PF_X flags in the same segment.
8022         (Layout::find_first_load_seg): Search all segments to find the first
8023         one.
8024         * options.h (rosegment): New.
8025
8026 2010-09-08  Rafael Espindola  <espindola@google.com>
8027
8028         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
8029
8030 2010-09-08  Doug Kwan  <dougkwan@google.com>
8031
8032         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
8033         (Arm_relobj::do_relocate_sections): Add new parameter for output
8034         file to match the parent.
8035         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
8036         of local symbols instead of input values.  Update code to track
8037         changes in gold::relocate_section.
8038         * object.cc (Sized_relobj::compute_final_local_value): New methods.
8039         (Sized_relobj::compute_final_local_value_internal): New methods.
8040         (Sized_relobj::do_finalize_local_symbols): Move code from loop
8041         body into private version of Sized_relobj::compute_final_local_value.
8042         Call the inline method.
8043         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
8044         merged symbol value if there is one.
8045         (Symbol_value::has_output_value): New method defintiion.
8046         (Sized_relobj::Compute_final_local_value_status): New enum type.
8047         (Sized_relobj::compute_final_local_value): New methods.
8048         (Sized_relobj::compute_final_local_value_internal): New methods.
8049         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
8050         and arm_cortex_a8.sh.
8051         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
8052         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
8053         New tests.
8054         * Makefile.in: Regenerate.
8055         * testsuite/arm_bl_out_of_range.s: Update test.
8056         * testsuite/thumb_bl_out_of_range.s: Ditto.
8057         * testsuite/thumb_blx_out_of_range.s: Ditto.
8058         * testsuite/arm_branch_out_of_range.sh: New file.
8059         * testsuite/arm_cortex_a8.sh: Ditto.
8060         * testsuite/arm_cortex_a8_b.s: Ditto.
8061         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
8062         * testsuite/arm_cortex_a8_b_local.s: Ditto.
8063         * testsuite/arm_cortex_a8_bl.s: Ditto.
8064         * testsuite/arm_cortex_a8_blx.s: Ditto.
8065         * testsuite/arm_cortex_a8_local.s: Ditto.
8066         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
8067         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
8068
8069 2010-09-08  Rafael Espindola  <espindola@google.com>
8070
8071         * Makefile.am (memory_test.stdout): Run readelf with -W.
8072         * Makefile.in: Regenerate.
8073         * testsuite/memory_test.sh: Make the regexps accept both 32 and
8074         64 bit output.
8075
8076 2010-09-08  Rafael Espindola  <espindola@google.com>
8077
8078         * script-sections.cc (Script_sections::add_memory_region): Convert
8079         field precision to int.
8080         * script.cc (script_set_section_region, script_set_section_region):
8081         Convert field precision to int.
8082
8083 2010-09-08  Rafael Espindola  <espindola@google.com>
8084
8085         * arm.cc (do_finalize_sections): Create the __exidx_start and
8086         __exdix_end symbols even when the section is missing.
8087
8088 2010-09-08  Nick Clifton  <nickc@redhat.com>
8089
8090         * README: Remove claim that MEMORY is not supported.
8091         * expression.cc (script_exp_function_origin)
8092         (script_exp_function_length): Move from here to ...
8093         * script.cc: ... here.
8094         (script_set_section_region, script_add_memory)
8095         (script_parse_memory_attr, script_include_directive): New
8096         functions.
8097         * script-sections.cc
8098         (class Memory_region): New class.
8099         (class Output_section_definition): Add set_memory_region,
8100         set_section_vma, set_section_lma and get_section_name methods.
8101         (class Script_Sections): Add add_memory_region,
8102         find_memory_region, find_memory_region_origin,
8103         find_memory_region_length and set_memory_region methods.
8104         Have set_section_addresses method walk the list of set memory
8105         regions.
8106         Extend the print methos to display memory regions.
8107         * script-sections.h: Add prototypes for new methods.
8108         Add enum for MEMORY region attributes.
8109         * yyscript.y: Add support for parsing MEMORY regions.
8110         * script-c.h: Add prototypes for new functions.
8111         * testsuite/Makefile.am: Add test of MEMORY region functionality.
8112         * testsuite/Makefile.in: Regenerate.
8113         * testsuite/memory_test.sh: New script.
8114         * testsuite/memory_test.s: New assembler source file.
8115         * testsuite/memory_test.t: New linker script.
8116
8117 2010-08-27  Doug Kwan  <dougkwan@google.com>
8118
8119         * gold/resolve.cc (Symbol_table::should_override): Let a weak
8120         reference override an existing dynamic weak reference.
8121         * testsuite/Makefile.am: Add new test dyn_weak_ref.
8122         * testsuite/Makefile.in: Regenerate.
8123         * testsuite/dyn_weak_ref.sh: New file.
8124         * testsuite/dyn_weak_ref_1.c: Ditto.
8125         * testsuite/dyn_weak_ref_2.c: Ditto.
8126
8127 2010-08-27  Ian Lance Taylor  <iant@google.com>
8128
8129         * incremental.h (class Incremental_input_entry): Add virtual
8130         destructor.
8131
8132 2010-08-27  Ian Lance Taylor  <iant@google.com>
8133
8134         * testsuite/start_lib_test_3.c: Mark t3 as used.
8135
8136 2010-08-27  Nick Clifton  <nickc@redhat.com>
8137
8138         * options.cc (version_script): Fix small typo in previous
8139         whitespace tidyup.
8140
8141 2010-08-25  Nick Clifton  <nickc@redhat.com>
8142
8143         * archive.cc: Formatting fixes: Remove whitespace between
8144         typename and following asterisk.  Remove whitespace between
8145         function name and opening parenthesis.
8146         * archive.h: Likewise.
8147         * arm.cc: Likewise.
8148         * attributes.cc: Likewise.
8149         * attributes.h: Likewise.
8150         * common.cc: Likewise.
8151         * copy-relocs.cc: Likewise.
8152         * dirsearch.h: Likewise.
8153         * dynobj.cc: Likewise.
8154         * ehframe.cc: Likewise.
8155         * ehframe.h: Likewise.
8156         * expression.cc: Likewise.
8157         * fileread.cc: Likewise.
8158         * fileread.h: Likewise.
8159         * gc.h: Likewise.
8160         * gold-threads.cc: Likewise.
8161         * gold.cc: Likewise.
8162         * i386.cc: Likewise.
8163         * icf.h: Likewise.
8164         * incremental-dump.cc: Likewise.
8165         * incremental.cc: Likewise.
8166         * layout.cc: Likewise.
8167         * layout.h: Likewise.
8168         * main.cc: Likewise.
8169         * merge.cc: Likewise.
8170         * merge.h: Likewise.
8171         * object.cc: Likewise.
8172         * object.h: Likewise.
8173         * options.cc: Likewise.
8174         * options.h: Likewise.
8175         * output.cc: Likewise.
8176         * output.h: Likewise.
8177         * plugin.cc: Likewise.
8178         * plugin.h: Likewise.
8179         * powerpc.cc: Likewise.
8180         * reloc.cc: Likewise.
8181         * script-c.h: Likewise.
8182         * script-sections.cc: Likewise.
8183         * script.cc: Likewise.
8184         * stringpool.cc: Likewise.
8185         * symtab.cc: Likewise.
8186         * symtab.h: Likewise.
8187         * target.cc: Likewise.
8188         * timer.cc: Likewise.
8189         * timer.h: Likewise.
8190         * version.cc: Likewise.
8191         * x86_64.cc: Likewise.
8192
8193 2010-08-24  Nick Clifton  <nickc@redhat.com>
8194
8195         PR 11899
8196         * layout.cc (segment_precedes): Sort segments by their physical
8197         addresses, if they have been set.
8198
8199 2010-08-23  Cary Coutant  <ccoutant@google.com>
8200
8201         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
8202         symbols data.
8203         (Lib_group::include_member): Unlock object after deleting its
8204         symbols data.
8205         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
8206         the bug fixed here.
8207
8208 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
8209             Cary Coutant  <ccoutant@google.com>
8210
8211         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
8212         constructor, and set_blocker.
8213         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
8214         readsyms_blocker_.
8215         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
8216         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
8217         * testsuite/Makefile.am (start_lib_test): New test case.
8218         * testsuite/Makefile.in: Regenerate.
8219         * testsuite/start_lib_test_main.c: New file.
8220         * testsuite/start_lib_test_1.c: New file.
8221         * testsuite/start_lib_test_2.c: New file.
8222         * testsuite/start_lib_test_3.c: New file.
8223
8224 2010-08-19  Ian Lance Taylor  <iant@google.com>
8225
8226         * Makefile.in: Rebuild with automake 1.11.1.
8227         * aclocal.m4: Likewise.
8228         * testsuite/Makefile.in: Likewise.
8229
8230 2010-08-19  Ian Lance Taylor  <iant@google.com>
8231
8232         PR 10893
8233         * i386.cc (class Output_data_plt_i386): Update declarations.
8234         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
8235         local_ifuncs_ fields.
8236         (Target_i386::do_plt_section_for_global): New function.
8237         (Target_i386::do_plt_section_for_local): New function.
8238         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
8239         parameter; change all callers.  Initialize global_ifuncs_ and
8240         local_ifuncs_.  If doing a static link define __rel_iplt_start and
8241         __rel_iplt_end.
8242         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
8243         (Output_data_plt_i386::add_local_ifunc_entry): New function.
8244         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
8245         symbols.
8246         (Target_i386::make_plt_section): New function, broken out of
8247         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
8248         (Target_i386::make_plt_entry): Call make_plt_section.
8249         (Target_i386::make_local_ifunc_plt_entry): New function.
8250         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
8251         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
8252         R_386_IRELATIVE to switch.
8253         (Target_i386::Scan::global): Likewise.
8254         (Target_i386::Relocate::relocate): Likewise.
8255         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
8256         switch.
8257         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
8258         (Target_x86_64::do_plt_section_for_global): New function.
8259         (Target_x86_64::do_plt_section_for_local): New function.
8260         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
8261         parameter; change all callers.  If doing a static link define
8262         __rela_iplt_start and __rela_iplt_end.
8263         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
8264         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
8265         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
8266         to point to .plt.
8267         (Target_x86_64::make_local_ifunc_plt_entry): New function.
8268         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
8269         switch.
8270         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
8271         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
8272         R_X86_64_IRELATIVE to switch.
8273         (Target_x86_64::Scan::global): Likewise.
8274         (Target_x86_64::Relocate::relocate): Likewise.
8275         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
8276         switch.
8277         * target.h (class Target): Add plt_section_for_global and
8278         plt_section_for_local functions.  Add do_plt_section_for_global
8279         and do_plt_section_for_local virtual functions.
8280         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
8281         clarifying comments.
8282         (Symbol::use_plt_offset): Handle IFUNC symbol.
8283         * object.cc (Sized_relobj::Sized_relobj): Initialize
8284         local_plt_offsets_.
8285         (Sized_relobj::local_has_plt_offset): New function.
8286         (Sized_relobj::local_plt_offset): New function.
8287         (Sized_relobj::set_local_plt_offset): New function.
8288         (Sized_relobj::do_count): Handle IFUNC symbol.
8289         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
8290         a bit away from input_shndx_ field.  Add set_is_func_symbol and
8291         is_ifunc_symbol functions.
8292         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
8293         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
8294         local_plt_offsets_ field.
8295         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
8296         * output.h (class Output_section_data): Add non-const
8297         output_section function.
8298         (class Output_data_got): Update declarations.
8299         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
8300         Add use_plt_offset parameter to global and local constructors.
8301         Change all callers.  Change local_sym_index_ field to 31 bits.
8302         Change GSYM_CODE and CONSTANT_CODE accordingly.
8303         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
8304         doing a static link don't set sh_link field.
8305         (Output_data_got::Got_entry::write): Use PLT offset if
8306         appropriate.
8307         (Output_data_got::add_global_plt): New function.
8308         (Output_data_got::add_local_plt): New function.
8309         * target-reloc.h (relocate_section): Handle IFUNC symbol.
8310         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
8311         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
8312         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
8313         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
8314         IFUNC conditional.
8315         * testsuite/ifunc-sel.h: New file.
8316         * testsuite/ifuncmain1.c: New file.
8317         * testsuite/ifuncmain1vis.c: New file.
8318         * testsuite/ifuncmod1.c: New file.
8319         * testsuite/ifuncdep2.c: New file.
8320         * testsuite/ifuncmain2.c: New file.
8321         * testsuite/ifuncmain3.c: New file.
8322         * testsuite/ifuncmod3.c: New file.
8323         * testsuite/ifuncmain4.c: New file.
8324         * testsuite/ifuncmain5.c: New file.
8325         * testsuite/ifuncmod5.c: New file.
8326         * testsuite/ifuncmain6pie.c: New file.
8327         * testsuite/ifuncmod6.c: New file.
8328         * testsuite/ifuncmain7.c: New file.
8329         * configure, testsuite/Makefile.in: Rebuild.
8330
8331 2010-08-18  Ian Lance Taylor  <iant@google.com>
8332
8333         * incremental.cc
8334         (Output_section_incremental_inputs::write_input_files): Add cast
8335         to avoid signed/unsigned comparison warning.
8336         (Output_section_incremental_inputs::write_info_blocks): Likewise.
8337
8338 2010-08-12  Cary Coutant  <ccoutant@google.com>
8339
8340         * common.cc (Sort_commons::operator()): Remove unnecessary code.
8341
8342 2010-08-13  Ian Lance Taylor  <iant@google.com>
8343
8344         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
8345
8346 2010-08-12  Cary Coutant  <ccoutant@google.com>
8347             Doug Kwan  <dougkwan@google.com>
8348
8349         * resolve.cc (Symbol_table::should_override): When a weak dynamic
8350         defintion overrides non-weak undef, remember that the original undef
8351         is not weak.
8352         * symtab.cc (Symbol_table::sized_write_global): For undef without
8353         an original weak binding, set binding to global in output.
8354         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
8355         * testsuite/Makefile.in: Regenerate.
8356         * testsuite/strong_ref_weak_def.sh: New file.
8357         * testsuite/strong_ref_weak_def_1.c: Ditto.
8358         * testsuite/strong_ref_weak_def_2.c: Ditto.
8359
8360 2010-08-12  Cary Coutant  <ccoutant@google.com>
8361
8362         * testsuite/incremental_test.sh: Rewrite.
8363         * testsuite/incremental_test_1.c: Rewrite.
8364         * testsuite/incremental_test_2.c: Rewrite.
8365
8366 2010-08-12  Cary Coutant  <ccoutant@google.com>
8367
8368         * arm.cc (Target_arm::got_size): Add const.
8369         (Target_arm::got_entry_count): New function.
8370         (Target_arm::plt_entry_count): New function.
8371         (Target_arm::first_plt_entry_offset): New function.
8372         (Target_arm::plt_entry_size): New function.
8373         (Output_data_plt_arm::entry_count): New function.
8374         (Output_data_plt_arm::first_plt_entry_offset): New function.
8375         (Output_data_plt_arm::get_plt_entry_size): New function.
8376         * i386.cc (Target_i386::got_size): Add const.
8377         (Target_i386::got_entry_count): New function.
8378         (Target_i386::plt_entry_count): New function.
8379         (Target_i386::first_plt_entry_offset): New function.
8380         (Target_i386::plt_entry_size): New function.
8381         (Output_data_plt_i386::entry_count): New function.
8382         (Output_data_plt_i386::first_plt_entry_offset): New function.
8383         (Output_data_plt_i386::get_plt_entry_size): New function.
8384         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
8385         find_incremental_inputs_sections.  Dump incremental_got_plt section.
8386         * incremental.cc: Include target.h.
8387         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
8388         parameter.  Adjust all callers.  Find incremental_got_plt section.
8389         (Incremental_inputs::create_data_sections): Create incremental_got_plt
8390         section.
8391         (Output_section_incremental_inputs::set_final_data_size): Calculate
8392         size of incremental_got_plt section.
8393         (Output_section_incremental_inputs::do_write): Write the
8394         incremental_got_plt section.
8395         (Got_plt_view_info): New struct.
8396         (Local_got_offset_visitor): New class.
8397         (Global_got_offset_visitor): New class.
8398         (Global_symbol_visitor_got_plt): New class.
8399         (Output_section_incremental_inputs::write_got_plt): New function.
8400         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
8401         Add parameter.  Adjust all callers.
8402         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8403         (Incremental_inputs::got_plt_section): New function.
8404         (Incremental_inputs::got_plt_section_): New data member.
8405         (Incremental_got_plt_reader): New class.
8406         * layout.cc (Layout::create_incremental_info_sections): Add the
8407         incremental_got_plt section.
8408         * object.h (Got_offset_list::get_list): New function.
8409         (Got offset_list::for_all_got_offsets): New function.
8410         (Sized_relobj::local_got_offset_list): New function.
8411         * powerpc.cc (Target_powerpc::got_size): Add const.
8412         (Target_powerpc::got_entry_count): New function.
8413         (Target_powerpc::plt_entry_count): New function.
8414         (Target_powerpc::first_plt_entry_offset): New function.
8415         (Target_powerpc::plt_entry_size): New function.
8416         (Output_data_plt_powerpc::entry_count): New function.
8417         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
8418         (Output_data_plt_powerpc::get_plt_entry_size): New function.
8419         * sparc.cc (Target_sparc::got_size): Add const.
8420         (Target_sparc::got_entry_count): New function.
8421         (Target_sparc::plt_entry_count): New function.
8422         (Target_sparc::first_plt_entry_offset): New function.
8423         (Target_sparc::plt_entry_size): New function.
8424         (Output_data_plt_sparc::entry_count): New function.
8425         (Output_data_plt_sparc::first_plt_entry_offset): New function.
8426         (Output_data_plt_sparc::get_plt_entry_size): New function.
8427         * symtab.h (Symbol::got_offset_list): New function.
8428         (Symbol_table::for_all_symbols): New function.
8429         * target.h (Sized_target::got_entry_count): New function.
8430         (Sized_target::plt_entry_count): New function.
8431         (Sized_target::plt_entry_size): New function.
8432         * x86_64.cc (Target_x86_64::got_size): Add const.
8433         (Target_x86_64::got_entry_count): New function.
8434         (Target_x86_64::plt_entry_count): New function.
8435         (Target_x86_64::first_plt_entry_offset): New function.
8436         (Target_x86_64::plt_entry_size): New function.
8437         (Output_data_plt_x86_64::entry_count): New function.
8438         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
8439         (Output_data_plt_x86_64::get_plt_entry_size): New function.
8440
8441 2010-08-12  Cary Coutant  <ccoutant@google.com>
8442
8443         * archive.cc: Include incremental.h.
8444         (Archive::Archive): Initialize incremental_info_.
8445         (Archive::include_member): Record archive members in incremental info.
8446         (Add_archive_symbols::run): Record begin and end of an archive in
8447         incremental info.
8448         (Lib_group::include_member): Record objects in incremental info.
8449         * archive.h (Incremental_archive_entry): Forward declaration.
8450         (Archive::set_incremental_info): New member function.
8451         (Archive::incremental_info): New member function.
8452         (Archive::Unused_symbol_iterator): New class.
8453         (Archive::unused_symbols_begin): New member function.
8454         (Archive::unused_symbols_end): New member function.
8455         (Archive::incremental_info_): New data member.
8456         * incremental-dump.cc (find_input_containing_global): New function.
8457         (dump_incremental_inputs): Dump new incremental info sections.
8458         * incremental.cc: Include symtab.h.
8459         (Output_section_incremental_inputs): New class.
8460         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
8461         new incremental info sections.
8462         (Sized_incremental_binary::do_check_inputs): Likewise.
8463         (Incremental_inputs::report_archive): Remove.
8464         (Incremental_inputs::report_archive_begin): New function.
8465         (Incremental_inputs::report_archive_end): New function.
8466         (Incremental_inputs::report_object): New function.
8467         (Incremental_inputs::finalize_inputs): Remove.
8468         (Incremental_inputs::report_input_section): New function.
8469         (Incremental_inputs::report_script): Rewrite.
8470         (Incremental_inputs::finalize): Do nothing but finalize string table.
8471         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8472         (Incremental_inputs::sized_create_inputs_section_data): Remove.
8473         (Incremental_inputs::create_data_sections): New function.
8474         (Incremental_inputs::relocs_entsize): New function.
8475         (Output_section_incremental_inputs::set_final_data_size): New function.
8476         (Output_section_incremental_inputs::do_write): New function.
8477         (Output_section_incremental_inputs::write_header): New function.
8478         (Output_section_incremental_inputs::write_input_files): New function.
8479         (Output_section_incremental_inputs::write_info_blocks): New function.
8480         (Output_section_incremental_inputs::write_symtab): New function.
8481         * incremental.h (Incremental_script_entry): Forward declaration.
8482         (Incremental_object_entry): Forward declaration.
8483         (Incremental_archive_entry): Forward declaration.
8484         (Incremental_inputs): Forward declaration.
8485         (Incremental_inputs_header_data): Remove.
8486         (Incremental_inputs_header): Remove.
8487         (Incremental_inputs_header_write): Remove.
8488         (Incremental_inputs_entry_data): Remove.
8489         (Incremental_inputs_entry): Remove.
8490         (Incremental_inputs_entry_write): Remove.
8491         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
8492         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
8493         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8494         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
8495         Likewise.
8496         (Incremental_input_entry): New class.
8497         (Incremental_script_entry): New class.
8498         (Incremental_object_entry): New class.
8499         (Incremental_archive_entry): New class.
8500         (Incremental_inputs::Incremental_inputs): Initialize new data members.
8501         (Incremental_inputs::report_inputs): Remove.
8502         (Incremental_inputs::report_archive): Remove.
8503         (Incremental_inputs::report_archive_begin): New function.
8504         (Incremental_inputs::report_archive_end): New function.
8505         (Incremental_inputs::report_object): Change prototype.
8506         (Incremental_inputs::report_input_section): New function.
8507         (Incremental_inputs::report_script): Change prototype.
8508         (Incremental_inputs::get_reloc_count): New function.
8509         (Incremental_inputs::set_reloc_count): New function.
8510         (Incremental_inputs::create_data_sections): New function.
8511         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8512         (Incremental_inputs::inputs_section): New function.
8513         (Incremental_inputs::symtab_section): New function.
8514         (Incremental_inputs::relocs_section): New function.
8515         (Incremental_inputs::get_stringpool): Add const.
8516         (Incremental_inputs::command_line): Add const.
8517         (Incremental_inputs::inputs): Remove.
8518         (Incremental_inputs::command_line_key): New function.
8519         (Incremental_inputs::input_file_count): New function.
8520         (Incremental_inputs::input_files): New function.
8521         (Incremental_inputs::relocs_entsize): New function.
8522         (Incremental_inputs::sized_create_inputs_section_data): Remove.
8523         (Incremental_inputs::finalize_inputs): Remove.
8524         (Incremental_inputs::Input_info): Remove.
8525         (Incremental_inputs::lock_): Remove.
8526         (Incremental_inputs::inputs_): Change type.
8527         (Incremental_inputs::inputs_map_): Remove.
8528         (Incremental_inputs::current_object_entry_): New data member.
8529         (Incremental_inputs::inputs_section_): New data member.
8530         (Incremental_inputs::symtab_section_): New data member.
8531         (Incremental_inputs::relocs_section_): New data member.
8532         (Incremental_inputs::reloc_count_): New data member.
8533         (Incremental_inputs_reader): New class.
8534         (Incremental_symtab_reader): New class.
8535         (Incremental_relocs_reader): New class.
8536         * layout.cc (Layout::finalize): Move finalization of incremental info
8537         and creation of incremental info sections to follow finalization of
8538         symbol table.  Set offsets for postprocessing sections.
8539         (Layout::create_incremental_info_sections): Call
8540         Incremental_inputs::create_data_sections.  Add incremental symtab
8541         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
8542         sections to layout after input sections.
8543         * layout.h (struct Timespec): Forward declaration.
8544         (Layout::incremental_inputs): Add const.
8545         (Layout::create_incremental_info_sections): Add parameter.
8546         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
8547         * object.cc: Include incremental.h.
8548         (Relobj::finalize_incremental_relocs): New function.
8549         (Sized_relobj::do_layout): Record input sections in incremental info.
8550         * object.h (Object::output_section): New function.
8551         (Object::output_section_offset): Moved from Relobj.
8552         (Object::get_incremental_reloc_base): New function.
8553         (Object::get_incremental_reloc_count): New function.
8554         (Object::do_output_section): New function.
8555         (Object::do_output_section_offset): Moved from Relobj.
8556         (Object::do_get_incremental_reloc_base): New function.
8557         (Object::do_get_incremental_reloc_count): New function.
8558         (Object::Object): Initialize new data members.
8559         (Relobj::output_section): Renamed do_output_section and moved to
8560         protected.
8561         (Relobj::output_section_offset): Moved to Object.
8562         (Relobj::do_get_incremental_reloc_base): New function.
8563         (Relobj::do_get_incremental_reloc_count): New function.
8564         (Relobj::allocate_incremental_reloc_counts): New function.
8565         (Relobj::count_incremental_reloc): New function.
8566         (Relobj::finalize_incremental_relocs): New function.
8567         (Relobj::next_incremental_reloc_index): New function.
8568         (Relobj::reloc_counts_): New data member.
8569         (Relobj::reloc_bases_): New data member.
8570         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
8571         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
8572         (Sized_relobj::incremental_relocs_scan): New function.
8573         (Sized_relobj::incremental_relocs_scan_reltype): New function.
8574         (Sized_relobj::incremental_relocs_write): New function.
8575         (Sized_relobj::incremental_relocs_write_reltype): New function.
8576         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
8577         incremental link.
8578         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
8579         archives and object files elsewhere.
8580         (Add_symbols::run): Report object files here.
8581         (Finish_group::run): Report end of archive at end of group.
8582         * reloc.cc: Include layout.h, incremental.h.
8583         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
8584         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
8585         (Sized_relobj::incremental_relocs_scan): New function.
8586         (Sized_relobj::incremental_relocs_scan_reltype): New function.
8587         (Sized_relobj::do_relocate_sections): Write incremental relocations.
8588         (Sized_relobj::incremental_relocs_write): New function.
8589         (Sized_relobj::incremental_relocs_write_reltype): New function.
8590         * script.cc (read_input_script): Rewrite test for incremental link.
8591         Change call to Incremental_inputs::report_script.
8592         * symtab.h (Symbol_table::first_global_index): New function.
8593         (Symbol_table::output_count): New function.
8594
8595 2010-08-12  Doug Kwan  <dougkwan@google.com>
8596
8597         * arm.cc (Target_arm::merge_object_attributes): Check command line
8598         options --no-wchar-size-warning and --no-enum-size-warning.
8599         * options.h (General_options): Add ld-compatible options
8600         --no-enum-size-warning and --no-wchar-size-warning.
8601
8602 2010-08-04  Ian Lance Taylor  <iant@google.com>
8603
8604         * x86_64.cc (Target_x86_64::Scan::local): Use
8605         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
8606         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
8607         (Target_x86_64::Scan::global): Likewise.
8608         (Target_x86_64::Relocate::relocate): Likewise.
8609         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
8610         Likewise.
8611
8612 2010-08-03  Cary Coutant  <ccoutant@google.com>
8613
8614         * merge.cc (Output_merge_string::do_add_input_section): Count strings
8615         to reserve space in merged_strings vector. Keep total input size
8616         for stats.
8617         (Output_merge_string::do_print_merge_stats): Print total input size.
8618         * merge.h (Output_merge_string): Add input_size_ field.
8619         * stringpool.cc (Stringpool_template::string_length): Move
8620         implementations out of Stringpool_template class and place in
8621         stringpool.h.
8622         * stringpool.h (string_length): Move out of Stringpool_template.
8623
8624 2010-08-03  Ian Lance Taylor  <iant@google.com>
8625
8626         PR 11712
8627         * layout.cc (relaxation_loop_body): If address of load segment is
8628         set, adjust address to include headers if possible.
8629
8630 2010-08-03  Ian Lance Taylor  <iant@google.com>
8631
8632         * version.cc (version_string): Bump to 1.10.
8633
8634 2010-08-03  Ian Lance Taylor  <iant@google.com>
8635
8636         PR 11805
8637         * layout.h (enum Output_section_order): Define.
8638         (class Layout): Update declarations.
8639         * layout.cc (Layout::get_output_section): Add order parameter.
8640         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
8641         is_first_non_relro parameters.  Change all callers.
8642         (Layout::choose_output_section): Likewise.
8643         (Layout::add_output_section_data): Likewise.
8644         (Layout::make_output_section): Likewise.  Set order.
8645         (Layout::default_section_order): New function.
8646         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
8647         * output.cc (Output_section::Output_section): Initialize order_.
8648         Don't initialize deleted fields.
8649         (Output_segment::Output_segment): Don't initialize deleted
8650         fields.
8651         (Output_segment::add_output_section_to_load): New function
8652         replacing add_output_section.  Change all callers to call this or
8653         add_output_section_to_nonload.
8654         (Output_segment::add_output_section_to_nonload): New function.
8655         (Output_segment::remove_output_section): Rewrite.
8656         (Output_segment::add_initial_output_data): Likewise.
8657         (Output_segment::has_any_data_sections): Likewise.
8658         (Output_segment::is_first_section_relro): Likewise.
8659         (Output_segment::maximum_alignment): Likewise.
8660         (Output_segment::has_dynamic_reloc): New function replacing
8661         dynamic_reloc_count.  Change all callers.
8662         (Output_segment::has_dynamic_reloc_list): New function replacing
8663         dynamic_reloc_count_list.  Change all callers.
8664         (Output_segment::set_section_addresses): Rewrite.
8665         (Output_segment::set_offset): Rewrite.
8666         (Output_segment::find_first_and_last_list): Remove.
8667         (Output_segment::set_tls_offsets): Rewrite.
8668         (Output_segment::first_section_load_address): Likewise.
8669         (Output_segment::output_section_count): Likewise.
8670         (Output_segment::section_with_lowest_load_address): Likewise.
8671         (Output_segment::write_section_headers): Likewise.
8672         (Output_segment::print_sections_to_map): Likewise.
8673         * output.h (class Output_data): Remove dynamic_reloc_count_
8674         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
8675         (Output_data::add_dynamic_reloc): Rewrite.
8676         (Output_data::has_dynamic_reloc): New function.
8677         (Output_data::dynamic_reloc_count): Remove.
8678         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
8679         is_last_relro_, is_first_non_relro_, is_interp_,
8680         is_dynamic_linker_section_ fields.  Add order and set_order
8681         functions.  Remove is_relro_local, set_is_relro_local,
8682         is_last_relro, set_is_last_relro, is_first_non_relro,
8683         set_is_first_non_relro functions, is_interp, set_is_interp,
8684         is_dynamic_linker_section, and set_is_dynamic_linker_section
8685         functions.
8686         (class Output_segment): Change Output_data_list from std::list to
8687         std:;vector.  Add output_lists_ field.  Remove output_data_ and
8688         output_bss_ fields.  Update declarations.
8689
8690 2010-08-02  Ian Lance Taylor  <iant@google.com>
8691
8692         * arm.cc (Target_arm::gc_process_relocs): Use typename.
8693         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
8694         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
8695
8696 2010-08-02  Ian Lance Taylor  <iant@google.com>
8697
8698         PR 11855
8699         * script.cc (Script_options::Script_options): Initialize
8700         symbol_definitions_ and symbol_references_.
8701         (Script_options::add_symbol_assignment): Update
8702         symbol_definitions_ and symbol_references_.
8703         (Script_options::add_symbol_reference): New function.
8704         (script_symbol): New function.
8705         * script.h (class Script_options): Add symbol_definitions_ and
8706         symbol_references_ fields.
8707         (Script_options::referenced_const_iterator): New type.
8708         (Script_options::referenced_begin): New function.
8709         (Script_options::referenced_end): New function.
8710         (Script_options::is_referenced): New function.
8711         (Script_options::any_unreferenced): New function.
8712         * script-c.h (script_symbol): Declare.
8713         * yyscript.y (exp): Call script_symbol.
8714         * symtab.cc: Include "script.h".
8715         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
8716         Change all callers.  Check symbols referenced by scripts.
8717         (Symbol_table::add_undefined_symbols_from_command_line): Add
8718         layout parameter.  Change all callers.
8719         (Symbol_table::do_add_undefined_symbols_from_command_line):
8720         Likewise.  Break out loop body.  Check symbols referenced by
8721         scripts.
8722         (Symbol_table::add_undefined_symbol_from_command_line): New
8723         function broken out of
8724         do_add_undefined_symbols_from_command_line.
8725         * symtab.h (class Symbol_table): Update declarations.
8726         * archive.cc: Include "layout.h".
8727         (Archive::should_include_member): Add layout parameter.  Change
8728         all callers.  Check for symbol mentioned in expression.
8729         * archive.h (class Archive): Update declaration.
8730         * object.cc (Sized_relobj::do_should_include_member): Add layout
8731         parameter.
8732         * object.h (Object::should_include_member): Add layout parameter.
8733         Change all callers.
8734         (Object::do_should_include_member): Add layout parameter.
8735         (class Sized_relobj): Update declaration.
8736         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
8737         parameter.
8738         * dynobj.h (class Sized_dynobj): Update declaration.
8739         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
8740         layout parameter.
8741         * plugin.h (class Sized_pluginobj): Update declaration.
8742
8743 2010-08-02  Ian Lance Taylor  <iant@google.com>
8744
8745         PR 11866
8746         * output.cc (Output_segment::set_offset): Search for the first and
8747         last sections rather than assuming that the list is in order.
8748         (Output_segment::find_first_and_last_list): New function.
8749         * output.h (class Output_segment): Update declarations.
8750         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
8751         (relro_strip_test_SOURCES): New variable.
8752         (relro_strip_test_DEPENDENCIES): New variable.
8753         (relro_strip_test_LDFLAGS): New variable.
8754         (relro_strip_test_LDADD): New variable.
8755         (relro_strip_test.so): New target.
8756
8757 2010-08-02  Ian Lance Taylor  <iant@google.com>
8758
8759         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
8760         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
8761         (Target_i386::got_tlsdesc_section): New function.
8762         (Target_i386::got_section): Create space for GOT entries for
8763         TLSDESC relocations.
8764         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
8765         R_386_TLS_GOTDESC.
8766         (Target_i386::Scan::global): Likewise.
8767         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
8768         using TLSDESC GOT.
8769         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
8770         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
8771         (Target_x86_64::got_tlsdesc_section): New function.
8772         (Target_x86_64::got_section): Create space for GOT entries for
8773         TLSDESC relocations.
8774         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
8775         R_386_TLS_GOTDESC.
8776         (Target_x86_64::Scan::global): Likewise.
8777         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
8778         using TLSDESC GOT.
8779
8780 2010-08-02  Ian Lance Taylor  <iant@google.com>
8781
8782         * testsuite/final_layout.sh: Use dc to convert from hex to
8783         decimal.
8784
8785 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
8786
8787         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
8788         paramter to the call to gold::gc_process_relocs.
8789         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
8790         paramter to the call to gold::gc_process_relocs.
8791         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
8792         parameter to the call to gold::gc_process_relocs.
8793         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
8794         template parameter to the call to gold::gc_process_relocs.
8795         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
8796         paramter to the call to gold::gc_process_relocs.
8797         * gc.h (get_embedded_addend_size): New function.
8798         (gc_process_relocs): Save the size of the reloc for use by ICF.
8799         * icf.cc (get_section_contents): Get the addend from the text section
8800         for SHT_REL relocation sections.
8801         * icf.h (Icf::Reloc_addend_size_info): New typedef.
8802         (Icf::Reloc_info): Add new member reloc_addend_size_info.
8803         * int_encoding.h (read_from_pointer): New overloaded function.
8804         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
8805         * testsuite/icf_sht_rel_addend_test.sh: New file.
8806         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
8807         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
8808
8809 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8810
8811         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
8812         * Makefile.in: Regenerate.
8813         * testsuite/Makefile.in: Regenerate.
8814
8815 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
8816
8817         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
8818         * gold/testsuite/debug_msg.cc: Likewise.
8819         * gold/testsuite/odr_violation1.cc
8820         * gold/testsuite/odr_violation2.cc
8821
8822 2010-07-21  Cary Coutant  <ccoutant@google.com>
8823
8824         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
8825         string, and length fields.
8826         (Output_merge_string::Merged_strings_list): New type.
8827         (Output_merge_string::Merged_strings_lists): New typedef.
8828         (Output_merge_string): Replace merged_strings_ with
8829         merged_strings_lists_.
8830         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
8831         Merged_strings_list per input object and section.  Don't store pointer
8832         to the string.  Don't store length with each merged string entry.
8833         (Output_merge_string::finalize_merged_data): Loop over list of merged
8834         strings lists.  Recompute length of each merged string.
8835
8836 2010-07-15  Cary Coutant  <ccoutant@google.com>
8837
8838         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
8839         here.
8840
8841 2010-07-14  Ian Lance Taylor  <iant@google.com>
8842
8843         * descriptors.cc (Descriptors::open): Report correct name in error
8844         message.
8845
8846 2010-07-13  Doug Kwan  <dougkwan@google.com>
8847
8848         * arm.cc (Arm_input_section::Arm_input_section): For a
8849         SHT_ARM_EXIDX section, always keeps the input sections.
8850         (Arm_input_section::set_exidx_section_link): New method.
8851         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
8852         has_errors_ to false.
8853         (Arm_exidx_input_section::has_errors,
8854         Arm_exidx_input_section::set_has_errors): New methods.
8855         (Arm_exidx_input_section::has_errors_): New data member.
8856         (Arm_relobj::get_exidx_shndx_list): New method.
8857         (Arm_output_section::append_text_sections_to_list): Do not skip
8858         section without SHF_EXECINSTR.
8859         (Arm_output_section::fix_exidx_coverage): Skip input sections with
8860         errors.
8861         (Arm_relobj::make_exidx_input_section): Add new parameter for text
8862         section header.  Make error messages more verbose.  Check for
8863         a non-executable section linked to an EXIDX section.
8864         (Arm_relobj::do_read_symbols): Remove error checking, which has been
8865         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
8866         check that there is no deferred EXIDX section if we exit early.
8867         Instead of not making an EXIDX section in case of an error, make one
8868         and set the has_errors flag of it.
8869         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
8870         in a relocatable link.
8871         (Target_arm::do_relax): Look for the EXIDX output section instead of
8872         assuming that it is called .ARM.exidx.
8873         (Target_arm::fix_exidx_coverage): Add a new parameter for input
8874         section list.  Do not check for SHF_EXECINSTR section flags but
8875         skip any input section with errors.
8876         * output.cc (Output_section::Output_section): Initialize
8877         always_keeps_input_sections_ to false.
8878         (Output_section::add_input_section): Check for
8879         always_keeps_input_sections_.
8880         *  output.h (Output_section::always_keeps_input_sections,
8881         Output_section::set_always_keeps_input_sections): New methods.
8882         (Output_section::always_keeps_input_sections): New data member.
8883
8884 2010-07-13  Rafael Espindola  <espindola@google.com>
8885
8886         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
8887         * fileread.h (Input_file): Add try_extra_search_path and find_file.
8888
8889 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
8890             Ian Lance Taylor  <iant@google.com>
8891
8892         * output.h (Output_section_lookup_maps::add_merge_section):
8893         Correct check of whether value was inserted.
8894         (Output_section_lookup_maps::add_merge_input_section): Likewise.
8895         (Output_section_lookup_maps::add_relaxed_input_section):
8896         Likewise.
8897         * arm.cc (Target_arm::got_section): Remove used local os.
8898         * i386.cc (Target_i386::got_section): Likewise.
8899         * x86_64.cc (Target_x86_64::got_section): Likewise.
8900         * sparc.cc (Target_sparc::got_section): Likewise.
8901         (Target_sparc::relocate): Remove unused local have_got_offset.
8902         * powerpc.cc (Target_powerpc::relocate): Likewise.
8903
8904 2010-07-13  Ian Lance Taylor  <iant@google.com>
8905
8906         * compressed_output.cc (zlib_decompress): Fix signature in
8907         !HAVE_ZLIB_H case.
8908
8909         * archive.cc (Archive::include_member): Unlock an external member
8910         of a thin archive.  Don't bother to delete an object we know is
8911         NULL.
8912
8913 2010-07-12  Cary Coutant  <ccoutant@google.com>
8914
8915         * compressed_output.cc (zlib_decompress): New function.
8916         (get_uncompressed_size): New function.
8917         (decompress_input_section): New function.
8918         * compressed_output.h (get_uncompressed_size): New function.
8919         (decompress_input_section): New function.
8920         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
8921         Handle compressed debug sections.
8922         * layout.cc (is_compressed_debug_section): New function.
8923         (Layout::output_section_name): Map compressed section names to
8924         canonical names.
8925         * layout.h (is_compressed_debug_section): New function.
8926         (is_debug_info_section): Recognize compressed debug sections.
8927         * merge.cc: Include compressed_output.h.
8928         (Output_merge_data::do_add_input_section): Handle compressed
8929         debug sections.
8930         (Output_merge_string::do_add_input_section): Handle compressed
8931         debug sections.
8932         * object.cc: Include compressed_output.h.
8933         (Sized_relobj::Sized_relobj): Initialize new data members.
8934         (build_compressed_section_map): New function.
8935         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8936         * object.h (Object::section_is_compressed): New method.
8937         (Object::do_section_is_compressed): New method.
8938         (Sized_relobj::Compressed_section_map): New type.
8939         (Sized_relobj::do_section_is_compressed): New method.
8940         (Sized_relobj::compressed_sections_): New data member.
8941         * output.cc (Output_section::add_input_section): Handle compressed
8942         debug sections.
8943         * reloc.cc: Include compressed_output.h.
8944         (Sized_relobj::write_sections): Handle compressed debug sections.
8945
8946 2010-07-08  Cary Coutant  <ccoutant@google.com>
8947
8948         * resolve.cc (Symbol_table::resolve): Remember whether undef was
8949         weak when resolving to a dynamic def.
8950         (Symbol_table::should_override): Add adjust_dyndef flag; set it
8951         for weak undef/dynamic def cases. Adjust callers.
8952         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8953         undef_binding_weak_.
8954         (Symbol_table::sized_write_globals): Adjust symbol binding.
8955         (Symbol_table::sized_write_symbol): Add binding parameter.
8956         * symtab.h (Symbol::set_undef_binding): New method.
8957         (Symbol::is_undef_binding_weak): New method.
8958         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8959         (Symbol_table::should_override): Add new parameter.
8960         (Symbol_table::sized_write_symbol): Add new parameter.
8961
8962         * testsuite/weak_undef_file1.cc: Add new test case.
8963         * testsuite/weak_undef_file2.cc: Fix header comment.
8964         * testsuite/weak_undef_test.cc: Add new test case.
8965
8966 2010-06-29  Doug Kwan  <dougkwan@google.com>
8967
8968         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8969         Initialize USE_SYMBOL_.
8970         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8971         definition.
8972         (Arm_reloc_property::uses_symbol_): New data member declaration.
8973         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8974         uses symbol value and symbol is undefined but not weakly undefined.
8975
8976 2010-06-28  Rafael Espindola  <espindola@google.com>
8977
8978         * plugin.cc (Plugin::load): Use dlerror.
8979
8980 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
8981
8982         * symtab.cc (detect_odr_violations): When reporting an ODR
8983         violation, report an object where the symbol is defined.
8984
8985 2010-06-25  Doug Kwan  <dougkwan@google.com>
8986
8987         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8988         (Target_arm::section_may_have_icf_unsafe_pointers): New method
8989         definition.
8990         (Target_arm::Scan::local_reloc_may_be_function_pointer,
8991         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8992         target hook to detect function points.
8993         (Target_arm::Scan::possible_function_pointer_reloc): New method.
8994         * icf.h (Icf::check_section_for_function_pointers): Change type of
8995         parameter SECTION_NAME to const reference to std::string.  Use
8996         target hook to determine if section may have unsafe pointers.
8997         * target.h (Target::section_may_have_icf_unsafe_pointers): New
8998         method definition.
8999
9000 2010-06-21  Rafael Espindola  <espindola@google.com>
9001
9002         * fileread.cc (Input_file::find_fie): New
9003         (Input_file::open): Use Input_file::find_fie.
9004         * fileread.h (Input_file::find_fie): New
9005         * plugin.cc (set_extra_library_path): New.
9006         (Plugin::load): Add set_extra_library_path to the transfer vector.
9007         (Plugin_manager::set_extra_library_path): New.
9008         (Plugin_manager::add_input_file): Use the extra search path if set.
9009         (set_extra_library_path(): New.
9010         * plugin.h (Plugin_manager): Add set_extra_library_path and
9011         extra_search_path_.
9012
9013 2010-06-19  Cary Coutant  <ccoutant@google.com>
9014
9015         * layout.cc (gdb_sections): Add .debug_types.
9016         (lines_only_debug_sections): Likewise.
9017
9018 2010-06-18  Rafael Espindola  <espindola@google.com>
9019
9020         * plugin.cc (add_input_file,add_input_library)
9021         (Plugin_manager::add_input_file): Make filename arguments const.
9022         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
9023         const.
9024
9025 2010-06-16  Doug Kwan  <dougkwan@google.com>
9026
9027         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
9028         .ARM.attributes section if we have not merged any input
9029         attributes sections.
9030
9031 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9032
9033         * arm.cc: Allow combining objects with no EABI version
9034         information.
9035
9036 2010-06-15  Rafael Espindola  <espindola@google.com>
9037
9038         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
9039
9040 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9041
9042         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
9043         (struct iovec): Correct !HAVE_READV definition.
9044
9045 2010-06-10  Cary Coutant  <ccoutant@google.com>
9046
9047         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
9048         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
9049         reloc sections.
9050         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
9051
9052         PR 11683
9053         * symtab.h (Symbol::is_placeholder): New member function.
9054         * target-reloc.h (relocate_section): Check for placeholder symbols.
9055
9056         * testsuite/Makefile.am (plugin_test_8): New test.
9057         (plugin_test_9): New test.
9058         * testsuite/Makefile.in: Regenerate.
9059
9060 2010-06-09  Nick Clifton  <nickc@redhat.com>
9061
9062         * yyscript.y (input_list_element): Allow strings prefixed with
9063         the '-' character.  Treat these as libraries.
9064         * script.cc (script_add_library): New function.  Adds a library
9065         specified by "-l<name>" found in an input script.
9066         * script-c.h: Add prototype for script_add_library.
9067
9068 2010-06-07  Doug Kwan  <dougkwan@google.com>
9069
9070         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
9071         Restrict stub-group size to be within long conditional branch
9072         range when working around cortex-A8 erratum.
9073
9074 2010-06-07  Damien Diederen  <dd@crosstwine.com>
9075
9076         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
9077         #ifdef typo.
9078
9079 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
9080
9081         PR gold/11658
9082         * output.cc
9083         (Output_section::Input_section_sort_entry::compare_section_ordering):
9084         Change to return non-zero correctly.
9085         (Output_section::Input_section_sort_section_order_index_compare
9086         ::operator()): Change to fix ambiguity in comparisons.
9087
9088 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
9089
9090         * gold.h (is_wildcard_string): New function.
9091         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
9092         (Layout::layout_eh_frame): Ditto.
9093         (Layout::find_section_order_index): New method.
9094         (Layout::read_layout_from_file): New method.
9095         * layout.h (Layout::find_section_order_index): New method.
9096         (Layout::read_layout_from_file): New method.
9097         (Layout::input_section_position_): New private member.
9098         (Layout::input_section_glob_): New private member.
9099         * main.cc (main): Call read_layout_from_file here.
9100         * options.h (--section-ordering-file): New option.
9101         * output.cc (Output_section::input_section_order_specified_): New
9102         member.
9103         (Output_section::Output_section): Initialize new member.
9104         (Output_section::add_input_section): Add new parameter.
9105         Keep input sections when --section-ordering-file is used.
9106         (Output_section::set_final_data_size): Sort input sections when
9107         section ordering file is specified.
9108         (Output_section::Input_section_sort_entry): Add new parameter.
9109         Check sorting type.
9110         (Output_section::Input_section_sort_entry::compare_section_ordering):
9111         New method.
9112         (Output_section::Input_section_sort_compare::operator()): Change to
9113         consider section_order_index.
9114         (Output_section::Input_section_sort_init_fini_compare::operator()):
9115         Change to consider section_order_index.
9116         (Output_section::Input_section_sort_section_order_index_compare
9117         ::operator()): New method.
9118         (Output_section::sort_attached_input_sections): Change to sort
9119         according to section order when specified.
9120         (Output_section::add_input_section<32, true>): Add new parameter.
9121         (Output_section::add_input_section<64, true>): Add new parameter.
9122         (Output_section::add_input_section<32, false>): Add new parameter.
9123         (Output_section::add_input_section<64, false>): Add new parameter.
9124         * output.h (Output_section::add_input_section): Add new parameter.
9125         (Output_section::input_section_order_specified): New
9126         method.
9127         (Output_section::set_input_section_order_specified): New method.
9128         (Input_section::Input_section): Initialize section_order_index_.
9129         (Input_section::section_order_index): New method.
9130         (Input_section::set_section_order_index): New method.
9131         (Input_section::section_order_index_): New member.
9132         (Input_section::Input_section_sort_section_order_index_compare): New
9133         struct.
9134         (Output_section::input_section_order_specified_): New member.
9135         * script-sections.cc (is_wildcard_string): Delete and move modified
9136         method to gold.h.
9137         (Output_section_element_input::Output_section_element_input): Modify
9138         call to is_wildcard_string.
9139         (Output_section_element_input::Input_section_pattern
9140         ::Input_section_pattern): Ditto.
9141         (Output_section_element_input::Output_section_element_input): Ditto.
9142         * testsuite/Makefile.am (final_layout): New test case.
9143         * testsuite/Makefile.in: Regenerate.
9144         * testsuite/final_layout.cc: New file.
9145         * testsuite/final_layout.sh: New file.
9146
9147 2010-06-01  Rafael Espindola  <espindola@google.com>
9148
9149         * plugin.cc (Plugin::load): Pass the output name to the plugin.
9150
9151 2010-06-01  Rafael Espindola  <espindola@google.com>
9152
9153         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
9154         visibility of symbols.
9155
9156 2010-05-27  Doug Kwan  <dougkwan@google.com>
9157
9158         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
9159         from start of output section instead of address for a local symbol
9160         in a merged or relaxed section when doing a relocatable link.
9161
9162 2010-05-26  Rafael Espindola  <espindola@google.com>
9163
9164         PR 11604
9165         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
9166         adding sections the garbage collector removed.
9167         * gold/testsuite/Makefile.am: Add test.
9168         * gold/testsuite/Makefile.in: Regenerate.
9169         * gold/testsuite/plugin_test_7.sh: New.
9170         * gold/testsuite/plugin_test_7_1.c: New.
9171         * gold/testsuite/plugin_test_7_2.c: New.
9172
9173 2010-05-26  Rafael Espindola  <espindola@google.com>
9174
9175         * script-sections.cc (Output_section_definition::set_section_addresses):
9176         Check for --section-start.
9177
9178 2010-05-26  Doug Kwan  <dougkwan@google.com>
9179
9180         * arm.cc (Arm_scan_relocatable_relocs): New class.
9181         (Target_arm::relocate_special_relocatable): New method.
9182         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
9183         (Arm_relocate_functions::thumb_branch_common): Same.
9184         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
9185         instead of Default_scan_relocatable_relocs.
9186         * target-reloc.h (relocate_for_relocatable): Let target handle
9187         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
9188         * target.h (Sized_target::relocate_special_relocatable): New method.
9189
9190 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9191
9192         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
9193
9194 2010-05-23  Doug Kwan  <dougkwan@google.com>
9195
9196         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
9197         instead of a cast.
9198         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
9199         with a direct branch, not a conditional branch, to a stub.
9200         * merge.cc (Output_merge_base::record_input_section): New method
9201         defintion.
9202         (Output_merge_data::do_add_input_section): Record input section if
9203         keeps-input-sections flag is set.
9204         (Output_merge_string::do_add_input_section): Ditto.
9205         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
9206         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
9207         INPUT_SECTIONS_.
9208         (Output_merge_base::keeps_input_sections,
9209         Output_merge_base::set_keeps_input_sections,
9210         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
9211         method definitions.
9212         (Output_merge_base::Input_sections): New type declaration.
9213         (Output_merge_base::input_sections_begin,
9214         Output_merge_base::input_sections_end,
9215         Output_merge_base::do_set_keeps_input_sections): New method definitions.
9216         (Output_merge_base::bool keeps_input_sections_,
9217         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
9218         Output_merge_base::input_sections_): New data members.
9219         (Output_merge_data::do_set_keeps_input_sections): New method
9220         defintion.
9221         (Output_merge_string::do_set_keeps_input_sections): Ditto.
9222         * output.cc (Output_section::Input_section::relobj): Move method
9223         defintion from class declaration to here and handle merge sections.
9224         (Output_section::Input_section::shndx): Ditto.
9225         (Output_section::Output_section): Remove initializations of removed
9226         data members and initialize new data member LOOKUP_MAPS_.
9227         (Output_section::add_input_section): Set keeps-input-sections flag
9228         for a newly created merge output section as appropriate.  Adjust code
9229         to use Output_section_lookup_maps class.
9230         (Output_section::add_relaxed_input_section): Adjst code for lookup
9231         maps code refactoring.
9232         (Output_section::add_merge_input_section): Add a new parameter
9233         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
9234         class.  If adding input section to a newly created merge output
9235         section fails, remove the new merge section.
9236         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
9237         Adjust code for use of the Output_section_lookup_maps class.
9238         (Output_section::find_merge_section): Ditto.
9239         (Output_section::build_lookup_maps): New method defintion.
9240         (Output_section::find_relaxed_input_section): Adjust code to use
9241         Output_section_lookup_maps class.
9242         (Output_section::get_input_sections): Export merge sections.  Adjust
9243         code to use Output_section_lookup_maps class.
9244         (Output_section:::add_script_input_section): Adjust code to use
9245         Output_section_lookup_maps class.  Update lookup maps for merge
9246         sections also.
9247         (Output_section::discard_states): Use Output_section_lookup_maps.
9248         (Output_section::restore_states): Same.
9249         * output.h (Merge_section_properties): Move class defintion out of
9250         Output_section.
9251         (Output_section_lookup_maps): New class.
9252         (Output_section::Input_section::is_merge_section): New method
9253         defintion.
9254         (Output_section::Input_section::relobj): Move defintion out of class
9255         defintion.  Declare method only.
9256         (Output_section::Input_section::shndx): Ditto.
9257         (Output_section::Input_section::output_merge_base): New method defintion.
9258         (Output_section::Input_section::u2_.pomb): New union field.
9259         (Output_section::Merge_section_by_properties_map,
9260         Output_section::Output_section_data_by_input_section_map,
9261         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
9262         Remove types.
9263         (Output_section::add_merge_input_section): Add new parameter
9264         KEEPS_INPUT_SECTIONS.
9265         (Output_section::build_lookup_maps): New method declaration.
9266         (Output_section::merge_section_map_,
9267         Output_section::merge_section_by_properties_map_,
9268         Output_section::relaxed_input_section_map_,
9269         Output_section::is_relaxed_input_section_map_valid_): Remove data
9270         members.
9271         (Output_section::lookup_maps_): New data member.
9272
9273 2010-05-21  Doug Kwan  <dougkwan@google.com>
9274
9275         PR gold/11619
9276         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
9277         avoid a compilation error.
9278
9279 2010-05-19  Rafael Espindola  <espindola@google.com>
9280
9281         * script-sections.cc (Output_section_definition::allocate_to_segment):
9282         Update the phdrs_list even when the output section is NULL.
9283         * testsuite/Makefile.am: Add test.
9284         * testsuite/Makefile.in: Regenerate.
9285         * testsuite/script_test_9.cc: New.
9286         * testsuite/script_test_9.sh: New.
9287         * testsuite/script_test_9.t: New.
9288
9289 2010-05-19  Doug Kwan  <dougkwan@google.com>
9290
9291         * arm.cc (Arm_input_section::original_size): New method.
9292         (Arm_input_section::do_addralign): Add a cast.
9293         (Arm_input_section::do_output_offset): Remove static cast.
9294         (Arm_input_section::original_addralign,
9295          Arm_input_section::original_size_): Change type to uint32_t.
9296         (Arm_input_section::init): Add safe casts for section alignment
9297         and size.
9298         (Arm_input_section::set_final_data_size): Do not set address and
9299         offset of stub table.
9300         (Arm_output_section::fix_exidx_coverage): Change use of of
9301         Output_section::Simple_input_section to that of
9302         Output_section::Input_section.
9303         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
9304         except for the first pass.
9305         * output.cc (Output_section::get_input_sections): Change type of
9306         input_sections to std::list<Input_section>.
9307         (Output_section::add_script_input_section): Rename from
9308         Output_section::add_simple_input_section.  Change type of SIS
9309         parameter from Simple_input_section to Input_section.
9310         * output.h (Output_section::Simple_input_section): Remove class.
9311         (Output_section::Input_section): Change class visibility to public.
9312         (Output_section::Input_section::addralign): Use stored alignments
9313         for special input sections if set.
9314         (Output_section::Input_section::set_addralign): New method.
9315         (Output_section::get_input_sections): Change parameter type from
9316         list of Simple_input_section to list of Input_section.
9317         (Output_section::add_script_input_section): Rename from
9318         Output_section::add_simple_input_section. Change first parameter's
9319         type from Simple_input_section to Input_section and remove the
9320         second and third parameters.
9321         * script-sections.cc (Input_section::Input_section_list): Change
9322         type to list of Output_section::Input_section/
9323         (Input_section_info::Input_section_info): Change parameter type of
9324         INPUT_SECTION to Output_section::Input_section.
9325         (Input_section_info::input_section): Change return type.
9326         (Input_section_info::input_section_): Change type to
9327         Output_section::Input_section.
9328         (Output_section_element_input::set_section_addresses): Adjust code
9329         to use Output_section::Input_section instead of
9330         Output_section::Simple_input_section.  Adjust code for renaming
9331         of Output_section::add_simple_input_section.
9332         (Orphan_output_section::set_section_addresses): Ditto.
9333
9334 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9335
9336         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
9337         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
9338
9339 2010-05-18  Rafael Espindola  <espindola@google.com>
9340
9341         * options.cc (General_options::finalize): Handle -nostdlib.
9342         * options.h (nostdlib): New option.
9343         * script.cc (script_add_search_dir): Handle -nostdlib.
9344
9345 2010-05-12  Doug Kwan  <dougkwan@google.com>
9346
9347         * arm.cc (Target_arm::do_finalize_sections): Create an empty
9348         attributes section only if there no attributes section after merging.
9349         (Target_arm::merge_object_attributes): Move value of
9350         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
9351         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
9352         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
9353         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
9354         and arm_attr_merge_7.stdout.
9355         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
9356         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
9357         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
9358         arm_attr_merge_7b.o): New rules.
9359         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
9360         arm_attr_merge_7
9361         * testsuite/Makefile.in: Regenerate.
9362         * testsuite/arm_attr_merge.sh: New file.
9363         * testsuite/arm_attr_merge_[67][ab].s: Same.
9364
9365 2010-05-05  Nick Clifton  <nickc@redhat.com>
9366
9367         * po/es.po: Updated Spanish translation.
9368
9369 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
9370
9371         * Makefile.am (install-exec-local): Properly install gold as
9372         default cross linker.
9373         * Makefile.in: Regenerated.
9374
9375 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
9376             Nick Clifton  <nickc@redhat.com>
9377
9378         * configure.ac (install_as_default): Define and set to false
9379         unless --enable-gold or --enable-gold=both/gold has been
9380         specified.
9381         * configure: Regenerate.
9382
9383         * Makefile.am (install-exec-local): Install the executable as
9384         'ld.gold'.  If install_as_default is true then also install it as
9385         'ld'.
9386         * Makefile.in: Regenerated.
9387
9388 2010-04-24  Ian Lance Taylor  <iant@google.com>
9389
9390         * layout.cc (Layout::layout_reloc): In relocatable link don't
9391         combine reloc sections for grouped sections.
9392
9393 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
9394
9395         * gc.h (gc_process_relocs): Pass information on relocs pointing to
9396         sections that are not ordinary to icf.
9397         * icf.cc (get_section_contents): Handle relocation pointing to section
9398         with no object or shndx information.
9399         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
9400         * testsuite/Makefile.in: Regenerate.
9401         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
9402         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
9403
9404 2010-04-22  Ian Lance Taylor  <iant@google.com>
9405
9406         * expression.cc (Expression::Expression_eval_info): Add
9407         result_alignment_pointer field.
9408         (Expression::eval_with_dot): Add result_alignment_pointer
9409         parameter.  Change all callers.
9410         (Expression::eval_maybe_dot): Likewise.
9411         (class Binary_expression): Add alignment_pointer parameter to
9412         left_value and right_value.  Change all callers.
9413         (BINARY_EXPRESSION): Set result alignment.
9414         (class Trinary_expression): Add alignment_pointer parameter to
9415         arg2_value and arg3_value.  Change all callers.
9416         (Trinary_cond::value): Set result alignment.
9417         (Max_expression::value, Min_expression::value): Likewise.
9418         (Align_expression::value): Likewise.
9419         * script-sections.cc (class Sections_element): Add dot_alignment
9420         parameter to set_section_addresses virtual function.  Update
9421         instantiations.
9422         (class Output_section_element): Likewise.
9423         (Script_sections::create_segments): Add dot_alignment parameter.
9424         Change all callers.
9425         (Script_sections::create_segments_from_phdrs_clause): Likewise.
9426         (Script_sections::set_phdrs_clause_addresses): Likewise.
9427         * script-sections.h: Update declarations.
9428         * script.h: Update declarations.
9429         * output.h (Output_segment::set_minimum_p_align): Don't decrease
9430         min_p_align.
9431         * testsuite/script_test_3.t: Set large alignment.
9432         * testsuite/script_test_3.sh: Make sure that at least one LOAD
9433         segment has expected alignment.
9434
9435 2010-04-22  Nick Clifton  <nickc@redhat.com>
9436
9437         * po/gold.pot: Updated by the Translation project.
9438         * po/vi.po: Updated Vietnamese translation.
9439
9440 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
9441
9442         * testsuite/Makefile.am (check_PROGRAMS): Add
9443         icf_virtual_function_folding_test.
9444         * testsuite/Makefile.in: Regenerated.
9445
9446 2010-04-15  Andrew Haley  <aph@redhat.com>
9447
9448         * options.h (merge_exidx_entries): New option.
9449         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
9450         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
9451         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
9452         (Target_arm::merge_exidx_entries): New function.
9453         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
9454         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
9455         to Arm_exidx_fixup constructor.
9456         Add new arg, merge_exidx_entries.
9457         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
9458         Arm_output_section::fix_exidx_coverage.
9459
9460 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
9461
9462         * icf.cc (get_section_contents): Check for preemptible functions.
9463         Ignore addend when appropriate.
9464         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
9465         section folded.
9466         (add_from_relobj): Check for section folded.
9467         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
9468         * symtab.h (should_add_dynsym_entry): Add new parameter.
9469         * target-reloc.h (scan_relocs): Check for section folded.
9470         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
9471         Check reloc types for function pointers in shared objects.
9472         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
9473         case.
9474         (icf_preemptible_functions_test): New test case.
9475         (icf_string_merge_test): New test case.
9476         * testsuite.Makefile.in: Regenerate.
9477         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
9478         bar_glob.  Refactor code.
9479         * testsuite/icf_preemptible_functions_test.cc: New file.
9480         * testsuite/icf_preemptible_functions_test.sh: New file.
9481         * testsuite/icf_string_merge_test.cc: New file.
9482         * testsuite/icf_string_merge_test.sh: New file.
9483         * testsuite/icf_virtual_function_folding_test.cc: New file.
9484         * testsuite/icf_virtual_function_folding_test.sh: New file.
9485
9486 2010-04-14  Doug Kwan  <dougkwan@google.com>
9487
9488         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
9489         for local symbol recounting if we remove a section due to ICF.
9490         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
9491         there are no regular objects in input.
9492
9493 2010-04-13  Doug Kwan  <dougkwan@google.com>
9494
9495         * arm.cc (Arm_input_section::set_final_data_size): Compute
9496         accurate final data size instead of using current data size.
9497
9498 2010-04-09  Doug Kwan  <dougkwan@google.com>
9499
9500         * layout.cc (Layout::choose_output_section): Handle script section
9501         types.
9502         (Layout::make_output_section_for_script): Add section type parameter.
9503         Handle script section types.
9504         * layout.h (Layout::make_output_section_for_script): Add section
9505         type parameter.
9506         * output.cc (Output_section::Output_section): Initialize data member
9507         is_noload_.
9508         (Output_section::do_reset_address_and_file_offset): Do not set address
9509         to 0 if section is a NOLOAD section.
9510         * output.h (Output_section::is_noload): New method.
9511         (Output_section::set_is_noload): Ditto.
9512         (Output_section::is_noload_): New data member.
9513         * script-c.h (Script_section_type): New enum type.
9514         (struct Parser_output_section_header): Add new file section_type.
9515         * script-sections.cc (Sections_element::output_section_name): Add
9516         parameter for returning script section type.
9517         (Output_section_definition::output_section_name): Ditto.
9518         (Output_section_definition::section_type)P; New method.
9519         (Output_section_definiton::script_section_type_name): Ditto.
9520         (Output_section_definition::script_section_type_): New data member.
9521         (Output_section_definition::Output_section_definition): Initialize
9522         data member Output_section_definition::script_section_type_.
9523         (Output_section_definition::create_sections): Pass script section type
9524         to Layout::make_output_section_for_script.
9525         (Output_section_definition::output_section_name): Return script
9526         section type to caller.
9527         (Output_section_definition::set_section_address): Do not advance
9528         dot value and load address if section type is NOLOAD.  Set address
9529         of NOLOAD sections regardless of section flags.
9530         (Output_section_definition::print): Print section type if it is
9531         not SCRIPT_SECTION_TYPE_NONE.
9532         (Output_section_definition::section_type): New method.
9533         (Output_section_definition::script_section_type_name): Ditto.
9534         (Script_sections::output_section_name): Add new parameter
9535         PSECTION_TYPE for returning script section type.  Pass it to
9536         section elements.  Handle discard sections.
9537         (Sort_output_sections::operator()): Handle NOLOAD sections.
9538         * script-sections.h (Script_sections::Section_type): New enum type.
9539         (Script_sections::output_section_name): Add a new parameter for
9540         returning script section type.
9541         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
9542         INFO and NOLOAD.
9543         * yyscript.y (union): Add new field SECTION_TYPE.
9544         (COPY, DSECT, INFO, NOLOAD): New tokens.
9545         (opt_address_and_section_type): Change type to output_section_header.
9546         (section_type): New non-terminal
9547         (section_header): Handle section type.
9548         (opt_address_and_section_type): Return section type value.
9549
9550 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
9551
9552         * testsuite/plugin_common_test_1.c (foo): Add prototype.
9553         * testsuite/plugin_common_test_2.c (foo): Likewise.
9554
9555 2010-04-08  Doug Kwan  <dougkwan@google.com>
9556
9557         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
9558         Output_merge_data.
9559         * output.cc (Output_section::add_merge_input_section): Simplify
9560         code and return status of Output_merge_base::add_input_section.
9561         Update merge section map only if Output_merge_base::add_input_section
9562         returns true.
9563
9564 2010-04-07  Doug Kwan  <dougkwan@google.com>
9565
9566         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
9567         if section is marked as containing instructions but has no mapping
9568         symbols.
9569         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
9570         correct section index.
9571         (Arm_relobj::find_linked_text_section): Ditto.
9572
9573 2010-04-07  Cary Coutant  <ccoutant@google.com>
9574
9575         * archive.cc (include_member): Destroy Read_symbols_data object before
9576         releasing file.
9577         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
9578         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
9579         (Read_symbols_data::~Read_symbols_data) New destructor.
9580         (Section_relocs::Section_relocs) New constructor.
9581         (Section_relocs::~Section_relocs) New destructor.
9582         (Read_relocs_data::Read_relocs_data) New constructor.
9583         (Read_relocs_data::~Read_relocs_data) New destructor.
9584         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
9585         pointers to NULL after deleting.
9586
9587 2010-04-07  Doug Kwan  <dougkwan@google.com>
9588
9589         * arm.cc: Replace "endianity" with "endianness" in comments.
9590         (Arm_exidx_cantunwind): Ditto.
9591         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
9592         (Arm_relobj::merge_flags_and_attributes): New method.
9593         (Arm_relobj::merge_flags_and_attributes_): New data member.
9594         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
9595         (Arm_relobj::scan_sections_for_stubs): Ditto.
9596         (Arm_relobj::do_read_symbols): Check to see if we really want to
9597         merge processor-specific flags and attributes.  Exit early if
9598         an object is empty except for section names and the undefined symbol.
9599         (Target_arm::do_finalize_sections): Move check for ELF format to
9600         Arm_relobj::do_read_symbols.  Merge processor specific flags and
9601         attributes from a regular object only when we have determined that
9602         it is aapropriate.  Do not create an .ARM.attributes section in
9603         output if there is no regular input object.
9604         (Target_arm::merge_processor_specific_flags): Check
9605         --warn-mismatch before printing any error.
9606         (Target_arm::merge_object_attributes): Ditto.
9607         * gold.cc (queue_middle_tasks): Handle the case in which there is
9608         no regular object in input.
9609         * options.cc (General_options::parse_EB): New method.
9610         (General_options::parse_EL): Same.
9611         (General_options::General_options): Initialize endianness_.
9612         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
9613         New options.
9614         (General_options::Endianness): New enum.
9615         (General_options::endianness): New method.
9616         (General_options::endianness_): New data member.
9617         * parameters.cc (Parameters::set_options): Check target endianness.
9618         (Parameters::set_target_once): Ditto.
9619         (Parameters::check_target_endianness): New method.
9620         (parameters_force_valid_target): If either -EL or -EB is specified,
9621         use it to define endianness of default target.
9622         * parameters.h (Parameters::check_target_endianness): New method
9623         declaration.
9624         * target.h (class Target): Change "endianity" to "endianness"
9625         in comments.
9626
9627 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9628
9629         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
9630         * configure: Regenerate.
9631         * Makefile.in: Regenerate.
9632         * testsuite/Makefile.in: Regenerate.
9633
9634 2010-04-06  Cary Coutant  <ccoutant@google.com>
9635
9636         gcc PR lto/42757
9637         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
9638         prevailing definitions of common symbols.
9639         * testsuite/plugin_test_6.sh: New test case.
9640         * testsuite/plugin_common_test_1.c: New test case.
9641         * testsuite/plugin_common_test_2.c: New test case.
9642         * testsuite/Makefile.am (plugin_test_6): New test case.
9643         * testsuite/Makefile.in: Regenerate.
9644
9645 2010-04-06  Nick Clifton  <nickc@redhat.com>
9646
9647         * po/vi.po: New Vietnamese translation.
9648
9649 2010-03-30  Doug Kwan  <dougkwan@google.com>
9650
9651         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
9652
9653 2010-03-25  Doug Kwan  <dougkwan@google.com>
9654
9655         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
9656         to avoid a conversion warning on a 32-bit host.
9657
9658 2010-03-24  Ian Lance Taylor  <iant@google.com>
9659
9660         * testsuite/script_test_3.t: Add a TLS segment.
9661         * testsuite/Makefile.am (check_PROGRAMS): Add
9662         tls_phdrs_script_test.
9663         (tls_phdrs_script_test_SOURCES): Define.
9664         (tls_phdrs_script_test_DEPENDENCIES): Define.
9665         (tls_phdrs_script_test_LDFLAGS): Define.
9666         (tls_phdrs_script_test_LDADD): Define.
9667         * testsuite/Makefile.in: Rebuild.
9668
9669 2010-03-23  Cary Coutant  <ccoutant@google.com>
9670
9671         * fileread.cc (find_or_make_view): Fix comment.
9672
9673 2010-03-23  Ian Lance Taylor  <iant@google.com>
9674
9675         * script-sections.cc (class Orphan_section_placement): Define
9676         PLACE_TLS and PLACE_TLS_BSS.
9677         (Orphan_section_placement::Orphan_section_placement): Initialize
9678         new places.
9679         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
9680         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
9681         (tls_script_test_SOURCES): Define.
9682         (tls_script_test_DEPENDENCIES): Define.
9683         (tls_script_test_LDFLAGS): Define.
9684         (tls_script_test_LDADD): Define.
9685         * testsuite/Makefile.in: Rebuild.
9686
9687 2010-03-22  Doug Kwan  <dougkwan@google.com>
9688
9689         * arm.cc (Arm_relocate_functions::abs8,
9690         Arm_relocate_functions::abs16): Use correct check for overflow
9691         specified in the ARM ELF specs.
9692         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
9693         target of a BLX instruction specially.
9694         (Reloc_stub::stub_type_for_reloc): Ditto.
9695         (Relocate::relocate): Use symbolic names instead of numeric relocation
9696         codes to report error.
9697         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
9698         workaround.
9699         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
9700         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
9701         thumb2_blx_out_of_range.stdout
9702         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
9703         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
9704         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
9705         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
9706         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
9707         thumb2_blx_in_range, thumb2_blx_in_range.o,
9708         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
9709         thumb2_blx_out_of_range.o): New rules.
9710         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
9711         thumb2_blx_in_range and thumb2_blx_out_of_range.
9712         * testsuite/Makefile.in: Regenerate.
9713         * arm_branch_in_range.sh: Add tests for THUMB BLX.
9714         * testsuite/thumb_blx_in_range.s: New file.
9715         * testsuite/thumb_blx_out_of_range.s: New file.
9716
9717 2010-03-22  Rafael Espindola  <espindola@google.com>
9718
9719         * archive.cc (Should_include): Move to archive.h.
9720         (should_include_member): Make it a member of Archive.
9721         (Lib_group): New.
9722         (Add_lib_group_symbols): New.
9723         * archive.h: Include options.h.
9724         (Archive_member): Moved from Archive.
9725         (Should_include): Moved from archive.cc.
9726         (Lib_group): New.
9727         (Add_lib_group_symbols): New.
9728         * dynobj.cc (do_should_include_member): New.
9729         * dynobj.h (do_should_include_member): New.
9730         * gold.cc (queue_initial_tasks): Update call to queue.
9731         * main.cc (main): Print lib group stats.
9732         * object.cc (do_should_include_member): New.
9733         * object.h: Include archive.h.
9734         (Object::should_include_member): New.
9735         (Object::do_should_include_member): New.
9736         (Sized_relobj::do_should_include_member): New.
9737         * options.cc (General_options::parse_start_lib): New.
9738         (General_options::parse_end_lib): New.
9739         (Input_arguments::add_file): Handle lib groups.
9740         (Input_arguments::start_group): Check we are not in a lib.
9741         (Input_arguments::start_lib): New.
9742         (Input_arguments::end_lib): New.
9743         * options.h (General_options): Add start_lib and end_lib.
9744         (Input_argument::lib_): New.
9745         (Input_argument::lib): New.
9746         (Input_argument::is_lib): New.
9747         (Input_file_lib): New.
9748         (Input_arguments::in_lib_): New.
9749         (Input_arguments::in_lib): New.
9750         (Input_arguments::start_lib): New.
9751         (Input_arguments::end_lib_): New.
9752         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
9753         in unused members as preempted.
9754         (Sized_pluginobj::do_should_include_member): New.
9755         * plugin.h (Sized_pluginobj::do_should_include_member): New.
9756         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
9757         return the blocker.
9758         (Read_symbols::do_whole_lib_group): New.
9759         (Read_symbols::do_lib_group): New.
9760         (Read_symbols::do_read_symbols): Handle lib groups.
9761         (Read_symbols::get_name): Handle lib groups.
9762         * readsyms.h (Read_symbols): Add an archive member pointer.
9763         (Read_symbols::do_whole_lib_group): New.
9764         (Read_symbols::do_lib_group): New.
9765         (Read_symbols::member_): New.
9766         * script.cc (read_input_script): Update call to queue_soon.
9767
9768 2010-03-19  Doug Kwan  <dougkwan@google.com>
9769
9770         * arm.cc (Stub_table::Stub_table): Initialize new data members
9771         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9772         (Stub_table::add_reloc_stub): Assign stub offset and update
9773         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9774         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
9775         New data members.
9776         (Stub_table::update_data_size_and_addralign): Use
9777         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
9778         instead of going over all reloc stubs.
9779         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
9780         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9781         Stringpool_template::offset_ to size of Stringpool_char.
9782         (Stringpool_template::new_key_offset): Remove code to initialize
9783         Stringpool_template::offset_.
9784         * stringpool.h (Stringpool_template::set_no_zero_null): Set
9785         Stringpool_template::offset_ to zero.
9786
9787 2010-03-15  Doug Kwan  <dougkwan@google.com>
9788
9789         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9790         offset_.
9791         (Stringpool_template::new_key_offset): New method.
9792         (Stringpool_template::add_string): Assign offsets when adding new
9793         strings.
9794         (Stringpool_template::set_string_offsets): Do not set string offsets
9795         when not optimizing.
9796         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
9797         member size_.
9798         (Chunked_vector::clear): Clear size_.
9799         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
9800         (Chunked_vector::size): Return size_.
9801         (Chunked_vector::push_back): Use size_ to find insert position.
9802         (Chunked_vector::size_): New data member.
9803         (Stringpool_template::set_no_zero_null): Assert string set is empty.
9804         (Stringpool_template::new_key_offset): New method declaration.
9805         (Stringpool_template::offset_): New data member.
9806
9807 2010-03-15   Rafael Espindola  <espindola@google.com>
9808
9809         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
9810         Add_symbols' constructor.
9811         * readsyms.h (Add_symbols): Remove the input_group member.
9812
9813 2010-03-10  Ian Lance Taylor  <iant@google.com>
9814
9815         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
9816         target to ask whether a reference to a symbol requires a stack
9817         split.
9818         * target.h (Target::is_call_to_non_split): New function.
9819         (Target::do_is_call_to_non_split): Declare virtual function.
9820         * target.cc: Include "symtab.h".
9821         (Target::do_is_call_to_non_split): New function.
9822         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
9823
9824 2010-03-10  Cary Coutant  <ccoutant@google.com>
9825
9826         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
9827         (File_read::open[1]): Remove initial mapping of whole_file_view_.
9828         (File_read::open[2]): Add whole_file_view_ to list of views.
9829         (File_read::make_view): Remove test of whole_file_view_.
9830         (File_read::find_or_make_view): Create whole_file_view_ if
9831         necessary.
9832         (File_read::clear_views): Replace bool parameter with enum;
9833         adjust all callers.  Don't delete views with permanent data;
9834         do delete cached views and views from archives if
9835         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
9836         if clearing the corresponding view.
9837         * fileread.h (File_read::Clear_views_mode): New enum.
9838         (File_read::View::is_permanent_view): New method.
9839         (File_read::clear_views): Replace bool parameter
9840         with enum; adjust all callers.
9841         * options.h (General_options): Change keep_files_mapped option;
9842         add map_whole_files.
9843         * readsyms.cc (Add_symbols::run): Delete sd_ object before
9844         releasing the file.
9845         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
9846         the file.
9847
9848 2010-03-10  David S. Miller  <davem@davemloft.net>
9849
9850         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
9851
9852 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
9853
9854         * icf.cc (get_section_contents): Add '@' marker after processing the
9855         merge reloc.
9856
9857 2010-03-08  Doug Kwan  <dougkwan@google.com>
9858
9859         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
9860         due to a conversion warning.
9861         (Arm_relobj::update_output_local_symbol_count): Check for local
9862         symbol with unset output index.
9863
9864 2010-03-05  Ian Lance Taylor  <iant@google.com>
9865
9866         * options.h (class General_options): Add --spare-dynamic-tags.
9867         * output.cc (Output_data_dynamic::set_final_data_size): Implement
9868         --spare-dynamic-tags.
9869
9870 2010-03-05  Ian Lance Taylor  <iant@google.com>
9871
9872         * incremental.cc: Include "libiberty.h".
9873
9874 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
9875
9876         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
9877         function, is_info_ member.
9878         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
9879         (Versions::Versions): Update caller.
9880         (Versions::define_base_version): Likewise.
9881         (Versions::add_def): Likewise.
9882
9883 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
9884
9885         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
9886         (Scan::possible_function_pointer_reloc): New function.
9887         (Scan::local_reloc_may_be_function_pointer): Change to call
9888         possible_function_pointer_reloc.
9889         (Scan::global_reloc_may_be_function_pointer): Ditto.
9890         * icf.h (Icf::check_section_for_function_pointers): Change to reject
9891         relocations in ".data.rel.ro._ZTV" section.
9892         * testsuite/icf_safe_so_test.sh: Change to pass i386.
9893         * testsuite/icf_safe_so_test.cc: Ditto.
9894         * testsuite/icf_safe_test.cc: Ditto.
9895         * testsuite/icf_safe_test.sh: Ditto.
9896
9897 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9898             Ian Lance Taylor  <iant@google.com>
9899
9900         * target-reloc.h (relocate_section): Check the symbol table index
9901         for -1U before setting the local symbol index.
9902         (scan_relocatable_relocs): If copying the relocation, record that
9903         the local symbol is required.
9904         * object.h (Symbol_value::is_output_symtab_index_set): New
9905         function.
9906         (Symbol_value::may_be_discarded_from_output_symtab): New
9907         function.
9908         (Symbol_value::has_output_symtab_entry): New function.
9909         (Symbol_value::needs_output_symtab_entry): Remove.
9910         (Symbol_value::output_symtab_index): Make sure the symbol index is
9911         set.
9912         (Symbol_value::set_output_symtab_index): Make sure the symbol
9913         index is not set.  Make sure the new index is valid.
9914         (Symbol_value::set_must_have_output_symtab_entry): New function.
9915         (Symbol_value::has_output_dynsym_entry): New function.
9916         (Symbol_value::set_output_dynsym_index): Make sure the new index
9917         is valid.
9918         (Sized_relobj::set_must_have_output_symtab_entry): New function.
9919         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
9920         local symbol if permitted.
9921         (Sized_relobj::do_finalize_local_symbols): Call
9922         is_output_symtab_index_set rather than needs_output_symtab_entry.
9923         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
9924         rather than needs_output_symtab_entry.  Call
9925         has_output_dynsym_entry rather than needs_output_dynsym_entry.
9926         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
9927         is_output_symtab_index_set rather than needs_output_symtab_entry.
9928         * testsuite/discard_locals_relocatable_test.c: New file.
9929         * testsuite/discard_locals_test.sh: Test -r.
9930         * testsuite/Makefile.am (check_DATA): Add
9931         discard_locals_relocatable_test1.syms,
9932         discard_local_relocatable_test2.syms.
9933         (MOSTLYCLEANFILES): Likewise.  Also add
9934         discard_locals_relocatable_test1.lout and
9935         discard_locals_relocatable_test2.out.
9936         (discard_locals_relocatable_test1.syms): New target.
9937         (discard_locals_relocatable_test.o): New target.
9938         (discard_locals_relocatable_test1.out): New target.
9939         (discard_locals_relocatable_test2.syms): New target.
9940         (discard_locals_relocatable_test2.out): New target.
9941         (various): Add missing ../ld-new dependencies.
9942         * testsuite/Makefile.in: Rebuild.
9943
9944 2010-03-03  Nick Clifton  <nickc@redhat.com>
9945
9946         * po/fi.po: New Finnish translation.
9947
9948 2010-03-01  Doug Kwan  <dougkwan@google.com>
9949
9950         * layout.cc (Layout::Layout): Force section types of .init_array*,
9951         .preinit_array* and .fini_array* sections.
9952         * output.cc (Output_section::Input_section_sort_entry::has_priority):
9953         Fix check of return value of std::string::find.().
9954         (Output_section::Input_section_sort_compare::operator()): Remove
9955         comment about .init_array.
9956         (Output_section::Input_section_sort_init_fini_compare::operator()):
9957         New method.
9958         (Output_section::sort_attached_input_sections): Handle .init_array
9959         and .fini_array specially.
9960         * output.h (Output_section::Inut_section_sort_compare): Update
9961         comment.
9962         (Output_section::Input_section_sort_init_fini_compare): New struct.
9963
9964 2010-02-26  Doug Kwan  <dougkwan@google.com>
9965
9966         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9967         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9968         * testsuite/debug_msg.sh: Avoid matching source line number for
9969         use of global variable undef_int.
9970
9971 2010-02-26  Doug Kwan  <dougkwan@google.com>
9972
9973         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9974         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9975         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9976         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9977         * options.cc (General_options::General_options): Initialize member
9978         fix_v4bx_.
9979         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9980         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9981         and rm_no_fix_v4bx.stdout
9982         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9983         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9984         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9985         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9986         and arm_no_fix_v4bx.
9987         * Makefile.in: Regenerate.
9988         * testsuite/arm_fix_v4bx.s: New file.
9989         * testsuite/arm_fix_v4bx.sh: Ditto.
9990
9991 2010-02-24  Doug Kwan  <dougkwan@google.com>
9992
9993         * arm.cc (Target_arm::got_section): Make the .got section the first
9994         non RELRO section in the data segment.
9995         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9996         suffixes of section names.
9997
9998 2010-02-24  Doug Kwan  <dougkwan@google.com>
9999
10000         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
10001         flags and attributes merging if an input file is a binary file.
10002         * fileread.cc (Input_file::open): Record format of original file.
10003         * fileread.h (Input_file::Format): New enum type.
10004         (Input_file::Input_file): Initialize data member format_.
10005         (Input_file::format): New method definition.
10006         (Input_file::format_):: New data member.
10007
10008 2010-02-24  Doug Kwan  <dougkwan@google.com>
10009
10010         * arm.cc (Arm_output_data_got): New class.
10011         (ARM_TCB_SIZE): New constant
10012         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
10013         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
10014         If user uses a script with a SECTIONS clause, issue only a warning
10015         for a misplaced EXIDX input section.  Otherwise, issue an error.
10016         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
10017         garbage collection.
10018         (Target_arm::got_mode_index_entry): Handle static linking.
10019         (Target_arm::Scan::local): Ditto.
10020         (Target_arm::Scan::global): Ditto.
10021         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
10022         all incorrectly implemented relocations.
10023         (Target_arm::fix_exidx_coverage): Pass layout to
10024         Arm_output_section::fix_exidx_coverage.
10025         * layout.cc (Layout::section_name_mapping): Remove trailing dots
10026         from ".ARM.exidx." and ".ARM.extab.".
10027
10028 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10029
10030         * arm.cc (Target_arm::do_finalize_sections): Create attribute
10031         section if it does not already exist.
10032         * attributes.cc (Attributes_section_data::Attributes_section_data):
10033         Don't crash if size is zero.
10034
10035 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10036             Ian Lance Taylor  <iant@google.com>
10037
10038         * gold.cc (queue_middle_tasks): If no input files were opened,
10039         exit.
10040         * workqueue.h (Task_function::Task_function): Assert that there is
10041         a blocker.
10042
10043 2010-02-22  Doug Kwan  <dougkwan@google.com>
10044
10045         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
10046         * icf.cc (get_section_contents): Cast snprintf arguments to long long
10047         types to avoid warnings due to different uint64_t implementations
10048         on different hosts.
10049
10050 2010-02-21  Doug Kwan  <dougkwan@google.com>
10051
10052         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
10053         handling of the maximum backward branch offset.
10054         (Arm_relocate_functions::thumb_branch_common): Ditto.
10055         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
10056         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
10057         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
10058         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
10059         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
10060         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
10061         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
10062         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
10063         thumb_bl_out_of_range thumb_bl_out_of_range.o,
10064         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
10065         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
10066         thumb2_bl_out_of_range.o): New rules.
10067         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
10068         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
10069         thumb2_bl_out_of_range
10070         * testsuite/Makefile.in: Regenerate.
10071         * testsuite/arm_bl_in_range.s: New file.
10072         * testsuite/arm_bl_out_of_range.s: Ditto.
10073         * testsuite/arm_branch_in_range.sh: Ditto.
10074         * testsuite/arm_branch_range.t: Ditto.
10075         * testsuite/thumb2_branch_range.t: Ditto.
10076         * testsuite/thumb_bl_in_range.s: Ditto.
10077         * testsuite/thumb_bl_out_of_range.s: Ditto.
10078         * testsuite/thumb_branch_range.t: Ditto.
10079
10080 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
10081
10082         * gc.h (gc_process_relocs): Change vectors to point to the new list.
10083         Add reloc offset information.
10084         * icf.cc (get_section_contents): Change iterators to point to the new
10085         vectors. Add reloc offset information to the contents.
10086         * icf.h (Icf::Sections_reachable_info): New typedef.
10087         (Icf::Sections_reachable_list): New typedef.
10088         (Icf::Offset_info): New typedef.
10089         (Icf::Reloc_info): New struct typedef.
10090         (Icf::Reloc_info_list): New typedef.
10091         (Icf::symbol_reloc_list): Delete method.
10092         (Icf::addend_reloc_list): Delete method.
10093         (Icf::section_reloc_list): Delete method.
10094         (Icf::reloc_info_list): New method.
10095         (Icf::reloc_info_list_): New member.
10096
10097 2010-02-19  Doug Kwan  <dougkwan@google.com>
10098
10099         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
10100         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
10101         * arm.cc (Arm_relocation_functions): New forward declaration.
10102         (Target_arm::Target_arm): Initialize new data members
10103         got_mod_index_offset_ and tls_base_symbol_defined_.
10104         (Target_arm::Relocate::relocate_tls): New method.
10105         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
10106          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
10107         New methods.
10108         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
10109         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
10110         (Target_arm::got_mod_index_offset_,
10111         Target_arm::tls_base_symbol_defined_): New data members.
10112         (Target_arm::Scan::local, Target::Scan::global,
10113         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
10114         relocations.
10115
10116 2010-02-18  Doug Kwan  <dougkwan@google.com>
10117
10118         * arm.cc (Arm_relobj::find_linked_text_section): New method.
10119         (Arm_relobj::make_exidx_input_section): Pass section index of linked
10120         text section as a parameter becuase some broken tools may not set
10121         the link in section header.
10122         (Target_arm::has_got_section): New method.
10123         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
10124         without any mapping symbol as data only.  Remove warning.
10125         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
10126         link in its section header, try to discover the link by inspecting the
10127         REL31 relocation at the beginning of the section.
10128         (Target_arm::Scan::check_non_pic): Report name of offending relocation
10129         in error message.
10130         (Target_arm::Scan::global): Treat any reference to the symbol
10131         _GLOBAL_OFFSET_TABLE_ as a GOT access.
10132
10133 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
10134
10135         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
10136         (Scan::global_reloc_may_be_function_pointer): New function.
10137         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10138         (Scan::global_reloc_may_be_function_pointer): New function.
10139         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10140         (Scan::global_reloc_may_be_function_pointer): New function.
10141         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
10142         (Scan::global_reloc_may_be_function_pointer): New function.
10143         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
10144         (Scan::global_reloc_may_be_function_pointer): New function.
10145         (Scan::possible_function_pointer_reloc): New function.
10146         (Target_x86_64::can_check_for_function_pointers): New function.
10147         * gc.h (gc_process_relocs): Scan relocation types to determine if
10148         function pointers were taken for targets that support it.
10149         * icf.cc (Icf::find_identical_sections): Include functions for
10150         folding in safe ICF whose pointer is not taken.
10151         * icf.h (Secn_fptr_taken_set): New typedef.
10152         (fptr_section_id_): New member.
10153         (section_has_function_pointers): New function.
10154         (set_section_has_function_pointers): New function.
10155         (check_section_for_function_pointers): New function.
10156         * options.h: Fix comment for safe ICF option.
10157         * target.h (can_check_for_function_pointers): New function.
10158         * testsuite/Makefile.am: Add icf_safe_so_test test case.
10159         Modify icf_safe_test for X86-64.
10160         * testsuite/Makefile.in: Regenerate.
10161         * testsuite/icf_safe_so_test.cc: New file.
10162         * testsuite/icf_safe_so_test.sh: New file.
10163         * testsuite/icf_safe_test.cc (kept_func_3): New function.
10164         (main): Change to take pointer to function kept_func_3.
10165         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
10166         folding is done correctly for X86-64.
10167
10168 2010-02-12  David S. Miller  <davem@davemloft.net>
10169
10170         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
10171         is_symbolless parameter.
10172         (Output_reloc<SHT_REL>::is_symbolless): New.
10173         (Output_reloc<SHT_REL>::is_symbolless_): New.
10174         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
10175         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
10176         (Output_reloc<SHT_RELA>::is_symbolless): New.
10177         (Output_data_reloc::add_global): Handle is_symbolless.
10178         (Output_data_reloc::add_global_relative): Likewise.
10179         (Output_data_reloc::add_local): Likewise.
10180         (Output_data_reloc::add_local_relative): Likewise.
10181         (Output_data_reloc::add_symbolless_global_addend): New.
10182         (Output_data_reloc::add_symbolless_local_addend): New.
10183         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
10184         is_symbolless.
10185         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
10186         instead of ->is_relative_
10187         (Output_reloc::write): Likewise.
10188         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
10189         (Output_reloc::write_rel): Simplify.
10190
10191         * sparc.cc (Target_sparc::Scan::local): Use
10192         ->add_symbolless_local_addend as needed.
10193         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
10194         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
10195         based upon relocation offset.
10196
10197 2010-02-11  Doug Kwan  <dougkwan@google.com>
10198
10199         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
10200         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
10201         beginning of function.
10202         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
10203         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
10204         parameter is_32bit in calls to should_apply_static_reloc.
10205         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
10206         (check_DATA): Add arm_abs_global.stdout.
10207         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
10208         arm_abs_global.stdout): New rules.
10209         (MOSTLLYCLEANFILES): Add arm_abs_global
10210         * Makefile.in: Regenerate.
10211         * testsuite/arm_abs_global.s: New file.
10212         * testsuite/arm_abs_global.sh: Ditto.
10213         * testsuite/arm_abs_lib.s: Ditto.
10214
10215 2010-02-11  Ian Lance Taylor  <iant@google.com>
10216
10217         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
10218         Read_relocs task.
10219         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
10220         Allocate_commons_task first.
10221         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
10222         task, rather than symtab_lock_.
10223         (Gc_process_relocs::~Gc_process_relocs): New function.
10224         (Gc_process_relocs::is_runnable): Check this_blocker_.
10225         (Gc_process_relocs::locks): Use next_blocker_ rather than
10226         blocker_.
10227         (Scan_relocs::~Scan_relocs): New function.
10228         (Scan_relocs::is_runnable): Check this_blocker_ rather than
10229         symtab_lock_.
10230         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
10231         next_blocker_.
10232         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
10233         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
10234         constructor accordingly.
10235         (class Gc_process_relocs): Likewise.
10236         (class Scan_relocs): Likewise.
10237         * common.h (class Allocate_commons_task): Remove symtab_lock_
10238         field, and corresponding constructor parameter.
10239         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
10240         symtab_lock_.
10241         (Allocate_commons_task::locks): Likewise.
10242
10243 2010-02-11  Ian Lance Taylor  <iant@google.com>
10244
10245         * gold-threads.h (class Once): Define.
10246         (class Initialize_lock): Rewrite as child of Once.
10247         * gold-threads.cc (class Once_initialize): Define.
10248         (once_pointer_control): New static variable.
10249         (once_pointer, once_arg): New static variables.
10250         (c_run_once): New static function.
10251         (Once::Once, Once::run_once, Once::internal_run): New functions.
10252         (class Initialize_lock_once): Remove.
10253         (initialize_lock_control): Remove.
10254         (initialize_lock_pointer): Remove.
10255         (initialize_lock_once): Remove.
10256         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
10257         (Initialize_lock::initialize): Rewrite.
10258         (Initialize_lock::do_run_once): New function.
10259         * archive.cc (Archive::interpret_header): Only clear name if it is
10260         not already empty.
10261         * fileread.cc: Include "gold-threads.h"
10262         (file_counts_lock): New static variable.
10263         (file_counts_initialize_lock): Likewise.
10264         (File_read::release): Only increment counts when using --stats.
10265         Use a lock around the increment.
10266         * parameters.cc (class Set_parameters_target_once): Define.
10267         (set_parameters_target_once): New static variable.
10268         (Parameters::Parameters): Move here from parameters.h.
10269         (Parameters::set_target): Rewrite.
10270         (Parameters::set_target_once): New function.
10271         (Parameters::clear_target): Move here and rewrite.
10272         * parameters.h (class Parameters): Update declarations.  Add
10273         set_parameters_target_once_ field.
10274         (Parameters::Parameters): Move to parameters.cc.
10275         (Parameters::clear_target): Likewise.
10276         * readsyms.cc (Read_symbols::do_group): Create a Start_group
10277         task.
10278         (Start_group::~Start_group): New function.
10279         (Start_group::is_runnable): New function.
10280         (Start_group::locks, Start_group::run): New functions.
10281         (Finish_group::run): Change saw_undefined to size_t.
10282         * readsyms.h (class Start_group): Define.
10283         (class Finish_group): Change saw_undefined_ field to size_t.
10284         (Finish_group::Finish_group): Remove saw_undefined and
10285         this_blocker parameters.  Change all callers.
10286         (Finish_group::set_saw_undefined): New function.
10287         (Finish_group::set_blocker): New function.
10288         * symtab.h (class Symbol_table): Change saw_undefined to return
10289         size_t.  Change saw_undefined_ field to size_t.
10290         * target-select.cc (Set_target_once::do_run_once): New function.
10291         (Target_selector::Target_selector): Initialize set_target_once_
10292         field.  Don't initialize lock_ and initialize_lock_ fields.
10293         (Target_selector::instantiate_target): Rewrite.
10294         (Target_selector::set_target): New function.
10295         * target-select.h (class Set_target_once): Define.
10296         (class Target_selector): Update declarations.  Make
10297         Set_target_once a friend.  Remove lock_ and initialize_lock_
10298         fields.  Add set_target_once_ field.
10299
10300 2010-02-10  Ian Lance Taylor  <iant@google.com>
10301
10302         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
10303         queueing any tasks.
10304         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
10305         (queue_middle_tasks): Add all blockers before queueing any tasks.
10306         (queue_final_tasks): Likewise.
10307         * token.h (Task_token::add_blockers): New function.
10308         * object.h (Input_objects::number_of_relobjs): New function.
10309
10310 2010-02-10  Ian Lance Taylor  <iant@google.com>
10311
10312         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
10313         shared, not if not position independent.
10314         * x86_64.cc (Relocate::relocate_tls): Likewise.
10315         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
10316         (tls_pie_pic_test): New target.
10317         * testsuite/Makefile.in: Rebuild.
10318
10319         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
10320         (tls_test_main_pie.o, tls_test_pie.o): New targets.
10321         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
10322         * testsuite/Makefile.in: Rebuild.
10323
10324 2010-02-09  David S. Miller  <davem@davemloft.net>
10325
10326         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
10327         R_SPARC_RELATIVE using ->add_local_relative().
10328         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
10329
10330         * output.h (Output_data_dynamic::add_section_size): New method
10331         that takes two Output_data objects.
10332         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
10333         entry param.  Handle it in initializers.
10334         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
10335         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
10336         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
10337         arg.
10338         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
10339         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
10340         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
10341         for dynrel_includes_plt.
10342         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10343         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10344         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
10345         before .rela.plt
10346         (Target_sparc::do_finalize_sections): Update to pass true for
10347         dynrel_includes_plt.
10348         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
10349         output before .rela.plt
10350         (Target_powerpc::do_finalize_sections): Update to pass true for
10351         dynrel_includes_plt when 32-bit.
10352
10353 2010-02-08  Doug Kwan  <dougkwan@google.com>
10354
10355         * arm.cc (Arm_relobj::simple_input_section_output_address): New
10356         method.
10357         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
10358         Arm_relobj::scan_section_for_cortex_a8_stubs,
10359         Arm_relobj::do_relocation_section): Instead of calling
10360         Output_section::output_address, use faster
10361         Arm_relobj::simple_input_section_output_address.
10362
10363 2010-02-08  David S. Miller  <davem@davemloft.net>
10364
10365         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
10366         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
10367         relocation helper function.
10368
10369         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
10370         just like R_SPARC_GOT{10,13,22}.
10371         (Target_sparc::Scan::local): Likewise.
10372         (Target_sparc::Relocate:relocate): Likewise.
10373
10374 2010-02-06  Ian Lance Taylor  <iant@google.com>
10375
10376         * configure.ac: Rewrite targetobjs duplicate removal code to use
10377         only shell constructs.
10378         * configure: Rebuild.
10379
10380 2010-02-05  Doug Kwan  <dougkwan@google.com>
10381
10382         PR 11247
10383         * arm.cc (Arm_relobj::section_is_scannable): New method.
10384         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
10385         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
10386
10387 2010-02-04  Doug Kwan  <dougkwan@google.com>
10388
10389         PR 11247
10390         * arm-reloc-property.cc (cstdio): Include.
10391         * configure.ac (targetobjs): Remove duplicates.
10392         * configure: Regenerate.
10393         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
10394         big and little endian version for a given address size.
10395
10396 2010-02-03  Doug Kwan  <dougkwan@google.com>
10397
10398         * arm-reloc-property.cc
10399         (Arm_reloc_property_table::reloc_name_in_error_message): New method
10400         definition.
10401         * arm-reloc-property.h
10402         (Arm_reloc_property_table::get_implemented_static_reloc_property):
10403         New method definition.
10404         (Arm_reloc_property_table::reloc_name_in_error_message): New method
10405         declaration.
10406         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
10407         overflow to N.
10408         (GOT_PREL): Change implemented to Y.
10409         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
10410         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
10411         (Arm_relocate_functions::movw_abs_nc): Remove method.
10412         (Arm_relocate_functions::movt_abs): Ditto.
10413         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
10414         (Arm_relocate_functions::thm_movt_abs): Ditto.
10415         (Arm_relocate_functions::movw_rel_nc): Ditto.
10416         (Arm_relocate_functions::movw_rel): Ditto.
10417         (Arm_relocate_functions::movt_rel): Ditto.
10418         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
10419         (Arm_relocate_functions:thm_movw_rel): Ditto.
10420         (Arm_relocate_functions:thm_movt_rel): Ditto.
10421         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
10422         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
10423         New method definitions.
10424         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
10425         (Arm_relocation_functions::arm_grp_ldr): Ditto.
10426         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
10427         (Arm_relocation_functions::arm_grp_ldc): Ditto.
10428         (Target_arm::Relocate::relocate): Check for non-static or
10429         unimplemented relocation code and exit early.  Change calls to
10430         Target_arm::reloc_uses_thumb_bit and
10431         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
10432         instead.  Refactor code to handle similar relocations to increase
10433         code sharing.  Remove check for unsupported relocation code in switch
10434         statement.
10435         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
10436         relocation property table to find out size.  Change error message to
10437         print out the name of a relocation code instead of the numeric value.
10438         (Target_arm::scan_reloc_for_stub): Use relocation property table
10439         instead of calling Target_arm::reloc_uses_thumb_bit().
10440
10441 2010-02-02  Doug Kwan  <dougkwan@google.com>
10442
10443         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
10444         types of relaxed input section.
10445
10446 2010-02-02  Doug Kwan  <dougkwan@google.com>
10447
10448         * Makefile.am (HFILES): Add arm-reloc-property.h.
10449         (DEFFILES): New.
10450         (TARGETSOURCES): Add arm-reloc-property.cc
10451         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
10452         (libgold_a_SOURCES): $(DEFFILES)
10453         * Makefile.in: Regenerate.
10454         * arm-reloc-property.cc: New file.
10455         * arm-reloc-property.h: New file.
10456         * arm-reloc.def: New file.
10457         * arm.cc: Update comments.
10458         (arm-reloc-property.h): New included header.
10459         (arm_reloc_property_table): New global variable.
10460         (Target_arm::do_select_as_default_target): New method definition.
10461         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
10462         arm-reloc-property to targ_extra_obj.
10463         * parameters.cc (set_parameters_target): Call
10464         Target::select_as_default_target().
10465         * target.h (Target::select_as_default_target): New method definition.
10466         (Target::do_select_as_default_target): Same.
10467
10468 2010-02-01  Doug Kwan  <dougkwan@google.com>
10469
10470         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
10471         first_output_text_section_.
10472         (Arm_exidx_fixup::first_output_text_section): New method definition.
10473         (Arm_exidx_fixup::first_output_text_section_): New data member.
10474         (Arm_exidx_fixup::process_exidx_section): Record the first text
10475         output section seen.
10476         (Arm_output_section::fix_exidx_coverage): Set correct linked section
10477         and entsize in output section header.
10478
10479 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10480
10481         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
10482         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
10483         (Arm_relocate_functions::thm_alu11): New Method.
10484         (Arm_relocate_functions::thm_pc8): New Method.
10485         (Arm_relocate_functions::thm_pc12): New Method.
10486         (Target_arm::Scan::local): Handle the relocations.
10487         (Target_arm::Scan::global): Likewise.
10488         (Target_arm::Relocate::relocate): Likewise.
10489         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10490
10491 2010-01-29  Doug Kwan  <dougkwan@google.com>
10492
10493         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
10494         of relocation types as ld.
10495
10496 2010-01-29  Doug Kwan  <dougkwan@google.com>
10497
10498         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
10499         to public.
10500         (Arm_relocate_functions::thumb_branch_common): Ditto.
10501         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
10502         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
10503         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
10504         Arm_relocate_functions::jump24): Remove.
10505         (Target_arm::Relocate::relocate): Adjust code to call
10506         Arm_relocation_functions::arm_branch_common and
10507         Arm_relocation_functions::thumb_branch_common instead of their removed
10508         wrappers.  Merge switch-cases together to reduce source code size.
10509
10510 2010-01-29  Doug Kwan  <dougkwan@google.com>
10511
10512         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
10513         output_local_symbol_count_needs_update_.
10514         (Arm_relobj::output_local_symbol_count_needs_update,
10515          Arm_relobj::set_output_local_symbol_count_needs_update,
10516          Arm_relobj::update_output_local_symbol_count): New methods.
10517         (Arm_relobj::output_local_symbol_count_needs_update_): New data
10518         member.
10519         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
10520         of pointed function as in a R_ARM_PREL31 relocation.
10521         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
10522         for output local symbol count updating.
10523         (Target_arm::do_relax): Update output local symbol counts in objects
10524         if necessary.
10525         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
10526
10527 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10528
10529         * arm.cc: Added support for the ARM relocations:
10530         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
10531         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
10532         (Arm_relocate_functions::movw_rel_nc): Renamed (was
10533         movw_prel_nc).
10534         (Arm_relocate_functions::movw_rel): New method.
10535         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
10536         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
10537         thm_movw_prel_nc).
10538         (Arm_relocate_functions::thm_movw_rel): New method.
10539         (Arm_relocate_functions::thm_movt_rel): Renamed (was
10540         thm_movt_prel).
10541         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
10542         relocations.
10543         (Target_arm::Scan::global): Likewise.
10544         (Target_arm::Relocate::relocate): Likewise.
10545         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10546         Likewise.
10547
10548 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10549
10550         * arm.cc: Added support for ARM group relocations.
10551         (Target_arm::reloc_needs_sym_origin): New method.
10552         (Arm_relocate_functions::calc_grp_kn): New method.
10553         (Arm_relocate_functions::calc_grp_residual): New method.
10554         (Arm_relocate_functions::calc_grp_gn): New method.
10555         (Arm_relocate_functions::arm_grp_alu): New Method.
10556         (Arm_relocate_functions::arm_grp_ldr): New Method.
10557         (Arm_relocate_functions::arm_grp_ldrs): New Method.
10558         (Arm_relocate_functions::arm_grp_ldc): New Method.
10559         (Target_arm::Scan::local): Handle the ARM group relocations.
10560         (Target_arm::Scan::global): Likewise.
10561         (Target_arm::Relocate::relocate): Likewise.
10562         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10563         Likewise.
10564
10565 2010-01-26  Doug Kwan  <dougkwan@google.com>
10566
10567         * arm.cc (set): Include.
10568         (class Arm_exidx_fixup): Change type of last_input_section_ to const
10569         pointer type.
10570         (Arm_output_section::Text_section_list): New type.
10571         (Arm_output_section::append_text_sections_to_list): New method.
10572         (Arm_output_section::fix_exidx_coverage): Ditto.
10573         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
10574         (Arm_relobj::convert_input_section_to_relaxed_section): Use
10575         Relobj::set_section_offset() instead of
10576         Sized_relobj::invalidate_section_offset().
10577         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
10578         parameter for section headers. Ignore relocation sections for
10579         unallocated sections and EXIDX sections.
10580         (Target_arm::fix_exidx_coverage): New method.
10581         (Target_arm::output_section_address_less_than): New type.
10582         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
10583         linked text section instead of the EXIDX section.
10584         (Arm_output_section::create_stub_group): Add an assertion to check
10585         that this is not an EXIDX output section.
10586         (Arm_output_section::append_text_sections_to_list): New method.
10587         (Arm_output_section::fix_exidx_coverage): Ditto.
10588         (Arm_relobj::scan_sections_for_stubs): Adjust call to
10589         Arm_relobj::section_needs_reloc_stub_scanning.
10590         (Target_arm::do_relax): Fix EXIDX output section coverage in the
10591         first pass.
10592         (Target_arm::fix_exidx_coverage): New method.
10593         * object.h (Relobj::set_output_section): New method.
10594         (Sized_relobj::invalidate_section_offset): Remove method.
10595         (Sized_relobj::do_invalidate_section_offset): Remove method.
10596         (Sized_relobj::do_set_section_offset): Handle offset value -1.
10597
10598 2010-01-25  Doug Kwan  <dougkwan@google.com>
10599
10600         * arm.cc (Arm_exidx_merged_section::do_output_offset):
10601         Fix warning due to signed and unsigned comparison on a 32-bit host.
10602
10603 2010-01-22  Doug Kwan  <dougkwan@google.com>
10604
10605         * arm.cc (Target_arm::do_relax): Record an output section for section
10606         offset adjustment it contains any stub table that has changed.
10607         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
10608         offsets in an output section if necessary.
10609         * output.cc (Output_section::Output_section): Initialize
10610         section_offsets_need_adjustments_.
10611         (Output_section::add_input_section_for_script): Renamed to
10612         Output_section::add_simple_input_section.
10613         (Output_section::save_states): Add a comment.
10614         (Output_section::discard_states): New method defintion.
10615         (Output_section::adjust_section_offsets): Same.
10616         * output.h (Output_section::add_input_section_for_script): Renamed to
10617         Output_section::add_simple_input_section.
10618         (Output_section::discard_states): New method declaration.
10619         (Output_section::adjust_section_offsets): Same.
10620         (Output_section::section_offsets_need_adjustment,
10621         Output_section::set_section_offsets_need_adjustment): New method
10622         definitions.
10623         (Output_section::section_offsets_need_adjustment_): New data member.
10624         * script-sections.cc
10625         (Output_section_element_input::set_section_address): Adjust code for
10626         renaming of Output_section::add_input_section_for_script.
10627         (Orphan_output_section::set_section_address): Same.
10628
10629 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10630
10631         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
10632         Fix_v4bx enum values .
10633         * gold/options.h (General_options): New option definitions.
10634         (General_options::fix_v4bx): New method.
10635         (General_options::Fix_v4bx): New enum.
10636         * gold/options.cc (General_options::parse_fix_v4bx): New method.
10637         (General_options::parse_fix_v4bx_interworking): New method.
10638
10639 2010-01-22  Doug Kwan  <dougkwan@google.com>
10640
10641         * arm.cc (Arm_exidx_fixup): New class.
10642
10643 2010-01-21  Doug Kwan  <dougkwan@google.com>
10644
10645         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
10646         classes.
10647         (Arm_exidx_section_offset_map): New type.
10648
10649 2010-01-21  Doug Kwan  <dougkwan@google.com>
10650
10651         * arm.cc (Arm_exidx_input_section): New class.
10652         (Arm_relobj::exidx_input_section_by_link,
10653         Arm_relobj::exidx_input_section_by_shndx,
10654         Arm_relobj::make_exidx_input_section): New methods.
10655         (read_arm_attributes_section): Remove.
10656         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
10657         information about them.
10658         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
10659         to here.
10660
10661 2010-01-20  Doug Kwan  <dougkwan@google.com>
10662
10663         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
10664         Input_section_specifier to Section_id.
10665         (Target_arm::new_arm_input_section: Adjust code for change of key
10666         type.
10667         (Target_arm::find_arm_input_section): Ditto.
10668         * gc.h (object.h): Include for Section_id nand Section_id_hash.
10669         (Section_id): Remove.
10670         (Garbage_collection::Section_id_hash): Remove.
10671         * icf.h (object.h): Include for Section_id nand Section_id_hash.
10672         (Section_id): Remove.
10673         (Icf::Section_id_hash): Remove.
10674         * object.h (Section_id, Const_section_id, Section_id_hash,
10675         Const_section_id_hash): New type definitions.
10676         * output.cc (Output_section::add_relaxed_input_section): Change to
10677         use Const_section_id instead of Input_section_specifier as key type.
10678         (Output_section::add_merge_input_section): Ditto.
10679         (Output_section::build_relaxation_map): Change to use Section_id
10680         instead of Input_section_specifier as key type.
10681         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10682         Ditto.
10683         (Output_section::convert_input_sections_to_relaxed_sections): Change
10684         to use Const_section_id instead of Input_section_specifier as key type.
10685         (Output_section::find_merge_section): Ditto.
10686         (Output_section::find_relaxed_input_section): Ditto.
10687         * output.h (Input_section_specifier): Remove class.
10688         (Output_section::Output_section_data_by_input_section_map): Change
10689         key type to Const_section_id.
10690         (Output_section::Output_relaxed_input_section_by_input_section_map):
10691         Ditto.
10692         (Output_section::Relaxation_map): Change key type to Section_id.
10693
10694 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10695
10696         * gold/arm.cc: Added support for R_ARM_V4BX relocation
10697         (class Arm_v4bx_stub): New class.
10698         (DEF_STUBS): Updated definition to support v4_veneer_bx.
10699         (Stub_factory::make_arm_v4bx_stub): New method.
10700         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
10701         (Stub_table::empty): Handle v4bx stubs.
10702         (Stub_table::add_arm_v4bx_stub): New method.
10703         (Stub_table::find_arm_v4bx_stub): New method.
10704         (Arm_relocate_functions::v4bx): New method.
10705         (Target_arm::fix_v4bx): New method.
10706         (Target_arm::Target_arm): Handle R_ARM_V4BX.
10707         (Stub_table::relocate_stubs): Likewise.
10708         (Stub_table::do_write): Likewise.
10709         (Stub_table::update_data_size_and_addralign): Likewise.
10710         (Stub_table::finalize_stubs):  Likewise.
10711         (Target_arm::Scan::local): Likewise.
10712         (Target_arm::Scan::global): Likewise.
10713         (Target_arm::do_finalize_sections): Likewise.
10714         (Target_arm::Relocate::relocate): Likewise.
10715         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10716         Likewise.
10717         (Target_arm::scan_reloc_for_stub): Likewise.
10718         (Target_arm::scan_reloc_section_for_stubs): Likewise.
10719
10720 2010-01-19  Ian Lance Taylor  <iant@google.com>
10721
10722         * output.cc (Output_section_headers::do_sized_write): Write large
10723         segment count to sh_info field.
10724         (Output_file_header::do_sized_write): For large segment count,
10725         write PN_XNUM to e_phnum field.
10726
10727 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10728
10729         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
10730         (Arm_relocate_functions::thm_jump8): New function.
10731         (Arm_relocate_functions::thm_jump11): New function.
10732         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
10733         R_ARM_THM_JUMP11.
10734         (Target_arm::Scan::global): Likewise.
10735         (Target_arm::Relocate::relocate): Likewise.
10736         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10737         Likewise.
10738
10739 2010-01-14  Doug Kwan  <dougkwan@google.com>
10740
10741         * arm.cc (map, utility): Include headers.
10742         (Target_arm::apply_cortex_a8_workaround): New method.
10743         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
10744         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
10745         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
10746         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
10747         the --[no-]fix-cortex-a8 command line options.
10748         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
10749         (Target_arm::relocate_stub): Use addend in instruction template.
10750         * options.h (DEFINE_bool): Set the user-set flag.
10751         (General_options): Add --[no-]-fix-cortex options.
10752         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
10753         : Update fast look-up map after conversion.
10754
10755 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
10756
10757         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
10758         in the first pass of do_layout.
10759
10760 2010-01-13  Doug Kwan  <dougkwan@google.com>
10761
10762         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10763         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
10764         apparent compiler problem of not folding static constant integral
10765         data members of elfcpp::Elf_sizes<32>.
10766
10767 2010-01-13  Doug Kwan  <dougkwan@google.com>
10768
10769         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10770         Arm_relobj::section_needs_cortex_a8_stub_scanning,
10771         Arm_relobj::scan_section_for_cortex_a8_erratum,
10772         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
10773         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
10774         sections to scan for relocation stubs into a new method
10775         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
10776         relocation and Cortex-A8 stub scanning.
10777         (Target_arm::do_relax): Force stubs to be after stubbed sections
10778         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
10779         the beginning of a new relaxation pass.  Update a comment.
10780         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
10781
10782 2010-01-12  Ian Lance Taylor  <iant@google.com>
10783
10784         * target-reloc.h (visibility_error): New inline function.
10785         (relocate_section): Call visibility_error.
10786         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
10787         (MOSTLYCLEANFILES): Likewise.
10788         (protected_4_pic.o, protected_3.err): New targets.
10789         * testsuite/protected_4.cc: New file.
10790
10791 2010-01-12  Doug Kwan  <dougkwan@google.com>
10792
10793         * arm.cc (Cortex_a8_reloc): New class.
10794         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
10795         and cortex_a8_relocs_info_.
10796         (Target_arm::fix_cortex_a8): New method definition.
10797         (Target_arm::Cortex_a8_relocs_info): New type.
10798         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
10799         New data member declarations.
10800         (Target_arm::scan_reloc_for_stub): Record information about
10801         relocations for THUMB branches that might be exempted from the
10802         Cortex-A8 workaround.
10803         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
10804         at the beginning of a relaxation pass.
10805
10806 2010-01-12  Doug Kwan  <dougkwan@google.com>
10807
10808         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
10809         (Arm_relobj::Mapping_symbol_position,
10810          Arm_reloj::Mapping_symbol_position_less,
10811          Arm_relobj::Mapping_symbols_info): New types.
10812         (Target_arm::is_mapping_symbol_name): New method definition.
10813         (Arm_relobj::do_count_local_symbols): Save information about mapping
10814         symbols.
10815
10816 2010-01-11  Doug Kwan  <dougkwan@google.com>
10817
10818         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
10819         Arm_relocate_functions::thumb32_branch_upper,
10820         Arm_relocate_functions::thumb32_branch_lower,
10821         Arm_relocate_functions::thumb32_cond_branch_offset,
10822         Arm_relocate_functions::thumb32_cond_branch_upper,
10823         Arm_relocate_functions::thumb32_cond_branch_lower,
10824         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
10825         branch offset encoding.
10826         (Arm_relocate_functions::thumb_branch_common): Use new branch
10827         offset encoding methods to avoid code duplication.
10828         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
10829         (Stub_addend_reader::operator()): Use new branch encoding method
10830         to avoid code duplication.
10831
10832 2010-01-11  Doug Kwan  <dougkwan@google.com>
10833
10834         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
10835         (Target_arm::do_finalize_sections): Define special EXIDX section
10836         symbols only if referenced.
10837         * gc.h (Garbage_collection::add_reference): New method.
10838         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
10839         code duplication.
10840
10841 2010-01-11  Ian Lance Taylor  <iant@google.com>
10842
10843         * script.cc (Version_script_info::build_expression_list_lookup):
10844         Change complaing about duplicate wildcard match from error to
10845         warning.
10846
10847         * script.cc (class Lazy_demangler): Recreate--revert part of patch
10848         of 2009-12-30.
10849         (Version_script_info::Version_script_info): Initialize globs_,
10850         default_version_, default_is_global_, and exact_.  Don't
10851         initialize globals_ or locals_.
10852         (Version_script_info::build_lookup_tables): Build local symbols
10853         first.
10854         (Version_script_info::unquote): New function.
10855         (Version_script_info::add_exact_match): New function.
10856         (Version_script_info::build_expression_list_lookup): Remove lookup
10857         parameter.  Add is_global parameter.  Change all callers.  Handle
10858         wildcard pattern specially.  Unquote pattern.  Call
10859         add_exact_match.
10860         (Version_script_info::get_name_to_match): New function.
10861         (Version_script_info::get_symbol_version): New function.
10862         (Version_script_info::get_symbol_version_helper): Remove.
10863         (Version_script_info::check_unmatched_names): Call unquote.
10864         * script.h (class Version_script_info): Change get_symbol_version
10865         to be non-inline and add is_global parameter; change all callers.
10866         Rewrite symbol_is_local.  Update declarations.  Define struct
10867         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
10868         Remove globals_ and locals_ members.  Add exact_, globs_,
10869         default_version_, is_global_.
10870         (Version_script_info::Glob): Remove pattern, add expression and
10871         is_global.  Update constructor.  Change all callers.
10872         * dynobj.cc (Versions::finalize): Mark the version symbol as the
10873         default version.
10874         (Versions::symbol_section_contents): If a symbol is undefined, or
10875         defined in a dynamic object, set the version index to
10876         VER_NDX_LOCAL.
10877         * symtab.cc (Symbol_table::add_from_relobj): Don't call
10878         symbol_is_local.
10879         (Symbol_table::add_from_pluginobj): Likewise.
10880         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
10881
10882 2010-01-11  Doug Kwan  <dougkwan@google.com>
10883
10884         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
10885         (incremental_dump_LDADD): Add linking option for libintl.
10886         * Makefile.in: Regenerate.
10887
10888 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
10889
10890         PR gold/11144
10891         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
10892         instead of -Ds.
10893         * testsuite/Makefile.in: Regenerated.
10894
10895 2010-01-10  Doug Kwan  <dougkwan@google.com>
10896
10897         * options.h (DEFINE_var): Use parentheses around argument varname__
10898         in macro body to avoid any unintended subsequent substitutions.
10899
10900 2010-01-10  Ian Lance Taylor  <iant@google.com>
10901
10902         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
10903         candidates before doing symbol resolution.
10904
10905         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
10906         ODR candidates if only one is weak.
10907
10908 2010-01-08  Ian Lance Taylor  <iant@google.com>
10909
10910         * script.cc (Version_script_info::build_expression_list_lookup):
10911         Don't warn about ambiguous version, just record the ambiguity.
10912         (Version_script_info::get_symbol_version_helper): Give error if
10913         version is ambiguous.
10914
10915 2010-01-08  Doug Kwan  <dougkwan@google.com>
10916
10917         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
10918         prev_data_size_ and prev_addralign_.  Remove initializer for
10919         deleted data member has_been_changed_.
10920         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
10921         to determine if the table is empty.
10922         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
10923         Remove.
10924         (Stub_table::add_reloc_stub): Define method in class definition
10925         instead of just declaring it there.
10926         (Stub_table::add_cortex_a8_stub): New method definition.
10927         (Stub_table::update_data_size_and_addralign): Ditto.
10928         (Stub_table::finalize_stubs): Ditto.
10929         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
10930         (Stub_table::do_addralign_): Return address alignment in the
10931         (Stub_table::do_reset_address_and_file_offset): Define method in
10932         class definition instead of declaring it there.  Set current data
10933         size to be the data size of the previous pass.
10934         (Stub_table::set_final_data_size): Use current data size as the
10935         final data size.
10936         (Stub_table::relocate_stub): Change parameter type of stub from
10937         Reloc_stub pointer to Stub pointer.
10938         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10939         (Stub_table::Cortex_a8_stub_list): New typedef.
10940         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10941          Stub_table::prev_addralign_): New data member.
10942         (Arm_relobj::Arm_relobj): Initialize data member
10943         section_has_cortex_a8_workaround_.
10944         (Arm_relobj::section_has_cortex_a8_workaround,
10945          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
10946          definitions.
10947         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10948         declarations.
10949         (Target_arm::relocate_stub): Change parameter type of stub from
10950         Reloc_stub pointer to Stub pointer.
10951         (Insn_template::size, Insn_template::alignment): Handle
10952         THUMB16_SPECIAL_TYPE.
10953         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10954          Stub_table::update_data_size_and_addralign,
10955          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10956         definitions.
10957         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10958         (Stub_table::do_write): Ditto.
10959         (Target_arm::do_relax): Adjust code for changes in Stub_table.
10960
10961 2010-01-08  Ian Lance Taylor  <iant@google.com>
10962
10963         PR 11108
10964         * symtab.h (class Symbol): Remove fields is_target_special_ and
10965         has_plt_offset_.  Add field is_defined_in_discarded_section_.
10966         (Symbol::is_defined_in_discarded_section): New function.
10967         (Symbol::set_is_defined_in_discarded_section): New function.
10968         (Symbol::has_plt_offset): Rewrite.
10969         (Symbol::set_plt_offset): Verify that new offset is not -1U.
10970         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10971         Don't initialize is_target_special_ or has_plt_offset_.
10972         Initialize is_defined_in_discarded_section_.
10973         (Symbol_table::add_from_relobj): If appropriate, set
10974         is_defined_in_discarded_section.
10975         * resolve.cc (Symbol::override_base_with_special): Don't test
10976         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
10977         * target-reloc.h (relocate_section): Do special handling for
10978         symbols defined in discarded sections for global symbols as well
10979         as local symbols.
10980
10981 2010-01-08  Ian Lance Taylor  <iant@google.com>
10982
10983         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10984         the SHT_SYMTAB case.
10985
10986 2010-01-08  Ian Lance Taylor  <iant@google.com>
10987
10988         * object.cc (Sized_relobj::do_layout): Don't get confused if
10989         layout_eh_frame returns NULL.
10990
10991 2010-01-08  Ian Lance Taylor  <iant@google.com>
10992
10993         PR 11084
10994         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10995         dynamic symbol table, use the normal symbol table.
10996         (Sized_dynobj::do_read_symbols): Remove assertion about type of
10997         symbol table.
10998
10999 2010-01-08  Ian Lance Taylor  <iant@google.com>
11000
11001         PR 11072
11002         * layout.cc (Layout::include_section): Remove .gnu_debuglink
11003         sections.
11004
11005 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
11006
11007         * version.cc (print_version): Change to "Copyright 2010".
11008
11009 2010-01-08  Ian Lance Taylor  <iant@google.com>
11010
11011         PR 10287
11012         PR 11063
11013         * i386.cc (class Target_i386): Change return type of plt_section
11014         to be non-const.
11015         (class Output_data_plt_i386): Add tls_desc_rel_ field.
11016         (Output_data_plt_i386::Output_data_plt_i386): Initialize
11017         tls_desc_rel_ field.
11018         (Output_data_plt_i386::rel_tls_desc): New function.
11019         (Target_i386::rel_tls_desc_section): New function.
11020         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
11021         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
11022         R_386_TLS_DESC reloc in rel_tls_desc_section.
11023         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
11024         Define struct Tlsdesc_info.
11025         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
11026         (Target_x86_64::do_reloc_symbol_index): New function.
11027         (Target_x86_64::add_tlsdesc_info): New function.
11028         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
11029         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
11030         tlsdesc_rel_ field.
11031         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
11032         all callers.
11033         (Output_data_plt_x86_64::rela_tlsdesc): New function.
11034         (Target_x86_64::rela_tlsdesc_section): New function.
11035         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
11036         handling.
11037         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
11038         (Target_x86_64::do_reloc_addend): New function.
11039         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
11040         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
11041         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
11042         (Output_reloc::type): New function.
11043         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
11044         (Output_reloc::is_target_specific): New function.
11045         (Output_reloc::target_arg): New function.
11046         (class Output_reloc) [SHT_RELA]: Add four new constructors for
11047         absolute relocs and target specific relocs.
11048         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
11049         add_target_specific.
11050         (class Output_data_reloc) [SHT_RELA]: Likewise.
11051         * output.cc (Output_reloc::Output_reloc): Add four new versions
11052         for absolute relocs and target specific relocs.
11053         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
11054         (Output_reloc::get_symbol_index): Likewise.
11055         (Output_reloc::local_section_offset): Check that local_sym_index_
11056         is not TARGET_CODE or 0.
11057         (Output_reloc::symbol_value): Likewise.
11058         (Output_reloc::write) [SHT_RELA]: Call target for target specific
11059         reloc.
11060         * target.h (class Target): Add reloc_symbol_index and reloc_addend
11061         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
11062         functions.
11063         * layout.cc (add_target_dynamic_tags): Use output section for
11064         DT_PLTRELSZ and DT_JMPREL.
11065
11066 2010-01-07  Ian Lance Taylor  <iant@google.com>
11067
11068         PR 11061
11069         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
11070         function.
11071         (class Output_data_reloc_generic): Define.
11072         (class Output_data_reloc_base): Change base class to
11073         Output_data_reloc_generic.  Change add() method to call
11074         bump_relative_reloc_count for a relative reloc.  Remove
11075         sort_relocs_ field.
11076         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
11077         to sort_relocs().
11078         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
11079         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
11080         appropriate.
11081         * layout.h (class Layout): Update declaration.
11082
11083 2010-01-07  Ian Lance Taylor  <iant@google.com>
11084
11085         * output.h (class Output_data): Add const version of
11086         output_section and do_output_section.
11087         (class Output_section_data): Add const version of
11088         do_output_section.
11089         (class Output_section): Likewise.
11090         * layout.cc (Layout::add_target_dynamic_tags): New function.
11091         * layout.h (class Layout): Update declarations.
11092         * arm.cc (Target_arm::do_finalize_sections): Use
11093         add_target_dynamic_tags.
11094         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11095         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11096         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11097         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11098
11099 2010-01-07  Ian Lance Taylor  <iant@google.com>
11100
11101         PR 11042
11102         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
11103         object as needed.
11104
11105 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
11106             Ian Lance Taylor  <iant@google.com>
11107
11108         PR 11019
11109         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
11110         Xindex::read_symtab_xindex.
11111
11112 2010-01-07  Doug Kwan  <dougkwan@google.com>
11113
11114         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
11115         (Insn_template::thumb16_bcond_insn): New method declaration.
11116         (Insn_template): Fix spelling.
11117         (Stub::thumb16_special): New method declaration.
11118         (Stub::do_write): Define virtual method which was previously pure
11119         virtual.
11120         (Stub::do_thumb16_special): New method declaration.
11121         (Stub::do_fixed_endian_write): New template member.
11122         (Reloc_stub::do_write): Remove.
11123         (Reloc_stub::do_fixed_endian_write): Remove.
11124         (Cortex_a8_stub): New class definition.
11125         (Stub_factory::make_cortex_a8_stub): New method definition.
11126         (Stub_factory::Stub_factory): Add missing static storage class
11127         qualifier for elf32_arm_stub_a8_veneer_blx.
11128
11129 2010-01-07  Ian Lance Taylor  <iant@google.com>
11130
11131         PR 10980
11132         * options.h (class General_options): Add --warn-unresolved-symbols
11133         and --error-unresolved-symbols.
11134         * errors.cc (Errors::undefined_symbol): Implement
11135         --warn-unresolved-symbols.
11136
11137         * options.h (class General_options): Add -z text and -z textoff.
11138         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
11139
11140 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
11141
11142         * gc.h (Garbage_collection::Cident_section_map): New typedef.
11143         (Garbage_collection::cident_sections): New function.
11144         (Garbage_collection::add_cident_section): New function.
11145         (Garbage_collection::cident_sections_): New member.
11146         (gc_process_relocs): Add references to sections whose names are C
11147         identifiers.
11148         * gold.h (cident_section_start_prefix): New constant.
11149         (cident_section_stop_prefix): New constant.
11150         (is_cident): New function.
11151         * layout.cc (Layout::define_section_symbols): Replace string constants
11152         with the newly defined constants.
11153         * object.cc (Sized_relobj::do_layout): Track sections whose names are
11154         C identifiers.
11155         * testsuite/Makefile.am: Add gc_orphan_section_test.
11156         * testsuite/Makefile.in: Regenerate.
11157         * testsuite/gc_orphan_section_test.cc: New file.
11158         * testsuite/gc_orphan_section_test.sh: New file.
11159
11160 2010-01-06  Ian Lance Taylor  <iant@google.com>
11161
11162         PR 10980
11163         * options.h (class General_options): Add --warn-shared-textrel.
11164         * layout.cc (Layout::finish_dynamic_section): Implement
11165         --warn-shared-textrel.
11166
11167         PR 10980
11168         * options.h (class General_options): Add --warn-multiple-gp.
11169
11170 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11171
11172         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
11173         $(THREADSLIB) and $(LIBDL).
11174         * Makefile.in: Rebuild.
11175
11176 2010-01-06  Ian Lance Taylor  <iant@google.com>
11177
11178         PR 10980
11179         * options.cc (General_options::parse_section_start): New function.
11180         (General_options::section_start): New function.
11181         (General_options::General_options): Initialize all members.
11182         * options.h: Include <map>
11183         (class General_options): Add --section-start.  Add section_starts_
11184         member.
11185         * layout.cc (Layout::attach_allocated_section_to_segment): If
11186         --section-start was used, set the address of the segment.  Remove
11187         local sort_sections.
11188         (Layout::relaxation_loop_body): If the address of the load segment
11189         has been set by --section-start, don't use it.
11190         * output.h (Output_segment::update_flags_for_output_section): New
11191         function.
11192         * output.cc (Output_segment::add_output_section): Call
11193         update_flags_for_output_section.
11194
11195 2010-01-05  Ian Lance Taylor  <iant@google.com>
11196
11197         PR 10980
11198         * options.h (class General_options): Add --undefined-version.
11199         * script.cc (struct Version_expression): Add was_matched_by_symbol
11200         field.
11201         (Version_script_info::matched_symbol): New function.
11202         (Version_script_info::get_symbol_version_helper): Call
11203         matched_symbol.
11204         (Version_script_info::check_unmatched_names): New function.
11205         * script.h (class Version_script_info): Update declarations.
11206         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
11207
11208         * options.h (class General_options): Use DEFINE_bool_alias for
11209         allow_multiple_definition.
11210         * resolve.cc (Symbol_table::should_override): Don't test
11211         allow_multiple_definition.
11212
11213         PR 10980
11214         * options.h (class General_options): Add --cref.
11215         * main.cc (main): Print cref table if --cref.  Don't close mapfile
11216         until after printing cref table.
11217         * cref.cc: Include "symtab.h".
11218         (class Cref_inputs): Define Cref_table_compare and Cref_table.
11219         (Cref_table_compare::operator()): New function.
11220         (Cref_inputs::gather_cref): New function.
11221         (filecol): New static const.
11222         (Cref_inputs::print_cref): New function.
11223         (Cref::print_cref): New function.
11224         * cref.h: Include <cstdio>.
11225         (class Cref): Update declarations.
11226         * mapfile.h (Mapfile::file): New function.
11227         * object.h (class Object): Define Symbols.  Declare virtual
11228         do_get_global_symbols.
11229         (Object::get_global_symbols): New function.
11230         * object.cc (Input_objects::add_object): Pass object to cref_ if
11231         --cref.
11232         (Input_objects::archive_start): Likewise.
11233         (Input_objects::archive_stop): Likewise.
11234         (Input_objects::print_cref): New function.
11235         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
11236         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
11237         --cref.
11238         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
11239         function.
11240         * plugin.h (class Sized_pluginobj): Update declarations.
11241
11242 2010-01-05  Ian Lance Taylor  <iant@google.com>
11243
11244         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
11245         to is_default_version.  Rename insdef to insdefault.
11246         (Symbol_table::add_from_relobj): Rename def to is_default_version
11247         and local to is_forced_local.
11248         (Symbol_table::add_from_pluginobj): Likewise.
11249         (Symbol_table::add_from_dynobj): Likewise.
11250         (Symbol_table::define_special_symbol): Rename insdef to
11251         insdefault.
11252
11253 2010-01-04  Ian Lance Taylor  <iant@google.com>
11254
11255         PR 10980
11256         * options.h (class General_options): Add
11257         --allow-multiple-definition and -z muldefs.
11258         * resolve.cc (Symbol_table::should_override): Don't warn about a
11259         multiple symbol definition if --allow-multiple-definition or -z
11260         muldefs.
11261
11262         PR 10980
11263         * options.h (class General_options): Add --add-needed and
11264         --copy-dt-needed-entries.  Tweak --as-needed help entry.
11265         * object.cc (Input_objects::check_dynamic_dependencies): Give an
11266         error if --copy-dt-needed-entries aka --add-needed is used and
11267         would cause a change in behaviour.
11268
11269         PR 10980
11270         * options.h (class General_options): Add -G as a short version of
11271         --shared.  Add no-op options -assert, -g, and -i.
11272
11273 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
11274
11275         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
11276         check for .text or .gnu.linkonce.t sections.
11277         * icf.cc (Icf::find_identical_sections): Ditto.
11278         Change the detection for mangled function name within the section
11279         name.
11280         * icf.h (is_section_foldable_candidate): New function.
11281
11282 2009-12-30  Ian Lance Taylor  <iant@google.com>
11283
11284         PR 10980
11285         * options.h (class General_options): Permit two dashes with
11286         --retain-symbols-file.
11287
11288 2009-12-30  Ian Lance Taylor  <iant@google.com>
11289
11290         PR 10979
11291         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
11292         don't put the file header and segment headers in the text
11293         segment.
11294
11295         PR 10979
11296         * common.cc (Sort_commons::operator()): Stabilize sort when both
11297         entries are NULL.
11298         (Symbol_table::do_allocate_commons_list): When allocating common
11299         symbols, skip a symbol which is no longer common.
11300         * symtab.h (Symbol::is_common): Test whether the symbol comes from
11301         an object before checking its type.
11302         * testsuite/common_test_2.c: New file.
11303         * testsuite/common_test_3.c: New file.
11304         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
11305         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
11306         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
11307         (common_test_2_pic.o, common_test_2.so): New targets.
11308         (common_test_3_pic.o, common_test_3.so): New targets.
11309         * testsuite/Makefile.in: Rebuild.
11310
11311         PR 10979
11312         * script.cc (read_input_script): If we see a new SECTIONS clause,
11313         and we have added an input section, give an error.
11314         * layout.h (class Layout): Add have_added_input_section function.
11315         Add have_added_input_section_ field.
11316         * layout.cc (Layout::Layout): Initialize
11317         have_added_input_section_.
11318         (Layout::layout): Set have_added_input_section_.
11319         (Layout::layout_eh_frame): Likewise.
11320
11321 2009-12-30  Ian Lance Taylor  <iant@google.com>
11322
11323         PR 10931
11324         * options.h (class General_options): Add --sort-common option.
11325         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
11326         * common.cc (Sort_common): Add sort_order parameter to
11327         constructor.  Add sort_order_ field.
11328         (Sort_commons::operator): Check sort_order_.
11329         (Symbol_table::allocate_commons): Determine the sort order.
11330         (Symbol_table::do_allocate_commons): Add sort_order parameter.
11331         Change all callers.
11332         (Symbol_table::do_allocate_commons_list): Likewise.
11333
11334 2009-12-30  Ian Lance Taylor  <iant@google.com>
11335
11336         PR 10916
11337         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
11338         symbols from this object, don't change the visibility of an
11339         undefined symbol.
11340         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
11341
11342 2009-12-30  Ian Lance Taylor  <iant@google.com>
11343
11344         PR 10861
11345         * script.h (class Version_script_info): Define Language enum.
11346         Update declarations.  Define Glob, Exact, and Lookup types.  Add
11347         new fields globals_, locals_, and is_finalized_.
11348         * script.cc: Various formatting fixes.
11349         (class Parser_closure): Change language_stack_ from a vector of
11350         std::string to one of Version_script_info::Language.  Adjust all
11351         uses accordingly.
11352         (class Lazy_demangler): Remove.
11353         (struct Version_expression): Change language from std::string to
11354         Version_script_info::Language.
11355         (Version_script_info::Version_script_info): New function.
11356         (Version_script_info::~Version_script_info): Don't call clear.
11357         (Version_script_info::finalize): New function.
11358         (Version_script_info::build_lookup_tables): New function.
11359         (Version_script_info::build_expression_list_lookup): New
11360         function.
11361         (Version_script_info::get_symbol_version_helper): Rewrite to use
11362         lookup tables.
11363         (Version_script_info::print_expression_list): Adjust to use
11364         Version_script_info::Language.
11365         (script_push_lex_into_version_mode): Check that the version script
11366         has not been finalized.
11367         (version_script_push_lang): Change language string to
11368         Version_script_info::Language.
11369         * options.cc (Command_line::version_script): New function.
11370         * options.h (class General_options): Add finalize_dynamic_list
11371         function.  Change version_script from declaration to definition.
11372         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
11373         * testsuite/version_script.map: Remove duplicate def of foo.
11374         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
11375         version_script.map.
11376         * testsuite/Makefile.in: Rebuild.
11377
11378 2009-12-30  Ian Lance Taylor  <iant@google.com>
11379
11380         PR 10843
11381         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
11382         if the input symbol index is 0, make the output symbol index 0.
11383
11384 2009-12-30  Ian Lance Taylor  <iant@google.com>
11385
11386         PR 10670
11387         * options.h (class General_options): Add -x/--discard-all.
11388         * object.cc (Sized_relobj::do_count_local_symbols): Handle
11389         --discard-all.  If the local symbol needs a dynamic entry, check
11390         that before handling --discard-locals.
11391
11392 2009-12-30  Ian Lance Taylor  <iant@google.com>
11393
11394         PR 10450
11395         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
11396         flags to PF_R.
11397         (Output_segment::add_output_section): Don't change the flags if
11398         the type is PT_TLS.
11399
11400         PR 10450
11401         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
11402         GNU hash table if they need a dynamic value.  Otherwise, don't add
11403         them if they are defined in a dynamic object or are forced local.
11404
11405 2009-12-29  Ian Lance Taylor  <iant@google.com>
11406
11407         PR 10450
11408         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
11409         .gnu.hash table for a 32-bit target.
11410
11411         PR 10450
11412         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
11413         regular and a dynamic object only needs a dynamic symbol table
11414         entry if it is externally visible.
11415
11416         PR 10450
11417         * i386.cc (class Target_i386): Initialize global_offset_table_ in
11418         constructor.  Add global_offset_table_ field.
11419         (Target_i386::got_section): Set global_offset_table_.
11420         (Target_i386::do_finalize_sections): Set global_offset_table_
11421         size.
11422         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
11423         in constructor.  Add global_offset_table_ field.
11424         (Target_x86_64::got_section): Set global_offset_table_.
11425         (Target_x86_64::do_finalize_sections): Set global_offset_table_
11426         size.
11427
11428         * layout.cc (Layout::Layout): Initialize increase_relro_.
11429         (Layout::get_output_section): Add is_relro, is_last_relro, and
11430         is_first_non_relro parameters.  Change all callers.
11431         (Layout::choose_output_section): Likewise.
11432         (Layout::add_output_section_data): Likewise.
11433         (Layout::make_output_section): Likewise.
11434         (Layout::set_segment_offsets): Clear increase_relro when using a
11435         linker script.
11436         * layout.h (class Layout): Add increase_relro method.  Add
11437         increase_relro_ field.  Update declarations.
11438         * output.cc (Output_section::Output_section): Initialize
11439         is_last_relro_ and is_first_non_relro_.
11440         (Output_segment::add_output_section): Group relro sections is
11441         do_sort is true.  Handle is_last_relro and is_first_non_relro.
11442         (Output_segment::maximum_alignment): Remove relro handling.
11443         (Output_segment::set_section_addresses): Add increase_relro
11444         parameter.  Change all callers.  Add initial alignment to align
11445         relro sections on separate page.  Remove old relro handling.
11446         (Output_segment::set_section_list_addresses): Remove in_relro
11447         parameter.  Change all callers.
11448         (Output_segment::set_offset): Add increase parameter.  Change all
11449         callers.  Remove old relro handling.
11450         * output.h (class Output_section): Add new methods: is_last_relro,
11451         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
11452         Add is_last_relro_ and is_first_non_relro_ fields.
11453         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
11454         Create separate .got.plt section.  Call increase_relro.
11455         * x86_64.cc (Target_x86_64::got_section): Likewise.
11456         * testsuite/relro_script_test.t: Add .got.plt.
11457
11458         PR 10450
11459         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
11460         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
11461         (Layout::finalize): Call set_dynamic_symbol_size.
11462         (Layout::set_dynamic_symbol_size): New function.
11463         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
11464         set_dynamic_symbol_size.
11465
11466         PR 10450
11467         * output.h (class Output_section): Add is_entsize_zero_ field.
11468         * output.cc (Output_section::Output_section): Initialize
11469         is_entsize_zero_.
11470         (Output_section::set_entsize): If two different entsizes are
11471         requested, force it to zero.
11472         (Output_section::add_input_section): Set flags for .debug_str
11473         before updating section flags.  Set entsize.
11474         (Output_section::update_flags_for_input_section): Set SHF_MERGE
11475         and SHF_STRING if all input sections have those flags.
11476
11477 2009-12-29   Rafael Espindola  <espindola@google.com>
11478
11479         * main.cc (main): Fix the sys time reporting.
11480         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
11481         reporting.
11482
11483 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
11484
11485         * options.cc (General_options::parse_version): Allow -v to exit
11486         without an error if there is nothing to link.
11487
11488 2009-12-29  Ian Lance Taylor  <iant@google.com>
11489
11490         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
11491         using a version of gcc before 4.1.
11492         * configure: Rebuild.
11493
11494 2009-12-28  Chris Demetriou  <cgd@google.com>
11495
11496         * attributes.cc (Output_attributes_section_data::do_write): Use
11497         std::vector::front rather than std::vector::data.
11498
11499 2009-12-28  Ian Lance Taylor  <iant@google.com>
11500
11501         * symtab.h (class Symbol_table): Add enum Defined.
11502         * resolve.cc (Symbol_table::should_override): Add defined
11503         parameter.  Change all callers.  Test whether object is NULL
11504         before calling a method on it.
11505         (Symbol_table::report_resolve_problem): Add defined parameter.
11506         Change all callers.
11507         (Symbol_table::should_override_with_special): Likewise.
11508         * symtab.cc (Symbol_table::define_in_output_data): Add defined
11509         parameter.  Change all callers.
11510         (Symbol_table::do_define_in_output_data): Likewise.
11511         (Symbol_table::define_in_output_segment): Likewise.
11512         (Symbol_table::do_define_in_output_segment): Likewise.
11513         (Symbol_table::define_as_constant): Likewise.
11514         (Symbol_table::do_define_as_constant): Likewise.
11515         * script.h (class Symbol_assignment): Add is_defsym parameter to
11516         constructor; change all callers.
11517         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
11518         parameter.  Change all callers.  Add is_defsym_ field.
11519         (class Parser_closure): Add parsing_defsym parameter to
11520         constructor; change all callers.  Add parsing_defsym accessor
11521         function.  Add parsing_defsym_ field.
11522
11523 2009-12-28  Ian Lance Taylor  <iant@google.com>
11524
11525         * gold.cc (queue_middle_tasks): Fix formatting.
11526         * object.cc (Relobj::is_section_name_included): Likewise.
11527
11528 2009-12-23  Ian Lance Taylor  <iant@google.com>
11529
11530         * i386.cc (Target_i386::do_calls_non_split): Recognize
11531         -fsplit-stack prologue for a function with a static chain.
11532         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
11533         -fsplit-stack prologue when using %r11.
11534
11535 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
11536
11537         * options.cc (General_options::parse_version): Make -v continue and do
11538         the link like GNU ld does.
11539
11540 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
11541
11542         * Makefile.am (CCFILES): Add timer.cc.
11543         (HFILES): Add timer.h.
11544         * configure.ac: Check for sysconf and times.
11545         * main.cc: include timer.h.
11546         (main): Use Timer instead of get_run_time.
11547         * timer.cc: New.
11548         * timer.h: New.
11549         * workqueue.cc: include timer.h.
11550         (Workqueue::find_and_run_task):
11551         Report user, sys and wall time.
11552         * Makefile.in: Regenerate.
11553         * config.in: Regenerate.
11554         * configure: Regenerate.
11555
11556 2009-12-16  Doug Kwan  <dougkwan@google.com>
11557
11558         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
11559         sections.
11560         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
11561         relaxed input sections.
11562         * output.cc (Output_section::find_relaxed_input_section): Change
11563         return type to Output_relaxed_input_section pointer.  Adjust code
11564         for new type of relaxed_input_section_map_.
11565         * output.h (Output_section::find_relaxed_input_section): Change
11566         return type to Output_relaxed_input_section pointer.
11567         (Output_section::Output_relaxed_input_section_by_input_section_map):
11568         New type.
11569         (Output_section::relaxed_input_section_map_): Change type to
11570         Output_section::Output_relaxed_input_section_by_input_section_map.
11571         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
11572         input section.
11573
11574 2009-12-15  Ian Lance Taylor  <iant@google.com>
11575
11576         * layout.cc (Layout::create_shstrtab): Only write out after input
11577         sections if we are compressing debug sections.
11578
11579 2009-12-15  Ian Lance Taylor  <iant@google.com>
11580
11581         * archive.cc (Archive::add_symbols): Only look up a symbol without
11582         a version if there is, in fact, a version.
11583
11584 2009-12-14  Ian Lance Taylor  <iant@google.com>
11585
11586         Revert -Wshadow changes, all changes from:
11587         2009-12-11  Doug Kwan  <dougkwan@google.com>
11588         2009-12-11  Nick Clifton  <nickc@redhat.com>
11589         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
11590
11591 2009-12-11  Doug Kwan  <dougkwan@google.com>
11592
11593         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
11594         due to -Wshadow.
11595         * attributes.cc (Object_attribute::size): Ditto.
11596         (Attributes_section_data::size): Ditto.
11597         (Attributes_section_data::Attributes_section_data): Ditto.
11598         (Output_attributes_section_data::do_write): Ditto.
11599         * attributes.h (Object_attribute::set_type): Ditto.
11600         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
11601
11602 2009-12-11  Nick Clifton  <nickc@redhat.com>
11603
11604         * archive.cc: Fix shadowed variable warnings.
11605         * arm.cc: Likewise.
11606         * compressed_output.cc: Likewise.
11607         * compressed_output.h: Likewise.
11608         * configure: Likewise.
11609         * dwarf_reader.cc: Likewise.
11610         * dynobj.cc: Likewise.
11611         * dynobj.h: Likewise.
11612         * ehframe.cc: Likewise.
11613         * ehframe.h: Likewise.
11614         * errors.cc: Likewise.
11615         * expression.cc: Likewise.
11616         * fileread.cc: Likewise.
11617         * fileread.h: Likewise.
11618         * freebsd.h: Likewise.
11619         * i386.cc: Likewise.
11620         * icf.cc: Likewise.
11621         * incremental.h: Likewise.
11622         * layout.cc: Likewise.
11623         * layout.h: Likewise.
11624         * mapfile.cc: Likewise.
11625         * merge.cc: Likewise.
11626         * merge.h: Likewise.
11627         * object.cc: Likewise.
11628         * object.h: Likewise.
11629         * options.h: Likewise.
11630         * output.cc: Likewise.
11631         * output.h: Likewise.
11632         * parameters.cc: Likewise.
11633         * plugin.cc: Likewise.
11634         * powerpc.cc: Likewise.
11635         * reduced_debug_output.cc: Likewise.
11636         * reduced_debug_output.h: Likewise.
11637         * reloc.cc: Likewise.
11638         * reloc.h: Likewise.
11639         * resolve.cc: Likewise.
11640         * script-sections.cc: Likewise.
11641         * script.cc: Likewise.
11642         * script.h: Likewise.
11643         * sparc.cc: Likewise.
11644         * symtab.cc: Likewise.
11645         * symtab.h: Likewise.
11646         * target-select.cc: Likewise.
11647         * target-select.h: Likewise.
11648         * token.h: Likewise.
11649         * workqueue.cc: Likewise.
11650         * workqueue.h: Likewise.
11651         * x86_64.cc: Likewise.
11652
11653 2009-12-10  Doug Kwan  <dougkwan@google.com>
11654
11655         * arm.cc (attributes.h): New include.
11656         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
11657         (Arm_relobj::~Arm_relobj): Delete object pointed by
11658         attributes_section_data_.
11659         (Arm_relobj::attributes_section_data): New method definition.
11660         (Arm_relobj::attributes_section_data_): New data member declaration.
11661         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
11662         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
11663         attributes_section_data_.
11664         (Arm_dynobj::attributes_section_data): New method definition.
11665         (Arm_dynobj::attributes_section_data_): New data member declaration.
11666         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
11667         initialization value of may_use_blx_ to false.
11668         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
11669         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
11670         object attributes to compute results instead of hard-coding.
11671         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
11672         Target_arm::get_secondary_compatible_arch,
11673         Target_arm::set_secondary_compatible_arch
11674         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11675         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
11676         New method declarations.
11677         (Target_arm::get_aeabi_object_attribute): New method definition.
11678         (Target_arm::attributes_section_data_): New data member declaration.
11679         (read_arm_attributes_section): New template definition.
11680         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
11681         (Arm_dynobj::do_read_symbols): Ditto.
11682         (Target_arm::do_finalize_sections): Merge attributes sections from
11683         input.  Check for BLX use after attributes section merging.
11684         Fix __exidx_start and __exidx_end visibility.  Create an
11685         .ARM.attributes section if necessary.
11686         (Target_arm::get_secondary_compatible_arch,
11687         Target_arm::set_secondary_compatible_arch,
11688         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11689         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
11690         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
11691         New method definitions.
11692
11693 2009-12-09  Ian Lance Taylor  <iant@google.com>
11694
11695         * plugin.cc (Plugin::load): Don't cast from void* to a function
11696         pointer.
11697
11698 2009-12-09  Ian Lance Taylor  <iant@google.com>
11699
11700         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
11701         information fields.
11702
11703 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
11704
11705         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
11706         Replace two_file_shared_1.so with two_file_shared_2.so.
11707         * testsuite/Makefile.in: Regenerated.
11708
11709 2009-12-08  Doug Kwan  <dougkwan@google.com>
11710
11711         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
11712         (HFILES): Add attributes.h and int_encoding.h.
11713         * Makefile.in: Regenerate.
11714         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
11715         function definitions to int_encoding.cc
11716         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
11717         prototypes to int_encoding.h
11718         * reduced_debug_output.cc (int_encoding.h): New include.
11719         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
11720         function definitions to int_encoding.cc
11721         (insert_into_vector, read_from_pointer): Move template definitions to
11722         int_encoding.h
11723         * attributes.cc: New file.
11724         * attributes.h: New file.
11725         * int_encoding.cc: New file.
11726         * int_encoding.h: New file.
11727
11728 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
11729
11730         PR gold/11055
11731         * incremental-dump.cc (dump_incremental_inputs): New.
11732         (main): Use dump_incremental_inputs.
11733
11734 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
11735
11736         PR gold/10893
11737         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
11738         checking elfcpp::STT_FUNC.
11739         (Target_i386::Relocate::relocate): Likewise.
11740         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
11741
11742         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
11743         symbols from shared libraries into normal FUNC symbols.
11744
11745         * symtab.h (Symbol): Add is_func and use it.
11746
11747 2009-12-05  Doug Kwan  <dougkwan@google.com>
11748
11749         * arm.cc (Target_arm::arm_info): Initialize new fields
11750         attributes_section and attributes_vendor.
11751         * i386.cc (Target_i386::i386_info): Same.
11752         * object.cc (Sized_relobj::do_layout): Skip attribute section.
11753         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
11754         fields attributes_section and attributes_vendor.
11755         * sparc.cc (Target_sparc::sparc_info): Same.
11756         * target.h (Target::attributes_section, Target::attributes_vendor,
11757         Target::is_attributes_section, Target::attribute_arg_type,
11758         Target::attributes_order): New method definitions.
11759         (Target::Target_info::attributes_section,
11760         Target::Target_info::attributes_vendor): New fields.
11761         (Target::do_attribute_arg_type, Target::do_attributes_order): New
11762         virtual method definitions.
11763         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
11764         attributes_section and attributes_vendor.
11765         * testsuite/testfile.cc (Target_test::test_target_info): Same.
11766
11767 2009-12-05  Doug Kwan  <dougkwan@google.com>
11768
11769         * arm.cc: Update comments about interworking and stub generation.
11770         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
11771         considered as non-PIC.
11772         (Arm_relocate_functions::base_abs): Fix formatting.
11773         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
11774         of function to use GOT entry address instead of offset.
11775         (Target_arm::Scan::global): Issue an error if a symbol would need a
11776         PLT does not get one because it is untyped.  Remove code to create
11777         dynamic symbols for relative branches.
11778         (Target_arm::Relocate::relocate: Use 0 instead of false since function
11779         takes unsigned integer instead of boolean.
11780
11781 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
11782
11783         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
11784         (two_file_test_LDADD): Likewise.
11785         (common_test_1_LDADD): Likewise.
11786         (exception_test_LDADD) Likewise.
11787         (weak_test_LDADD): Likewise.
11788         (many_sections_test_LDADD): Likewise.
11789         (initpri1_LDADD): Likewise.
11790         (script_test_1_LDADD): Likewise.
11791         (script_test_2_LDADD): Likewise.
11792         (justsyms_LDADD): Likewise.
11793         (binary_test_LDADD): Likewise.
11794         (large_LDADD): Likewise.
11795         * testsuite/Makefile.in: Regenerated.
11796
11797 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
11798
11799         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
11800         (Symbol_table::override_with_special): Likewise.
11801         (Symbol_table::add_from_object): Likewise.
11802
11803 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
11804
11805         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11806         Don't set the data_offset twice.
11807
11808 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
11809
11810         * testsuite/Makefile.in: Regenerate.
11811
11812 2009-12-03  Doug Kwan  <dougkwan@google.com>
11813
11814         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
11815         (Target_arm::do_finalize_sections): Add parameter for symbol table
11816         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
11817         * i386.cc (Target_i386::do_finalize_sections): Add an additional
11818         parameter for symbol table pointer.
11819         * layout.cc (Layout::finalize): Call Target::finalize_sections with
11820         an additional parameter for a pointer to symbol table.
11821         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
11822         parameter for a symbol table pointer.
11823         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
11824         * target.h (Target::finalize_sections, Target::do_finalize_sections):
11825         Ditto.
11826         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
11827         parameter for a symbol table pointer.
11828
11829 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
11830
11831         * incremental.cc (Incremental_inputs_header)
11832         (Incremental_inputs_header_write, Incremental_inputs_entry)
11833         (Incremental_inputs_entry_write): Move ...
11834         * incremental.h (Incremental_inputs_header)
11835         (Incremental_inputs_header_write, Incremental_inputs_entry)
11836         (Incremental_inputs_entry_write): here.
11837
11838 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11839
11840         * incremental.cc (make_sized_incremental_binary): Set the target.
11841         Error if it is incompatible.
11842         * output.h (Output_file): Add filename method.
11843
11844 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11845
11846         * incremental.cc (Incremental_inputs_entry): Remove unused argument
11847         from the get_* methods.
11848
11849 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11850
11851         * incremental-dump.cc (main): Check that the offeset of a script is 0.
11852         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11853         Write 0 for the data_offset of scripts.
11854
11855 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11856
11857         * testsuite/Makefile.am: Add the incremental_test.sh test.
11858         * testsuite/incremental_test.sh: New.
11859         * testsuite/incremental_test_1.c: New.
11860         * testsuite/incremental_test_2.c: New.
11861
11862 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
11863
11864         * incremental-dump.cc (main): Fix typos.
11865
11866 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
11867
11868         PR gold/11025
11869         * incremental-dump.cc (main): Use llu to print 64 bit values.
11870
11871 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
11872             H.J. Lu  <hongjiu.lu@intel.com>
11873
11874         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
11875         $(LIBDL).
11876         (incremental_dump_LDADD): Likewise.
11877         * Makefile.in: Regenerated.
11878
11879 2009-11-25  Doug Kwan  <dougkwan@google.com>
11880
11881         Revert:
11882
11883         2009-11-25  Doug Kwan  <dougkwan@google.com>
11884
11885                 * arm.cc (Target_arm::Target_arm): Move method definition
11886                 outside of class definition.  Add code to handle
11887                 --target1-rel, --target1-abs and --target2= options.
11888                 (Target_arm::get_reloc_reloc_type): Change method to be
11889                 non-static and const.
11890                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
11891                 New data member declaration.
11892                 (Target_arm::Scan::local, Target_arm::Scan::global,
11893                 Target_arm::Relocate::relocate,
11894                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11895                 Adjust call to Target_arm::get_real_reloc_type.
11896                 (Target_arm::get_real_reloc_type): Use command line options
11897                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11898                 * options.h (--target1-rel, --target1-abs, --target2): New
11899                 ARM-only options.
11900
11901 2009-11-25  Doug Kwan  <dougkwan@google.com>
11902
11903         * arm.cc (Target_arm::Target_arm): Move method definition outside of
11904         class definition.  Add code to handle --target1-rel, --target1-abs
11905         and --target2= options.
11906         (Target_arm::get_reloc_reloc_type): Change method to be non-static
11907         and const.
11908         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
11909         member declaration.
11910         (Target_arm::Scan::local, Target_arm::Scan::global,
11911         Target_arm::Relocate::relocate,
11912         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
11913         call to Target_arm::get_real_reloc_type.
11914         (Target_arm::get_real_reloc_type): Use command line options to
11915         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11916         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
11917         options.
11918
11919 2009-11-25  Doug Kwan  <dougkwan@google.com>
11920
11921         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
11922         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
11923         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
11924         formatting.
11925         (Arm_relocate_functions::thm_call): Replace body with a call to
11926         Arm_relocate_functions::thumb_branch_common.
11927         (Arm_relocate_functions::thm_jump24,
11928         Arm_relocate_functions::thm_xpc22): New method definitions.
11929         (Arm_relocate_functions::thumb_branch_common): New method definition.
11930         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
11931         operator.
11932         (Target_arm::Relocate::relocate): Adjust call to thm_call.
11933         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
11934
11935 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11936
11937         * Makefile.am: Build incremental-dump
11938         * Makefile.in: Regenerate.
11939         * incremental-dump.cc: New.
11940         * incremental.cc (Incremental_inputs_header_data,
11941         Incremental_inputs_entry_data): Move to incremental.h
11942         * incremental.h: (Incremental_inputs_header_data,
11943         Incremental_inputs_entry_data): Move from incremental.cc
11944
11945 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11946
11947         * incremental.cc (Incremental_inputs_header,
11948         Incremental_inputs_header_write, Incremental_inputs_entry,
11949         Incremental_inputs_entry_write): Add a typedef with the data type.
11950
11951 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11952
11953         * incremental.cc (Incremental_inputs_header,
11954         Incremental_inputs_header_write, Incremental_inputs_entry,
11955         Incremental_inputs_entry_write): Update comment about which
11956         type has the filed descriptions.
11957
11958 2009-11-15  Doug Kwan  <dougkwan@google.com>
11959
11960         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11961         (Arm_relocate_functions::arm_branch_common): Change method defintion
11962         in class definition to a method declaration and update list of formal
11963         parameters.
11964         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11965         Arm_relocation_functions::jump24): Adjust call to
11966         Arm_relocate_functions::arm_branch_common.  Update list of formal
11967         parameters.
11968         (Arm_relocate_functions::xpc25): New method definition.
11969         (Arm_relocate_functions::arm_branch_common): Move method defintion
11970         out from class definition.  Use stubs for mode-switching and extending
11971         branch ranges.
11972         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11973         specially.  Change code to enable use of stubs in ARM branches.
11974
11975 2009-11-10  Doug Kwan  <dougkwan@google.com>
11976
11977         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11978         in method declaration.
11979         (Target_arm::relocate_stub): New method declaration.
11980         (Target_arm::default_target): Change to return a pointer instead of
11981         a const reference.
11982         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11983         Target_arm::default_target.
11984         (Arm_Relobj::do_relocate_sections): Remove options paramater in
11985         method definition.
11986         (Target_arm::relocate_section): Adjust view.
11987         (Target_arm::relocate_stub): New method definition.
11988
11989 2009-11-10  Doug Kwan  <dougkwan@google.com>
11990
11991         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11992         a format warning.
11993         * incremental.cc (open_incremental_binary): Initialized local
11994         variables to avoid warnings.
11995         * object.cc (make_elf_object): Ditto.
11996         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11997         a format warning.
11998
11999 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
12000
12001         PR gold/10930
12002         * testsuite/plugin_test.c: Include "config.h".
12003
12004 2009-11-09  Doug Kwan  <dougkwan@google.com>
12005
12006         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
12007         (arm_symbol_value): Remove.
12008         (Arm_relocate_functions::arm_branch_common,
12009         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
12010         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
12011         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
12012         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
12013         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
12014         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
12015         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
12016         Arm_relocate_functions::thm_mobw_abs_nc,
12017         Arm_relocate_functions::thm_mov_abs,
12018         Arm_relocate_functions::movw_prel_nc,
12019         Arm_relocate_functions::thm_movt_abs,
12020         Arm_relocate_functions::movt_prel,
12021         Arm_relocate_functions::thm_movw_prel_nc,
12022         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
12023         (Target_arm::Relocate::relocate): Only decompose address into two
12024         parts if relocation type uses the thumb-bit and pass the actual
12025         bit instead of a flag indicating that the thumb-bit is used.  Adjust
12026         calls to methods in Arm_relocate_functions for this change.
12027
12028 2009-11-08  Ian Lance Taylor  <iant@google.com>
12029
12030         PR 10925
12031         * reloc.cc: Instantiate
12032         Sized_relobj::initialize_input_to_output_maps and
12033         Sized_relobj:free_input_to_output_maps.
12034
12035 2009-11-06  Ian Lance Taylor  <iant@google.com>
12036
12037         PR 10876
12038         * defstd.cc (in_segment): Set only_if_ref true for "end".
12039
12040 2009-11-06  Doug Kwan  <dougkwan@google.com>
12041
12042         * arm.cc (class Reloc_stub): Correct a comment.
12043         (Target_arm::Target_arm): Initialize arm_input_section_map_.
12044         (Target_arm::scan_section_for_stubs): New method declaration.
12045         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
12046         Change methods from private to protected.
12047         (Target_arm::do_may_relax): New method definition.
12048         (Target_arm::do_relax, Target_arm::group_sections,
12049         Target_arm::scan_reloc_for_stub,
12050         Target_arm::scan_reloc_section_for_stubs): New method declarations.
12051         (Target_arm::arm_input_section_map_): New data member declaration.
12052         (Target_arm::scan_reloc_for_stub,
12053         Target_arm::scan_reloc_section_for_stubs,
12054         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
12055         Target_arm::do_relax): New method definitions.
12056
12057 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
12058
12059         * configure.ac: Check for (struct stat)::st_mtim
12060         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
12061         * config.in: Regenerate.
12062         * configure: Regenerate.
12063
12064 2009-11-05  Ian Lance Taylor  <iant@google.com>
12065
12066         PR 10910
12067         * output.cc (Output_segment::add_output_section): Add missing
12068         return statement.
12069
12070 2009-11-04  Ian Lance Taylor  <iant@google.com>
12071
12072         PR 10880
12073         * object.h (class Object): Add is_needed and set_is_needed
12074         methods.  Add is_needed_ field.  Make bool fields into bitfields.
12075         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
12076         defined in a dynamic object and referenced by a regular object,
12077         set is_needed for the dynamic object.
12078         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
12079         if the file is marked with as_needed and it is not needed.
12080
12081 2009-11-04  Ian Lance Taylor  <iant@google.com>
12082
12083         PR 10887
12084         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
12085         tags if data is discarded by linker script.
12086         * i386.cc (Target_i386::do_finalize_sections): Likewise.
12087         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
12088         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
12089         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
12090
12091 2009-11-04  Ian Lance Taylor  <iant@google.com>
12092
12093         * layout.cc (Layout::get_output_section): Add is_interp and
12094         is_dynamic_linker_section parameters.  Change all callers.
12095         (Layout::choose_output_section): Likewise.
12096         (Layout::make_output_section): Likewise.
12097         (Layout::add_output_section_data): Add is_dynamic_linker_section
12098         parameter.  Change all callers.
12099         * layout.h (class Layout): Update declarations.
12100         * output.h (class Output_section): Add is_interp, set_is_interp,
12101         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
12102         Add is_interp_, is_dynamic_linker_section_ fields.  Change
12103         generate_code_fills_at_write_ to a bitfield.
12104         * output.cc (Output_section::Output_sections): Initialize new
12105         fields.
12106         (Output_segment::add_output_section): Add do_sort parameter.
12107         Change all callers.
12108
12109 2009-11-03  Ian Lance Taylor  <iant@google.com>
12110
12111         PR 10860
12112         * options.h (class General_options): Add --warn-common.
12113         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
12114         merging two common symbols.
12115         (Symbol_table::should_override): Handle --warn-common when merging
12116         a common symbol with a defined symbol.  Use report_resolve_problem
12117         for multiple definitions.
12118         (Symbol_table::report_resolve_problem): New function.
12119         * symtab.h (class Symbol_table): Declare report_resolve_problem.
12120
12121 2009-11-03  Doug Kwan  <dougkwan@google.com>
12122
12123         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
12124         stub_factory_.
12125         (Target_arm::stub_factory): New method definition.
12126         (Target_arm::new_arm_input_section,
12127         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
12128         Target_arm::reloc_uses_thumb_bit): New method declarations.
12129         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
12130         New type definitions.
12131         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
12132         member declarations.
12133         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
12134         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
12135         New method definitions.
12136
12137 2009-11-03  Ian Lance Taylor  <iant@google.com>
12138
12139         * options.h (class General_options): Add --warn_constructors.
12140
12141 2009-11-03  Ian Lance Taylor  <iant@google.com>
12142
12143         PR 10893
12144         * defstd.cc (in_section): Add entries for __rel_iplt_start,
12145         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
12146
12147 2009-11-03  Ian Lance Taylor  <iant@google.com>
12148
12149         PR 10895
12150         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
12151         --msgid-bugs-address.
12152         (install-pdf): New target.
12153         (install-data_yes): Look up one directory to find mkinstalldirs.
12154
12155 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
12156
12157         * po/Make-in (.po.gmo): Don't generate .gmo files in source
12158         tree.
12159
12160 2009-10-30  Doug Kwan  <dougkwan@google.com>
12161
12162         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
12163
12164 2009-10-30  Doug Kwan  <dougkwan@google.com>
12165
12166         * arm.cc (Stub_addend_reader): New struct template definition
12167         and partial specializations.
12168         (Stub_addend_reader::operator()): New method definition for a
12169         partially specialized template.
12170
12171 2009-10-30  Doug Kwan  <dougkwan@google.com>
12172
12173         * arm.cc (Arm_relobj::processor_specific_flags): New method
12174         definition.
12175         (Arm_relobj::do_read_symbols): New method declaration.
12176         (Arm_relobj::processor_specific_flags_): New data member declaration.
12177         (Arm_dynobj): New class definition.
12178         (Target_arm::do_finalize_sections): Add input_objects parameter.
12179         (Target_arm::do_adjust_elf_header): New method declaration.
12180         (Target_arm::are_eabi_versions_compatible,
12181         (Target_arm::merge_processor_specific_flags): New method declaration.
12182         (Target_arm::do_make_elf_object): New overloaded method definitions
12183         and declaration.
12184         (Arm_relobj::do_read_symbols): New method definition.
12185         (Arm_dynobj::do_read_symbols): Ditto.
12186         (Target_arm::do_finalize_sections): Add input_objects parameters.
12187         Merge processor-specific flags from all input objects.
12188         (Target_arm::are_eabi_versions_compatible,
12189         Target_arm::merge_processor_specific_flags,
12190         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
12191         New method definitions.
12192         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
12193         Input_objects pointer type parameter.
12194         * layout.cc (Layout::finalize): Pass input objects to target's.
12195         finalize_sections function.
12196         * output.cc (Output_file_header::do_sized_write): Set ELF file
12197         header's processor-specific flags.
12198         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
12199         Input_objects pointer type parameter.
12200         * sparc.cc (Target_sparc::do_finalize_sections): Same.
12201         * target.h (Input_objects): New forward class declaration.
12202         (Target::processor_specific_flags,
12203         Target::are_processor_specific_flags_sect): New method definitions.
12204         (Target::finalize_sections): Add input_objects parameter.
12205         (Target::Target): Initialize processor_specific_flags_ and
12206         are_processor_specific_flags_set_.
12207         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
12208         parameter.
12209         (Target::set_processor_specific_flags): New method definition.
12210         (Target::processor_specific_flags_,
12211         Target::are_processor_specific_flags_set_): New data member
12212         declarations.
12213         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
12214         Input_objects pointer type parameter.
12215
12216 2009-10-30  Doug Kwan  <dougkwan@google.com>
12217
12218         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
12219
12220 2009-10-28  Ian Lance Taylor  <iant@google.com>
12221
12222         * object.h (class Relobj): Drop options parameter from
12223         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
12224         do_scan_relocs, do_relocate.  Change all callers.
12225         (class Sized_relobj): Drop options parameters from
12226         do_gc_process_relocs, do_scan_relocs, do_relocate,
12227         do_relocate_sections, relocate_sections, emit_relocs_scan,
12228         emit_relocs_scan_reltype.  Change all callers.
12229         (struct Relocate_info): Remove options field and all references to
12230         it.
12231         * reloc.h (class Read_relocs): Remove options constructor
12232         parameter and options_ field.  Change all callers.
12233         (class Gc_process_relocs, class Scan_relocs): Likewise.
12234         (class Relocate_task): Likewise.
12235         * target-reloc.h (scan_relocs): Remove options parameter.  Change
12236         all callers.
12237         (scan_relocatable_relocs): Likewise.
12238         * target.h (class Sized_target): Remove options parameter from
12239         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
12240         all callers.
12241         * gc.h (gc_process_relocs): Remove options parameter.  Change all
12242         callers.
12243         * arm.cc: Update functions to remove options parameters.
12244         * i386.cc: Likewise.
12245         * powerpc.cc: Likewise.
12246         * sparc.cc: Likewise.
12247         * x86_64.cc: Likewise.
12248         * testsuite/testfile.cc: Likewise.
12249
12250 2009-10-28  Doug Kwan  <dougkwan@google.com>
12251
12252         * arm.cc (Arm_relobj): New class definition.
12253         (Arm_relobj::scan_sections_for_stubs,
12254         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
12255         New method definitions.
12256
12257 2009-10-28  Cary Coutant  <ccoutant@google.com>
12258
12259         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
12260         (Plugin::cleanup_done_): New member.
12261         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
12262         (Plugin_manager::cleanup_done_): Remove.
12263         (Plugin_manager::add_input_file): Edit error message.
12264         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
12265         (Plugin_manager::cleanup): Remove use of cleanup_done_.
12266
12267 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
12268
12269         * fileread.cc: (File_read::View::~View): Use the new
12270         data_ownership_ filed.
12271         (File_read::~File_read): Dispose the new whole_file_view_.
12272         (File_read::open): Mmap the whole file if needed.
12273         (File_read::open): Use whole_file_view_ instead of contents_.
12274         (File_read::find_view): Use whole_file_view_ if applicable.
12275         (File_read::do_read): Use whole_file_view_ instead of contents_.
12276         (File_read::make_view): Use whole_file_view_ instead of contents_,
12277         update File_read::View::View call.
12278         (File_read::find_or_make_view): Update File_read::View::View
12279         call.
12280         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
12281         remove contents_
12282         (File_read::View::Data_ownership): New enum.
12283         (File_read::View::View): Replace bool mapped_ with Data_ownership
12284         argument.
12285         (File_read::View::mapped_): Remove (replaced by data_ownership_).
12286         (File_read::View::data_ownership_): New field.
12287         (File_read::contents_): Remove (replaced by whole_file_view_).
12288         (File_read::whole_file_view_): New field.
12289         * options.h (class General_options): Add --keep-files-mapped.
12290
12291 2009-10-27  Cary Coutant  <ccoutant@google.com>
12292
12293         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
12294         * testsuite/Makefile.am (plugin_test_5): New test case.
12295         * testsuite/Makefile.in: Regenerate.
12296
12297 2009-10-25  Doug Kwan  <dougkwan@google.com>
12298
12299         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
12300         from private to protected to allow access by child class.
12301         (Sized_relobj::do_relocate_sections): New method declaration.
12302         (Sized_relobj::relocate_sections): Virtualize.
12303         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
12304         Sized_relobj::relocate_sections.  Instantiate template explicitly
12305         for different target sizes and endianity.
12306
12307 2009-10-24  Doug Kwan  <dougkwan@google.com>
12308
12309         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
12310         (Arm_input_section::as_arm_input_section): New method.
12311         (Arm_output_section): New class definition.
12312         (Arm_output_section::create_stub_group,
12313         Arm_output_section::group_sections): New method definitions.
12314
12315 2009-10-22  Doug Kwan  <dougkwan@google.com>
12316
12317         * arm.cc (Arm_input_section): New class definition.
12318         (Arm_input_section::init, Arm_input_section:do_write,
12319         Arm_input_section::set_final_data_size,
12320         Arm_input_section::do_reset_address_and_file_offset): New method
12321         definitions.
12322
12323 2009-10-21  Doug Kwan  <dougkwan@google.com>
12324
12325         * arm.cc (Stub_table, Arm_input_section): New forward class
12326         declarations.
12327         (Stub_table): New class defintion.
12328         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
12329         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
12330         New method definition.
12331
12332 2009-10-21  Doug Kwan  <dougkwan@google.com>
12333
12334         * arm.cc: Update copyright comments.
12335         (Target_arm): New forward class template declaration.
12336         (Arm_address): New type.
12337         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
12338         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
12339         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
12340         constants.
12341         (Insn_template): Same.
12342         (DEF_STUBS): New macro.
12343         (Stub_type): New enum type.
12344         (Stub_template): New class definition.
12345         (Stub): Same.
12346         (Reloc_stub): Same.
12347         (Stub_factory): Same.
12348         (Target_arm::Target_arm): Initialize may_use_blx_ and
12349         should_force_pic_veneer_.
12350         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
12351         Target_arm::should_force_pic_veneer,
12352         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
12353         Target_arm::using_thumb_only, Target_arm:;default_target): New
12354         method defintions.
12355         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
12356         New data member declarations.
12357         (Insn_template::size, Insn_template::alignment): New method defintions.
12358         (Stub_template::Stub_template): New method definition.
12359         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
12360         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
12361         (Stub_factory::Stub_factory): New method definition.
12362         * gold.h (string_hash): New template.
12363         * output.h (Input_section_specifier::hash_value): Use
12364         gold::string_hash.
12365         (Input_section_specifier::string_hash): Remove.
12366         * stringpool.cc (Stringpool_template::string_hash): Use
12367         gold::string_hash.
12368
12369 2009-10-20  Doug Kwan  <dougkwan@google.com>
12370
12371         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
12372         symbols of relaxed input sections.
12373         * output.h (Output_section::find_relaxed_input_section): Make
12374         method public.
12375
12376 2009-10-16  Doug Kwan  <dougkwan@google.com>
12377
12378         * dynobj.cc (Versions::Versions): Initialize version_script_.
12379         Only insert base version symbol definition for a shared object
12380         if version script defines any version versions.
12381         (Versions::define_base_version): New method definition.
12382         (Versions::add_def): Check that base version is not needed.
12383         (Versions::add_need): Define base version lazily.
12384         * dynobj.h (Versions::define_base_version): New method declaration.
12385         (Versions::needs_base_version_): New data member declaration.
12386         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
12387         (check_DATA): Add no_version_test.stdout.
12388         (libno_version_test.so, no_version_test.o no_version_test.stdout):
12389         New make rules.
12390         * testsuite/Makefile.in: Regenerate.
12391         * testsuite/no_version_test.c: New file.
12392         * testsuite/no_version_test.sh: Ditto.
12393
12394 2009-10-16  Doug Kwan  <dougkwan@google.com>
12395
12396         * expression.cc (class Segment_start_expression): New class definition.
12397         (Segment_start_expression::value): New method definition.
12398         (script_exp_function_segment_start): Return a new
12399         Segment_start_expression.
12400         * gold/script-c.h (script_saw_segment_start_expression): New function
12401         prototype.
12402         * script-sections.cc (Script_sections::Script_sections): Initialize
12403         SAW_SEGMENT_START_EXPRESSION_ to false.
12404         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
12405         and -Tbbs options to specify section addresses if given in
12406         command line and no SEGMENT_START expression is seen in a script.
12407         * script-sections.h (Script_sections::saw_segment_start_expression,
12408         Script_sections::set_saw_segment_start_expression): New method
12409         definition.
12410         (Script_sections::saw_segment_start_expression_): New data member
12411         declaration.
12412         * script.cc (script_saw_segment_start_expression): New function.
12413         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
12414         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
12415         script_test_7.sh and script_test_8.sh.
12416         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
12417         script_test_8.stdout.
12418         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
12419         (script_test_6, script_test_6.stdout, script_test_7,
12420         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
12421         * Makefile.in: Regenerate.
12422         * testsuite/script_test_6.sh: New file.
12423         * testsuite/script_test_6.t: Same.
12424         * testsuite/script_test_7.sh: Same.
12425         * testsuite/script_test_7.t: Same.
12426         * testsuite/script_test_8.sh: Same.
12427
12428 2009-10-16  Doug Kwan  <dougkwan@google.com>
12429
12430         * output.cc (Output_segment::set_section_list_address): Cast
12431         expressions to unsigned long long type to avoid format warnings.
12432
12433 2009-10-15  Ian Lance Taylor  <iant@google.com>
12434
12435         * script.cc (Script_options::add_symbol_assignment): Always add a
12436         dot assignment to script_sections_.
12437         * script-sections.cc (Script_sections::add_dot_assignment):
12438         Initialize if necessary.
12439
12440         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
12441         program headers with no load segment if there is a linker script.
12442
12443         * layout.cc (Layout::set_segment_offsets): Align the file offset
12444         to the segment aligment for -N or -n with no load segment.
12445         * output.cc (Output_segment::add_output_section): Don't crash if
12446         the first section is a TLS section.
12447         (Output_segment::set_section_list_addresses): Print an error
12448         message if the address moves backward in a linker script.
12449         * script-sections.cc
12450         (Output_section_element_input::set_section_addresses): Don't
12451         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
12452         (Orphan_output_section::set_section_addresses): Likewise.
12453
12454 2009-10-15  Doug Kwan  <dougkwan@google.com>
12455
12456         * layout.cc (Layout::finish_dynamic_section): Generate tags
12457         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
12458         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
12459         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
12460
12461 2009-10-14  Ian Lance Taylor  <iant@google.com>
12462
12463         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
12464         fields.
12465         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
12466         data_shdr fields of relinfo.
12467         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
12468         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
12469         R_386_TLS_LDO_32, adjust based on section flags.
12470         (Target_i386::Relocate::fix_up_ldo): Remove.
12471
12472 2009-10-13  Ian Lance Taylor  <iant@google.com>
12473
12474         Add support for -pie.
12475         * options.h (class General_options): Add -pie and
12476         --pic-executable.
12477         (General_options::output_is_position_independent): Test -pie.
12478         (General_options::output_is_executable): Return true if not shared
12479         and not relocatable.
12480         (General_options::output_is_pie): Remove.
12481         * options.cc (General_options::finalize): Reject incompatible uses
12482         of -pie.
12483         * gold.cc (queue_middle_tasks): A -pie link is not static.
12484         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
12485         * symtab.cc (Symbol::final_value_is_known): Return false if
12486         output_is_position_independent.
12487         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
12488         output_is_position_independent.
12489         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
12490         output_is_position_independent.
12491         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
12492         output_is_position_independent.
12493         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
12494         two_file_pie_test.
12495         (basic_pie_test.o, basic_pie_test): New targets.
12496         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
12497         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
12498         (two_file_pie_test): New target.
12499         * testsuite/Makefile.in: Rebuild.
12500         * README: Remove note saying that -pie is not supported.
12501
12502 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
12503
12504         * options.h (class General_options): Add -init and -fini.
12505         * layout.cc (Layout::finish_dynamic_section): Emit
12506         given init and fini functions.
12507
12508 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
12509
12510         * gc.h (gc_process_relocs): Check if icf is enabled using new
12511         function.
12512         * gold.cc (queue_initial_tasks): Likewise.
12513         (queue_middle_tasks): Likewise.
12514         * object.cc (do_layout): Likewise.
12515         * symtab.cc (is_section_folded): Likewise.
12516         * main.cc (main): Likewise.
12517         * reloc.cc (Read_relocs::run): Likewise.
12518         (Sized_relobj::do_scan_relocs): Likewise.
12519         * icf.cc (is_function_ctor_or_dtor): New function.
12520         (Icf::find_identical_sections): Check if function is ctor or dtor when
12521         safe icf is chosen.
12522         * options.h (General_options::icf): Change option to be an enum.
12523         (Icf_status): New enum.
12524         (icf_enabled): New method.
12525         (icf_safe_folding): New method.
12526         (set_icf_status): New method.
12527         (icf_status_): New variable.
12528         * (options.cc) (General_options::finalize): Set icf_status_.
12529         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
12530         icf_test and icf_keep_unique_test to use the --icf enum flag.
12531         * testsuite/icf_safe_test.sh: New file.
12532         * testsuite/icf_safe_test.cc: New file.
12533
12534 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
12535
12536         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
12537         includes to gc.h and icf.h.
12538         * arm.cc: Include gc.h.
12539         * gold.cc: Likewise.
12540         * i386.cc: Likewise.
12541         * powerpc.cc: Likewise.
12542         * sparc.cc: Likewise.
12543         * x86_64.cc: Likewise.
12544         * gc.h: Include icf.h.
12545
12546 2009-10-11  Ian Lance Taylor  <iant@google.com>
12547
12548         * plugin.cc: Include "gold.h" before other header files.
12549
12550 2009-10-10  Chris Demetriou  <cgd@google.com>
12551
12552         * options.h (Input_file_argument::Input_file_type): New enum.
12553         (Input_file_argument::is_lib_): Replace with...
12554         (Input_file_argument::type_): New member.
12555         (Input_file_argument::Input_file_argument): Take Input_file_type
12556         'type' rather than boolean 'is_lib' as second argument.
12557         (Input_file_argument::is_lib): Use type_.
12558         (Input_file_argument::is_searched_file): New function.
12559         (Input_file_argument::may_need_search): Handle is_searched_file.
12560         * options.cc (General_options::parse_library): Support -l:filename.
12561         (General_options::parse_just_symbols): Update for Input_file_argument
12562         changes.
12563         (Command_line::process): Likewise.
12564         * archive.cc (Archive::get_file_and_offset): Likewise.
12565         * plugin.cc (Plugin_manager::release_input_file): Likewise.
12566         * script.cc (read_script_file, script_add_file): Likewise.
12567         * fileread.cc (Input_file::Input_file): Likewise.
12568         (Input_file::will_search_for): Handle is_searched_file.
12569         (Input_file::open): Likewise.
12570         * readsyms.cc (Read_symbols::get_name): Likewise.
12571         * testsuite/Makefile.am (searched_file_test): New test.
12572         * testsuite/Makefile.in: Regenerate.
12573         * testsuite/searched_file_test.cc: New file.
12574         * testsuite/searched_file_test_lib.cc: New file.
12575
12576 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12577             Ian Lance Taylor  <iant@google.com>
12578
12579         * descriptor.cc: Include <cstdio> and "binary-io.h".
12580         (Descriptors::open): Open the files in binary mode always.
12581         * script.cc (Lex::get_token): Treat \r as whitespace.
12582
12583 2009-10-09  Ian Lance Taylor  <iant@google.com>
12584
12585         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
12586
12587 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12588             Ian Lance Taylor  <iant@google.com>
12589
12590         * configure.ac: Check for readv function also.
12591         * fileread.cc (readv): Define if not HAVE_READV.
12592         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
12593         does not exist.
12594         * config.in: Regenerate.
12595         * configure: Regenerate.
12596
12597 2009-10-09  Doug Kwan  <dougkwan@google.com>
12598
12599         * layout.cc (Layout::make_output_section): Call target hook to make
12600         ordinary output section.
12601         (Layout::finalize): Adjust parameter list of call the
12602         Target::may_relax().
12603         * layout.h (class Layout::section_list): New method.
12604         * merge.h (Output_merge_base::entsize): Change visibility to public.
12605         (Output_merge_base::is_string, Output_merge_base::do_is_string):
12606         New methods.
12607         (Output_merge_string::do_is_string): New method.
12608         * object.cc (Sized_relobj::do_setup): renamed from
12609         Sized_relobj::set_up.
12610         * object.h (Sized_relobj::adjust_shndx,
12611         Sized_relobj::initializ_input_to_output_maps,
12612         Sized_relobj::free_input_to_output_maps): Change visibilities to
12613         protected.
12614         (Sized_relobj::setup): Virtualize.
12615         (Sized_relobj::do_setup): New method declaration.
12616         (Sized_relobj::invalidate_section_offset,
12617         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
12618         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
12619         * options.cc (parse_int): New function.
12620         * options.h (parse_int): New declaration.
12621         (DEFINE_int): New macro.
12622         (stub_group_size): New option.
12623         * output.cc (Output_section::Output_section): Initialize memebers
12624         merge_section_map_, merge_section_by_properties_map_,
12625         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
12626         (Output_section::add_input_section): Handled deferred code-fill
12627         generation and remove an old comment.
12628         (Output_section::add_relaxed_input_section): New method definition.
12629         (Output_section::add_merge_input_section): Use merge section by
12630         properties map to speed to search.  Update merge section maps
12631         as appropriate.
12632         (Output_section::build_relaxation_map): New method definition.
12633         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
12634         Same.
12635         (Output_section::relax_input_section): Renamed to
12636         Output_section::convert_input_sections_to_relaxed_sections and change
12637         interface to take a vector of pointers to relaxed sections.
12638         (Output_section::find_merge_section,
12639         Output_section::find_relaxed_input_section): New method definitions.
12640         (Output_section::is_input_address_mapped,
12641         Output_section::output_offset, Output_section::output_address):
12642         Use output section data maps to speed up searching.
12643         (Output_section::find_starting_output_address): Add comments.
12644         (Output_section::do_write,
12645         Output_section::write_to_postprocessing_buffer): Do code-fill
12646         generation as appropriate.
12647         (Output_section::get_input_sections): Invalidate relaxed input section
12648         map.
12649         (Output_section::restore_states): Adjust type of checkpoint .
12650         Invalidate relaxed input section map.
12651         * output.h (Output_merge_base): New class declaration.
12652         (Input_section_specifier): New class defintion.
12653         (class Output_relaxed_input_section) Change base class to
12654         Output_section_data_build.
12655         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
12656         base class initializer.
12657         (Output_section::add_relaxed_input_section): New method declaration.
12658         (Output_section::Input_section): Change visibility to protected.
12659         (Output_section::Input_section::relobj,
12660         Output_section::Input_section::shndx): Handle relaxed input sections.
12661         Output_section::input_sections) Change visibility to protected.  Also
12662         define overload to return a non-const pointer.
12663         (Output_section::Merge_section_properties): New class defintion.
12664         (Output_section::Merge_section_by_properties_map,
12665         Output_section::Output_section_data_by_input_section_map,
12666         Output_section::Relaxation_map): New types.
12667         (Output_section::relax_input_section): Rename method to
12668         Output_section::convert_input_sections_to_relaxed_sections and change
12669         interface to take a vector of relaxed section pointers.
12670         (Output_section::find_merge_section,
12671         Output_section::find_relaxed_input_section,
12672         Output_section::build_relaxation_map,
12673         Output_section::convert_input_sections_in_list_to_relaxed_sections):
12674         New method declarations.
12675         (Output_section::merge_section_map_
12676         Output_section::merge_section_by_properties_map_,
12677         Output_section::relaxed_input_section_map_,
12678         Output_section::is_relaxed_input_section_map_valid_,
12679         Output_section::generate_code_fills_at_write_): New data members.
12680         * script-sections.cc
12681         (Output_section_element_input::set_section_addresses): Call
12682         current_data_size and addralign methods of relaxed input sections.
12683         (Orphan_output_section::set_section_addresses): Call current_data_size
12684         and addralign methods of relaxed input sections.
12685         * symtab.cc (Symbol_table::compute_final_value): Extract template
12686         from the body of Symbol_table::sized_finalize_symbol.
12687         (Symbol_table::sized_finalized_symbol): Call
12688         Symbol_table::compute_final_value.
12689         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
12690         (Symbol_table::compute_final_value): New templated method declaration.
12691         * target.cc (Target::do_make_output_section): New method defintion.
12692         * target.h (Target::make_output_section): New method declaration.
12693         (Target::relax): Add more parameters for input objects, symbol table
12694         and layout.  Adjust call to do_relax.
12695         (Target::do_make_output_section): New method declaration.
12696         (Target::do_relax): Add parameters for input objects, symbol table
12697         and layout.
12698
12699 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12700
12701         * pread.c: Include stdio.h.
12702
12703 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12704
12705         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
12706         defined.
12707
12708 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12709
12710         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
12711         Change read_shndx type to unsigned int.
12712         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12713         int.
12714         (Sized_dwarf_line_info::read_line_mappings): Likewise.
12715         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
12716         Change read_shndx type to unsigned int.
12717         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12718         int.
12719         (Sized_dwarf_line_info::read_line_mappings): Likewise.
12720         * layout.cc (Layout::create_symtab_sections): Cast the result of
12721         local_symcount * symsize to off_t in the gold_assert.
12722
12723 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12724
12725         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
12726         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
12727         R_ARM_BASE_ABS.
12728         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
12729         (Arm_relocate_functions::thm_abs5): New function.
12730         (Arm_relocate_functions::abs12): New function.
12731         (Arm_relocate_functions::abs16): New function.
12732         (Arm_relocate_functions::base_abs): New function.
12733         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
12734         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
12735         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
12736         R_ARM_BASE_ABS.
12737         (Scan::global): Likewise.
12738         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
12739         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
12740         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
12741         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
12742         R_ARM_BASE_ABS.
12743
12744 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12745
12746         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
12747         (Arm_relocate_functions::movt_prel): New function.
12748         (Arm_relocate_functions::thm_movw_prel_nc): New function.
12749         (Arm_relocate_functions::thm_movt_prel): New function.
12750         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
12751         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
12752         (Scan::global, Relocate::relocate): Likewise.
12753         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12754
12755 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
12756
12757         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
12758         Incremental_checker.
12759         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
12760         unsigned int.
12761         (class Incremental_inputs_header): New class.
12762         (Incremental_inputs_header_writer): Edit comment.
12763         (Incremental_inputs_entry): New class.
12764         (Incremental_inputs_entry_writer): Edit comment.
12765         (Sized_incremental_binary::do_find_incremental_inputs_section):
12766         Add *strtab_shndx parameter, fill it.
12767         (Sized_incremental_binary::do_check_inputs): New method.
12768         (Incremental_checker::can_incrementally_link_output_file): Use
12769         Sized_incremental_binary::check_inputs.
12770         (Incremental_inputs::report_command_line): Save command line in
12771         command_line_.
12772         * incremental.h:
12773         (Incremental_binary::find_incremental_inputs_section): New
12774         method.
12775         (Incremental_binary::do_find_incremental_inputs_section): Add
12776         strtab_shndx parameter.
12777         (Incremental_binary::do_check_inputs): New pure virtual method.
12778         (Sized_incremental_binary::do_check_inputs): Declare.
12779         (Incremental_checker::Incremental_checker): Add incremental_inputs
12780         parameter, use it to initialize incremental_inputs_.
12781         (Incremental_checker::incremental_inputs_): New field.
12782         (Incremental_checker::command_line): New method.
12783         (Incremental_checker::inputs): New method.
12784         (Incremental_checker::command_line_): New field.
12785
12786 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
12787
12788         * incremental.cc: Include <cstdarg> and "target-select.h".
12789         (vexplain_no_incremental): New function.
12790         (explain_no_incremental): New function.
12791         (Incremental_binary::error): New method.
12792         (Sized_incremental_binary::do_find_incremental_inputs_section): New
12793         method.
12794         (make_sized_incremental_binary): New function.
12795         (open_incremental_binary): New function.
12796         (can_incrementally_link_file): Add checks if output is ELF and has
12797         inputs section.
12798         * incremental.h: Include "elfcpp_file.h" and "output.h".
12799         (Incremental_binary): New class.
12800         (Sized_incremental_binary): New class.
12801         (open_incremental_binary): Declare.
12802         * object.cc (is_elf_object): Use
12803         elfcpp::Elf_recognizer::is_elf_file.
12804         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
12805         * output.h (Output_file::filesize): New method.
12806
12807 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12808
12809         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
12810         New function.
12811         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
12812         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
12813         function.
12814         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
12815         function.
12816         (Arm_relocate_functions::movw_abs_nc): New function.
12817         (Arm_relocate_functions::movt_abs): New function.
12818         (Arm_relocate_functions::thm_movw_abs_nc): New function.
12819         (Arm_relocate_functions::thm_movt_abs): New function.
12820         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
12821         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
12822         (Scan::global): Likewise.
12823         (Relocate::relocate): Likewise.
12824         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12825
12826 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12827
12828         * arm.cc (Arm_relocate_functions::got_prel) New function.
12829         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
12830         (Relocate::relocate): Likewise.
12831         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12832
12833 2009-10-06  Ian Lance Taylor  <iant@google.com>
12834
12835         * options.h (class General_options): Define
12836         split_stack_adjust_size parameter.
12837         * object.h (class Object): Add uses_split_stack_ and
12838         has_no_split_stack_ fields.  Add uses_split_stack and
12839         has_no_split_stack accessor functions.  Declare
12840         handle_split_stack_section.
12841         (class Reloc_symbol_changes): Define.
12842         (class Sized_relobj): Define Function_offsets.  Declare
12843         split_stack_adjust, split_stack_adjust_reltype, and
12844         find_functions.
12845         * object.cc (Object::handle_split_stack_section): New function.
12846         (Sized_relobj::do_layout): Call handle_split_stack_section.
12847         * dynobj.cc (Sized_dynobj::do_layout): Call
12848         handle_split_stack_section.
12849         * reloc.cc (Sized_relobj::relocate_sections): Call
12850         split_stack_adjust for executable sections in split_stack
12851         objects.  Pass reloc_map to relocate_section.
12852         (Sized_relobj::split_stack_adjust): New function.
12853         (Sized_relobj::split_stack_adjust_reltype): New function.
12854         (Sized_relobj::find_functions): New function.
12855         * target-reloc.h: Include "object.h".
12856         (relocate_section): Add reloc_symbol_changes parameter.  Change
12857         all callers.
12858         * target.h (class Target): Add calls_non_split method.  Declare
12859         do_calls_non_split virtual method.  Declare match_view and
12860         set_view_to_nop.
12861         * target.cc: Include "elfcpp.h".
12862         (Target::do_calls_non_split): New function.
12863         (Target::match_view): New function.
12864         (Target::set_view_to_nop): New function.
12865         * gold.cc (queue_middle_tasks): Give an error if mixing
12866         split-stack and non-split-stack objects with -r.
12867         * i386.cc (Target_i386::relocate_section): Add
12868         reloc_symbol_changes parameter.
12869         (Target_i386::do_calls_non_split): New function.
12870         * x86_64.cc (Target_x86_64::relocate_section): Add
12871         reloc_symbol_changes parameter.
12872         (Target_x86_64::do_calls_non_split): New function.
12873         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
12874         parameter.
12875         * powerpc.cc (Target_powerpc::relocate_section): Add
12876         reloc_symbol_changes parameter.
12877         * sparc.cc (Target_sparc::relocate_section): Add
12878         reloc_symbol_changes parameter.
12879         * configure.ac: Call AM_CONDITIONAL for the default target.
12880         * configure: Rebuild.
12881         * testsuite/Makefile.am (TEST_AS): New variable.
12882         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
12883         (check_DATA): Add split_i386 and split_x86_64 files.
12884         (SPLIT_DEFSYMS): Define.
12885         (split_i386_[1234n].o): New targets.
12886         (split_i386_[124]): New targets.
12887         (split_i386_[1234r].stdout): New targets.
12888         (split_x86_64_[1234n].o): New targets.
12889         (split_x86_64_[124]): New targets.
12890         (split_x86_64_[1234r].stdout): New targets.
12891         (MOSTLYCLEANFILES): Add new executables.
12892         * testsuite/split_i386.sh: New file.
12893         * testsuite/split_x86_64.sh: New file.
12894         * testsuite/split_i386_1.s: New file.
12895         * testsuite/split_i386_2.s: New file.
12896         * testsuite/split_i386_3.s: New file.
12897         * testsuite/split_i386_4.s: New file.
12898         * testsuite/split_i386_n.s: New file.
12899         * testsuite/split_x86_64_1.s: New file.
12900         * testsuite/split_x86_64_2.s: New file.
12901         * testsuite/split_x86_64_3.s: New file.
12902         * testsuite/split_x86_64_4.s: New file.
12903         * testsuite/split_x86_64_n.s: New file.
12904         * testsuite/testfile.cc (Target_test): Update relocation_section
12905         function.
12906         * testsuite/Makefile.in: Rebuild.
12907
12908 2009-10-06  Ian Lance Taylor  <iant@google.com>
12909
12910         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
12911         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
12912         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
12913         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
12914         the address on ldo_addrs_.
12915         (Target_i386::Relocate::fix_up_ldo): New function.
12916
12917 2009-10-06   Rafael Espindola  <espindola@google.com>
12918
12919         * plugin.cc (add_input_library): New.
12920         (Plugin::load): Add add_input_library to tv.
12921         (Plugin_manager::add_input_file): Add the is_lib argument.
12922         (add_input_file): Update call to Plugin_manager::add_input_file.
12923         (add_input_library): New.
12924         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
12925
12926 2009-09-30  Doug Kwan  <dougkwan@google.com>
12927
12928         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
12929         symbol and call Symbol::may_need_copy_reloc to determine if
12930         a copy reloc is needed.
12931         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12932         nocopyreloc is given in command line.
12933         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12934         given in command line.
12935         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12936         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
12937         of the removed Target_i386::may_need_copy_reloc.
12938         * options.h (copyreloc): New option with default value false.
12939         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12940         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12941         instead of the removed Target_powerpc::may_need_copy_reloc.
12942         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12943         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
12944         instead of the removed Target_sparc::may_need_copy_reloc.
12945         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
12946         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
12947         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12948         instead of the removed Target_x86_64::may_need_copy_reloc.
12949
12950 2009-09-30  Ian Lance Taylor  <iant@google.com>
12951
12952         * object.h (class Object): Remove target_ field, and target,
12953         sized_target, and set_target methods.
12954         (Object::sized_target): Remove.
12955         (class Sized_relobj): Update declarations.  Remove sized_target.
12956         * object.cc (Sized_relobj::setup): Remove target parameter.
12957         Change all callers.
12958         (Input_objects::add_object): Don't do anything with the target.
12959         (make_elf_sized_object): Add punconfigured parameter.  Change all
12960         callers.  Set or test parameter target.
12961         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12962         Change all callers.
12963         * parameters.cc (Parameters::set_target): Change parameter type to
12964         be non-const.
12965         (Parameters::default_target): Remove.
12966         (set_parameters_target): Change parameter type to be non-const.
12967         (parameters_force_valid_target): New function.
12968         (parameters_clear_target): New function.
12969         * parameters.h (class Parameters): Update declarations.  Remove
12970         default_target method.  Add sized_target and clear_target
12971         methods.  Change target_ to be non-const.
12972         (set_parameters_target): Update declaration.
12973         (parameters_force_valid_target): Declare.
12974         (parameters_clear_target): Declare.
12975         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12976         as NULL if we aren't searching.
12977         (Add_symbols::run): Don't check for compatible target.
12978         * fileread.cc (Input_file::open_binary): Call
12979         parameters_force_valid_target.
12980         * gold.cc (queue_middle_tasks): Likewise.
12981         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
12982         set_target on object.
12983         * dynobj.h (class Sized_dynobj): Update declarations.
12984         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12985         make_elf_object returns NULL.
12986         (Archive::include_member): Don't check whether object target is
12987         compatible.
12988         * output.cc (Output_section::add_input_section): Get target from
12989         parameters.
12990         (Output_section::relax_input_section): Likewise.
12991         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12992         parameters.
12993         (Sized_relobj::do_scan_relocs): Likewise.
12994         (Sized_relobj::relocate_sections): Likewise.
12995         * resolve.cc (Symbol_table::resolve): Likewise.
12996         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
12997         parameter.  Change all callers.
12998         (Symbol_table::add_from_object): Get target from parameters.
12999         (Symbol_table::add_from_relobj): Don't check object target.
13000         (Symbol_table::add_from_dynobj): Likewise.
13001         (Symbol_table::define_special_symbol): Get target from
13002         parameters.
13003         * symtab.h (class Symbol_table): Update declaration.
13004         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
13005         parameter.  Change all callers.  Clear parameter target.
13006         (Binary_test): Test target here.
13007         * testsuite/object_unittest.cc (gold_testsuite): Remove
13008         target_test_pointer parameter.  Change all callers.
13009         (Object_test): Test target here.
13010
13011 2009-09-26  Ian Lance Taylor  <iant@google.com>
13012
13013         * testsuite/initpri1.c: Don't try to use constructor priorities if
13014         compiling with gcc before 4.3.
13015
13016 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
13017
13018         * testsuite/retain_symbols_file_test.sh (check_present): Change
13019         output file name to retain_symbols_file_test.stdout.
13020         (check_absent): Likewise.
13021
13022 2009-09-18  Craig Silverstein  <csilvers@google.com>
13023
13024         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
13025         * options.cc: Include <cerrno> and <fstream>.
13026         (General_options::finalize): Parse -retain-symbols-file tag.
13027         * options.h: New flag.
13028         (General_options): New method should_retain_symbol, new
13029         variable symbols_to_retain.
13030         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
13031         should_retain_symbol map.
13032         * testsuite/Makefile.am (retain_symbols_file_test): New test.
13033         * testsuite/Makefile.in: Regenerate.
13034         * testsuite/retain_symbols_file_test.sh: New file.
13035
13036 2009-09-18  Nick Clifton  <nickc@redhat.com>
13037
13038         * po/es.po: Updated Spanish translation.
13039
13040 2009-09-17  Doug Kwan  <dougkwan@google.com>
13041
13042         * debug.h (DEBUG_RELAXATION): New constant.
13043         (DEBUG_ALL): Add DEBUG_RELAXATION.
13044         (debug_string_to_enum): Add relaxation debug option.
13045         * layout.cc
13046         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
13047         Layout::Relaxation_debug_check::read_sections,
13048         Layout::Relaxation_debug_check::read_sections): New method definitions.
13049         (Layout::Layout): Initialize data members
13050         record_output_section_data_from_scrips_,
13051         script_output_section_data_list_ and relaxation_debug_check_.
13052         (Layout::save_segments, Layout::restore_segments,
13053         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13054         Layout::relaxation_loop_body): New method definitions.
13055         (Layout::finalize): Support relaxation.  Move section layout code to
13056         Layout::relaxation_loop_body.
13057         (Layout::set_asection_address_from_script): Move code for orphan
13058         section placement out.
13059         (Layout::place_orphan_sections_in_script): New method definition.
13060         * layout.h (Output_segment_headers, Output_file_header):
13061         New forward class declarations.
13062         (Layout::~Layout): Define.
13063         (Layout::new_output_section_data_from_script): New method definition.
13064         (Layout::place_orphan_sections_in_script): New method declaration.
13065         (Layout::Segment_states): New type declaration.
13066         (Layout::save_segments, Layout::restore_segments,
13067         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13068         Layout::relaxation_loop_body): New method declarations.
13069         (Layout::Output_section_data_list): New type declaration.
13070         (Layout::Relaxation_debug_check): New class definition.
13071         (Layout::record_output_section_data_from_script_,
13072         Layout::script_output_section_data_list_, Layout::segment_states_,
13073         Layout::relaxation_debug_check_): New data members.
13074         * output.cc: (Output_section_headers::do_size): New method definition.
13075         (Output_section_headers::Output_section_headers): Move size
13076         computation to Output_section_headers::do_size.
13077         (Output_segment_headers::do_size): New method definition.
13078         (Output_file_header::Output_file_header): Move size computation to
13079         Output_file_header::do_size and call it.
13080         (Output_file_header::do_size): New method definition.
13081         (Output_data_group::Output_data_group): Adjust call to
13082         Output_section_data.
13083         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
13084         (Output_symtab_xindex::do_write): Add array bound check.
13085         (Output_section::Input_section::print_to_mapfile): Handle
13086         RELAXED_INPUT_SECTION_CODE.
13087         (Output_section::Output_section): Initialize data member checkpoint_.
13088         (Output_section::~Output_section): Delete checkpoint object pointed
13089         by checkpoint_.
13090         (Output_section::add_input_section): Always add an Input_section if
13091         relaxing.
13092         (Output_section::add_merge_input_section): Add assert.
13093         (Output_section::relax_input_section): New method definition.
13094         (Output_section::set_final_data_size): Set load address to zero for
13095         an unallocated section.
13096         (Output_section::do_address_and_file_offset_have_reset_values):
13097         New method definition.
13098         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
13099         Handle relaxed input section.
13100         (Output_section::sort_attached_input_sections): Checkpoint input
13101         section list lazily.
13102         (Output_section::get_input_sections): Change type of input_sections to
13103         list of Simple_input_section pointers.  Checkpoint input section list
13104         lazily.  Also handle relaxed input sections.
13105         (Output_section::add_input_section_for_script): Take a reference to
13106         a Simple_input_section object instead of Relobj pointer and section
13107         index as parameter.  Handle relaxed input sections.
13108         (Output_section::save_states, Output_section::restore_states): New
13109         method definitions.
13110         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
13111         (Output_data::is_data_size_fixed): New method definition.
13112         (Output_data::reset_addresss_and_file_offset): Do not reset data size
13113         if it is fixed.
13114         (Output_data::address_and_file_offset_have_reset_values): New method
13115         definition.
13116         (Output_data::do_address_and_file_offset_have_reset_values): New method
13117         definition.
13118         (Output_data::set_data_size): Check that data size is not fixed.
13119         (Output_data::fix_data_size): New method definition.
13120         (Output_data::is_data_size_fixed_): New data member.
13121         (Output_section_headers::set_final_data_size): New method definition.
13122         (Output_section_headers::do_size): New method declaration.
13123         (Output_segment_headers::set_final_data_size): New method definition.
13124         (Output_segment_headers::do_size): New method declaration.
13125         (Output_file_header::set_final_data_size)::New method definition.
13126         (Output_file_header::do_size)::New method declaration.
13127         (Output_section_data::Output_section_data): Add new parameter
13128         is_data_size_fixed and use it to fix data size.
13129         (Output_data_const::Output_data_const): Adjust call to base class
13130         constructor and fix data size.
13131         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
13132         base class constructor and fix data size.
13133         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
13134         base class constructor and fix data size.
13135         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
13136         class constructor and fix data size.
13137         (Output_data_group::set_final_data_size): New method definition.
13138         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
13139         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
13140         class constructor and fix data size.
13141         (Output_relaxed_input_section): New class definition.
13142         (Output_section::Simple_input_section): New class definition.
13143         (Output_section::get_input_sections): Adjust parameter list.
13144         (Output_section::add_input_section_for_script): Same.
13145         (Output_section::save_states, Output_section::restore_states,
13146         Output_section::do_address_and_file_offset_have_reset_values,
13147         (Output_section::Input_section::Input_section): Handle
13148         RELAXED_INPUT_SECTION_CODE.  Add new overload for
13149         Output_relaxed_input_section.
13150         (Output_section::Input_section::is_input_section,
13151         Output_section::Input_section::set_output_section): Handle relaxed
13152         input section.
13153         (Output_section::Input_section::is_relaxed_input_section,
13154         Output_section::Input_section::output_section_data,
13155         Output_section::Input_section::relaxed_input_section): New method
13156         definitions.
13157         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
13158         value.
13159         (Output_section::Input_section::u1_): Update comments.
13160         (Output_section::Input_section::u2_): Add new union member poris.
13161         (Output_section::Checkpoint_output_section): New classs definition.
13162         (Output_section::relax_input_section): New method declaration.
13163         (Output_section::checkpoint_): New data member.
13164         (Output_segment): Update comments.
13165         (Output_segment::Output_segment): Un-privatize copy constructor.
13166         (Output_segment::operator=): Un-privatize.
13167         * script-sections.cc (Output_section_element::Input_section_list):
13168         Change element type to Output_section::Simple_input_section.
13169         (Output_section_element_dot_assignment::set_section_addresses):
13170         Register output section data for relaxation clean up.
13171         (Output_data_exression::Output_data_expression): Adjust call to base
13172         constructor to fix data size.
13173         (Output_section_element_data::set_section_addresses): Register
13174         Output_data_expression object for relaxation clean up.
13175         (struct Input_section_info): Replace Relobj pointer and section index
13176         pair with Output_section::Simple_input_section and Convert struct to a
13177         class.
13178         (Input_section_sorter::operator()): Adjust access to
13179         Input_section_info data member to use accessors.
13180         (Output_section_element_input::set_section_addresses): Use layout
13181         parameter.  Adjust code to use Output_section::Simple_input_section
13182         and Input_secction_info classes.  Register filler for relaxation
13183         clean up.
13184         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
13185         and section index pair with Output_section::Simple_input_section
13186         class.  Adjust code accordingly.
13187         (Phdrs_element::release_segment): New method definition.
13188         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
13189         segment list.
13190         (Script_sections::release_segments): New method definition.
13191         * gold/script-sections.h (Script_sections::release_segments): New
13192         method declaration.
13193         * gold/target.h (Target::may_relax, Target::relax,
13194         Target::do_may_relax, Target::do_relax): New method definitions.
13195
13196 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13197
13198         * arm.cc (has_signed_unsigned_overflow): New function.
13199         (Arm_relocate_functions::abs8): New function.
13200         (Target_arm::Scan::local): Handle R_ARM_ABS8.
13201         (Target_arm::Scan::global): Likewise.
13202         (Target_arm::relocate::relocate): Likewise.
13203         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
13204         Likewise.
13205
13206 2009-09-16  Cary Coutant  <ccoutant@google.com>
13207
13208         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
13209         * testsuite/Makefile.in: Regenerate.
13210
13211 2009-09-11  Nick Clifton  <nickc@redhat.com>
13212
13213         * po/gold.pot: Updated by the Translation project.
13214
13215 2009-09-08  Cary Coutant  <ccoutant@google.com>
13216
13217         * output.cc (Output_file::open): Add execute permission to empty file.
13218         * testsuite/Makefile.am (permission_test): New test.
13219         * testsuite/Makefile.in: Regenerate.
13220
13221 2009-09-02  Ian Lance Taylor  <iant@google.com>
13222
13223         * output.cc (Output_file::resize): Call map_no_anonymous rather
13224         than map.
13225
13226 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
13227
13228         * gold.cc: Include "incremental.h".
13229         (queue_initial_tasks): Call Incremental_checker methods.
13230         * incremental.cc: Include "output.h".
13231         (Incremental_checker::can_incrementally_link_output_file): New
13232         method.
13233         * incremental.h (Incremental_checker): New class.
13234
13235         * output.cc (Output_file::open_for_modification): New method.
13236         (Output_file::map_anonymous): Changed return type to bool.  Record
13237         map in base_ field.
13238         (Output_file::map_no_anonymous): New method, broken out of map.
13239         (Output_file::map): Use map_no_anonymous and map_anonymous.
13240         * output.h (class Output_file): Update declarations.
13241
13242 2009-08-24  Cary Coutant  <ccoutant@google.com>
13243
13244         * options.h (Command_line::Pre_options): New class.
13245         (Command_line::pre_options): New member.
13246         * options.cc (gold::options::ready_to_register): New variable.
13247         (One_option::register_option): Do nothing if not registering options.
13248         Assert if same short option registered twice.
13249         (General_options::General_options): Turn off option registration when
13250         done constructing.
13251         (Command_line::Pre_options::Pre_options): New constructor.
13252
13253 2009-08-24  Cary Coutant  <ccoutant@google.com>
13254
13255         * options.h (General_options::no_keep_memory): Remove incorrect
13256         short option.
13257
13258 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
13259
13260         * Makefile.am (am__skiplex, am__skipyacc): New.
13261         * Makefile.in: Regenerate.
13262
13263 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
13264
13265         * Makefile.am (AM_CPPFLAGS): Renamed from ...
13266         (INCLUDES): ... this.
13267         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
13268         (AM_CPPFLAGS): Renamed from ...
13269         (INCLUDE): ... this.
13270         * Makefile.in, testsuite/Makefile.in: Regenerate.
13271
13272         * Makefile.in: Regenerate.
13273         * aclocal.m4: Likewise.
13274         * config.in: Likewise.
13275         * configure: Likewise.
13276         * testsuite/Makefile.in: Likewise.
13277
13278         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13279         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13280         * Makefile.in: Regenerate.
13281         * testsuite/Makefile.in: Regenerate.
13282
13283 2009-08-19  Cary Coutant  <ccoutant@google.com>
13284
13285         * resolve.cc (Symbol_table::resolve): Don't complain about defined
13286         symbols in shared libraries overridden by hidden or internal symbols
13287         in the main program.
13288
13289 2009-08-19  Chris Demetriou  <cgd@google.com>
13290
13291         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
13292         checking source file names in error messages.
13293
13294 2009-08-18  Doug Kwan  <dougkwan@google.com>
13295
13296         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
13297         an elcpp::Ehdr as parameter.  Adjust call to set_target.
13298         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
13299         an elfcpp::Ehdr as parameter.
13300         * object.cc (Object::set_target): Remove the version that looks up
13301         a target and sets it.
13302         (Sized_relobj::setup): Take a Target object instead of
13303         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
13304         (make_elf_sized_object): Find target and ask target to
13305         make an ELF object.
13306         * object.h: (Object::set_target): Remove the version that looks up
13307         a target and sets it.
13308         (Sized_relobj::setup): Take a Target object instead of
13309         an elfcpp:Ehdr as parameter.
13310         * target.cc: Include dynobj.h.
13311         (Target::do_make_elf_object_implementation): New.
13312         (Target::do_make_elf_object): New.
13313         * target.h (Target::make_elf_object): New template declaration.
13314         (Target::do_make_elf_object): New method declarations.
13315         (Target::do_make_elf_object_implementation): New template declaration.
13316
13317 2009-08-14  Ian Lance Taylor  <iant@google.com>
13318
13319         * gold.h (FUNCTION_NAME): Define.
13320         (gold_unreachable): Use FUNCTION_NAME.
13321
13322 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
13323
13324         * icf.cc (Icf::find_identical_sections): Issue a warning when a
13325         symbol in the --keep-unique list is not found.
13326
13327 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
13328
13329         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
13330         been maked as --keep-unique.
13331         (Icf::unfold_section): New function.
13332         * icf.h (Icf::unfold_section): New function.
13333         * options.h (General_options::keep_unique): New option.
13334         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
13335         * testsuite/Makefile.in: Regenerate.
13336         * testsuite/icf_keep_unique_test.sh: New file.
13337         * testsuite/icf_keep_unique_test.cc: New file.
13338
13339 2009-08-12  Cary Coutant  <ccoutant@google.com>
13340
13341         PR 10471
13342         * resolve.cc (Symbol_table::resolve): Check for references from
13343         dynamic objects to hidden and internal symbols.
13344         * testsuite/Makefile.am (hidden_test.sh): New test.
13345         * testsuite/Makefile.in: Regenerate.
13346         * testsuite/hidden_test.sh: New script.
13347         * testsuite/hidden_test_1.c: New test source.
13348         * testsuite/hidden_test_main.c: New test source.
13349
13350 2009-08-11  Doug Kwan  <dougkwan@google.com>
13351
13352         * arm.cc: Update comments.
13353         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
13354         segment to locate the .ARM.exidx section if present.
13355
13356 2009-08-09  Doug Kwan  <dougkwan@google.com>
13357
13358         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
13359         patch.
13360
13361 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
13362         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
13363         compiler warnings.
13364
13365 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
13366
13367         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
13368         valid tls_segment only for non-debug-section relocations.
13369         * testsuite/Makefile.am: Add gc_tls_test.
13370         * testsuite/Makefile.in: Regenerate.
13371         * testsuite/gc_tls_test.cc: New file.
13372         * testsuite/gc_tls_test.sh: New file.
13373
13374 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
13375
13376         * icf.cc: New file.
13377         * icf.h: New file.
13378         * Makefile.am (CCFILES): Add icf.cc.
13379         (HFILES): Add icf.h
13380         * Makefile.in: Regenerate.
13381         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
13382         * gc.h (gc_process_relocs): Populate lists used by icf to contain
13383         section, symbol and addend information for the relocs.
13384         * gold.cc (queue_middle_tasks): Call identical code folding.
13385         * gold.h: Add defines for multimap.
13386         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
13387         to the call of finalize_local_symbols.
13388         * main.cc (main): Create object of class Icf.
13389         * object.cc (Sized_relobj::do_layout): Allow this function to be
13390         called twice during icf.
13391         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
13392         to sections marked as identical by icf.
13393         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
13394         when available.
13395         (Sized_relobj::do_section_entsize): New function.
13396         * object.h (Object::section_entsize): New function.
13397         (Object::do_section_entsize): New pure virtual function.
13398         (Relobj::finalize_local_symbols): Add new parameter.
13399         (Relobj::do_section_entsize): New function.
13400         * options.h (General_options::icf): New option.
13401         (General_options::icf_iterations): New option.
13402         (General_options::print_icf_sections): New option.
13403         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
13404         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
13405         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
13406         icf.
13407         * symtab.cc (Symbol_table::is_section_folded): New function.
13408         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
13409         to sections marked as identical by icf.
13410         * symtab.h (Symbol_table::set_icf): New function.
13411         (Symbol_table::icf): New function.
13412         (Symbol_table::is_section_folded): New function.
13413         (Symbol_table::icf_): New data member.
13414         * target-reloc.h (relocate_section): Ignore sections folded by icf.
13415         * testsuite/Makefile.am: Add commands to build icf_test.
13416         * testsuite/Makefile.in: Regenerate.
13417         * testsuite/icf_test.sh: New file.
13418         * testsuite/icf_test.cc: New file.
13419
13420 2009-07-24  Chris Demetriou  <cgd@google.com>
13421
13422         * layout.cc (is_compressible_debug_section): Fix incorrect
13423         comment about compressed section names.
13424
13425 2009-07-20  Ian Lance Taylor  <ian@airs.com>
13426
13427         PR 10419
13428         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
13429
13430 2009-07-16  Ian Lance Taylor  <iant@google.com>
13431
13432         PR 10400
13433         * layout.h: #include <map>.
13434         (class Kept_section): Change from struct to class.  Add accessors
13435         and setters.  Add section size to Comdat_group mapping.  Change
13436         Comdat_group to std::map.  Add is_comdat_ field.  Add
13437         linkonce_size field in union.
13438         (class Layout): Update declaration of find_or_add_kept_section.
13439         Don't declare find_kept_object.
13440         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
13441         parameter.  Add object, shndx, is_comdat, and is_group_name
13442         parameters.  Change all callers.  Adjust for new Kept_section.
13443         (Layout::find_kept_object): Remove.
13444         * object.cc (Sized_relobj::include_section_group): Update use of
13445         Kept_section.  Rename secnum to shndx.  Only record
13446         Kept_comdat_section if sections are the same size.
13447         (Sized_relobj::include_linkonce_section): Update use of
13448         Kept_section.  Only record Kept_comdat_section if sections are the
13449         same size.  Set size of linkonce section.
13450         (Sized_relobj::map_to_kept_section): Update call to
13451         get_kept_comdat_section.
13452         * object.h (class Sized_relobj): Rename fields in
13453         Kept_comdat_section to drop trailing underscores; change object
13454         field to Relobj*.  Change Kept_comdat_section_table to store
13455         struct rather than pointer.
13456         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
13457         Add kept_object and kept_shndx parameters.  Change all callers.
13458         (Sized_relobj::get_kept_comdat_section): Change return type to
13459         bool.  Add kept_object and kept_shndx parameters.  Change all
13460         callers.
13461         * plugin.cc (Pluginobj::include_comdat_group): Update call to
13462         Layout::find_or_add_kept_section.
13463
13464 2009-07-09  Ian Lance Taylor  <iant@google.com>
13465
13466         * merge.cc (Object_merge_map::initialize_input_to_output_map):
13467         Reserve space in the hash table.
13468
13469 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
13470
13471         * fileread.cc (File_read::get_mtime): New method.
13472         * fileread.h (Timespec): New structure.
13473         (File_read::get_mtime): New method.
13474         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
13475         Renamed from timestamp_nsec.
13476         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
13477         Elf_Xword.
13478         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
13479         timestamp_nsec.
13480         (Incremental_inputs::report_archive): Save mtime; style fix.
13481         (Incremental_inputs::report_obejct): Save mtime; style fix.
13482         (Incremental_inputs::report_script): Save mtime; style fix.
13483         (Incremental_inputs::finalize_inputs): Style fix.
13484         (Incremental_inputs::finalize): Style fix.
13485         (Incremental_inputs::create_input_section_data): Store inputs
13486         mtime.
13487         * incremental.h (Incremental_inputs::report_script): Add mtime
13488         argument.
13489         (Incremental_inputs::Input_info::Input_info): Intialize only one
13490         union member.
13491         (Incremental_inputs::Input_info::archive): Move to nameless
13492         union.
13493         (Incremental_inputs::Input_info::obejct): Move to nameless union.
13494         (Incremental_inputs::Input_info::script): Move to nameless union.
13495         (Incremental_inputs::mtime): New field.
13496         * script.cc (read_input_script): Pass file mtime to
13497         Incremental_input.
13498         * script.h (Script_info::inputs): Style fix.
13499
13500 2009-07-01  Ian Lance Taylor  <ian@airs.com>
13501
13502         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
13503         instead of 32.
13504
13505 2009-06-24  Ian Lance Taylor  <iant@google.com>
13506
13507         PR 10156
13508         * layout.cc (Layout::choose_output_section): If we find an
13509         existing section, update the flags.
13510         (Layout::create_notes): New function, broken out of
13511         Layout::finalize.
13512         (Layout::finalize): Don't create note sections.
13513         (Layout::create_note): Don't crash if linker script discards
13514         section.
13515         (Layout::create_gold_note): Likewise.
13516         (Layout::create_build_id): Likewise.  Don't set
13517         after_input_sections on the section.
13518         (Layout::create_executable_stack_info): Remove target parameter.
13519         Change caller.
13520         * layout.h (class Layout): Declare create_notes.  Update
13521         declaration of create_executable_stack_info.
13522         * gold.cc (queue_middle_tasks): Call create_notes.
13523         * output.cc (Output_section::update_flags_for_input_section): Move
13524         here from output.h.  If SHF_ALLOC flag is newly set, mark address
13525         invalid.
13526         * output.h (Output_data::mark_address_invalid): New function.
13527         (class Output_section): Only declare, not define,
13528         update_flags_for_input_section.  Remove set_flags.
13529
13530 2009-06-24  Ian Lance Taylor  <iant@google.com>
13531
13532         * script-sections.cc (Output_section_definition::
13533         set_section_addresses): Rename shadowing local load_address to
13534         laddr.
13535
13536 2009-06-24  Ian Lance Taylor  <iant@google.com>
13537
13538         PR 10244
13539         * reloc.cc (relocate_sections): Skip empty relocation sections.
13540
13541 2009-06-23  Ian Lance Taylor  <iant@google.com>
13542
13543         PR 10156
13544         * layout.cc (Layout::create_note): Use choose_output_section
13545         rather than make_output_section.
13546
13547 2009-06-23  Ian Lance Taylor  <iant@google.com>
13548
13549         PR 10237
13550         * options.cc (General_options::parse_V): Set printed_version_.
13551         (General_options::General_options): Initialize printed_version_.
13552         * options.h (class General_options): Add printed_version_ field.
13553         * gold.cc (queue_initial_tasks): If there are no input files,
13554         don't give a fatal error if we printed the version information.
13555         (queue_middle_tasks): If using -r with a shared object, give a
13556         fatal error rather than an ordinary error.
13557
13558 2009-06-23  Ian Lance Taylor  <iant@google.com>
13559
13560         PR 10219
13561         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
13562         (Layout::make_output_section): Set have_stabstr_section_ if we see
13563         a .stab*str section.
13564         (Layout::finalize): Call link_stabs_sections.
13565         (Layout::link_stabs_sections): New file.
13566         * layout.h (class Layout): Add have_stabstr_section_ field.
13567         Declare link_stabs_sections.
13568
13569 2009-06-23  Doug Kwan  <dougkwan@google.com>
13570
13571         * Makefile.am (libgold_a_LIBADD): New.
13572         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
13573         * Makefile.in: Regenerate.
13574         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
13575         * configure: Regenerate.
13576         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
13577         * fileread.cc: Include sys/state.h
13578         * gold.h: Declare memmem and strndup if found missing.
13579         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
13580
13581 2009-06-23  Ian Lance Taylor  <iant@google.com>
13582
13583         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
13584         * configure: Rebuild.
13585
13586 2009-06-23  Ian Lance Taylor  <iant@google.com>
13587
13588         PR 10147
13589         * object.cc (Object::section_contents): Don't try to get a view if
13590         the section has length zero.
13591         (Object::handle_gnu_warning_section): If the section is empty, use
13592         the name of the section as the warning.
13593
13594 2009-06-23  Ian Lance Taylor  <iant@google.com>
13595
13596         PR 10133
13597         * stringpool.h (class Stringpool_template): Add optimize_ field.
13598         (Stringpool_template::set_optimize): New function.
13599         * stringpool.cc (Stringpool_template::Stringpool_template):
13600         Initialize optimize_ field.
13601         (Stringpool_template::set_string_offsets): Test local optimize
13602         fild rather than parameter.
13603         * layout.cc (Layout::Layout): Call set_optimize on the section
13604         name stringpool.
13605
13606 2009-06-22  Ian Lance Taylor  <iant@google.com>
13607
13608         PR 10030
13609         * yyscript.y: Parse TARGET.
13610         * script.cc (script_set_target): New function.
13611         * script-c.h (script_set_target): Declare.
13612         * options.cc (General_options::string_to_object_format): Rename
13613         from string_to_object_format in anonymous namespace.  Change
13614         callers.
13615         * options.h (class General_options): Declare
13616         string_to_object_format.
13617
13618 2009-06-22  Ian Lance Taylor  <iant@google.com>
13619
13620         * script-sections.cc (Script_sections::create_segments): Don't put
13621         program headers in a PT_LOAD segment if -n or -N.
13622
13623 2009-06-22  Ian Lance Taylor  <iant@google.com>
13624
13625         PR 10141
13626         * options.h (class General_options): Add -z lazy and -z now.  Sort
13627         -z options into alphabetical order.
13628         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
13629
13630 2009-06-21  Ian Lance Taylor  <iant@google.com>
13631
13632         * layout.cc (Layout::make_output_section): Call
13633         Target::new_output_section.
13634         (Layout::attach_allocated_section_to_segment): Put large section
13635         sections in a separate load segment with the large segment flag
13636         set.
13637         (Layout::segment_precedes): Sort large data segments after other
13638         load segments.
13639         (align_file_offset): New static function.
13640         (Layout::set_segment_offsets): Use align_file_offset.
13641         * output.h (class Output_section): Add is_small_section_ and
13642         is_large_section_ fields.
13643         (Output_section::is_small_section): New function.
13644         (Output_section::set_is_small_section):  New function.
13645         (Output_section::is_large_section): New function.
13646         (Output_section::set_is_large_section): New function.
13647         (Output_section::is_large_data_section): New function.
13648         (class Output_segment): Add is_large_data_segment_ field.
13649         (Output_segment::is_large_data_segment): New function.
13650         (Output_segment::set_is_large_data_segment): New function.
13651         * output.cc (Output_section::Output_section): Initialize new
13652         fields.
13653         (Output_segment::Output_segment): Likewise.
13654         (Output_segment::add_output_section): Add assertion that large
13655         data sections always go in large data segments.  Force small data
13656         sections to the end of the list of data sections.  Force small BSS
13657         sections to the start of the list of BSS sections.  For large BSS
13658         sections to the end of the list of BSS sections.
13659         * symtab.h (class Symbol): Declare is_common_shndx.
13660         (Symbol::is_defined): Check Symbol::is_common_shndx.
13661         (Symbol::is_common): Likewise.
13662         (class Symbol_table): Define enum Commons_section_type.  Update
13663         declarations.  Add small_commons_ and large_commons_ fields.
13664         * symtab.cc (Symbol::is_common_shndx): New function.
13665         (Symbol_table::Symbol_table): Initialize new fields.
13666         (Symbol_table::add_from_object): Put small and large common
13667         symbols in the right list.
13668         (Symbol_table::sized_finalized_symbol): Check
13669         Symbol::is_common_shndx.
13670         (Symbol_table::sized_write_globals): Likewise.
13671         * common.cc (Symbol_table::do_allocate_commons): Allocate new
13672         common symbol lists.  Don't call do_allocate_commons_list if the
13673         list is empty.
13674         (Symbol_table::do_allocate_commons_list): Remove is_tls
13675         parameter.  Add comons_section_type parameter.  Change all
13676         callers.  Handle small and large common symbols.
13677         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
13678         Symbol::is_common_shndx.
13679         * resolve.cc (symbol_to_bits): Likewise.
13680         * target.h (Target::small_common_shndx): New function.
13681         (Target::small_common_section_flags): New function.
13682         (Target::large_common_shndx): New function.
13683         (Target::large_common_section_flags): New function.
13684         (Target::new_output_section): New function.
13685         (Target::Target_info): Add small_common_shndx, large_common_shndx,
13686         small_common_section_flags, and large_common_section_flags
13687         fields.
13688         (Target::do_new_output_section): New virtual function.
13689         * arm.cc (Target_arm::arm_info): Initialize new fields.
13690         * i386.cc (Target_i386::i386_info): Likewise.
13691         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
13692         Likewise.
13693         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
13694         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13695         (Target_x86_64::do_new_output_section): New function.
13696         * configure.ac: Define conditional MCMODEL_MEDIUM.
13697         * testsuite/Makefile.am (check_PROGRAMS): Add large.
13698         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
13699         (large_LDFLAGS): Define.
13700         * testsuite/large.c: New file.
13701         * testsuite/testfile.cc (Target_test::test_target_info):
13702         Initialize new fields.
13703         * configure, testsuite/Makefile.in: Rebuild.
13704
13705 2009-06-05  Doug Kwan  <dougkwan@google.com>
13706
13707         * Makefile.am (CCFILES): Add target.cc.
13708         * Makefile.in: Regenerate.
13709         * i386.cc (class Target_i386): Define new virtual method to
13710         override do_is_local_label_name in parent.
13711         * object.cc (Sized_relobj::do_count_local_symbols): Discard
13712         local symbols if --discard-locals or -X is given.
13713         * options.h (class General_options): Declare new options
13714         '--discard-locals' and '-X' for discarding locals.
13715         * target.h (class Target): Define new methods is_local_label_name.
13716         Declare new virtual method do_is_local_label_name.
13717         * target.cc: New file.
13718         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
13719         (check_SCRIPTS): Add discard_locals_test.sh.
13720         (check_DATA): Add discard_local_tests.syms.
13721         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
13722         (discard_local_tests.syms, discard_locals_test.o): New make rules.
13723         * testsuite/Makefile.in: Regenerate.
13724         * testsuite/discard_locals_test.c: New file.
13725         * testsuite/discard_locals_test.sh: Same.
13726
13727 2009-06-05  Doug Kwan  <dougkwan@google.com>
13728
13729         * object.cc (Sized_relobj::Sized_relobj): Initialize
13730         discarded_eh_frame_shndx_ to -1U.
13731         (Sized_relobj::do_layout): Record index of a discard .eh_frame
13732         section.
13733         (Sized_relobj::do_count_local_symbols): Skip local symbols in
13734         a discarded .eh_frame section.
13735         (Sized_relobj::do_finalize_local_symbols): Ditto.
13736         * object.h (class Sized_relobj): Declare new member
13737         discarded_eh_frame_shndx_.
13738         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
13739         (local_labels_test.o, local_labels_test): New rules.
13740         * testsuite/Makefile.in: Regenerate.
13741
13742 2009-06-04  Doug Kwan  <dougkwan@google.com>
13743
13744         * layout.cc (Layout::section_name_mapping): Add mapping for
13745         special ARM sections.
13746
13747 2009-06-03  Doug Kwan  <dougkwan@google.com>
13748
13749         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
13750         (utils::has_overflow): Same.
13751
13752 2009-06-03  Ian Lance Taylor  <iant@google.com>
13753
13754         * layout.cc (Layout::section_name_mapping): New array, replacing
13755         Layout::linkonce_mapping.
13756         (Layout::section_name_mapping_count): New variable, replacing
13757         Layout::linkonce_mapping_count.
13758         (Layout::linkonce_output_name): Remove.
13759         (Layout::output_section_name): Rewrite.
13760         * layout.h (class Layout): Rename Linkonce_mapping to
13761         Section_name_mapping, linkonce_mapping to section_name_mapping,
13762         linkonce_mapping_count to section_name_mapping_count.  Don't
13763         declare linkonce_output_name.
13764
13765 2009-06-03  Doug Kwan  <dougkwan@google.com>
13766
13767         * gold/arm.cc (namespace utils): New.
13768         (Target_arm::reloc_is_non_pic): Define new method.
13769         (class Arm_relocate_functions): New.
13770         (Target_arm::Relocate::relocate): Handle relocation types used by
13771         Android.
13772
13773 2009-06-03  Ian Lance Taylor  <iant@google.com>
13774
13775         * arm.cc (Target_arm::scan::global): Use || instead of |.
13776
13777 2009-06-02  Doug Kwan  <dougkwan@google.com>
13778
13779         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
13780         issued_non_pic_error_.
13781         (class Target_arm::Scan): Declare new method check_non_pic.
13782         Define new method symbol_needs_plt_entry.
13783         Declare new data member issued_non_pic_error_.
13784         (class Target_arm::Relocate): Declare new method
13785         should_apply_static_reloc.
13786         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
13787         (Target_arm::Scan::check_non_pic): Define new method.
13788         (Target_arm::Scan::local): Handle a small subset of reloc types used
13789         by Android.
13790         (Target_arm::Scan::local): Same.
13791         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
13792
13793 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
13794
13795         * incremental.cc (Incremental_inputs::report_command_line): Filter
13796         out --incremental-* options.
13797
13798 2009-05-29  Doug Kwan  <dougkwan@google.com>
13799
13800         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
13801         template class.
13802         (class Target_arm): Update comment.
13803         (Target_arm::Target_arm): Initialize new data members GOT_,
13804         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
13805         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
13806         and Target_arm::rel_dyn_section.
13807         Declare new_enum Target_arm::Got_type.
13808         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
13809         and DYNBSS_.
13810         Update commments for member do_dynsym_value.
13811         (Target_arm::got_size, Target_arm::plt_section,
13812         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
13813         new methods inside class defintion.
13814         (Target_arm::got_section): Define new method.
13815         (Target_arm::rel_dyn_section): Same.
13816         (Output_data_plt_arm): New template class.
13817         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
13818         (Output_data_plt_arm:do_adjust_output_section): Define new method.
13819         (Output_data_plt_arm::add_entry): Same.
13820         (Output_data_plt_arm::first_plt_entry): Define new
13821         static data member for PLT instruction template.
13822         (Output_data_plt_arm::plt_entry): Same.
13823         (Output_data_plt_arm::do_write): Define new method.
13824         (Target_arm::make_plt_entry): Same.
13825         (Target_arm::do_finalize_sections): Same.
13826         (Target_arm::do_dynsym_value): Same.
13827
13828 2009-05-28  Doug Kwan  <dougkwan@google.com>
13829
13830         * Makefile.am (TARGETSOURCES): Add arm.cc.
13831         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
13832         * Makefile.in: Regenerate.
13833         * arm.cc: New file.
13834         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
13835
13836 2009-05-26  Doug Kwan  <dougkwan@google.com>
13837
13838         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
13839         (General_options::check_excluded_libs): Strip off directories in
13840         archive name before matching like GNU ld does.
13841         * testsuite/Makefile.am (MOSTLYCLEANFILES,
13842         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
13843         (exclude_libs_test_LDFLAGS): Add linker option
13844         -Wl,--exclude-libs,libexclude_libs_test_3
13845         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
13846         an explicit archive without using -l.
13847         (alt/libexclude_libs_test_3.a): New make rule.
13848         * testsuite/Makefile.in: Regenerate.
13849         * testsuite/exclude_libs_test.c : Declare lib3_default().
13850         (main): Call it.
13851         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
13852         * exclude_libs_test_3.c: New file.
13853
13854 2009-05-26  Nick Clifton  <nickc@redhat.com>
13855
13856         * po/id.po: New Indonesian translation.
13857         * po/gold.pot: Updated template file.
13858
13859 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
13860
13861         * testsuite/Makefile.am: Add -ffunction-sections to compile
13862         gc_comdat_test files.  Add -Wl,--gc-sections to build
13863         gc_comdat_test.
13864         * testsuite/Makefile.in: Regenerate.
13865         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
13866
13867 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
13868
13869         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
13870         kept comdat section was garbage collected.
13871         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
13872         * testsuite/Makefile.in: Regenerate.
13873         * testsuite/gc_comdat_test.sh: New file.
13874         * testsuite/gc_comdat_test_1.cc: New file.
13875         * testsuite/gc_comdat_test_2.cc: New file.
13876
13877 2009-05-19  Doug Kwan  <dougkwan@google.com>
13878
13879         * archive.cc (Archive::Archive): Move constructor from archive.h
13880         to here.  Initialize no_export_.
13881         (Archive::get_elf_object_for_member): Set no_export flag of object.
13882         * archive.h (Archive::Archive): Move constructor body to
13883         archive.cc.
13884         (Archive::no_export): New method.
13885         (Archive::no_export_): New field.
13886         * object.h (Object::Object): Initialize no_export_ to false.
13887         (Object::no_export, Object::set_no_export): New methods.
13888         (Object::no_export_): New field.
13889         * options.cc (General_options::parse_exclude_libs): New method.
13890         (General_options::check_excluded_libs) Same.
13891         * options.h (exclude_libs): New option.
13892         (General_options::check_excluded_libs): New method declaration.
13893         (General_options::excluded_libs_): New field.
13894         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
13895         default or protected visibility if an object has no-export flag set.
13896         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
13897         (check_SCRIPTS): Add exclude_libs_test.sh.
13898         (check_DATA): Add exclude_libs_test.syms.
13899         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
13900         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
13901         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
13902         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
13903         (exclude_libs_test.syms, libexclude_libs_test_1.a,
13904         libexclude_libs_test_2.a): New rules.
13905         * testsuite/Makefile.in: Regenerate.
13906         * testsuite/exclude_libs_test.c: New file.
13907         * testsuite/exclude_libs_test.sh: Ditto.
13908         * testsuite/exclude_libs_test_1.c: Ditto.
13909         * testsuite/exclude_libs_test_2.c: Ditto.
13910
13911 2009-05-15  Ian Lance Taylor  <iant@google.com>
13912
13913         * configure.ac: Check for declarations for cases where libiberty.h
13914         checks HAVE_DECL_xxx.
13915         * configure, config.in: Rebuild.
13916
13917 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
13918
13919         * gold.h (Incremental_argument_list): Remove (invalid) forward
13920         declaration.
13921         * incremental.cc (Incremental_inputs::report_achive): New method.
13922         (Incremental_inputs::report_object): New method.
13923         (Incremental_inputs::report_script): New method.
13924         (Incremental_inputs::finalize_inputs): New method.
13925         (Incremental_inputs::finalize): Call finalize_inputs().
13926         (Incremental_inputs::sized_create_incremental_inputs_section_data):
13927         Create inputs entries.
13928         * incremental.h (Incremental_input_type): New enum.
13929         (Incremental_inputs::Incremental_input): Initialize new fields.
13930         (Incremental_inputs::report_inputs): New method.
13931         (Incremental_inputs::report_achive): New method.
13932         (Incremental_inputs::report_object): New method.
13933         (Incremental_inputs::report_script): New method.
13934         (Incremental_inputs::finalize_inputs): New method.
13935         (Incremental_inputs::Input_info): New struct.
13936         (Incremental_inputs::Input_info_map): New typedef.
13937         (Incremental_inputs::lock_): New field.
13938         (Incremental_inputs::Inputs_): New field.
13939         (Incremental_inputs::Inputs_map): New field.
13940         * main.cc (main): Call Incremental_input::report_inputs.
13941         * options.h (Input_argument_list): Typedef moved from
13942         Input_arguments.
13943         (Input_file_group::Files): Remove, use ::Input_argument_list.
13944         (Input_file_group::Input_argument_list): Remove, use
13945         ::Input_argument_list.
13946         * plugin.cc (Plugin_manager::add_input_file): Add error in
13947         incremental build.
13948         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13949         functions.
13950         * script.cc (read_input_script): Call
13951         Incremental_input::report_script.
13952         * script.h (Script_info): New class.
13953
13954 2009-04-27  Ian Lance Taylor  <iant@google.com>
13955
13956         * x86_64.cc (do_adjust_output_section): Set entsize to
13957         plt_entry_size.
13958
13959 2009-04-23  Elliott Hughes  <enh@google.com>
13960
13961         * output.cc (Output_file::close): After short writes, continue
13962         writing from the correct offset in the buffer being written.
13963
13964 2009-04-23  Chris Demetriou  <cgd@google.com>
13965
13966         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13967         * configure: Regenerate.
13968         * config.in: Regenerate.
13969         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13970         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13971
13972 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
13973
13974         * incremental.cc (Incremental_inputs_header_data): Renamed from
13975         Incremental_input_header_data.
13976         (Incremental_inputs_header_data::data_size): New field.
13977         (Incremental_inputs_header_data::put_input_file_count): Renamed
13978         from input_file_count.
13979         (Incremental_inputs_header_data::put_command_line_offset): Renamed
13980         from command_line_offset.
13981         (Incremental_inputs_header_data::put_reserved): Renamed from
13982         put_reserved.
13983         (Incremental_inputs_entry_data): Renamed from
13984         Incremental_input_entry_data.
13985         (Incremental_inputs_entry_data::data_size): New field.
13986         (Incremental_inputs::report_command_line): New method.
13987         (Incremental_inputs::finalize): New method.
13988         (Incremental_inputs::create_incremental_inputs_data): New method.
13989         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13990         * incremental.h: New file.
13991         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13992         (Layout::finalize): Create incremental inputs section in
13993         incremental builds.
13994         (Layout::create_incremental_info_sections): New method.
13995         * layout.h (Layout::incremental_inputs): New method.
13996         (Layout::create_incremental_info_sections): New method.
13997         (Layout::incremental_inputs_): New field.
13998         * main.cc (main): Notify Incremental_input of the command line.
13999
14000 2009-04-01  Ian Lance Taylor  <iant@google.com>
14001             Mikolaj Zalewski  <mikolajz@google.com>
14002
14003         * gold.h (reserve_unordered_map): Define, three versions, one for
14004         each version of Unordered_map.
14005         * layout.cc (Layout::Layout): Remove options parameter.  Add
14006         number_of_input_files parameter.  Don't initialize options_.
14007         Initialize number_of_input_files_ and resized_signatures_.  Move
14008         sections_are_attached_.
14009         (Layout::layout_group): Reserve space for group_signatures_.
14010         (Layout::find_or_add_kept_section): Change name parameter to be a
14011         reference.  Resize signatures_ map when it gets large enough.
14012         (Layout::layout_eh_frame): Use parameters->options() instead of
14013         this->options_.
14014         (Layout::make_output_section): Likewise.
14015         (Layout::attach_allocated_section_to_segment): Likewise.
14016         (Layout::finalize, Layout::create_executable_stack): Likewise.
14017         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
14018         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
14019         * layout.h (class Layout): Update declarations.  Remove options_
14020         field.  Add number_of_input_files_ and resized_signatures_
14021         fields.  Move sections_are_attached_ field.
14022         * main.cc (main): Pass number of input files to Layout
14023         constructor.  Don't pass options.
14024
14025 2009-03-30  Ian Lance Taylor  <iant@google.com>
14026
14027         * ffsll.c (ffsll): Correct implementation.
14028
14029 2009-03-27  Ian Lance Taylor  <iant@google.com>
14030
14031         * ffsll.c: New file.
14032         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
14033         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
14034         * ftruncate.c (ftruncate): Declare before definition.
14035         * mremap.c (mremap): Likewise.
14036         * pread.c (pread): Likewise.
14037         * configure, Makefile.in, config.in: Rebuild.
14038
14039         * mremap.c: New file.
14040         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
14041         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
14042         (mremap): Declare if HAVE_MREMAP is not defined.
14043         * configure, Makefile.in, config.in: Rebuild.
14044
14045 2009-03-27  Cary Coutant  <ccoutant@google.com>
14046
14047         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
14048         position independent.
14049         * sparc.cc (Target_sparc::check_non_pic): Likewise.
14050         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
14051
14052 2009-03-24  Cary Coutant  <ccoutant@google.com>
14053
14054         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
14055         an executable.
14056         (needs_dynamic_reloc): Likewise.
14057
14058 2009-03-24  Ian Lance Taylor  <iant@google.com>
14059
14060         * yyscript.y (file_cmd): Recognize EXTERN.
14061         (extern_name_list, extern_name_list_body): New nonterminals.
14062         * script.cc (script_add_extern): Define.
14063         * script-c.h (script_add_extern): Declare.
14064
14065 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
14066
14067         * object.cc (is_elf_object): Define.
14068         * object.h (is_elf_object): Declare.
14069         * archive.cc (Archive::get_elf_object_for_member): Call
14070         is_elf_object.
14071         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
14072
14073 2009-03-24  Elliott Hughes  <enh@google.com>
14074
14075         * output.cc (Output_file::map_anonymous): Define.
14076         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
14077         try an anonymous one.  Report the size if the mmap fails.
14078         * output.h (class Output_file): Declare map_anonymous.
14079
14080 2009-03-24  Ian Lance Taylor  <iant@google.com>
14081
14082         * target-select.cc (instantiate_target): Don't acquire the lock if
14083         the instantiated_target_ field has already been set.
14084
14085 2009-03-23  Ian Lance Taylor  <iant@google.com>
14086
14087         * gold-threads.h (class Initialize_lock): Define.
14088         * gold-threads.cc (class Initialize_lock_once): Define.
14089         (initialize_lock_control): New static variable.
14090         (initialize_lock_pointer): New static variable.
14091         (initialize_lock_once): New static function.
14092         (Initialize_lock::Initialize_lock): Define.
14093         (Initialize_lock::initialize): Define.
14094         * target-select.h: Include "gold-threads.h".
14095         (class Target_selector): Add lock_ and initialize_lock_ fields.
14096         Don't define instantiate_target, just declare it.
14097         * target-select.cc (Target_selector::Target_selector): Initialize
14098         new fields.
14099         (Target_selector::instantiate_target): Define.
14100         * descriptors.h: Include "gold-threads.h".
14101         (class Descriptors): Add initialize_lock_ field.
14102         * descriptors.cc (Descriptors::Descriptors): Initialize new
14103         field.
14104         (Descriptors::open): Use initialize_lock_ field
14105         * errors.h (class Errors): Add initialize_lock_ field.
14106         * errors.cc (Errors::Errors): Initialize new field.
14107         (Errors::initialize_lock): Use initialize_lock_ field.
14108         * powerpc.cc (class Target_selector_powerpc): Remove
14109         instantiated_target_ field.  In do_recognize call
14110         instantiate_target rather than do_instantiate_target.  In
14111         do_instantiate_target just allocate a new target.
14112         * sparc.cc (class Target_selector_sparc): Likewise.
14113
14114         * freebsd.h: New file.
14115         * i386.cc: Include "freebsd.h".
14116         (Target_i386): Derive from Target_freebsd rather than
14117         Sized_target.
14118         (Target_selector_i386): Derive from Target_selector_freebsd rather
14119         than Target_selector.
14120         * x86_64.cc: Include "freebsd.h".
14121         (Target_x86_64): Derive from Target_freebsd rather than
14122         Sized_target.
14123         (Target_selector_x86_64): Derive from Target_selector_freebsd
14124         rather than Target_selector.
14125         * target.h (class Target): Add adjust_elf_header and
14126         do_adjust_elf_header.
14127         * output.cc (Output_file_header:: do_sized_write): Call target
14128         adjust_elf_header routine.
14129         * configure.tgt: Set targ_osabi.
14130         * configure.ac: Define GOLD_DEFAULT_OSABI.
14131         * parameters.cc (Parameters::default_target): Pass
14132         GOLD_DEFAULT_OSABI to select_target.
14133         * target-select.h (class Target_selector): Make instantiate_target
14134         protected rather than private.
14135         * Makefile.am (HFILES): Add freebsd.h.
14136         * configure, Makefile.in, config.in: Rebuild.
14137
14138         * merge.cc (do_add_input_section): Correct pend value.  Change
14139         message about last entry not being null terminated from error to
14140         warning.
14141
14142 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
14143
14144         * incremental.cc: New file.
14145         * Makefile.am (CCFILES): Add incremental.cc.
14146         * Makefile.in: Rebuild.
14147
14148 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
14149
14150         * layout.cc (Layout::output_section_name): Preserve names
14151         of '.note.' sections.
14152
14153 2009-03-19  Ian Lance Taylor  <iant@google.com>
14154
14155         * descriptors.cc (Descriptors::open): Check that the options are
14156         valid before using them.
14157
14158 2009-03-18  Ian Lance Taylor  <iant@google.com>
14159
14160         * script-sections.h: Include <list>.
14161         (class Script_sections): Change Sections_elements from std::vector
14162         to std::list.  Typedef public Elements_iterator.  Add
14163         orphan_section_placement_, data_segment_align_start_, and
14164         saw_data_segment_align_ fields.  Remove data_segment_align_index_
14165         field.
14166         * script-sections.cc (class Orphan_section_placement): New class.
14167         (class Sections_element): Add virtual functions is_relro and
14168         orphan_section_init.  Remove virtual function place_orphan_here.
14169         (class Output_section_definition): Add is_relro and
14170         orphan_section_init.  Remove place_orphan_here.
14171         (class Orphan_output_section): Likewise.
14172         (Script_sections::Script_sections): Update for field changes.
14173         (Script_sections::data_segment_align): Set saw_data_segment_align_
14174         and data_segment_align_start_, not data_segment_align_index.
14175         (Script_sections::data_segment_relro_end): Check
14176         saw_data_segment_align_.  Use data_segment_align_start_ rather
14177         than data_segment_align_index_.
14178         (Script_sections::place_orphan): Rewrite to use
14179         Orphan_section_placement.
14180
14181 2009-03-17  Ian Lance Taylor  <iant@google.com>
14182
14183         * archive.cc (Archive::add_symbols): Check for a version attached
14184         to the symbol name in the archive map.
14185         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
14186         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
14187         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
14188         (ver_test_11.a): New target.
14189         * testsuite/Makefile.in: Rebuild.
14190
14191         * configure.ac: Check for chsize and posix_fallocate.  Replace
14192         ftruncate.
14193         * ftruncate.c: New file, from gnulib.
14194         * output.cc (posix_fallocate): Define dummy version if not
14195         HAVE_POSIX_FALLOCATE.
14196         (Output_file::map): Call posix_fallocate rather than lseek and
14197         write.
14198         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
14199         * configure, Makefile.in, config.in: Rebuild.
14200
14201 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
14202
14203         * layout.h (Layout::create_note): Add section_name parameter.
14204         * layout.cc (Layout::create_note): Likewise.
14205         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
14206
14207 2009-03-17  Ian Lance Taylor  <iant@google.com>
14208
14209         * descriptors.cc: Include "options.h".
14210         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
14211         (Descriptors::open): Always use O_CLOEXEC when opening a new
14212         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
14213         then set FD_CLOEXEC.
14214
14215         * sparc.cc (class Target_sparc): Add has_got_section.
14216         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
14217         make sure we have a GOT section.
14218
14219         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
14220         (Target_sparc::Scan::local): Likewise.
14221         (Target_sparc::Scan::global): Likewise.
14222         (Target_sparc::Relocate::relocate): Likewise.
14223         (Target_sparc::Relocate::relocate_tls): Likewise.
14224
14225         * symtab.cc (Symbol_table::define_default_version): New function,
14226         broken out of add_from_object.
14227         (Symbol_table::add_from_object): Call define_default_version.
14228         (Symbol_table::define_special_symbol): Add resolve_oldsym
14229         parameter.  Change all callers.  If the version for a symbol comes
14230         from a version script, resolve it with the symbol with the same
14231         name with no version.  Also add the symbol without a version if
14232         appropriate.
14233         (do_define_in_output_data): If resolving with oldsym, don't delete
14234         sym.
14235         (do_define_in_output_segment): Likewise.
14236         (do_define_as_constant): Likewise.
14237         * symtab.h (class Symbol_table): Update declarations.
14238
14239 2009-03-13  Ian Lance Taylor  <iant@google.com>
14240
14241         * readsyms.cc (Read_symbols::incompatible_warning): New function.
14242         (Read_symbols::requeue): New function.
14243         (Read_symbols::do_read_symbols): If make_elf_object fails because
14244         the target type is not configured, and the file was searched for,
14245         issue a warning and retry with the next directory.
14246         (Add_symbols::run): If the file has an incompatible format, and
14247         it was searched for, requeue the Read_symbols task.  On error,
14248         release the object.
14249         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
14250         dirindex parameter to constructor.  Change all callers.  Declare
14251         incompatible_warning and requeue.
14252         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
14253         input_argument_ and input_group_ fields.  Add them to
14254         constructor.  Change all callers.
14255         (class Read_script): Add dirindex_ field.  Add it to constructor.
14256         Change all callers.
14257         * archive.cc (Archive::setup): Remove input_objects parameter.
14258         Change all callers.
14259         (Archive::get_file_and_offset): Likewise.
14260         (Archive::read_all_symbols): Likewise.
14261         (Archive::read_symbols): Likewise.
14262         (Archive::get_elf_object_for_member): Remove input_objects
14263         parameter.  Add punconfigured parameter.  Change all callers.
14264         (Archive::add_symbols): Change return type to bool.  Check return
14265         value of include_member.
14266         (Archive::include_all_members): Likewise.
14267         (Archive::include_member): Change return type to bool.  Return
14268         false if first included object has incompatible target.  Set
14269         included_member_ field.
14270         (Add_archive_symbols::run): If add_symbols returns false, requeue
14271         Read_symbols task.
14272         * archive.h (class Archive): Add included_member_ field.
14273         Initialize it in constructor.  Add input_file and searched_for
14274         methods.  Update declarations.
14275         (class Add_archive_symbols): Add dirpath_, dirindex_, and
14276         input_argument_ fields.  Add them to constructor.  Change all
14277         callers.
14278         * script.cc: Include "target-select.h".
14279         (class Parser_closure): Add skip_on_incompatible_target_ and
14280         found_incompatible_target_ fields.  Add
14281         skip_on_incompatible_target parameter to constructor.  Change all
14282         callers.  Add methods skip_on_incompatible_target,
14283         clear_skip_on_incompatible_target, found_incompatible_target, and
14284         set_found_incompatible_target.
14285         (read_input_script): Add dirindex parameter.  Change all callers.
14286         If parser finds an incompatible target, requeue Read_symbols
14287         task.
14288         (script_set_symbol): Clear skip_on_incompatible_target in
14289         closure.
14290         (script_add_assertion, script_parse_option): Likewise.
14291         (script_start_sections, script_add_phdr): Likewise.
14292         (script_check_output_format): New function.
14293         * script.h (read_input_script): Update declaration.
14294         * script-c.h (script_check_output_format): Declare.
14295         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
14296         (ignore_cmd): Remove OUTPUT_FORMAT.
14297         * fileread.cc (Input_file::Input_file): Add explicit this.
14298         (Input_file::will_search_for): New function.
14299         (Input_file::open): Add pindex parameter.  Change all callers.
14300         * fileread.h (class Input_file): Add input_file_argument method.
14301         Declare will_search_for.  Update declarations.
14302         * object.cc (make_elf_object): Add punconfigured parameter.
14303         Change all callers.
14304         * object.h (class Object): Make input_file public.  Add
14305         searched_for method.
14306         (make_elf_object): Update declaration.
14307         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
14308         restart search.
14309         * dirsearch.h (class Dirsearch): Update declaration.
14310         * options.h (class General_options): Add --warn-search-mismatch.
14311         * parameters.cc (Parameters::is_compatible_target): New function.
14312         * parameters.h (class Parameters): Declare is_compatible_target.
14313         * workqueue.cc (Workqueue::add_blocker): New function.
14314         * workqueue.h (class Workqueue): Declare add_blocker.
14315
14316         * fileread.cc (Input_file::open): Remove options parameter.
14317         Change all callers.
14318         (Input_file::open_binary): Likewise.
14319         * script.cc (read_input_script): Likewise.
14320         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
14321         options parameter from constructor.  Change all callers.
14322         (class Read_script): Likewise.
14323         * fileread.h (class Input_file): Update declarations.
14324         * script.h (read_input_script): Update declaration.
14325
14326 2009-03-10  Nick Clifton  <nickc@redhat.com>
14327
14328         * po/es.po: New Spanish translation.
14329
14330 2009-03-06  Cary Coutant  <ccoutant@google.com>
14331
14332         * options.cc (parse_short_option): Keep dash_z from registering itself.
14333
14334 2009-03-03  Ian Lance Taylor  <iant@google.com>
14335
14336         PR 9918
14337         * target-reloc.h (relocate_section): Pass output_section to
14338         relocate.
14339         * i386.cc (Target_i386::should_apply_static_reloc): Add
14340         output_section parameter.  Change all callers.
14341         (Target_i386::Relocate::relocate): Add output_section parameter.
14342         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14343         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
14344         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
14345         * testsuite/two_file_shared.sh: New script.
14346         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
14347         (check_DATA): Add two_file_shared.dbg.
14348         (two_file_shared.dbg): New target.
14349         * testsuite/Makefile.in: Rebuild.
14350
14351 2009-03-01  Ian Lance Taylor  <iant@google.com>
14352
14353         * configure.ac: Check for byteswap.h.
14354         * configure: Rebuild.
14355         * config.in: Rebuild.
14356
14357 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
14358
14359         * layout.cc (Layout::find_or_add_kept_section): New function.
14360         (Layout::add_comdat): Removed.
14361         * layout.h (struct Kept_section): Move out of class Layout.
14362         Remove trailing underscores from field names.  Add group_sections
14363         field.  Rename group_ field to is_group.  Change all uses.
14364         (class Layout): Declare find_or_add_kept_section, not add_comdat.
14365         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
14366         comdat_groups_ field.
14367         (Sized_relobj::include_section_group): Use
14368         find_or_add_kept_section and Kept_section::group_sections.
14369         (Sized_relobj::include_linkonce_section): Likewise.
14370         * object.cc (class Sized_relobj): Don't define Comdat_group or
14371         Comdat_group_table.  Remove find_comdat_group and
14372         add_comdat_group.  Remove comdat_groups_ field.
14373         * plugin.cc (include_comdat_group): Use
14374         Layout::find_or_add_kept_section.
14375
14376 2009-02-28  Ian Lance Taylor  <iant@google.com>
14377
14378         * README: --gc-sections and map files are now supported.  Document
14379         some build requirements.
14380
14381         PR 6992
14382         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
14383         relocatable link set the value of the section symbol to zero.
14384         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
14385         relocatable link don't include the section address in the local
14386         symbol value.
14387
14388 2009-02-27  Ian Lance Taylor  <iant@google.com>
14389
14390         PR 6811
14391         * options.h (class Search_directory): Add is_system_directory.
14392         (class General_options): Declare is_in_system_directory.
14393         * options.cc (get_relative_sysroot): Make static.
14394         (get_default_sysroot): Make static.
14395         (General_optoins::is_in_system_directory): New function.
14396         * fileread.cc (Input_file::is_in_system_directory): New function.
14397         * fileread.h (class Input_file): Declare is_in_system_directory.
14398         * object.h (class Object): Add is_in_system_directory.
14399         (class Input_objects): Remove system_library_directory_ field.
14400         * object.cc (Input_objects::add_object): Don't set
14401         system_library_directory_.
14402         (input_objects::found_in_system_library_directory): Remove.
14403         * symtab.cc (Symbol_table::write_globals): Remove input_objects
14404         parameter.  Change all callers.
14405         (Symbol_table::sized_write_globals): Likewise.
14406         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
14407         Call Object::is_in_system_directory.
14408         * symtab.h (class Symbol_table): Update declarations.
14409
14410         PR 5990
14411         * descriptors.h (Open_descriptor): Add is_on_stack field.
14412         * descriptors.cc (Descriptors::open): If the descriptor is on the
14413         top of the stack, remove it.  Initialize is_on_stack field.
14414         (Descriptors::release): Only add pod to stack if it is not on the
14415         stack already.
14416         (Descriptors::close_some_descriptor): Clear stack_next and
14417         is_on_stack fields.
14418
14419         PR 7091
14420         * output.cc (Output_section::find_starting_output_address): Rename
14421         from starting_output_address; add PADDR parameter; change return
14422         type.
14423         * output.h (class Output_section): Declare
14424         find_starting_output_address instead of starting_output_address.
14425         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
14426         section symbol for which we can't find a merge section.
14427
14428         PR 9836
14429         * symtab.cc (Symbol_table::add_from_object): If the visibility is
14430         hidden or internal, force the symbol to be local.
14431         * resolve.cc (Symbol::override_visibility): Define.
14432         (Symbol::override_base): Use override_visibility.
14433         (Symbol_table::resolve): Likewise.
14434         (Symbol::override_base_with_special): Likewise.
14435         (Symbol_table::override_with_special): If the visibility is hidden
14436         or internal, force the symbol to be local.
14437         * symtab.h (class Symbol): Add set_visibility and
14438         override_visibility.
14439         * testsuite/ver_test_1.sh: New file.
14440         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
14441         (check_DATA): Add ver_test_1.syms.
14442         (ver_test_1.syms): New target.
14443         * testsuite/Makefile.in: Rebuild.
14444
14445 2009-02-25  Cary Coutant  <ccoutant@google.com>
14446
14447         * layout.cc (Layout::choose_output_section): Don't rename sections
14448         when using a linker script that has a SECTIONS clause.
14449         * Makefile.in: Regenerate.
14450
14451         * testsuite/Makefile.am (script_test_5.sh): New test case.
14452         * testsuite/Makefile.in: Regenerate.
14453         * testsuite/script_test_5.cc: New file.
14454         * testsuite/script_test_5.sh: New file.
14455         * testsuite/script_test_5.t: New file.
14456
14457 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
14458
14459         * archive.cc (Archive::include_member): Update calls to add_symbols.
14460         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
14461         the Layout argument.
14462         * dynobj.h (do_add_symbols): Add the Layout argument.
14463         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
14464         Layout argument.
14465         * object.h (Object::add_symbols): Add the Layout argument.
14466         (Object::do_add_symbols): Add the Layout argument.
14467         (Sized_relobj::do_add_symbols): Add the Layout argument.
14468         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
14469         Unify the two versions.
14470         (Add_plugin_symbols): Remove.
14471         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
14472         (Sized_pluginobj::do_add_symbols): Unify the two versions.
14473         (Add_plugin_symbols): Remove.
14474         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
14475         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
14476         (Add_symbols::run): Make it work with Pulginobj.
14477
14478 2009-02-06  Ian Lance Taylor  <iant@google.com>
14479
14480         * object.cc (Sized_relobj::do_layout): Make info message start
14481         with lower case letter.
14482
14483 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
14484
14485         * binary.cc: Fix file comment.
14486
14487         * options.h (enum Incremental_disposition): Define.
14488         (class General_options): Add new options: --incremental,
14489         --incremental_changed, --incremental_unchanged,
14490         --incremental_unknown.  Add incremental_disposition_ and
14491         implicit_incremental_ fields.
14492         (General_options::incremental_disposition): New function.
14493         (class Position_dependent_options): Add incremental_disposition
14494         option.
14495         (Position_dependent_options::copy_from_options): Set incremental
14496         dispositions.
14497         * options.cc (General_options::parse_incremental_changed): New
14498         function.
14499         (General_options::parse_incremental_unchanged): New function.
14500         (General_options::parse_incremental_unknown): New function.
14501         (General_options::General_options): Initialize new fields
14502         incremental_disposition_ and implicit_incremental_.
14503         (General_options::finalize): Check for uasge of --incremental-*
14504         without --incremental.
14505
14506 2009-02-06  Chris Demetriou  <cgd@google.com>
14507
14508         * gold.h (gold_undefined_symbol): Change to take only a Symbol
14509         pointer and to report location as the file name associated with
14510         the symbol.
14511         (gold_undefined_symbol_at_location): New function to replace the
14512         old gold_undefined_symbol functionality.
14513         * target-reloc.h (relocate_section): Update to use
14514         gold_undefined_symbol_at_location.
14515         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14516         Call gold_undefined_symbol function rather than gold_error.
14517         * errors.h (Errors::undefined_symbol): Take location as a
14518         string, rather than calculating it from a relocation.
14519         * errors.cc (Errors::fatal): Print "fatal error:" before the
14520         formatted message.
14521         (Errors::error, Errors::error_at_location): Print "error: "
14522         before the formatted message.
14523         (Errors::undefined_symbol): Take location as a string, rather
14524         than calculating it from a relocation.
14525         (gold_undefined_symbol_at_location): New function akin to
14526         old gold_undefined_symbol, calculates location from relocation.
14527         (gold_undefined_symbol): Change to take only a Symbol pointer
14528         and to report location as the file name associated with the symbol.
14529         * testsuite/debug_msg.sh: Update for changed error messages.
14530         * testsuite/undef_symbol.sh: Likewise.
14531
14532 2009-02-04  Duncan Sands  <baldrick@free.fr>
14533
14534         PR 9812
14535         * reduced_debug_output.h
14536         (Output_reduced_debug_abbrev_section::failed): Use format for
14537         gold_warning.
14538         (Output_reduced_debug_info_section::faild): Likewise.
14539
14540 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
14541
14542         * script.cc (Lazy_demangler): New class.
14543         (Version_script_info::get_symbol_version_helper): Demangle a
14544         symbol only once.
14545
14546 2009-01-29  Cary Coutant  <ccoutant@google.com>
14547
14548         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
14549         to __tls_get_addr.
14550         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14551
14552 2009-01-28  Ian Lance Taylor  <iant@google.com>
14553
14554         * version.cc (version_string): Bump to 1.9.
14555
14556         * gold.h: Include <cstring> and <stdint.h>.
14557         * version.cc: Include <cstdio>.
14558         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
14559         warning.
14560         * reduced_debug_output.cc (insert_into_vector): Rename from
14561         Insert_into_vector; change all callers.  Use Swap_unaligned to
14562         avoid aliasing issue; remove union since it is unnecessary.
14563
14564 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
14565
14566         * Makefile.am (CCFILES): Add gc.cc.
14567         (HFILES): Add gc.h.
14568         * Makefile.in: Regenerate.
14569         * gold.cc (Gc_runner): New class.
14570         (queue_initial_tasks): Call garbage collection related tasks
14571         when corresponding options are invoked.
14572         (queue_middle_gc_tasks): New function.
14573         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
14574         processed early before laying out sections during garbage collection.
14575         * gold.h (queue_middle_gc_tasks): New function.
14576         (is_prefix_of): Move from "layout.cc".
14577         * i386.cc (Target_i386::gc_process_relocs): New function.
14578         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
14579         * main.cc (main): Create object of class "Garbage_collection".
14580         * object.cc (Relobj::copy_symbols_data): New function.
14581         (Relobj::is_section_name_included): New function.
14582         (Sized_relobj::do_layout): Allow this function to be called twice
14583         during garbage collection and defer layout of section during the
14584         first call.
14585         * object.h (Relobj::get_symbols_data): New function.
14586         (Relobj::is_section_name_included): New function.
14587         (Relobj::copy_symbols_data): New function.
14588         (Relobj::set_symbols_data): New function.
14589         (Relobj::get_relocs_data): New function.
14590         (Relobj::set_relocs_data): New function.
14591         (Relobj::is_output_section_offset_invalid): New pure virtual function.
14592         (Relobj::gc_process_relocs): New function.
14593         (Relobj::do_gc_process_relocs): New pure virtual function.
14594         (Relobj::sd_): New data member.
14595         (Sized_relobj::is_output_section_offset_invalid): New function.
14596         (Sized_relobj::do_gc_process_relocs): New function.
14597         * options.h (General_options::gc_sections): Modify to not be a no-op.
14598         (General_options::print_gc_sections): New option.
14599         * plugin.cc (Plugin_finish::run): Remove function call to
14600         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
14601         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
14602         * reloc.cc (Read_relocs::run): Add task to process relocs and
14603         determine unreferenced sections when doing garbage collection.
14604         (Gc_process_relocs): New class.
14605         (Sized_relobj::do_gc_process_relocs): New function.
14606         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
14607         sections that are garbage collected.
14608         * reloc.h (Gc_process_relocs): New class.
14609         * sparc.cc (Target_sparc::gc_process_relocs): New function.
14610         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
14611         symbols whose corresponding sections are garbage collected.
14612         (Symbol_table::Symbol_table): Add new parameter for the garbage
14613         collection object.
14614         (Symbol_table::gc_mark_undef_symbols): New function.
14615         (Symbol_table::gc_mark_symbol_for_shlib): New function.
14616         (Symbol_table::gc_mark_dyn_syms): New function.
14617         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
14618         as garbage.
14619         (Symbol_table::add_from_object): Likewise.
14620         (Symbol_table::add_from_relobj): When building shared objects, do not
14621         treat externally visible symbols as garbage.
14622         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
14623         table information for static and relocatable links.
14624         * symtab.h (Symbol_table::set_gc): New function.
14625         (Symbol_table::gc): New function.
14626         (Symbol_table::gc_mark_undef_symbols): New function.
14627         (Symbol_table::gc_mark_symbol_for_shlib): New function.
14628         (Symbol_table::gc_mark_dyn_syms): New function.
14629         (Symbol_table::gc_): New data member.
14630         * target.h (Sized_target::gc_process_relocs): New pure virtual
14631         function.
14632         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
14633         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
14634
14635 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
14636
14637         * options.h (General_options::gc_sections): Define as a no-op for now.
14638         (General_options::no_keep_memory): Ditto.
14639         (General_options::Bshareable): Define.
14640         * options.cc (General_options::finalize): Honor -Bshareable.
14641
14642 2009-01-20  Andreas Schwab  <schwab@suse.de>
14643
14644         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
14645         read the value in the contents, since we don't use it.  Use the
14646         template endianness when writing.
14647         (Relocate::relocate): Use it for R_PPC_REL16_HA.
14648
14649 2009-01-19  Andreas Schwab  <schwab@suse.de>
14650
14651         * configure.tgt (powerpc64-*): Fix targ_obj.
14652
14653 2009-01-15  Ian Lance Taylor  <iant@google.com>
14654
14655         * object.cc (Sized_relobj::write_local_symbols): Don't write out
14656         local symbols when stripping all symbols.
14657
14658 2009-01-14  Cary Coutant  <ccoutant@google.com>
14659
14660         * output.cc (Output_reloc): Add explicit instantiations.
14661
14662 2009-01-14  Cary Coutant  <ccoutant@google.com>
14663
14664         * archive.cc (Archive::get_elf_object_for_member): Remove call
14665         to File_read::claim_for_plugin.
14666         * descriptors.cc (Descriptors::open): Remove reference to
14667         is_claimed.
14668         (Descriptors::claim_for_plugin): Remove.
14669         * descriptors.h (Descriptors::claim_for_plugin): Remove.
14670         (Descriptors::is_claimed): Remove.
14671         (claim_descriptor_for_plugin): Remove.
14672         * fileread.cc (File_read::claim_for_plugin): Remove.
14673         * fileread.h (File_read::claim_for_plugin): Remove.
14674         (File_read::descriptor): Reopen descriptor if necessary.
14675         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
14676         (Plugin_manager::all_symbols_read): Add task parameter. Change
14677         all callers.
14678         (Plugin_manager::get_input_file): New function.
14679         (Plugin_manager::release_input_file): New function.
14680         (Pluginobj::Pluginobj): Add filesize parameter and initialize
14681         corresponding data member.
14682         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
14683         and pass to base constructor. Change all callers.
14684         (get_input_file, release_input_file): New functions.
14685         (make_sized_plugin_object): Add filesize parameter. Change all callers.
14686         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
14687         (Plugin_manager::all_symbols_read): Add task parameter.
14688         (Plugin_manager::get_input_file): New function.
14689         (Plugin_manager::release_input_file): New function.
14690         (Plugin_manager::task_): New data member.
14691         (Pluginobj::Pluginobj): Add filesize parameter.
14692         (Pluginobj::filename): New function.
14693         (Pluginobj::descriptor): New function.
14694         (Pluginobj::filesize): New function.
14695         (Pluginobj::filesize_): New data member.
14696         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
14697         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
14698         File_read::claim_for_plugin; use Object::unlock to unlock the file.
14699
14700         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
14701         with archive libraries.
14702         * testsuite/Makefile.in: Regenerate.
14703         * testsuite/plugin_test.c (struct sym_info): New type.
14704         (get_input_file, release_input_file): New static variables.
14705         (onload): Capture new transfer vector entries.
14706         (claim_file_hook): Stop reading at end of file according to filesize.
14707         Factor out parsing of readelf output into separate function.
14708         (all_symbols_read_hook): Exercise get_input_file and release_input_file
14709         APIs and get the source file name from the symbol table.  Convert
14710         source file name to corresponding object file name.  Print info
14711         message when adding new input files.
14712         (parse_readelf_line): New function.
14713         * testsuite/plugin_test_1.sh: Add checks for new info messages.
14714         * testsuite/plugin_test_2.sh: Likewise.
14715         * testsuite/plugin_test_3.sh: Likewise.
14716         * testsuite/plugin_test_4.sh: New test case.
14717
14718 2009-01-07  Ian Lance Taylor  <iant@google.com>
14719
14720         * version.cc (version_string): Bump to 1.8.
14721
14722 2008-12-23  Cary Coutant  <ccoutant@google.com>
14723
14724         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
14725         * plugin.cc (Plugin_manager::finish): Rename as
14726         layout_deferred_objects.  Move cleanup to separate function.
14727         (Plugin_manager::cleanup): New function.
14728         (Plugin_finish::run): Call layout_deferred_objects and cleanup
14729         separately.
14730         * plugin.h (Plugin_manager::finish): Rename as
14731         layout_deferred_objects.
14732         (Plugin_manager::cleanup): New function.
14733         (Plugin_manager::cleanup_done): New field.
14734
14735 2008-12-23  Cary Coutant  <ccoutant@google.com>
14736
14737         * plugin.cc (is_visible_from_outside): New function.
14738         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
14739         so we don't return "IR only" status for exported symbols or -r links.
14740
14741         * testsuite/Makefile.am (plugin_test_3): New test case.
14742         * testsuite/Makefile.in: Regenerate.
14743         * testsuite/plugin_test_3.sh: New file.
14744
14745 2008-12-22  Cary Coutant  <ccoutant@google.com>
14746
14747         * object.cc (Sized_relobj::layout_section): New function.
14748         (Sized_relobj::do_layout): Defer layout of input sections until after
14749         plugin has provided replacement files.
14750         (Sized_relobj::do_layout_deferred_sections): New function.
14751         * object.h (Relobj::set_section_offset): Remove virtual keyword.
14752         (Relobj::layout_deferred_sections): New function.
14753         (Relobj::do_layout_deferred_sections): New function.
14754         (Sized_relobj::do_layout_deferred_sections): New function.
14755         (Sized_relobj::layout_section): New function.
14756         (Sized_relobj::Deferred_layout): New structure.
14757         (Sized_relobj::deferred_layout_): New field.
14758         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
14759         Change all callers.  Layout deferred sections.
14760         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
14761         references.
14762         (Plugin_hook::run): Move code from do_plugin_hook inline.
14763         (Plugin_hook::do_plugin_hook): Remove.
14764         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
14765         (Plugin_manager::finish): Renamed, was cleanup.
14766         (Plugin_manager::should_defer_layout): New function.
14767         (Plugin_manager::add_deferred_layout_object): New function.
14768         (Plugin_manager::Deferred_layout_list): New type.
14769         (Plugin_manager::deferred_layout_objects_): New field.
14770         (Plugin_hook::do_plugin_hook): Remove.
14771
14772 2008-12-17  Ian Lance Taylor  <iant@google.com>
14773
14774         * options.h (class General_options): Add --no case for
14775         --export-dynamic.
14776
14777 2008-12-16  Cary Coutant  <ccoutant@google.com>
14778
14779         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
14780         vector.
14781         (Plugin_manager::claim_file): Create plugin object even if
14782         plugin did not call the add_symbols callback.
14783         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
14784         asking for more symbols than were added.
14785         * testsuite/Makefile.am (plugin_test_1): Add test case with
14786         no global symbols.
14787         (empty.syms): New target.
14788         * testsuite/Makefile.in: Regenerate.
14789         * testsuite/plugin_test.c (claim_file_hook): Add new debug
14790         message. Don't call add_symbols if no globals.
14791         (all_symbols_read_hook): Don't provide replacement for empty
14792         claimed file.
14793
14794 2008-12-12  Ian Lance Taylor  <iant@google.com>
14795
14796         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
14797         r_type == 0 for a local symbol with r_sym == 0.
14798         (scan_relocatable_relocs): Pass r_sym to
14799         local_non_section_strategy.
14800         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
14801         r_sym parameter.
14802
14803         * configure.ac: Update test for TLS descriptors: they are
14804         supported as of glibc 2.9.
14805         * configure: Rebuild.
14806
14807 2008-12-11  Ian Lance Taylor  <iant@google.com>
14808
14809         PR 7091
14810         * target-reloc.h (Default_scan_relocatable_relocs): For each
14811         function, map r_type == 0 to RELOC_DISCARD.
14812
14813 2008-12-10  Cary Coutant  <ccoutant@google.com>
14814
14815         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
14816         object to override a kept COMDAT group from a plugin object.
14817
14818 2008-12-09  Ian Lance Taylor  <iant@google.com>
14819
14820         PR 7088
14821         * yyscript.y (file_cmd): Handle INPUT.
14822
14823         * testsuite/initpri1.c: Change all declarations to be full
14824         prototypes by adding void, to avoid compiler warnings.
14825
14826 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
14827
14828         * options.cc (General_options::parse_plugin_opt): New.
14829         (General_options::add_plugin): The argument now is just the filename.
14830         (General_options::add_plugin_option): New.
14831         * options.h (plugin_opt): New.
14832         (add_plugin): Change argument name.
14833         (add_plugin_option): New.
14834         * plugin.cc (Plugin::load): Don't parse the plugin option.
14835         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
14836         (Plugin::add_option): New.
14837         (Plugin::args_): Change type.
14838         (Plugin::filename_): New.
14839         (Plugin_manager::add_plugin_option): New.
14840         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
14841         * testsuite/Makefile.in: Regenerate.
14842
14843 2008-12-05  Cary Coutant  <ccoutant@google.com>
14844
14845         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
14846         Handle --strip-lto-sections option.
14847         * options.h (strip_lto_sections): New option.
14848
14849 2008-12-01  Cary Coutant  <ccoutant@google.com>
14850
14851         * plugin.cc (ld_plugin_message): Change format parameter to const.
14852         Fix mismatch between new[] and delete.
14853
14854 2008-11-14  Cary Coutant  <ccoutant@google.com>
14855
14856         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
14857         instead of -1U.
14858
14859 2008-11-05  Craig Silverstein  <csilvers@google.com>
14860
14861         * options.cc (General_options::parse_dynamic_list): New function.
14862         * options.h (General_options): New flags dynamic_list,
14863         dynamic_list_data, dynamic_list_cpp_new, and
14864         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
14865         (General_options::in_dynamic_list): New function.
14866         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
14867         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
14868         (Lex::can_continue_name): Likewise.
14869         (yylex): Likewise.
14870         (read_script_file): New parameter script_options.
14871         (read_dynamic_list): New function.
14872         (Script_options::define_dynamic_list): New function.
14873         (dynamic_list_keyword_parsecodes): New variable.
14874         (dynamic_list_keywords): New variable.
14875         * script.h (Script_options::define_dynamic_list): New function
14876         prototype.
14877         (read_dynamic_list): New function prototype.
14878         * symtab.cc (strprefix): New macro.
14879         (Symbol::should_add_dynsym_entry): Support dynamic_list,
14880         dynamic_list_data, dynamic_list_cpp_new, and
14881         dynamic_list_cpp_typeinfo.
14882         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
14883         (dynamic_list_expr): New rule.
14884         (dynamic_list_nodes): Likewise.
14885         (dynamic_list_node): Likewise.
14886         * testsuite/Makefile.am (dynamic_list): New test.
14887         * testsuite/Makefile.in: Regenerated.
14888         * testsuite/dynamic_list.t: New file.
14889         * testsuite/dynamic_list.sh: New file.
14890
14891 2008-11-05  Craig Silverstein  <csilvers@google.com>
14892
14893         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
14894         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
14895         (t11_last): Likewise.
14896         * testsuite/ver_test_6.c (main): Likewise.
14897
14898 2008-10-07  Cary Coutant  <ccoutant@google.com>
14899
14900         * options.c (General_options::finalize): Add check for -static and
14901         -shared.
14902         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
14903         is not empty.
14904
14905 2008-10-02  Cary Coutant  <ccoutant@google.com>
14906
14907         * plugin.cc (make_sized_plugin_object): Fix conditional
14908         compilation to work when not all targets are enabled.
14909
14910 2008-09-29  Cary Coutant  <ccoutant@google.com>
14911
14912         * archive.cc (Archive::get_file_and_offset): Use filename instead
14913         of name to get library path.
14914         (Archive::include_member): Unlock external member of a thin archive.
14915
14916         * testsuite/Makefile.am (TEST_AR): New variable.
14917         (thin_archive_test_1): New test.
14918         (thin_archive_test_2): New test.
14919         * testsuite/Makefile.in: Regenerate.
14920         * testsuite/thin_archive_main.cc: New file.
14921         * testsuite/thin_archive_test_1.cc: New file.
14922         * testsuite/thin_archive_test_2.cc: New file.
14923         * testsuite/thin_archive_test_3.cc: New file.
14924         * testsuite/thin_archive_test_4.cc: New file.
14925
14926 2008-09-29  Cary Coutant  <ccoutant@google.com>
14927
14928         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
14929         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
14930         instead of -1U.
14931         (Sized_relobj::do_finalize_local_symbols): Likewise.
14932         (Sized_relobj::map_to_kept_section): Likewise.
14933         * object.h (Sized_relobj::invalid_address): New constant.
14934         (Sized_relobj::do_output_section_offset): Check for invalid_address
14935         and return -1ULL.
14936         * output.cc (Output_reloc::local_section_offset): Use constant
14937         invalid_address instead of -1U.
14938         (Output_reloc::get_address): Likewise.
14939         (Output_section::output_address): Change -1U to -1ULL.
14940         * output.h (Output_reloc::invalid_address): New constant.
14941         * reloc.cc (Sized_relobj::write_sections): Use constant
14942         invalid_address instead of -1U.
14943         (Sized_relobj::relocate_sections): Likewise.
14944         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
14945         values for merge sections.
14946         * target-reloc.h (relocate_for_relocatable): Use constant
14947         invalid_address instead of -1U.
14948
14949 2008-09-19  Cary Coutant  <ccoutant@google.com>
14950
14951         Add plugin functionality for link-time optimization (LTO).
14952         * configure.ac (plugins): Add --enable-plugins option.
14953         * configure: Regenerate.
14954         * config.in: Regenerate.
14955         * Makefile.am (LIBDL): New variable.
14956         (CCFILES): Add plugin.cc.
14957         (HFILES): Add plugin.h.
14958         (ldadd_var): Add LIBDL.
14959         * Makefile.in: Regenerate.
14960
14961         * archive.cc: Include "plugin.h".
14962         (Archive::setup): Don't preread archive symbols when using a plugin.
14963         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
14964         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14965         files.
14966         (Archive::include_member): Add symbols from plugin objects.
14967         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14968         * descriptors.cc (Descriptors::open): Check for file descriptors
14969         abandoned by plugins.
14970         (Descriptors::claim_for_plugin): New function.
14971         * descriptors.h (Descriptors::claim_for_plugin): New function.
14972         (Open_descriptor::is_claimed): New field.
14973         (claim_descriptor_for_plugin): New function.
14974         * fileread.cc (File_read::claim_for_plugin): New function.
14975         * fileread.h (File_read::claim_for_plugin): New function.
14976         (File_read::descriptor): New function.
14977         * gold.cc: Include "plugin.h".
14978         (queue_initial_tasks): Add task to call plugin hooks for generating
14979         new object files.
14980         * main.cc: Include "plugin.h".
14981         (main): Load plugin libraries.
14982         * object.h (Pluginobj): Declare.
14983         (Object::pluginobj): New function.
14984         (Object::do_pluginobj): New function.
14985         (Object::set_target): New function.
14986         * options.cc: Include "plugin.h".
14987         (General_options::parse_plugin): New function.
14988         (General_options::General_options): Initialize plugins_ field.
14989         (General_options::add_plugin): New function.
14990         * options.h (Plugin_manager): Declare.
14991         (General_options): Add --plugin option.
14992         (General_options::has_plugins): New function.
14993         (General_options::plugins): New function.
14994         (General_options::add_plugin): New function.
14995         (General_options::plugins_): New field.
14996         * plugin.cc: New file.
14997         * plugin.h: New file.
14998         * readsyms.cc: Include "plugin.h".
14999         (Read_symbols::do_read_symbols): Check for archive before checking
15000         for ELF file.  Call plugin hooks to claim files.
15001         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
15002         from a real object file; force override when processing replacement
15003         files.
15004         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
15005         (Symbol::init_base_object): Likewise.
15006         (Symbol::init_base_output_data): Likewise.
15007         (Symbol::init_base_output_segment): Likewise.
15008         (Symbol::init_base_constant): Likewise.
15009         (Symbol::init_base_undefined): Likewise.
15010         (Symbol::output_section): Assert that object is not a plugin.
15011         (Symbol_table::add_from_pluginobj): New function.
15012         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
15013         undefined.
15014         (Symbol_table::sized_write_globals): Likewise.
15015         (Symbol_table::add_from_pluginobj): Instantiate template.
15016         * symtab.h (Sized_pluginobj): Declare.
15017         (Symbol::in_real_elf): New function.
15018         (Symbol::set_in_real_elf): New function.
15019         (Symbol::in_real_elf_): New field.
15020         (Symbol_table::add_from_pluginobj): New function.
15021
15022         * testsuite/Makefile.am (AM_CFLAGS): New variable.
15023         (LIBDL): New variable.
15024         (LDADD): Add LIBDL.
15025         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
15026         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
15027         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
15028         (MOSTLYCLEANFILES): Likewise.
15029         * testsuite/Makefile.in: Regenerate.
15030         * testsuite/plugin_test.c: New file.
15031         * testsuite/plugin_test_1.sh: New file.
15032         * testsuite/plugin_test_2.sh: New file.
15033
15034 2008-09-16  Ian Lance Taylor  <iant@google.com>
15035
15036         * target-reloc.h (relocate_section): Check whether a symbol is
15037         defined by the ABI before reporting an undefined symbol error.
15038         * target.h (Target::is_defined_by_abi): Make parameter const.
15039         (Target::do_is_defined_by_abi): Likewise.
15040         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
15041         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
15042         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
15043         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
15044         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
15045         * testsuite/Makefile.in: Rebuild.
15046
15047         * fileread.cc (make_view): Add casts to avoid warning.
15048
15049 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15050
15051         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
15052         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15053
15054 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15055
15056         * options.h (General_options::output_is_executable): New.
15057         (General_options::output_is_pie): New.
15058         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
15059         for shared libraries.
15060         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15061
15062 2008-09-11  Chris Demetriou  <cgd@google.com>
15063
15064         * options.h (origin): New -z option.
15065         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
15066         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
15067         in DT_FLAGS_1.
15068
15069 2008-09-05  Cary Coutant  <ccoutant@google.com>
15070
15071         * fileread.cc (File_read::make_view): Add check for attempt to map
15072         beyond end of file.
15073
15074 2008-09-05  Cary Coutant  <ccoutant@google.com>
15075
15076         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
15077         explicit instantiations.
15078
15079 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
15080
15081         PR gold/6858
15082         * options.cc (General_options::finalize): Allow undefined symbols
15083         in shlibs if linking -shared.
15084
15085         PR gold/6859
15086         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
15087         symbols as not needing a dynsym entry.
15088
15089 2008-08-20  Craig Silverstein  <csilvers@google.com>
15090
15091         * fileread.cc (File_read::open): Do not lock the file unless it
15092         was successfully opened.
15093
15094 2008-08-14  Cary Coutant  <ccoutant@google.com>
15095
15096         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
15097         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
15098         * testsuite/tls_test.cc (struct int128): 128-bit struct
15099         for testing TLS relocs with non-zero addend.
15100         (v12): New TLS variable.
15101         (t12): New test.
15102         (t_last): Add check for v12.
15103         * testsuite/tls_test.h (t12): New function.
15104         * testsuite/tls_test_main.cc (thread_routine): Call new test.
15105
15106 2008-08-13  Ian Lance Taylor  <iant@google.com>
15107
15108         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
15109         set tls_segment_ or relro_segment_.
15110         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
15111         when appropriate.
15112         * output.h (Output_section::clear_is_relro): New function.
15113         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
15114         sections specially even when output_data_ is empty.
15115         (Output_segment::maximum_alignment): When first section is relro,
15116         only force alignment for PT_LOAD segments.
15117         * script.cc (script_data_segment_align): New function.
15118         (script_data_segment_relro_end): New function.
15119         * script-c.h (script_data_segment_align): Declare.
15120         (script_data_segment_relro_end): Declare.
15121         * script-sections.h (class Script_sections): Declare
15122         data_segment_align and data_segment_relro_end.  Add fields
15123         segment_align_index_ and saw_relro_end_.
15124         * script-sections.cc (class Sections_element): Add set_is_relro
15125         virtual function.  Add new bool* parameter to place_orphan_here.
15126         Add get_output_section virtual function.
15127         (class Output_section_definition): Add set_is_relro.  Add new
15128         bool* parameter to place_orphan_here.  Add get_output_section.
15129         Add is_relro_ field.
15130         (Output_section_definition::Output_section_definition): Initialize
15131         evaluated_address_, evaluated_load_address, evaluated_addralign_,
15132         and is_relro_ fields.
15133         (Output_section_definition::place_orphan_here): Add is_relro
15134         parameter.
15135         (Output_section_definition::set_section_addresses): Set relro for
15136         output section.
15137         (Output_section_definition::alternate_constraint): Likewise.
15138         (class Orphan_output_section): Add new bool* parameter to
15139         place_orphan_here.  Add get_output_section.
15140         (Orphan_output_section::place_orphan_here): Add is_relro
15141         parameter.
15142         (Script_sections::Script_sections): Initialize
15143         data_segment_align_index_ and saw_relro_end_.
15144         (Script_sections::data_segment_align): New function.
15145         (Script_sections::data_segment_relro_end): New function.
15146         (Script_sections::place_orphan): Set or clear is_relro.
15147         (Script_sections::set_section_addresses): Force alignment of first
15148         TLS section.
15149         * yyscript.y (exp): Call script_data_segment_align and
15150         script_data_segment_relro_end.
15151         * testsuite/relro_script_test.t: New file.
15152         * testsuite/relro_test.cc (using_script): Declare.
15153         (t1, t2): Test using_script.
15154         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
15155         (relro_script_test_SOURCES): Define.
15156         (relro_script_test_DEPENDENCIES): Define.
15157         (relro_script_test_LDFLAGS): Define.
15158         (relro_script_test_LDADD): Define.
15159         (relro_script_test.so): New target.
15160         * testsuite/Makefile.in: Rebuild.
15161
15162 2008-08-06  Cary Coutant <ccoutant@google.com>
15163
15164         * archive.cc (Archive::total_archives, Archive::total_members)
15165         (Archive::total_members_loaded): New variables.
15166         (Archive::setup): Add parameter.  Add option to preread
15167         archive symbols.
15168         (Archive::read_armap): Add counter.
15169         (Archive::get_file_and_offset): New function.
15170         (Archive::get_elf_object_for_member): New function.
15171         (Archive::read_all_symbols): New function.
15172         (Archive::read_symbols): New function.
15173         (Archive::add_symbols): Add counters.
15174         (Archive::include_all_members): Use armap to find members if it's
15175         already built.
15176         (Archive::include_member): Skip reading symbols if already read.
15177         Factored code into Archive::get_file_and_offset and
15178         Archive::get_elf_object_for_member.  Changed call to
15179         Mapfile::report_include_archive_member.
15180         (Archive::print_stats): New function.
15181         * archive.h: Declare Object and Read_symbols_data classes.
15182         (Archive::Archive): Add initializers for new members.
15183         (Archive::setup): Add parameter.
15184         (Archive::print_stats): New function.
15185         (Archive::total_archives, Archive::total_members)
15186         (Archive::total_members_loaded): New variables.
15187         (Archive::get_file_and_offset): New function.
15188         (Archive::get_elf_object_for_member): New function.
15189         (Archive::read_all_symbols): New function.
15190         (Archive::read_symbols): New function.
15191         (Archive::Archive_member): New class.
15192         (Archive::members_): New member.
15193         (Archive::num_members_): New member.
15194         * main.cc: Include archive.h.
15195         (main): Call Archive::print_stats.
15196         * mapfile.cc (Mapfile::report_include_archive_member): Delete
15197         archive parameter; member_name is now the fully-decorated name.
15198         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
15199         * options.h: (General_options): Add --preread-archive-symbols option.
15200         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
15201         Archive::setup.
15202
15203 2008-08-04  Ian Lance Taylor  <iant@google.com>
15204
15205         * symtab.h (Symbol::use_plt_offset): New function.
15206         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
15207         * powerpc.cc (Relocate::relocate): Likewise.
15208         * sparc.cc (Relocate::relocate): Likewise.
15209         * x86_64.cc (Relocate::relocate): Likewise.
15210         * testsuite/weak_plt.sh: New test.
15211         * testsuite/weak_plt_main.cc: New test.
15212         * testsuite/weak_plt_shared.cc: New test.
15213         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
15214         (check_PROGRAMS): Add weak_plt.
15215         (check_DATA): Add weak_plt_shared.so.
15216         (weak_plt_main_pic.o, weak_plt): New targets.
15217         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
15218         * testsuite/Makefile.in: Rebuild.
15219
15220         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
15221         gcctestdir/ld.
15222         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
15223         * testsuite/Makefile.in: Rebuild.
15224
15225 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
15226
15227         * Makefile.am (POTFILES.in): Set LC_ALL=C.
15228         * Makefile.in: Regenerate.
15229         * po/POTFILES.in: Regenerate.
15230
15231 2008-07-29  Ian Lance Taylor  <iant@google.com>
15232
15233         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
15234         symbols before other symbols.
15235         * testsuite/script_test_2.cc (test_addr): Declare.
15236         (test_addr_alias): Declare.
15237         (main): Check that test_addr and test_addr_alias have the right
15238         values.
15239         * testsuite/script_test_2.t: Define test_addr_alias and
15240         test_addr.
15241
15242 2008-07-24  Ian Lance Taylor  <iant@google.com>
15243
15244         PR 5990
15245         * descriptors.cc: New file.
15246         * descriptors.h: New file.
15247         * gold-threads.h (class Hold_optional_lock): New class.
15248         * fileread.cc: Include "descriptors.h".
15249         (File_read::~File_read): Release descriptor rather than closing
15250         it.
15251         (File_read::open) [file]: Call open_descriptor rather than open.
15252         Set is_descriptor_opened_.
15253         (File_read::open) [memory]: Assert that descriptor is not open.
15254         (File_read::reopen_descriptor): New function.
15255         (File_read::release): Release descriptor.
15256         (File_read::do_read): Make non-const.  Reopen descriptor.
15257         (File_read::read): Make non-const.
15258         (File_read::make_view): Reopen descriptor.
15259         (File_read::do_readv): Likewise.
15260         * fileread.h (class File_read): Add is_descriptor_opened_ field.
15261         Update declarations.
15262         * layout.cc: Include "descriptors.h".
15263         (Layout::create_build_id): Use open_descriptor rather than open.
15264         * output.cc: Include "descriptors.h".
15265         (Output_file::open): Use open_descriptor rather than open.
15266         * archive.cc (Archive::const_iterator): Change Archive to be
15267         non-const.
15268         (Archive::begin, Archive::end): Make non-const.
15269         (Archive::count_members): Likewise.
15270         * archive.h (class Archive): Update declarations.
15271         * object.h (Object::read): Make non-const.
15272         * Makefile.am (CCFILES): Add descriptors.cc.
15273         (HFILES): Add descriptors.h.
15274         * Makefile.in: Rebuild.
15275
15276         PR 6716
15277         * gold.h: Always include <clocale>.  Add Solaris workarounds
15278         following code in binutils/sysdep.h.
15279
15280         PR 6048
15281         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
15282         this->eh_frame_hdr_ is NULL before using it.
15283
15284         * dynobj.cc (Versions::Versions): Update comment.
15285
15286         * dynobj.cc (Versions::Versions): If there is an soname, use it as
15287         the base version name.
15288
15289         * stringpool.cc (Stringpool_template::add_with_length): Set key to
15290         array size plus one.
15291         (Stringpool_template::set_string_offsets): Subtract one from key
15292         before using it as an array index.
15293         (Stringpool_template::get_offset_with_length): Likewise.
15294         (Stringpool_template::write_to_buffer): Likewise.
15295         * stringpool.h (Stringpool_template::get_offset_from_key):
15296         Likewise.
15297
15298 2008-07-23  Ian Lance Taylor  <iant@google.com>
15299
15300         PR 6658
15301         * object.h (Merged_symbol_value::value): Do our best to handle a
15302         negative addend.
15303
15304         PR 6647
15305         * script.cc (Version_script_info::get_versions): Don't add empty
15306         version tag to return value.
15307         (Version_script_info::get_symbol_version_helper): Change return
15308         type to bool.  Add pversion parameter.  Change all callers.
15309         (script_register_vers_node): Don't require a non-NULL tag.
15310         * script.h (class Version_script_info): Update declarations.
15311         (Version_script_info::get_symbol_version): Change return type to
15312         bool.  Add version parameter.  Change all callers.
15313         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
15314         handling.  Handle an empty version from a version script.
15315         (Symbol_table::define_special_symbol): Likewise.
15316         * testsuite/ver_test_10.script: New file.
15317         * testsuite/ver_test_10.sh: New file.
15318         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
15319         (check_DATA): Add ver_test_10.syms.
15320         (ver_test_10.syms, ver_test_10.so): New target.
15321         * testsuite/Makefile.in: Rebuild.
15322
15323 2008-07-23  Simon Baldwin  <simonb@google.com>
15324
15325         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
15326         to zero for undefined symbols from dynamic libraries.
15327
15328 2008-07-23  Ian Lance Taylor  <iant@google.com>
15329
15330         * symtab.cc (Symbol_table::resolve): Remove version parameter.
15331         Change all callers.
15332         * symtab.h (class Symbol_table): Update declaration.
15333         * testsuite/ver_test_9.cc: New file.
15334         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
15335         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
15336         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
15337         (ver_test_9.so, ver_test_9.o): New targets.
15338         * testsuite/Makefile.in: Rebuild.
15339
15340 2008-07-22  Ian Lance Taylor  <iant@google.com>
15341
15342         * options.h (class General_options): Define --check-sections.
15343         * layout.cc (Layout::set_segment_offsets): Handle
15344         --check-sections.
15345
15346         * options.h (class General_options): Define -n/--nmagic and
15347         -N/--omagic.
15348         * options.cc (General_options::finalize): For -n/--nmagic or
15349         -N/--omagic, set -static.
15350         * layout.cc (Layout::attach_allocated_section_to_segment): If
15351         -N/--omagic, don't put read-only and read-write sections in
15352         different segments.
15353         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
15354         finding a read-only segment.
15355         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
15356         don't set the minimum segment alignment to the common page size,
15357         and don't set the file offset to the address modulo the page size.
15358         * script-sections.cc (Script_sections::create_segments): If
15359         -n/--omagic, don't put read-only and read-write sections in
15360         different segments.
15361
15362         * cref.cc: New file.
15363         * cref.h: New file.
15364         * options.h (class General_options): Add --print-symbol-counts.
15365         * main.cc (main): Issue defined symbol report if requested.
15366         * archive.cc (Archive::interpret_header): Make into a const member
15367         function.
15368         (Archive::add_symbols): Call Input_objects::archive_start and
15369         archive_stop.
15370         (Archive::const_iterator): Define new class.
15371         (Archive::begin, Archive::end): New functions.
15372         (Archive::include_all_members): Rewrite to use iterator.
15373         (Archive::count_members): New function.
15374         * archive.h (class Archive): Update declarations.
15375         (Archive::filename): New function.
15376         * object.cc: Include "cref.h".
15377         (Sized_relobj::Sized_relobj): Initialize defined_count_.
15378         (Sized_relobj::do_get_global_symbol_counts): New function.
15379         (Input_objects::add_object): Add object to cross-referencer.
15380         (Input_objects::archive_start): New function.
15381         (Input_objects::archive_stop): New function.
15382         (Input_objects::print_symbol_counts): New function.
15383         * object.h: Declare Cref and Archive.
15384         (Object::get_global_symbol_counts): New function.
15385         (Object::do_get_global_symbol_counts): New pure virtual function.
15386         (class Sized_relobj): Add defined_count_ field.  Update
15387         declarations.
15388         (class Input_objects): Add cref_ field.  Update constructor.
15389         Update declarations.
15390         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
15391         defined_count_.
15392         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
15393         symbol counts.
15394         (Sized_dynobj::do_get_global_symbol_counts): New function.
15395         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
15396         defined_count_.  Update declarations.  Define Symbols typedef.
15397         * symtab.cc (Symbol_table::add_from_relobj): Add defined
15398         parameter.  Change all callers.
15399         (Symbol_table::add_from_dynobj): Add sympointers and defined
15400         parameters.  Change all callers.
15401         * symtab.h (class Symbol_table): Update declarations.
15402         * Makefile.am (CCFILES): Add cref.cc.
15403         (HFILES): Add cref.h.
15404         * Makefile.in: Rebuild.
15405
15406 2008-07-22  Simon Baldwin  <simonb@google.com>
15407
15408         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
15409         to zero when writing undefined symbols.
15410
15411 2008-07-22  Ian Lance Taylor  <iant@google.com>
15412
15413         * output.cc (Output_section::add_input_section): Don't try to
15414         merge empty merge sections.
15415
15416 2008-07-21  Craig Silverstein  <csilvers@google.com>
15417
15418         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15419         Include symbol version in error message.
15420
15421 2008-07-20  Chris Demetriou  <cgd@google.com>
15422
15423         * configure.ac (gold_cv_c_random_seed): New configured variable.
15424         (RANDOM_SEED_CFLAGS): New substituted variable.
15425         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
15426         * configure: Rebuild.
15427         * Makefile.in: Likewise.
15428         * testsuite/Makefile.in: Likewise.
15429
15430 2008-07-18  Ian Lance Taylor  <iant@google.com>
15431
15432         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
15433         where we see NAME/NULL and NAME/VERSION  as separate symbols.
15434         * testsuite/ver_test_main.cc (main): Call t4.
15435         (t4, t4_2a): Define.
15436         * testsuite/ver_test_2.cc (t4_2): Define.
15437         * testsuite/ver_test_2.script: Put t4_2a in VER2.
15438         * testsuite/ver_test_4.cc (t4_2a): Define.
15439         * testsuite/ver_test_4.script: Put t4_2a in VER2.
15440         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
15441
15442 2008-07-17  Ian Lance Taylor  <iant@google.com>
15443
15444         * dynobj.cc (Versions::add_def): If we give an error about a
15445         missing version, go ahead and create the version anyhow.
15446
15447 2008-07-10  Ian Lance Taylor  <iant@google.com>
15448
15449         Handle output sections with more than 0x7fffffff bytes.
15450         * object.h (class Relobj): Change map_to_output_ to
15451         output_sections_, and just keep a section pointer.  Change all
15452         uses.  Move comdat group support to Sized_relobj.
15453         (Relobj::is_section_specially_mapped): Remove.
15454         (Relobj::output_section): Remove poff parameter.  Change all
15455         callers.
15456         (Relobj::output_section_offset): New function.
15457         (Relobj::set_section_offset): Rewrite.
15458         (Relobj::map_to_output): Remove.
15459         (Relobj::output_sections): New function.
15460         (Relobj::do_output_section_offset): New pure virtual function.
15461         (Relobj::do_set_section_offset): Likewise.
15462         (class Sized_relobj): Add section_offsets_ field.  Add comdat
15463         group support from Relobj.  Update declarations.
15464         (Sized_relobj::get_output_section_offset): New function.
15465         (Sized_relobj::do_output_section_offset): New function.
15466         (Sized_relobj::do_set_section_offset): New function.
15467         * object.cc (Relobj::output_section_address): Remove.
15468         (Sized_relobj::Sized_relobj): Initialize new fields.
15469         (Sized_relobj::include_section_group): Cast find_kept_object to
15470         Sized_relobj.
15471         (Sized_relobj::include_linkonce_section): Likewise.
15472         (Sized_relobj::do_layout): Use separate arrays for output section
15473         and output offset.
15474         (Sized_relobj::do_count_local_symbols): Change map_to_output to
15475         output_sections.
15476         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
15477         output_sections and section_offsets.
15478         (Sized_relobj::write_local_symbols): Likewise.
15479         (map_to_kept_section): Compute output address directly.
15480         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
15481         output_sections and section_offsets.
15482         (Sized_relobj::write_sections): Likewise.
15483         (Sized_relobj::relocate_sections): Likewise.
15484         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
15485         * output.h (class Output_reloc): Update declarations.  Change
15486         u2_.relobj to Sized_relobj*.
15487         (class Output_data_reloc): Change add functions to use
15488         Sized_relobj*.
15489         * output.cc (Output_reloc::Output_reloc): Change relobj to
15490         Sized_relobj*.
15491         (Output_reloc::local_section_offset): Change return type to
15492         Elf_Addr.  Use get_output_section_offset.
15493         (Output_reloc::get_address): Likewise.
15494         (Output_section::is_input_address_mapped): Don't call
15495         is_section_specially_mapped.
15496         (Output_section::output_offset): Likewise.
15497         (Output_section::output_address): Likewise.
15498         (Output_section::starting_output_address): Likewise.
15499         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
15500         parameter to Sized_relobj*.
15501         (Copy_relocs::need_copy_reloc): Likewise.
15502         (Copy_relocs::save): Likewise.
15503         * copy-relocs.h (class Copy_relocs): Update declarations.
15504         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
15505         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
15506         * target-reloc.h (relocate_for_relocatable): Change
15507         offset_in_output_section type to Elf_Addr.  Change code that uses
15508         it as well.
15509         * layout.cc (Layout::layout): Always set *off.
15510         * mapfile.cc (Mapfile::print_input_section): Use
15511         output_section_offset.
15512         * i386.cc (Target_i386::copy_reloc): Change object parameter to
15513         Sized_relobj*.
15514         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
15515         * sparc.cc (Target_sparc::copy_reloc): Likewise.
15516         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
15517
15518 2008-07-03  Ian Lance Taylor  <iant@google.com>
15519
15520         * layout.cc (Layout::include_section): Do not discard unrecognized
15521         SHT_STRTAB sections.
15522
15523 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
15524
15525         * script.cc (Lex::can_continue_name): Make '?' allowable in
15526         version-script names.
15527         * testsuite/version_script.map: Change glob pattern to use '?'
15528
15529 2008-06-30  Manish Singh  <yosh@gimp.org>
15530
15531         PR 6585
15532         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
15533         Correct typo.
15534
15535 2008-06-30  Ian Lance Taylor  <iant@google.com>
15536
15537         PR 6660
15538         PR 6682
15539         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
15540         versions]: Don't try to read the value in the contents, since we
15541         don't use it.  Use the template endianness when writing.
15542
15543 2008-06-25  Cary Coutant  <ccoutant@google.com>
15544
15545         * fileread.cc (File_read::make_view): Assert on zero-length view.
15546         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
15547         symbol table when there are no symbols to read.
15548
15549 2008-06-23  Craig Silverstein  <csilvers@google.com>
15550
15551         * version.cc (version_string): Bump to 1.7
15552
15553 2008-06-18  Craig Silverstein  <csilvers@google.com>
15554
15555         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
15556         constant 0xFFFF to type Valtype.
15557         (Powerpc_relocate_functions::rel16_ha): Likewise.
15558
15559 2008-06-17  Ian Lance Taylor  <iant@google.com>
15560
15561         * output.h (Output_section::Input_section): Initialize p2align_ to
15562         zero for Output_section_data constructors.
15563         (Output_section::Input_section::addralign): If not an input
15564         section, return the alignment of the Output_section_data.
15565         * testsuite/copy_test.cc: New file.
15566         * testsuite/copy_test_1.cc: New file.
15567         * testsuite/copy_test_2.cc: New file.
15568         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
15569         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
15570         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
15571         (copy_test_1_pic.o, copy_test_1.so): New targets.
15572         (copy_test_2_pic.o, copy_test_2.so): New targets.
15573         * testsuite/Makefile.in: Rebuild.
15574
15575         * script-sections.cc (Script_sections::place_orphan): Initialize
15576         local variable exact.
15577
15578 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
15579
15580         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
15581
15582 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
15583             David S. Miller  <davem@davemloft.net>
15584
15585         * powerpc.cc: New file.
15586         * Makefile.am (TARGETSOURCES): Add powerpc.cc
15587         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
15588         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
15589         * Makefile.in: Rebuild.
15590
15591 2008-06-09  Ian Lance Taylor  <iant@google.com>
15592
15593         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
15594         <exception>.
15595         (throwing, orig_terminate): New static variables.
15596         (terminate_handler): New static function.
15597         (t2): Set terminate handler.
15598
15599 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
15600
15601         PR 6584
15602         * binary.cc (Binary_to_elf::sized_convert): Fix .data
15603         alignment.
15604
15605 2008-05-30  Cary Coutant  <ccoutant@google.com>
15606
15607         * archive.cc (Archive::include_all_members) Correct to step
15608         over symbol table and extended name table in thin archives.
15609
15610 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
15611
15612         PR 6407
15613         * target-reloc.h (relocate_for_relocatable): Fix new_offset
15614         calculation.
15615
15616 2008-05-28  Caleb Howe  <cshowe@google.com>
15617
15618         * reduced_debug_output.cc: New file.
15619         * reduced_debug_output.h: New file.
15620         * options.h (class General_options): Add --strip-debug-non-line.
15621         * options.cc (General_options::finalize): Add strip_debug_non_line
15622         to the strip heirarchy.
15623         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
15624         fields.
15625         * layout.cc: Include "reduced_debug_output.h".
15626         (Layout::Layout): Initialize new fields.
15627         (line_only_debug_sections): New static array.
15628         (is_lines_only_debug_sections): New static inline function.
15629         (Layout::include_section): Handle --strip-debug-non-line.
15630         (Layout::make_output_section): If --strip-debug-non-line, build
15631         new output sections for .debug_abbrev and .debug_info.
15632         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
15633         gold.  Warn about possible overflow.
15634         (read_signed_LEB_128): Likewise.
15635         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
15636         (read_signed_LEB_128): Declare.
15637         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
15638         (HFILES): Add reduced_debug_output.h.
15639         * Makefile.in: Rebuild.
15640
15641 2008-05-21  Ian Lance Taylor  <iant@google.com>
15642
15643         * mapfile.cc: New file.
15644         * mapfile.h: New file.
15645         * options.h (class General_options): Add -M/--print-map and -Map.
15646         * options.cc (General_options::finalize): Make -M equivalent to
15647         -Map -.
15648         * main.cc: Include <cstdio> and "mapfile.h".
15649         (main): Open mapfile if requested.
15650         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
15651         constructor.  Change caller.
15652         (queue_initial_tasks): Add mapfile parameter.  Change caller.
15653         (queue_middle_tasks): Likewise.
15654         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
15655         declarations.
15656         * archive.cc: Include "mapfile.h".
15657         (Archive::add_symbols): Add mapfile parameter.  Change all
15658         callers.  Pass mapfile, symbol, and reason to include_member.
15659         (Archive::include_all_members): Add mapfile parameter.  Change all
15660         callers.
15661         (Archive::include_member): Add mapfile, sym, and why parameters.
15662         Change all callers.  Report inclusion to map file.
15663         * archive.h: Include "fileread.h".
15664         (class Archive): Update declarations.
15665         (Archive::file): New const method.
15666         (class Add_archive_symbols): Add mapfile_ field.  Update
15667         constructor.  Change all callers.
15668         * readsyms.h (class Read_symbols): Likewise.
15669         (class Finish_group): Likewise.
15670         (class Read_script): Likewise.
15671         * common.cc: Include "mapfile.h".
15672         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
15673         all callers.
15674         (Symbol_table::do_allocate_commons): Likewise.
15675         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
15676         symbol allocation to mapfile.
15677         * common.h (class Allocate_commons_task): Add mapfile_ field.
15678         Update constructor.  Change all callers.
15679         * symtab.h (class Symbol_table): Update declarations.
15680         * layout.cc: Include "mapfile.h".
15681         (Layout_task_runner::run): Print information to mapfile.
15682         (Layout::create_gold_note): Change Output_data_fixed_space to
15683         Output_data_zero_fill.
15684         (Layout::create_build_id): Likewise.
15685         (Layout::print_to_mapfile): New function.
15686         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
15687         constructor.  Change caller.
15688         (class Layout): Declare print_to_mapfile.
15689         * output.cc (Output_section::Input_section::print_to_mapfile): New
15690         function.
15691         (Output_section::add_input_section): If producing a map, always
15692         add to input_sections_ list.
15693         (Output_section::do_print_to_mapfile): New function.
15694         (Output_segment::print_sections_to_mapfile): New function.
15695         (Output_segment::print_section_list_to_mapfile): New function.
15696         * output.h: Include "mapfile.h".
15697         (Output_data::print_to_mapfile): New function.
15698         (Output_data::do_print_to_mapfile): New virtual function.
15699         (Output_segment_headers::do_print_to_mapfile): New function.
15700         (Output_file_header::do_print_to_mapfile): New function.
15701         (Output_data_const::do_print_to_mapfile): New function.
15702         (class Output_data_const_buffer): Add map_name_ field.  Update
15703         constructor.  Change all callers.  Add do_print_to_mapfile
15704         function.
15705         (class Output_data_fixed_space): Likewise.
15706         (class Output_data_space): Likewise.
15707         (class Output_data_zero_fill): New class.
15708         (Output_data_strtab::do_print_to_mapfile): New function.
15709         (Output_data_reloc_base::do_print_to_mapfile): New function.
15710         (Output_relocatable_relocs::do_print_to_mapfile): New function.
15711         (Output_data_group::do_print_to_mapfile): New function.
15712         (Output_data_got::do_print_to_mapfile): New function.
15713         (Output_data_dynamic::do_print_to_mapfile): New function.
15714         (Output_symtab_xindex::do_print_to_mapfile): New function.
15715         (class Output_section): Declare do_print_to_mapflie.  Declare
15716         print_to_mapfile in Input_section.
15717         (class Output_segment): Declare new functions.
15718         * object.h (Sized_relobj::symbol_count): New function.
15719         * script-sections.cc
15720         (Output_section_element_dot_assignment::set_section_addresses):
15721         Change Output_data_fixed_space to Output_data_zero_fill.
15722         (Output_data_expression::do_print_to_mapfile): New function.
15723         * script.cc (read_input_script): Add mapfile parameter.  Change
15724         all callers.
15725         * script.h (read_input_script): Update declaration.
15726         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
15727         (Eh_frame::do_print_to_mapfile): New function.
15728         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
15729         (Output_merge_string::do_print_to_mapfile): New function.
15730         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
15731         function.
15732         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
15733         function.
15734         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
15735         function.
15736         * Makefile.am (CCFILES): Add mapfile.cc.
15737         (HFILES): Add mapfile.h.
15738         * Makefile.in: Rebuild.
15739
15740 2008-05-19  Ian Lance Taylor  <iant@google.com>
15741
15742         * options.h (class General_options): Add -z relro.
15743         * layout.cc (Layout::Layout): Initialize relro_segment_.
15744         (Layout::add_output_section_data): Return the output section.
15745         (Layout::make_output_section): Rcognize relro sections and mark
15746         them appropriately.
15747         (Layout::attach_allocated_section_to_segment): Put relro sections
15748         in a PT_GNU_RELRO segment.
15749         (Layout::create_initial_dynamic_sections): Mark the .dynamic
15750         section as relro.
15751         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
15752         PT_TLS segments.
15753         (Layout::linkonce_mapping): Map d.rel.ro.local to
15754         .data.rel.ro.local.
15755         (Layout::output_section_name): Us .data.rel.ro.local for any
15756         section which begins with that.
15757         * layout.h (class Layout): Update add_output_section_data
15758         declaration.  Add relro_segment_ field.
15759         * output.cc (Output_section::Output_section): Initialize is_relro_
15760         and is_relro_local_ fields.
15761         (Output_segment::add_output_section): Group relro sections.
15762         (Output_segment::is_first_section_relro): New function.
15763         (Output_segment::maximum_alignment): If there is a relro section,
15764         align the segment to the common page size.
15765         (Output_segment::set_section_addresses): Track whether we are
15766         looking at relro sections.  If the last section is a relro
15767         section, align to the common page size.
15768         (Output_segment::set_section_list_addresses): Add in_relro
15769         parameter.  Change all callers.  Align to the page size when
15770         moving from relro to non-relro section.
15771         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
15772         segment.
15773         * output.h (class Output_section): Add is_relro_ and
15774         is_relro_local_ fields.
15775         (Output_section::is_relro): New function.
15776         (Output_section::set_is_relro): New function.
15777         (Output_section::is_relro_local): New function.
15778         (Output_section::set_is_relro_local): New function.
15779         (class Output_segment): Update declarations.
15780         * i386.cc (Target_i386::got_section): Mark .got section as relro.
15781         * sparc.cc (Target_sparc::got_section): Likewise.
15782         * x86_64.cc (Target_x86_64::got_section): Likewise.
15783         * testsuite/relro_test_main.cc: New file.
15784         * testsuite/relro_test.cc: New file.
15785         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
15786         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
15787         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
15788         (relro_test.so, relro_test_pic.o): New targets.
15789         * testsuite/Makefile.in: Rebuild.
15790
15791 2008-05-16  Ian Lance Taylor  <iant@google.com>
15792
15793         * output.cc (Output_segment::add_output_section): Remove front
15794         parameter.
15795         * output.h (class Output_segment): Remove
15796         add_initial_output_section and overloaded add_output_section.
15797         Update declaration of remaining add_output_section.
15798         * layout.cc (Layout::create_interp): Call add_output_section
15799         rather than add_initial_output_section.
15800         (Layout::finish_dynamic_section): Likewise.
15801
15802         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
15803         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
15804         know the dynamic type.
15805         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
15806         field.  Initialize it in constructor.
15807         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
15808         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
15809         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
15810         reloc.
15811
15812         * output.cc (Output_reloc::get_address): Change return type to
15813         Elf_Addr.
15814         * output.h (class Output_reloc): Update get_address declaration.
15815         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
15816         for section addresses.
15817
15818 2008-05-09  Ian Lance Taylor  <iant@google.com>
15819
15820         PR 6493
15821         * gold.cc (gold_nomem): Use return value of write.
15822
15823 2008-05-08  Ian Lance Taylor  <iant@google.com>
15824
15825         * symtab.c (Symbol::init_base_output_data): Add version
15826         parameter.  Change all callers.
15827         (Symbol::init_base_output_segment): Likewise.
15828         (Symbol::init_base_constant): Likewise.
15829         (Symbol::init_base_undefined): Likewise.
15830         (Sized_symbol::init_output_data): Likewise.
15831         (Sized_symbol::init_output_segment): Likewise.
15832         (Sized_symbol::init_constant): Likewise.
15833         (Sized_symbol::init_undefined): Likewise.
15834         (Symbol_table::do_define_in_output_data): If the new symbol has a
15835         version, mark it as the default.
15836         (Symbol_table::do_define_in_output_segment): Likewise.
15837         (Symbol_table::do_define_as_constant): Likewise.
15838         * symtab.h (class Symbol): Update declarations.
15839         (class Sized_symbol): Likewise.
15840         * resolve.cc (Symbol::override_version): New function.
15841         (Symbol::override_base): Call override_version.
15842         (Symbol::override_base_with_special): Likewise.
15843         * testsuite/ver_script_8.script: New file.
15844         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
15845         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
15846         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
15847         (ver_test_8_1.so, ver_test_8_2.so): New targets.
15848
15849 2008-05-06  Ian Lance Taylor  <iant@google.com>
15850
15851         PR 6049
15852         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
15853         functions.
15854         (class General_options): Remove existing --undefined, and add
15855         --no-undefined instead.  Add new --undefined as synonym for -u.
15856         * archive.cc (Archive::add_symbols): Check whether symbol was
15857         named with -u.
15858         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
15859         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
15860         all uses.  Add IS_UNDEFINED.  Update declarations to split
15861         different versions of init_base.  Declare init_base_undefined.
15862         (Symbol::is_defined): Handle IS_UNDEFINED.
15863         (Symbol::is_undefined): Likewise.
15864         (Symbol::is_weak_undefined): Call is_undefined.
15865         (Symbol::is_absolute): Handle IS_CONSTANT.
15866         (class Sized_symbol): Update declarations to split different
15867         versions of init.  Declare init_undefined.
15868         (class Symbol_table): Declare new functions.
15869         * symtab.cc (Symbol::init_base_object): Rename from init_base.
15870         Change all callers.
15871         (Symbol::init_base_output_data): Likewise.
15872         (Symbol::init_base_output_segment): Likewise.
15873         (Symbol::init_base_constant): Likewise.
15874         (Symbol::init_base_undefined): New function.
15875         (Sized_symbol::init_object): Rename from init.  Change all
15876         callers.
15877         (Sized_symbol::init_output_data): Likewise.
15878         (Sized_symbol::init_output_segment): Likewise.
15879         (Sized_symbol::init_constant): Likewise.
15880         (Sized_symbol::init_undefined): New function.
15881         (Symbol_table::add_undefined_symbols_from_command_line): New
15882         function.
15883         (Symbol_table::do_add_undefined_symbols_from_command_line): New
15884         function.
15885         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
15886         (Symbol::output_section): Likewise.
15887         (Symbol::set_output_section): Likewise.
15888         (Symbol_table::sized_finalize_symbol): Likewise.
15889         (Symbol_table::sized_write_globals): Likewise.
15890         * resolve.cc (Symbol_table::should_override): Likewise.
15891         (Symbol::override_base_with_special): Likewise.
15892
15893         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
15894         symbol, change it to have default visibility.
15895         * testsuite/protected_1.cc: New file.
15896         * testsuite/protected_2.cc: New file.
15897         * testsuite/protected_3.cc: New file.
15898         * testsuite/protected_main_1.cc: New file.
15899         * testsuite/protected_main_2.cc: New file.
15900         * testsuite/protected_main_3.cc: New file.
15901         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
15902         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
15903         (protected_1_LDFLAGS, protected_1_LDADD): Define.
15904         (protected_1.so): New target.
15905         (protected_1_pic.o, protected_2_pic.o): New targets.
15906         (protected_3_pic.o): New target.
15907         (check_PROGRAMS): Add protected_2.
15908         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
15909         (protected_2_LDFLAGS, protected_2_LDADD): Define.
15910         * testsuite/Makefile.in: Rebuild.
15911
15912         * options.h (DEFINE_var): Add set_user_set_##varname__.
15913         (DEFINE_bool_alias): New macro.
15914         (class General_options): Define -Bstatic using DEFINE_bool_alias
15915         rather than DEFINE_special.  Add --undefined as an alias for -z
15916         defs.
15917         * options.cc (General_options::parse_Bstatic): Remove.
15918
15919         * options.h (class General_options): Add --fatal-warnings.
15920         * main.cc (main): Implement --fatal-warnings.
15921         * errors.h (Errors::warning_count): New function.
15922
15923         * options.h (class General_options): Add -Bsymbolic-functions.
15924         * symtab.h (Symbol::is_preemptible): Check for
15925         -Bsymbolic-functions.
15926
15927 2008-05-05  Ian Lance Taylor  <iant@google.com>
15928
15929         * options.h (DEFINE_bool): For DASH_Z, create the negative option
15930         as noVARNAME rather than no-VARNAME.
15931         (class General_options): Add option -z combreloc.
15932         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15933         get_address.
15934         (Output_reloc::sort_before) [SHT_REL]: New function.
15935         (Output_reloc::sort_before) [SHT_RELA]: New function.
15936         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
15937         Sort_relocs_comparison.
15938         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15939         parameter.  Change all callers.
15940         (Output_data_reloc::Output_data_reloc) [both versions]: Add
15941         sort_relocs parameter.  Change all callers.
15942         * output.cc (Output_reloc::get_address): New function, broken out
15943         of write_rel.
15944         (Output_reloc::write_rel): Call it.
15945         (Output_reloc::compare): New function.
15946         (Output_data_reloc_base::do_write): Optionally sort relocs.
15947
15948         * configure.ac: If targ_extra_obj is set, link it in.
15949         * configure.tgt: Initialize all variables.
15950         (x86_64*): Set targ_extra_obj and targ_extra_size.
15951         * configure: Rebuild.
15952
15953         * object.cc (Sized_relobj::include_section_group): Adjust section
15954         indexes read from group data.  Build vector to pass to
15955         layout_group.
15956         * layout.cc (Layout::layout_group): Add flags and shndxes
15957         parameters.  Remove contents parameter.  Change caller.  Update
15958         explicit instantiations.
15959         * layout.h (class Layout): Update layout_group declaration.
15960         * output.cc (Output_data_group::Output_data_group): Add flags and
15961         input_shndxes parameters.  Remove contents parameter.  Change
15962         caller.
15963         (Output_data_group::do_write): Change input_sections_ to
15964         input_shndxes_.
15965         * output.h (class Output_data_group): Update constructor
15966         declaration.  Rename input_sections_ to input_shndxes_.
15967         * testsuite/many_sections_test.cc: Add template.
15968
15969 2008-04-30  Cary Coutant  <ccoutant@google.com>
15970
15971         * target-reloc.h (relocate_section): Fix dead-pointer bug.
15972
15973         * layout.cc (Layout::include_section): Refactored check for debug
15974         info section.
15975         (Layout::add_comdat): Add new parameters.  Change type
15976         of signature parameter.  Add object and shndx to signatures table.
15977         (Layout::find_kept_object): New function.
15978         * layout.h: Include <cstring>.
15979         (Layout::is_debug_info_section): New function.
15980         (Layout::add_comdat): Add new parameters.
15981         (Layout::find_kept_object): New function.
15982         (Layout::Kept_section): New struct.
15983         (Layout::Signatures): Change type of map range.
15984         * object.cc (Relobj::output_section_address): New function.
15985         (Sized_relobj::include_section_group): Add new parameters.  Change
15986         calls to Layout::add_comdat.  Change to build table of kept comdat
15987         groups and table mapping discarded sections to kept sections.
15988         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
15989         (Sized_relobj::do_layout): Change calls to include_section_group and
15990         include_linkonce_section.
15991         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15992         value to zero when section is discarded.
15993         (Sized_relobj::map_to_kept_section): New function.
15994         * object.h (Relobj::output_section_address): New function.
15995         (Relobj::Comdat_group): New type.
15996         (Relobj::find_comdat_group): New function.
15997         (Relobj::Comdat_group_table): New type.
15998         (Relobj::Kept_comdat_section): New type.
15999         (Relobj::Kept_comdat_section_table): New type.
16000         (Relobj::add_comdat_group): New function.
16001         (Relobj::set_kept_comdat_section): New function.
16002         (Relobj::get_kept_comdat_section): New function.
16003         (Relobj::comdat_groups_): New field.
16004         (Relobj::kept_comdat_sections_): New field.
16005         (Symbol_value::input_value): Update comment.
16006         (Sized_relobj::map_to_kept_section) New function.
16007         (Sized_relobj::include_linkonce_section): Add new parameter.
16008         * target-reloc.h (Comdat_behavior): New type.
16009         (get_comdat_behavior): New function.
16010         (relocate_section): Add code to map a discarded section to the
16011         corresponding kept section when applying a relocation.
16012
16013 2008-04-30  Craig Silverstein  <csilvers@google.com>
16014
16015         * dwarf_reader.cc (next_generation_count): New static var.
16016         (Addr2line_cache_entry): New struct.
16017         (addr2line_cache): New static var.
16018         (Dwarf_line_info::one_addr2line): Added caching.
16019         (Dwarf_line_info::clear_addr2line_cache): New function.
16020         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
16021         cache-size parameter.
16022         (Dwarf_line_info::one_addr2line_cache): New function.
16023         * symtab.cc (Symbol_table::detect_odr_violations): Pass
16024         new cache-size argument to one_addr2line(), and clear cache.
16025
16026 2008-04-28  Cary Coutant  <ccoutant@google.com>
16027
16028         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
16029         R_386_PC8 relocations.
16030
16031 2008-04-23  Ian Lance Taylor  <iant@google.com>
16032
16033         * object.cc (Sized_relobj::include_section_group): Check for
16034         invalid section group.
16035
16036         * object.cc (make_elf_object): Correct test for 64-bit ELF file
16037         header size.
16038
16039         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
16040         than read for file header.
16041         * archive.cc (Archive::include_member): Likewise.
16042
16043 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
16044
16045         * aclocal.m4: Regenerate.
16046         * configure: Regenerate.
16047
16048 2008-04-19  Ian Lance Taylor  <iant@google.com>
16049
16050         * version.cc (version_string): Bump to 1.6.
16051
16052         * testsuite/Makefile.am (many_sections_r_test): New target.
16053         (many_sections_r_test_SOURCES): Remove.
16054         (many_sections_r_test_DEPENDENCIES): Remove.
16055         (many_sections_r_test_LDFLAGS): Remove.
16056         (many_sections_r_test_LDADD): Remove.
16057
16058         * object.cc (Sized_relobj::do_add_symbols): Always pass
16059         local_symbol_count_ to add_from_relobj.
16060
16061         * testsuite/Makefile.am (many_sections_check.h): Only check one in
16062         every thousand variables.
16063         * testsuite/Makefile.in: Rebuild.
16064
16065         * object.cc (Xindex::initialize_symtab_xindex): New function.
16066         (Xindex::read_symtab_xindex): New function.
16067         (Xindex::sym_xindex_to_shndx): New function.
16068         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
16069         available.
16070         (Sized_relobj::do_initialize_xindex): New function.
16071         (Sized_relobj::do_read_symbols): Adjust section links.
16072         (Sized_relobj::symbol_section_and_value): Add is_ordinary
16073         parameter.  Change all callers.
16074         (Sized_relobj::include_section_group): Adjust section links and
16075         symbol section indexes.
16076         (Sized_relobj::do_layout): Adjust section links.
16077         (Sized_relobj::do_count_local_symbols): Adjust section links and
16078         symbol section indexes.
16079         (Sized_relobj::do_finalize_local_symbols): Distinguish between
16080         ordinary and special symbols.
16081         (Sized_relobj::write_local_symbols): Add symtab_xindex and
16082         dynsym_xindex parameters.  Change all callers.  Adjust section
16083         links.  Use SHN_XINDEX when needed.
16084         (Sized_relobj::get_symbol_location_info): Adjust section links.
16085         Don't get fooled by special symbols.
16086         * object.h (class Xindex): Define.
16087         (class Object): Add xindex_ parameter.  Declare virtual functoin
16088         do_initialize_xindex.
16089         (Object::adjust_sym_shndx): New function.
16090         (Object::set_xindex): New protected function.
16091         (class Symbol_value): Add is_ordinary_shndx_ field.
16092         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
16093         (Symbol_value::value): Assert ordinary section.
16094         (Symbol_value::initialize_input_to_output_map): Likewise.
16095         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
16096         Change all callers.
16097         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
16098         all callers.
16099         (class Sized_relobj): Update declarations.
16100         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
16101         parameter.  Change all callers.
16102         (Sized_relobj::adjust_shndx): New function.
16103         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
16104         field.
16105         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
16106         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
16107         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
16108         (Sized_dynobj::read_dynsym_section): Adjust section links.
16109         (Sized_dynobj::read_dynamic): Likewise.
16110         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
16111         section links.
16112         (Sized_dynobj::do_initialize_xindex): New function.
16113         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
16114         do_initialize_xindex.
16115         (Sized_dynobj::adjust_shndx): New function.
16116         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
16117         dynsym_xindex_ fields.
16118         (Layout::finalize): Add a call to set_section_indexes before
16119         creating the symtab sections.
16120         (Layout::set_section_indexes): Don't do anything if the section
16121         already has a section index.
16122         (Layout::create_symtab_sections): Add shnum parameter.  Change
16123         caller.  Create .symtab_shndx section if needed.
16124         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
16125         caller.
16126         (Layout::allocated_output_section_count): New function.
16127         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
16128         needed.
16129         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
16130         fields.  Update declarations.
16131         (Layout::symtab_xindex): New function.
16132         (Layout::dynsym_xindex): New function.
16133         (class Write_symbols_task): Add layout_ field.
16134         (Write_symbols_task::Write_symbols_task): Add layout parameter.
16135         Change caller.
16136         * output.cc (Output_section_headers::Output_section_headers): Add
16137         shstrtab_section parameter.  Change all callers.
16138         (Output_section_headers::do_sized_write): Store overflow values
16139         for section count and section string table section index in
16140         section header zero.
16141         (Output_file_header::do_sized_write): Check for overflow of
16142         section count and section string table section index.
16143         (Output_symtab_xindex::do_write): New function.
16144         (Output_symtab_xindex::endian_do_write): New function.
16145         * output.h (class Output_section_headers): Add shstrtab_section_.
16146         Update declarations.
16147         (class Output_symtab_xindex): Define.
16148         (Output_section::has_out_shndx): New function.
16149         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
16150         field.
16151         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
16152         Change all callers.
16153         (Sized_symbol::init): Likewise.
16154         (Symbol::output_section): Check for ordinary symbol.
16155         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
16156         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
16157         callers.
16158         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
16159         Change all callers.  Simplify handling of symbols from sections
16160         not included in the link.
16161         (Symbol_table::add_from_dynobj): Handle ordinary symbol
16162         distinction.
16163         (Weak_alias_sorter::operator()): Assert that symbols are
16164         ordinary.
16165         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
16166         distinction.
16167         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
16168         parameters.  Change all callers.
16169         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
16170         symbol distinction.  Use SHN_XINDEX when needed.
16171         (Symbol_table::write_section_symbol): Add symtab_xindex
16172         parameter.  Change all callers.
16173         (Symbol_table::sized_write_section_symbol): Likewise.  Use
16174         SHN_XINDEX when needed.
16175         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
16176         declarations.
16177         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
16178         (Symbol::is_defined): Check is_ordinary.
16179         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
16180         (Symbol::is_absolute, Symbol::is_common): Likewise.
16181         (class Sized_symbol): Update declarations.
16182         (class Symbol_table): Update declarations.
16183         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
16184         parameters.  Change all callers.
16185         (Sized_symbol::override): Likewise.
16186         (Symbol_table::override): Likewise.
16187         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
16188         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
16189         is_ordinary, and orig_st_shndx parameters.  Change all callers.
16190         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
16191         to be in an ordinary section.
16192         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
16193         object and is_ordinary parameters.  Change all callers.
16194         (Sized_dwarf_line_info::read_relocs): Add object parameter.
16195         Change all callers.  Don't add undefined or non-ordinary symbols
16196         to reloc_map_.
16197         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
16198         Change all callers.
16199         * dwarf_reader.h (class Sized_dwarf_line_info): Update
16200         declarations.
16201         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
16202         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
16203         (Sized_relobj::relocate_sections): Likewise.
16204         * target-reloc.h (scan_relocs): Adjust section symbol index.
16205         (scan_relocatable_relocs): Likewise.
16206         * i386.cc (Scan::local): Check for ordinary symbols.
16207         * sparc.cc (Scan::local): Likewise.
16208         * x86_64.cc (Scan::local): Likewise.
16209         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
16210         to symbol_section_and_value.
16211         * testsuite/many_sections_test.cc: New file.
16212         * testsuite/Makefile.am (BUILT_SOURCES): Define.
16213         (check_PROGRAMS): Add many_sections_test.
16214         (many_sections_test_SOURCES): Define.
16215         (many_sections_test_DEPENDENCIES): Define.
16216         (many_sections_test_LDFLAGS): Define.
16217         (BUILT_SOURCES): Add many_sections_define.h.
16218         (many_sections_define.h): New target.
16219         (BUILT_SOURCES): Add many_sections_check.h.
16220         (many_sections_check.h): New target.
16221         (check_PROGRAMS): Add many_sections_r_test.
16222         (many_sections_r_test_SOURCES): Define.
16223         (many_sections_r_test_DEPENDENCIES): Define.
16224         (many_sections_r_test_LDFLAGS): Define.
16225         (many_sections_r_test_LDADD): Define.
16226         (many_sections_r_test.o): New target.
16227         * testsuite/Makefile.in: Rebuild.
16228
16229 2008-04-17  Cary Coutant  <ccoutant@google.com>
16230
16231         * errors.cc (Errors::info): New function.
16232         (gold_info): New function.
16233         * errors.h (Errors::info): New function.
16234         * gold.h (gold_info): New function.
16235         * object.cc (Input_objects::add_object): Print trace output.
16236         * options.cc (options::parse_set): New function.
16237         (General_options::parse_wrap): Deleted.
16238         (General_options::General_options): Deleted initializer.
16239         * options.h (options::String_set): New typedef.
16240         (options::parse_set): New function.
16241         (DEFINE_set): New macro.
16242         (General_options::wrap): Changed to use DEFINE_set. Changed
16243         callers of any_wrap_symbols and is_wrap_symbol.
16244         (General_options::trace, General_options::trace_symbol):
16245         New options.
16246         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
16247         (General_options::wrap_symbols_): Deleted.
16248         * symtab.cc (Symbol_table::add_from_object): Print trace output.
16249
16250 2008-04-17  David S. Miller  <davem@davemloft.net>
16251
16252         * options.cc (General_options::parse_V): New function.
16253         * options.h: Add entries for -V and -Qy.
16254
16255 2008-04-17  Ian Lance Taylor  <iant@google.com>
16256
16257         * common.cc (Symbol_table::allocate_commons): Remove options
16258         parameter.  Change caller.
16259         (Symbol_table::do_allocate_commons): Remove options parameter.
16260         Change caller.  Just call do_allocate_commons_list twice.
16261         (Symbol_table::do_allocate_commons_list): New function, broken out
16262         of do_allocate_commons.
16263         * common.h (class Allocate_commons_task): Remove options_ field.
16264         Update constructor.
16265         * symtab.cc (Symbol_table::Symbol_table): Initialize
16266         tls_commons_.
16267         (Symbol_table::add_from_object): Put TLS common symbols on
16268         tls_commons_ list.
16269         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
16270         which are IN_OUTPUT_DATA.
16271         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
16272         allocate_commons and do_allocate_commons declarations.  Declare
16273         do_allocate_commons_list.
16274         * gold.cc (queue_middle_tasks): Update creation of
16275         Allocate_commons_task to not pass options.
16276         * testsuite/Makefile.am (INCLUDES): Add -I.. .
16277         (TLS_TEST_C_FLAGS): New variable.
16278         (tls_test_c_pic.o): New target.
16279         (tls_test_shared.so): Link in tls_test_c_pic.o.
16280         (tls_test_c_pic_ie.o): New target.
16281         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
16282         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
16283         (tls_test_c.o): New target.
16284         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
16285         (tls_pic_test_LDADD): Likewise.
16286         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
16287         (tls_shared_gd_to_ie_test_LDADD): Likewise.
16288         (tls_test_c_gnu2.o): New target.
16289         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
16290         tls_test_c_gnu2.o.
16291         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
16292         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
16293         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
16294         * testsuite/tls_test.cc: Include "config.h".
16295         (t_last): Call t11_last.
16296         * testsuite/tls_test.h (t11, t11_last): Declare.
16297         * testsuite/tls_test_c.c: New file.
16298         * testsuite/tls_test_main.cc (thread_routine): Call t11.
16299         * configure.ac: Check for OpenMP support.
16300         * configure, config.in, Makefile.in: Rebuild.
16301         * testsuite/Makefile.in: Rebuild.
16302
16303 2008-04-16  Cary Coutant  <ccoutant@google.com>
16304
16305         * i386.cc (Target_i386::define_tls_base_symbol): New function.
16306         (Target_i386::tls_base_symbol_defined_): New field.
16307         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16308         (Target_i386::Scan::global): Likewise.
16309         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
16310         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
16311         (Target_x86_64::tls_base_symbol_defined_): New field.
16312         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16313         (Target_x86_64::Scan::global): Likewise.
16314
16315 2008-04-16  Cary Coutant  <ccoutant@google.com>
16316
16317         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
16318         (Symbol::needs_plt_entry): Allow weak undefined symbols.
16319         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
16320         building shared libraries.
16321         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
16322         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
16323         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
16324         * testsuite/Makefile.in: Rebuild.
16325         * testsuite/weak_undef.h: New file.
16326         * testsuite/weak_undef_file1.cc: Add extra test cases.
16327         * testsuite/weak_undef_file2.cc: Likewise.
16328         * testsuite/weak_undef_test.cc: Likewise.
16329
16330 2008-04-16  David S. Miller  <davem@davemloft.net>
16331
16332         * sparc.cc (Target_sparc::Scan): Change from struct to class.
16333         Add issued_non_pic_error_ field.  Declare check_non_pic.
16334         (Target_sparc::Scan::check_non_pic): New function.
16335         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
16336         (Target_sparc::Scan::global): Likewise.
16337
16338         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
16339         * configure: Rebuild.
16340
16341         * options.h (DEFINE_enable): New macro.
16342         (new_dtags): New enable option.
16343         (initfirst, interpose, loadfltr, nodefaultlib,
16344         nodelete, nodlopen, nodump): New -z options.
16345         * layout.cc (Layout:finish_dynamic_section): If new
16346         dtags enabled, emit DT_RUNPATH.  Also, emit a
16347         DT_FLAGS_1 containing any specified -z flags.
16348
16349 2008-04-16  Ian Lance Taylor  <iant@google.com>
16350
16351         * copy-relocs.cc: New file.
16352         * copy-relocs.h: New file.
16353         * reloc.cc: Remove Copy_relocs code.
16354         * reloc.h: Likewise.
16355         * reloc-types.h (struct Reloc_types) [both versions]: Add
16356         get_reloc_addend_noerror.
16357         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
16358         variants of add_global which take an addend which must be zero.
16359         * i386.cc: Include "copy-relocs.h".
16360         (class Target_i386): Change type of copy_relocs_ to variable,
16361         update initializer.
16362         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
16363         Change all callers.
16364         (Target_i386::do_finalize_sections): Change handling of
16365         copy_relocs_.
16366         * sparc.cc: Include "copy-relocs.h".
16367         (class Target_sparc): Change type of copy_relocs_ to variable,
16368         update initializer.
16369         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
16370         Change all callers.
16371         (Target_sparc::do_finalize_sections): Change handling of
16372         copy_relocs_.
16373         * x86_64.cc: Include "copy-relocs.h".
16374         (class Target_x86_64): Change type of copy_relocs_ to variable,
16375         update initializer.
16376         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
16377         class.  Change all callers.
16378         (Target_x86_64::do_finalize_sections): Change handling of
16379         copy_relocs_.
16380         * Makefile.am (CCFILES): Add copy-relocs.cc.
16381         (HFILES): Add copy-relocs.h.
16382
16383         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
16384
16385         * testsuite/script_test_4.sh: Permit leading zeroes.
16386
16387 2008-04-15  Ian Lance Taylor  <iant@google.com>
16388
16389         * script-sections.cc (Script_sections::create_segments): Use
16390         header_size_adjustment even when there is enough room for the
16391         headers.
16392         * testsuite/script_test_4.sh: New file.
16393         * testsuite/script_test_4.t: New file.
16394         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
16395         (check_DATA): Add script_test_4.stdout.
16396         (MOSTLYCLEANFILES): Likewise.
16397         (script_test_4): New target.
16398         (script_test_4.stdout): New target.
16399         * testsuite/Makefile.in: Rebuild.
16400
16401         * sparc.cc: Add definitions for Output_data_plt_sparc class
16402         constants.
16403
16404 2008-04-14  David S. Miller  <davem@davemloft.net>
16405
16406         * sparc.cc: New file.
16407         * Makefile.am (TARGETSOURCES): Add sparc.cc
16408         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
16409         * configure.tgt: Document targ_extra_size and
16410         targ_extra_big_endian.  Add entries for sparc-* and
16411         sparc64-*.
16412         * configure.ac: Handle targ_extra_size and
16413         targ_extra_big_endian.
16414         * Makefile.in: Rebuild.
16415         * configure: Likewise.
16416         * po/POTFILES.in: Likewise.
16417         * po/gold.pot: Likewise.
16418
16419 2008-04-14  Ian Lance Taylor  <iant@google.com>
16420
16421         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
16422         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
16423         in the name/type/flags to section mapping.  Don't call
16424         allocate_output_section.
16425         (Layout::choose_output_section): Change parameter from adjust_name
16426         to is_input_section.  Don't permit input sections after sections
16427         are attached to segments.  Don't call allocate_output_section.
16428         (Layout::layout_eh_frame): Call update_flags_for_input_section,
16429         not write_enable_output_section.
16430         (Layout::make_output_section): Don't push to
16431         unattached_section_list_ nor call attach_to_segment.  Call
16432         attach_section_to_segment if sections are attached.
16433         (Layout::attach_sections_to_segments): New function.
16434         (Layout::attach_section_to_segment): New function.
16435         (Layout::attach_allocated_section_to_segment): Rename from
16436         attach_to_segment.  Remove flags parameter.
16437         (Layout::allocate_output_section): Remove function.
16438         (Layout::write_enable_output_section): Remove function.
16439         * layout.h (class Layout): Update for above changes.  Add new
16440         field sections_are_attached_.
16441         * output.h (Output_section::update_flags_for_input_section): New
16442         function.
16443         * output.cc (Output_section::add_input_section): Call
16444         update_flags_for_input_section.
16445         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
16446
16447 2008-04-11  Cary Coutant  <ccoutant@google.com>
16448
16449         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
16450         thought unnecessary.
16451         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
16452
16453 2008-04-11  Ian Lance Taylor  <iant@google.com>
16454
16455         * output.h (class Output_section_data): Remove inline definition
16456         of set_addralign.
16457         * output.cc (Output_section_data::set_addralign): New function.
16458
16459 2008-04-11  Cary Coutant  <ccoutant@google.com>
16460
16461         Add support for TLS descriptors for i386 and x86_64.
16462         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
16463         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
16464         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
16465         GOT_TYPE_TLS_DESC.
16466         (Target_i386::got_mod_index_entry): Remove unnecessary code.
16467         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
16468         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
16469         relocations.
16470         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
16471         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
16472         Fix problem with initial-exec relocations.
16473         (Target_i386::Relocate::relocate_tls): Likewise.
16474         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
16475         relaxation.
16476         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
16477         support for section-plus-offset dynamic table entries.
16478         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
16479         (Output_data_dynamic::Dynamic_entry): Add support for
16480         section-plus-offset dynamic table entries.
16481         (Output_data_dynamic::Classification): Likewise.
16482         (Output_data_dynamic::classification_): Renamed offset_.
16483         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
16484         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
16485         (Target_x86_64::make_plt_section): New function.
16486         (Target_x86_64::reserve_tlsdesc_entries): New function.
16487         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
16488         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
16489         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
16490         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
16491         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
16492         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
16493         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
16494         add extra PLT entry for TLS descriptors.
16495         (Output_data_plt_x86_64::got_): New field.
16496         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
16497         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
16498         fields.
16499         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
16500         descriptors.
16501         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
16502         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
16503         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
16504         R_386_TLS_DESC_CALL relocations.
16505         (Target_x86_64::Scan::global): Likewise.
16506         (Target_x86_64::do_finalize_sections): Add dynamic table entries
16507         for TLS descriptors.
16508         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
16509         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
16510         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
16511         GD-to-IE relaxation.
16512         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
16513         and TLS_DESCRIPTORS.
16514         * Makefile.in: Rebuild.
16515         * configure: Rebuild.
16516         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
16517         (tls_test_shared2.so): New target.
16518         (tls_shared_gd_to_ie_test_SOURCES): New variable.
16519         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
16520         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
16521         (tls_shared_gd_to_ie_test_LDADD): New variable.
16522         (tls_shared_gnu2_gd_to_ie_test): New target.
16523         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
16524         New targets.
16525         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
16526         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
16527         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
16528         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
16529         (tls_shared_gnu2_test): New target.
16530         (tls_test_gnu2_shared.so): New target.
16531         (tls_shared_gnu2_test_SOURCES): New variable.
16532         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
16533         (tls_shared_gnu2_test_LDFLAGS): New variable.
16534         (tls_shared_gnu2_test_LDADD): New variable.
16535         * testsuite/Makefile.in: Rebuild.
16536         * testsuite/Makefile.
16537
16538 2008-04-11  Ian Lance Taylor  <iant@google.com>
16539
16540         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
16541         justsyms.t.
16542         * testsuite/Makefile.in: Rebuild.
16543
16544         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
16545         long.
16546         * testsuite/script_test_2.cc (main): Adjust test.
16547
16548 2008-04-11  David S. Miller  <davem@davemloft.net>
16549             Ian Lance Taylor  <iant@google.com>
16550
16551         * options.h (General_options): Add entries for '-Y' and
16552         '-relax'.
16553         * options.cc (General_options:finalize): If -Y was used, add those
16554         entries to the library path instead of the default "/lib" and
16555         "/usr/lib".
16556
16557 2008-04-11  David S. Miller  <davem@davemloft.net>
16558
16559         * testsuite/justsyms.t: Start at 0x100.
16560         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
16561         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
16562         long.
16563         * testsuite/script_test_2.cc: Adjust string and section length
16564         checks.
16565
16566 2008-04-09  Ian Lance Taylor  <iant@google.com>
16567
16568         PR gold/5996
16569         * script-sections.cc (Sections_element::allocate_to_segment): Add
16570         orphan parameter.
16571         (Output_section_definition::allocate_to_segment): Likewise.
16572         (Orphan_output_section::allocate_to_segment): Likewise.
16573         (Script_sections::attach_sections_using_phdrs_clause): Don't
16574         propagate non-PT_LOAD segments to orphan sections.
16575         * testsuite/Makefile.am (script_test_3.stdout): Generate using
16576         readelf rather than objdump.
16577         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
16578         .interp section and PT_INTERP segment are the same size.
16579         * testsuite/Makefile.in: Rebuild.
16580
16581         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
16582         aliases for symbols defined in the same object.
16583         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
16584         (weak_alias_test_SOURCES): New variable.
16585         (weak_alias_test_DEPENDENCIES): New variable.
16586         (weak_alias_test_LDFLAGS): New variable.
16587         (weak_alias_test_LDADD): New variable.
16588         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
16589         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
16590         (weak_alias_test_3.o): New target.
16591         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
16592         * testsuite/weak_alias_test_main.cc: New file.
16593         * testsuite/weak_alias_test_1.cc: New file.
16594         * testsuite/weak_alias_test_2.cc: New file.
16595         * testsuite/weak_alias_test_3.cc: New file.
16596
16597 2008-04-08  Ian Lance Taylor  <iant@google.com>
16598
16599         * options.h (class General_options): Add --noinhibit-exec option.
16600         * main.cc (main): Check --noinhibit-exec.
16601
16602         * options.h (class General_options): Define --wrap as a special
16603         option.  Add wrap_symbols_ field.
16604         (General_options::any_wrap_symbols): New function.
16605         (General_options::is_wrap_symbol): New function.
16606         * options.cc (General_options::parse_wrap): New function.
16607         (General_options::General_options): Initialize wrap_symbols_.
16608         * symtab.cc (Symbol_table::wrap_symbol): New function.
16609         (Symbol_table::add_from_object): Handle --wrap.
16610         * symtab.h (class Symbol_table): Declare wrap_symbol.
16611         * target.h (Target::wrap_char): New function.
16612         (Target::Target_info): Add wrap_char field.
16613         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
16614         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
16615         * testsuite/testfile.cc (Target_test::test_target_info):
16616         Likewise.
16617
16618         * errors.cc (Errors::undefined_symbol): Mention symbol version if
16619         there is one.
16620
16621         * layout.h (class Layout): Add added_eh_frame_data_ field.
16622         * layout.cc (Layout::Layout): Initialize new field.
16623         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
16624         output section until we find a section we merged successfully.
16625         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
16626         that the size be non-zero.
16627
16628         * merge.cc (Object_merge_map::get_output_offset): Remove inline
16629         qualifier.
16630
16631 2008-04-08  Craig Silverstein  <csilvers@google.com>
16632
16633         * configure.ac: Export new conditional variable HAVE_ZLIB.
16634         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
16635         on HAVE_ZLIB.
16636         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
16637         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16638
16639 2008-04-07  Ian Lance Taylor  <iant@google.com>
16640
16641         * version.cc (version_string): Set to "1.5".
16642
16643         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
16644         Add issued_non_pic_error_ field.  Declare check_non_pic.
16645         (Target_x86_64::Scan::check_non_pic): New function.
16646         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
16647         (Target_x86_64::Scan::global): Likewise.
16648
16649         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
16650         addend parameter.  Change caller.  Handle merge sections.
16651         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
16652         Address to Addend.  Don't add in the result of
16653         local_section_offset, pass down the addend and use the returned
16654         value.
16655         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
16656         Update declarations of local_section_offset and symbol_value.
16657         * testsuite/two_file_test_1.cc (t18): New function.
16658         * testsuite/two_file_test_2.cc (f18): New function.
16659         * testsuite/two_file_test_main.cc (main): Call t18.
16660         * testsuite/two_file_test.h (t18, f18): Declare.
16661
16662         * configure.ac: Don't test for objdump, c++filt, or readelf.
16663         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
16664         conditionals.
16665         (TEST_READELF): New variable.
16666         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
16667         (check_PROGRAMS): Add two_file_strip_test.
16668         (two_file_strip_test): New target.
16669         (check_PROGRAMS): Add two_file_same_shared_strip_test.
16670         (two_file_same_shared_strip_test_SOURCES): New variable.
16671         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
16672         (two_file_same_shared_strip_test_LDFLAGS): New variable.
16673         (two_file_same_shared_strip_test_LDADD): New variable.
16674         (two_file_shared_strip.so): New target.
16675         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
16676         (ver_test_5.syms, ver_test_7.syms): Likewise.
16677         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
16678         (strip_test_3.stdout): Use TEST_OBJDUMP.
16679         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16680
16681 2008-04-04  Cary Coutant  <ccoutant@google.com>
16682
16683         * symtab.h (Symbol::is_weak_undefined): New function.
16684         (Symbol::is_strong_undefined): New function.
16685         (Symbol::is_absolute): New function.
16686         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
16687         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
16688         absolute symbols.
16689         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
16690         (weak_undef_test): New target.
16691         * testsuite/Makefile.in: Rebuild.
16692         * testsuite/weak_undef_file1.cc: New file.
16693         * testsuite/weak_undef_file2.cc: New file.
16694         * testsuite/weak_undef_test.cc: New file.
16695
16696 2008-04-03  Craig Silverstein  <csilvers@google.com>
16697
16698         * compressed_output.h (class Output_compressed_section): Use
16699         unsigned buffer.
16700         * compressed_output.cc (zlib_compress): Use unsigned buffers,
16701         add zlib header.
16702         (zlib_compressed_suffix): Removed.
16703         (Output_compressed_section::set_final_data_size): Use unsigned
16704         buffers.
16705         * testsuite/Makefile.am (flagstest_compress_debug_sections):
16706         Fix linker invocation.
16707         (flagstest_o_specialfile_and_compress_debug_sections):
16708         Likewise.
16709         * testsuite/Makefile.in: Regenerated.
16710
16711 2008-04-02  David S. Miller  <davem@davemloft.net>
16712
16713         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
16714         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
16715
16716 2008-04-02  Craig Silverstein  <csilvers@google.com>
16717
16718         * TODO: New file.
16719
16720 2008-04-02  Ian Lance Taylor  <iant@google.com>
16721
16722         * fileread.cc (File_read::find_view): Add byteshift and vshifted
16723         parameters.  Update for new key type to views_.  Change all
16724         callers.
16725         (File_read::read): Adjust for byteshift in returned view.
16726         (File_read::add_view): New function, broken out of
16727         find_and_make_view.
16728         (File_read::make_view): New function, broken out of
16729         find_and_make_view.
16730         (File_read::find_or_make_view): Add offset and aligned
16731         parameters.  Rewrite accordingly.  Change all callers.
16732         (File_read::get_view): Add offset and aligned parameters.  Adjust
16733         for byteshift in return value.
16734         (File_read::get_lasting_view): Likewise.
16735         * fileread.h (class File_read): Update declarations.
16736         (class File_read::View): Add byteshift_ field.  Add byteshift to
16737         constructor.  Add byteshift method.
16738         * archive.h (Archive::clear_uncached_views): New function.
16739         (Archive::get_view): Add aligned parameter.  Change all callers.
16740         * object.h (Object::get_view): Add aligned parameter.  Change all
16741         callers.
16742         (Object::get_lasting_view): Likewise.
16743
16744         * fileread.cc (File_read::release): Don't call clear_views if
16745         there are multiple objects.
16746         * fileread.h (File_read::clear_uncached_views): New function.
16747         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
16748         on the archive.
16749
16750 2008-03-31  Cary Coutant  <ccoutant@google.com>
16751
16752         Add thin archive support.
16753         * archive.cc (Archive::armagt): New const.
16754         (Archive::setup): Remove task parameter and calls to unlock.
16755         (Archive::unlock_nested_archives): New function.
16756         (Archive::read_header): Add nested_off parameter. Change
16757         all callers.
16758         (Archive::interpret_header): Likewise.
16759         (Archive::include_all_members): Change to handle thin
16760         archives.
16761         (Archive::include_member): Likewise.
16762         * archive.h (Archive::Archive): Add new parameters and
16763         initializers.
16764         (Archive::armagt): New const.
16765         (Archive::setup): Remove task parameter.
16766         (Archive::unlock_nested_archives): New function.
16767         (Archive::read_header): Add nested_off parameter.
16768         (Archive::interpret_header): Likewise.
16769         (Archive::Nested_archive_table): New typedef.
16770         (Archive::is_thin_archive_): New field.
16771         (Archive::nested_archives_): New field.
16772         (Archive::options_): New field.
16773         (Archive::dirpath_): New field.
16774         (Archive::task_): New field.
16775         * readsyms.cc (Read_symbols::do_read_symbols): Add check
16776         for thin archives.  Pass additional parameters to
16777         Archive::Archive.  Unlock the archive file after calling
16778         Archive::setup.
16779
16780 2008-03-29  Ian Lance Taylor  <iant@google.com>
16781
16782         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
16783         version symbol to be local.
16784         * testsuite/ver_test_4.sh: New file.
16785         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
16786         (check_DATA): Add ver_test_4.syms.
16787         (ver_test_4.syms): New target.
16788         * testsuite/Makefile.in: Rebuild.
16789
16790         * output.cc
16791         (Output_section::Input_section_sort_entry::has_priority): New
16792         function.
16793         (Output_section::Input_section_sort_entry::match_file_name): New
16794         function.
16795         (Output_section::Input_section_sort_entry::match_section_name):
16796         Remove.
16797         (Output_section::Input_section_sort_entry::match_section_name_prefix):
16798         Remove.
16799         (Output_section::Input_section_sort_entry::match_section_file):
16800         Remove.
16801         (Output_section::Input_section_sort_compare::operator()): Rewrite
16802         using new Input_section_sort_entry functions.  Sort crtbegin and
16803         crtend first.  Sort sections with no priority before sections with
16804         a priority.
16805         * testsuite/initpri1.c (d3): Check j != 4.
16806         (cd5): New constructor/destructor function.
16807         (main): Check j != 2.
16808
16809         * symtab.cc (Symbol_table::add_from_object): If we don't use the
16810         new symbol when resolving, don't call set_is_default.
16811         * testsuite/ver_test_7.cc: New file.
16812         * testsuite/ver_test_7.sh: New file.
16813         * testsuite/Makefile.am (ver_test_7.so): New target.
16814         (ver_test_7.o): New target.
16815         (check_SCRIPTS): Add ver_test_7.sh.
16816         (check_DATA): Add ver_test_7.syms.
16817         (ver_test_7.syms): New target.
16818
16819 2008-03-28  Ian Lance Taylor  <iant@google.com>
16820
16821         * layout.cc (Layout::layout): If we see an input section with a
16822         name that needs sorting, set the must_sort flag for the output
16823         section.
16824         (Layout::make_output_section): If the name of the output section
16825         indicates that it might require sorting, set the may_sort flag.
16826         * output.h (Output_section::may_sort_attached_input_sections): New
16827         function.
16828         (Output_section::set_may_sort_attached_input_sections): New
16829         function.
16830         (Output_section::must_sort_attached_input_sections): New
16831         function.
16832         (Output_section::set_must_sort_attached_input_sections): New
16833         function.
16834         (class Output_section): Declare Input_section_sort_entry.  Define
16835         Input_section_sort_compare.  Declare
16836         sort_attached_input_sections.  Add new fields:
16837         may_sort_attached_input_sections_,
16838         must_sort_attached_input_sections_,
16839         attached_input_sections_are_sorted_.
16840         * output.cc (Output_section::Output_section): Initialize new
16841         fields.
16842         (Output_section::add_input_section): Add an entry to
16843         input_sections_ if may_sort or must_sort are true.
16844         (Output_section::set_final_data_size): Call
16845         sort_attached_input_sections if necessary.
16846         (Output_section::Input_section_sort_entry): Define new class.
16847         (Output_section::Input_section_sort_compare::operator()): New
16848         function.
16849         (Output_section::sort_attached_input_sections): New function.
16850         * configure.ac: Check whether the compiler supports constructor
16851         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
16852         * testsuite/initpri1.c: New file.
16853         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
16854         CONSTRUCTOR_PRIORITY.
16855         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
16856         (initpri1_LDFLAGS): New variable.
16857         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16858
16859 2008-03-27  Ian Lance Taylor  <iant@google.com>
16860
16861         * common.cc (Sort_commons::operator): Correct sorting algorithm.
16862         * testsuite/common_test_1.c: New file.
16863         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
16864         (common_test_1_SOURCES): New variable.
16865         (common_test_1_DEPENDENCIES): New variable.
16866         (common_test_1_LDFLAGS): New variable.
16867
16868         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
16869         and commons_ correctly when NAME/VERSION does not override
16870         NAME/NULL.
16871         * testsuite/ver_test_6.c: New file.
16872         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
16873         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
16874         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
16875
16876 2008-03-26  Ian Lance Taylor  <iant@google.com>
16877
16878         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
16879         of an undefined symbol from a version script.
16880         * testsuite/Makefile.am (ver_test_5.so): New target.
16881         (ver_test_5.o): New target.
16882         (check_SCRIPTS): Add ver_test_5.sh.
16883         (check_DATA): Add ver_test_5.syms.
16884         (ver_test_5.syms): New target.
16885         * testsuite/ver_test_5.cc: New file.
16886         * testsuite/ver_test_5.script: New file.
16887         * testsuite/ver_test_5.sh: New file.
16888         * Makefile.in, testsuite/Makefile.in: Rebuild.
16889
16890         PR gold/5986
16891         Fix problems building gold with gcc 4.3.0.
16892         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
16893         (gold_error_at_location, gold_warning_at_location): Use it.
16894         * configure.ac: Check whether we can compile and use a template
16895         function with a printf attribute.
16896         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
16897         when jumping over bytes.
16898         * object.cc: Instantiate Object::read_section_data.
16899         * debug.h: Include <cstring>
16900         * dwarf_reader.cc: Include <algorithm>
16901         * main.cc: Include <cstring>.
16902         * options.cc: Include <cstring>.
16903         * output.cc: Include <cstring>.
16904         * script.cc: Include <cstring>.
16905         * script.h: Include <string>.
16906         * symtab.cc: Include <cstring> and <algorithm>.
16907         * target-select.cc: Include <cstring>.
16908         * version.cc: Include <string>.
16909         * testsuite/testmain.cc: Include <cstdlib>.
16910         * configure, config.in: Rebuild.
16911
16912 2008-03-25  Ian Lance Taylor  <iant@google.com>
16913
16914         * options.cc: Include "../bfd/bfdver.h".
16915         (options::help): Print bug reporting address.
16916
16917         * version.cc (print_version): Adjust output for current value of
16918         BFD_VERSION_STRING.
16919
16920         * NEWS: New file.
16921
16922         * options.cc (options::help): Print list of supported targets.
16923         * target-select.h: Include <vector>.
16924         (class Target_selector): Make machine_, size_, and is_big_endian_
16925         fields const.  Add bfd_name_ and instantiated_target_ fields.
16926         (Target_selector::Target_selector): Add bfd_name parameter.
16927         (Target_selector::recognize): Make non-virtual, call
16928         do_recognize.
16929         (Target_selector::recognize_by_name): Make non-virtual, call
16930         do_recognize_by_name.
16931         (Target_selector::supported_names): New function.
16932         (Target_selector::bfd_name): New function.
16933         (Target_selector::do_instantiate_target): New pure virtual
16934         function.
16935         (Target_selector::do_recognize): New virtual function.
16936         (Target_selector::do_recognize_by_name): New virtual function.
16937         (Target_selector::instantiate_target): New private function.
16938         (supported_target_names): Declare.
16939         * target-select.cc (Target_selector::Target_selector): Update for
16940         new parameter and fields.
16941         (select_target_by_name): Check that the name matches before
16942         calling recognize_by_name.
16943         (supported_target_names): New function.
16944         * i386.cc (class Target_selector_i386): Update Target_selector
16945         constructor call.  Remove recognize and recognize_by_name.  Add
16946         do_instantiate_target.
16947         * x86_64.cc (class Target_selector_x86_64): Likewise.
16948         * testsuite/testfile.cc (class Target_selector_test): Update for
16949         changes to Target_selector.
16950
16951         * README: Rewrite, with some notes on unsupported features.
16952
16953 2008-03-24  Cary Coutant  <ccoutant@google.com>
16954
16955         * i386.cc (Target_i386::Got_type): New enum declaration.
16956         (Target_i386::Scan::local): Updated callers of Output_data_got
16957         member functions.
16958         (Target_i386::Scan::global): Likewise.
16959         (Target_i386::Relocate::relocate): Likewise.
16960         (Target_i386::Relocate::relocate_tls): Likewise.
16961         * object.h (Got_offset_list): New class.
16962         (Sized_relobj::local_has_got_offset): Added got_type parameter.
16963         (Sized_relobj::local_got_offset): Likewise.
16964         (Sized_relobj::set_local_got_offset): Likewise.
16965         (Sized_relobj::local_has_tls_got_offset): Removed.
16966         (Sized_relobj::local_tls_got_offset): Removed.
16967         (Sized_relobj::set_local_tls_got_offset): Removed.
16968         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16969         * output.cc (Output_data_got::add_global): Added got_type parameter.
16970         (Output_data_got::add_global_with_rel): Likewise.
16971         (Output_data_got::add_global_with_rela): Likewise.
16972         (Output_data_got::add_global_pair_with_rel): New function.
16973         (Output_data_got::add_global_pair_with_rela): New function.
16974         (Output_data_got::add_local): Added got_type parameter.
16975         (Output_data_got::add_local_with_rel): Likewise.
16976         (Output_data_got::add_local_with_rela): Likewise.
16977         (Output_data_got::add_local_pair_with_rel): New function.
16978         (Output_data_got::add_local_pair_with_rela): New function.
16979         (Output_data_got::add_global_tls): Removed.
16980         (Output_data_got::add_global_tls_with_rel): Removed.
16981         (Output_data_got::add_global_tls_with_rela): Removed.
16982         (Output_data_got::add_local_tls): Removed.
16983         (Output_data_got::add_local_tls_with_rel): Removed.
16984         (Output_data_got::add_local_tls_with_rela): Removed.
16985         * output.h (Output_data_got::add_global): Added got_type parameter.
16986         (Output_data_got::add_global_with_rel): Likewise.
16987         (Output_data_got::add_global_with_rela): Likewise.
16988         (Output_data_got::add_global_pair_with_rel): New function.
16989         (Output_data_got::add_global_pair_with_rela): New function.
16990         (Output_data_got::add_local): Added got_type parameter.
16991         (Output_data_got::add_local_with_rel): Likewise.
16992         (Output_data_got::add_local_with_rela): Likewise.
16993         (Output_data_got::add_local_pair_with_rel): New function.
16994         (Output_data_got::add_local_pair_with_rela): New function.
16995         (Output_data_got::add_global_tls): Removed.
16996         (Output_data_got::add_global_tls_with_rel): Removed.
16997         (Output_data_got::add_global_tls_with_rela): Removed.
16998         (Output_data_got::add_local_tls): Removed.
16999         (Output_data_got::add_local_tls_with_rel): Removed.
17000         (Output_data_got::add_local_tls_with_rela): Removed.
17001         * resolve.cc (Symbol::override_base_with_special): Removed
17002         reference to has_got_offset_ field.
17003         * symtab.cc (Symbol::init_fields): Replaced initialization
17004         of got_offset_ with got_offsets_.  Removed initialization
17005         of has_got_offset_
17006         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
17007         (Symbol::got_offset): Likewise.
17008         (Symbol::set_got_offset): Likewise.
17009         (Symbol::has_tls_got_offset): Removed.
17010         (Symbol::tls_got_offset): Removed.
17011         (Symbol::set_tls_got_offset): Removed.
17012         (Symbol::got_offset_): Removed.
17013         (Symbol::tls_mod_got_offset_): Removed.
17014         (Symbol::tls_pair_got_offset_): Removed.
17015         (Symbol::got_offsets_): New field.
17016         (Symbol::has_got_offset): Removed.
17017         (Symbol::has_tls_mod_got_offset): Removed.
17018         (Symbol::has_tls_pair_got_offset): Removed.
17019         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
17020         (Target_x86_64::Scan::local): Updated callers of Output_data_got
17021         member functions.
17022         (Target_x86_64::Scan::global): Likewise.
17023         (Target_x86_64::Relocate::relocate): Likewise.
17024         (Target_x86_64::Relocate::relocate_tls): Likewise.
17025
17026 2008-03-25  Ben Elliston  <bje@au.ibm.com>
17027
17028         * yyscript.y: Fix spelling error in comment.
17029
17030 2008-03-24  Ian Lance Taylor  <iant@google.com>
17031
17032         * options.h (class General_options): Define build_id option.
17033         * layout.h (class Layout): Declare write_build_id, create_note,
17034         create_build_id.  Add build_id_note_ member.
17035         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
17036         "libiberty.h", "md5.h", "sha1.h".
17037         (Layout::Layout): Initialize eh_frame_data_,
17038         eh_frame_hdr_section_, and build_id_note_.
17039         (Layout::finalize): Call create_build_id.
17040         (Layout::create_note): New function, broken out of
17041         Layout::create_gold_note.
17042         (Layout::create_gold_note): Call create_note.
17043         (Layout::create_build_id): New function.
17044         (Layout::write_build_id): New function.
17045         (Close_task_runner::run): Call write_build_id.
17046
17047         * x86_64.cc: Correct license to GPLv3.
17048
17049 2008-03-23  Ian Lance Taylor  <iant@google.com>
17050
17051         * options.cc: Include "demangle.h".
17052         (parse_optional_string): New function.
17053         (parse_long_option): Handle takes_optional_argument.
17054         (parse_short_option): Update dash_z initializer.  Handle
17055         takes_optional_argument.
17056         (General_options::General_options): Initialize do_demangle_.
17057         (General_options::finalize): Set do_demangle_.  Handle demangling
17058         style.
17059         * options.h (parse_optional_string): Declare.
17060         (struct One_option): Add optional_arg field.  Update constructor.
17061         Update call constructor calls.  Add takes_optional_argument
17062         function.
17063         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
17064         (DEFINE_optional_string): Define.
17065         (General_options::demangle): Change from DEFINE_bool to
17066         DEFINE_optional_string.
17067         (General_options::no_demangle): New function.
17068         (General_options::do_demangle): New function.
17069         (General_options::set_do_demangle): New function.
17070         (General_options::execstack_status_): Move definition to end of
17071         class definition.
17072         (General_options::static_): Likewise.
17073         (General_options::do_demangle_): New field.
17074         * object.cc (big_endian>::get_symbol_location_info): Call
17075         Options::do_demangle, not Options::demangle.
17076         * symtab.cc (demangle): Likewise.
17077
17078 2008-03-22  Ian Lance Taylor  <iant@google.com>
17079
17080         * gold.h: Include <cstddef> and <sys/types.h>
17081         * options.h: Include <cstring>.
17082
17083 2008-03-21  Ian Lance Taylor  <iant@google.com>
17084
17085         * Added source code to GNU binutils.
17086 \f
17087 Copyright (C) 2008-2015 Free Software Foundation, Inc.
17088
17089 Copying and distribution of this file, with or without modification,
17090 are permitted in any medium without royalty provided the copyright
17091 notice and this notice are preserved.
17092
17093 Local Variables:
17094 mode: change-log
17095 left-margin: 8
17096 fill-column: 74
17097 version-control: never
17098 End: